From 133a96bca69670625d83b153356f093aa94a7939 Mon Sep 17 00:00:00 2001 From: Melwyn Saldanha Date: Sat, 6 Feb 2021 16:23:23 +0530 Subject: [PATCH] make flow-parser working with laters code --- esy.lock/.gitattributes | 2 +- esy.lock/.gitignore | 1 + esy.lock/index.json | 537 +- esy.lock/opam/conf-m4.1/opam | 2 +- esy.lock/opam/{cppo.1.6.6 => cppo.1.6.7}/opam | 12 +- esy.lock/opam/csexp.1.3.2/opam | 58 + esy.lock/opam/dot-merlin-reader.3.4.2/opam | 28 + esy.lock/opam/dune-configurator.2.8.2/opam | 47 + .../opam/{dune.1.11.3 => dune.2.8.2}/opam | 39 +- esy.lock/opam/gen.0.5.2/opam | 29 - esy.lock/opam/gen.0.5.3/opam | 30 + .../opam/{merlin.3.3.2 => merlin.3.4.2}/opam | 18 +- .../opam | 7 +- esy.lock/opam/ocamlbuild.0.14.0/opam | 36 + esy.lock/opam/ppx_derivers.1.2.1/opam | 2 +- esy.lock/opam/ppx_deriving.4.5/opam | 35 + esy.lock/opam/ppx_gen_rec.1.1.0/opam | 27 + esy.lock/opam/ppx_tools.6.3/opam | 24 + esy.lock/opam/ppx_tools_versioned.5.4.0/opam | 27 + esy.lock/opam/ppxfind.1.4/opam | 41 + esy.lock/opam/{result.1.4 => result.1.5}/opam | 6 +- esy.lock/opam/sedlex.2.2/opam | 38 + esy.lock/opam/uchar.0.0.2/opam | 36 + .../package.json | 6 + .../package.json | 14 - .../files/ocamlbuild-0.14.0.patch | 463 + .../package.json | 27 + lib/.gitignore | 8 + lib/META | 6 + lib/Makefile | 129 + lib/__tests__/offset_utils_test.ml | 193 + lib/__tests__/parser_tests.ml | 12 + lib/ast.ml | 1132 -- lib/ast_utils.ml | 68 - lib/ast_utils.mli | 31 - lib/comment_attachment.ml | 772 ++ lib/declaration_parser.ml | 626 +- lib/dune | 4 +- lib/enum_common.ml | 19 + lib/enum_parser.ml | 410 + lib/estree_translator.ml | 3237 +++-- lib/expression_parser.ml | 2206 +-- lib/file_key.ml | 57 +- lib/flow_ast.ml | 1866 +++ lib/flow_ast_mapper.ml | 2431 ++++ lib/flow_ast_utils.ml | 232 + lib/flow_ast_utils.mli | 119 + lib/flow_lexer.ml | 1796 +++ lib/flow_parser_dot_js.ml | 25 +- lib/flow_parser_js.ml | 179 +- lib/jsx_parser.ml | 686 +- lib/lex_env.ml | 88 +- lib/lex_result.ml | 25 +- lib/lexer.ml | 1794 --- lib/libflowparser.h | 5 +- lib/libflowparser.ml | 108 +- lib/loc.ml | 137 +- lib/loc.mli | 51 +- lib/object_parser.ml | 1497 ++- lib/offset_utils.ml | 145 + lib/offset_utils.mli | 52 + lib/parse_error.ml | 510 +- lib/parser_common.ml | 277 +- lib/parser_env.ml | 1083 +- lib/parser_env.mli | 139 +- lib/parser_flow.ml | 418 +- lib/pattern_cover.ml | 45 +- lib/pattern_parser.ml | 524 +- lib/relativeLoc.ml | 48 + lib/relativeLoc.mli | 27 + lib/statement_parser.ml | 3189 +++-- .../esprima/ES2016/exponent/exp_assign.js | 1 + .../ES2016/exponent/exp_assign.tree.json | 165 + .../esprima/ES2016/exponent/exp_bitnot.js | 1 + .../ES2016/exponent/exp_bitnot.tree.json | 184 + .../esprima/ES2016/exponent/exp_delete.js | 1 + .../ES2016/exponent/exp_delete.tree.json | 184 + lib/test/esprima/ES2016/exponent/exp_minus.js | 1 + .../ES2016/exponent/exp_minus.tree.json | 184 + .../esprima/ES2016/exponent/exp_minusminus.js | 1 + .../ES2016/exponent/exp_minusminus.tree.json | 184 + lib/test/esprima/ES2016/exponent/exp_not.js | 1 + .../esprima/ES2016/exponent/exp_not.tree.json | 184 + .../esprima/ES2016/exponent/exp_operator.js | 1 + .../ES2016/exponent/exp_operator.tree.json | 147 + lib/test/esprima/ES2016/exponent/exp_plus.js | 1 + .../ES2016/exponent/exp_plus.tree.json | 184 + .../esprima/ES2016/exponent/exp_plusplus.js | 1 + .../ES2016/exponent/exp_plusplus.tree.json | 184 + .../esprima/ES2016/exponent/exp_precedence.js | 1 + .../ES2016/exponent/exp_precedence.tree.json | 256 + .../esprima/ES2016/exponent/exp_typeof.js | 1 + .../ES2016/exponent/exp_typeof.tree.json | 184 + lib/test/esprima/ES2016/exponent/exp_void.js | 1 + .../ES2016/exponent/exp_void.tree.json | 184 + .../exponent/invalid_bitnot_exp.failure.json | 1 + .../ES2016/exponent/invalid_bitnot_exp.js | 1 + .../exponent/invalid_delete_exp.failure.json | 1 + .../ES2016/exponent/invalid_delete_exp.js | 1 + .../exponent/invalid_minus_exp.failure.json | 1 + .../ES2016/exponent/invalid_minus_exp.js | 1 + .../exponent/invalid_not_exp.failure.json | 1 + .../ES2016/exponent/invalid_not_exp.js | 1 + .../exponent/invalid_plus_exp.failure.json | 1 + .../ES2016/exponent/invalid_plus_exp.js | 1 + .../exponent/invalid_typeof_exp.failure.json | 1 + .../ES2016/exponent/invalid_typeof_exp.js | 1 + .../esprima/ES2016/exponent/invalid_update.js | 1 + .../ES2016/exponent/invalid_update.tree.json | 437 + .../exponent/invalid_void_exp.failure.json | 1 + .../ES2016/exponent/invalid_void_exp.js | 1 + .../esprima/ES2016/exponent/update_exp.js | 1 + .../ES2016/exponent/update_exp.tree.json | 437 + .../esprima/ES2016/identifier/gujarati_zha.js | 2 + .../ES2016/identifier/gujarati_zha.tree.json | 75 + .../array-binding-pattern-01.js | 1 + .../array-binding-pattern-01.tree.json | 316 + .../array-binding-pattern-02.js | 1 + .../array-binding-pattern-02.tree.json | 315 + .../array-binding-pattern-03.js | 1 + .../array-binding-pattern-03.tree.json | 350 + .../array-binding-pattern-empty.js | 1 + .../array-binding-pattern-empty.tree.json | 224 + .../array-binding-pattern/elision.js | 1 + .../array-binding-pattern/elision.tree.json | 245 + .../invalid-dup-param.failure.json | 1 + .../invalid-dup-param.js | 1 + .../invalid-elision-after-rest.failure.json | 1 + .../invalid-elision-after-rest.js | 1 + .../arrow-rest-forgetting-comma.failure.json | 1 + .../arrow-rest-forgetting-comma.js | 1 + .../arrow-with-multiple-arg-and-rest.js | 1 + ...arrow-with-multiple-arg-and-rest.tree.json | 349 + .../arrow-with-multiple-rest.failure.json | 1 + .../arrow-with-multiple-rest.js | 1 + .../arrow-function/arrow-with-only-rest.js | 1 + .../arrow-with-only-rest.tree.json | 223 + ...lex-rest-in-arrow-not-allowed.failure.json | 1 + .../complex-rest-in-arrow-not-allowed.js | 1 + .../invalid-duplicated-params.failure.json | 1 + .../invalid-duplicated-params.js | 1 + ...invalid-line-terminator-arrow.failure.json | 1 + .../invalid-line-terminator-arrow.js | 2 + .../invalid-param-strict-mode.failure.json | 1 + .../invalid-param-strict-mode.js | 1 + .../ES6/arrow-function/migrated_0000.js | 1 + .../arrow-function/migrated_0000.tree.json | 151 + .../ES6/arrow-function/migrated_0001.js | 1 + .../arrow-function/migrated_0001.tree.json | 152 + .../ES6/arrow-function/migrated_0002.js | 1 + .../arrow-function/migrated_0002.tree.json | 188 + .../ES6/arrow-function/migrated_0003.js | 1 + .../arrow-function/migrated_0003.tree.json | 242 + .../ES6/arrow-function/migrated_0004.js | 1 + .../arrow-function/migrated_0004.tree.json | 242 + .../ES6/arrow-function/migrated_0005.js | 1 + .../arrow-function/migrated_0005.tree.json | 318 + .../ES6/arrow-function/migrated_0006.diff | 20 + .../ES6/arrow-function/migrated_0006.js | 1 + .../arrow-function/migrated_0006.tree.json | 295 + .../ES6/arrow-function/migrated_0007.js | 1 + .../arrow-function/migrated_0007.tree.json | 332 + .../ES6/arrow-function/migrated_0008.diff | 13 + .../ES6/arrow-function/migrated_0008.js | 1 + .../arrow-function/migrated_0008.tree.json | 332 + .../ES6/arrow-function/migrated_0009.js | 1 + .../arrow-function/migrated_0009.tree.json | 152 + .../ES6/arrow-function/migrated_0010.js | 1 + .../arrow-function/migrated_0010.tree.json | 152 + .../ES6/arrow-function/migrated_0011.js | 1 + .../arrow-function/migrated_0011.tree.json | 188 + .../ES6/arrow-function/migrated_0012.js | 1 + .../arrow-function/migrated_0012.tree.json | 242 + .../ES6/arrow-function/migrated_0013.diff | 13 + .../ES6/arrow-function/migrated_0013.js | 1 + .../arrow-function/migrated_0013.tree.json | 261 + .../ES6/arrow-function/migrated_0014.diff | 13 + .../ES6/arrow-function/migrated_0014.js | 1 + .../arrow-function/migrated_0014.tree.json | 315 + .../ES6/arrow-function/migrated_0015.js | 1 + .../arrow-function/migrated_0015.tree.json | 187 + .../ES6/arrow-function/migrated_0016.js | 1 + .../arrow-function/migrated_0016.tree.json | 228 + .../ES6/arrow-function/migrated_0017.js | 1 + .../arrow-function/migrated_0017.tree.json | 552 + .../ES6/arrow-function/migrated_0018.js | 1 + .../arrow-function/migrated_0018.tree.json | 259 + .../ES6/arrow-function/migrated_0019.js | 1 + .../arrow-function/migrated_0019.tree.json | 350 + .../ES6/arrow-function/migrated_0020.js | 1 + .../arrow-function/migrated_0020.tree.json | 187 + ...arrow-param-followed-by-arrow.failure.json | 1 + .../non-arrow-param-followed-by-arrow.js | 1 + ...-arrow-param-followed-by-rest.failure.json | 1 + .../non-arrow-param-followed-by-rest.js | 1 + .../invalid-member-expr.failure.json | 1 + .../invalid-member-expr.js | 1 + .../invalid-method-in-pattern.failure.json | 1 + .../invalid-method-in-pattern.js | 1 + .../invalid-nested-param.failure.json | 1 + .../invalid-nested-param.js | 1 + ...d-pattern-without-parenthesis.failure.json | 1 + .../invalid-pattern-without-parenthesis.js | 1 + ...nvalid-rest-in-object-pattern.failure.json | 1 + .../invalid-rest-in-object-pattern.js | 1 + .../nested-cover-grammar.js | 1 + .../nested-cover-grammar.tree.json | 1471 ++ .../object-binding-pattern-01.js | 1 + .../object-binding-pattern-01.tree.json | 813 ++ .../object-binding-pattern-empty.js | 1 + .../object-binding-pattern-empty.tree.json | 224 + ...param-with-rest-without-arrow.failure.json | 1 + .../param-with-rest-without-arrow.js | 1 + .../rest-without-arrow.failure.json | 1 + .../ES6/arrow-function/rest-without-arrow.js | 1 + .../binary-integer-literal/migrated_0000.js | 1 + .../migrated_0000.tree.json | 76 + .../binary-integer-literal/migrated_0001.js | 1 + .../migrated_0001.tree.json | 76 + .../binary-integer-literal/migrated_0002.js | 1 + .../migrated_0002.tree.json | 76 + .../binary-integer-literal/migrated_0003.js | 1 + .../migrated_0003.tree.json | 76 + .../binary-integer-literal/migrated_0004.js | 1 + .../migrated_0004.tree.json | 76 + .../binary-integer-literal/migrated_0005.js | 1 + .../migrated_0005.tree.json | 76 + .../array-pattern/dupe-param.diff | 31 + .../array-pattern/dupe-param.js | 4 + .../array-pattern/dupe-param.tree.json | 1209 ++ .../binding-pattern/array-pattern/elision.js | 1 + .../array-pattern/elision.tree.json | 259 + .../empty-pattern-catch-param.js | 1 + .../empty-pattern-catch-param.tree.json | 291 + .../array-pattern/empty-pattern-fn.js | 1 + .../array-pattern/empty-pattern-fn.tree.json | 241 + .../array-pattern/empty-pattern-lexical.js | 1 + .../empty-pattern-lexical.tree.json | 221 + .../array-pattern/empty-pattern-var.js | 1 + .../array-pattern/empty-pattern-var.tree.json | 204 + .../array-pattern/for-let-let.js | 1 + .../array-pattern/for-let-let.skip | 1 + .../array-pattern/for-let-let.tree.json | 403 + .../ES6/binding-pattern/array-pattern/hole.js | 1 + .../array-pattern/hole.tree.json | 296 + .../invalid-strict-for-let-let.failure.json | 1 + .../invalid-strict-for-let-let.js | 1 + .../array-pattern/nested-pattern.js | 1 + .../array-pattern/nested-pattern.tree.json | 241 + .../patterned-catch-dupe.failure.json | 7 + .../array-pattern/patterned-catch-dupe.js | 1 + .../array-pattern/patterned-catch.js | 1 + .../array-pattern/patterned-catch.tree.json | 1132 ++ .../array-pattern/rest.elision.failure.json | 7 + .../array-pattern/rest.elision.js | 1 + .../ES6/binding-pattern/array-pattern/rest.js | 1 + .../array-pattern/rest.tree.json | 276 + .../array-pattern/tailing-hold.js | 1 + .../array-pattern/tailing-hold.tree.json | 260 + .../array-pattern/var-for-in.js | 1 + .../array-pattern/var-for-in.tree.json | 384 + .../array-pattern/var_let_array.js | 1 + .../array-pattern/var_let_array.tree.json | 240 + ...with-default-catch-param-fail.failure.json | 7 + .../with-default-catch-param-fail.js | 1 + .../array-pattern/with-default-catch-param.js | 1 + .../with-default-catch-param.tree.json | 400 + .../array-pattern/with-default-fn.js | 1 + .../array-pattern/with-default-fn.tree.json | 350 + .../array-pattern/with-object-pattern.js | 1 + .../with-object-pattern.tree.json | 317 + .../binding-pattern/object-pattern/elision.js | 1 + .../object-pattern/elision.tree.json | 280 + .../object-pattern/empty-catch-param.js | 1 + .../empty-catch-param.tree.json | 291 + .../object-pattern/empty-fn.js | 1 + .../object-pattern/empty-fn.tree.json | 241 + .../object-pattern/empty-for-lex.js | 1 + .../object-pattern/empty-for-lex.tree.json | 294 + .../object-pattern/empty-lexical.js | 1 + .../object-pattern/empty-lexical.tree.json | 186 + .../object-pattern/empty-var.js | 1 + .../object-pattern/empty-var.tree.json | 186 + .../object-pattern/for-let-let.js | 1 + .../object-pattern/for-let-let.skip | 1 + .../object-pattern/for-let-let.tree.json | 478 + .../invalid-strict-for-let-let.failure.json | 1 + .../invalid-strict-for-let-let.js | 1 + .../binding-pattern/object-pattern/nested.js | 1 + .../object-pattern/nested.tree.json | 316 + .../object-pattern/properties.js | 1 + .../object-pattern/properties.tree.json | 977 ++ .../object-pattern/var-for-in.js | 1 + .../object-pattern/var-for-in.tree.json | 462 + lib/test/esprima/ES6/class/migrated_0000.js | 1 + .../esprima/ES6/class/migrated_0000.tree.json | 148 + lib/test/esprima/ES6/class/migrated_0001.js | 1 + .../esprima/ES6/class/migrated_0001.tree.json | 202 + lib/test/esprima/ES6/class/migrated_0002.js | 1 + .../esprima/ES6/class/migrated_0002.tree.json | 166 + lib/test/esprima/ES6/class/migrated_0003.js | 1 + .../esprima/ES6/class/migrated_0003.tree.json | 184 + lib/test/esprima/ES6/class/migrated_0004.js | 1 + .../esprima/ES6/class/migrated_0004.tree.json | 316 + lib/test/esprima/ES6/class/migrated_0005.js | 1 + .../esprima/ES6/class/migrated_0005.tree.json | 483 + lib/test/esprima/ES6/class/migrated_0006.js | 1 + .../esprima/ES6/class/migrated_0006.tree.json | 501 + lib/test/esprima/ES6/class/migrated_0007.js | 1 + .../esprima/ES6/class/migrated_0007.tree.json | 519 + lib/test/esprima/ES6/class/migrated_0008.js | 1 + .../esprima/ES6/class/migrated_0008.tree.json | 537 + lib/test/esprima/ES6/class/migrated_0009.js | 1 + .../esprima/ES6/class/migrated_0009.tree.json | 334 + lib/test/esprima/ES6/class/migrated_0010.js | 1 + .../esprima/ES6/class/migrated_0010.tree.json | 574 + lib/test/esprima/ES6/class/migrated_0011.js | 1 + .../esprima/ES6/class/migrated_0011.tree.json | 777 ++ lib/test/esprima/ES6/class/migrated_0012.js | 1 + .../esprima/ES6/class/migrated_0012.tree.json | 352 + lib/test/esprima/ES6/class/migrated_0013.js | 1 + .../esprima/ES6/class/migrated_0013.tree.json | 388 + lib/test/esprima/ES6/class/migrated_0014.js | 1 + .../esprima/ES6/class/migrated_0014.tree.json | 609 + lib/test/esprima/ES6/class/migrated_0015.js | 1 + .../esprima/ES6/class/migrated_0015.tree.json | 352 + lib/test/esprima/ES6/class/migrated_0016.js | 1 + .../esprima/ES6/class/migrated_0016.tree.json | 311 + lib/test/esprima/ES6/class/migrated_0017.js | 1 + .../esprima/ES6/class/migrated_0017.tree.json | 316 + lib/test/esprima/ES6/class/migrated_0018.js | 1 + .../esprima/ES6/class/migrated_0018.tree.json | 316 + lib/test/esprima/ES6/class/migrated_0019.js | 1 + .../esprima/ES6/class/migrated_0019.tree.json | 521 + lib/test/esprima/ES6/class/migrated_0020.js | 1 + .../esprima/ES6/class/migrated_0020.tree.json | 519 + lib/test/esprima/ES6/class/migrated_0021.js | 1 + .../esprima/ES6/class/migrated_0021.tree.json | 371 + lib/test/esprima/ES6/class/migrated_0022.js | 1 + .../esprima/ES6/class/migrated_0022.tree.json | 166 + lib/test/esprima/ES6/class/migrated_0023.js | 1 + .../esprima/ES6/class/migrated_0023.tree.json | 201 + lib/test/esprima/ES6/class/migrated_0024.js | 1 + .../esprima/ES6/class/migrated_0024.tree.json | 220 + lib/test/esprima/ES6/class/migrated_0025.js | 1 + .../esprima/ES6/class/migrated_0025.tree.json | 255 + lib/test/esprima/ES6/class/migrated_0026.diff | 13 + lib/test/esprima/ES6/class/migrated_0026.js | 1 + .../esprima/ES6/class/migrated_0026.tree.json | 361 + .../default-parameter-value/migrated_0000.js | 1 + .../migrated_0000.tree.json | 349 + .../default-parameter-value/migrated_0001.js | 1 + .../migrated_0001.tree.json | 295 + .../default-parameter-value/migrated_0002.js | 1 + .../migrated_0002.tree.json | 479 + .../array-pattern/dup-assignment.js | 1 + .../array-pattern/dup-assignment.tree.json | 383 + .../array-pattern/elision.js | 1 + .../array-pattern/elision.tree.json | 205 + .../array-pattern/member-expr-in-rest.js | 1 + .../member-expr-in-rest.tree.json | 347 + .../array-pattern/nested-assignment.diff | 18 + .../array-pattern/nested-assignment.js | 1 + .../array-pattern/nested-assignment.tree.json | 727 + .../array-pattern/nested-cover-grammar.js | 1 + .../nested-cover-grammar.tree.json | 368 + .../array-pattern/simple-assignment.js | 1 + .../array-pattern/simple-assignment.tree.json | 221 + .../invalid-cover-grammar.failure.json | 1 + .../invalid-cover-grammar.js | 1 + .../invalid-group-assignment.failure.json | 1 + .../invalid-group-assignment.js | 1 + .../empty-object-pattern-assignment.js | 1 + .../empty-object-pattern-assignment.tree.json | 220 + .../invalid-lhs-01.failure.json | 1 + .../object-pattern/invalid-lhs-01.js | 1 + .../invalid-lhs-02.failure.json | 1 + .../object-pattern/invalid-lhs-02.js | 1 + .../invalid-pattern-with-method.failure.json | 1 + .../invalid-pattern-with-method.js | 1 + .../object-pattern/nested-cover-grammar.js | 1 + .../nested-cover-grammar.tree.json | 1522 +++ .../object-pattern-assignment.diff | 17 + .../object-pattern-assignment.js | 8 + .../object-pattern-assignment.tree.json | 1358 ++ .../export-declaration/export-const-number.js | 1 + .../export-const-number.tree.json | 223 + .../export-default-array.js | 1 + .../export-default-array.tree.json | 147 + .../export-default-class.js | 1 + .../export-default-class.tree.json | 166 + .../export-default-expression.js | 1 + .../export-default-expression.tree.json | 239 + .../export-default-function.js | 1 + .../export-default-function.tree.json | 204 + .../export-default-named-function.js | 1 + .../export-default-named-function.tree.json | 239 + .../export-default-number.js | 1 + .../export-default-number.tree.json | 130 + .../export-default-object.js | 1 + .../export-default-object.tree.json | 260 + .../export-default-value.js | 1 + .../export-default-value.tree.json | 129 + .../export-declaration/export-from-batch.js | 1 + .../export-from-batch.tree.json | 148 + .../export-declaration/export-from-default.js | 1 + .../export-from-default.tree.json | 240 + .../export-from-named-as-default.js | 1 + .../export-from-named-as-default.tree.json | 276 + .../export-from-named-as-specifier.js | 1 + .../export-from-named-as-specifier.tree.json | 276 + .../export-from-named-as-specifiers.js | 1 + .../export-from-named-as-specifiers.tree.json | 365 + .../export-from-specifier.js | 1 + .../export-from-specifier.tree.json | 240 + .../export-from-specifiers.js | 1 + .../export-from-specifiers.tree.json | 329 + .../export-function-declaration.js | 1 + .../export-function-declaration.tree.json | 277 + .../ES6/export-declaration/export-function.js | 1 + .../export-function.tree.json | 223 + .../export-declaration/export-let-number.js | 1 + .../export-let-number.tree.json | 223 + .../export-named-as-default.js | 1 + .../export-named-as-default.tree.json | 222 + .../export-named-as-specifier.js | 1 + .../export-named-as-specifier.tree.json | 222 + .../export-named-as-specifiers.js | 1 + .../export-named-as-specifiers.tree.json | 311 + .../export-declaration/export-named-empty.js | 1 + .../export-named-empty.tree.json | 114 + .../export-named-specifier.js | 1 + .../export-named-specifier.tree.json | 186 + .../export-named-specifiers-comma.js | 1 + .../export-named-specifiers-comma.tree.json | 293 + .../export-named-specifiers.js | 1 + .../export-named-specifiers.tree.json | 275 + .../export-var-anonymous-function.js | 1 + .../export-var-anonymous-function.tree.json | 315 + .../export-declaration/export-var-number.js | 1 + .../export-var-number.tree.json | 223 + .../ES6/export-declaration/export-var.js | 1 + .../export-declaration/export-var.tree.json | 169 + ...nvalid-export-batch-missing-from-clause.js | 1 + ...port-batch-missing-from-clause.module.json | 7 + .../invalid-export-batch-token.js | 1 + .../invalid-export-batch-token.module.json | 7 + .../invalid-export-default-equal.js | 1 + .../invalid-export-default-equal.module.json | 7 + .../invalid-export-default-token.js | 1 + .../invalid-export-default-token.module.json | 7 + .../invalid-export-default.js | 1 + .../invalid-export-default.module.json | 7 + .../invalid-export-named-default.js | 1 + .../invalid-export-named-default.module.json | 7 + .../ES6/for-of/for-of-array-pattern-let.js | 1 + .../for-of/for-of-array-pattern-let.tree.json | 383 + .../ES6/for-of/for-of-array-pattern-var.js | 1 + .../for-of/for-of-array-pattern-var.tree.json | 383 + .../ES6/for-of/for-of-array-pattern.js | 1 + .../ES6/for-of/for-of-array-pattern.tree.json | 327 + lib/test/esprima/ES6/for-of/for-of-let.js | 1 + .../esprima/ES6/for-of/for-of-let.tree.json | 237 + .../ES6/for-of/for-of-object-pattern-const.js | 1 + .../for-of-object-pattern-const.tree.json | 461 + .../ES6/for-of/for-of-object-pattern-var.js | 1 + .../for-of-object-pattern-var.tree.json | 461 + .../ES6/for-of/for-of-object-pattern.js | 1 + .../for-of/for-of-object-pattern.tree.json | 405 + .../esprima/ES6/for-of/for-of-with-const.js | 1 + .../ES6/for-of/for-of-with-const.tree.json | 274 + .../esprima/ES6/for-of/for-of-with-let.js | 1 + .../ES6/for-of/for-of-with-let.tree.json | 274 + .../esprima/ES6/for-of/for-of-with-var.js | 1 + .../ES6/for-of/for-of-with-var.tree.json | 274 + lib/test/esprima/ES6/for-of/for-of.js | 1 + lib/test/esprima/ES6/for-of/for-of.tree.json | 218 + .../for-of/invalid-const-init.failure.json | 1 + .../esprima/ES6/for-of/invalid-const-init.js | 1 + .../invalid-for-of-array-pattern.failure.json | 1 + .../for-of/invalid-for-of-array-pattern.js | 1 + ...invalid-for-of-object-pattern.failure.json | 1 + .../for-of/invalid-for-of-object-pattern.js | 1 + .../ES6/for-of/invalid-let-init.failure.json | 1 + .../esprima/ES6/for-of/invalid-let-init.js | 1 + .../ES6/for-of/invalid-lhs-init.failure.json | 1 + .../esprima/ES6/for-of/invalid-lhs-init.js | 1 + .../invalid-strict-for-of-let.failure.json | 1 + .../ES6/for-of/invalid-strict-for-of-let.js | 1 + .../ES6/for-of/invalid-var-init.failure.json | 1 + .../esprima/ES6/for-of/invalid-var-init.js | 1 + .../ES6/for-of/invalid_const_let.failure.json | 1 + .../esprima/ES6/for-of/invalid_const_let.js | 1 + .../ES6/for-of/invalid_let_let.failure.json | 1 + .../esprima/ES6/for-of/invalid_let_let.js | 1 + lib/test/esprima/ES6/for-of/let-of-of.js | 1 + .../esprima/ES6/for-of/let-of-of.tree.json | 274 + .../ES6/for-of/unexpected-number.failure.json | 1 + .../esprima/ES6/for-of/unexpected-number.js | 1 + .../generator-declaration-with-params.js | 1 + ...enerator-declaration-with-params.tree.json | 349 + ...nerator-declaration-with-yield-delegate.js | 1 + ...-declaration-with-yield-delegate.tree.json | 331 + .../generator-declaration-with-yield.js | 1 + ...generator-declaration-with-yield.tree.json | 313 + .../ES6/generator/generator-declaration.js | 1 + .../generator/generator-declaration.tree.json | 204 + .../generator-expression-rest-param.js | 1 + .../generator-expression-rest-param.tree.json | 294 + .../generator-expression-with-params.js | 1 + ...generator-expression-with-params.tree.json | 367 + ...enerator-expression-with-yield-delegate.js | 1 + ...r-expression-with-yield-delegate.tree.json | 493 + .../generator-expression-with-yield.js | 1 + .../generator-expression-with-yield.tree.json | 331 + .../ES6/generator/generator-expression.js | 1 + .../generator/generator-expression.tree.json | 222 + ...tor-method-with-computed-name.failure.json | 1 + .../generator-method-with-computed-name.js | 3 + ...od-with-invalid-computed-name.failure.json | 1 + ...rator-method-with-invalid-computed-name.js | 1 + .../generator/generator-method-with-params.js | 1 + .../generator-method-with-params.tree.json | 461 + .../generator-method-with-yield-delegate.js | 1 + ...rator-method-with-yield-delegate.tree.json | 443 + .../generator-method-with-yield-expression.js | 1 + ...tor-method-with-yield-expression.tree.json | 425 + ...rator-method-with-yield-line-terminator.js | 4 + ...ethod-with-yield-line-terminator.tree.json | 425 + .../generator/generator-method-with-yield.js | 1 + .../generator-method-with-yield.tree.json | 389 + .../esprima/ES6/generator/generator-method.js | 1 + .../ES6/generator/generator-method.tree.json | 316 + ...tor-parameter-binding-element.failure.json | 1 + .../generator-parameter-binding-element.js | 3 + ...ter-binding-property-reserved.failure.json | 1 + ...tor-parameter-binding-property-reserved.js | 1 + ...or-parameter-binding-property.failure.json | 1 + .../generator-parameter-binding-property.js | 3 + ...ameter-computed-property-name.failure.json | 1 + ...erator-parameter-computed-property-name.js | 3 + ...meter-invalid-binding-element.failure.json | 1 + ...rator-parameter-invalid-binding-element.js | 3 + ...eter-invalid-binding-property.failure.json | 1 + ...ator-parameter-invalid-binding-property.js | 3 + ...nvalid-computed-property-name.failure.json | 1 + ...arameter-invalid-computed-property-name.js | 3 + .../incomplete-yield-delegate.failure.json | 1 + .../generator/incomplete-yield-delegate.js | 1 + .../malformed-generator-method-2.failure.json | 1 + .../generator/malformed-generator-method-2.js | 1 + .../malformed-generator-method.failure.json | 1 + .../generator/malformed-generator-method.js | 1 + ...tic-generator-method-with-computed-name.js | 1 + ...erator-method-with-computed-name.tree.json | 388 + .../ES6/generator/static-generator-method.js | 1 + .../static-generator-method.tree.json | 352 + .../ES6/identifier/dakuten_handakuten.js | 1 + .../identifier/dakuten_handakuten.tree.json | 147 + .../esprima/ES6/identifier/escaped_all.js | 1 + .../ES6/identifier/escaped_all.tree.json | 132 + .../ES6/identifier/escaped_math_alef.js | 2 + .../identifier/escaped_math_alef.tree.json | 114 + .../ES6/identifier/escaped_math_dal_part.js | 1 + .../escaped_math_dal_part.tree.json | 114 + .../ES6/identifier/escaped_math_kaf_lam.js | 1 + .../identifier/escaped_math_kaf_lam.tree.json | 114 + .../ES6/identifier/escaped_math_zain_start.js | 1 + .../escaped_math_zain_start.tree.json | 114 + .../esprima/ES6/identifier/escaped_part.js | 1 + .../ES6/identifier/escaped_part.tree.json | 132 + .../esprima/ES6/identifier/escaped_start.js | 1 + .../ES6/identifier/escaped_start.tree.json | 132 + lib/test/esprima/ES6/identifier/estimated.js | 1 + .../ES6/identifier/estimated.tree.json | 114 + .../esprima/ES6/identifier/ethiopic_digits.js | 1 + .../ES6/identifier/ethiopic_digits.tree.json | 114 + ...valid_escaped_surrogate_pairs.failure.json | 1 + .../invalid_escaped_surrogate_pairs.js | 1 + .../identifier/invalid_expression_await.js | 1 + .../invalid_expression_await.module.json | 1 + .../ES6/identifier/invalid_function_wait.js | 1 + .../invalid_function_wait.module.json | 1 + .../identifier/invalid_id_smp.failure.json | 1 + .../esprima/ES6/identifier/invalid_id_smp.js | 1 + .../invalid_lone_surrogate.failure.json | 1 + .../invalid_lone_surrogate.source.js | 1 + .../ES6/identifier/invalid_var_await.js | 1 + .../identifier/invalid_var_await.module.json | 1 + lib/test/esprima/ES6/identifier/math_alef.js | 1 + .../esprima/ES6/identifier/math_alef.skip | 1 + .../ES6/identifier/math_alef.tree.json | 114 + .../esprima/ES6/identifier/math_dal_part.js | 1 + .../esprima/ES6/identifier/math_dal_part.skip | 1 + .../ES6/identifier/math_dal_part.tree.json | 114 + .../esprima/ES6/identifier/math_kaf_lam.js | 1 + .../esprima/ES6/identifier/math_kaf_lam.skip | 1 + .../ES6/identifier/math_kaf_lam.tree.json | 114 + .../esprima/ES6/identifier/math_zain_start.js | 1 + .../ES6/identifier/math_zain_start.skip | 1 + .../ES6/identifier/math_zain_start.tree.json | 114 + .../esprima/ES6/identifier/module_await.js | 1 + .../esprima/ES6/identifier/module_await.skip | 1 + .../ES6/identifier/module_await.tree.json | 174 + .../esprima/ES6/identifier/valid_await.js | 1 + .../ES6/identifier/valid_await.tree.json | 239 + .../esprima/ES6/identifier/weierstrass.js | 1 + .../ES6/identifier/weierstrass.tree.json | 132 + .../ES6/identifier/weierstrass_weierstrass.js | 1 + .../weierstrass_weierstrass.tree.json | 114 + .../import-default-and-named-specifiers.js | 1 + ...ort-default-and-named-specifiers.tree.json | 310 + ...import-default-and-namespace-specifiers.js | 1 + ...default-and-namespace-specifiers.tree.json | 292 + .../import-declaration/import-default-as.js | 1 + .../import-default-as.tree.json | 275 + .../ES6/import-declaration/import-default.js | 1 + .../import-default.tree.json | 185 + .../ES6/import-declaration/import-jquery.js | 1 + .../import-jquery.tree.json | 167 + .../ES6/import-declaration/import-module.js | 1 + .../import-module.tree.json | 113 + .../import-named-as-specifier.js | 1 + .../import-named-as-specifier.tree.json | 275 + .../import-named-as-specifiers.js | 1 + .../import-named-as-specifiers.tree.json | 364 + .../import-declaration/import-named-empty.js | 1 + .../import-named-empty.tree.json | 167 + .../import-named-specifier.js | 1 + .../import-named-specifier.tree.json | 239 + .../import-named-specifiers-comma.js | 1 + .../import-named-specifiers-comma.tree.json | 346 + .../import-named-specifiers.js | 1 + .../import-named-specifiers.tree.json | 328 + .../import-namespace-specifier.js | 1 + .../import-namespace-specifier.tree.json | 221 + .../import-declaration/import-null-as-nil.js | 1 + .../import-null-as-nil.tree.json | 257 + ...mport-default-after-named-after-default.js | 1 + ...ault-after-named-after-default.module.json | 7 + .../invalid-import-default-after-named.js | 1 + ...lid-import-default-after-named.module.json | 7 + ...import-default-missing-module-specifier.js | 1 + ...fault-missing-module-specifier.module.json | 7 + ...invalid-import-default-module-specifier.js | 1 + ...mport-default-module-specifier.module.json | 7 + .../invalid-import-default.js | 1 + .../invalid-import-default.module.json | 7 + .../invalid-import-missing-comma.js | 1 + .../invalid-import-missing-comma.module.json | 7 + ...invalid-import-missing-module-specifier.js | 1 + ...mport-missing-module-specifier.module.json | 7 + .../invalid-import-module-specifier.js | 1 + ...nvalid-import-module-specifier.module.json | 7 + .../invalid-import-named-after-named.js | 1 + ...valid-import-named-after-named.module.json | 7 + .../invalid-import-named-after-namespace.js | 1 + ...d-import-named-after-namespace.module.json | 7 + .../invalid-import-named-as-missing-from.js | 1 + ...d-import-named-as-missing-from.module.json | 7 + .../invalid-import-namespace-after-named.js | 1 + ...d-import-namespace-after-named.module.json | 7 + .../invalid-import-namespace-missing-as.js | 1 + ...id-import-namespace-missing-as.module.json | 7 + .../invalid-import-specifiers.js | 1 + .../invalid-import-specifiers.module.json | 7 + .../ES6/lexical-declaration/for_let_in.js | 1 + .../ES6/lexical-declaration/for_let_in.skip | 1 + .../lexical-declaration/for_let_in.tree.json | 238 + ..._complex_binding_without_init.failure.json | 1 + .../invalid_complex_binding_without_init.js | 1 + .../invalid_const_const.failure.json | 1 + .../invalid_const_const.js | 1 + .../invalid_const_forin.failure.json | 1 + .../invalid_const_forin.js | 1 + .../invalid_const_let.failure.json | 1 + .../lexical-declaration/invalid_const_let.js | 1 + ...nvalid_for_const_declarations.failure.json | 1 + .../invalid_for_const_declarations.js | 1 + .../invalid_for_const_let.failure.json | 1 + .../invalid_for_const_let.js | 1 + .../invalid_for_let_declarations.failure.json | 1 + .../invalid_for_let_declarations.js | 1 + .../invalid_for_let_init.failure.json | 1 + .../invalid_for_let_init.js | 1 + .../invalid_for_let_let.failure.json | 1 + .../invalid_for_let_let.js | 1 + .../invalid_for_let_pattern.failure.json | 1 + .../invalid_for_let_pattern.js | 1 + .../invalid_forin_const_let.failure.json | 1 + .../invalid_forin_const_let.js | 1 + .../invalid_forin_let_let.failure.json | 1 + .../invalid_forin_let_let.js | 1 + .../invalid_let_declarations.failure.json | 1 + .../invalid_let_declarations.js | 1 + .../invalid_let_for_in.failure.json | 1 + .../lexical-declaration/invalid_let_for_in.js | 1 + .../invalid_let_forin.failure.json | 1 + .../lexical-declaration/invalid_let_forin.js | 1 + .../invalid_let_init.failure.json | 1 + .../lexical-declaration/invalid_let_init.js | 1 + .../invalid_let_let.failure.json | 1 + .../lexical-declaration/invalid_let_let.js | 1 + .../invalid_strict_const_const.failure.json | 1 + .../invalid_strict_const_const.js | 1 + .../invalid_strict_const_let.failure.json | 1 + .../invalid_strict_const_let.js | 1 + .../invalid_trailing_comma_1.failure.json | 1 + .../invalid_trailing_comma_1.js | 1 + .../invalid_trailing_comma_2.failure.json | 1 + .../invalid_trailing_comma_2.js | 1 + .../invalid_trailing_comma_3.failure.json | 1 + .../invalid_trailing_comma_3.js | 1 + .../invalid_trailing_comma_4.failure.json | 1 + .../invalid_trailing_comma_4.js | 2 + .../invalid_trailing_comma_5.failure.json | 1 + .../invalid_trailing_comma_5.js | 1 + .../invalid_trailing_comma_6.failure.json | 1 + .../invalid_trailing_comma_6.js | 1 + .../invalid_trailing_comma_7.failure.json | 1 + .../invalid_trailing_comma_7.js | 3 + .../ES6/lexical-declaration/let_assign.js | 1 + .../ES6/lexical-declaration/let_assign.skip | 1 + .../lexical-declaration/let_assign.tree.json | 166 + .../ES6/lexical-declaration/let_identifier.js | 1 + .../lexical-declaration/let_identifier.skip | 1 + .../let_identifier.tree.json | 93 + .../ES6/lexical-declaration/let_member.js | 1 + .../ES6/lexical-declaration/let_member.skip | 1 + .../lexical-declaration/let_member.tree.json | 219 + .../ES6/lexical-declaration/migrated_0000.js | 1 + .../migrated_0000.tree.json | 477 + .../ES6/lexical-declaration/module_let.js | 1 + .../lexical-declaration/module_let.tree.json | 114 + .../ES6/meta-property/assign-new-target.js | 3 + .../meta-property/assign-new-target.tree.json | 421 + .../meta-property/invalid-dots.failure.json | 1 + .../esprima/ES6/meta-property/invalid-dots.js | 1 + .../invalid-new-target.failure.json | 1 + .../ES6/meta-property/invalid-new-target.js | 1 + .../ES6/meta-property/new-new-target.js | 3 + .../meta-property/new-new-target.tree.json | 365 + .../meta-property/new-target-declaration.js | 3 + .../new-target-declaration.tree.json | 329 + .../meta-property/new-target-expression.js | 1 + .../new-target-expression.tree.json | 403 + .../ES6/meta-property/new-target-invoke.js | 3 + .../meta-property/new-target-invoke.tree.json | 383 + .../meta-property/new-target-precedence.js | 3 + .../new-target-precedence.tree.json | 455 + .../unknown-property.failure.json | 1 + .../ES6/meta-property/unknown-property.js | 1 + .../ES6/method-definition/migrated_0000.js | 1 + .../method-definition/migrated_0000.tree.json | 334 + .../ES6/method-definition/migrated_0001.js | 1 + .../method-definition/migrated_0001.tree.json | 371 + .../ES6/method-definition/migrated_0002.js | 1 + .../method-definition/migrated_0002.tree.json | 335 + .../ES6/method-definition/migrated_0003.js | 1 + .../method-definition/migrated_0003.tree.json | 334 + .../ES6/method-definition/migrated_0004.js | 1 + .../method-definition/migrated_0004.tree.json | 334 + ...oto-getter-literal-identifier.failure.json | 1 + ...invalid-proto-getter-literal-identifier.js | 1 + ...alid-proto-identifier-literal.failure.json | 1 + .../invalid-proto-identifier-literal.js | 1 + ...id-proto-identifier-shorthand.failure.json | 1 + .../invalid-proto-identifier-shorthand.js | 1 + .../invalid-proto-identifiers.failure.json | 1 + .../invalid-proto-identifiers.js | 1 + ...alid-proto-literal-identifier.failure.json | 1 + .../invalid-proto-literal-identifier.js | 1 + ...valid-proto-literal-shorthand.failure.json | 1 + .../invalid-proto-literal-shorthand.js | 1 + .../invalid-proto-literals.failure.json | 1 + .../invalid-proto-literals.js | 1 + ...oto-setter-literal-identifier.failure.json | 1 + ...invalid-proto-setter-literal-identifier.js | 1 + ...id-proto-shorthand-identifier.failure.json | 1 + .../invalid-proto-shorthand-identifier.js | 1 + ...valid-proto-shorthand-literal.failure.json | 1 + .../invalid-proto-shorthand-literal.js | 1 + .../invalid-proto-shorthands.failure.json | 1 + .../invalid-proto-shorthands.js | 1 + .../proto-identifier-getter-setter.js | 1 + .../proto-identifier-getter-setter.tree.json | 687 + .../proto-identifier-getter.js | 1 + .../proto-identifier-getter.tree.json | 446 + .../proto-identifier-method.js | 1 + .../proto-identifier-method.tree.json | 446 + .../proto-identifier-setter.js | 1 + .../proto-identifier-setter.tree.json | 483 + .../proto-literal-getter-setter.js | 1 + .../proto-literal-getter-setter.tree.json | 688 + .../proto-literal-getter.js | 1 + .../proto-literal-getter.tree.json | 447 + .../proto-literal-method.js | 1 + .../proto-literal-method.tree.json | 447 + .../proto-literal-setter.js | 1 + .../proto-literal-setter.tree.json | 484 + .../migrated_0000.js | 1 + .../migrated_0000.tree.json | 334 + .../octal-integer-literal/migrated_0000.js | 1 + .../migrated_0000.tree.json | 76 + .../octal-integer-literal/migrated_0001.js | 1 + .../migrated_0001.tree.json | 76 + .../octal-integer-literal/migrated_0002.js | 1 + .../migrated_0002.tree.json | 332 + .../octal-integer-literal/migrated_0003.js | 1 + .../migrated_0003.tree.json | 76 + .../octal-integer-literal/migrated_0004.js | 1 + .../migrated_0004.tree.json | 76 + .../octal-integer-literal/migrated_0005.js | 1 + .../migrated_0005.tree.json | 76 + .../octal-integer-literal/migrated_0006.js | 1 + .../migrated_0006.tree.json | 332 + .../rest-parameter/function-declaration.js | 1 + .../function-declaration.tree.json | 312 + .../ES6/rest-parameter/function-expression.js | 1 + .../function-expression.tree.json | 366 + .../ES6/rest-parameter/object-method.js | 1 + .../rest-parameter/object-method.tree.json | 496 + .../rest-parameter/object-shorthand-method.js | 1 + .../object-shorthand-method.tree.json | 406 + .../rest-property/assignment-with-trailing.js | 1 + .../assignment-with-trailing.tree.json | 67 + .../esprima/ES6/rest-property/assignment.diff | 15 + .../esprima/ES6/rest-property/assignment.js | 1 + .../ES6/rest-property/assignment.tree.json | 49 + .../let-assignment-with-trailing-comma.diff | 28 + .../let-assignment-with-trailing-comma.js | 2 + ...t-assignment-with-trailing-comma.tree.json | 101 + .../let-assignment-with-trailing.diff | 17 + .../let-assignment-with-trailing.js | 2 + .../let-assignment-with-trailing.tree.json | 138 + .../ES6/rest-property/let-assignment.diff | 17 + .../ES6/rest-property/let-assignment.js | 1 + .../rest-property/let-assignment.tree.json | 50 + .../ES6/spread-element/call-multi-spread.js | 1 + .../call-multi-spread.tree.json | 397 + .../ES6/spread-element/call-spread-default.js | 1 + .../call-spread-default.tree.json | 345 + .../ES6/spread-element/call-spread-first.js | 1 + .../call-spread-first.tree.json | 327 + .../ES6/spread-element/call-spread-number.js | 1 + .../call-spread-number.tree.json | 220 + .../esprima/ES6/spread-element/call-spread.js | 1 + .../ES6/spread-element/call-spread.tree.json | 219 + .../invalid-call-dot-dot.failure.json | 1 + .../spread-element/invalid-call-dot-dot.js | 1 + .../invalid-call-dots.failure.json | 1 + .../ES6/spread-element/invalid-call-dots.js | 1 + .../invalid-call-spreads.failure.json | 1 + .../spread-element/invalid-call-spreads.js | 1 + .../invalid-new-dot-dot.failure.json | 1 + .../ES6/spread-element/invalid-new-dot-dot.js | 1 + .../invalid-new-dots.failure.json | 1 + .../ES6/spread-element/invalid-new-dots.js | 1 + .../invalid-new-spreads.failure.json | 1 + .../ES6/spread-element/invalid-new-spreads.js | 1 + .../ES6/spread-element/new-multi-spread.js | 1 + .../spread-element/new-multi-spread.tree.json | 415 + .../ES6/spread-element/new-spread-default.js | 1 + .../new-spread-default.tree.json | 363 + .../ES6/spread-element/new-spread-first.js | 1 + .../spread-element/new-spread-first.tree.json | 345 + .../ES6/spread-element/new-spread-number.js | 1 + .../new-spread-number.tree.json | 238 + .../esprima/ES6/spread-element/new-spread.js | 1 + .../ES6/spread-element/new-spread.tree.json | 237 + .../esprima/ES6/super-property/arrow_super.js | 5 + .../ES6/super-property/arrow_super.tree.json | 551 + .../ES6/super-property/constructor_super.js | 5 + .../constructor_super.tree.json | 494 + .../invalid_super_access.failure.json | 1 + .../super-property/invalid_super_access.js | 5 + .../invalid_super_id.failure.json | 1 + .../ES6/super-property/invalid_super_id.js | 3 + ...lid_super_not_inside_function.failure.json | 1 + .../invalid_super_not_inside_function.js | 1 + .../esprima/ES6/super-property/new_super.js | 5 + .../ES6/super-property/new_super.tree.json | 566 + .../ES6/super-property/super_computed.js | 5 + .../super-property/super_computed.tree.json | 531 + .../ES6/super-property/super_member.js | 5 + .../ES6/super-property/super_member.tree.json | 512 + .../after-switch.failure.json | 1 + .../ES6/template-literals/after-switch.js | 1 + .../ES6/template-literals/dollar-sign.js | 1 + .../template-literals/dollar-sign.tree.json | 99 + .../escape-sequences.source.js | 1 + .../escape-sequences.tree.json | 99 + .../invalid-escape.failure.json | 1 + .../ES6/template-literals/invalid-escape.js | 1 + .../line-terminators.source.js | 1 + .../line-terminators.tree.json | 99 + .../literal-escape-sequences.source.js | 1 + .../literal-escape-sequences.tree.json | 99 + .../ES6/template-literals/new-expression.js | 1 + .../new-expression.tree.json | 188 + .../octal-literal.failure.json | 1 + .../ES6/template-literals/octal-literal.js | 1 + .../strict-octal-literal.failure.json | 1 + .../template-literals/strict-octal-literal.js | 1 + .../template-literals/tagged-interpolation.js | 1 + .../tagged-interpolation.tree.json | 229 + .../tagged-nested-with-object-literal.js | 1 + ...agged-nested-with-object-literal.tree.json | 444 + .../esprima/ES6/template-literals/tagged.js | 1 + .../ES6/template-literals/tagged.tree.json | 152 + .../unclosed-interpolation.failure.json | 1 + .../unclosed-interpolation.js | 1 + .../unclosed-nested.failure.json | 1 + .../ES6/template-literals/unclosed-nested.js | 1 + .../template-literals/unclosed.failure.json | 1 + .../esprima/ES6/template-literals/unclosed.js | 1 + .../esprima/ES6/template-literals/untagged.js | 1 + .../ES6/template-literals/untagged.tree.json | 99 + .../migrated_0000.source.js | 1 + .../migrated_0000.tree.json | 77 + .../migrated_0001.source.js | 1 + .../migrated_0001.tree.json | 77 + .../migrated_0002.source.js | 1 + .../migrated_0002.tree.json | 77 + ...nvalid-yield-binding-property.failure.json | 1 + .../yield/invalid-yield-binding-property.js | 1 + .../invalid-yield-expression.failure.json | 1 + .../ES6/yield/invalid-yield-expression.js | 1 + ...yield-generator-arrow-default.failure.json | 1 + .../invalid-yield-generator-arrow-default.js | 1 + ...eld-generator-arrow-parameter.failure.json | 1 + ...invalid-yield-generator-arrow-parameter.js | 1 + ...ld-generator-arrow-parameters.failure.json | 1 + ...nvalid-yield-generator-arrow-parameters.js | 1 + ...invalid-yield-generator-catch.failure.json | 1 + .../yield/invalid-yield-generator-catch.js | 1 + ...d-yield-generator-declaration.failure.json | 1 + .../invalid-yield-generator-declaration.js | 1 + .../invalid-yield-generator-export-default.js | 1 + ...yield-generator-export-default.module.json | 1 + ...eld-generator-expression-name.failure.json | 1 + ...invalid-yield-generator-expression-name.js | 1 + ...enerator-expression-parameter.failure.json | 1 + ...id-yield-generator-expression-parameter.js | 1 + ...eld-generator-expression-rest.failure.json | 1 + ...invalid-yield-generator-expression-rest.js | 1 + ...enerator-function-declaration.failure.json | 1 + ...id-yield-generator-function-declaration.js | 1 + ...generator-lexical-declaration.failure.json | 1 + ...lid-yield-generator-lexical-declaration.js | 1 + ...d-generator-member-expression.failure.json | 1 + ...valid-yield-generator-member-expression.js | 1 + ...lid-yield-generator-parameter.failure.json | 1 + .../invalid-yield-generator-parameter.js | 1 + .../invalid-yield-generator-rest.failure.json | 1 + .../ES6/yield/invalid-yield-generator-rest.js | 1 + ...or-strict-function-expression.failure.json | 1 + ...ld-generator-strict-function-expression.js | 1 + ...tor-strict-function-parameter.failure.json | 1 + ...eld-generator-strict-function-parameter.js | 1 + ...enerator-variable-declaration.failure.json | 1 + ...id-yield-generator-variable-declaration.js | 1 + ...id-yield-strict-array-pattern.failure.json | 1 + .../invalid-yield-strict-array-pattern.js | 1 + ...trict-arrow-parameter-default.failure.json | 1 + ...id-yield-strict-arrow-parameter-default.js | 1 + ...d-strict-arrow-parameter-name.failure.json | 1 + ...valid-yield-strict-arrow-parameter-name.js | 1 + ...-yield-strict-binding-element.failure.json | 1 + .../invalid-yield-strict-binding-element.js | 1 + ...-yield-strict-catch-parameter.failure.json | 1 + .../invalid-yield-strict-catch-parameter.js | 1 + ...yield-strict-formal-parameter.failure.json | 1 + .../invalid-yield-strict-formal-parameter.js | 1 + ...d-strict-function-declaration.failure.json | 1 + ...valid-yield-strict-function-declaration.js | 1 + ...ld-strict-function-expression.failure.json | 1 + ...nvalid-yield-strict-function-expression.js | 1 + ...valid-yield-strict-identifier.failure.json | 1 + .../yield/invalid-yield-strict-identifier.js | 1 + ...ld-strict-lexical-declaration.failure.json | 1 + ...nvalid-yield-strict-lexical-declaration.js | 1 + ...d-yield-strict-rest-parameter.failure.json | 1 + .../invalid-yield-strict-rest-parameter.js | 1 + ...d-strict-variable-declaration.failure.json | 1 + ...valid-yield-strict-variable-declaration.js | 1 + .../esprima/ES6/yield/yield-array-pattern.js | 1 + .../ES6/yield/yield-array-pattern.tree.json | 238 + .../ES6/yield/yield-arrow-concise-body.js | 1 + .../yield/yield-arrow-concise-body.tree.json | 277 + .../ES6/yield/yield-arrow-function-body.diff | 16 + .../ES6/yield/yield-arrow-function-body.js | 1 + .../yield/yield-arrow-function-body.tree.json | 349 + .../yield/yield-arrow-parameter-default.js | 1 + .../yield/yield-arrow-parameter-default.skip | 1 + .../yield-arrow-parameter-default.tree.json | 277 + .../ES6/yield/yield-arrow-parameter-name.js | 1 + .../yield-arrow-parameter-name.tree.json | 206 + .../ES6/yield/yield-binding-element.js | 1 + .../ES6/yield/yield-binding-element.tree.json | 315 + .../ES6/yield/yield-binding-property.js | 1 + .../yield/yield-binding-property.tree.json | 315 + .../yield/yield-call-expression-property.js | 1 + .../yield-call-expression-property.tree.json | 402 + .../ES6/yield/yield-catch-parameter.js | 1 + .../ES6/yield/yield-catch-parameter.tree.json | 273 + .../yield/yield-expression-precedence.diff | 14 + .../ES6/yield/yield-expression-precedence.js | 1 + .../yield-expression-precedence.tree.json | 619 + ...d-function-declaration-formal-parameter.js | 1 + ...ion-declaration-formal-parameter.tree.json | 223 + .../ES6/yield/yield-function-declaration.js | 1 + .../yield-function-declaration.tree.json | 186 + .../yield-function-expression-parameter.js | 1 + ...ld-function-expression-parameter.tree.json | 241 + .../ES6/yield/yield-function-expression.js | 1 + .../yield/yield-function-expression.tree.json | 239 + .../yield-generator-arrow-concise-body.js | 1 + ...eld-generator-arrow-concise-body.tree.json | 460 + .../yield/yield-generator-arrow-default.js | 1 + .../yield/yield-generator-arrow-default.skip | 1 + .../yield-generator-arrow-default.tree.json | 460 + .../yield-generator-arrow-function-body.diff | 22 + .../yield-generator-arrow-function-body.js | 1 + ...ld-generator-arrow-function-body.tree.json | 532 + .../ES6/yield/yield-generator-declaration.js | 1 + .../yield-generator-declaration.tree.json | 204 + .../yield-generator-default-parameter.diff | 21 + .../yield-generator-default-parameter.js | 1 + ...ield-generator-default-parameter.tree.json | 312 + .../yield-generator-function-expression.js | 1 + ...ld-generator-function-expression.tree.json | 496 + .../yield-generator-function-parameter.diff | 14 + .../yield-generator-function-parameter.js | 1 + ...eld-generator-function-parameter.tree.json | 480 + .../ES6/yield/yield-generator-method.js | 1 + .../yield/yield-generator-method.tree.json | 316 + ...ield-generator-parameter-object-pattern.js | 1 + ...nerator-parameter-object-pattern.tree.json | 371 + .../ES6/yield/yield-lexical-declaration.js | 1 + .../yield/yield-lexical-declaration.tree.json | 186 + .../yield/yield-member-expression-property.js | 1 + ...yield-member-expression-property.tree.json | 384 + lib/test/esprima/ES6/yield/yield-method.js | 1 + .../esprima/ES6/yield/yield-method.tree.json | 298 + .../yield/yield-parameter-object-pattern.js | 1 + .../yield-parameter-object-pattern.tree.json | 353 + .../esprima/ES6/yield/yield-rest-parameter.js | 1 + .../ES6/yield/yield-rest-parameter.tree.json | 258 + .../yield/yield-strict-binding-property.js | 1 + .../yield-strict-binding-property.tree.json | 388 + .../esprima/ES6/yield/yield-strict-method.js | 1 + .../ES6/yield/yield-strict-method.tree.json | 371 + .../ES6/yield/yield-super-property.diff | 22 + .../esprima/ES6/yield/yield-super-property.js | 1 + .../ES6/yield/yield-super-property.tree.json | 494 + .../ES6/yield/yield-variable-declaration.js | 1 + .../yield-variable-declaration.tree.json | 132 + .../yield-yield-expression-delegate.diff | 14 + .../yield/yield-yield-expression-delegate.js | 1 + .../yield-yield-expression-delegate.tree.json | 313 + .../ES6/yield/yield-yield-expression.diff | 14 + .../ES6/yield/yield-yield-expression.js | 1 + .../yield/yield-yield-expression.tree.json | 295 + .../JSX/attribute-double-quoted-string.js | 1 + .../attribute-double-quoted-string.tree.json | 276 + lib/test/esprima/JSX/attribute-element.js | 1 + lib/test/esprima/JSX/attribute-element.skip | 1 + .../esprima/JSX/attribute-element.tree.json | 597 + .../esprima/JSX/attribute-entity-decimal.js | 1 + .../JSX/attribute-entity-decimal.tree.json | 364 + lib/test/esprima/JSX/attribute-entity-hex.js | 1 + .../JSX/attribute-entity-hex.tree.json | 276 + lib/test/esprima/JSX/attribute-entity.js | 1 + .../esprima/JSX/attribute-entity.tree.json | 276 + lib/test/esprima/JSX/attribute-expression.js | 1 + .../JSX/attribute-expression.tree.json | 434 + .../esprima/JSX/attribute-multi-entities.js | 1 + .../JSX/attribute-multi-entities.tree.json | 276 + lib/test/esprima/JSX/attribute-null-value.js | 1 + .../JSX/attribute-null-value.tree.json | 222 + lib/test/esprima/JSX/attribute-primary.js | 1 + .../esprima/JSX/attribute-primary.tree.json | 347 + .../JSX/attribute-single-quoted-string.js | 1 + .../attribute-single-quoted-string.tree.json | 276 + lib/test/esprima/JSX/attribute-spread.js | 1 + .../esprima/JSX/attribute-spread.tree.json | 381 + .../esprima/JSX/attribute-unknown-entity.js | 1 + .../JSX/attribute-unknown-entity.tree.json | 276 + .../JSX/container-object-expression.js | 1 + .../JSX/container-object-expression.tree.json | 457 + lib/test/esprima/JSX/container-series.js | 1 + .../esprima/JSX/container-series.tree.json | 577 + lib/test/esprima/JSX/empty-child-comment.js | 1 + .../esprima/JSX/empty-child-comment.tree.json | 326 + .../esprima/JSX/empty-expression-container.js | 1 + .../JSX/empty-expression-container.tree.json | 326 + .../esprima/JSX/inside-group-expression.js | 1 + .../JSX/inside-group-expression.tree.json | 295 + ...invalid-attribute-value-trail.failure.json | 1 + .../JSX/invalid-attribute-value-trail.js | 1 + .../JSX/invalid-closing-trail.failure.json | 1 + lib/test/esprima/JSX/invalid-closing-trail.js | 1 + .../esprima/JSX/invalid-element.failure.json | 1 + lib/test/esprima/JSX/invalid-element.js | 1 + ...id-empty-attribute-expression.failure.json | 1 + .../JSX/invalid-empty-attribute-expression.js | 1 + .../invalid-empty-selfclosing.failure.json | 1 + .../esprima/JSX/invalid-empty-selfclosing.js | 1 + .../invalid-incomplete-namespace.failure.json | 1 + .../JSX/invalid-incomplete-namespace.js | 1 + .../JSX/invalid-match-member.failure.json | 1 + lib/test/esprima/JSX/invalid-match-member.js | 1 + .../invalid-match-name-namespace.failure.json | 1 + .../JSX/invalid-match-name-namespace.js | 1 + .../invalid-match-namespace-name.failure.json | 1 + .../JSX/invalid-match-namespace-name.js | 1 + .../JSX/invalid-match-namespace.failure.json | 1 + .../esprima/JSX/invalid-match-namespace.js | 1 + .../esprima/JSX/invalid-match.failure.json | 1 + lib/test/esprima/JSX/invalid-match.js | 1 + .../invalid-member-incomplete.failure.json | 1 + .../esprima/JSX/invalid-member-incomplete.js | 1 + .../JSX/invalid-no-closing.failure.json | 1 + lib/test/esprima/JSX/invalid-no-closing.js | 1 + .../JSX/invalid-self-closing.failure.json | 1 + lib/test/esprima/JSX/invalid-self-closing.js | 1 + .../JSX/invalid-start-member.failure.json | 1 + lib/test/esprima/JSX/invalid-start-member.js | 1 + .../JSX/invalid-start-namespace.failure.json | 1 + .../esprima/JSX/invalid-start-namespace.js | 1 + lib/test/esprima/JSX/long-member-pair.js | 1 + .../esprima/JSX/long-member-pair.tree.json | 965 ++ lib/test/esprima/JSX/long-member.js | 1 + lib/test/esprima/JSX/long-member.tree.json | 522 + lib/test/esprima/JSX/multi-attributes.js | 1 + .../esprima/JSX/multi-attributes.tree.json | 543 + lib/test/esprima/JSX/multiline-crlf-text.js | 5 + lib/test/esprima/JSX/multiline-crlf-text.skip | 1 + .../esprima/JSX/multiline-crlf-text.tree.json | 293 + lib/test/esprima/JSX/multiline-text.js | 5 + lib/test/esprima/JSX/multiline-text.tree.json | 293 + lib/test/esprima/JSX/nested-elements.js | 1 + .../esprima/JSX/nested-elements.tree.json | 675 + lib/test/esprima/JSX/null-attribute-value.js | 1 + .../JSX/null-attribute-value.tree.json | 293 + .../esprima/JSX/simple-deeply-nested-pair.js | 1 + .../JSX/simple-deeply-nested-pair.tree.json | 927 ++ .../JSX/simple-expression-container.js | 1 + .../JSX/simple-expression-container.tree.json | 363 + lib/test/esprima/JSX/simple-member-pair.js | 1 + .../esprima/JSX/simple-member-pair.tree.json | 397 + lib/test/esprima/JSX/simple-member.js | 1 + lib/test/esprima/JSX/simple-member.tree.json | 238 + lib/test/esprima/JSX/simple-namespace-pair.js | 1 + .../JSX/simple-namespace-pair.tree.json | 397 + lib/test/esprima/JSX/simple-namespace.js | 1 + .../esprima/JSX/simple-namespace.tree.json | 238 + lib/test/esprima/JSX/simple-nested-pair.js | 1 + .../esprima/JSX/simple-nested-pair.tree.json | 472 + lib/test/esprima/JSX/simple-pair.js | 1 + lib/test/esprima/JSX/simple-pair.tree.json | 255 + .../JSX/simple-selfclosing-linefeed.js | 2 + .../JSX/simple-selfclosing-linefeed.tree.json | 167 + .../JSX/simple-selfclosing-whitespace.js | 2 + .../simple-selfclosing-whitespace.tree.json | 167 + lib/test/esprima/JSX/simple-selfclosing.js | 2 + .../esprima/JSX/simple-selfclosing.tree.json | 167 + lib/test/esprima/JSX/simple-text.js | 1 + lib/test/esprima/JSX/simple-text.tree.json | 293 + lib/test/esprima/LICENSE.BSD | 21 + .../migrated_0000.diff | 12 + .../migrated_0000.js | 2 + .../migrated_0000.tree.json | 220 + .../migrated_0001.diff | 12 + .../migrated_0001.js | 2 + .../migrated_0001.tree.json | 220 + .../migrated_0002.js | 1 + .../migrated_0002.tree.json | 132 + .../migrated_0003.js | 2 + .../migrated_0003.tree.json | 420 + .../migrated_0004.js | 2 + .../migrated_0004.tree.json | 292 + .../migrated_0005.js | 2 + .../migrated_0005.tree.json | 292 + .../migrated_0006.js | 2 + .../migrated_0006.tree.json | 292 + .../migrated_0007.js | 2 + .../migrated_0007.tree.json | 292 + .../migrated_0008.js | 2 + .../migrated_0008.tree.json | 292 + .../migrated_0009.js | 2 + .../migrated_0009.tree.json | 292 + .../migrated_0010.js | 2 + .../migrated_0010.tree.json | 312 + .../migrated_0011.js | 2 + .../migrated_0011.tree.json | 312 + .../migrated_0012.js | 2 + .../migrated_0012.tree.json | 312 + .../migrated_0013.js | 2 + .../migrated_0013.tree.json | 219 + .../migrated_0014.js | 2 + .../migrated_0014.tree.json | 219 + .../migrated_0015.js | 2 + .../migrated_0015.tree.json | 219 + lib/test/esprima/comment/migrated_0000.js | 1 + .../esprima/comment/migrated_0000.tree.json | 76 + lib/test/esprima/comment/migrated_0001.js | 1 + lib/test/esprima/comment/migrated_0001.skip | 1 + .../esprima/comment/migrated_0001.tree.json | 72 + lib/test/esprima/comment/migrated_0002.diff | 7 + lib/test/esprima/comment/migrated_0002.js | 1 + .../esprima/comment/migrated_0002.tree.json | 208 + lib/test/esprima/comment/migrated_0003.diff | 3 + lib/test/esprima/comment/migrated_0003.js | 1 + .../esprima/comment/migrated_0003.tree.json | 60 + lib/test/esprima/comment/migrated_0004.diff | 13 + lib/test/esprima/comment/migrated_0004.js | 1 + .../esprima/comment/migrated_0004.tree.json | 295 + lib/test/esprima/comment/migrated_0005.diff | 7 + lib/test/esprima/comment/migrated_0005.js | 2 + .../esprima/comment/migrated_0005.tree.json | 187 + lib/test/esprima/comment/migrated_0006.js | 1 + lib/test/esprima/comment/migrated_0006.skip | 1 + .../esprima/comment/migrated_0006.tree.json | 114 + lib/test/esprima/comment/migrated_0007.js | 1 + lib/test/esprima/comment/migrated_0007.skip | 1 + .../esprima/comment/migrated_0007.tree.json | 54 + lib/test/esprima/comment/migrated_0008.js | 1 + lib/test/esprima/comment/migrated_0008.skip | 1 + .../esprima/comment/migrated_0008.tree.json | 76 + lib/test/esprima/comment/migrated_0009.js | 1 + lib/test/esprima/comment/migrated_0009.skip | 1 + .../esprima/comment/migrated_0009.tree.json | 96 + lib/test/esprima/comment/migrated_0010.js | 5 + .../esprima/comment/migrated_0010.tree.json | 76 + lib/test/esprima/comment/migrated_0011.diff | 7 + lib/test/esprima/comment/migrated_0011.js | 2 + .../esprima/comment/migrated_0011.tree.json | 116 + lib/test/esprima/comment/migrated_0012.js | 1 + .../esprima/comment/migrated_0012.tree.json | 96 + lib/test/esprima/comment/migrated_0013.diff | 7 + lib/test/esprima/comment/migrated_0013.js | 2 + .../esprima/comment/migrated_0013.tree.json | 116 + lib/test/esprima/comment/migrated_0014.diff | 7 + lib/test/esprima/comment/migrated_0014.js | 2 + .../esprima/comment/migrated_0014.tree.json | 116 + lib/test/esprima/comment/migrated_0015.diff | 3 + lib/test/esprima/comment/migrated_0015.js | 1 + .../esprima/comment/migrated_0015.tree.json | 60 + lib/test/esprima/comment/migrated_0016.js | 2 + .../esprima/comment/migrated_0016.tree.json | 76 + lib/test/esprima/comment/migrated_0017.js | 1 + lib/test/esprima/comment/migrated_0017.skip | 1 + .../esprima/comment/migrated_0017.tree.json | 116 + lib/test/esprima/comment/migrated_0018.diff | 7 + lib/test/esprima/comment/migrated_0018.js | 2 + .../esprima/comment/migrated_0018.tree.json | 116 + lib/test/esprima/comment/migrated_0019.js | 1 + .../esprima/comment/migrated_0019.tree.json | 40 + lib/test/esprima/comment/migrated_0020.js | 1 + .../esprima/comment/migrated_0020.tree.json | 32 + lib/test/esprima/comment/migrated_0021.diff | 7 + lib/test/esprima/comment/migrated_0021.js | 2 + .../esprima/comment/migrated_0021.tree.json | 116 + lib/test/esprima/comment/migrated_0022.js | 1 + .../esprima/comment/migrated_0022.tree.json | 40 + lib/test/esprima/comment/migrated_0023.js | 1 + .../esprima/comment/migrated_0023.tree.json | 20 + lib/test/esprima/comment/migrated_0024.diff | 7 + lib/test/esprima/comment/migrated_0024.js | 1 + .../esprima/comment/migrated_0024.tree.json | 116 + lib/test/esprima/comment/migrated_0025.js | 1 + lib/test/esprima/comment/migrated_0025.skip | 1 + .../esprima/comment/migrated_0025.tree.json | 116 + lib/test/esprima/comment/migrated_0026.diff | 7 + lib/test/esprima/comment/migrated_0026.js | 4 + .../esprima/comment/migrated_0026.tree.json | 152 + lib/test/esprima/comment/migrated_0027.diff | 13 + lib/test/esprima/comment/migrated_0027.js | 2 + .../esprima/comment/migrated_0027.tree.json | 332 + lib/test/esprima/comment/migrated_0028.diff | 13 + lib/test/esprima/comment/migrated_0028.js | 2 + .../esprima/comment/migrated_0028.tree.json | 350 + lib/test/esprima/comment/migrated_0029.js | 1 + lib/test/esprima/comment/migrated_0029.skip | 1 + .../esprima/comment/migrated_0029.tree.json | 332 + lib/test/esprima/comment/migrated_0030.js | 1 + lib/test/esprima/comment/migrated_0030.skip | 1 + .../esprima/comment/migrated_0030.tree.json | 332 + lib/test/esprima/comment/migrated_0031.js | 1 + lib/test/esprima/comment/migrated_0031.skip | 1 + .../esprima/comment/migrated_0031.tree.json | 406 + lib/test/esprima/comment/migrated_0032.js | 1 + lib/test/esprima/comment/migrated_0032.skip | 1 + .../esprima/comment/migrated_0032.tree.json | 406 + lib/test/esprima/comment/migrated_0033.diff | 7 + lib/test/esprima/comment/migrated_0033.js | 1 + .../esprima/comment/migrated_0033.tree.json | 571 + lib/test/esprima/comment/migrated_0034.diff | 22 + lib/test/esprima/comment/migrated_0034.js | 1 + .../esprima/comment/migrated_0034.tree.json | 591 + lib/test/esprima/comment/migrated_0035.diff | 17 + lib/test/esprima/comment/migrated_0035.js | 1 + .../esprima/comment/migrated_0035.tree.json | 557 + lib/test/esprima/comment/migrated_0036.js | 1 + lib/test/esprima/comment/migrated_0036.skip | 1 + .../esprima/comment/migrated_0036.tree.json | 12 + lib/test/esprima/comment/migrated_0037.js | 1 + lib/test/esprima/comment/migrated_0037.skip | 1 + .../esprima/comment/migrated_0037.tree.json | 48 + lib/test/esprima/comment/migrated_0038.js | 1 + lib/test/esprima/comment/migrated_0038.skip | 1 + .../esprima/comment/migrated_0038.tree.json | 40 + lib/test/esprima/comment/migrated_0039.js | 1 + lib/test/esprima/comment/migrated_0039.skip | 1 + .../esprima/comment/migrated_0039.tree.json | 40 + lib/test/esprima/comment/migrated_0040.js | 1 + lib/test/esprima/comment/migrated_0040.skip | 1 + .../esprima/comment/migrated_0040.tree.json | 40 + lib/test/esprima/comment/migrated_0041.js | 1 + lib/test/esprima/comment/migrated_0041.skip | 1 + .../esprima/comment/migrated_0041.tree.json | 58 + lib/test/esprima/comment/migrated_0042.js | 1 + lib/test/esprima/comment/migrated_0042.skip | 1 + .../esprima/comment/migrated_0042.tree.json | 58 + lib/test/esprima/comment/migrated_0043.js | 1 + .../esprima/comment/migrated_0043.tree.json | 220 + lib/test/esprima/comment/migrated_0044.js | 1 + .../esprima/comment/migrated_0044.tree.json | 293 + lib/test/esprima/comment/migrated_0045.diff | 8 + lib/test/esprima/comment/migrated_0045.js | 1 + .../esprima/comment/migrated_0045.tree.json | 153 + lib/test/esprima/comment/migrated_0046.js | 1 + .../esprima/comment/migrated_0046.tree.json | 241 + lib/test/esprima/comment/migrated_0047.diff | 9 + lib/test/esprima/comment/migrated_0047.js | 3 + .../esprima/comment/migrated_0047.tree.json | 132 + lib/test/esprima/comment/migrated_0048.diff | 9 + lib/test/esprima/comment/migrated_0048.js | 4 + .../esprima/comment/migrated_0048.tree.json | 192 + lib/test/esprima/comment/migrated_0049.diff | 7 + lib/test/esprima/comment/migrated_0049.js | 4 + .../esprima/comment/migrated_0049.tree.json | 106 + lib/test/esprima/comment/migrated_0050.diff | 12 + lib/test/esprima/comment/migrated_0050.js | 8 + .../esprima/comment/migrated_0050.tree.json | 180 + lib/test/esprima/comment/migrated_0051.diff | 14 + lib/test/esprima/comment/migrated_0051.js | 4 + .../esprima/comment/migrated_0051.tree.json | 150 + lib/test/esprima/comment/migrated_0052.diff | 7 + lib/test/esprima/comment/migrated_0052.js | 1 + .../esprima/comment/migrated_0052.tree.json | 106 + lib/test/esprima/comment/migrated_0053.diff | 7 + lib/test/esprima/comment/migrated_0053.js | 1 + .../esprima/comment/migrated_0053.tree.json | 181 + lib/test/esprima/comment/migrated_0054.diff | 14 + lib/test/esprima/comment/migrated_0054.js | 1 + .../esprima/comment/migrated_0054.tree.json | 199 + lib/test/esprima/comment/migrated_0055.js | 5 + .../esprima/comment/migrated_0055.tree.json | 224 + .../declaration/const/migrated_0000.js | 1 + .../declaration/const/migrated_0000.tree.json | 168 + .../declaration/const/migrated_0001.diff | 12 + .../declaration/const/migrated_0001.js | 1 + .../declaration/const/migrated_0001.tree.json | 223 + .../declaration/const/migrated_0002.diff | 12 + .../declaration/const/migrated_0002.js | 1 + .../declaration/const/migrated_0002.tree.json | 475 + .../declaration/function/dupe-param.diff | 13 + .../declaration/function/dupe-param.js | 1 + .../declaration/function/dupe-param.tree.json | 359 + .../declaration/function/empty-param.js | 1 + .../function/empty-param.tree.json | 387 + .../declaration/function/migrated_0000.js | 1 + .../function/migrated_0000.tree.json | 312 + .../declaration/function/migrated_0001.js | 1 + .../function/migrated_0001.tree.json | 186 + .../declaration/function/migrated_0002.js | 1 + .../function/migrated_0002.tree.json | 186 + .../declaration/function/migrated_0003.js | 1 + .../function/migrated_0003.tree.json | 277 + .../declaration/function/migrated_0004.js | 1 + .../function/migrated_0004.tree.json | 330 + .../declaration/function/migrated_0005.diff | 20 + .../declaration/function/migrated_0005.js | 1 + .../function/migrated_0005.tree.json | 407 + .../declaration/function/migrated_0006.js | 1 + .../function/migrated_0006.tree.json | 349 + .../declaration/function/migrated_0007.js | 1 + .../function/migrated_0007.tree.json | 403 + .../declaration/function/migrated_0008.diff | 20 + .../declaration/function/migrated_0008.js | 1 + .../function/migrated_0008.tree.json | 386 + .../declaration/function/migrated_0009.js | 1 + .../function/migrated_0009.tree.json | 313 + .../declaration/function/migrated_0010.js | 1 + .../function/migrated_0010.tree.json | 313 + .../declaration/function/migrated_0011.diff | 20 + .../declaration/function/migrated_0011.js | 1 + .../function/migrated_0011.tree.json | 421 + .../declaration/function/migrated_0012.js | 1 + .../function/migrated_0012.tree.json | 204 + .../declaration/function/migrated_0013.js | 1 + .../function/migrated_0013.tree.json | 223 + .../declaration/function/migrated_0014.js | 1 + .../function/migrated_0014.tree.json | 332 + .../esprima/declaration/let/migrated_0000.js | 1 + .../declaration/let/migrated_0000.tree.json | 114 + .../declaration/let/migrated_0001.diff | 12 + .../esprima/declaration/let/migrated_0001.js | 1 + .../declaration/let/migrated_0001.tree.json | 169 + .../declaration/let/migrated_0002.diff | 12 + .../esprima/declaration/let/migrated_0002.js | 1 + .../declaration/let/migrated_0002.tree.json | 223 + .../declaration/let/migrated_0003.diff | 12 + .../esprima/declaration/let/migrated_0003.js | 1 + .../declaration/let/migrated_0003.tree.json | 475 + .../esprima/directive-prolog/migrated_0000.js | 1 + .../directive-prolog/migrated_0000.tree.json | 474 + .../esprima/directive-prolog/migrated_0001.js | 1 + .../directive-prolog/migrated_0001.tree.json | 474 + .../expression/additive/migrated_0000.js | 1 + .../additive/migrated_0000.tree.json | 147 + .../expression/additive/migrated_0001.js | 1 + .../additive/migrated_0001.tree.json | 147 + .../expression/additive/migrated_0002.js | 1 + .../additive/migrated_0002.tree.json | 149 + .../expression/assignment/migrated_0000.js | 1 + .../assignment/migrated_0000.tree.json | 148 + .../expression/assignment/migrated_0001.js | 1 + .../assignment/migrated_0001.tree.json | 148 + .../expression/assignment/migrated_0002.js | 1 + .../assignment/migrated_0002.tree.json | 148 + .../expression/assignment/migrated_0003.js | 1 + .../assignment/migrated_0003.tree.json | 148 + .../expression/assignment/migrated_0004.js | 1 + .../assignment/migrated_0004.tree.json | 148 + .../expression/assignment/migrated_0005.js | 1 + .../assignment/migrated_0005.tree.json | 148 + .../expression/assignment/migrated_0006.js | 1 + .../assignment/migrated_0006.tree.json | 148 + .../expression/assignment/migrated_0007.js | 1 + .../assignment/migrated_0007.tree.json | 148 + .../expression/assignment/migrated_0008.js | 1 + .../assignment/migrated_0008.tree.json | 148 + .../expression/assignment/migrated_0009.js | 1 + .../assignment/migrated_0009.tree.json | 148 + .../expression/assignment/migrated_0010.js | 1 + .../assignment/migrated_0010.tree.json | 148 + .../expression/assignment/migrated_0011.js | 1 + .../assignment/migrated_0011.tree.json | 148 + .../expression/assignment/migrated_0012.js | 1 + .../assignment/migrated_0012.tree.json | 148 + .../expression/assignment/migrated_0013.js | 1 + .../assignment/migrated_0013.tree.json | 148 + .../binary-bitwise/migrated_0000.js | 1 + .../binary-bitwise/migrated_0000.tree.json | 147 + .../binary-bitwise/migrated_0001.js | 1 + .../binary-bitwise/migrated_0001.tree.json | 147 + .../binary-bitwise/migrated_0002.js | 1 + .../binary-bitwise/migrated_0002.tree.json | 147 + .../binary-logical/migrated_0000.js | 1 + .../binary-logical/migrated_0000.tree.json | 147 + .../binary-logical/migrated_0001.js | 1 + .../binary-logical/migrated_0001.tree.json | 147 + .../binary-logical/migrated_0002.js | 1 + .../binary-logical/migrated_0002.tree.json | 219 + .../binary-logical/migrated_0003.js | 1 + .../binary-logical/migrated_0003.tree.json | 219 + .../binary-logical/migrated_0004.js | 1 + .../binary-logical/migrated_0004.tree.json | 219 + .../binary-logical/migrated_0005.js | 1 + .../binary-logical/migrated_0005.tree.json | 219 + .../expression/binary/migrated_0000.js | 1 + .../expression/binary/migrated_0000.tree.json | 219 + .../expression/binary/migrated_0001.js | 1 + .../expression/binary/migrated_0001.tree.json | 219 + .../expression/binary/migrated_0002.js | 1 + .../expression/binary/migrated_0002.tree.json | 219 + .../expression/binary/migrated_0003.js | 1 + .../expression/binary/migrated_0003.tree.json | 219 + .../expression/binary/migrated_0004.js | 1 + .../expression/binary/migrated_0004.tree.json | 219 + .../expression/binary/migrated_0005.js | 1 + .../expression/binary/migrated_0005.tree.json | 219 + .../expression/binary/migrated_0006.js | 1 + .../expression/binary/migrated_0006.tree.json | 219 + .../expression/binary/migrated_0007.js | 1 + .../expression/binary/migrated_0007.tree.json | 219 + .../expression/binary/migrated_0008.js | 1 + .../expression/binary/migrated_0008.tree.json | 219 + .../expression/binary/migrated_0009.js | 1 + .../expression/binary/migrated_0009.tree.json | 219 + .../expression/binary/migrated_0010.js | 1 + .../expression/binary/migrated_0010.tree.json | 219 + .../expression/binary/migrated_0011.js | 1 + .../expression/binary/migrated_0011.tree.json | 219 + .../expression/binary/migrated_0012.js | 1 + .../expression/binary/migrated_0012.tree.json | 219 + .../expression/binary/migrated_0013.js | 1 + .../expression/binary/migrated_0013.tree.json | 219 + .../expression/binary/migrated_0014.js | 1 + .../expression/binary/migrated_0014.tree.json | 219 + .../expression/binary/migrated_0015.js | 1 + .../expression/binary/migrated_0015.tree.json | 219 + .../expression/binary/migrated_0016.js | 1 + .../expression/binary/migrated_0016.tree.json | 219 + .../expression/binary/migrated_0017.js | 1 + .../expression/binary/migrated_0017.tree.json | 219 + .../expression/bitwise-shift/migrated_0000.js | 1 + .../bitwise-shift/migrated_0000.tree.json | 147 + .../expression/bitwise-shift/migrated_0001.js | 1 + .../bitwise-shift/migrated_0001.tree.json | 147 + .../expression/bitwise-shift/migrated_0002.js | 1 + .../bitwise-shift/migrated_0002.tree.json | 147 + .../expression/complex/migrated_0000.js | 1 + .../complex/migrated_0000.tree.json | 795 ++ .../expression/conditional/migrated_0000.js | 1 + .../conditional/migrated_0000.tree.json | 202 + .../expression/conditional/migrated_0001.js | 1 + .../conditional/migrated_0001.tree.json | 274 + .../expression/conditional/migrated_0002.js | 1 + .../conditional/migrated_0002.tree.json | 311 + .../expression/equality/migrated_0000.js | 1 + .../equality/migrated_0000.tree.json | 147 + .../expression/equality/migrated_0001.js | 1 + .../equality/migrated_0001.tree.json | 147 + .../expression/equality/migrated_0002.js | 1 + .../equality/migrated_0002.tree.json | 147 + .../expression/equality/migrated_0003.js | 1 + .../equality/migrated_0003.tree.json | 147 + .../expression/grouping/migrated_0000.js | 1 + .../grouping/migrated_0000.tree.json | 294 + .../expression/grouping/migrated_0001.js | 1 + .../grouping/migrated_0001.tree.json | 258 + .../left-hand-side/let_object_computed.js | 1 + .../let_object_computed.tree.json | 273 + .../left-hand-side/migrated_0000.js | 1 + .../left-hand-side/migrated_0000.tree.json | 111 + .../left-hand-side/migrated_0001.js | 1 + .../left-hand-side/migrated_0001.tree.json | 147 + .../left-hand-side/migrated_0002.js | 1 + .../left-hand-side/migrated_0002.tree.json | 147 + .../left-hand-side/migrated_0003.js | 1 + .../left-hand-side/migrated_0003.tree.json | 183 + .../left-hand-side/migrated_0004.js | 1 + .../left-hand-side/migrated_0004.tree.json | 273 + .../left-hand-side/migrated_0005.js | 1 + .../left-hand-side/migrated_0005.tree.json | 201 + .../left-hand-side/migrated_0006.js | 1 + .../left-hand-side/migrated_0006.tree.json | 219 + .../left-hand-side/migrated_0007.js | 1 + .../left-hand-side/migrated_0007.tree.json | 273 + .../left-hand-side/migrated_0008.js | 1 + .../left-hand-side/migrated_0008.tree.json | 220 + .../left-hand-side/migrated_0009.js | 1 + .../left-hand-side/migrated_0009.tree.json | 165 + .../left-hand-side/migrated_0010.js | 1 + .../left-hand-side/migrated_0010.tree.json | 147 + .../left-hand-side/migrated_0011.js | 1 + .../left-hand-side/migrated_0011.tree.json | 219 + .../left-hand-side/migrated_0012.js | 1 + .../left-hand-side/migrated_0012.tree.json | 291 + .../left-hand-side/migrated_0013.js | 1 + .../left-hand-side/migrated_0013.tree.json | 238 + .../left-hand-side/migrated_0014.js | 1 + .../left-hand-side/migrated_0014.tree.json | 165 + .../left-hand-side/migrated_0015.js | 1 + .../left-hand-side/migrated_0015.tree.json | 238 + .../left-hand-side/migrated_0016.js | 1 + .../left-hand-side/migrated_0016.tree.json | 239 + .../left-hand-side/migrated_0017.js | 1 + .../left-hand-side/migrated_0017.tree.json | 513 + .../left-hand-side/migrated_0018.js | 1 + .../left-hand-side/migrated_0018.tree.json | 383 + .../left-hand-side/migrated_0019.js | 1 + .../left-hand-side/migrated_0019.tree.json | 147 + .../left-hand-side/migrated_0020.js | 1 + .../left-hand-side/migrated_0020.tree.json | 147 + .../left-hand-side/migrated_0021.js | 1 + .../left-hand-side/migrated_0021.tree.json | 147 + .../left-hand-side/migrated_0022.js | 1 + .../left-hand-side/migrated_0022.tree.json | 147 + .../multiplicative/migrated_0000.js | 1 + .../multiplicative/migrated_0000.tree.json | 147 + .../multiplicative/migrated_0001.js | 1 + .../multiplicative/migrated_0001.tree.json | 147 + .../multiplicative/migrated_0002.js | 1 + .../multiplicative/migrated_0002.tree.json | 147 + .../expression/postfix/migrated_0000.js | 1 + .../postfix/migrated_0000.tree.json | 112 + .../expression/postfix/migrated_0001.js | 1 + .../postfix/migrated_0001.tree.json | 112 + .../expression/postfix/migrated_0002.js | 1 + .../postfix/migrated_0002.tree.json | 112 + .../expression/postfix/migrated_0003.js | 1 + .../postfix/migrated_0003.tree.json | 112 + .../expression/postfix/migrated_0004.js | 1 + .../postfix/migrated_0004.tree.json | 112 + .../expression/postfix/migrated_0005.js | 1 + .../postfix/migrated_0005.tree.json | 112 + .../expression/primary/array/migrated_0000.js | 1 + .../primary/array/migrated_0000.tree.json | 165 + .../expression/primary/array/migrated_0001.js | 1 + .../primary/array/migrated_0001.tree.json | 165 + .../expression/primary/array/migrated_0002.js | 1 + .../primary/array/migrated_0002.tree.json | 203 + .../expression/primary/array/migrated_0003.js | 1 + .../primary/array/migrated_0003.tree.json | 221 + .../expression/primary/array/migrated_0004.js | 1 + .../primary/array/migrated_0004.tree.json | 241 + .../expression/primary/array/migrated_0005.js | 1 + .../primary/array/migrated_0005.tree.json | 331 + .../expression/primary/array/migrated_0006.js | 1 + .../primary/array/migrated_0006.tree.json | 350 + .../expression/primary/array/migrated_0007.js | 1 + .../primary/array/migrated_0007.tree.json | 165 + .../primary/array/migrated_0008.source.js | 1 + .../primary/array/migrated_0008.tree.json | 165 + .../primary/array/migrated_0009.source.js | 1 + .../primary/array/migrated_0009.tree.json | 165 + .../primary/array/migrated_0010.source.js | 1 + .../primary/array/migrated_0010.tree.json | 165 + .../primary/array/migrated_0011.source.js | 1 + .../primary/array/migrated_0011.tree.json | 165 + .../primary/array/migrated_0012.source.js | 1 + .../primary/array/migrated_0012.tree.json | 165 + .../primary/literal/numeric/migrated_0000.js | 1 + .../literal/numeric/migrated_0000.tree.json | 76 + .../primary/literal/numeric/migrated_0001.js | 1 + .../literal/numeric/migrated_0001.tree.json | 76 + .../primary/literal/numeric/migrated_0002.js | 1 + .../literal/numeric/migrated_0002.tree.json | 36 + .../primary/literal/numeric/migrated_0003.js | 1 + .../literal/numeric/migrated_0003.tree.json | 60 + .../primary/literal/numeric/migrated_0004.js | 1 + .../literal/numeric/migrated_0004.tree.json | 76 + .../primary/literal/numeric/migrated_0005.js | 1 + .../literal/numeric/migrated_0005.tree.json | 76 + .../primary/literal/numeric/migrated_0006.js | 1 + .../literal/numeric/migrated_0006.tree.json | 76 + .../primary/literal/numeric/migrated_0007.js | 1 + .../literal/numeric/migrated_0007.tree.json | 76 + .../primary/literal/numeric/migrated_0008.js | 1 + .../literal/numeric/migrated_0008.tree.json | 76 + .../primary/literal/numeric/migrated_0009.js | 1 + .../literal/numeric/migrated_0009.tree.json | 94 + .../literal/numeric/migrated_0010.diff | 10 + .../primary/literal/numeric/migrated_0010.js | 1 + .../literal/numeric/migrated_0010.tree.json | 76 + .../primary/literal/numeric/migrated_0011.js | 1 + .../literal/numeric/migrated_0011.tree.json | 76 + .../primary/literal/numeric/migrated_0012.js | 1 + .../literal/numeric/migrated_0012.tree.json | 76 + .../primary/literal/numeric/migrated_0013.js | 1 + .../literal/numeric/migrated_0013.tree.json | 76 + .../primary/literal/numeric/migrated_0014.js | 1 + .../literal/numeric/migrated_0014.tree.json | 76 + .../primary/literal/numeric/migrated_0015.js | 1 + .../literal/numeric/migrated_0015.tree.json | 76 + .../primary/literal/numeric/migrated_0016.js | 1 + .../literal/numeric/migrated_0016.tree.json | 76 + .../primary/literal/numeric/migrated_0017.js | 1 + .../literal/numeric/migrated_0017.tree.json | 76 + .../primary/literal/numeric/migrated_0018.js | 1 + .../literal/numeric/migrated_0018.tree.json | 76 + .../primary/literal/numeric/migrated_0019.js | 1 + .../literal/numeric/migrated_0019.tree.json | 76 + .../primary/literal/numeric/migrated_0020.js | 1 + .../literal/numeric/migrated_0020.tree.json | 76 + .../primary/literal/numeric/migrated_0021.js | 1 + .../literal/numeric/migrated_0021.tree.json | 76 + .../primary/literal/numeric/migrated_0022.js | 1 + .../literal/numeric/migrated_0022.tree.json | 76 + .../primary/literal/numeric/migrated_0023.js | 1 + .../literal/numeric/migrated_0023.tree.json | 76 + .../primary/literal/numeric/migrated_0024.js | 1 + .../literal/numeric/migrated_0024.tree.json | 76 + .../regular-expression/migrated_0000.diff | 9 + .../regular-expression/migrated_0000.js | 1 + .../migrated_0000.tree.json | 102 + .../regular-expression/migrated_0001.diff | 13 + .../regular-expression/migrated_0001.js | 1 + .../migrated_0001.tree.json | 139 + .../regular-expression/migrated_0002.diff | 13 + .../regular-expression/migrated_0002.js | 1 + .../migrated_0002.tree.json | 176 + .../regular-expression/migrated_0003.js | 1 + .../migrated_0003.tree.json | 176 + .../regular-expression/migrated_0004.js | 1 + .../migrated_0004.tree.json | 176 + .../migrated_0005.source.js | 1 + .../migrated_0005.tree.json | 176 + .../migrated_0006.failure.json | 6 + .../migrated_0006.source.js | 1 + .../regular-expression/migrated_0007.diff | 13 + .../regular-expression/migrated_0007.js | 1 + .../migrated_0007.tree.json | 86 + .../regular-expression/migrated_0008.diff | 13 + .../regular-expression/migrated_0008.js | 1 + .../migrated_0008.tree.json | 140 + .../regular-expression/migrated_0009.diff | 13 + .../regular-expression/migrated_0009.js | 1 + .../migrated_0009.tree.json | 176 + .../regular-expression/migrated_0010.diff | 13 + .../regular-expression/migrated_0010.js | 1 + .../migrated_0010.tree.json | 176 + .../regular-expression/migrated_0011.diff | 13 + .../regular-expression/migrated_0011.js | 1 + .../migrated_0011.tree.json | 176 + .../regular-expression/migrated_0012.diff | 13 + .../regular-expression/migrated_0012.js | 1 + .../migrated_0012.tree.json | 176 + .../regular-expression/migrated_0013.diff | 15 + .../regular-expression/migrated_0013.js | 1 + .../migrated_0013.tree.json | 248 + .../u-flag-invalid-range-4-hex.failure.json | 6 + .../u-flag-invalid-range-4-hex.js | 1 + .../u-flag-invalid-range-var-hex.failure.json | 6 + .../u-flag-invalid-range-var-hex.js | 1 + .../u-flag-surrogate-pair.js | 1 + .../u-flag-surrogate-pair.tree.json | 176 + .../regular-expression/u-flag-valid-range.js | 1 + .../u-flag-valid-range.tree.json | 194 + .../primary/literal/string/migrated_0000.js | 1 + .../literal/string/migrated_0000.tree.json | 77 + .../primary/literal/string/migrated_0001.js | 1 + .../literal/string/migrated_0001.tree.json | 77 + .../literal/string/migrated_0002.source.js | 1 + .../literal/string/migrated_0002.tree.json | 77 + .../primary/literal/string/migrated_0003.js | 1 + .../literal/string/migrated_0003.tree.json | 77 + .../primary/literal/string/migrated_0006.js | 1 + .../literal/string/migrated_0006.tree.json | 77 + .../primary/literal/string/migrated_0007.js | 2 + .../literal/string/migrated_0007.tree.json | 77 + .../primary/literal/string/migrated_0008.js | 1 + .../literal/string/migrated_0008.tree.json | 77 + .../primary/literal/string/migrated_0009.js | 1 + .../literal/string/migrated_0009.tree.json | 77 + .../primary/literal/string/migrated_0010.js | 1 + .../literal/string/migrated_0010.tree.json | 77 + .../primary/literal/string/migrated_0011.js | 1 + .../literal/string/migrated_0011.tree.json | 77 + .../primary/literal/string/migrated_0012.js | 1 + .../literal/string/migrated_0012.tree.json | 77 + .../primary/literal/string/migrated_0013.js | 1 + .../literal/string/migrated_0013.tree.json | 77 + .../primary/literal/string/migrated_0015.js | 1 + .../literal/string/migrated_0015.tree.json | 77 + .../primary/literal/string/migrated_0016.js | 1 + .../literal/string/migrated_0016.tree.json | 77 + .../primary/literal/string/migrated_0017.js | 2 + .../literal/string/migrated_0017.tree.json | 77 + .../primary/literal/string/migrated_0018.js | 1 + .../literal/string/migrated_0018.tree.json | 77 + .../primary/object/migrated_0000.js | 1 + .../primary/object/migrated_0000.tree.json | 165 + .../primary/object/migrated_0001.js | 1 + .../primary/object/migrated_0001.tree.json | 165 + .../primary/object/migrated_0002.js | 1 + .../primary/object/migrated_0002.tree.json | 278 + .../primary/object/migrated_0003.js | 1 + .../primary/object/migrated_0003.tree.json | 278 + .../primary/object/migrated_0004.js | 1 + .../primary/object/migrated_0004.tree.json | 278 + .../primary/object/migrated_0005.js | 1 + .../primary/object/migrated_0005.tree.json | 278 + .../primary/object/migrated_0006.js | 1 + .../primary/object/migrated_0006.tree.json | 278 + .../primary/object/migrated_0007.js | 1 + .../primary/object/migrated_0007.tree.json | 279 + .../primary/object/migrated_0008.js | 1 + .../primary/object/migrated_0008.tree.json | 408 + .../primary/object/migrated_0009.diff | 24 + .../primary/object/migrated_0009.js | 1 + .../primary/object/migrated_0009.tree.json | 424 + .../primary/object/migrated_0010.js | 1 + .../primary/object/migrated_0010.tree.json | 352 + .../primary/object/migrated_0011.js | 1 + .../primary/object/migrated_0011.tree.json | 352 + .../primary/object/migrated_0012.js | 1 + .../primary/object/migrated_0012.tree.json | 352 + .../primary/object/migrated_0013.js | 1 + .../primary/object/migrated_0013.tree.json | 352 + .../primary/object/migrated_0014.js | 1 + .../primary/object/migrated_0014.tree.json | 352 + .../primary/object/migrated_0015.js | 1 + .../primary/object/migrated_0015.tree.json | 353 + .../primary/object/migrated_0016.js | 1 + .../primary/object/migrated_0016.tree.json | 353 + .../primary/object/migrated_0017.diff | 24 + .../primary/object/migrated_0017.js | 1 + .../primary/object/migrated_0017.tree.json | 515 + .../primary/object/migrated_0018.diff | 24 + .../primary/object/migrated_0018.js | 1 + .../primary/object/migrated_0018.tree.json | 515 + .../primary/object/migrated_0019.diff | 24 + .../primary/object/migrated_0019.js | 1 + .../primary/object/migrated_0019.tree.json | 515 + .../primary/object/migrated_0020.diff | 24 + .../primary/object/migrated_0020.js | 1 + .../primary/object/migrated_0020.tree.json | 515 + .../primary/object/migrated_0021.diff | 24 + .../primary/object/migrated_0021.js | 1 + .../primary/object/migrated_0021.tree.json | 515 + .../primary/object/migrated_0022.diff | 24 + .../primary/object/migrated_0022.js | 1 + .../primary/object/migrated_0022.tree.json | 516 + .../primary/object/migrated_0023.diff | 24 + .../primary/object/migrated_0023.js | 1 + .../primary/object/migrated_0023.tree.json | 516 + .../primary/object/migrated_0024.js | 1 + .../primary/object/migrated_0024.tree.json | 278 + .../primary/object/migrated_0025.js | 1 + .../primary/object/migrated_0025.tree.json | 278 + .../primary/object/migrated_0026.js | 1 + .../primary/object/migrated_0026.tree.json | 278 + .../primary/object/migrated_0027.js | 1 + .../primary/object/migrated_0027.tree.json | 279 + .../primary/object/migrated_0028.diff | 24 + .../primary/object/migrated_0028.js | 1 + .../primary/object/migrated_0028.tree.json | 809 ++ .../primary/object/migrated_0029.js | 1 + .../primary/object/migrated_0029.tree.json | 446 + .../primary/object/migrated_0030.js | 1 + .../primary/object/migrated_0030.tree.json | 482 + .../primary/object/migrated_0031.js | 1 + .../primary/object/migrated_0031.tree.json | 650 + .../primary/object/migrated_0032.js | 1 + .../primary/object/migrated_0032.tree.json | 576 + .../primary/object/migrated_0033.js | 1 + .../primary/object/migrated_0033.tree.json | 613 + .../primary/object/migrated_0034.js | 1 + .../primary/object/migrated_0034.tree.json | 334 + .../primary/object/migrated_0035.js | 1 + .../primary/object/migrated_0035.tree.json | 370 + .../primary/object/migrated_0036.js | 1 + .../primary/object/migrated_0036.tree.json | 446 + .../primary/object/migrated_0037.js | 1 + .../primary/object/migrated_0037.tree.json | 243 + .../primary/object/migrated_0038.js | 1 + .../primary/object/migrated_0038.tree.json | 425 + .../expression/primary/other/migrated_0000.js | 1 + .../primary/other/migrated_0000.tree.json | 74 + .../expression/primary/other/migrated_0001.js | 1 + .../primary/other/migrated_0001.tree.json | 76 + .../expression/primary/other/migrated_0002.js | 3 + .../primary/other/migrated_0002.tree.json | 76 + .../expression/primary/other/migrated_0003.js | 1 + .../primary/other/migrated_0003.tree.json | 258 + .../expression/relational/migrated_0000.js | 1 + .../relational/migrated_0000.tree.json | 147 + .../expression/relational/migrated_0001.js | 1 + .../relational/migrated_0001.tree.json | 147 + .../expression/relational/migrated_0002.js | 1 + .../relational/migrated_0002.tree.json | 147 + .../expression/relational/migrated_0003.js | 1 + .../relational/migrated_0003.tree.json | 147 + .../expression/relational/migrated_0004.js | 1 + .../relational/migrated_0004.tree.json | 147 + .../expression/relational/migrated_0005.js | 1 + .../relational/migrated_0005.tree.json | 147 + .../expression/relational/migrated_0006.js | 1 + .../relational/migrated_0006.tree.json | 219 + .../esprima/expression/unary/migrated_0000.js | 1 + .../expression/unary/migrated_0000.tree.json | 112 + .../esprima/expression/unary/migrated_0001.js | 1 + .../expression/unary/migrated_0001.tree.json | 112 + .../esprima/expression/unary/migrated_0002.js | 1 + .../expression/unary/migrated_0002.tree.json | 112 + .../esprima/expression/unary/migrated_0003.js | 1 + .../expression/unary/migrated_0003.tree.json | 112 + .../esprima/expression/unary/migrated_0004.js | 1 + .../expression/unary/migrated_0004.tree.json | 112 + .../esprima/expression/unary/migrated_0005.js | 1 + .../expression/unary/migrated_0005.tree.json | 112 + .../esprima/expression/unary/migrated_0006.js | 1 + .../expression/unary/migrated_0006.tree.json | 112 + .../esprima/expression/unary/migrated_0007.js | 1 + .../expression/unary/migrated_0007.tree.json | 112 + .../esprima/expression/unary/migrated_0008.js | 1 + .../expression/unary/migrated_0008.tree.json | 112 + .../esprima/expression/unary/migrated_0009.js | 1 + .../expression/unary/migrated_0009.tree.json | 112 + .../esprima/expression/unary/migrated_0010.js | 1 + .../expression/unary/migrated_0010.tree.json | 112 + .../esprima/expression/unary/migrated_0011.js | 1 + .../expression/unary/migrated_0011.tree.json | 112 + .../esprima/expression/unary/migrated_0012.js | 1 + .../expression/unary/migrated_0012.tree.json | 112 + .../invalid-syntax/GH-1106-00.failure.json | 6 + lib/test/esprima/invalid-syntax/GH-1106-00.js | 1 + .../invalid-syntax/GH-1106-01.failure.json | 6 + lib/test/esprima/invalid-syntax/GH-1106-01.js | 1 + .../invalid-syntax/GH-1106-02.failure.json | 6 + lib/test/esprima/invalid-syntax/GH-1106-02.js | 1 + .../invalid-syntax/GH-1106-03.failure.json | 6 + lib/test/esprima/invalid-syntax/GH-1106-03.js | 1 + .../invalid-syntax/GH-1106-04.failure.json | 6 + lib/test/esprima/invalid-syntax/GH-1106-04.js | 1 + .../invalid-syntax/GH-1106-05.failure.json | 6 + lib/test/esprima/invalid-syntax/GH-1106-05.js | 1 + .../invalid-syntax/GH-1106-06.failure.json | 6 + lib/test/esprima/invalid-syntax/GH-1106-06.js | 1 + .../invalid-syntax/GH-1106-07.failure.json | 6 + lib/test/esprima/invalid-syntax/GH-1106-07.js | 1 + .../invalid-syntax/GH-1106-08.failure.json | 6 + lib/test/esprima/invalid-syntax/GH-1106-08.js | 1 + .../invalid-syntax/GH-1106-09.failure.json | 6 + lib/test/esprima/invalid-syntax/GH-1106-09.js | 1 + .../invalid-syntax/migrated_0000.failure.json | 6 + .../esprima/invalid-syntax/migrated_0000.js | 1 + .../invalid-syntax/migrated_0001.failure.json | 6 + .../esprima/invalid-syntax/migrated_0001.js | 1 + .../invalid-syntax/migrated_0002.failure.json | 6 + .../esprima/invalid-syntax/migrated_0002.js | 1 + .../invalid-syntax/migrated_0003.failure.json | 6 + .../esprima/invalid-syntax/migrated_0003.js | 1 + .../invalid-syntax/migrated_0004.failure.json | 6 + .../esprima/invalid-syntax/migrated_0004.js | 1 + .../invalid-syntax/migrated_0005.failure.json | 6 + .../esprima/invalid-syntax/migrated_0005.js | 1 + .../invalid-syntax/migrated_0006.failure.json | 6 + .../esprima/invalid-syntax/migrated_0006.js | 1 + .../invalid-syntax/migrated_0007.failure.json | 6 + .../esprima/invalid-syntax/migrated_0007.js | 1 + .../invalid-syntax/migrated_0008.failure.json | 6 + .../esprima/invalid-syntax/migrated_0008.js | 1 + .../invalid-syntax/migrated_0009.failure.json | 6 + .../esprima/invalid-syntax/migrated_0009.js | 1 + .../invalid-syntax/migrated_0010.failure.json | 6 + .../esprima/invalid-syntax/migrated_0010.js | 1 + .../invalid-syntax/migrated_0011.failure.json | 6 + .../esprima/invalid-syntax/migrated_0011.js | 1 + .../invalid-syntax/migrated_0012.failure.json | 6 + .../esprima/invalid-syntax/migrated_0012.js | 1 + .../invalid-syntax/migrated_0013.failure.json | 6 + .../esprima/invalid-syntax/migrated_0013.js | 1 + .../invalid-syntax/migrated_0014.failure.json | 6 + .../esprima/invalid-syntax/migrated_0014.js | 1 + .../invalid-syntax/migrated_0015.failure.json | 6 + .../esprima/invalid-syntax/migrated_0015.js | 1 + .../invalid-syntax/migrated_0016.failure.json | 6 + .../esprima/invalid-syntax/migrated_0016.js | 1 + .../invalid-syntax/migrated_0017.failure.json | 6 + .../esprima/invalid-syntax/migrated_0017.js | 1 + .../invalid-syntax/migrated_0018.failure.json | 6 + .../esprima/invalid-syntax/migrated_0018.js | 1 + .../invalid-syntax/migrated_0019.failure.json | 6 + .../esprima/invalid-syntax/migrated_0019.js | 1 + .../invalid-syntax/migrated_0020.failure.json | 6 + .../esprima/invalid-syntax/migrated_0020.js | 1 + .../invalid-syntax/migrated_0021.failure.json | 6 + .../esprima/invalid-syntax/migrated_0021.js | 1 + .../invalid-syntax/migrated_0022.failure.json | 6 + .../esprima/invalid-syntax/migrated_0022.js | 1 + .../invalid-syntax/migrated_0023.failure.json | 6 + .../esprima/invalid-syntax/migrated_0023.js | 1 + .../invalid-syntax/migrated_0024.failure.json | 6 + .../esprima/invalid-syntax/migrated_0024.js | 1 + .../invalid-syntax/migrated_0025.failure.json | 6 + .../esprima/invalid-syntax/migrated_0025.js | 1 + .../invalid-syntax/migrated_0026.failure.json | 6 + .../esprima/invalid-syntax/migrated_0026.js | 1 + .../invalid-syntax/migrated_0027.failure.json | 6 + .../esprima/invalid-syntax/migrated_0027.js | 1 + .../invalid-syntax/migrated_0028.failure.json | 6 + .../esprima/invalid-syntax/migrated_0028.js | 1 + .../invalid-syntax/migrated_0029.failure.json | 6 + .../esprima/invalid-syntax/migrated_0029.js | 1 + .../invalid-syntax/migrated_0030.failure.json | 6 + .../esprima/invalid-syntax/migrated_0030.js | 1 + .../invalid-syntax/migrated_0031.failure.json | 6 + .../esprima/invalid-syntax/migrated_0031.js | 2 + .../invalid-syntax/migrated_0032.failure.json | 6 + .../esprima/invalid-syntax/migrated_0032.js | 1 + .../invalid-syntax/migrated_0033.failure.json | 6 + .../invalid-syntax/migrated_0033.source.js | 1 + .../invalid-syntax/migrated_0034.failure.json | 6 + .../invalid-syntax/migrated_0034.source.js | 1 + .../invalid-syntax/migrated_0035.failure.json | 6 + .../esprima/invalid-syntax/migrated_0035.js | 1 + .../invalid-syntax/migrated_0036.failure.json | 6 + .../invalid-syntax/migrated_0036.source.js | 1 + .../invalid-syntax/migrated_0037.failure.json | 6 + .../invalid-syntax/migrated_0037.source.js | 1 + .../invalid-syntax/migrated_0038.failure.json | 6 + .../esprima/invalid-syntax/migrated_0038.js | 1 + .../invalid-syntax/migrated_0039.failure.json | 6 + .../esprima/invalid-syntax/migrated_0039.js | 1 + .../invalid-syntax/migrated_0040.failure.json | 6 + .../esprima/invalid-syntax/migrated_0040.js | 2 + .../invalid-syntax/migrated_0041.failure.json | 6 + .../invalid-syntax/migrated_0041.source.js | 1 + .../invalid-syntax/migrated_0042.failure.json | 6 + .../invalid-syntax/migrated_0042.source.js | 1 + .../invalid-syntax/migrated_0043.failure.json | 6 + .../invalid-syntax/migrated_0043.source.js | 1 + .../invalid-syntax/migrated_0044.failure.json | 6 + .../invalid-syntax/migrated_0044.source.js | 1 + .../invalid-syntax/migrated_0045.failure.json | 6 + .../esprima/invalid-syntax/migrated_0045.js | 1 + .../invalid-syntax/migrated_0046.failure.json | 6 + .../esprima/invalid-syntax/migrated_0046.js | 1 + .../invalid-syntax/migrated_0047.failure.json | 6 + .../esprima/invalid-syntax/migrated_0047.js | 1 + .../invalid-syntax/migrated_0048.failure.json | 6 + .../invalid-syntax/migrated_0048.source.js | 1 + .../invalid-syntax/migrated_0049.failure.json | 6 + .../invalid-syntax/migrated_0049.source.js | 1 + .../invalid-syntax/migrated_0050.failure.json | 6 + .../invalid-syntax/migrated_0050.source.js | 1 + .../invalid-syntax/migrated_0051.failure.json | 6 + .../invalid-syntax/migrated_0051.source.js | 1 + .../invalid-syntax/migrated_0052.failure.json | 6 + .../esprima/invalid-syntax/migrated_0052.js | 1 + .../invalid-syntax/migrated_0053.failure.json | 6 + .../esprima/invalid-syntax/migrated_0053.js | 1 + .../invalid-syntax/migrated_0054.failure.json | 6 + .../esprima/invalid-syntax/migrated_0054.js | 1 + .../invalid-syntax/migrated_0055.failure.json | 6 + .../esprima/invalid-syntax/migrated_0055.js | 1 + .../invalid-syntax/migrated_0056.failure.json | 6 + .../esprima/invalid-syntax/migrated_0056.js | 1 + .../invalid-syntax/migrated_0057.failure.json | 6 + .../esprima/invalid-syntax/migrated_0057.js | 1 + .../invalid-syntax/migrated_0058.failure.json | 6 + .../esprima/invalid-syntax/migrated_0058.js | 1 + .../invalid-syntax/migrated_0059.failure.json | 6 + .../esprima/invalid-syntax/migrated_0059.js | 1 + .../invalid-syntax/migrated_0060.failure.json | 6 + .../esprima/invalid-syntax/migrated_0060.js | 1 + .../invalid-syntax/migrated_0061.failure.json | 6 + .../esprima/invalid-syntax/migrated_0061.js | 1 + .../invalid-syntax/migrated_0062.failure.json | 6 + .../esprima/invalid-syntax/migrated_0062.js | 2 + .../invalid-syntax/migrated_0063.failure.json | 6 + .../esprima/invalid-syntax/migrated_0063.js | 1 + .../invalid-syntax/migrated_0064.failure.json | 6 + .../esprima/invalid-syntax/migrated_0064.js | 1 + .../invalid-syntax/migrated_0065.failure.json | 6 + .../esprima/invalid-syntax/migrated_0065.js | 1 + .../invalid-syntax/migrated_0066.failure.json | 6 + .../esprima/invalid-syntax/migrated_0066.js | 1 + .../invalid-syntax/migrated_0067.failure.json | 6 + .../esprima/invalid-syntax/migrated_0067.js | 1 + .../invalid-syntax/migrated_0068.failure.json | 6 + .../esprima/invalid-syntax/migrated_0068.js | 1 + .../invalid-syntax/migrated_0069.failure.json | 6 + .../esprima/invalid-syntax/migrated_0069.js | 4 + .../invalid-syntax/migrated_0070.failure.json | 6 + .../esprima/invalid-syntax/migrated_0070.js | 4 + .../invalid-syntax/migrated_0071.failure.json | 6 + .../esprima/invalid-syntax/migrated_0071.js | 1 + .../invalid-syntax/migrated_0072.failure.json | 6 + .../esprima/invalid-syntax/migrated_0072.js | 1 + .../invalid-syntax/migrated_0073.failure.json | 6 + .../esprima/invalid-syntax/migrated_0073.js | 1 + .../invalid-syntax/migrated_0074.failure.json | 6 + .../esprima/invalid-syntax/migrated_0074.js | 1 + .../invalid-syntax/migrated_0075.failure.json | 6 + .../esprima/invalid-syntax/migrated_0075.js | 1 + .../invalid-syntax/migrated_0076.failure.json | 6 + .../esprima/invalid-syntax/migrated_0076.js | 1 + .../invalid-syntax/migrated_0077.failure.json | 6 + .../esprima/invalid-syntax/migrated_0077.js | 1 + .../invalid-syntax/migrated_0078.failure.json | 6 + .../esprima/invalid-syntax/migrated_0078.js | 1 + .../invalid-syntax/migrated_0080.failure.json | 6 + .../esprima/invalid-syntax/migrated_0080.js | 1 + .../invalid-syntax/migrated_0081.failure.json | 6 + .../esprima/invalid-syntax/migrated_0081.js | 1 + .../invalid-syntax/migrated_0082.failure.json | 6 + .../esprima/invalid-syntax/migrated_0082.js | 1 + .../invalid-syntax/migrated_0083.failure.json | 6 + .../esprima/invalid-syntax/migrated_0083.js | 1 + .../invalid-syntax/migrated_0084.failure.json | 6 + .../esprima/invalid-syntax/migrated_0084.js | 1 + .../invalid-syntax/migrated_0085.failure.json | 6 + .../esprima/invalid-syntax/migrated_0085.js | 1 + .../invalid-syntax/migrated_0086.failure.json | 6 + .../esprima/invalid-syntax/migrated_0086.js | 1 + .../invalid-syntax/migrated_0087.failure.json | 6 + .../esprima/invalid-syntax/migrated_0087.js | 1 + .../invalid-syntax/migrated_0088.failure.json | 6 + .../esprima/invalid-syntax/migrated_0088.js | 1 + .../invalid-syntax/migrated_0089.failure.json | 6 + .../esprima/invalid-syntax/migrated_0089.js | 1 + .../invalid-syntax/migrated_0090.failure.json | 6 + .../esprima/invalid-syntax/migrated_0090.js | 1 + .../invalid-syntax/migrated_0091.failure.json | 6 + .../esprima/invalid-syntax/migrated_0091.js | 1 + .../invalid-syntax/migrated_0092.failure.json | 6 + .../esprima/invalid-syntax/migrated_0092.js | 1 + .../invalid-syntax/migrated_0093.failure.json | 6 + .../esprima/invalid-syntax/migrated_0093.js | 1 + .../invalid-syntax/migrated_0094.failure.json | 6 + .../esprima/invalid-syntax/migrated_0094.js | 1 + .../invalid-syntax/migrated_0095.failure.json | 6 + .../esprima/invalid-syntax/migrated_0095.js | 1 + .../invalid-syntax/migrated_0096.failure.json | 6 + .../esprima/invalid-syntax/migrated_0096.js | 1 + .../invalid-syntax/migrated_0097.failure.json | 6 + .../esprima/invalid-syntax/migrated_0097.js | 1 + .../invalid-syntax/migrated_0098.failure.json | 6 + .../esprima/invalid-syntax/migrated_0098.js | 1 + .../invalid-syntax/migrated_0099.failure.json | 6 + .../esprima/invalid-syntax/migrated_0099.js | 1 + .../invalid-syntax/migrated_0100.failure.json | 6 + .../esprima/invalid-syntax/migrated_0100.js | 1 + .../invalid-syntax/migrated_0101.failure.json | 6 + .../esprima/invalid-syntax/migrated_0101.js | 1 + .../invalid-syntax/migrated_0102.failure.json | 6 + .../esprima/invalid-syntax/migrated_0102.js | 1 + .../invalid-syntax/migrated_0103.failure.json | 6 + .../esprima/invalid-syntax/migrated_0103.js | 1 + .../invalid-syntax/migrated_0104.failure.json | 6 + .../esprima/invalid-syntax/migrated_0104.js | 1 + .../invalid-syntax/migrated_0105.failure.json | 6 + .../esprima/invalid-syntax/migrated_0105.js | 1 + .../invalid-syntax/migrated_0106.failure.json | 6 + .../esprima/invalid-syntax/migrated_0106.js | 1 + .../invalid-syntax/migrated_0107.failure.json | 6 + .../esprima/invalid-syntax/migrated_0107.js | 1 + .../invalid-syntax/migrated_0108.failure.json | 6 + .../esprima/invalid-syntax/migrated_0108.js | 1 + .../invalid-syntax/migrated_0109.failure.json | 6 + .../esprima/invalid-syntax/migrated_0109.js | 1 + .../invalid-syntax/migrated_0110.failure.json | 6 + .../esprima/invalid-syntax/migrated_0110.js | 1 + .../invalid-syntax/migrated_0111.failure.json | 6 + .../esprima/invalid-syntax/migrated_0111.js | 1 + .../invalid-syntax/migrated_0112.failure.json | 6 + .../esprima/invalid-syntax/migrated_0112.js | 1 + .../invalid-syntax/migrated_0113.failure.json | 6 + .../esprima/invalid-syntax/migrated_0113.js | 1 + .../invalid-syntax/migrated_0114.failure.json | 6 + .../esprima/invalid-syntax/migrated_0114.js | 1 + .../invalid-syntax/migrated_0115.failure.json | 6 + .../esprima/invalid-syntax/migrated_0115.js | 1 + .../invalid-syntax/migrated_0116.failure.json | 6 + .../esprima/invalid-syntax/migrated_0116.js | 1 + .../invalid-syntax/migrated_0117.failure.json | 6 + .../esprima/invalid-syntax/migrated_0117.js | 1 + .../invalid-syntax/migrated_0118.failure.json | 6 + .../esprima/invalid-syntax/migrated_0118.js | 1 + .../invalid-syntax/migrated_0119.failure.json | 6 + .../esprima/invalid-syntax/migrated_0119.js | 1 + .../invalid-syntax/migrated_0120.failure.json | 6 + .../esprima/invalid-syntax/migrated_0120.js | 1 + .../invalid-syntax/migrated_0121.failure.json | 6 + .../esprima/invalid-syntax/migrated_0121.js | 1 + .../invalid-syntax/migrated_0122.failure.json | 6 + .../esprima/invalid-syntax/migrated_0122.js | 1 + .../invalid-syntax/migrated_0123.failure.json | 6 + .../esprima/invalid-syntax/migrated_0123.js | 1 + .../invalid-syntax/migrated_0124.failure.json | 6 + .../esprima/invalid-syntax/migrated_0124.js | 1 + .../invalid-syntax/migrated_0125.failure.json | 6 + .../esprima/invalid-syntax/migrated_0125.js | 1 + .../invalid-syntax/migrated_0126.failure.json | 6 + .../esprima/invalid-syntax/migrated_0126.js | 1 + .../invalid-syntax/migrated_0127.failure.json | 6 + .../esprima/invalid-syntax/migrated_0127.js | 1 + .../invalid-syntax/migrated_0128.failure.json | 6 + .../esprima/invalid-syntax/migrated_0128.js | 1 + .../invalid-syntax/migrated_0129.failure.json | 6 + .../esprima/invalid-syntax/migrated_0129.js | 1 + .../invalid-syntax/migrated_0130.failure.json | 6 + .../esprima/invalid-syntax/migrated_0130.js | 1 + .../invalid-syntax/migrated_0131.failure.json | 6 + .../esprima/invalid-syntax/migrated_0131.js | 1 + .../invalid-syntax/migrated_0132.failure.json | 6 + .../esprima/invalid-syntax/migrated_0132.js | 1 + .../invalid-syntax/migrated_0133.failure.json | 6 + .../esprima/invalid-syntax/migrated_0133.js | 1 + .../invalid-syntax/migrated_0134.failure.json | 6 + .../esprima/invalid-syntax/migrated_0134.js | 1 + .../invalid-syntax/migrated_0135.failure.json | 6 + .../esprima/invalid-syntax/migrated_0135.js | 1 + .../invalid-syntax/migrated_0136.failure.json | 6 + .../esprima/invalid-syntax/migrated_0136.js | 1 + .../invalid-syntax/migrated_0137.failure.json | 6 + .../invalid-syntax/migrated_0137.source.js | 1 + .../invalid-syntax/migrated_0138.failure.json | 6 + .../esprima/invalid-syntax/migrated_0138.js | 1 + .../invalid-syntax/migrated_0139.failure.json | 6 + .../esprima/invalid-syntax/migrated_0139.js | 1 + .../invalid-syntax/migrated_0140.failure.json | 6 + .../esprima/invalid-syntax/migrated_0140.js | 1 + .../invalid-syntax/migrated_0141.failure.json | 1 + .../esprima/invalid-syntax/migrated_0141.js | 1 + .../invalid-syntax/migrated_0142.failure.json | 6 + .../esprima/invalid-syntax/migrated_0142.js | 1 + .../invalid-syntax/migrated_0143.failure.json | 6 + .../esprima/invalid-syntax/migrated_0143.js | 1 + .../invalid-syntax/migrated_0144.failure.json | 6 + .../esprima/invalid-syntax/migrated_0144.js | 1 + .../invalid-syntax/migrated_0145.failure.json | 6 + .../esprima/invalid-syntax/migrated_0145.js | 1 + .../invalid-syntax/migrated_0146.failure.json | 6 + .../esprima/invalid-syntax/migrated_0146.js | 3 + .../invalid-syntax/migrated_0147.failure.json | 6 + .../esprima/invalid-syntax/migrated_0147.js | 1 + .../invalid-syntax/migrated_0148.failure.json | 6 + .../esprima/invalid-syntax/migrated_0148.js | 3 + .../invalid-syntax/migrated_0149.failure.json | 6 + .../esprima/invalid-syntax/migrated_0149.js | 1 + .../invalid-syntax/migrated_0150.failure.json | 6 + .../esprima/invalid-syntax/migrated_0150.js | 1 + .../invalid-syntax/migrated_0151.failure.json | 6 + .../esprima/invalid-syntax/migrated_0151.js | 2 + .../invalid-syntax/migrated_0152.failure.json | 6 + .../esprima/invalid-syntax/migrated_0152.js | 1 + .../invalid-syntax/migrated_0153.failure.json | 6 + .../esprima/invalid-syntax/migrated_0153.js | 2 + .../invalid-syntax/migrated_0154.failure.json | 6 + .../esprima/invalid-syntax/migrated_0154.js | 2 + .../invalid-syntax/migrated_0155.failure.json | 6 + .../esprima/invalid-syntax/migrated_0155.js | 2 + .../invalid-syntax/migrated_0156.failure.json | 6 + .../esprima/invalid-syntax/migrated_0156.js | 2 + .../invalid-syntax/migrated_0157.failure.json | 6 + .../esprima/invalid-syntax/migrated_0157.js | 2 + .../invalid-syntax/migrated_0158.failure.json | 6 + .../esprima/invalid-syntax/migrated_0158.js | 2 + .../invalid-syntax/migrated_0159.failure.json | 6 + .../esprima/invalid-syntax/migrated_0159.js | 2 + .../invalid-syntax/migrated_0160.failure.json | 6 + .../esprima/invalid-syntax/migrated_0160.js | 2 + .../invalid-syntax/migrated_0161.failure.json | 6 + .../esprima/invalid-syntax/migrated_0161.js | 2 + .../invalid-syntax/migrated_0162.failure.json | 6 + .../esprima/invalid-syntax/migrated_0162.js | 1 + .../invalid-syntax/migrated_0163.failure.json | 6 + .../invalid-syntax/migrated_0163.source.js | 1 + .../invalid-syntax/migrated_0164.failure.json | 6 + .../esprima/invalid-syntax/migrated_0164.js | 1 + .../invalid-syntax/migrated_0165.failure.json | 6 + .../invalid-syntax/migrated_0165.source.js | 1 + .../invalid-syntax/migrated_0166.failure.json | 6 + .../invalid-syntax/migrated_0166.source.js | 1 + .../invalid-syntax/migrated_0167.failure.json | 6 + .../invalid-syntax/migrated_0167.source.js | 1 + .../invalid-syntax/migrated_0168.failure.json | 6 + .../esprima/invalid-syntax/migrated_0168.js | 1 + .../invalid-syntax/migrated_0169.failure.json | 6 + .../invalid-syntax/migrated_0169.source.js | 1 + .../invalid-syntax/migrated_0170.failure.json | 6 + .../esprima/invalid-syntax/migrated_0170.js | 1 + .../invalid-syntax/migrated_0171.failure.json | 6 + .../esprima/invalid-syntax/migrated_0171.js | 1 + .../invalid-syntax/migrated_0172.failure.json | 6 + .../esprima/invalid-syntax/migrated_0172.js | 1 + .../invalid-syntax/migrated_0173.failure.json | 6 + .../esprima/invalid-syntax/migrated_0173.js | 1 + .../invalid-syntax/migrated_0174.failure.json | 6 + .../esprima/invalid-syntax/migrated_0174.js | 1 + .../invalid-syntax/migrated_0175.failure.json | 6 + .../esprima/invalid-syntax/migrated_0175.js | 1 + .../invalid-syntax/migrated_0176.failure.json | 6 + .../esprima/invalid-syntax/migrated_0176.js | 1 + .../invalid-syntax/migrated_0177.failure.json | 6 + .../esprima/invalid-syntax/migrated_0177.js | 1 + .../invalid-syntax/migrated_0178.failure.json | 6 + .../esprima/invalid-syntax/migrated_0178.js | 1 + .../invalid-syntax/migrated_0179.failure.json | 6 + .../esprima/invalid-syntax/migrated_0179.js | 1 + .../invalid-syntax/migrated_0180.failure.json | 6 + .../esprima/invalid-syntax/migrated_0180.js | 1 + .../invalid-syntax/migrated_0181.failure.json | 6 + .../esprima/invalid-syntax/migrated_0181.js | 1 + .../invalid-syntax/migrated_0182.failure.json | 6 + .../esprima/invalid-syntax/migrated_0182.js | 1 + .../invalid-syntax/migrated_0183.failure.json | 6 + .../esprima/invalid-syntax/migrated_0183.js | 1 + .../invalid-syntax/migrated_0184.failure.json | 6 + .../esprima/invalid-syntax/migrated_0184.js | 1 + .../invalid-syntax/migrated_0185.failure.json | 6 + .../esprima/invalid-syntax/migrated_0185.js | 1 + .../invalid-syntax/migrated_0186.failure.json | 6 + .../esprima/invalid-syntax/migrated_0186.js | 1 + .../invalid-syntax/migrated_0187.failure.json | 6 + .../esprima/invalid-syntax/migrated_0187.js | 1 + .../invalid-syntax/migrated_0188.failure.json | 6 + .../esprima/invalid-syntax/migrated_0188.js | 1 + .../invalid-syntax/migrated_0189.failure.json | 6 + .../esprima/invalid-syntax/migrated_0189.js | 1 + .../invalid-syntax/migrated_0190.failure.json | 6 + .../esprima/invalid-syntax/migrated_0190.js | 1 + .../invalid-syntax/migrated_0191.failure.json | 6 + .../esprima/invalid-syntax/migrated_0191.js | 1 + .../invalid-syntax/migrated_0192.failure.json | 6 + .../esprima/invalid-syntax/migrated_0192.js | 1 + .../invalid-syntax/migrated_0193.failure.json | 6 + .../esprima/invalid-syntax/migrated_0193.js | 1 + .../invalid-syntax/migrated_0194.failure.json | 6 + .../esprima/invalid-syntax/migrated_0194.js | 1 + .../invalid-syntax/migrated_0195.failure.json | 6 + .../esprima/invalid-syntax/migrated_0195.js | 1 + .../invalid-syntax/migrated_0196.failure.json | 6 + .../esprima/invalid-syntax/migrated_0196.js | 1 + .../invalid-syntax/migrated_0197.failure.json | 6 + .../esprima/invalid-syntax/migrated_0197.js | 1 + .../invalid-syntax/migrated_0198.failure.json | 6 + .../esprima/invalid-syntax/migrated_0198.js | 1 + .../invalid-syntax/migrated_0199.failure.json | 6 + .../esprima/invalid-syntax/migrated_0199.js | 1 + .../invalid-syntax/migrated_0200.failure.json | 6 + .../esprima/invalid-syntax/migrated_0200.js | 1 + .../invalid-syntax/migrated_0201.failure.json | 6 + .../esprima/invalid-syntax/migrated_0201.js | 1 + .../invalid-syntax/migrated_0202.failure.json | 6 + .../esprima/invalid-syntax/migrated_0202.js | 1 + .../invalid-syntax/migrated_0203.failure.json | 6 + .../esprima/invalid-syntax/migrated_0203.js | 1 + .../invalid-syntax/migrated_0204.failure.json | 6 + .../esprima/invalid-syntax/migrated_0204.js | 1 + .../invalid-syntax/migrated_0205.failure.json | 6 + .../esprima/invalid-syntax/migrated_0205.js | 1 + .../invalid-syntax/migrated_0206.failure.json | 6 + .../esprima/invalid-syntax/migrated_0206.js | 1 + .../invalid-syntax/migrated_0207.failure.json | 6 + .../esprima/invalid-syntax/migrated_0207.js | 1 + .../invalid-syntax/migrated_0208.failure.json | 6 + .../esprima/invalid-syntax/migrated_0208.js | 1 + .../invalid-syntax/migrated_0209.failure.json | 6 + .../esprima/invalid-syntax/migrated_0209.js | 1 + .../invalid-syntax/migrated_0210.failure.json | 6 + .../esprima/invalid-syntax/migrated_0210.js | 1 + .../invalid-syntax/migrated_0211.failure.json | 6 + .../esprima/invalid-syntax/migrated_0211.js | 1 + .../invalid-syntax/migrated_0212.failure.json | 6 + .../esprima/invalid-syntax/migrated_0212.js | 1 + .../invalid-syntax/migrated_0213.failure.json | 6 + .../esprima/invalid-syntax/migrated_0213.js | 1 + .../invalid-syntax/migrated_0214.failure.json | 6 + .../esprima/invalid-syntax/migrated_0214.js | 1 + .../invalid-syntax/migrated_0215.failure.json | 6 + .../esprima/invalid-syntax/migrated_0215.js | 1 + .../invalid-syntax/migrated_0216.failure.json | 6 + .../esprima/invalid-syntax/migrated_0216.js | 1 + .../invalid-syntax/migrated_0217.failure.json | 6 + .../esprima/invalid-syntax/migrated_0217.js | 1 + .../invalid-syntax/migrated_0218.failure.json | 6 + .../esprima/invalid-syntax/migrated_0218.js | 1 + .../invalid-syntax/migrated_0219.failure.json | 6 + .../esprima/invalid-syntax/migrated_0219.js | 1 + .../invalid-syntax/migrated_0220.failure.json | 6 + .../esprima/invalid-syntax/migrated_0220.js | 1 + .../invalid-syntax/migrated_0221.failure.json | 6 + .../esprima/invalid-syntax/migrated_0221.js | 1 + .../invalid-syntax/migrated_0222.failure.json | 6 + .../esprima/invalid-syntax/migrated_0222.js | 1 + .../invalid-syntax/migrated_0223.failure.json | 6 + .../esprima/invalid-syntax/migrated_0223.js | 1 + .../invalid-syntax/migrated_0224.failure.json | 6 + .../esprima/invalid-syntax/migrated_0224.js | 1 + .../invalid-syntax/migrated_0225.failure.json | 6 + .../esprima/invalid-syntax/migrated_0225.js | 1 + .../invalid-syntax/migrated_0226.failure.json | 6 + .../esprima/invalid-syntax/migrated_0226.js | 1 + .../invalid-syntax/migrated_0227.failure.json | 6 + .../esprima/invalid-syntax/migrated_0227.js | 1 + .../invalid-syntax/migrated_0228.failure.json | 6 + .../esprima/invalid-syntax/migrated_0228.js | 1 + .../invalid-syntax/migrated_0229.failure.json | 6 + .../esprima/invalid-syntax/migrated_0229.js | 1 + .../invalid-syntax/migrated_0230.failure.json | 6 + .../esprima/invalid-syntax/migrated_0230.js | 1 + .../invalid-syntax/migrated_0231.failure.json | 6 + .../esprima/invalid-syntax/migrated_0231.js | 1 + .../invalid-syntax/migrated_0232.failure.json | 6 + .../esprima/invalid-syntax/migrated_0232.js | 1 + .../invalid-syntax/migrated_0233.failure.json | 6 + .../esprima/invalid-syntax/migrated_0233.js | 1 + .../invalid-syntax/migrated_0234.failure.json | 6 + .../esprima/invalid-syntax/migrated_0234.js | 1 + .../invalid-syntax/migrated_0235.failure.json | 6 + .../esprima/invalid-syntax/migrated_0235.js | 1 + .../invalid-syntax/migrated_0236.failure.json | 6 + .../esprima/invalid-syntax/migrated_0236.js | 1 + .../invalid-syntax/migrated_0239.failure.json | 6 + .../esprima/invalid-syntax/migrated_0239.js | 1 + .../invalid-syntax/migrated_0240.failure.json | 6 + .../esprima/invalid-syntax/migrated_0240.js | 1 + .../invalid-syntax/migrated_0241.failure.json | 6 + .../esprima/invalid-syntax/migrated_0241.js | 1 + .../invalid-syntax/migrated_0242.failure.json | 6 + .../esprima/invalid-syntax/migrated_0242.js | 1 + .../invalid-syntax/migrated_0243.failure.json | 6 + .../esprima/invalid-syntax/migrated_0243.js | 1 + .../invalid-syntax/migrated_0244.failure.json | 6 + .../esprima/invalid-syntax/migrated_0244.js | 1 + .../invalid-syntax/migrated_0245.failure.json | 6 + .../esprima/invalid-syntax/migrated_0245.js | 1 + .../invalid-syntax/migrated_0246.failure.json | 6 + .../esprima/invalid-syntax/migrated_0246.js | 1 + .../invalid-syntax/migrated_0247.failure.json | 6 + .../esprima/invalid-syntax/migrated_0247.js | 1 + .../invalid-syntax/migrated_0248.failure.json | 6 + .../esprima/invalid-syntax/migrated_0248.js | 1 + .../invalid-syntax/migrated_0249.failure.json | 6 + .../esprima/invalid-syntax/migrated_0249.js | 1 + .../invalid-syntax/migrated_0250.failure.json | 6 + .../esprima/invalid-syntax/migrated_0250.js | 1 + .../invalid-syntax/migrated_0252.failure.json | 6 + .../esprima/invalid-syntax/migrated_0252.js | 1 + .../invalid-syntax/migrated_0254.failure.json | 6 + .../esprima/invalid-syntax/migrated_0254.js | 1 + .../invalid-syntax/migrated_0255.failure.json | 6 + .../esprima/invalid-syntax/migrated_0255.js | 1 + .../invalid-syntax/migrated_0256.failure.json | 6 + .../esprima/invalid-syntax/migrated_0256.js | 1 + .../invalid-syntax/migrated_0257.failure.json | 6 + .../esprima/invalid-syntax/migrated_0257.js | 1 + .../invalid-syntax/migrated_0258.failure.json | 6 + .../esprima/invalid-syntax/migrated_0258.js | 1 + .../invalid-syntax/migrated_0259.failure.json | 6 + .../esprima/invalid-syntax/migrated_0259.js | 1 + .../invalid-syntax/migrated_0260.failure.json | 6 + .../esprima/invalid-syntax/migrated_0260.js | 1 + .../invalid-syntax/migrated_0261.failure.json | 6 + .../esprima/invalid-syntax/migrated_0261.js | 1 + .../invalid-syntax/migrated_0262.failure.json | 6 + .../esprima/invalid-syntax/migrated_0262.js | 1 + .../invalid-syntax/migrated_0263.failure.json | 6 + .../esprima/invalid-syntax/migrated_0263.js | 1 + .../invalid-syntax/migrated_0264.failure.json | 6 + .../esprima/invalid-syntax/migrated_0264.js | 1 + .../invalid-syntax/migrated_0265.failure.json | 6 + .../esprima/invalid-syntax/migrated_0265.js | 1 + .../invalid-syntax/migrated_0266.failure.json | 6 + .../esprima/invalid-syntax/migrated_0266.js | 1 + .../invalid-syntax/migrated_0267.failure.json | 6 + .../esprima/invalid-syntax/migrated_0267.js | 1 + .../invalid-syntax/migrated_0268.failure.json | 6 + .../esprima/invalid-syntax/migrated_0268.js | 1 + .../invalid-syntax/migrated_0269.failure.json | 6 + .../esprima/invalid-syntax/migrated_0269.js | 1 + .../invalid-syntax/migrated_0270.failure.json | 6 + .../esprima/invalid-syntax/migrated_0270.js | 1 + .../invalid-syntax/migrated_0271.failure.json | 6 + .../esprima/invalid-syntax/migrated_0271.js | 1 + .../invalid-syntax/migrated_0272.failure.json | 6 + .../esprima/invalid-syntax/migrated_0272.js | 1 + .../invalid-syntax/migrated_0273.failure.json | 6 + .../esprima/invalid-syntax/migrated_0273.js | 1 + .../invalid-syntax/migrated_0274.failure.json | 6 + .../esprima/invalid-syntax/migrated_0274.js | 1 + .../invalid-syntax/migrated_0275.failure.json | 6 + .../esprima/invalid-syntax/migrated_0275.js | 1 + .../invalid-syntax/migrated_0276.failure.json | 6 + .../esprima/invalid-syntax/migrated_0276.js | 1 + .../invalid-syntax/migrated_0277.failure.json | 6 + .../esprima/invalid-syntax/migrated_0277.js | 1 + .../invalid-syntax/migrated_0278.failure.json | 6 + .../esprima/invalid-syntax/migrated_0278.js | 1 + .../strict_assignment_implements.failure.json | 1 + .../strict_assignment_implements.js | 1 + .../strict_assignment_interface.failure.json | 1 + .../strict_assignment_interface.js | 1 + .../strict_assignment_let.failure.json | 1 + .../invalid-syntax/strict_assignment_let.js | 1 + .../strict_assignment_package.failure.json | 1 + .../strict_assignment_package.js | 1 + .../strict_assignment_private.failure.json | 1 + .../strict_assignment_private.js | 1 + .../strict_assignment_protected.failure.json | 1 + .../strict_assignment_protected.js | 1 + .../strict_assignment_public.failure.json | 1 + .../strict_assignment_public.js | 1 + .../strict_assignment_static.failure.json | 1 + .../strict_assignment_static.js | 1 + .../strict_assignment_yield.failure.json | 1 + .../invalid-syntax/strict_assignment_yield.js | 1 + .../esprima/source-element/migrated_0000.js | 0 .../esprima/source-element/migrated_0000.skip | 1 + .../source-element/migrated_0000.tree.json | 20 + .../esprima/source-option/migrated_0000.diff | 21 + .../esprima/source-option/migrated_0000.js | 1 + .../source-option/migrated_0000.tree.json | 226 + .../esprima/source-option/migrated_0001.diff | 33 + .../esprima/source-option/migrated_0001.js | 1 + .../source-option/migrated_0001.tree.json | 446 + .../source-type-module/error-delete.js | 2 + .../error-delete.module.json | 7 + .../source-type-module/error-export-if.js | 1 + .../error-export-if.module.json | 7 + .../error-export-in-function.js | 4 + .../error-export-in-function.module.json | 7 + .../error-import-in-function.js | 3 + .../error-import-in-function.module.json | 7 + ...or-invalid-export-declaration.failure.json | 7 + .../error-invalid-export-declaration.js | 1 + ...or-invalid-import-declaration.failure.json | 7 + .../error-invalid-import-declaration.js | 1 + .../source-type-module/error-strict.js | 5 + .../error-strict.module.json | 7 + .../statement/block/migrated_0000.diff | 12 + .../esprima/statement/block/migrated_0000.js | 1 + .../statement/block/migrated_0000.tree.json | 130 + .../esprima/statement/block/migrated_0001.js | 1 + .../statement/block/migrated_0001.tree.json | 327 + .../esprima/statement/block/migrated_0002.js | 1 + .../statement/block/migrated_0002.tree.json | 76 + .../statement/break/migrated_0000.diff | 14 + .../esprima/statement/break/migrated_0000.js | 1 + .../statement/break/migrated_0000.tree.json | 221 + .../statement/break/migrated_0001.diff | 16 + .../esprima/statement/break/migrated_0001.js | 1 + .../statement/break/migrated_0001.tree.json | 327 + .../esprima/statement/break/migrated_0002.js | 1 + .../statement/break/migrated_0002.tree.json | 345 + .../esprima/statement/break/migrated_0003.js | 1 + .../statement/break/migrated_0003.tree.json | 345 + .../statement/break/semicolon_newline.js | 5 + .../break/semicolon_newline.tree.json | 435 + .../statement/continue/migrated_0000.js | 1 + .../continue/migrated_0000.tree.json | 239 + .../statement/continue/migrated_0001.diff | 14 + .../statement/continue/migrated_0001.js | 1 + .../continue/migrated_0001.tree.json | 221 + .../statement/continue/migrated_0002.diff | 16 + .../statement/continue/migrated_0002.js | 1 + .../continue/migrated_0002.tree.json | 327 + .../statement/continue/migrated_0003.js | 1 + .../continue/migrated_0003.tree.json | 345 + .../statement/continue/migrated_0004.js | 1 + .../continue/migrated_0004.tree.json | 345 + .../statement/debugger/migrated_0000.js | 1 + .../debugger/migrated_0000.tree.json | 75 + .../esprima/statement/empty/migrated_0000.js | 1 + .../statement/empty/migrated_0000.tree.json | 57 + .../statement/expression/migrated_0000.js | 1 + .../expression/migrated_0000.tree.json | 75 + .../statement/expression/migrated_0001.js | 1 + .../expression/migrated_0001.tree.json | 148 + .../expression/migrated_0002.source.js | 1 + .../expression/migrated_0002.tree.json | 75 + .../expression/migrated_0003.source.js | 1 + .../expression/migrated_0003.tree.json | 75 + .../expression/migrated_0004.source.js | 1 + .../expression/migrated_0004.tree.json | 75 + .../expression/migrated_0005.source.js | 1 + .../expression/migrated_0005.tree.json | 75 + .../esprima/statement/if/migrated_0000.js | 1 + .../statement/if/migrated_0000.tree.json | 237 + .../esprima/statement/if/migrated_0001.js | 1 + .../statement/if/migrated_0001.tree.json | 312 + .../esprima/statement/if/migrated_0002.js | 1 + .../statement/if/migrated_0002.tree.json | 294 + .../esprima/statement/if/migrated_0003.js | 1 + .../statement/if/migrated_0003.tree.json | 294 + .../esprima/statement/if/migrated_0004.js | 1 + .../statement/if/migrated_0004.tree.json | 379 + .../esprima/statement/if/migrated_0005.js | 2 + .../statement/if/migrated_0005.tree.json | 308 + .../esprima/statement/if/migrated_0006.js | 1 + .../statement/if/migrated_0006.tree.json | 308 + .../statement/iteration/const_forin.js | 1 + .../statement/iteration/const_forin.tree.json | 402 + .../esprima/statement/iteration/for-in-let.js | 1 + .../statement/iteration/for-in-let.tree.json | 238 + .../statement/iteration/for-let-let.js | 1 + .../statement/iteration/for-let-let.skip | 1 + .../statement/iteration/for-let-let.tree.json | 330 + .../iteration/for-statement-with-seq.js | 1 + .../for-statement-with-seq.tree.json | 329 + .../invalid-strict-for-in-let.failure.json | 1 + .../iteration/invalid-strict-for-in-let.js | 1 + .../statement/iteration/migrated_0000.js | 1 + .../iteration/migrated_0000.tree.json | 273 + .../statement/iteration/migrated_0001.js | 1 + .../iteration/migrated_0001.tree.json | 291 + .../statement/iteration/migrated_0002.js | 1 + .../iteration/migrated_0002.tree.json | 491 + .../statement/iteration/migrated_0003.diff | 12 + .../statement/iteration/migrated_0003.js | 1 + .../iteration/migrated_0003.tree.json | 311 + .../statement/iteration/migrated_0004.js | 1 + .../iteration/migrated_0004.tree.json | 273 + .../statement/iteration/migrated_0005.js | 2 + .../iteration/migrated_0005.tree.json | 273 + .../statement/iteration/migrated_0006.js | 1 + .../iteration/migrated_0006.tree.json | 237 + .../statement/iteration/migrated_0007.js | 1 + .../iteration/migrated_0007.tree.json | 473 + .../statement/iteration/migrated_0008.js | 1 + .../iteration/migrated_0008.tree.json | 167 + .../statement/iteration/migrated_0009.js | 1 + .../iteration/migrated_0009.tree.json | 186 + .../statement/iteration/migrated_0010.js | 1 + .../iteration/migrated_0010.tree.json | 275 + .../statement/iteration/migrated_0011.js | 1 + .../iteration/migrated_0011.tree.json | 312 + .../statement/iteration/migrated_0012.diff | 10 + .../statement/iteration/migrated_0012.js | 1 + .../iteration/migrated_0012.tree.json | 312 + .../statement/iteration/migrated_0013.js | 1 + .../iteration/migrated_0013.tree.json | 438 + .../statement/iteration/migrated_0014.js | 1 + .../iteration/migrated_0014.tree.json | 383 + .../statement/iteration/migrated_0015.js | 1 + .../iteration/migrated_0015.tree.json | 455 + .../statement/iteration/migrated_0016.js | 1 + .../iteration/migrated_0016.tree.json | 582 + .../statement/iteration/migrated_0017.js | 1 + .../iteration/migrated_0017.tree.json | 346 + .../statement/iteration/migrated_0018.js | 1 + .../iteration/migrated_0018.tree.json | 402 + .../statement/iteration/migrated_0019.js | 1 + .../statement/iteration/migrated_0019.skip | 1 + .../iteration/migrated_0019.tree.json | 456 + .../statement/iteration/migrated_0020.js | 1 + .../iteration/migrated_0020.tree.json | 402 + .../statement/iteration/migrated_0021.js | 1 + .../statement/iteration/migrated_0021.skip | 1 + .../iteration/migrated_0021.tree.json | 400 + .../statement/iteration/migrated_0022.js | 1 + .../statement/iteration/migrated_0022.skip | 1 + .../iteration/migrated_0022.tree.json | 580 + .../statement/iteration/migrated_0023.js | 1 + .../statement/iteration/migrated_0023.skip | 1 + .../iteration/migrated_0023.tree.json | 711 + .../statement/iteration/migrated_0024.js | 1 + .../iteration/migrated_0024.tree.json | 381 + .../statement/iteration/migrated_0025.js | 1 + .../iteration/migrated_0025.tree.json | 473 + .../statement/iteration/migrated_0026.js | 1 + .../iteration/migrated_0026.tree.json | 291 + .../statement/iteration/pattern-in-for-in.js | 1 + .../iteration/pattern-in-for-in.tree.json | 1474 ++ .../statement/labelled/migrated_0000.js | 1 + .../labelled/migrated_0000.tree.json | 274 + .../statement/labelled/migrated_0001.js | 1 + .../labelled/migrated_0001.tree.json | 272 + .../statement/labelled/migrated_0002.js | 1 + .../labelled/migrated_0002.tree.json | 146 + .../statement/return/migrated_0000.diff | 22 + .../esprima/statement/return/migrated_0000.js | 1 + .../statement/return/migrated_0000.tree.json | 241 + .../esprima/statement/return/migrated_0001.js | 1 + .../statement/return/migrated_0001.tree.json | 259 + .../esprima/statement/return/migrated_0002.js | 1 + .../statement/return/migrated_0002.tree.json | 294 + .../statement/return/migrated_0003.diff | 22 + .../esprima/statement/return/migrated_0003.js | 1 + .../statement/return/migrated_0003.tree.json | 348 + .../esprima/statement/switch/migrated_0000.js | 1 + .../statement/switch/migrated_0000.tree.json | 166 + .../esprima/statement/switch/migrated_0001.js | 1 + .../statement/switch/migrated_0001.tree.json | 438 + .../statement/switch/migrated_0002.diff | 18 + .../esprima/statement/switch/migrated_0002.js | 1 + .../statement/switch/migrated_0002.tree.json | 530 + .../esprima/statement/throw/migrated_0000.js | 1 + .../statement/throw/migrated_0000.tree.json | 111 + .../esprima/statement/throw/migrated_0001.js | 1 + .../statement/throw/migrated_0001.tree.json | 165 + .../esprima/statement/throw/migrated_0002.js | 1 + .../statement/throw/migrated_0002.tree.json | 224 + .../esprima/statement/try/migrated_0000.js | 1 + .../statement/try/migrated_0000.tree.json | 273 + .../esprima/statement/try/migrated_0001.js | 1 + .../statement/try/migrated_0001.tree.json | 273 + .../esprima/statement/try/migrated_0002.js | 1 + .../statement/try/migrated_0002.tree.json | 273 + .../esprima/statement/try/migrated_0003.diff | 16 + .../esprima/statement/try/migrated_0003.js | 1 + .../statement/try/migrated_0003.tree.json | 418 + .../esprima/statement/try/migrated_0004.diff | 14 + .../esprima/statement/try/migrated_0004.js | 1 + .../statement/try/migrated_0004.tree.json | 329 + .../esprima/statement/try/migrated_0005.diff | 16 + .../esprima/statement/try/migrated_0005.js | 1 + .../statement/try/migrated_0005.tree.json | 544 + .../esprima/statement/try/migrated_0006.diff | 24 + .../esprima/statement/try/migrated_0006.js | 1 + .../statement/try/migrated_0006.tree.json | 760 ++ .../statement/try/strict_simple_catch.js | 2 + .../try/strict_simple_catch.tree.json | 346 + ...complex-pattern-requires-init.failure.json | 1 + .../variable/complex-pattern-requires-init.js | 1 + .../invalid_trailing_comma_1.failure.json | 1 + .../variable/invalid_trailing_comma_1.js | 1 + .../invalid_trailing_comma_2.failure.json | 1 + .../variable/invalid_trailing_comma_2.js | 1 + .../invalid_trailing_comma_3.failure.json | 1 + .../variable/invalid_trailing_comma_3.js | 1 + .../invalid_trailing_comma_4.failure.json | 1 + .../variable/invalid_trailing_comma_4.js | 1 + .../invalid_trailing_comma_5.failure.json | 1 + .../variable/invalid_trailing_comma_5.js | 2 + .../invalid_trailing_comma_6.failure.json | 1 + .../variable/invalid_trailing_comma_6.js | 1 + .../statement/variable/migrated_0000.js | 1 + .../variable/migrated_0000.tree.json | 114 + .../statement/variable/migrated_0001.js | 1 + .../variable/migrated_0001.tree.json | 204 + .../statement/variable/migrated_0002.js | 1 + .../variable/migrated_0002.tree.json | 168 + .../statement/variable/migrated_0003.js | 1 + .../variable/migrated_0003.tree.json | 294 + .../statement/variable/migrated_0004.js | 1 + .../variable/migrated_0004.tree.json | 420 + .../statement/variable/migrated_0005.js | 1 + .../variable/migrated_0005.tree.json | 258 + .../statement/variable/migrated_0006.js | 1 + .../variable/migrated_0006.tree.json | 330 + .../esprima/statement/variable/var_let.js | 1 + .../statement/variable/var_let.tree.json | 132 + .../esprima/statement/with/migrated_0000.js | 1 + .../statement/with/migrated_0000.tree.json | 254 + .../esprima/statement/with/migrated_0001.js | 1 + .../statement/with/migrated_0001.tree.json | 272 + .../esprima/statement/with/migrated_0002.diff | 14 + .../esprima/statement/with/migrated_0002.js | 1 + .../statement/with/migrated_0002.tree.json | 309 + lib/test/esprima/tokenize/empty.skip | 1 + lib/test/esprima/tokenize/empty.tokens.json | 1 + lib/test/esprima/tokenize/leading_comment.js | 1 + .../tokenize/leading_comment.tokens.json | 42 + lib/test/esprima/tokenize/line_comment.js | 1 + .../esprima/tokenize/line_comment.tokens.json | 92 + lib/test/esprima/tokenize/line_terminators.js | 4 + .../tokenize/line_terminators.tokens.json | 1 + lib/test/esprima/tokenize/migrated_0000.js | 1 + .../tokenize/migrated_0000.tokens.json | 78 + lib/test/esprima/tokenize/migrated_0001.js | 1 + .../tokenize/migrated_0001.tokens.json | 132 + lib/test/esprima/tokenize/migrated_0002.js | 1 + .../tokenize/migrated_0002.tokens.json | 96 + lib/test/esprima/tokenize/migrated_0003.js | 1 + .../tokenize/migrated_0003.tokens.json | 110 + lib/test/esprima/tokenize/migrated_0004.js | 1 + .../tokenize/migrated_0004.tokens.json | 132 + lib/test/esprima/tokenize/migrated_0005.js | 1 + .../tokenize/migrated_0005.tokens.json | 128 + lib/test/esprima/tokenize/migrated_0006.js | 1 + .../tokenize/migrated_0006.tokens.json | 74 + lib/test/esprima/tokenize/migrated_0007.js | 1 + .../tokenize/migrated_0007.tokens.json | 164 + lib/test/esprima/tokenize/migrated_0008.js | 1 + .../tokenize/migrated_0008.tokens.json | 150 + lib/test/esprima/tokenize/migrated_0009.js | 1 + .../tokenize/migrated_0009.tokens.json | 42 + lib/test/esprima/tokenize/migrated_0010.js | 1 + .../tokenize/migrated_0010.tokens.json | 24 + lib/test/esprima/tokenize/migrated_0011.js | 1 + .../tokenize/migrated_0011.tokens.json | 38 + lib/test/esprima/tokenize/migrated_0012.js | 1 + .../tokenize/migrated_0012.tokens.json | 92 + lib/test/esprima/tokenize/migrated_0013.skip | 1 + .../tokenize/migrated_0013.tokens.json | 1 + .../tokenize/migrated_0014.failure.json | 7 + lib/test/esprima/tokenize/migrated_0014.js | 1 + .../tokenize/migrated_0015.failure.json | 7 + lib/test/esprima/tokenize/migrated_0015.js | 1 + lib/test/esprima/tokenize/migrated_0016.js | 1 + .../tokenize/migrated_0016.tokens.json | 74 + lib/test/esprima/tokenize/trailing_comment.js | 1 + .../tokenize/trailing_comment.tokens.json | 42 + .../for-in-missing-parenthesis.diff | 21 + .../for-in-missing-parenthesis.js | 2 + .../for-in-missing-parenthesis.tree.json | 191 + .../for-missing-parenthesis.diff | 21 + .../tolerant-parse/for-missing-parenthesis.js | 1 + .../for-missing-parenthesis.tree.json | 463 + .../for-of-missing-parenthesis.diff | 21 + .../for-of-missing-parenthesis.js | 2 + .../for-of-missing-parenthesis.tree.json | 190 + .../if-missing-parenthesis.diff | 21 + .../tolerant-parse/if-missing-parenthesis.js | 1 + .../if-missing-parenthesis.tree.json | 210 + lib/test/esprima/tolerant-parse/let_eval.diff | 13 + lib/test/esprima/tolerant-parse/let_eval.js | 1 + .../esprima/tolerant-parse/let_eval.tree.json | 213 + .../esprima/tolerant-parse/migrated_0000.diff | 13 + .../esprima/tolerant-parse/migrated_0000.js | 1 + .../tolerant-parse/migrated_0000.tree.json | 48 + .../esprima/tolerant-parse/migrated_0001.diff | 13 + .../esprima/tolerant-parse/migrated_0001.js | 1 + .../tolerant-parse/migrated_0001.tree.json | 214 + .../esprima/tolerant-parse/migrated_0002.diff | 13 + .../esprima/tolerant-parse/migrated_0002.js | 1 + .../tolerant-parse/migrated_0002.tree.json | 48 + .../esprima/tolerant-parse/migrated_0003.diff | 13 + .../esprima/tolerant-parse/migrated_0003.js | 1 + .../tolerant-parse/migrated_0003.tree.json | 48 + .../esprima/tolerant-parse/migrated_0004.diff | 13 + .../esprima/tolerant-parse/migrated_0004.js | 2 + .../tolerant-parse/migrated_0004.tree.json | 48 + .../esprima/tolerant-parse/migrated_0005.js | 1 + .../esprima/tolerant-parse/migrated_0005.skip | 1 + .../tolerant-parse/migrated_0005.tree.json | 270 + .../esprima/tolerant-parse/migrated_0006.js | 1 + .../esprima/tolerant-parse/migrated_0006.skip | 1 + .../tolerant-parse/migrated_0006.tree.json | 363 + .../esprima/tolerant-parse/migrated_0007.js | 1 + .../esprima/tolerant-parse/migrated_0007.skip | 1 + .../tolerant-parse/migrated_0007.tree.json | 288 + .../esprima/tolerant-parse/migrated_0008.js | 1 + .../esprima/tolerant-parse/migrated_0008.skip | 1 + .../tolerant-parse/migrated_0008.tree.json | 528 + .../esprima/tolerant-parse/migrated_0009.js | 1 + .../esprima/tolerant-parse/migrated_0009.skip | 1 + .../tolerant-parse/migrated_0009.tree.json | 646 + .../esprima/tolerant-parse/migrated_0010.js | 1 + .../esprima/tolerant-parse/migrated_0010.skip | 1 + .../tolerant-parse/migrated_0010.tree.json | 777 ++ .../esprima/tolerant-parse/migrated_0011.js | 1 + .../esprima/tolerant-parse/migrated_0011.skip | 1 + .../tolerant-parse/migrated_0011.tree.json | 1024 ++ .../esprima/tolerant-parse/migrated_0012.diff | 14 + .../esprima/tolerant-parse/migrated_0012.js | 1 + .../tolerant-parse/migrated_0012.tree.json | 303 + .../esprima/tolerant-parse/migrated_0013.diff | 13 + .../esprima/tolerant-parse/migrated_0013.js | 1 + .../tolerant-parse/migrated_0013.tree.json | 66 + .../esprima/tolerant-parse/migrated_0014.diff | 13 + .../esprima/tolerant-parse/migrated_0014.js | 1 + .../tolerant-parse/migrated_0014.tree.json | 482 + .../esprima/tolerant-parse/migrated_0015.diff | 29 + .../esprima/tolerant-parse/migrated_0015.js | 1 + .../tolerant-parse/migrated_0015.tree.json | 394 + .../esprima/tolerant-parse/migrated_0016.diff | 13 + .../esprima/tolerant-parse/migrated_0016.js | 1 + .../tolerant-parse/migrated_0016.tree.json | 193 + .../esprima/tolerant-parse/migrated_0017.diff | 13 + .../esprima/tolerant-parse/migrated_0017.js | 1 + .../tolerant-parse/migrated_0017.tree.json | 354 + .../esprima/tolerant-parse/migrated_0018.diff | 13 + .../esprima/tolerant-parse/migrated_0018.js | 1 + .../tolerant-parse/migrated_0018.tree.json | 354 + .../esprima/tolerant-parse/migrated_0019.diff | 13 + .../esprima/tolerant-parse/migrated_0019.js | 1 + .../tolerant-parse/migrated_0019.tree.json | 213 + .../esprima/tolerant-parse/migrated_0020.diff | 13 + .../esprima/tolerant-parse/migrated_0020.js | 1 + .../tolerant-parse/migrated_0020.tree.json | 213 + .../esprima/tolerant-parse/migrated_0021.diff | 13 + .../esprima/tolerant-parse/migrated_0021.js | 1 + .../tolerant-parse/migrated_0021.tree.json | 247 + .../esprima/tolerant-parse/migrated_0022.diff | 13 + .../esprima/tolerant-parse/migrated_0022.js | 1 + .../tolerant-parse/migrated_0022.tree.json | 211 + .../esprima/tolerant-parse/migrated_0023.diff | 13 + .../esprima/tolerant-parse/migrated_0023.js | 1 + .../tolerant-parse/migrated_0023.tree.json | 211 + .../esprima/tolerant-parse/migrated_0024.diff | 13 + .../esprima/tolerant-parse/migrated_0024.js | 1 + .../tolerant-parse/migrated_0024.tree.json | 247 + .../esprima/tolerant-parse/migrated_0025.diff | 13 + .../esprima/tolerant-parse/migrated_0025.js | 1 + .../tolerant-parse/migrated_0025.tree.json | 211 + .../esprima/tolerant-parse/migrated_0026.diff | 13 + .../esprima/tolerant-parse/migrated_0026.js | 1 + .../tolerant-parse/migrated_0026.tree.json | 211 + .../esprima/tolerant-parse/migrated_0027.diff | 13 + .../esprima/tolerant-parse/migrated_0027.js | 1 + .../tolerant-parse/migrated_0027.tree.json | 302 + .../esprima/tolerant-parse/migrated_0028.diff | 13 + .../esprima/tolerant-parse/migrated_0028.js | 1 + .../tolerant-parse/migrated_0028.tree.json | 302 + .../esprima/tolerant-parse/migrated_0029.diff | 13 + .../esprima/tolerant-parse/migrated_0029.js | 1 + .../tolerant-parse/migrated_0029.tree.json | 302 + .../esprima/tolerant-parse/migrated_0030.diff | 13 + .../esprima/tolerant-parse/migrated_0030.js | 1 + .../tolerant-parse/migrated_0030.tree.json | 338 + .../esprima/tolerant-parse/migrated_0031.diff | 13 + .../esprima/tolerant-parse/migrated_0031.js | 1 + .../tolerant-parse/migrated_0031.tree.json | 338 + .../esprima/tolerant-parse/migrated_0032.diff | 13 + .../esprima/tolerant-parse/migrated_0032.js | 1 + .../tolerant-parse/migrated_0032.tree.json | 338 + .../esprima/tolerant-parse/migrated_0033.diff | 13 + .../esprima/tolerant-parse/migrated_0033.js | 1 + .../tolerant-parse/migrated_0033.tree.json | 339 + .../esprima/tolerant-parse/migrated_0034.diff | 13 + .../esprima/tolerant-parse/migrated_0034.js | 1 + .../tolerant-parse/migrated_0034.tree.json | 339 + .../esprima/tolerant-parse/migrated_0035.diff | 13 + .../esprima/tolerant-parse/migrated_0035.js | 1 + .../tolerant-parse/migrated_0035.tree.json | 393 + .../esprima/tolerant-parse/migrated_0036.diff | 13 + .../esprima/tolerant-parse/migrated_0036.js | 1 + .../tolerant-parse/migrated_0036.tree.json | 375 + .../esprima/tolerant-parse/migrated_0037.diff | 13 + .../esprima/tolerant-parse/migrated_0037.js | 1 + .../tolerant-parse/migrated_0037.tree.json | 375 + .../esprima/tolerant-parse/migrated_0038.diff | 13 + .../esprima/tolerant-parse/migrated_0038.js | 1 + .../tolerant-parse/migrated_0038.tree.json | 429 + .../esprima/tolerant-parse/migrated_0039.diff | 13 + .../esprima/tolerant-parse/migrated_0039.js | 1 + .../tolerant-parse/migrated_0039.tree.json | 470 + .../esprima/tolerant-parse/migrated_0040.diff | 13 + .../esprima/tolerant-parse/migrated_0040.js | 1 + .../tolerant-parse/migrated_0040.tree.json | 341 + .../esprima/tolerant-parse/migrated_0041.diff | 13 + .../esprima/tolerant-parse/migrated_0041.js | 1 + .../tolerant-parse/migrated_0041.tree.json | 176 + .../esprima/tolerant-parse/migrated_0042.diff | 13 + .../esprima/tolerant-parse/migrated_0042.js | 1 + .../tolerant-parse/migrated_0042.tree.json | 380 + .../esprima/tolerant-parse/migrated_0043.diff | 14 + .../esprima/tolerant-parse/migrated_0043.js | 1 + .../tolerant-parse/migrated_0043.tree.json | 324 + .../esprima/tolerant-parse/migrated_0044.diff | 13 + .../esprima/tolerant-parse/migrated_0044.js | 1 + .../tolerant-parse/migrated_0044.tree.json | 247 + .../esprima/tolerant-parse/migrated_0045.diff | 13 + .../esprima/tolerant-parse/migrated_0045.js | 1 + .../tolerant-parse/migrated_0045.tree.json | 157 + .../esprima/tolerant-parse/migrated_0046.diff | 13 + .../esprima/tolerant-parse/migrated_0046.js | 1 + .../tolerant-parse/migrated_0046.tree.json | 121 + .../esprima/tolerant-parse/migrated_0047.diff | 13 + .../esprima/tolerant-parse/migrated_0047.js | 1 + .../tolerant-parse/migrated_0047.tree.json | 121 + .../esprima/tolerant-parse/migrated_0048.diff | 13 + .../esprima/tolerant-parse/migrated_0048.js | 1 + .../tolerant-parse/migrated_0048.tree.json | 265 + .../esprima/tolerant-parse/migrated_0049.js | 1 + .../esprima/tolerant-parse/migrated_0049.skip | 1 + .../tolerant-parse/migrated_0049.tree.json | 184 + .../tolerant-parse/migrated_0050.source.js | 1 + .../tolerant-parse/migrated_0050.tree.json | 190 + .../esprima/tolerant-parse/migrated_0051.diff | 13 + .../esprima/tolerant-parse/migrated_0051.js | 1 + .../tolerant-parse/migrated_0051.tree.json | 417 + .../esprima/tolerant-parse/migrated_0052.diff | 13 + .../esprima/tolerant-parse/migrated_0052.js | 1 + .../tolerant-parse/migrated_0052.tree.json | 399 + .../string_literal_escape_eight.js | 1 + .../string_literal_escape_eight.skip | 1 + .../string_literal_escape_eight.tree.json | 194 + .../while-missing-parenthesis.diff | 21 + .../while-missing-parenthesis.js | 1 + .../while-missing-parenthesis.tree.json | 137 + .../whitespace/migrated_0000.source.js | 1 + .../whitespace/migrated_0000.tree.json | 111 + .../whitespace/migrated_0001.source.js | 1 + .../whitespace/migrated_0001.tree.json | 347 + lib/test/esprima_tests.js | 3329 +++++ lib/test/file_utils.ml | 70 + lib/test/file_utils.mli | 19 + .../array-pattern/rest_not_final.js | 1 + .../array-pattern/rest_not_final.tree.json | 62 + .../await-prop-in-async-function.js | 5 + .../await-prop-in-async-function.tree.json | 112 + .../eval-prop-assignment-strict.js | 2 + .../eval-prop-assignment-strict.tree.json | 78 + .../object-pattern/methods_are_invalid.js | 1 + .../methods_are_invalid.tree.json | 39 + .../public-prop-assignment-strict.js | 2 + .../public-prop-assignment-strict.tree.json | 78 + .../yield-prop-alias-assignment-strict.js | 2 + ...eld-prop-alias-assignment-strict.tree.json | 72 + ...ld-prop-alias-invalid-assignment-strict.js | 2 + ...-alias-invalid-assignment-strict.tree.json | 78 + .../yield-prop-assignment-strict.js | 2 + .../yield-prop-assignment-strict.tree.json | 78 + .../yield-prop-binding-strict.js | 2 + .../yield-prop-binding-strict.tree.json | 79 + .../yield-prop-in-generator-strict.js | 6 + .../yield-prop-in-generator-strict.tree.json | 125 + .../object-pattern/yield-prop-in-generator.js | 5 + .../yield-prop-in-generator.tree.json | 112 + .../ES6/computed_properties/migrated_0000.js | 1 + .../migrated_0000.tree.json | 52 + .../export_default_class_implements.js | 1 + .../export_default_class_implements.tree.json | 46 + lib/test/flow/ES6/modules/migrated_0000.js | 1 + .../flow/ES6/modules/migrated_0000.tree.json | 39 + lib/test/flow/ES6/modules/migrated_0001.js | 1 + .../flow/ES6/modules/migrated_0001.tree.json | 40 + lib/test/flow/ES6/modules/migrated_0002.js | 1 + .../flow/ES6/modules/migrated_0002.tree.json | 31 + lib/test/flow/ES6/modules/migrated_0003.js | 1 + .../flow/ES6/modules/migrated_0003.tree.json | 38 + lib/test/flow/ES6/modules/migrated_0004.js | 1 + .../flow/ES6/modules/migrated_0004.tree.json | 33 + lib/test/flow/ES6/modules/migrated_0005.js | 1 + .../flow/ES6/modules/migrated_0005.tree.json | 40 + lib/test/flow/ES6/modules/migrated_0006.js | 1 + .../flow/ES6/modules/migrated_0006.tree.json | 35 + lib/test/flow/ES6/modules/migrated_0007.js | 1 + .../flow/ES6/modules/migrated_0007.tree.json | 66 + lib/test/flow/ES6/modules/migrated_0008.js | 1 + .../ES6/modules/migrated_0008.options.json | 3 + .../flow/ES6/modules/migrated_0008.tree.json | 37 + lib/test/flow/ES6/modules/migrated_0009.js | 1 + .../flow/ES6/modules/migrated_0009.tree.json | 21 + lib/test/flow/ES6/modules/migrated_0010.js | 3 + .../flow/ES6/modules/migrated_0010.tree.json | 93 + lib/test/flow/ES6/modules/migrated_0011.js | 3 + .../flow/ES6/modules/migrated_0011.tree.json | 93 + lib/test/flow/ES6/modules/migrated_0012.js | 3 + .../flow/ES6/modules/migrated_0012.tree.json | 93 + lib/test/flow/ES6/modules/migrated_0013.js | 3 + .../flow/ES6/modules/migrated_0013.tree.json | 96 + lib/test/flow/ES6/modules/migrated_0014.js | 3 + .../flow/ES6/modules/migrated_0014.tree.json | 99 + lib/test/flow/ES6/modules/migrated_0015.js | 3 + .../flow/ES6/modules/migrated_0015.tree.json | 97 + lib/test/flow/ES6/modules/migrated_0016.js | 3 + .../flow/ES6/modules/migrated_0016.tree.json | 83 + lib/test/flow/ES6/modules/migrated_0017.js | 3 + .../flow/ES6/modules/migrated_0017.tree.json | 83 + lib/test/flow/ES6/modules/migrated_0018.js | 3 + .../flow/ES6/modules/migrated_0018.tree.json | 47 + lib/test/flow/ES6/modules/migrated_0019.js | 1 + .../flow/ES6/modules/migrated_0019.tree.json | 71 + lib/test/flow/ES6/modules/migrated_0020.js | 1 + .../flow/ES6/modules/migrated_0020.tree.json | 70 + lib/test/flow/ES6/modules/migrated_0021.js | 1 + .../flow/ES6/modules/migrated_0021.tree.json | 71 + lib/test/flow/ES6/modules/migrated_0022.js | 1 + .../flow/ES6/modules/migrated_0022.tree.json | 94 + lib/test/flow/ES6/modules/migrated_0023.js | 1 + .../flow/ES6/modules/migrated_0023.tree.json | 107 + lib/test/flow/ES6/modules/migrated_0024.js | 1 + .../flow/ES6/modules/migrated_0024.tree.json | 46 + .../object_short_notation/migrated_0000.js | 1 + .../migrated_0000.tree.json | 89 + .../object_short_notation/migrated_0001.js | 1 + .../migrated_0001.tree.json | 89 + .../object_short_notation/migrated_0002.js | 1 + .../migrated_0002.tree.json | 134 + .../octal-integer-literal/migrated_0000.js | 1 + .../migrated_0000.tree.json | 21 + .../octal-integer-literal/migrated_0001.js | 1 + .../migrated_0001.tree.json | 21 + .../octal-integer-literal/migrated_0002.js | 1 + .../migrated_0002.tree.json | 61 + .../super-call-in-static-constructor.js | 1 + ...super-call-in-static-constructor.tree.json | 96 + .../ES6/yield/invalid-yield-expression.js | 1 + .../yield/invalid-yield-expression.tree.json | 67 + .../invalid-yield-ident-arrow-param-strict.js | 2 + ...d-yield-ident-arrow-param-strict.tree.json | 89 + .../invalid-yield-ident-assign-strict.js | 2 + ...nvalid-yield-ident-assign-strict.tree.json | 70 + .../yield/invalid-yield-ident-dstr-strict.js | 2 + .../invalid-yield-ident-dstr-strict.tree.json | 97 + .../invalid-yield-ident-func-param-strict.js | 2 + ...id-yield-ident-func-param-strict.tree.json | 75 + lib/test/flow/ES6/yield/migrated_0000.js | 3 + .../flow/ES6/yield/migrated_0000.tree.json | 55 + lib/test/flow/ES6/yield/migrated_0001.js | 3 + .../flow/ES6/yield/migrated_0001.tree.json | 55 + lib/test/flow/ES6/yield/migrated_0002.js | 3 + .../flow/ES6/yield/migrated_0002.tree.json | 48 + lib/test/flow/ES6/yield/migrated_0003.js | 4 + .../flow/ES6/yield/migrated_0003.tree.json | 62 + lib/test/flow/ES6/yield/migrated_0004.js | 3 + .../flow/ES6/yield/migrated_0004.tree.json | 55 + lib/test/flow/ES6/yield/migrated_0005.js | 3 + .../flow/ES6/yield/migrated_0005.tree.json | 60 + lib/test/flow/JSX/gt_in_attribute.js | 1 + lib/test/flow/JSX/gt_in_attribute.tree.json | 53 + .../flow/JSX/html_entity_at_start_of_child.js | 1 + .../html_entity_at_start_of_child.tree.json | 52 + lib/test/flow/JSX/invalid_unpaired_gt.js | 1 + .../flow/JSX/invalid_unpaired_gt.tree.json | 58 + lib/test/flow/JSX/invalid_unpaired_rcurly.js | 1 + .../JSX/invalid_unpaired_rcurly.tree.json | 58 + lib/test/flow/JSX/migrated_0000.js | 1 + lib/test/flow/JSX/migrated_0000.tree.json | 55 + lib/test/flow/JSX/migrated_0001.js | 1 + lib/test/flow/JSX/migrated_0001.tree.json | 55 + lib/test/flow/JSX/migrated_0002.js | 3 + lib/test/flow/JSX/migrated_0002.tree.json | 55 + lib/test/flow/JSX/mismatched_closing_tag.js | 4 + .../flow/JSX/mismatched_closing_tag.tree.json | 103 + lib/test/flow/JSX/partial_closing_tag.js | 3 + .../flow/JSX/partial_closing_tag.tree.json | 99 + lib/test/flow/JSX/partial_opening_tag.js | 3 + .../flow/JSX/partial_opening_tag.tree.json | 85 + lib/test/flow/JSX/partial_opening_tag_frag.js | 3 + .../JSX/partial_opening_tag_frag.tree.json | 81 + lib/test/flow/JSX/rcurly_in_attribute.js | 1 + .../flow/JSX/rcurly_in_attribute.tree.json | 53 + lib/test/flow/JSX_invalid/migrated_0000.js | 1 + .../flow/JSX_invalid/migrated_0000.tree.json | 54 + lib/test/flow/JSX_invalid/migrated_0001.js | 1 + .../flow/JSX_invalid/migrated_0001.tree.json | 119 + lib/test/flow/JSX_invalid/migrated_0002.js | 1 + .../flow/JSX_invalid/migrated_0002.tree.json | 126 + .../array_literal_spreads/migrated_0000.js | 1 + .../migrated_0000.tree.json | 41 + .../array_literal_spreads/migrated_0001.js | 1 + .../migrated_0001.tree.json | 41 + .../array_literal_spreads/migrated_0002.js | 1 + .../migrated_0002.tree.json | 41 + .../array_literal_spreads/migrated_0003.js | 1 + .../migrated_0003.tree.json | 42 + lib/test/flow/arrow_function/migrated_0000.js | 1 + .../arrow_function/migrated_0000.tree.json | 43 + lib/test/flow/arrow_function/migrated_0001.js | 1 + .../arrow_function/migrated_0001.tree.json | 43 + lib/test/flow/arrow_function/migrated_0002.js | 1 + .../arrow_function/migrated_0002.tree.json | 51 + lib/test/flow/arrow_function/migrated_0003.js | 1 + .../arrow_function/migrated_0003.tree.json | 68 + lib/test/flow/arrow_function/migrated_0004.js | 1 + .../arrow_function/migrated_0004.tree.json | 68 + lib/test/flow/arrow_function/migrated_0005.js | 1 + .../arrow_function/migrated_0005.tree.json | 62 + lib/test/flow/arrow_function/migrated_0006.js | 1 + .../arrow_function/migrated_0006.tree.json | 95 + .../flow/arrow_function/object_return_type.js | 1 + .../object_return_type.tree.json | 94 + .../arrow_function/param-dflt-yield-expr.js | 3 + .../param-dflt-yield-expr.tree.json | 87 + .../arrow_function/param-dflt-yield-id.js | 3 + .../param-dflt-yield-id.tree.json | 82 + .../flow/arrow_function/tuple_return_type.js | 1 + .../tuple_return_type.tree.json | 70 + .../arrow_function_invalid/migrated_0000.js | 1 + .../migrated_0000.tree.json | 82 + .../arrow_function_invalid/migrated_0001.js | 1 + .../migrated_0001.tree.json | 56 + .../arrow_function_invalid/migrated_0002.js | 1 + .../migrated_0002.tree.json | 52 + .../arrow_function_invalid/migrated_0003.js | 1 + .../migrated_0003.tree.json | 63 + .../arrow_function_invalid/migrated_0004.js | 1 + .../migrated_0004.tree.json | 63 + .../async_arrow_functions/migrated_0000.js | 1 + .../migrated_0000.tree.json | 55 + .../async_arrow_functions/migrated_0001.js | 1 + .../migrated_0001.tree.json | 64 + .../async_arrow_functions/migrated_0002.js | 1 + .../migrated_0002.tree.json | 64 + .../async_arrow_functions/migrated_0003.js | 1 + .../migrated_0003.tree.json | 72 + .../async_arrow_functions/migrated_0004.js | 1 + .../migrated_0004.tree.json | 87 + .../async_arrow_functions/migrated_0005.js | 1 + .../migrated_0005.tree.json | 52 + .../async_arrow_functions/migrated_0006.js | 1 + .../migrated_0006.tree.json | 86 + .../async_arrow_functions/migrated_0007.js | 1 + .../migrated_0007.tree.json | 201 + .../async_arrow_functions/migrated_0008.js | 1 + .../migrated_0008.tree.json | 78 + .../async_arrow_functions/migrated_0009.js | 2 + .../migrated_0009.tree.json | 73 + .../with_type_parameters.js | 7 + .../with_type_parameters.tree.json | 173 + .../with_type_parameters_types_disabled.js | 7 + ...ype_parameters_types_disabled.options.json | 3 + ...h_type_parameters_types_disabled.tree.json | 274 + .../flow/async_await/async_computed_method.js | 1 + .../async_computed_method.tree.json | 57 + .../flow/async_await/async_generic_method.js | 1 + .../async_generic_method.tree.json | 72 + lib/test/flow/async_await/migrated_0000.js | 1 + .../flow/async_await/migrated_0000.tree.json | 54 + lib/test/flow/async_await/migrated_0001.js | 1 + .../flow/async_await/migrated_0001.tree.json | 54 + lib/test/flow/async_await/migrated_0002.js | 1 + .../flow/async_await/migrated_0002.tree.json | 61 + lib/test/flow/async_await/migrated_0003.js | 1 + .../flow/async_await/migrated_0003.tree.json | 61 + lib/test/flow/async_await/migrated_0004.js | 1 + .../flow/async_await/migrated_0004.tree.json | 61 + lib/test/flow/async_await/migrated_0005.js | 1 + .../flow/async_await/migrated_0005.tree.json | 60 + lib/test/flow/async_await/migrated_0006.js | 1 + .../flow/async_await/migrated_0006.tree.json | 112 + lib/test/flow/async_await/migrated_0007.js | 1 + .../flow/async_await/migrated_0007.tree.json | 105 + lib/test/flow/async_await/migrated_0008.js | 1 + .../flow/async_await/migrated_0008.tree.json | 48 + lib/test/flow/async_await/migrated_0009.js | 2 + .../flow/async_await/migrated_0009.tree.json | 65 + lib/test/flow/async_await/migrated_0010.js | 1 + .../flow/async_await/migrated_0010.tree.json | 93 + lib/test/flow/async_await/migrated_0011.js | 1 + .../flow/async_await/migrated_0011.tree.json | 54 + lib/test/flow/async_await/migrated_0012.js | 1 + .../flow/async_await/migrated_0012.tree.json | 83 + lib/test/flow/async_await/migrated_0013.js | 1 + .../flow/async_await/migrated_0013.tree.json | 83 + lib/test/flow/async_await/migrated_0014.js | 1 + .../flow/async_await/migrated_0014.tree.json | 68 + lib/test/flow/async_await/migrated_0015.js | 1 + .../flow/async_await/migrated_0015.tree.json | 68 + lib/test/flow/async_await/migrated_0016.js | 1 + .../flow/async_await/migrated_0016.tree.json | 48 + lib/test/flow/async_await/migrated_0017.js | 1 + .../flow/async_await/migrated_0017.tree.json | 69 + lib/test/flow/async_await/migrated_0018.js | 1 + .../flow/async_await/migrated_0018.tree.json | 90 + lib/test/flow/async_await/migrated_0019.js | 2 + .../flow/async_await/migrated_0019.tree.json | 51 + lib/test/flow/async_await/migrated_0020.js | 2 + .../flow/async_await/migrated_0020.tree.json | 51 + lib/test/flow/async_await/migrated_0021.js | 2 + .../flow/async_await/migrated_0021.tree.json | 63 + lib/test/flow/async_await/migrated_0022.js | 2 + .../flow/async_await/migrated_0022.tree.json | 65 + lib/test/flow/async_await/migrated_0023.js | 2 + .../flow/async_await/migrated_0023.tree.json | 49 + lib/test/flow/async_await/migrated_0024.js | 2 + .../flow/async_await/migrated_0024.tree.json | 49 + lib/test/flow/async_await/migrated_0025.js | 2 + .../flow/async_await/migrated_0025.tree.json | 78 + lib/test/flow/async_await/migrated_0026.js | 2 + .../flow/async_await/migrated_0026.tree.json | 43 + lib/test/flow/async_await/migrated_0027.js | 2 + .../flow/async_await/migrated_0027.tree.json | 43 + .../flow/async_generators/migrated_0000.js | 1 + .../async_generators/migrated_0000.tree.json | 34 + .../flow/async_generators/migrated_0001.js | 1 + .../async_generators/migrated_0001.tree.json | 76 + .../flow/async_generators/migrated_0002.js | 1 + .../async_generators/migrated_0002.tree.json | 69 + .../flow/async_generators/migrated_0003.js | 1 + .../async_generators/migrated_0003.tree.json | 111 + .../flow/async_generators/migrated_0004.js | 1 + .../async_generators/migrated_0004.tree.json | 78 + .../flow/async_generators/migrated_0005.js | 1 + .../async_generators/migrated_0005.tree.json | 111 + .../flow/async_generators/migrated_0006.js | 1 + .../async_generators/migrated_0006.tree.json | 48 + .../flow/async_generators/migrated_0007.js | 1 + .../async_generators/migrated_0007.tree.json | 90 + .../flow/async_generators/migrated_0008.js | 1 + .../async_generators/migrated_0008.tree.json | 54 + lib/test/flow/bigint/binary-invalid-digit.js | 1 + .../bigint/binary-invalid-digit.tree.json | 45 + lib/test/flow/bigint/binary-invalid-word.js | 1 + .../flow/bigint/binary-invalid-word.tree.json | 45 + lib/test/flow/bigint/exponent-part.js | 1 + lib/test/flow/bigint/exponent-part.tree.json | 27 + lib/test/flow/bigint/float-invalid-dot-dot.js | 1 + .../bigint/float-invalid-dot-dot.tree.json | 35 + lib/test/flow/bigint/float-invalid-dot.js | 1 + .../flow/bigint/float-invalid-dot.tree.json | 27 + ...float-invalid-without-fractional-digits.js | 1 + ...nvalid-without-fractional-digits.tree.json | 27 + lib/test/flow/bigint/float-invalid.js | 1 + lib/test/flow/bigint/float-invalid.tree.json | 27 + lib/test/flow/bigint/hex-invalid-word.js | 1 + .../flow/bigint/hex-invalid-word.tree.json | 45 + .../flow/bigint/hexadecimal-invalid-digit.js | 1 + .../hexadecimal-invalid-digit.tree.json | 45 + lib/test/flow/bigint/legacy-octal-invalid.js | 1 + .../bigint/legacy-octal-invalid.tree.json | 45 + .../flow/bigint/octal-new-invalid-word.js | 1 + .../bigint/octal-new-invalid-word.tree.json | 45 + lib/test/flow/bigint/small-invalid-word.js | 1 + .../flow/bigint/small-invalid-word.tree.json | 45 + lib/test/flow/bigint/valid-binary.js | 1 + lib/test/flow/bigint/valid-binary.tree.json | 21 + lib/test/flow/bigint/valid-hex.js | 1 + lib/test/flow/bigint/valid-hex.tree.json | 21 + lib/test/flow/bigint/valid-large.js | 1 + lib/test/flow/bigint/valid-large.tree.json | 21 + lib/test/flow/bigint/valid-octal-new.js | 1 + .../flow/bigint/valid-octal-new.tree.json | 21 + lib/test/flow/bigint/valid-small.js | 1 + lib/test/flow/bigint/valid-small.tree.json | 21 + .../flow/call_properties/migrated_0000.js | 1 + .../call_properties/migrated_0000.tree.json | 65 + .../flow/call_properties/migrated_0001.js | 1 + .../call_properties/migrated_0001.tree.json | 65 + .../flow/call_properties/migrated_0002.js | 1 + .../call_properties/migrated_0002.tree.json | 129 + .../flow/call_properties/migrated_0003.js | 1 + .../call_properties/migrated_0003.tree.json | 109 + .../flow/call_properties/migrated_0004.js | 1 + .../call_properties/migrated_0004.tree.json | 53 + .../call_properties_invalid/migrated_0000.js | 1 + .../migrated_0000.tree.json | 79 + lib/test/flow/catch/optional_catch_binding.js | 1 + .../catch/optional_catch_binding.tree.json | 26 + .../class_expression/anonymous_implements.js | 1 + .../anonymous_implements.tree.json | 46 + .../anonymous_with_type_params.js | 1 + .../anonymous_with_type_params.tree.json | 70 + .../class_method_kinds/async_as_id_tparams.js | 3 + .../async_as_id_tparams.tree.json | 84 + .../flow/class_method_kinds/async_tparams.js | 3 + .../async_tparams.tree.json | 84 + lib/test/flow/class_method_kinds/get_as_id.js | 3 + .../class_method_kinds/get_as_id.tree.json | 69 + .../class_method_kinds/get_as_id_tparams.js | 3 + .../get_as_id_tparams.tree.json | 84 + .../flow/class_method_kinds/migrated_0000.js | 1 + .../migrated_0000.tree.json | 69 + .../flow/class_method_kinds/migrated_0001.js | 1 + .../migrated_0001.tree.json | 68 + .../flow/class_method_kinds/migrated_0002.js | 1 + .../migrated_0002.tree.json | 69 + .../flow/class_method_kinds/migrated_0003.js | 1 + .../migrated_0003.tree.json | 68 + .../flow/class_method_kinds/migrated_0004.js | 1 + .../migrated_0004.tree.json | 69 + .../flow/class_method_kinds/migrated_0005.js | 1 + .../migrated_0005.tree.json | 68 + .../flow/class_method_kinds/migrated_0006.js | 1 + .../migrated_0006.tree.json | 78 + .../flow/class_method_kinds/migrated_0007.js | 1 + .../migrated_0007.tree.json | 77 + .../multiple_constructors.js | 25 + .../multiple_constructors.tree.json | 465 + .../class_method_kinds/polymorphic_getter.js | 1 + .../polymorphic_getter.tree.json | 104 + .../flow/class_method_kinds/static_async.js | 3 + .../class_method_kinds/static_async.tree.json | 69 + .../class_method_kinds/static_async_as_id.js | 3 + .../static_async_as_id.tree.json | 69 + lib/test/flow/class_properties/async.js | 3 + .../flow/class_properties/async.tree.json | 51 + .../flow/class_properties/async_annotated.js | 3 + .../async_annotated.tree.json | 60 + lib/test/flow/class_properties/async_asi.js | 4 + .../flow/class_properties/async_asi.tree.json | 94 + .../class_properties/async_initializer.js | 3 + .../async_initializer.options.json | 3 + .../async_initializer.tree.json | 57 + lib/test/flow/class_properties/computed.js | 3 + .../flow/class_properties/computed.tree.json | 50 + lib/test/flow/class_properties/get.js | 3 + lib/test/flow/class_properties/get.tree.json | 51 + .../flow/class_properties/migrated_0000.js | 1 + .../class_properties/migrated_0000.tree.json | 51 + .../flow/class_properties/migrated_0001.js | 1 + .../class_properties/migrated_0001.tree.json | 60 + .../flow/class_properties/migrated_0002.js | 1 + .../migrated_0002.options.json | 3 + .../class_properties/migrated_0002.tree.json | 57 + .../flow/class_properties/migrated_0003.js | 1 + .../migrated_0003.options.json | 3 + .../class_properties/migrated_0003.tree.json | 130 + .../flow/class_properties/migrated_0004.js | 1 + .../migrated_0004.options.json | 3 + .../class_properties/migrated_0004.tree.json | 66 + .../flow/class_properties/migrated_0005.js | 1 + .../class_properties/migrated_0005.tree.json | 51 + .../flow/class_properties/migrated_0006.js | 1 + .../class_properties/migrated_0006.tree.json | 60 + .../flow/class_properties/migrated_0007.js | 1 + .../migrated_0007.options.json | 3 + .../class_properties/migrated_0007.tree.json | 57 + .../flow/class_properties/migrated_0008.js | 1 + .../migrated_0008.options.json | 3 + .../class_properties/migrated_0008.tree.json | 130 + .../flow/class_properties/migrated_0009.js | 1 + .../migrated_0009.options.json | 3 + .../class_properties/migrated_0009.tree.json | 66 + .../flow/class_properties/migrated_0010.js | 1 + .../migrated_0010.options.json | 3 + .../class_properties/migrated_0010.tree.json | 66 + .../flow/class_properties/migrated_0011.js | 1 + .../class_properties/migrated_0011.tree.json | 51 + .../flow/class_properties/migrated_0012.js | 1 + .../class_properties/migrated_0012.tree.json | 60 + .../flow/class_properties/migrated_0013.js | 1 + .../migrated_0013.options.json | 3 + .../class_properties/migrated_0013.tree.json | 57 + .../flow/class_properties/migrated_0014.js | 1 + .../class_properties/migrated_0014.tree.json | 84 + .../flow/class_properties/migrated_0015.js | 1 + .../class_properties/migrated_0015.tree.json | 69 + .../flow/class_properties/migrated_0016.js | 1 + .../class_properties/migrated_0016.tree.json | 51 + .../flow/class_properties/migrated_0017.js | 1 + .../class_properties/migrated_0017.tree.json | 60 + .../flow/class_properties/migrated_0018.js | 1 + .../migrated_0018.options.json | 3 + .../class_properties/migrated_0018.tree.json | 57 + .../flow/class_properties/migrated_0019.js | 1 + .../class_properties/migrated_0019.tree.json | 84 + .../flow/class_properties/migrated_0020.js | 1 + .../class_properties/migrated_0020.tree.json | 69 + .../flow/class_properties/migrated_0021.js | 1 + .../class_properties/migrated_0021.tree.json | 87 + .../flow/class_properties/migrated_0022.js | 1 + .../class_properties/migrated_0022.tree.json | 87 + .../flow/class_properties/migrated_0023.js | 4 + .../migrated_0023.options.json | 3 + .../class_properties/migrated_0023.tree.json | 93 + .../flow/class_properties/migrated_0024.js | 4 + .../migrated_0024.options.json | 3 + .../class_properties/migrated_0024.tree.json | 84 + .../flow/class_properties/migrated_0025.js | 4 + .../migrated_0025.options.json | 3 + .../class_properties/migrated_0025.tree.json | 150 + .../flow/class_properties/migrated_0026.js | 4 + .../class_properties/migrated_0026.tree.json | 93 + .../flow/class_properties/migrated_0027.js | 4 + .../class_properties/migrated_0027.tree.json | 105 + .../flow/class_properties/migrated_0028.js | 4 + .../migrated_0028.options.json | 3 + .../class_properties/migrated_0028.tree.json | 114 + .../flow/class_properties/migrated_0029.js | 1 + .../class_properties/migrated_0029.tree.json | 81 + .../flow/class_properties/migrated_0030.js | 1 + .../class_properties/migrated_0030.tree.json | 86 + .../class_properties/super-call-in-arrow.js | 3 + .../super-call-in-arrow.options.json | 3 + .../super-call-in-arrow.tree.json | 83 + .../class_properties/super-prop-in-arrow.js | 3 + .../super-prop-in-arrow.options.json | 3 + .../super-prop-in-arrow.tree.json | 82 + .../class_properties/super-prop-in-prop.js | 3 + .../super-prop-in-prop.options.json | 3 + .../super-prop-in-prop.tree.json | 69 + lib/test/flow/class_properties/super-prop.js | 3 + .../class_properties/super-prop.options.json | 3 + .../class_properties/super-prop.tree.json | 51 + lib/test/flow/class_properties/unannotated.js | 3 + .../class_properties/unannotated.tree.json | 51 + .../flow/class_properties/unannotated_asi.js | 4 + .../unannotated_asi.tree.json | 69 + lib/test/flow/comment_interning/array.js | 12 + .../flow/comment_interning/array.options.json | 3 + .../flow/comment_interning/array.tree.json | 338 + .../flow/comment_interning/array_pattern.js | 12 + .../array_pattern.options.json | 3 + .../comment_interning/array_pattern.tree.json | 410 + .../flow/comment_interning/arrow_function.js | 12 + .../arrow_function.options.json | 3 + .../arrow_function.tree.json | 500 + lib/test/flow/comment_interning/assignment.js | 5 + .../comment_interning/assignment.options.json | 3 + .../comment_interning/assignment.tree.json | 203 + lib/test/flow/comment_interning/binary.js | 3 + .../comment_interning/binary.options.json | 3 + .../flow/comment_interning/binary.tree.json | 173 + lib/test/flow/comment_interning/block.js | 13 + .../flow/comment_interning/block.options.json | 3 + .../flow/comment_interning/block.tree.json | 184 + lib/test/flow/comment_interning/break.js | 28 + .../flow/comment_interning/break.options.json | 3 + .../flow/comment_interning/break.tree.json | 406 + lib/test/flow/comment_interning/call.js | 18 + .../flow/comment_interning/call.options.json | 3 + .../flow/comment_interning/call.tree.json | 620 + lib/test/flow/comment_interning/catch.js | 35 + .../flow/comment_interning/catch.options.json | 3 + .../flow/comment_interning/catch.tree.json | 610 + .../comment_interning/class_declaration.js | 35 + .../class_declaration.options.json | 3 + .../class_declaration.tree.json | 1420 ++ .../comment_interning/class_expression.js | 5 + .../class_expression.options.json | 3 + .../class_expression.tree.json | 260 + .../flow/comment_interning/class_method.js | 42 + .../class_method.options.json | 3 + .../comment_interning/class_method.tree.json | 1628 +++ .../flow/comment_interning/class_property.js | 37 + .../class_property.options.json | 4 + .../class_property.tree.json | 1055 ++ .../flow/comment_interning/conditional.js | 3 + .../conditional.options.json | 3 + .../comment_interning/conditional.tree.json | 213 + lib/test/flow/comment_interning/continue.js | 28 + .../comment_interning/continue.options.json | 3 + .../flow/comment_interning/continue.tree.json | 406 + lib/test/flow/comment_interning/debugger.js | 24 + .../comment_interning/debugger.options.json | 3 + .../flow/comment_interning/debugger.tree.json | 342 + .../flow/comment_interning/declare_class.js | 31 + .../declare_class.options.json | 3 + .../comment_interning/declare_class.tree.json | 892 ++ .../declare_export_declaration.js | 47 + .../declare_export_declaration.options.json | 3 + .../declare_export_declaration.tree.json | 1550 +++ .../comment_interning/declare_function.js | 22 + .../declare_function.options.json | 3 + .../declare_function.tree.json | 633 + .../comment_interning/declare_interface.js | 7 + .../declare_interface.options.json | 3 + .../declare_interface.tree.json | 187 + .../flow/comment_interning/declare_module.js | 15 + .../declare_module.options.json | 3 + .../declare_module.tree.json | 329 + .../declare_module_exports.js | 7 + .../declare_module_exports.options.json | 3 + .../declare_module_exports.tree.json | 221 + .../comment_interning/declare_type_alias.js | 27 + .../declare_type_alias.options.json | 3 + .../declare_type_alias.tree.json | 566 + .../comment_interning/declare_variable.js | 13 + .../declare_variable.options.json | 3 + .../declare_variable.tree.json | 323 + lib/test/flow/comment_interning/decorator.js | 14 + .../comment_interning/decorator.options.json | 4 + .../comment_interning/decorator.tree.json | 519 + lib/test/flow/comment_interning/do_while.js | 32 + .../comment_interning/do_while.options.json | 3 + .../flow/comment_interning/do_while.tree.json | 603 + .../flow/comment_interning/empty_statement.js | 2 + .../empty_statement.options.json | 3 + .../empty_statement.tree.json | 75 + .../comment_interning/enum_declaration.js | 21 + .../enum_declaration.options.json | 4 + .../enum_declaration.tree.json | 580 + lib/test/flow/comment_interning/export.js | 29 + .../comment_interning/export.options.json | 3 + .../flow/comment_interning/export.tree.json | 964 ++ .../comment_interning/expression_statement.js | 22 + .../expression_statement.options.json | 3 + .../expression_statement.tree.json | 333 + lib/test/flow/comment_interning/for.js | 7 + .../flow/comment_interning/for.options.json | 3 + lib/test/flow/comment_interning/for.tree.json | 487 + .../comment_interning/function_declaration.js | 47 + .../function_declaration.options.json | 3 + .../function_declaration.tree.json | 1531 +++ .../comment_interning/function_expression.js | 30 + .../function_expression.options.json | 3 + .../function_expression.tree.json | 1062 ++ .../flow/comment_interning/function_type.js | 14 + .../function_type.options.json | 3 + .../comment_interning/function_type.tree.json | 662 + lib/test/flow/comment_interning/if.js | 8 + .../flow/comment_interning/if.options.json | 3 + lib/test/flow/comment_interning/if.tree.json | 226 + lib/test/flow/comment_interning/import.js | 15 + .../comment_interning/import.options.json | 3 + .../flow/comment_interning/import.tree.json | 579 + lib/test/flow/comment_interning/interface.js | 20 + .../comment_interning/interface.options.json | 3 + .../comment_interning/interface.tree.json | 598 + .../flow/comment_interning/jsx_element.js | 32 + .../jsx_element.options.json | 3 + .../comment_interning/jsx_element.tree.json | 1356 ++ .../flow/comment_interning/jsx_fragment.js | 1 + .../jsx_fragment.options.json | 3 + .../comment_interning/jsx_fragment.tree.json | 67 + lib/test/flow/comment_interning/labeled.js | 7 + .../comment_interning/labeled.options.json | 3 + .../flow/comment_interning/labeled.tree.json | 173 + lib/test/flow/comment_interning/literal.js | 11 + .../comment_interning/literal.options.json | 3 + .../flow/comment_interning/literal.tree.json | 256 + lib/test/flow/comment_interning/member.js | 20 + .../comment_interning/member.options.json | 3 + .../flow/comment_interning/member.tree.json | 656 + .../flow/comment_interning/meta_property.js | 5 + .../meta_property.options.json | 3 + .../comment_interning/meta_property.tree.json | 202 + lib/test/flow/comment_interning/new.js | 17 + .../flow/comment_interning/new.options.json | 3 + lib/test/flow/comment_interning/new.tree.json | 504 + lib/test/flow/comment_interning/object.js | 44 + .../comment_interning/object.options.json | 3 + .../flow/comment_interning/object.tree.json | 1551 +++ .../flow/comment_interning/object_pattern.js | 5 + .../object_pattern.options.json | 3 + .../object_pattern.tree.json | 223 + .../flow/comment_interning/object_type.js | 65 + .../object_type.options.json | 3 + .../comment_interning/object_type.tree.json | 2256 ++++ .../parenthesized_expression.js | 61 + .../parenthesized_expression.options.json | 4 + .../parenthesized_expression.tree.json | 1534 +++ .../comment_interning/parenthesized_type.js | 51 + .../parenthesized_type.options.json | 3 + .../parenthesized_type.tree.json | 1363 ++ .../program_comment_block.js | 6 + .../program_comment_block.options.json | 3 + .../program_comment_block.tree.json | 56 + .../program_comment_directive.js | 8 + .../program_comment_directive.options.json | 3 + .../program_comment_directive.tree.json | 68 + .../remove_expression_trailing_comments.js | 152 + ..._expression_trailing_comments.options.json | 3 + ...ove_expression_trailing_comments.tree.json | 3247 +++++ .../remove_type_trailing_comments.js | 60 + ...remove_type_trailing_comments.options.json | 3 + .../remove_type_trailing_comments.tree.json | 1964 +++ lib/test/flow/comment_interning/return.js | 19 + .../comment_interning/return.options.json | 3 + .../flow/comment_interning/return.tree.json | 379 + lib/test/flow/comment_interning/sequence.js | 7 + .../comment_interning/sequence.options.json | 3 + .../flow/comment_interning/sequence.tree.json | 173 + lib/test/flow/comment_interning/super.js | 19 + .../flow/comment_interning/super.options.json | 3 + .../flow/comment_interning/super.tree.json | 305 + lib/test/flow/comment_interning/switch.js | 39 + .../comment_interning/switch.options.json | 3 + .../flow/comment_interning/switch.tree.json | 723 + lib/test/flow/comment_interning/template.js | 20 + .../comment_interning/template.options.json | 3 + .../flow/comment_interning/template.tree.json | 466 + lib/test/flow/comment_interning/this.js | 11 + .../flow/comment_interning/this.options.json | 3 + .../flow/comment_interning/this.tree.json | 179 + lib/test/flow/comment_interning/throw.js | 14 + .../flow/comment_interning/throw.options.json | 3 + .../flow/comment_interning/throw.tree.json | 361 + .../flow/comment_interning/trailing_comma.js | 42 + .../trailing_comma.options.json | 4 + .../trailing_comma.tree.json | 962 ++ lib/test/flow/comment_interning/try.js | 41 + .../flow/comment_interning/try.options.json | 3 + lib/test/flow/comment_interning/try.tree.json | 777 ++ lib/test/flow/comment_interning/type_alias.js | 21 + .../comment_interning/type_alias.options.json | 3 + .../comment_interning/type_alias.tree.json | 615 + lib/test/flow/comment_interning/type_cast.js | 15 + .../comment_interning/type_cast.options.json | 3 + .../comment_interning/type_cast.tree.json | 369 + .../flow/comment_interning/type_parameters.js | 1 + .../type_parameters.options.json | 3 + .../type_parameters.tree.json | 63 + lib/test/flow/comment_interning/types.js | 53 + .../flow/comment_interning/types.options.json | 3 + .../flow/comment_interning/types.tree.json | 1764 +++ lib/test/flow/comment_interning/unary.js | 3 + .../flow/comment_interning/unary.options.json | 3 + .../flow/comment_interning/unary.tree.json | 199 + lib/test/flow/comment_interning/update.js | 11 + .../comment_interning/update.options.json | 3 + .../flow/comment_interning/update.tree.json | 245 + .../comment_interning/variable_declaration.js | 45 + .../variable_declaration.options.json | 3 + .../variable_declaration.tree.json | 1124 ++ lib/test/flow/comment_interning/while.js | 1 + .../flow/comment_interning/while.options.json | 3 + .../flow/comment_interning/while.tree.json | 109 + lib/test/flow/comment_interning/with.js | 1 + .../flow/comment_interning/with.options.json | 3 + .../flow/comment_interning/with.tree.json | 109 + lib/test/flow/comment_interning/yield.js | 31 + .../flow/comment_interning/yield.options.json | 3 + .../flow/comment_interning/yield.tree.json | 1021 ++ lib/test/flow/comments/migrated_0000.js | 2 + .../flow/comments/migrated_0000.tree.json | 20 + lib/test/flow/comments/migrated_0001.js | 2 + .../flow/comments/migrated_0001.tree.json | 71 + lib/test/flow/comments/migrated_0002.js | 2 + .../flow/comments/migrated_0002.tree.json | 60 + lib/test/flow/comments/migrated_0003.js | 3 + .../flow/comments/migrated_0003.tree.json | 52 + lib/test/flow/decorators/migrated_0000.js | 2 + .../decorators/migrated_0000.options.json | 3 + .../flow/decorators/migrated_0000.tree.json | 123 + lib/test/flow/decorators/migrated_0001.js | 2 + .../decorators/migrated_0001.options.json | 3 + .../flow/decorators/migrated_0001.tree.json | 96 + lib/test/flow/decorators/migrated_0002.js | 2 + .../decorators/migrated_0002.options.json | 3 + .../flow/decorators/migrated_0002.tree.json | 104 + lib/test/flow/decorators/migrated_0003.js | 4 + .../decorators/migrated_0003.options.json | 3 + .../flow/decorators/migrated_0003.tree.json | 104 + lib/test/flow/decorators/migrated_0004.js | 2 + .../decorators/migrated_0004.options.json | 3 + .../flow/decorators/migrated_0004.tree.json | 102 + lib/test/flow/decorators/migrated_0005.js | 4 + .../decorators/migrated_0005.options.json | 3 + .../flow/decorators/migrated_0005.tree.json | 102 + lib/test/flow/decorators/migrated_0006.js | 1 + .../decorators/migrated_0006.options.json | 3 + .../flow/decorators/migrated_0006.tree.json | 96 + lib/test/flow/decorators/migrated_0007.js | 1 + .../decorators/migrated_0007.options.json | 3 + .../flow/decorators/migrated_0007.tree.json | 96 + lib/test/flow/decorators/migrated_0008.js | 1 + .../decorators/migrated_0008.options.json | 3 + .../flow/decorators/migrated_0008.tree.json | 96 + lib/test/flow/decorators/migrated_0009.js | 1 + .../decorators/migrated_0009.options.json | 3 + .../flow/decorators/migrated_0009.tree.json | 96 + lib/test/flow/decorators/migrated_0010.js | 1 + .../decorators/migrated_0010.options.json | 3 + .../flow/decorators/migrated_0010.tree.json | 96 + lib/test/flow/decorators/migrated_0011.js | 1 + .../decorators/migrated_0011.options.json | 3 + .../flow/decorators/migrated_0011.tree.json | 105 + lib/test/flow/decorators/migrated_0012.js | 1 + .../decorators/migrated_0012.options.json | 3 + .../flow/decorators/migrated_0012.tree.json | 98 + .../flow/decorators_invalid/migrated_0000.js | 1 + .../migrated_0000.tree.json | 42 + .../flow/decorators_invalid/migrated_0001.js | 1 + .../migrated_0001.options.json | 3 + .../migrated_0001.tree.json | 23 + .../flow/decorators_invalid/migrated_0002.js | 2 + .../migrated_0002.options.json | 3 + .../migrated_0002.tree.json | 32 + .../flow/decorators_invalid/migrated_0003.js | 2 + .../migrated_0003.options.json | 3 + .../migrated_0003.tree.json | 49 + .../flow/decorators_invalid/migrated_0004.js | 2 + .../migrated_0004.options.json | 3 + .../migrated_0004.tree.json | 42 + .../flow/decorators_invalid/migrated_0005.js | 2 + .../migrated_0005.options.json | 3 + .../migrated_0005.tree.json | 42 + .../flow/decorators_invalid/migrated_0006.js | 2 + .../migrated_0006.options.json | 3 + .../migrated_0006.tree.json | 40 + .../flow/decorators_invalid/migrated_0007.js | 2 + .../migrated_0007.options.json | 3 + .../migrated_0007.tree.json | 39 + .../flow/decorators_invalid/migrated_0008.js | 2 + .../migrated_0008.options.json | 3 + .../migrated_0008.tree.json | 41 + .../flow/decorators_invalid/migrated_0009.js | 2 + .../migrated_0009.options.json | 3 + .../migrated_0009.tree.json | 33 + .../flow/decorators_invalid/migrated_0010.js | 2 + .../migrated_0010.options.json | 3 + .../migrated_0010.tree.json | 40 + .../migrated_0000.js | 1 + .../migrated_0000.tree.json | 73 + .../migrated_0001.js | 1 + .../migrated_0001.tree.json | 73 + .../migrated_0002.js | 1 + .../migrated_0002.tree.json | 195 + .../migrated_0003.js | 1 + .../migrated_0003.tree.json | 56 + .../migrated_0004.js | 1 + .../migrated_0004.tree.json | 64 + ...obj_assignment_pattern_with_literal_key.js | 1 + ...ignment_pattern_with_literal_key.tree.json | 65 + lib/test/flow/dynamic_import/migrated_0000.js | 1 + .../dynamic_import/migrated_0000.tree.json | 41 + lib/test/flow/dynamic_import/migrated_0001.js | 1 + .../dynamic_import/migrated_0001.tree.json | 62 + lib/test/flow/dynamic_import/migrated_0002.js | 1 + .../dynamic_import/migrated_0002.tree.json | 56 + lib/test/flow/dynamic_import/migrated_0003.js | 1 + .../dynamic_import/migrated_0003.tree.json | 47 + lib/test/flow/dynamic_import/migrated_0004.js | 1 + .../dynamic_import/migrated_0004.tree.json | 54 + lib/test/flow/dynamic_import/migrated_0005.js | 1 + .../dynamic_import/migrated_0005.tree.json | 78 + lib/test/flow/dynamic_import/migrated_0006.js | 1 + .../dynamic_import/migrated_0006.tree.json | 47 + ...boolean-member-not-initialized-explicit.js | 3 + ...mber-not-initialized-explicit.options.json | 3 + ...-member-not-initialized-explicit.tree.json | 35 + ...boolean-member-not-initialized-implicit.js | 4 + ...mber-not-initialized-implicit.options.json | 3 + ...-member-not-initialized-implicit.tree.json | 56 + .../flow/enums/enum-duplicate-member-name.js | 4 + .../enum-duplicate-member-name.options.json | 3 + .../enum-duplicate-member-name.tree.json | 62 + .../enum-end-of-file-after-member-name.js | 2 + ...end-of-file-after-member-name.options.json | 3 + ...um-end-of-file-after-member-name.tree.json | 49 + lib/test/flow/enums/enum-end-of-file.js | 1 + .../flow/enums/enum-end-of-file.options.json | 3 + .../flow/enums/enum-end-of-file.tree.json | 43 + lib/test/flow/enums/enum-export.js | 3 + lib/test/flow/enums/enum-export.options.json | 3 + lib/test/flow/enums/enum-export.tree.json | 64 + ...istent-member-values-majority-defaulted.js | 5 + ...ber-values-majority-defaulted.options.json | 3 + ...member-values-majority-defaulted.tree.json | 35 + ...istent-member-values-mixed-initializers.js | 4 + ...ber-values-mixed-initializers.options.json | 3 + ...member-values-mixed-initializers.tree.json | 35 + .../enum-invalid-explicit-type-expression.js | 2 + ...alid-explicit-type-expression.options.json | 3 + ...invalid-explicit-type-expression.tree.json | 43 + .../enum-invalid-explicit-type-identifier.js | 2 + ...alid-explicit-type-identifier.options.json | 3 + ...invalid-explicit-type-identifier.tree.json | 35 + lib/test/flow/enums/enum-invalid-export.js | 4 + .../enums/enum-invalid-export.options.json | 3 + .../flow/enums/enum-invalid-export.tree.json | 71 + .../enum-invalid-initializer-separator.js | 3 + ...invalid-initializer-separator.options.json | 3 + ...um-invalid-initializer-separator.tree.json | 56 + ...ber-initializer-boolean-explicit-string.js | 3 + ...lizer-boolean-explicit-string.options.json | 3 + ...tializer-boolean-explicit-string.tree.json | 35 + ...initializer-expression-explicit-boolean.js | 3 + ...r-expression-explicit-boolean.options.json | 3 + ...izer-expression-explicit-boolean.tree.json | 43 + ...-initializer-expression-explicit-number.js | 3 + ...er-expression-explicit-number.options.json | 3 + ...lizer-expression-explicit-number.tree.json | 43 + ...-initializer-expression-explicit-string.js | 3 + ...er-expression-explicit-string.options.json | 3 + ...lizer-expression-explicit-string.tree.json | 43 + ...-initializer-expression-explicit-symbol.js | 3 + ...er-expression-explicit-symbol.options.json | 3 + ...lizer-expression-explicit-symbol.tree.json | 42 + ...-member-initializer-expression-implicit.js | 3 + ...itializer-expression-implicit.options.json | 3 + ...-initializer-expression-implicit.tree.json | 43 + ...ber-initializer-literal-explicit-symbol.js | 3 + ...lizer-literal-explicit-symbol.options.json | 3 + ...tializer-literal-explicit-symbol.tree.json | 34 + ...ber-initializer-number-explicit-boolean.js | 3 + ...lizer-number-explicit-boolean.options.json | 3 + ...tializer-number-explicit-boolean.tree.json | 35 + ...mber-initializer-number-explicit-string.js | 3 + ...alizer-number-explicit-string.options.json | 3 + ...itializer-number-explicit-string.tree.json | 35 + ...nvalid-member-initializer-parenthesized.js | 3 + ...ber-initializer-parenthesized.options.json | 3 + ...member-initializer-parenthesized.tree.json | 43 + ...ber-initializer-string-explicit-boolean.js | 3 + ...lizer-string-explicit-boolean.options.json | 3 + ...tializer-string-explicit-boolean.tree.json | 35 + ...mber-initializer-string-explicit-number.js | 3 + ...alizer-string-explicit-number.options.json | 3 + ...itializer-string-explicit-number.tree.json | 35 + .../flow/enums/enum-invalid-member-name.js | 4 + .../enum-invalid-member-name.options.json | 3 + .../enums/enum-invalid-member-name.tree.json | 66 + ...invalid-member-separator-no-initializer.js | 4 + ...mber-separator-no-initializer.options.json | 3 + ...-member-separator-no-initializer.tree.json | 62 + ...valid-member-separator-with-initializer.js | 3 + ...er-separator-with-initializer.options.json | 3 + ...ember-separator-with-initializer.tree.json | 56 + ...-invalid-unknown-members-trailing-comma.js | 4 + ...nknown-members-trailing-comma.options.json | 3 + ...d-unknown-members-trailing-comma.tree.json | 49 + .../enums/enum-invalid-unknown-members.js | 4 + .../enum-invalid-unknown-members.options.json | 3 + .../enum-invalid-unknown-members.tree.json | 49 + ...-number-member-not-initialized-explicit.js | 3 + ...mber-not-initialized-explicit.options.json | 3 + ...-member-not-initialized-explicit.tree.json | 35 + ...-number-member-not-initialized-implicit.js | 4 + ...mber-not-initialized-implicit.options.json | 3 + ...-member-not-initialized-implicit.tree.json | 56 + lib/test/flow/enums/enum-option-off.js | 4 + .../flow/enums/enum-option-off.options.json | 3 + lib/test/flow/enums/enum-option-off.tree.json | 56 + .../enums/enum-reserved-word-enum-name.js | 2 + .../enum-reserved-word-enum-name.options.json | 3 + .../enum-reserved-word-enum-name.tree.json | 35 + ...istently-initialized-majority-defaulted.js | 5 + ...nitialized-majority-defaulted.options.json | 3 + ...y-initialized-majority-defaulted.tree.json | 62 + ...tently-initialized-majority-initialized.js | 5 + ...tialized-majority-initialized.options.json | 3 + ...initialized-majority-initialized.tree.json | 76 + .../flow/enums/enum-valid-boolean-explicit.js | 4 + .../enum-valid-boolean-explicit.options.json | 3 + .../enum-valid-boolean-explicit.tree.json | 70 + .../flow/enums/enum-valid-boolean-implicit.js | 4 + .../enum-valid-boolean-implicit.options.json | 3 + .../enum-valid-boolean-implicit.tree.json | 70 + lib/test/flow/enums/enum-valid-empty.js | 1 + .../flow/enums/enum-valid-empty.options.json | 3 + .../flow/enums/enum-valid-empty.tree.json | 29 + lib/test/flow/enums/enum-valid-name.js | 2 + .../flow/enums/enum-valid-name.options.json | 3 + lib/test/flow/enums/enum-valid-name.tree.json | 29 + .../enums/enum-valid-no-trailing-comma.js | 3 + .../enum-valid-no-trailing-comma.options.json | 3 + .../enum-valid-no-trailing-comma.tree.json | 43 + .../flow/enums/enum-valid-number-explicit.js | 4 + .../enum-valid-number-explicit.options.json | 3 + .../enum-valid-number-explicit.tree.json | 70 + .../flow/enums/enum-valid-number-implicit.js | 4 + .../enum-valid-number-implicit.options.json | 3 + .../enum-valid-number-implicit.tree.json | 70 + .../enum-valid-string-explicit-defaulted.js | 4 + ...lid-string-explicit-defaulted.options.json | 3 + ...-valid-string-explicit-defaulted.tree.json | 56 + .../enum-valid-string-explicit-initialized.js | 4 + ...d-string-explicit-initialized.options.json | 3 + ...alid-string-explicit-initialized.tree.json | 70 + .../enum-valid-string-implicit-defaulted.js | 4 + ...lid-string-implicit-defaulted.options.json | 3 + ...-valid-string-implicit-defaulted.tree.json | 56 + .../enum-valid-string-implicit-initialized.js | 4 + ...d-string-implicit-initialized.options.json | 3 + ...alid-string-implicit-initialized.tree.json | 70 + lib/test/flow/enums/enum-valid-symbol.js | 4 + .../flow/enums/enum-valid-symbol.options.json | 3 + .../flow/enums/enum-valid-symbol.tree.json | 55 + .../flow/enums/enum-valid-unknown-members.js | 8 + .../enum-valid-unknown-members.options.json | 3 + .../enum-valid-unknown-members.tree.json | 64 + lib/test/flow/exponentiation/migrated_0000.js | 1 + .../exponentiation/migrated_0000.tree.json | 34 + lib/test/flow/exponentiation/migrated_0001.js | 2 + .../exponentiation/migrated_0001.tree.json | 80 + lib/test/flow/exponentiation/migrated_0002.js | 1 + .../exponentiation/migrated_0002.tree.json | 41 + lib/test/flow/exponentiation/migrated_0003.js | 1 + .../exponentiation/migrated_0003.tree.json | 47 + lib/test/flow/exponentiation/migrated_0004.js | 1 + .../exponentiation/migrated_0004.tree.json | 63 + .../migrated_0000.js | 1 + .../migrated_0000.tree.json | 45 + .../migrated_0001.js | 1 + .../migrated_0001.tree.json | 45 + .../migrated_0002.js | 1 + .../migrated_0002.tree.json | 45 + .../migrated_0003.js | 1 + .../migrated_0003.tree.json | 39 + .../migrated_0004.js | 1 + .../migrated_0004.tree.json | 45 + .../migrated_0005.js | 1 + .../migrated_0005.tree.json | 45 + .../migrated_0006.js | 1 + .../migrated_0006.tree.json | 51 + .../migrated_0007.js | 1 + .../migrated_0007.tree.json | 51 + .../export_default_async_expression.js | 1 + .../export_default_async_expression.tree.json | 40 + .../export_default_async_function.js | 1 + .../export_default_async_function.tree.json | 33 + .../export_default_async_generator.js | 1 + .../export_default_async_generator.tree.json | 33 + .../export_default_async_id_and_function.js | 2 + ...rt_default_async_id_and_function.tree.json | 86 + ...ort_default_async_id_and_named_function.js | 2 + ...ault_async_id_and_named_function.tree.json | 48 + .../export_default_async_named_function.js | 1 + ...ort_default_async_named_function.tree.json | 40 + .../export_default_async_named_generator.js | 1 + ...rt_default_async_named_generator.tree.json | 40 + .../export_statements/export_missing_comma.js | 1 + .../export_missing_comma.tree.json | 66 + .../export_trailing_comma.js | 1 + .../export_trailing_comma.tree.json | 39 + .../expression/assignment/assign_declare.js | 1 + .../assignment/assign_declare.tree.json | 35 + .../expression/assignment/assign_interface.js | 1 + .../assignment/assign_interface.tree.json | 35 + .../flow/expression/assignment/assign_of.js | 1 + .../expression/assignment/assign_of.tree.json | 35 + .../flow/expression/assignment/assign_type.js | 1 + .../assignment/assign_type.tree.json | 35 + lib/test/flow/expression/assignment/parens.js | 1 + .../expression/assignment/parens.tree.json | 35 + .../binary-logical/and_on_lhs_of_or.js | 1 + .../binary-logical/and_on_lhs_of_or.tree.json | 50 + .../binary-logical/migrated_0000.js | 1 + .../binary-logical/migrated_0000.tree.json | 50 + .../binary-logical/migrated_0001.js | 1 + .../binary-logical/migrated_0001.tree.json | 50 + .../binary-logical/migrated_0002.js | 1 + .../binary-logical/migrated_0002.tree.json | 50 + .../binary-logical/migrated_0003.js | 1 + .../binary-logical/migrated_0003.tree.json | 50 + .../binary-logical/migrated_0004.js | 1 + .../binary-logical/migrated_0004.tree.json | 50 + .../binary-logical/migrated_0005.js | 1 + .../binary-logical/migrated_0005.tree.json | 50 + .../left-hand-side/type_property.js | 1 + .../left-hand-side/type_property.tree.json | 36 + .../expression/sequence/parenthesized_left.js | 1 + .../sequence/parenthesized_left.tree.json | 35 + .../sequence/parenthesized_right.js | 1 + .../sequence/parenthesized_right.tree.json | 35 + .../flow/expression/unary/incr_with_parens.js | 1 + .../unary/incr_with_parens.tree.json | 29 + .../flow/expression/unary/not_with_parens.js | 1 + .../unary/not_with_parens.tree.json | 29 + .../flow/for_await_loops/migrated_0000.js | 1 + .../for_await_loops/migrated_0000.tree.json | 50 + .../flow/for_await_loops/migrated_0001.js | 1 + .../for_await_loops/migrated_0001.tree.json | 76 + .../flow/for_await_loops/migrated_0002.js | 1 + .../for_await_loops/migrated_0002.tree.json | 82 + .../flow/for_await_loops/migrated_0003.js | 1 + .../for_await_loops/migrated_0003.tree.json | 139 + .../for_of_loops_invalid/migrated_0000.js | 1 + .../migrated_0000.tree.json | 86 + .../flow/import_statements/migrated_0000.js | 1 + .../import_statements/migrated_0000.tree.json | 45 + .../flow/import_statements/migrated_0001.js | 1 + .../import_statements/migrated_0001.tree.json | 58 + .../flow/import_statements/migrated_0002.js | 1 + .../import_statements/migrated_0002.tree.json | 73 + lib/test/flow/import_statements/missing_as.js | 2 + .../import_statements/missing_as.tree.json | 52 + .../import_statements/missing_as_and_from.js | 2 + .../missing_as_and_from.tree.json | 56 + .../flow/import_statements/missing_from.js | 2 + .../import_statements/missing_from.tree.json | 75 + .../flow/import_statements/missing_source.js | 2 + .../missing_source.tree.json | 75 + lib/test/flow/internal_slot/declare_class.js | 1 + .../internal_slot/declare_class.tree.json | 66 + .../internal_slot/declare_class_static.js | 1 + .../declare_class_static.tree.json | 66 + lib/test/flow/internal_slot/interface.js | 1 + .../flow/internal_slot/interface.tree.json | 64 + .../flow/internal_slot/interface_method.js | 1 + .../internal_slot/interface_method.tree.json | 72 + .../flow/internal_slot/interface_variance.js | 1 + .../interface_variance.tree.json | 78 + lib/test/flow/internal_slot/object.js | 1 + lib/test/flow/internal_slot/object.tree.json | 64 + lib/test/flow/internal_slot/object_method.js | 1 + .../internal_slot/object_method.tree.json | 72 + .../flow/internal_slot/object_optional.js | 1 + .../internal_slot/object_optional.tree.json | 64 + .../flow/internal_slot/object_variance.js | 1 + .../internal_slot/object_variance.tree.json | 70 + ...class_unexpected_identifier_before_body.js | 3 + ...nexpected_identifier_before_body.tree.json | 94 + lib/test/flow/invalid_syntax/migrated_0000.js | 3 + .../invalid_syntax/migrated_0000.tree.json | 83 + lib/test/flow/invalid_syntax/migrated_0001.js | 3 + .../invalid_syntax/migrated_0001.tree.json | 86 + lib/test/flow/invalid_syntax/migrated_0002.js | 3 + .../invalid_syntax/migrated_0002.tree.json | 103 + lib/test/flow/invalid_syntax/migrated_0003.js | 3 + .../invalid_syntax/migrated_0003.tree.json | 90 + lib/test/flow/invalid_syntax/migrated_0004.js | 3 + .../invalid_syntax/migrated_0004.tree.json | 56 + lib/test/flow/invalid_syntax/migrated_0005.js | 1 + .../invalid_syntax/migrated_0005.tree.json | 60 + lib/test/flow/invalid_syntax/migrated_0006.js | 1 + .../invalid_syntax/migrated_0006.tree.json | 111 + lib/test/flow/invalid_syntax/migrated_0007.js | 1 + .../invalid_syntax/migrated_0007.tree.json | 64 + lib/test/flow/invalid_syntax/migrated_0008.js | 1 + .../invalid_syntax/migrated_0008.tree.json | 64 + lib/test/flow/invalid_syntax/migrated_0009.js | 1 + .../invalid_syntax/migrated_0009.tree.json | 45 + lib/test/flow/invalid_syntax/migrated_0010.js | 2 + .../invalid_syntax/migrated_0010.tree.json | 64 + lib/test/flow/invalid_syntax/migrated_0011.js | 2 + .../invalid_syntax/migrated_0011.tree.json | 99 + lib/test/flow/invalid_syntax/migrated_0012.js | 2 + .../invalid_syntax/migrated_0012.tree.json | 103 + lib/test/flow/invalid_syntax/migrated_0013.js | 1 + .../invalid_syntax/migrated_0013.tree.json | 41 + lib/test/flow/invalid_syntax/migrated_0014.js | 1 + .../invalid_syntax/migrated_0014.tree.json | 41 + lib/test/flow/invalid_syntax/migrated_0015.js | 1 + .../invalid_syntax/migrated_0015.tree.json | 36 + lib/test/flow/invalid_syntax/migrated_0016.js | 1 + .../invalid_syntax/migrated_0016.tree.json | 76 + lib/test/flow/invalid_syntax/migrated_0017.js | 1 + .../invalid_syntax/migrated_0017.tree.json | 27 + lib/test/flow/invalid_syntax/migrated_0018.js | 1 + .../invalid_syntax/migrated_0018.tree.json | 84 + .../flow/invalid_syntax/string_newline.js | 2 + .../invalid_syntax/string_newline.tree.json | 62 + lib/test/flow/large_numbers/migrated_0000.js | 1 + .../large_numbers/migrated_0000.tree.json | 21 + lib/test/flow/large_numbers/migrated_0001.js | 1 + .../large_numbers/migrated_0001.tree.json | 21 + lib/test/flow/large_numbers/migrated_0002.js | 1 + .../large_numbers/migrated_0002.tree.json | 21 + lib/test/flow/large_numbers/migrated_0003.js | 1 + .../large_numbers/migrated_0003.tree.json | 21 + lib/test/flow/large_numbers/migrated_0004.js | 1 + .../large_numbers/migrated_0004.tree.json | 21 + .../flow/nullish_coalescing/missing-plugin.js | 1 + .../missing-plugin.tree.json | 42 + lib/test/flow/nullish_coalescing/multiple.js | 1 + .../nullish_coalescing/multiple.options.json | 3 + .../nullish_coalescing/multiple.tree.json | 84 + .../multiple_no_whitespace.js | 1 + .../multiple_no_whitespace.options.json | 3 + .../multiple_no_whitespace.tree.json | 84 + .../flow/nullish_coalescing/precedence_and.js | 1 + .../precedence_and.options.json | 3 + .../precedence_and.tree.json | 50 + .../precedence_and_lhs_no_parens.js | 1 + .../precedence_and_lhs_no_parens.options.json | 3 + .../precedence_and_lhs_no_parens.tree.json | 56 + .../precedence_and_nested_lhs.js | 1 + .../precedence_and_nested_lhs.options.json | 3 + .../precedence_and_nested_lhs.tree.json | 50 + .../precedence_and_nested_rhs.js | 1 + .../precedence_and_nested_rhs.options.json | 3 + .../precedence_and_nested_rhs.tree.json | 50 + .../precedence_and_rhs_no_parens.js | 1 + .../precedence_and_rhs_no_parens.options.json | 3 + .../precedence_and_rhs_no_parens.tree.json | 56 + ...precedence_multiple_on_or_rhs_no_parens.js | 1 + ..._multiple_on_or_rhs_no_parens.options.json | 3 + ...nce_multiple_on_or_rhs_no_parens.tree.json | 70 + .../flow/nullish_coalescing/precedence_or.js | 1 + .../precedence_or.options.json | 3 + .../precedence_or.tree.json | 50 + .../precedence_or_lhs_no_parens.js | 1 + .../precedence_or_lhs_no_parens.options.json | 3 + .../precedence_or_lhs_no_parens.tree.json | 56 + .../precedence_or_no_parens.js | 14 + .../precedence_or_no_parens.options.json | 3 + .../precedence_or_no_parens.tree.json | 81 + .../precedence_or_rhs_no_parens.js | 1 + .../precedence_or_rhs_no_parens.options.json | 3 + .../precedence_or_rhs_no_parens.tree.json | 56 + lib/test/flow/nullish_coalescing/simple.js | 1 + .../nullish_coalescing/simple.options.json | 3 + .../flow/nullish_coalescing/simple.tree.json | 34 + .../flow/numbers/binnumber_word_invalid.js | 1 + .../numbers/binnumber_word_invalid.tree.json | 66 + lib/test/flow/numbers/migrated_0000.js | 1 + lib/test/flow/numbers/migrated_0000.tree.json | 21 + lib/test/flow/numbers/migrated_0001.js | 1 + lib/test/flow/numbers/migrated_0001.tree.json | 21 + lib/test/flow/numbers/migrated_0002.js | 1 + lib/test/flow/numbers/migrated_0002.tree.json | 21 + .../non_octal_decimal_integer_literal.js | 3 + ...on_octal_decimal_integer_literal.tree.json | 47 + ...on_octal_decimal_integer_literal_strict.js | 4 + ...l_decimal_integer_literal_strict.tree.json | 74 + .../numbers/scientific_leading_decimal.js | 1 + .../scientific_leading_decimal.tree.json | 21 + .../flow/numbers/scientific_leading_zero.js | 1 + .../numbers/scientific_leading_zero.tree.json | 21 + .../scientific_without_fractional_digits.js | 1 + ...ntific_without_fractional_digits.tree.json | 21 + lib/test/flow/numbers/scientific_zero.js | 1 + .../flow/numbers/scientific_zero.tree.json | 21 + lib/test/flow/numbers/underscored_bin.js | 1 + .../flow/numbers/underscored_bin.tree.json | 21 + lib/test/flow/numbers/underscored_float.js | 1 + .../flow/numbers/underscored_float.tree.json | 21 + .../numbers/underscored_float_err_lead.js | 1 + .../underscored_float_err_lead.tree.json | 41 + .../numbers/underscored_float_err_trail.js | 1 + .../underscored_float_err_trail.tree.json | 58 + .../flow/numbers/underscored_float_whole.js | 1 + .../numbers/underscored_float_whole.tree.json | 21 + lib/test/flow/numbers/underscored_hex.js | 1 + .../flow/numbers/underscored_hex.tree.json | 21 + .../flow/numbers/underscored_legacy_octal.js | 3 + .../underscored_legacy_octal.tree.json | 103 + lib/test/flow/numbers/underscored_number.js | 1 + .../flow/numbers/underscored_number.tree.json | 21 + .../numbers/underscored_number_err_double.js | 1 + .../underscored_number_err_double.tree.json | 41 + .../numbers/underscored_number_err_lead.js | 1 + .../underscored_number_err_lead.tree.json | 22 + .../underscored_number_err_leading_zero.js | 1 + ...erscored_number_err_leading_zero.tree.json | 41 + .../numbers/underscored_number_err_trail.js | 1 + .../underscored_number_err_trail.tree.json | 41 + lib/test/flow/numbers/underscored_oct.js | 1 + .../flow/numbers/underscored_oct.tree.json | 21 + .../object-literal-spread/spread_is_first.js | 1 + .../spread_is_first.tree.json | 59 + .../object-literal-spread/spread_is_last.js | 1 + .../spread_is_last.tree.json | 59 + .../spread_is_last_trailing_comma.js | 1 + .../spread_is_last_trailing_comma.tree.json | 59 + .../class-constructor-call.js | 13 + .../class-constructor-call.options.json | 3 + .../class-constructor-call.tree.json | 310 + .../optional_chaining/conditional-decimal.js | 5 + .../conditional-decimal.options.json | 3 + .../conditional-decimal.tree.json | 127 + .../flow/optional_chaining/function-call.js | 17 + .../function-call.options.json | 3 + .../optional_chaining/function-call.tree.json | 506 + .../member-access-bracket.js | 13 + .../member-access-bracket.options.json | 3 + .../member-access-bracket.tree.json | 264 + .../flow/optional_chaining/member-access.js | 7 + .../member-access.options.json | 3 + .../optional_chaining/member-access.tree.json | 153 + .../flow/optional_chaining/missing-plugin.js | 1 + .../missing-plugin.tree.json | 43 + .../optional-chain-expression.js | 1 + .../optional-chain-expression.options.json | 3 + .../optional-chain-expression.tree.json | 58 + .../optional_chaining/parenthesized-chain.js | 9 + .../parenthesized-chain.options.json | 3 + .../parenthesized-chain.tree.json | 372 + .../optional_chaining/separated-chaining.js | 3 + .../separated-chaining.options.json | 3 + .../separated-chaining.tree.json | 184 + .../optional_chaining/template-literals.js | 7 + .../template-literals.options.json | 3 + .../template-literals.tree.json | 221 + .../private_class_properties/constructor.js | 15 + .../constructor.tree.json | 285 + .../flow/private_class_properties/delete.js | 7 + .../private_class_properties/delete.tree.json | 193 + .../flow/private_class_properties/getter.js | 3 + .../private_class_properties/getter.tree.json | 74 + .../getter_and_field.js | 4 + .../getter_and_field.tree.json | 97 + .../getter_and_setter.js | 4 + .../getter_and_setter.tree.json | 124 + .../getter_duplicate.js | 4 + .../getter_duplicate.tree.json | 121 + .../getter_whitespace.js | 3 + .../getter_whitespace.tree.json | 80 + .../flow/private_class_properties/member.js | 8 + .../private_class_properties/member.tree.json | 215 + .../member_whitespace.js | 6 + .../member_whitespace.tree.json | 123 + .../flow/private_class_properties/multiple.js | 6 + .../multiple.tree.json | 160 + .../flow/private_class_properties/nested.js | 3 + .../private_class_properties/nested.tree.json | 103 + .../private_class_properties/object_type.js | 3 + .../object_type.tree.json | 71 + .../flow/private_class_properties/scope.js | 45 + .../private_class_properties/scope.tree.json | 1252 ++ .../flow/private_class_properties/setter.js | 3 + .../private_class_properties/setter.tree.json | 83 + .../setter_and_field.js | 4 + .../setter_and_field.tree.json | 106 + .../setter_duplicate.js | 4 + .../setter_duplicate.tree.json | 139 + .../flow/private_class_properties/super.js | 6 + .../private_class_properties/super.tree.json | 139 + .../private_class_properties/unannotated.js | 3 + .../unannotated.tree.json | 50 + .../unannotated_asi.js | 4 + .../unannotated_asi.tree.json | 67 + .../flow/private_class_properties/valid.js | 5 + .../private_class_properties/valid.tree.json | 112 + .../private_class_properties/whitespace.js | 3 + .../whitespace.tree.json | 56 + .../statement/if/declare_in_consequent.js | 1 + .../if/declare_in_consequent.tree.json | 48 + .../flow/statement/labelled/label_declare.js | 1 + .../labelled/label_declare.tree.json | 34 + lib/test/flow/statement/labelled/label_of.js | 1 + .../statement/labelled/label_of.tree.json | 34 + .../flow/statement/labelled/label_type.js | 1 + .../statement/labelled/label_type.tree.json | 34 + .../labelled/statement_with_parens.js | 1 + .../labelled/statement_with_parens.tree.json | 34 + .../labelled/statement_with_parens_no_semi.js | 1 + .../statement_with_parens_no_semi.tree.json | 34 + .../return/expression_with_parens.js | 1 + .../return/expression_with_parens.tree.json | 46 + .../return/expression_with_parens_no_semi.js | 1 + .../expression_with_parens_no_semi.tree.json | 46 + .../statement/throw/expression_with_parens.js | 1 + .../throw/expression_with_parens.tree.json | 20 + .../throw/expression_with_parens_no_semi.js | 1 + .../expression_with_parens_no_semi.tree.json | 20 + .../variable/const_ends_with_paren.js | 1 + .../variable/const_ends_with_paren.tree.json | 50 + .../variable/const_ends_with_paren_no_semi.js | 1 + .../const_ends_with_paren_no_semi.tree.json | 50 + .../statement/variable/let_ends_with_paren.js | 1 + .../variable/let_ends_with_paren.tree.json | 50 + .../variable/let_ends_with_paren_no_semi.js | 1 + .../let_ends_with_paren_no_semi.tree.json | 50 + .../statement/variable/var_ends_with_paren.js | 1 + .../variable/var_ends_with_paren.tree.json | 50 + .../variable/var_ends_with_paren_no_semi.js | 1 + .../var_ends_with_paren_no_semi.tree.json | 50 + .../statement/variable/var_named_declare.js | 1 + .../variable/var_named_declare.tree.json | 44 + .../flow/statement/variable/var_named_type.js | 1 + .../variable/var_named_type.tree.json | 56 + .../flow/this_param/annotation_required.js | 2 + .../this_param/annotation_required.tree.json | 47 + lib/test/flow/this_param/arrow_function.js | 7 + .../flow/this_param/arrow_function.tree.json | 247 + lib/test/flow/this_param/class_constructor.js | 15 + .../this_param/class_constructor.tree.json | 391 + lib/test/flow/this_param/class_method.js | 9 + .../flow/this_param/class_method.tree.json | 363 + lib/test/flow/this_param/declare_class.js | 9 + .../flow/this_param/declare_class.tree.json | 328 + lib/test/flow/this_param/declare_function.js | 7 + .../this_param/declare_function.tree.json | 296 + .../flow/this_param/function_declaration.js | 7 + .../this_param/function_declaration.tree.json | 298 + .../flow/this_param/function_expression.js | 7 + .../this_param/function_expression.tree.json | 322 + lib/test/flow/this_param/function_type.js | 7 + .../flow/this_param/function_type.tree.json | 280 + .../this_param/function_type_no_annotation.js | 3 + .../function_type_no_annotation.tree.json | 115 + .../flow/this_param/getters_and_setters.js | 4 + .../this_param/getters_and_setters.tree.json | 149 + lib/test/flow/this_param/must_be_first.js | 1 + .../flow/this_param/must_be_first.tree.json | 79 + .../this_param/no_shorthand_arrow_function.js | 1 + .../no_shorthand_arrow_function.tree.json | 44 + .../flow/this_param/not_an_arrow_function.js | 5 + .../not_an_arrow_function.tree.json | 119 + lib/test/flow/this_param/object_method.js | 9 + .../flow/this_param/object_method.tree.json | 351 + .../flow/trailing_commas/migrated_0000.js | 1 + .../trailing_commas/migrated_0000.tree.json | 67 + .../flow/trailing_commas/migrated_0001.js | 1 + .../trailing_commas/migrated_0001.tree.json | 93 + .../flow/trailing_commas/migrated_0002.js | 1 + .../trailing_commas/migrated_0002.tree.json | 79 + .../flow/trailing_commas/migrated_0003.js | 1 + .../trailing_commas/migrated_0003.tree.json | 86 + .../flow/trailing_commas/migrated_0004.js | 1 + .../trailing_commas/migrated_0004.tree.json | 58 + .../flow/trailing_commas/migrated_0005.js | 1 + .../trailing_commas/migrated_0005.tree.json | 90 + .../flow/trailing_commas/migrated_0006.js | 1 + .../trailing_commas/migrated_0006.tree.json | 61 + .../flow/trailing_commas/migrated_0007.js | 1 + .../trailing_commas/migrated_0007.tree.json | 50 + .../flow/trailing_commas/migrated_0008.js | 1 + .../trailing_commas/migrated_0008.tree.json | 57 + .../flow/trailing_commas/migrated_0009.js | 1 + .../trailing_commas/migrated_0009.tree.json | 63 + .../flow/trailing_commas/migrated_0010.js | 1 + .../trailing_commas/migrated_0010.tree.json | 70 + .../trailing_commas_invalid/migrated_0000.js | 1 + .../migrated_0000.tree.json | 66 + .../trailing_commas_invalid/migrated_0001.js | 1 + .../migrated_0001.tree.json | 125 + .../trailing_commas_invalid/migrated_0002.js | 1 + .../migrated_0002.tree.json | 139 + .../trailing_commas_invalid/migrated_0003.js | 1 + .../migrated_0003.tree.json | 153 + .../typeapp_call/disabled_ambiguous_call.js | 1 + .../disabled_ambiguous_call.options.json | 3 + .../disabled_ambiguous_call.tree.json | 50 + .../typeapp_call/disabled_ambiguous_new.js | 1 + .../disabled_ambiguous_new.options.json | 3 + .../disabled_ambiguous_new.tree.json | 56 + lib/test/flow/typeapp_call/function_call.js | 1 + .../flow/typeapp_call/function_call.tree.json | 49 + .../flow/typeapp_call/function_call_chain.js | 1 + .../function_call_chain.tree.json | 94 + .../typeapp_call/function_call_optional.js | 1 + .../function_call_optional.options.json | 3 + .../function_call_optional.tree.json | 59 + lib/test/flow/typeapp_call/method_call.js | 1 + .../flow/typeapp_call/method_call.tree.json | 63 + .../flow/typeapp_call/method_call_computed.js | 1 + .../method_call_computed.tree.json | 63 + .../flow/typeapp_call/method_call_optional.js | 1 + .../method_call_optional.options.json | 3 + .../method_call_optional.tree.json | 74 + .../typeapp_call/method_call_optional2.js | 1 + .../method_call_optional2.options.json | 3 + .../method_call_optional2.tree.json | 73 + lib/test/flow/typeapp_call/new.js | 1 + lib/test/flow/typeapp_call/new.tree.json | 49 + lib/test/flow/typeapp_call/new_noparens.js | 1 + .../flow/typeapp_call/new_noparens.tree.json | 49 + .../flow/typeapp_call/rollback_computed.js | 1 + .../typeapp_call/rollback_computed.tree.json | 57 + lib/test/flow/typeapp_call/rollback_dot.js | 1 + .../flow/typeapp_call/rollback_dot.tree.json | 49 + lib/test/flow/typeapp_call/rollback_jsx.js | 1 + .../flow/typeapp_call/rollback_jsx.tree.json | 72 + .../flow/types/aliases/alias_with_parens.js | 1 + .../types/aliases/alias_with_parens.tree.json | 27 + .../aliases/alias_with_parens_no_semi.js | 1 + .../alias_with_parens_no_semi.tree.json | 27 + lib/test/flow/types/aliases/keyword.js | 1 + lib/test/flow/types/aliases/keyword.tree.json | 67 + .../aliases/line_separator_after_type.js | 2 + .../line_separator_after_type.tree.json | 48 + lib/test/flow/types/aliases/migrated_0000.js | 1 + .../types/aliases/migrated_0000.tree.json | 27 + lib/test/flow/types/aliases/migrated_0001.js | 1 + .../types/aliases/migrated_0001.tree.json | 27 + lib/test/flow/types/aliases/migrated_0002.js | 1 + .../types/aliases/migrated_0002.tree.json | 71 + lib/test/flow/types/aliases/migrated_0003.js | 1 + .../types/aliases/migrated_0003.tree.json | 71 + lib/test/flow/types/aliases/migrated_0004.js | 1 + .../types/aliases/migrated_0004.tree.json | 95 + lib/test/flow/types/aliases/reserved_type.js | 1 + .../types/aliases/reserved_type.tree.json | 33 + ...licit_inexact_disallowed_in_non_objects.js | 39 + ...nexact_disallowed_in_non_objects.tree.json | 448 + .../explicit_inexact_forbidden_in_exact.js | 1 + ...licit_inexact_forbidden_in_exact.tree.json | 64 + .../explicit_inexact_must_appear_last.js | 1 + ...xplicit_inexact_must_appear_last.tree.json | 64 + .../annotations/explicit_inexact_object.js | 3 + .../explicit_inexact_object.tree.json | 171 + .../explicit_inexact_object_invalid.js | 3 + .../explicit_inexact_object_invalid.tree.json | 215 + .../explicit_inexact_trailing_comma.js | 10 + .../explicit_inexact_trailing_comma.tree.json | 158 + .../flow/types/annotations/migrated_0000.js | 1 + .../types/annotations/migrated_0000.tree.json | 69 + .../flow/types/annotations/migrated_0001.js | 1 + .../types/annotations/migrated_0001.tree.json | 87 + .../flow/types/annotations/migrated_0002.js | 1 + .../types/annotations/migrated_0002.tree.json | 69 + .../flow/types/annotations/migrated_0003.js | 1 + .../types/annotations/migrated_0003.tree.json | 60 + .../flow/types/annotations/migrated_0004.js | 1 + .../types/annotations/migrated_0004.tree.json | 60 + .../flow/types/annotations/migrated_0005.js | 1 + .../types/annotations/migrated_0005.tree.json | 57 + .../flow/types/annotations/migrated_0006.js | 1 + .../types/annotations/migrated_0006.tree.json | 60 + .../flow/types/annotations/migrated_0007.js | 1 + .../types/annotations/migrated_0007.tree.json | 60 + .../flow/types/annotations/migrated_0008.js | 1 + .../types/annotations/migrated_0008.tree.json | 80 + .../flow/types/annotations/migrated_0009.js | 1 + .../types/annotations/migrated_0009.tree.json | 99 + .../flow/types/annotations/migrated_0010.js | 1 + .../types/annotations/migrated_0010.tree.json | 43 + .../flow/types/annotations/migrated_0011.js | 1 + .../types/annotations/migrated_0011.tree.json | 51 + .../flow/types/annotations/migrated_0012.js | 1 + .../types/annotations/migrated_0012.tree.json | 71 + .../flow/types/annotations/migrated_0013.js | 1 + .../types/annotations/migrated_0013.tree.json | 49 + .../flow/types/annotations/migrated_0014.js | 1 + .../types/annotations/migrated_0014.tree.json | 49 + .../flow/types/annotations/migrated_0015.js | 1 + .../types/annotations/migrated_0015.tree.json | 58 + .../flow/types/annotations/migrated_0016.js | 1 + .../types/annotations/migrated_0016.tree.json | 77 + .../flow/types/annotations/migrated_0017.js | 1 + .../types/annotations/migrated_0017.tree.json | 71 + .../flow/types/annotations/migrated_0018.js | 1 + .../types/annotations/migrated_0018.tree.json | 89 + .../flow/types/annotations/migrated_0019.js | 1 + .../types/annotations/migrated_0019.tree.json | 39 + .../flow/types/annotations/migrated_0020.js | 1 + .../types/annotations/migrated_0020.tree.json | 46 + .../flow/types/annotations/migrated_0021.js | 1 + .../types/annotations/migrated_0021.tree.json | 75 + .../flow/types/annotations/migrated_0022.js | 1 + .../types/annotations/migrated_0022.tree.json | 70 + .../flow/types/annotations/migrated_0023.js | 1 + .../types/annotations/migrated_0023.tree.json | 96 + .../flow/types/annotations/migrated_0024.js | 1 + .../types/annotations/migrated_0024.tree.json | 96 + .../flow/types/annotations/migrated_0025.js | 1 + .../types/annotations/migrated_0025.tree.json | 101 + .../flow/types/annotations/migrated_0026.js | 1 + .../types/annotations/migrated_0026.tree.json | 94 + .../flow/types/annotations/migrated_0027.js | 1 + .../types/annotations/migrated_0027.tree.json | 94 + .../flow/types/annotations/migrated_0030.js | 1 + .../types/annotations/migrated_0030.tree.json | 116 + .../flow/types/annotations/migrated_0031.js | 1 + .../types/annotations/migrated_0031.tree.json | 78 + .../flow/types/annotations/migrated_0032.js | 1 + .../types/annotations/migrated_0032.tree.json | 98 + .../flow/types/annotations/migrated_0033.js | 1 + .../types/annotations/migrated_0033.tree.json | 130 + .../flow/types/annotations/migrated_0034.js | 1 + .../types/annotations/migrated_0034.tree.json | 94 + .../flow/types/annotations/migrated_0035.js | 1 + .../types/annotations/migrated_0035.tree.json | 104 + .../flow/types/annotations/migrated_0036.js | 1 + .../types/annotations/migrated_0036.tree.json | 84 + .../flow/types/annotations/migrated_0037.js | 1 + .../types/annotations/migrated_0037.tree.json | 84 + .../flow/types/annotations/migrated_0038.js | 1 + .../types/annotations/migrated_0038.tree.json | 104 + .../flow/types/annotations/migrated_0039.js | 1 + .../types/annotations/migrated_0039.tree.json | 85 + .../flow/types/annotations/migrated_0040.js | 1 + .../types/annotations/migrated_0040.tree.json | 93 + .../flow/types/annotations/migrated_0041.js | 1 + .../types/annotations/migrated_0041.tree.json | 86 + .../flow/types/annotations/migrated_0042.js | 1 + .../types/annotations/migrated_0042.tree.json | 51 + .../flow/types/annotations/migrated_0043.js | 1 + .../types/annotations/migrated_0043.tree.json | 63 + .../flow/types/annotations/migrated_0044.js | 1 + .../types/annotations/migrated_0044.tree.json | 87 + .../flow/types/annotations/migrated_0045.js | 1 + .../types/annotations/migrated_0045.tree.json | 67 + .../flow/types/annotations/migrated_0046.js | 1 + .../types/annotations/migrated_0046.tree.json | 47 + .../flow/types/annotations/migrated_0047.js | 1 + .../types/annotations/migrated_0047.tree.json | 121 + .../flow/types/annotations/migrated_0048.js | 1 + .../types/annotations/migrated_0048.tree.json | 83 + .../flow/types/annotations/migrated_0049.js | 1 + .../types/annotations/migrated_0049.tree.json | 87 + .../flow/types/annotations/migrated_0050.js | 1 + .../types/annotations/migrated_0050.tree.json | 60 + .../flow/types/annotations/migrated_0051.js | 1 + .../types/annotations/migrated_0051.tree.json | 59 + .../flow/types/annotations/migrated_0052.js | 1 + .../types/annotations/migrated_0052.tree.json | 59 + .../flow/types/annotations/migrated_0053.js | 1 + .../types/annotations/migrated_0053.tree.json | 60 + .../flow/types/annotations/migrated_0054.js | 1 + .../types/annotations/migrated_0054.tree.json | 72 + .../flow/types/annotations/migrated_0055.js | 1 + .../types/annotations/migrated_0055.tree.json | 74 + .../flow/types/annotations/migrated_0056.js | 1 + .../types/annotations/migrated_0056.tree.json | 94 + .../flow/types/annotations/migrated_0057.js | 1 + .../types/annotations/migrated_0057.tree.json | 66 + .../flow/types/annotations/migrated_0058.js | 1 + .../types/annotations/migrated_0058.tree.json | 125 + .../flow/types/annotations/migrated_0059.js | 1 + .../types/annotations/migrated_0059.tree.json | 80 + .../flow/types/annotations/migrated_0060.js | 1 + .../types/annotations/migrated_0060.tree.json | 108 + .../flow/types/annotations/migrated_0061.js | 1 + .../types/annotations/migrated_0061.tree.json | 80 + .../flow/types/annotations/migrated_0062.js | 1 + .../types/annotations/migrated_0062.tree.json | 57 + .../flow/types/annotations/migrated_0063.js | 1 + .../types/annotations/migrated_0063.tree.json | 198 + .../flow/types/annotations/migrated_0064.js | 1 + .../types/annotations/migrated_0064.tree.json | 74 + .../flow/types/annotations/migrated_0065.js | 1 + .../types/annotations/migrated_0065.tree.json | 60 + .../flow/types/annotations/migrated_0066.js | 1 + .../types/annotations/migrated_0066.tree.json | 72 + .../flow/types/annotations/migrated_0067.js | 1 + .../types/annotations/migrated_0067.tree.json | 57 + .../flow/types/annotations/migrated_0068.js | 1 + .../types/annotations/migrated_0068.tree.json | 198 + .../flow/types/annotations/migrated_0069.js | 1 + .../types/annotations/migrated_0069.tree.json | 74 + .../flow/types/annotations/migrated_0070.js | 1 + .../types/annotations/migrated_0070.tree.json | 72 + .../flow/types/annotations/migrated_0071.js | 1 + .../types/annotations/migrated_0071.tree.json | 100 + .../flow/types/annotations/migrated_0072.js | 1 + .../types/annotations/migrated_0072.tree.json | 124 + .../flow/types/annotations/migrated_0073.js | 1 + .../types/annotations/migrated_0073.tree.json | 71 + .../flow/types/annotations/migrated_0074.js | 1 + .../types/annotations/migrated_0074.tree.json | 60 + .../flow/types/annotations/migrated_0075.js | 1 + .../types/annotations/migrated_0075.tree.json | 97 + .../flow/types/annotations/migrated_0076.js | 1 + .../types/annotations/migrated_0076.tree.json | 57 + .../flow/types/annotations/migrated_0077.js | 1 + .../types/annotations/migrated_0077.tree.json | 58 + .../flow/types/annotations/migrated_0078.js | 1 + .../types/annotations/migrated_0078.tree.json | 47 + .../flow/types/annotations/migrated_0079.js | 1 + .../types/annotations/migrated_0079.tree.json | 70 + .../annotations/static_is_reserved_param.js | 1 + .../static_is_reserved_param.tree.json | 61 + .../annotations/static_is_reserved_type.js | 1 + .../static_is_reserved_type.tree.json | 42 + lib/test/flow/types/annotations/symbol.js | 1 + .../flow/types/annotations/symbol.tree.json | 30 + .../underscore_is_allowed_trailing_commas.js | 7 + ...score_is_allowed_trailing_commas.tree.json | 96 + ...underscore_is_implicit_anywhere_in_list.js | 1 + ...ore_is_implicit_anywhere_in_list.tree.json | 143 + .../underscore_is_implicit_in_calls.js | 1 + .../underscore_is_implicit_in_calls.tree.json | 49 + ...rscore_is_implicit_in_constructor_calls.js | 1 + ...is_implicit_in_constructor_calls.tree.json | 49 + .../underscore_is_implicit_in_methods.js | 1 + ...nderscore_is_implicit_in_methods.tree.json | 70 + .../underscore_is_reserved_elsewhere.js | 7 + ...underscore_is_reserved_elsewhere.tree.json | 281 + .../annotations/unfinished_colon_method.js | 1 + .../unfinished_colon_method.tree.json | 129 + .../annotations/unfinished_colon_param.js | 1 + .../unfinished_colon_param.tree.json | 58 + .../annotations/unfinished_colon_return.js | 1 + .../unfinished_colon_return.tree.json | 100 + .../annotations/unfinished_function_body.js | 1 + .../unfinished_function_body.tree.json | 59 + .../annotations/void_is_reserved_param.js | 1 + .../void_is_reserved_param.tree.json | 61 + .../annotations_in_comments/migrated_0000.js | 1 + .../migrated_0000.tree.json | 69 + .../annotations_in_comments/migrated_0001.js | 1 + .../migrated_0001.tree.json | 87 + .../annotations_in_comments/migrated_0002.js | 1 + .../migrated_0002.tree.json | 69 + .../annotations_in_comments/migrated_0003.js | 1 + .../migrated_0003.tree.json | 60 + .../annotations_in_comments/migrated_0004.js | 1 + .../migrated_0004.tree.json | 60 + .../annotations_in_comments/migrated_0005.js | 1 + .../migrated_0005.tree.json | 57 + .../annotations_in_comments/migrated_0006.js | 1 + .../migrated_0006.tree.json | 60 + .../annotations_in_comments/migrated_0007.js | 1 + .../migrated_0007.tree.json | 60 + .../annotations_in_comments/migrated_0008.js | 1 + .../migrated_0008.tree.json | 80 + .../annotations_in_comments/migrated_0009.js | 1 + .../migrated_0009.tree.json | 99 + .../annotations_in_comments/migrated_0010.js | 1 + .../migrated_0010.tree.json | 43 + .../annotations_in_comments/migrated_0011.js | 1 + .../migrated_0011.tree.json | 51 + .../annotations_in_comments/migrated_0012.js | 5 + .../migrated_0012.tree.json | 66 + .../annotations_in_comments/migrated_0013.js | 5 + .../migrated_0013.tree.json | 66 + .../annotations_in_comments/migrated_0014.js | 1 + .../migrated_0014.tree.json | 7 + .../annotations_in_comments/migrated_0015.js | 1 + .../migrated_0015.tree.json | 7 + .../annotations_in_comments/migrated_0016.js | 1 + .../migrated_0016.tree.json | 108 + .../annotations_in_comments/migrated_0017.js | 1 + .../migrated_0017.tree.json | 34 + .../annotations_in_comments/migrated_0018.js | 1 + .../migrated_0018.tree.json | 34 + .../annotations_in_comments/migrated_0019.js | 1 + .../migrated_0019.tree.json | 46 + .../migrated_0000.js | 1 + .../migrated_0000.tree.json | 23 + .../migrated_0001.js | 1 + .../migrated_0001.tree.json | 27 + .../migrated_0002.js | 1 + .../migrated_0002.tree.json | 27 + .../migrated_0003.js | 1 + .../migrated_0003.tree.json | 13 + .../migrated_0004.js | 1 + .../migrated_0004.tree.json | 13 + .../migrated_0005.js | 1 + .../migrated_0005.tree.json | 45 + .../migrated_0006.js | 1 + .../migrated_0006.tree.json | 13 + .../migrated_0007.js | 1 + .../migrated_0007.tree.json | 49 + .../migrated_0000.js | 1 + .../migrated_0000.options.json | 3 + .../migrated_0000.tree.json | 50 + .../migrated_0001.js | 1 + .../migrated_0001.options.json | 3 + .../migrated_0001.tree.json | 44 + .../types/bigint_literal/migrated_0000.js | 1 + .../bigint_literal/migrated_0000.tree.json | 41 + .../types/bigint_literal/migrated_0002.js | 1 + .../bigint_literal/migrated_0002.tree.json | 41 + .../types/bigint_literal/migrated_0003.js | 1 + .../bigint_literal/migrated_0003.tree.json | 41 + .../types/bigint_literal/migrated_0004.js | 1 + .../bigint_literal/migrated_0004.tree.json | 41 + .../types/bigint_literal/migrated_0005.js | 1 + .../bigint_literal/migrated_0005.tree.json | 41 + .../types/bigint_literal/migrated_0006.js | 1 + .../bigint_literal/migrated_0006.tree.json | 41 + .../types/bigint_literal/migrated_0007.js | 1 + .../bigint_literal/migrated_0007.tree.json | 41 + .../types/bigint_literal/migrated_0008.js | 1 + .../bigint_literal/migrated_0008.tree.json | 41 + .../types/bigint_literal/migrated_0009.js | 1 + .../bigint_literal/migrated_0009.tree.json | 41 + .../bigint_literal_invalid/migrated_0000.js | 1 + .../migrated_0000.tree.json | 69 + .../bigint_literal_invalid/migrated_0001.js | 1 + .../migrated_0001.tree.json | 47 + .../bigint_literal_invalid/migrated_0002.js | 1 + .../migrated_0002.tree.json | 67 + .../bigint_literal_invalid/migrated_0010.js | 1 + .../migrated_0010.tree.json | 47 + .../types/boolean_literal/migrated_0000.js | 1 + .../boolean_literal/migrated_0000.tree.json | 41 + .../types/boolean_literal/migrated_0001.js | 1 + .../boolean_literal/migrated_0001.tree.json | 41 + .../class_property_variance/migrated_0000.js | 1 + .../migrated_0000.tree.json | 69 + .../class_property_variance/migrated_0001.js | 1 + .../migrated_0001.tree.json | 74 + .../class_property_variance/migrated_0002.js | 1 + .../migrated_0002.tree.json | 74 + .../class_property_variance/migrated_0003.js | 1 + .../migrated_0003.tree.json | 75 + .../class_property_variance/migrated_0004.js | 1 + .../migrated_0004.tree.json | 75 + .../class_property_variance/migrated_0005.js | 1 + .../migrated_0005.tree.json | 75 + .../class_property_variance/migrated_0006.js | 1 + .../migrated_0006.tree.json | 93 + .../class_property_variance/migrated_0007.js | 1 + .../migrated_0007.tree.json | 75 + .../class_property_variance/migrated_0008.js | 1 + .../migrated_0008.tree.json | 93 + .../class_property_variance/migrated_0009.js | 1 + .../migrated_0009.tree.json | 75 + .../class_property_variance/migrated_0010.js | 1 + .../migrated_0010.tree.json | 93 + lib/test/flow/types/declare_class/basic.js | 1 + .../flow/types/declare_class/basic.tree.json | 35 + .../types/declare_class/field_named_static.js | 1 + .../field_named_static.tree.json | 60 + .../flow/types/declare_class/implements.js | 1 + .../types/declare_class/implements.tree.json | 50 + .../declare_class/implements_and_mixins.js | 1 + .../implements_and_mixins.tree.json | 65 + .../declare_class/implements_multiple.js | 1 + .../implements_multiple.tree.json | 64 + .../invalid_quoted_static_modifier.js | 1 + .../invalid_quoted_static_modifier.tree.json | 77 + .../declare_class/method_with_this_return.js | 3 + .../method_with_this_return.tree.json | 78 + lib/test/flow/types/declare_class/mixins.js | 1 + .../flow/types/declare_class/mixins.tree.json | 50 + .../types/declare_class/mixins_multiple.js | 1 + .../declare_class/mixins_multiple.tree.json | 64 + .../types/declare_class/multiple_extends.js | 1 + .../declare_class/multiple_extends.tree.json | 89 + lib/test/flow/types/declare_class/proto.js | 11 + .../flow/types/declare_class/proto.tree.json | 196 + .../flow/types/declare_class/proto_indexer.js | 1 + .../declare_class/proto_indexer.tree.json | 78 + .../flow/types/declare_class/proto_method.js | 1 + .../declare_class/proto_method.tree.json | 74 + .../types/declare_class/static_indexer.js | 1 + .../declare_class/static_indexer.tree.json | 61 + .../flow/types/declare_class/static_method.js | 1 + .../declare_class/static_method.tree.json | 55 + .../flow/types/declare_class/static_proto.js | 1 + .../declare_class/static_proto.tree.json | 106 + .../flow/types/declare_class/truncated0.js | 3 + .../types/declare_class/truncated0.tree.json | 78 + .../flow/types/declare_class/truncated1.js | 3 + .../types/declare_class/truncated1.tree.json | 83 + .../flow/types/declare_class/truncated2.js | 3 + .../types/declare_class/truncated2.tree.json | 83 + .../types/declare_class_properties/basic.js | 4 + .../declare_class_properties/basic.tree.json | 89 + .../declare_class_properties/invalid_async.js | 3 + .../invalid_async.tree.json | 84 + .../invalid_initializer.js | 3 + .../invalid_initializer.tree.json | 84 + .../invalid_missing_annotation.js | 3 + .../invalid_missing_annotation.tree.json | 52 + .../declare_export/batch/migrated_0000.js | 1 + .../batch/migrated_0000.tree.json | 20 + .../declare_export/batch/migrated_0001.js | 1 + .../batch/migrated_0001.tree.json | 20 + .../declare_export/class/migrated_0017.js | 1 + .../class/migrated_0017.tree.json | 43 + .../declare_export/class/migrated_0018.js | 1 + .../class/migrated_0018.tree.json | 118 + .../declare_export/class/migrated_0019.js | 1 + .../class/migrated_0019.tree.json | 100 + .../declare_export/class/migrated_0020.js | 1 + .../class/migrated_0020.tree.json | 69 + .../declare_export/class/migrated_0021.js | 1 + .../class/migrated_0021.tree.json | 63 + .../declare_export_class_prop_named_static.js | 1 + ...e_export_class_prop_named_static.tree.json | 68 + .../default/default_with_parens.js | 1 + .../default/default_with_parens.tree.json | 21 + .../default/default_with_parens_no_semi.js | 1 + .../default_with_parens_no_semi.tree.json | 21 + .../declare_export/default/migrated_0022.js | 1 + .../default/migrated_0022.tree.json | 21 + .../declare_export/default/migrated_0023.js | 1 + .../default/migrated_0023.tree.json | 21 + .../declare_export/default/migrated_0024.js | 1 + .../default/migrated_0024.tree.json | 47 + .../declare_export/default/migrated_0025.js | 1 + .../default/migrated_0025.tree.json | 47 + .../declare_export/default/migrated_0026.js | 1 + .../default/migrated_0026.tree.json | 62 + .../declare_export/default/migrated_0027.js | 1 + .../default/migrated_0027.tree.json | 86 + .../declare_export/default/migrated_0028.js | 1 + .../default/migrated_0028.tree.json | 43 + .../declare_export/default/migrated_0029.js | 1 + .../default/migrated_0029.tree.json | 118 + .../declare_export/default/migrated_0030.js | 1 + .../default/migrated_0030.tree.json | 100 + .../declare_export/default/migrated_0031.js | 1 + .../default/migrated_0031.tree.json | 69 + .../declare_export/default/migrated_0032.js | 1 + .../default/migrated_0032.tree.json | 63 + .../declare_export/function/migrated_0012.js | 1 + .../function/migrated_0012.tree.json | 47 + .../declare_export/function/migrated_0013.js | 1 + .../function/migrated_0013.tree.json | 47 + .../declare_export/function/migrated_0014.js | 1 + .../function/migrated_0014.tree.json | 62 + .../declare_export/function/migrated_0015.js | 1 + .../function/migrated_0015.tree.json | 86 + .../declare_export/function/migrated_0016.js | 1 + .../function/migrated_0016.tree.json | 79 + .../declare_export/named/migrated_0002.js | 1 + .../named/migrated_0002.tree.json | 23 + .../declare_export/named/migrated_0003.js | 1 + .../named/migrated_0003.tree.json | 45 + .../declare_export/named/migrated_0004.js | 1 + .../named/migrated_0004.tree.json | 45 + .../declare_export/named/migrated_0005.js | 1 + .../named/migrated_0005.tree.json | 66 + .../declare_export/named/migrated_0006.js | 1 + .../named/migrated_0006.tree.json | 39 + .../declare_export/named/migrated_0007.js | 1 + .../named/migrated_0007.tree.json | 39 + .../declare_export/named/migrated_0008.js | 1 + .../named/migrated_0008.tree.json | 60 + .../types/declare_export/var/migrated_0009.js | 1 + .../var/migrated_0009.tree.json | 29 + .../types/declare_export/var/migrated_0010.js | 1 + .../var/migrated_0010.tree.json | 29 + .../types/declare_export/var/migrated_0011.js | 1 + .../var/migrated_0011.tree.json | 38 + .../export_non_default_type.js | 2 + .../export_non_default_type.tree.json | 60 + .../export_type/migrated_0000.js | 1 + .../export_type/migrated_0000.tree.json | 136 + .../export_type/migrated_0001.js | 1 + .../export_type/migrated_0001.tree.json | 99 + .../export_type/migrated_0002.js | 1 + .../export_type/migrated_0002.tree.json | 140 + .../export_type/migrated_0003.js | 1 + .../export_type/migrated_0003.tree.json | 165 + .../export_type/migrated_0004.js | 1 + .../export_type/migrated_0004.tree.json | 198 + .../export_type/migrated_0005.js | 1 + .../export_type/migrated_0005.tree.json | 107 + .../export_type/migrated_0006.js | 1 + .../export_type/migrated_0006.tree.json | 111 + .../export_type/migrated_0007.js | 1 + .../export_type/migrated_0007.tree.json | 227 + .../export_type/migrated_0008.js | 1 + .../export_type/migrated_0008.tree.json | 136 + .../let_const/migrated_0009.js | 1 + .../let_const/migrated_0009.tree.json | 48 + .../let_const/migrated_0010.js | 1 + .../let_const/migrated_0010.tree.json | 48 + .../declare_export_invalid/migrated_0012.js | 2 + .../migrated_0012.tree.json | 64 + .../declare_export_invalid/migrated_0014.js | 1 + .../migrated_0014.tree.json | 92 + .../types/declare_interface/migrated_0000.js | 1 + .../declare_interface/migrated_0000.tree.json | 33 + .../types/declare_interface/migrated_0001.js | 1 + .../declare_interface/migrated_0001.tree.json | 57 + .../types/declare_interface/migrated_0002.js | 1 + .../declare_interface/migrated_0002.tree.json | 58 + .../types/declare_interface/migrated_0003.js | 1 + .../declare_interface/migrated_0003.tree.json | 48 + .../types/declare_interface/migrated_0004.js | 1 + .../declare_interface/migrated_0004.tree.json | 62 + .../types/declare_interface/migrated_0005.js | 1 + .../declare_interface/migrated_0005.tree.json | 83 + .../types/declare_interface/migrated_0010.js | 1 + .../declare_interface/migrated_0010.tree.json | 89 + .../types/declare_interface/migrated_0011.js | 1 + .../declare_interface/migrated_0011.tree.json | 89 + .../types/declare_module/migrated_0000.js | 1 + .../declare_module/migrated_0000.tree.json | 28 + .../types/declare_module/migrated_0001.js | 1 + .../declare_module/migrated_0001.tree.json | 27 + .../types/declare_module/migrated_0002.js | 1 + .../declare_module/migrated_0002.tree.json | 56 + .../types/declare_module/migrated_0003.js | 2 + .../declare_module/migrated_0003.tree.json | 48 + .../declare_module_exports/migrated_0000.js | 1 + .../migrated_0000.tree.json | 23 + .../declare_module_exports/migrated_0001.js | 1 + .../migrated_0001.tree.json | 43 + .../migrated_0000.js | 1 + .../migrated_0000.tree.json | 33 + .../migrated_0001.js | 1 + .../migrated_0001.tree.json | 64 + .../declare_module_invalid/migrated_0000.js | 1 + .../migrated_0000.tree.json | 70 + .../declare_module_invalid/migrated_0001.js | 1 + .../migrated_0001.tree.json | 42 + .../declare_module_invalid/migrated_0002.js | 1 + .../migrated_0002.tree.json | 62 + .../declare_module_invalid/migrated_0003.js | 1 + .../migrated_0003.tree.json | 118 + .../declare_module_invalid/migrated_0004.js | 1 + .../migrated_0004.tree.json | 79 + .../declare_module_invalid/migrated_0005.js | 1 + .../migrated_0005.tree.json | 61 + .../export_type_with_parens.js | 3 + .../export_type_with_parens.tree.json | 56 + .../export_type_with_parens_no_semi.js | 3 + .../export_type_with_parens_no_semi.tree.json | 56 + .../migrated_0000.js | 1 + .../migrated_0000.tree.json | 40 + .../migrated_0001.js | 1 + .../migrated_0001.tree.json | 65 + .../migrated_0002.js | 1 + .../migrated_0002.tree.json | 59 + .../migrated_0003.js | 1 + .../migrated_0003.tree.json | 58 + .../migrated_0004.js | 1 + .../migrated_0004.tree.json | 87 + .../migrated_0005.js | 1 + .../migrated_0005.tree.json | 116 + .../migrated_0006.js | 1 + .../migrated_0006.tree.json | 55 + .../migrated_0007.js | 1 + .../migrated_0007.tree.json | 85 + .../migrated_0008.js | 1 + .../migrated_0008.tree.json | 70 + .../migrated_0009.js | 1 + .../migrated_0009.tree.json | 61 + .../migrated_0010.js | 1 + .../migrated_0010.tree.json | 91 + .../migrated_0011.js | 1 + .../migrated_0011.tree.json | 76 + .../declare_class_prop_named_static.js | 1 + .../declare_class_prop_named_static.tree.json | 60 + .../types/declare_statements/migrated_0000.js | 1 + .../migrated_0000.tree.json | 21 + .../types/declare_statements/migrated_0001.js | 1 + .../migrated_0001.tree.json | 21 + .../types/declare_statements/migrated_0002.js | 1 + .../migrated_0002.tree.json | 39 + .../types/declare_statements/migrated_0003.js | 1 + .../migrated_0003.tree.json | 39 + .../types/declare_statements/migrated_0004.js | 1 + .../migrated_0004.tree.json | 78 + .../types/declare_statements/migrated_0005.js | 2 + .../migrated_0005.tree.json | 78 + .../types/declare_statements/migrated_0006.js | 1 + .../migrated_0006.tree.json | 35 + .../types/declare_statements/migrated_0007.js | 1 + .../migrated_0007.tree.json | 110 + .../types/declare_statements/migrated_0008.js | 1 + .../migrated_0008.tree.json | 92 + .../types/declare_statements/migrated_0009.js | 1 + .../migrated_0009.tree.json | 55 + .../types/declare_statements/migrated_0010.js | 1 + .../migrated_0010.tree.json | 61 + .../types/declare_statements/migrated_0011.js | 1 + .../migrated_0011.tree.json | 68 + .../types/declare_statements/migrated_0012.js | 1 + .../migrated_0012.tree.json | 88 + .../types/declare_statements/migrated_0013.js | 1 + .../migrated_0013.tree.json | 120 + .../migrated_0000.js | 2 + .../migrated_0000.tree.json | 56 + .../migrated_0002.js | 1 + .../migrated_0002.tree.json | 84 + .../flow/types/declare_type_alias/basic.js | 1 + .../types/declare_type_alias/basic.tree.json | 27 + .../flow/types/exact_objects/migrated_0000.js | 1 + .../exact_objects/migrated_0000.tree.json | 101 + .../flow/types/exact_objects/migrated_0001.js | 1 + .../exact_objects/migrated_0001.tree.json | 101 + .../function_predicates/migrated_0000.js | 1 + .../migrated_0000.tree.json | 84 + .../function_predicates/migrated_0001.js | 1 + .../migrated_0001.tree.json | 84 + .../function_predicates/migrated_0002.js | 1 + .../migrated_0002.tree.json | 83 + .../function_predicates/migrated_0003.js | 1 + .../migrated_0003.tree.json | 85 + .../function_predicates/migrated_0004.js | 1 + .../migrated_0004.tree.json | 61 + .../function_predicates/migrated_0005.js | 1 + .../migrated_0005.tree.json | 133 + .../function_predicates/migrated_0006.js | 1 + .../migrated_0006.tree.json | 158 + .../inside_generics.js | 1 + .../inside_generics.tree.json | 68 + .../inside_generics_inside_return.js | 1 + .../inside_generics_inside_return.tree.json | 98 + .../invalid_some_named_some_anonymous.js | 1 + ...nvalid_some_named_some_anonymous.tree.json | 61 + .../migrated_0000.js | 1 + .../migrated_0000.tree.json | 48 + .../migrated_0001.js | 1 + .../migrated_0001.tree.json | 48 + .../migrated_0002.js | 1 + .../migrated_0002.tree.json | 68 + .../migrated_0003.js | 1 + .../migrated_0003.tree.json | 68 + .../migrated_0004.js | 1 + .../migrated_0004.tree.json | 67 + .../migrated_0005.js | 1 + .../migrated_0005.tree.json | 66 + .../migrated_0006.js | 1 + .../migrated_0006.tree.json | 99 + .../migrated_0007.js | 2 + .../migrated_0007.tree.json | 104 + .../migrated_0008.js | 3 + .../migrated_0008.tree.json | 71 + .../migrated_0009.js | 1 + .../migrated_0009.tree.json | 70 + .../migrated_0010.js | 3 + .../migrated_0010.tree.json | 103 + .../migrated_0011.js | 2 + .../migrated_0011.tree.json | 97 + .../migrated_0012.js | 2 + .../migrated_0012.tree.json | 109 + .../migrated_0013.js | 2 + .../migrated_0013.tree.json | 102 + .../migrated_0014.js | 1 + .../migrated_0014.tree.json | 48 + .../migrated_0015.js | 1 + .../migrated_0015.tree.json | 68 + .../migrated_0016.js | 3 + .../migrated_0016.tree.json | 71 + .../migrated_0017.js | 3 + .../migrated_0017.tree.json | 83 + .../migrated_0018.js | 3 + .../migrated_0018.tree.json | 103 + .../migrated_0019.js | 2 + .../migrated_0019.tree.json | 67 + .../migrated_0020.js | 2 + .../migrated_0020.tree.json | 67 + .../migrated_0021.js | 2 + .../migrated_0021.tree.json | 60 + .../migrated_0022.js | 2 + .../migrated_0022.tree.json | 60 + .../migrated_0023.js | 1 + .../migrated_0023.tree.json | 69 + .../migrated_0024.js | 2 + .../migrated_0024.tree.json | 67 + .../migrated_0025.js | 2 + .../migrated_0025.tree.json | 76 + .../migrated_0026.js | 2 + .../migrated_0026.tree.json | 97 + .../migrated_0027.js | 2 + .../migrated_0027.tree.json | 109 + .../some_named_some_anonymous.js | 1 + .../some_named_some_anonymous.tree.json | 67 + lib/test/flow/types/grouping/function.js | 1 + .../flow/types/grouping/function.tree.json | 66 + .../flow/types/grouping/function_param.js | 1 + .../types/grouping/function_param.tree.json | 73 + lib/test/flow/types/grouping/intersection.js | 1 + .../types/grouping/intersection.tree.json | 57 + .../types/grouping/intersection_of_union.js | 1 + .../grouping/intersection_of_union.tree.json | 63 + lib/test/flow/types/grouping/method.js | 3 + lib/test/flow/types/grouping/method.tree.json | 75 + lib/test/flow/types/grouping/migrated_0000.js | 1 + .../types/grouping/migrated_0000.tree.json | 39 + lib/test/flow/types/grouping/migrated_0001.js | 1 + .../types/grouping/migrated_0001.tree.json | 67 + lib/test/flow/types/grouping/migrated_0003.js | 1 + .../types/grouping/migrated_0003.tree.json | 53 + lib/test/flow/types/grouping/migrated_0004.js | 1 + .../types/grouping/migrated_0004.tree.json | 59 + lib/test/flow/types/grouping/migrated_0005.js | 1 + .../types/grouping/migrated_0005.tree.json | 45 + lib/test/flow/types/grouping/migrated_0006.js | 1 + .../types/grouping/migrated_0006.tree.json | 107 + lib/test/flow/types/grouping/nullable.js | 1 + .../flow/types/grouping/nullable.tree.json | 46 + .../grouping/object_type_call_property.js | 3 + .../object_type_call_property.tree.json | 62 + .../types/grouping/object_type_indexer.js | 3 + .../grouping/object_type_indexer.tree.json | 70 + .../types/grouping/object_type_property.js | 3 + .../grouping/object_type_property.tree.json | 67 + .../grouping/object_type_spread_property.js | 3 + .../object_type_spread_property.tree.json | 53 + lib/test/flow/types/grouping/typeof.js | 1 + lib/test/flow/types/grouping/typeof.tree.json | 41 + lib/test/flow/types/grouping/union.js | 1 + lib/test/flow/types/grouping/union.tree.json | 57 + .../types/grouping_invalid/migrated_0000.js | 1 + .../grouping_invalid/migrated_0000.tree.json | 138 + .../import_type_shorthand/migrated_0000.js | 1 + .../migrated_0000.tree.json | 45 + .../import_type_shorthand/migrated_0001.js | 1 + .../migrated_0001.tree.json | 45 + .../import_type_shorthand/migrated_0002.js | 1 + .../migrated_0002.tree.json | 45 + .../import_type_shorthand/migrated_0003.js | 1 + .../migrated_0003.tree.json | 45 + .../import_type_shorthand/migrated_0004.js | 1 + .../migrated_0004.tree.json | 45 + .../import_type_shorthand/migrated_0005.js | 1 + .../migrated_0005.tree.json | 45 + .../import_type_shorthand/migrated_0006.js | 1 + .../migrated_0006.tree.json | 45 + .../import_type_shorthand/migrated_0007.js | 1 + .../migrated_0007.tree.json | 145 + .../import_type_shorthand/migrated_0008.js | 1 + .../migrated_0008.tree.json | 51 + .../import_type_shorthand/migrated_0009.js | 1 + .../migrated_0009.tree.json | 51 + .../import_type_shorthand/reserved_type.js | 2 + .../reserved_type.tree.json | 58 + .../types/import_type_shorthand/type_as_as.js | 2 + .../type_as_as.tree.json | 52 + .../import_type_shorthand/typeof_in_typeof.js | 1 + .../typeof_in_typeof.tree.json | 51 + .../typeof_in_typeof_reserved_type.js | 2 + .../typeof_in_typeof_reserved_type.tree.json | 62 + .../typeof_in_typeof_reserved_value.js | 2 + .../typeof_in_typeof_reserved_value.tree.json | 58 + .../typeof_reserved_type.js | 2 + .../typeof_reserved_type.tree.json | 58 + .../typeof_reserved_value.js | 2 + .../typeof_reserved_value.tree.json | 52 + .../import_types/default_reserved_type.js | 2 + .../default_reserved_type.tree.json | 49 + .../import_types/default_reserved_value.js | 2 + .../default_reserved_value.tree.json | 43 + .../flow/types/import_types/migrated_0000.js | 1 + .../import_types/migrated_0000.tree.json | 46 + .../types/import_types/named_reserved_type.js | 2 + .../named_reserved_type.tree.json | 58 + .../import_types/named_reserved_value.js | 2 + .../named_reserved_value.tree.json | 52 + lib/test/flow/types/import_types/namespace.js | 1 + .../types/import_types/namespace.tree.json | 42 + .../import_types/namespace_reserved_type.js | 2 + .../namespace_reserved_type.tree.json | 53 + .../import_types/namespace_reserved_value.js | 2 + .../namespace_reserved_value.tree.json | 49 + .../typeof_default_reserved_type.js | 2 + .../typeof_default_reserved_type.tree.json | 49 + .../typeof_named_reserved_type.js | 2 + .../typeof_named_reserved_type.tree.json | 58 + .../typeof_named_reserved_type_alias.js | 2 + ...typeof_named_reserved_type_alias.tree.json | 52 + .../typeof_namespace_reserved_type.js | 2 + .../typeof_namespace_reserved_type.tree.json | 49 + .../instance_spread_invalid/migrated_0000.js | 1 + .../migrated_0000.tree.json | 39 + .../instance_spread_invalid/migrated_0001.js | 1 + .../migrated_0001.tree.json | 41 + .../interfaces/implements_reserved_type.js | 2 + .../implements_reserved_type.tree.json | 60 + .../interfaces/implements_reserved_value.js | 2 + .../implements_reserved_value.tree.json | 54 + lib/test/flow/types/interfaces/inline.js | 4 + .../flow/types/interfaces/inline.tree.json | 251 + .../flow/types/interfaces/migrated_0000.js | 1 + .../types/interfaces/migrated_0000.tree.json | 33 + .../flow/types/interfaces/migrated_0001.js | 1 + .../types/interfaces/migrated_0001.tree.json | 57 + .../flow/types/interfaces/migrated_0002.js | 1 + .../types/interfaces/migrated_0002.tree.json | 58 + .../flow/types/interfaces/migrated_0003.js | 1 + .../types/interfaces/migrated_0003.tree.json | 48 + .../flow/types/interfaces/migrated_0004.js | 1 + .../types/interfaces/migrated_0004.tree.json | 62 + .../flow/types/interfaces/migrated_0005.js | 1 + .../types/interfaces/migrated_0005.tree.json | 83 + .../flow/types/interfaces/migrated_0006.js | 1 + .../types/interfaces/migrated_0006.tree.json | 47 + .../flow/types/interfaces/migrated_0007.js | 1 + .../types/interfaces/migrated_0007.tree.json | 79 + .../flow/types/interfaces/migrated_0008.js | 1 + .../types/interfaces/migrated_0008.tree.json | 70 + .../flow/types/interfaces/migrated_0009.js | 1 + .../types/interfaces/migrated_0009.tree.json | 85 + .../flow/types/interfaces/migrated_0010.js | 1 + .../types/interfaces/migrated_0010.tree.json | 89 + .../flow/types/interfaces/migrated_0011.js | 1 + .../types/interfaces/migrated_0011.tree.json | 89 + .../types/interfaces/prop_named_static.js | 5 + .../interfaces/prop_named_static.tree.json | 296 + .../flow/types/interfaces/reserved_type.js | 4 + .../types/interfaces/reserved_type.tree.json | 75 + .../flow/types/interfaces/reserved_value.js | 2 + .../types/interfaces/reserved_value.tree.json | 40 + .../types/invalid_keywords/migrated_0000.js | 1 + .../invalid_keywords/migrated_0000.tree.json | 33 + .../types/invalid_keywords/migrated_0001.js | 1 + .../invalid_keywords/migrated_0001.tree.json | 48 + .../keyword_variable_collision/arguments.js | 1 + .../arguments.tree.json | 27 + .../arguments_strict.js | 2 + .../arguments_strict.tree.json | 40 + .../types/keyword_variable_collision/eval.js | 1 + .../keyword_variable_collision/eval.tree.json | 27 + .../keyword_variable_collision/eval_strict.js | 2 + .../eval_strict.tree.json | 40 + .../opaque_collision.js | 2 + .../opaque_collision.tree.json | 57 + .../opaque_in_exp.js | 2 + .../opaque_in_exp.tree.json | 63 + .../opaque_in_func.js | 1 + .../opaque_in_func.tree.json | 36 + lib/test/flow/types/member/migrated_0000.js | 1 + .../flow/types/member/migrated_0000.tree.json | 61 + lib/test/flow/types/member/migrated_0001.js | 1 + .../flow/types/member/migrated_0001.tree.json | 74 + lib/test/flow/types/member/migrated_0002.js | 1 + .../flow/types/member/migrated_0002.tree.json | 81 + lib/test/flow/types/member/migrated_0003.js | 1 + .../flow/types/member/migrated_0003.tree.json | 86 + lib/test/flow/types/member/reserved_words.js | 1 + .../types/member/reserved_words.tree.json | 61 + .../types/number_literal/migrated_0000.js | 1 + .../number_literal/migrated_0000.tree.json | 41 + .../types/number_literal/migrated_0001.js | 1 + .../number_literal/migrated_0001.tree.json | 41 + .../types/number_literal/migrated_0002.js | 1 + .../number_literal/migrated_0002.tree.json | 41 + .../types/number_literal/migrated_0003.js | 1 + .../number_literal/migrated_0003.tree.json | 41 + .../types/number_literal/migrated_0004.js | 1 + .../number_literal/migrated_0004.tree.json | 41 + .../types/number_literal/migrated_0005.js | 1 + .../number_literal/migrated_0005.tree.json | 41 + .../types/number_literal/migrated_0006.js | 1 + .../number_literal/migrated_0006.tree.json | 41 + .../types/number_literal/migrated_0007.js | 1 + .../number_literal/migrated_0007.tree.json | 41 + .../types/number_literal/migrated_0008.js | 1 + .../number_literal/migrated_0008.tree.json | 41 + .../types/number_literal/migrated_0009.js | 1 + .../number_literal/migrated_0009.tree.json | 41 + .../types/number_literal/migrated_0010.js | 1 + .../number_literal/migrated_0010.tree.json | 41 + .../number_literal_invalid/migrated_0000.js | 1 + .../migrated_0000.tree.json | 47 + .../number_literal_invalid/migrated_0001.js | 1 + .../migrated_0001.tree.json | 67 + .../indexers/reserved_type_indexer_name.js | 1 + .../reserved_type_indexer_name.tree.json | 59 + .../indexers/reserved_word_indexer_name.js | 1 + .../reserved_word_indexer_name.tree.json | 59 + .../types/object/methods/generic_method.js | 1 + .../object/methods/generic_method.tree.json | 110 + lib/test/flow/types/object/methods/method.js | 1 + .../types/object/methods/method.tree.json | 66 + .../flow/types/object/unexpected_proto.js | 8 + .../types/object/unexpected_proto.tree.json | 249 + .../flow/types/object/unexpected_static.js | 26 + .../types/object/unexpected_static.tree.json | 793 ++ .../migrated_0000.js | 1 + .../migrated_0000.tree.json | 67 + .../migrated_0001.js | 1 + .../migrated_0001.tree.json | 72 + .../migrated_0002.js | 1 + .../migrated_0002.tree.json | 72 + .../migrated_0003.js | 1 + .../migrated_0003.tree.json | 75 + .../migrated_0004.js | 1 + .../migrated_0004.tree.json | 81 + .../migrated_0005.js | 1 + .../migrated_0005.tree.json | 81 + .../migrated_0006.js | 1 + .../migrated_0006.tree.json | 77 + .../migrated_0007.js | 1 + .../migrated_0007.tree.json | 82 + .../migrated_0008.js | 1 + .../migrated_0008.tree.json | 82 + .../migrated_0009.js | 1 + .../migrated_0009.tree.json | 62 + .../migrated_0010.js | 1 + .../migrated_0010.tree.json | 68 + .../migrated_0011.js | 1 + .../migrated_0011.tree.json | 68 + .../types/object_type_spread/migrated_0000.js | 1 + .../migrated_0000.tree.json | 53 + .../types/object_type_spread/migrated_0001.js | 1 + .../migrated_0001.tree.json | 53 + .../types/object_type_spread/migrated_0002.js | 1 + .../migrated_0002.tree.json | 86 + .../types/object_type_spread/migrated_0003.js | 1 + .../migrated_0003.tree.json | 86 + .../types/object_type_spread/migrated_0004.js | 1 + .../migrated_0004.tree.json | 72 + .../types/object_type_spread/migrated_0005.js | 1 + .../migrated_0005.tree.json | 77 + .../declare/opaque_declare_export_init_eol.js | 2 + .../opaque_declare_export_init_eol.tree.json | 70 + .../declare/opaque_declare_export_neither.js | 1 + .../opaque_declare_export_neither.tree.json | 32 + .../declare/opaque_declare_export_st_no_t.js | 1 + .../opaque_declare_export_st_no_t.tree.json | 45 + .../declare/opaque_declare_export_t_and_st.js | 1 + .../opaque_declare_export_t_and_st.tree.json | 64 + .../declare/opaque_declare_export_t_no_st.js | 1 + .../opaque_declare_export_t_no_st.tree.json | 51 + .../declare/opaque_declare_neither.js | 1 + .../declare/opaque_declare_neither.tree.json | 24 + .../declare/opaque_declare_st_no_t.js | 1 + .../declare/opaque_declare_st_no_t.tree.json | 37 + .../declare/opaque_declare_t_and_st.js | 1 + .../declare/opaque_declare_t_and_st.tree.json | 56 + .../declare/opaque_declare_t_no_st.js | 1 + .../declare/opaque_declare_t_no_st.tree.json | 43 + .../opaque_aliases/invalid/opaque_invalid1.js | 1 + .../invalid/opaque_invalid1.tree.json | 42 + .../opaque_aliases/invalid/opaque_invalid2.js | 1 + .../invalid/opaque_invalid2.tree.json | 74 + .../invalid/opaque_subtype_allow_export.js | 3 + .../opaque_subtype_allow_export.tree.json | 66 + .../invalid/opaque_subtype_invalid1.js | 1 + .../invalid/opaque_subtype_invalid1.tree.json | 69 + .../invalid/opaque_subtype_invalid2.js | 1 + .../invalid/opaque_subtype_invalid2.tree.json | 89 + .../invalid/opaque_subtype_invalid3.js | 1 + .../invalid/opaque_subtype_invalid3.tree.json | 135 + .../invalid/opaque_type_allow_export.js | 3 + .../opaque_type_allow_export.tree.json | 62 + .../opaque_aliases/invalid/reserved_type.js | 1 + .../invalid/reserved_type.tree.json | 34 + .../opaque_aliases/valid/declare_opaque.js | 1 + .../valid/declare_opaque.tree.json | 34 + .../opaque_aliases/valid/opaque_subtype.js | 1 + .../valid/opaque_subtype.tree.json | 90 + .../valid/opaque_subtype_export.js | 1 + .../valid/opaque_subtype_export.tree.json | 98 + .../types/opaque_aliases/valid/opaque_type.js | 1 + .../valid/opaque_type.tree.json | 28 + .../valid/opaque_type_export.js | 1 + .../valid/opaque_type_export.tree.json | 36 + .../opaque_aliases/valid/reserved_value.js | 1 + .../valid/reserved_value.tree.json | 28 + .../optional_indexer_name/migrated_0000.js | 1 + .../migrated_0000.tree.json | 52 + .../optional_indexer_name/migrated_0001.js | 1 + .../migrated_0001.tree.json | 64 + .../types/parameter_defaults/migrated_0000.js | 1 + .../migrated_0000.tree.json | 55 + .../types/parameter_defaults/migrated_0001.js | 1 + .../migrated_0001.tree.json | 69 + .../types/parameter_defaults/migrated_0002.js | 1 + .../migrated_0002.tree.json | 78 + .../types/parameter_defaults/migrated_0003.js | 1 + .../migrated_0003.tree.json | 82 + .../types/parameter_defaults/migrated_0004.js | 1 + .../migrated_0004.tree.json | 51 + .../types/parameter_defaults/migrated_0005.js | 1 + .../migrated_0005.tree.json | 65 + .../types/parameter_defaults/migrated_0006.js | 1 + .../migrated_0006.tree.json | 74 + .../types/parameter_defaults/migrated_0007.js | 1 + .../migrated_0007.tree.json | 78 + .../types/parameter_defaults/migrated_0008.js | 1 + .../migrated_0008.tree.json | 57 + .../types/parameter_defaults/migrated_0009.js | 1 + .../migrated_0009.tree.json | 71 + .../types/parameter_defaults/migrated_0010.js | 1 + .../migrated_0010.tree.json | 80 + .../types/parameter_defaults/migrated_0011.js | 1 + .../migrated_0011.tree.json | 84 + .../types/parameter_defaults/migrated_0012.js | 1 + .../migrated_0012.tree.json | 54 + .../types/parameter_defaults/migrated_0013.js | 1 + .../migrated_0013.tree.json | 68 + .../types/parameter_defaults/migrated_0014.js | 1 + .../migrated_0014.tree.json | 77 + .../types/parameter_defaults/migrated_0015.js | 1 + .../migrated_0015.tree.json | 81 + .../types/parameter_defaults/migrated_0016.js | 1 + .../migrated_0016.tree.json | 52 + .../types/parameter_defaults/migrated_0017.js | 1 + .../migrated_0017.tree.json | 66 + .../types/parameter_defaults/migrated_0018.js | 1 + .../migrated_0018.tree.json | 75 + .../types/parameter_defaults/migrated_0019.js | 1 + .../migrated_0019.tree.json | 79 + .../types/parameter_defaults/migrated_0020.js | 1 + .../migrated_0020.tree.json | 53 + .../types/parameter_defaults/migrated_0021.js | 1 + .../migrated_0021.tree.json | 44 + .../types/parameter_defaults/migrated_0022.js | 1 + .../migrated_0022.tree.json | 82 + .../types/parameter_defaults/migrated_0023.js | 1 + .../migrated_0023.tree.json | 70 + .../types/parameter_defaults/migrated_0024.js | 1 + .../migrated_0024.tree.json | 70 + .../types/parameter_defaults/migrated_0025.js | 1 + .../migrated_0025.tree.json | 79 + .../types/parameter_defaults/migrated_0026.js | 1 + .../migrated_0026.tree.json | 53 + .../types/parameter_defaults/migrated_0027.js | 1 + .../migrated_0027.tree.json | 81 + .../types/parameter_defaults/migrated_0028.js | 1 + .../migrated_0028.tree.json | 76 + .../types/parameter_defaults/migrated_0029.js | 1 + .../migrated_0029.tree.json | 88 + .../types/parameter_defaults/migrated_0030.js | 1 + .../migrated_0030.tree.json | 94 + .../types/parameter_defaults/migrated_0031.js | 1 + .../migrated_0031.tree.json | 87 + .../types/parameter_defaults/migrated_0032.js | 1 + .../migrated_0032.tree.json | 53 + lib/test/flow/types/reserved/reserved.js | 11 + .../flow/types/reserved/reserved.tree.json | 454 + .../types/string_literal/migrated_0000.js | 1 + .../string_literal/migrated_0000.tree.json | 41 + .../types/string_literal/migrated_0001.js | 1 + .../string_literal/migrated_0001.tree.json | 41 + .../types/string_literal/migrated_0002.js | 1 + .../string_literal/migrated_0002.tree.json | 41 + .../string_literal_invalid/migrated_0000.js | 1 + .../migrated_0000.tree.json | 47 + .../this_constraints/declare_class_getter.js | 3 + .../declare_class_getter.tree.json | 92 + .../declare_class_method_0.js | 3 + .../declare_class_method_0.tree.json | 86 + .../declare_class_method_1.js | 3 + .../declare_class_method_1.tree.json | 106 + .../declare_class_method_2.js | 3 + .../declare_class_method_2.tree.json | 125 + .../this_constraints/declare_class_setter.js | 3 + .../declare_class_setter.tree.json | 112 + .../this_constraints/declare_function_0.js | 1 + .../declare_function_0.tree.json | 57 + .../this_constraints/declare_function_1.js | 1 + .../declare_function_1.tree.json | 77 + .../this_constraints/declare_function_2.js | 1 + .../declare_function_2.tree.json | 96 + .../types/this_constraints/error_not_first.js | 1 + .../error_not_first.tree.json | 83 + .../types/this_constraints/error_optional.js | 1 + .../this_constraints/error_optional.tree.json | 88 + .../types/this_constraints/error_repeated.js | 1 + .../this_constraints/error_repeated.tree.json | 63 + .../types/this_constraints/function_type_0.js | 1 + .../function_type_0.tree.json | 53 + .../types/this_constraints/function_type_1.js | 1 + .../function_type_1.tree.json | 73 + .../types/this_constraints/function_type_2.js | 1 + .../function_type_2.tree.json | 92 + .../no_ambiguity_with_anonymous_this_0.js | 3 + ..._ambiguity_with_anonymous_this_0.tree.json | 91 + .../no_ambiguity_with_anonymous_this_1.js | 3 + ..._ambiguity_with_anonymous_this_1.tree.json | 103 + .../this_constraints/object_type_method_0.js | 3 + .../object_type_method_0.tree.json | 84 + .../this_constraints/object_type_method_1.js | 3 + .../object_type_method_1.tree.json | 104 + .../this_constraints/object_type_method_2.js | 3 + .../object_type_method_2.tree.json | 123 + lib/test/flow/types/tuples/migrated_0000.js | 1 + .../flow/types/tuples/migrated_0000.tree.json | 45 + lib/test/flow/types/tuples/migrated_0001.js | 1 + .../flow/types/tuples/migrated_0001.tree.json | 89 + lib/test/flow/types/tuples/migrated_0002.js | 1 + .../flow/types/tuples/migrated_0002.tree.json | 59 + lib/test/flow/types/tuples/migrated_0003.js | 1 + .../flow/types/tuples/migrated_0003.tree.json | 71 + .../flow/types/typecasts/migrated_0000.js | 1 + .../types/typecasts/migrated_0000.tree.json | 37 + .../flow/types/typecasts/migrated_0001.js | 1 + .../types/typecasts/migrated_0001.tree.json | 139 + .../flow/types/typecasts/migrated_0002.js | 2 + .../types/typecasts/migrated_0002.tree.json | 107 + .../flow/types/typecasts/migrated_0003.js | 2 + .../types/typecasts/migrated_0003.tree.json | 74 + .../types/typecasts_invalid/migrated_0000.js | 2 + .../typecasts_invalid/migrated_0000.tree.json | 76 + .../types/typecasts_invalid/migrated_0001.js | 2 + .../typecasts_invalid/migrated_0001.tree.json | 98 + .../migrated_0000.js | 1 + .../migrated_0000.tree.json | 50 + .../migrated_0001.js | 1 + .../migrated_0001.tree.json | 50 + .../migrated_0000.js | 1 + .../migrated_0000.tree.json | 49 + .../migrated_0000.js | 1 + .../migrated_0000.tree.json | 68 + .../migrated_0001.js | 1 + .../migrated_0001.tree.json | 82 + .../migrated_0002.js | 1 + .../migrated_0002.tree.json | 82 + .../migrated_0003.js | 1 + .../migrated_0003.tree.json | 75 + .../migrated_0004.js | 1 + .../migrated_0004.tree.json | 75 + .../migrated_0005.js | 1 + .../migrated_0005.tree.json | 75 + .../migrated_0006.js | 1 + .../migrated_0006.tree.json | 75 + .../migrated_0007.js | 1 + .../migrated_0007.tree.json | 75 + .../migrated_0008.js | 1 + .../migrated_0008.tree.json | 75 + .../migrated_0000.js | 1 + .../migrated_0000.tree.json | 74 + .../migrated_0001.js | 1 + .../migrated_0001.tree.json | 74 + .../migrated_0002.js | 1 + .../migrated_0002.tree.json | 78 + lib/test/test262_baseline.txt | 11057 ++++++++++++++++ lib/token.ml | 95 +- lib/token_translator.ml | 88 +- lib/translator_intf.ml | 27 +- lib/type_parser.ml | 1704 ++- lib/yarn.lock | 19 - package.json | 8 +- ppx_tools_versioned.5.2/.depend | 62 - ppx_tools_versioned.5.2/.ocp-indent | 2 - ppx_tools_versioned.5.2/.travis.yml | 17 - ppx_tools_versioned.5.2/LICENSE | 20 - ppx_tools_versioned.5.2/Makefile | 26 - ppx_tools_versioned.5.2/README.md | 138 - .../ast_convenience_402.ml | 155 - .../ast_convenience_402.mli | 110 - .../ast_convenience_403.ml | 122 - .../ast_convenience_403.mli | 110 - .../ast_convenience_404.ml | 124 - .../ast_convenience_404.mli | 112 - .../ast_convenience_405.ml | 124 - .../ast_convenience_405.mli | 112 - .../ast_convenience_406.ml | 124 - .../ast_convenience_406.mli | 112 - ppx_tools_versioned.5.2/ast_lifter_402.ml | 1353 -- ppx_tools_versioned.5.2/ast_lifter_403.ml | 1378 -- ppx_tools_versioned.5.2/ast_lifter_404.ml | 1388 -- ppx_tools_versioned.5.2/ast_lifter_405.ml | 1393 -- ppx_tools_versioned.5.2/ast_lifter_406.ml | 1409 -- .../ast_mapper_class_402.ml | 576 - .../ast_mapper_class_402.mli | 57 - .../ast_mapper_class_403.ml | 581 - .../ast_mapper_class_403.mli | 58 - .../ast_mapper_class_404.ml | 586 - .../ast_mapper_class_404.mli | 58 - .../ast_mapper_class_405.ml | 586 - .../ast_mapper_class_405.mli | 58 - .../ast_mapper_class_406.ml | 594 - .../ast_mapper_class_406.mli | 58 - ppx_tools_versioned.5.2/example/ppx_once/META | 8 - .../example/ppx_once/Makefile | 34 - .../example/ppx_once/ppx_once.ml | 70 - .../example/ppx_once/standalone.ml | 4 - ppx_tools_versioned.5.2/gen/update_jbuild.ml | 48 - ppx_tools_versioned.5.2/jbuild | 11 - ppx_tools_versioned.5.2/jbuild-workspace.dev | 5 - ppx_tools_versioned.5.2/jbuild.inc | 68 - ppx_tools_versioned.5.2/pkg/pkg.ml | 2 - ppx_tools_versioned.5.2/ppx_metaquot_402.ml | 236 - ppx_tools_versioned.5.2/ppx_metaquot_403.ml | 236 - ppx_tools_versioned.5.2/ppx_metaquot_404.ml | 281 - ppx_tools_versioned.5.2/ppx_metaquot_405.ml | 281 - ppx_tools_versioned.5.2/ppx_metaquot_406.ml | 281 - ppx_tools_versioned.5.2/ppx_metaquot_run.ml | 1 - ppx_tools_versioned.5.2/ppx_tools_402.ml | 2 - ppx_tools_versioned.5.2/ppx_tools_403.ml | 2 - ppx_tools_versioned.5.2/ppx_tools_404.ml | 2 - ppx_tools_versioned.5.2/ppx_tools_405.ml | 2 - ppx_tools_versioned.5.2/ppx_tools_406.ml | 2 - .../ppx_tools_versioned.nopam | 21 - sedlex-1.99.4/.gitignore | 15 - sedlex-1.99.4/CHANGES | 57 - sedlex-1.99.4/LICENSE | 22 - sedlex-1.99.4/META | 14 - sedlex-1.99.4/Makefile | 74 - sedlex-1.99.4/README.md | 225 - sedlex-1.99.4/examples/Makefile | 36 - sedlex-1.99.4/examples/complement.ml | 14 - sedlex-1.99.4/examples/repeat.ml | 15 - sedlex-1.99.4/examples/subtraction.ml | 14 - sedlex-1.99.4/examples/tokenizer.ml | 17 - sedlex-1.99.4/nopam | 20 - sedlex-1.99.4/src/lib/Makefile | 26 - sedlex-1.99.4/src/lib/dune | 5 - sedlex-1.99.4/src/lib/sedlexing.ml | 464 - sedlex-1.99.4/src/lib/sedlexing.mli | 231 - sedlex-1.99.4/src/syntax/Makefile | 54 - sedlex-1.99.4/src/syntax/dune | 9 - sedlex-1.99.4/src/syntax/ppx_sedlex.ml | 452 - sedlex-1.99.4/src/syntax/sedlex.ml | 145 - sedlex-1.99.4/src/syntax/sedlex.mli | 24 - sedlex-1.99.4/src/syntax/sedlex_cset.ml | 399 - sedlex-1.99.4/src/syntax/sedlex_cset.mli | 30 - sedlex-1.99.4/src/syntax/unicode63.ml | 1869 --- sedlex-1.99.4/src/syntax/unicode63.mli | 54 - 5557 files changed, 395882 insertions(+), 27503 deletions(-) rename esy.lock/opam/{cppo.1.6.6 => cppo.1.6.7}/opam (64%) create mode 100644 esy.lock/opam/csexp.1.3.2/opam create mode 100644 esy.lock/opam/dot-merlin-reader.3.4.2/opam create mode 100644 esy.lock/opam/dune-configurator.2.8.2/opam rename esy.lock/opam/{dune.1.11.3 => dune.2.8.2}/opam (52%) delete mode 100644 esy.lock/opam/gen.0.5.2/opam create mode 100644 esy.lock/opam/gen.0.5.3/opam rename esy.lock/opam/{merlin.3.3.2 => merlin.3.4.2}/opam (77%) rename esy.lock/opam/{ocaml-migrate-parsetree.1.4.0 => ocaml-migrate-parsetree.1.8.0}/opam (76%) create mode 100644 esy.lock/opam/ocamlbuild.0.14.0/opam create mode 100644 esy.lock/opam/ppx_deriving.4.5/opam create mode 100644 esy.lock/opam/ppx_gen_rec.1.1.0/opam create mode 100644 esy.lock/opam/ppx_tools.6.3/opam create mode 100644 esy.lock/opam/ppx_tools_versioned.5.4.0/opam create mode 100644 esy.lock/opam/ppxfind.1.4/opam rename esy.lock/opam/{result.1.4 => result.1.5}/opam (80%) create mode 100644 esy.lock/opam/sedlex.2.2/opam create mode 100644 esy.lock/opam/uchar.0.0.2/opam create mode 100644 esy.lock/overrides/opam__s__conf_m4_opam__c__1_opam_override/package.json delete mode 100644 esy.lock/overrides/opam__s__dune_opam__c__1.11.3_opam_override/package.json create mode 100644 esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.0_opam_override/files/ocamlbuild-0.14.0.patch create mode 100644 esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.0_opam_override/package.json create mode 100644 lib/.gitignore create mode 100644 lib/META create mode 100644 lib/Makefile create mode 100644 lib/__tests__/offset_utils_test.ml create mode 100644 lib/__tests__/parser_tests.ml delete mode 100644 lib/ast.ml delete mode 100644 lib/ast_utils.ml delete mode 100644 lib/ast_utils.mli create mode 100644 lib/comment_attachment.ml create mode 100644 lib/enum_common.ml create mode 100644 lib/enum_parser.ml create mode 100644 lib/flow_ast.ml create mode 100644 lib/flow_ast_mapper.ml create mode 100644 lib/flow_ast_utils.ml create mode 100644 lib/flow_ast_utils.mli create mode 100644 lib/flow_lexer.ml delete mode 100644 lib/lexer.ml create mode 100644 lib/offset_utils.ml create mode 100644 lib/offset_utils.mli create mode 100644 lib/relativeLoc.ml create mode 100644 lib/relativeLoc.mli create mode 100644 lib/test/esprima/ES2016/exponent/exp_assign.js create mode 100644 lib/test/esprima/ES2016/exponent/exp_assign.tree.json create mode 100644 lib/test/esprima/ES2016/exponent/exp_bitnot.js create mode 100644 lib/test/esprima/ES2016/exponent/exp_bitnot.tree.json create mode 100644 lib/test/esprima/ES2016/exponent/exp_delete.js create mode 100644 lib/test/esprima/ES2016/exponent/exp_delete.tree.json create mode 100644 lib/test/esprima/ES2016/exponent/exp_minus.js create mode 100644 lib/test/esprima/ES2016/exponent/exp_minus.tree.json create mode 100644 lib/test/esprima/ES2016/exponent/exp_minusminus.js create mode 100644 lib/test/esprima/ES2016/exponent/exp_minusminus.tree.json create mode 100644 lib/test/esprima/ES2016/exponent/exp_not.js create mode 100644 lib/test/esprima/ES2016/exponent/exp_not.tree.json create mode 100644 lib/test/esprima/ES2016/exponent/exp_operator.js create mode 100644 lib/test/esprima/ES2016/exponent/exp_operator.tree.json create mode 100644 lib/test/esprima/ES2016/exponent/exp_plus.js create mode 100644 lib/test/esprima/ES2016/exponent/exp_plus.tree.json create mode 100644 lib/test/esprima/ES2016/exponent/exp_plusplus.js create mode 100644 lib/test/esprima/ES2016/exponent/exp_plusplus.tree.json create mode 100644 lib/test/esprima/ES2016/exponent/exp_precedence.js create mode 100644 lib/test/esprima/ES2016/exponent/exp_precedence.tree.json create mode 100644 lib/test/esprima/ES2016/exponent/exp_typeof.js create mode 100644 lib/test/esprima/ES2016/exponent/exp_typeof.tree.json create mode 100644 lib/test/esprima/ES2016/exponent/exp_void.js create mode 100644 lib/test/esprima/ES2016/exponent/exp_void.tree.json create mode 100644 lib/test/esprima/ES2016/exponent/invalid_bitnot_exp.failure.json create mode 100644 lib/test/esprima/ES2016/exponent/invalid_bitnot_exp.js create mode 100644 lib/test/esprima/ES2016/exponent/invalid_delete_exp.failure.json create mode 100644 lib/test/esprima/ES2016/exponent/invalid_delete_exp.js create mode 100644 lib/test/esprima/ES2016/exponent/invalid_minus_exp.failure.json create mode 100644 lib/test/esprima/ES2016/exponent/invalid_minus_exp.js create mode 100644 lib/test/esprima/ES2016/exponent/invalid_not_exp.failure.json create mode 100644 lib/test/esprima/ES2016/exponent/invalid_not_exp.js create mode 100644 lib/test/esprima/ES2016/exponent/invalid_plus_exp.failure.json create mode 100644 lib/test/esprima/ES2016/exponent/invalid_plus_exp.js create mode 100644 lib/test/esprima/ES2016/exponent/invalid_typeof_exp.failure.json create mode 100644 lib/test/esprima/ES2016/exponent/invalid_typeof_exp.js create mode 100644 lib/test/esprima/ES2016/exponent/invalid_update.js create mode 100644 lib/test/esprima/ES2016/exponent/invalid_update.tree.json create mode 100644 lib/test/esprima/ES2016/exponent/invalid_void_exp.failure.json create mode 100644 lib/test/esprima/ES2016/exponent/invalid_void_exp.js create mode 100644 lib/test/esprima/ES2016/exponent/update_exp.js create mode 100644 lib/test/esprima/ES2016/exponent/update_exp.tree.json create mode 100644 lib/test/esprima/ES2016/identifier/gujarati_zha.js create mode 100644 lib/test/esprima/ES2016/identifier/gujarati_zha.tree.json create mode 100644 lib/test/esprima/ES6/arrow-function/array-binding-pattern/array-binding-pattern-01.js create mode 100644 lib/test/esprima/ES6/arrow-function/array-binding-pattern/array-binding-pattern-01.tree.json create mode 100644 lib/test/esprima/ES6/arrow-function/array-binding-pattern/array-binding-pattern-02.js create mode 100644 lib/test/esprima/ES6/arrow-function/array-binding-pattern/array-binding-pattern-02.tree.json create mode 100644 lib/test/esprima/ES6/arrow-function/array-binding-pattern/array-binding-pattern-03.js create mode 100644 lib/test/esprima/ES6/arrow-function/array-binding-pattern/array-binding-pattern-03.tree.json create mode 100644 lib/test/esprima/ES6/arrow-function/array-binding-pattern/array-binding-pattern-empty.js create mode 100644 lib/test/esprima/ES6/arrow-function/array-binding-pattern/array-binding-pattern-empty.tree.json create mode 100644 lib/test/esprima/ES6/arrow-function/array-binding-pattern/elision.js create mode 100644 lib/test/esprima/ES6/arrow-function/array-binding-pattern/elision.tree.json create mode 100644 lib/test/esprima/ES6/arrow-function/array-binding-pattern/invalid-dup-param.failure.json create mode 100644 lib/test/esprima/ES6/arrow-function/array-binding-pattern/invalid-dup-param.js create mode 100644 lib/test/esprima/ES6/arrow-function/array-binding-pattern/invalid-elision-after-rest.failure.json create mode 100644 lib/test/esprima/ES6/arrow-function/array-binding-pattern/invalid-elision-after-rest.js create mode 100644 lib/test/esprima/ES6/arrow-function/arrow-rest-forgetting-comma.failure.json create mode 100644 lib/test/esprima/ES6/arrow-function/arrow-rest-forgetting-comma.js create mode 100644 lib/test/esprima/ES6/arrow-function/arrow-with-multiple-arg-and-rest.js create mode 100644 lib/test/esprima/ES6/arrow-function/arrow-with-multiple-arg-and-rest.tree.json create mode 100644 lib/test/esprima/ES6/arrow-function/arrow-with-multiple-rest.failure.json create mode 100644 lib/test/esprima/ES6/arrow-function/arrow-with-multiple-rest.js create mode 100644 lib/test/esprima/ES6/arrow-function/arrow-with-only-rest.js create mode 100644 lib/test/esprima/ES6/arrow-function/arrow-with-only-rest.tree.json create mode 100644 lib/test/esprima/ES6/arrow-function/complex-rest-in-arrow-not-allowed.failure.json create mode 100644 lib/test/esprima/ES6/arrow-function/complex-rest-in-arrow-not-allowed.js create mode 100644 lib/test/esprima/ES6/arrow-function/invalid-duplicated-params.failure.json create mode 100644 lib/test/esprima/ES6/arrow-function/invalid-duplicated-params.js create mode 100644 lib/test/esprima/ES6/arrow-function/invalid-line-terminator-arrow.failure.json create mode 100644 lib/test/esprima/ES6/arrow-function/invalid-line-terminator-arrow.js create mode 100644 lib/test/esprima/ES6/arrow-function/invalid-param-strict-mode.failure.json create mode 100644 lib/test/esprima/ES6/arrow-function/invalid-param-strict-mode.js create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0000.js create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0000.tree.json create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0001.js create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0001.tree.json create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0002.js create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0002.tree.json create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0003.js create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0003.tree.json create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0004.js create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0004.tree.json create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0005.js create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0005.tree.json create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0006.diff create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0006.js create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0006.tree.json create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0007.js create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0007.tree.json create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0008.diff create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0008.js create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0008.tree.json create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0009.js create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0009.tree.json create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0010.js create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0010.tree.json create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0011.js create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0011.tree.json create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0012.js create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0012.tree.json create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0013.diff create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0013.js create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0013.tree.json create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0014.diff create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0014.js create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0014.tree.json create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0015.js create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0015.tree.json create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0016.js create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0016.tree.json create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0017.js create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0017.tree.json create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0018.js create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0018.tree.json create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0019.js create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0019.tree.json create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0020.js create mode 100644 lib/test/esprima/ES6/arrow-function/migrated_0020.tree.json create mode 100644 lib/test/esprima/ES6/arrow-function/non-arrow-param-followed-by-arrow.failure.json create mode 100644 lib/test/esprima/ES6/arrow-function/non-arrow-param-followed-by-arrow.js create mode 100644 lib/test/esprima/ES6/arrow-function/non-arrow-param-followed-by-rest.failure.json create mode 100644 lib/test/esprima/ES6/arrow-function/non-arrow-param-followed-by-rest.js create mode 100644 lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-member-expr.failure.json create mode 100644 lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-member-expr.js create mode 100644 lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-method-in-pattern.failure.json create mode 100644 lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-method-in-pattern.js create mode 100644 lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-nested-param.failure.json create mode 100644 lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-nested-param.js create mode 100644 lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-pattern-without-parenthesis.failure.json create mode 100644 lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-pattern-without-parenthesis.js create mode 100644 lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-rest-in-object-pattern.failure.json create mode 100644 lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-rest-in-object-pattern.js create mode 100644 lib/test/esprima/ES6/arrow-function/object-binding-pattern/nested-cover-grammar.js create mode 100644 lib/test/esprima/ES6/arrow-function/object-binding-pattern/nested-cover-grammar.tree.json create mode 100644 lib/test/esprima/ES6/arrow-function/object-binding-pattern/object-binding-pattern-01.js create mode 100644 lib/test/esprima/ES6/arrow-function/object-binding-pattern/object-binding-pattern-01.tree.json create mode 100644 lib/test/esprima/ES6/arrow-function/object-binding-pattern/object-binding-pattern-empty.js create mode 100644 lib/test/esprima/ES6/arrow-function/object-binding-pattern/object-binding-pattern-empty.tree.json create mode 100644 lib/test/esprima/ES6/arrow-function/param-with-rest-without-arrow.failure.json create mode 100644 lib/test/esprima/ES6/arrow-function/param-with-rest-without-arrow.js create mode 100644 lib/test/esprima/ES6/arrow-function/rest-without-arrow.failure.json create mode 100644 lib/test/esprima/ES6/arrow-function/rest-without-arrow.js create mode 100644 lib/test/esprima/ES6/binary-integer-literal/migrated_0000.js create mode 100644 lib/test/esprima/ES6/binary-integer-literal/migrated_0000.tree.json create mode 100644 lib/test/esprima/ES6/binary-integer-literal/migrated_0001.js create mode 100644 lib/test/esprima/ES6/binary-integer-literal/migrated_0001.tree.json create mode 100644 lib/test/esprima/ES6/binary-integer-literal/migrated_0002.js create mode 100644 lib/test/esprima/ES6/binary-integer-literal/migrated_0002.tree.json create mode 100644 lib/test/esprima/ES6/binary-integer-literal/migrated_0003.js create mode 100644 lib/test/esprima/ES6/binary-integer-literal/migrated_0003.tree.json create mode 100644 lib/test/esprima/ES6/binary-integer-literal/migrated_0004.js create mode 100644 lib/test/esprima/ES6/binary-integer-literal/migrated_0004.tree.json create mode 100644 lib/test/esprima/ES6/binary-integer-literal/migrated_0005.js create mode 100644 lib/test/esprima/ES6/binary-integer-literal/migrated_0005.tree.json create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/dupe-param.diff create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/dupe-param.js create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/dupe-param.tree.json create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/elision.js create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/elision.tree.json create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/empty-pattern-catch-param.js create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/empty-pattern-catch-param.tree.json create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/empty-pattern-fn.js create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/empty-pattern-fn.tree.json create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/empty-pattern-lexical.js create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/empty-pattern-lexical.tree.json create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/empty-pattern-var.js create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/empty-pattern-var.tree.json create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/for-let-let.js create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/for-let-let.skip create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/for-let-let.tree.json create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/hole.js create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/hole.tree.json create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/invalid-strict-for-let-let.failure.json create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/invalid-strict-for-let-let.js create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/nested-pattern.js create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/nested-pattern.tree.json create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/patterned-catch-dupe.failure.json create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/patterned-catch-dupe.js create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/patterned-catch.js create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/patterned-catch.tree.json create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/rest.elision.failure.json create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/rest.elision.js create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/rest.js create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/rest.tree.json create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/tailing-hold.js create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/tailing-hold.tree.json create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/var-for-in.js create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/var-for-in.tree.json create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/var_let_array.js create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/var_let_array.tree.json create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/with-default-catch-param-fail.failure.json create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/with-default-catch-param-fail.js create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/with-default-catch-param.js create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/with-default-catch-param.tree.json create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/with-default-fn.js create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/with-default-fn.tree.json create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/with-object-pattern.js create mode 100644 lib/test/esprima/ES6/binding-pattern/array-pattern/with-object-pattern.tree.json create mode 100644 lib/test/esprima/ES6/binding-pattern/object-pattern/elision.js create mode 100644 lib/test/esprima/ES6/binding-pattern/object-pattern/elision.tree.json create mode 100644 lib/test/esprima/ES6/binding-pattern/object-pattern/empty-catch-param.js create mode 100644 lib/test/esprima/ES6/binding-pattern/object-pattern/empty-catch-param.tree.json create mode 100644 lib/test/esprima/ES6/binding-pattern/object-pattern/empty-fn.js create mode 100644 lib/test/esprima/ES6/binding-pattern/object-pattern/empty-fn.tree.json create mode 100644 lib/test/esprima/ES6/binding-pattern/object-pattern/empty-for-lex.js create mode 100644 lib/test/esprima/ES6/binding-pattern/object-pattern/empty-for-lex.tree.json create mode 100644 lib/test/esprima/ES6/binding-pattern/object-pattern/empty-lexical.js create mode 100644 lib/test/esprima/ES6/binding-pattern/object-pattern/empty-lexical.tree.json create mode 100644 lib/test/esprima/ES6/binding-pattern/object-pattern/empty-var.js create mode 100644 lib/test/esprima/ES6/binding-pattern/object-pattern/empty-var.tree.json create mode 100644 lib/test/esprima/ES6/binding-pattern/object-pattern/for-let-let.js create mode 100644 lib/test/esprima/ES6/binding-pattern/object-pattern/for-let-let.skip create mode 100644 lib/test/esprima/ES6/binding-pattern/object-pattern/for-let-let.tree.json create mode 100644 lib/test/esprima/ES6/binding-pattern/object-pattern/invalid-strict-for-let-let.failure.json create mode 100644 lib/test/esprima/ES6/binding-pattern/object-pattern/invalid-strict-for-let-let.js create mode 100644 lib/test/esprima/ES6/binding-pattern/object-pattern/nested.js create mode 100644 lib/test/esprima/ES6/binding-pattern/object-pattern/nested.tree.json create mode 100644 lib/test/esprima/ES6/binding-pattern/object-pattern/properties.js create mode 100644 lib/test/esprima/ES6/binding-pattern/object-pattern/properties.tree.json create mode 100644 lib/test/esprima/ES6/binding-pattern/object-pattern/var-for-in.js create mode 100644 lib/test/esprima/ES6/binding-pattern/object-pattern/var-for-in.tree.json create mode 100644 lib/test/esprima/ES6/class/migrated_0000.js create mode 100644 lib/test/esprima/ES6/class/migrated_0000.tree.json create mode 100644 lib/test/esprima/ES6/class/migrated_0001.js create mode 100644 lib/test/esprima/ES6/class/migrated_0001.tree.json create mode 100644 lib/test/esprima/ES6/class/migrated_0002.js create mode 100644 lib/test/esprima/ES6/class/migrated_0002.tree.json create mode 100644 lib/test/esprima/ES6/class/migrated_0003.js create mode 100644 lib/test/esprima/ES6/class/migrated_0003.tree.json create mode 100644 lib/test/esprima/ES6/class/migrated_0004.js create mode 100644 lib/test/esprima/ES6/class/migrated_0004.tree.json create mode 100644 lib/test/esprima/ES6/class/migrated_0005.js create mode 100644 lib/test/esprima/ES6/class/migrated_0005.tree.json create mode 100644 lib/test/esprima/ES6/class/migrated_0006.js create mode 100644 lib/test/esprima/ES6/class/migrated_0006.tree.json create mode 100644 lib/test/esprima/ES6/class/migrated_0007.js create mode 100644 lib/test/esprima/ES6/class/migrated_0007.tree.json create mode 100644 lib/test/esprima/ES6/class/migrated_0008.js create mode 100644 lib/test/esprima/ES6/class/migrated_0008.tree.json create mode 100644 lib/test/esprima/ES6/class/migrated_0009.js create mode 100644 lib/test/esprima/ES6/class/migrated_0009.tree.json create mode 100644 lib/test/esprima/ES6/class/migrated_0010.js create mode 100644 lib/test/esprima/ES6/class/migrated_0010.tree.json create mode 100644 lib/test/esprima/ES6/class/migrated_0011.js create mode 100644 lib/test/esprima/ES6/class/migrated_0011.tree.json create mode 100644 lib/test/esprima/ES6/class/migrated_0012.js create mode 100644 lib/test/esprima/ES6/class/migrated_0012.tree.json create mode 100644 lib/test/esprima/ES6/class/migrated_0013.js create mode 100644 lib/test/esprima/ES6/class/migrated_0013.tree.json create mode 100644 lib/test/esprima/ES6/class/migrated_0014.js create mode 100644 lib/test/esprima/ES6/class/migrated_0014.tree.json create mode 100644 lib/test/esprima/ES6/class/migrated_0015.js create mode 100644 lib/test/esprima/ES6/class/migrated_0015.tree.json create mode 100644 lib/test/esprima/ES6/class/migrated_0016.js create mode 100644 lib/test/esprima/ES6/class/migrated_0016.tree.json create mode 100644 lib/test/esprima/ES6/class/migrated_0017.js create mode 100644 lib/test/esprima/ES6/class/migrated_0017.tree.json create mode 100644 lib/test/esprima/ES6/class/migrated_0018.js create mode 100644 lib/test/esprima/ES6/class/migrated_0018.tree.json create mode 100644 lib/test/esprima/ES6/class/migrated_0019.js create mode 100644 lib/test/esprima/ES6/class/migrated_0019.tree.json create mode 100644 lib/test/esprima/ES6/class/migrated_0020.js create mode 100644 lib/test/esprima/ES6/class/migrated_0020.tree.json create mode 100644 lib/test/esprima/ES6/class/migrated_0021.js create mode 100644 lib/test/esprima/ES6/class/migrated_0021.tree.json create mode 100644 lib/test/esprima/ES6/class/migrated_0022.js create mode 100644 lib/test/esprima/ES6/class/migrated_0022.tree.json create mode 100644 lib/test/esprima/ES6/class/migrated_0023.js create mode 100644 lib/test/esprima/ES6/class/migrated_0023.tree.json create mode 100644 lib/test/esprima/ES6/class/migrated_0024.js create mode 100644 lib/test/esprima/ES6/class/migrated_0024.tree.json create mode 100644 lib/test/esprima/ES6/class/migrated_0025.js create mode 100644 lib/test/esprima/ES6/class/migrated_0025.tree.json create mode 100644 lib/test/esprima/ES6/class/migrated_0026.diff create mode 100644 lib/test/esprima/ES6/class/migrated_0026.js create mode 100644 lib/test/esprima/ES6/class/migrated_0026.tree.json create mode 100644 lib/test/esprima/ES6/default-parameter-value/migrated_0000.js create mode 100644 lib/test/esprima/ES6/default-parameter-value/migrated_0000.tree.json create mode 100644 lib/test/esprima/ES6/default-parameter-value/migrated_0001.js create mode 100644 lib/test/esprima/ES6/default-parameter-value/migrated_0001.tree.json create mode 100644 lib/test/esprima/ES6/default-parameter-value/migrated_0002.js create mode 100644 lib/test/esprima/ES6/default-parameter-value/migrated_0002.tree.json create mode 100644 lib/test/esprima/ES6/destructuring-assignment/array-pattern/dup-assignment.js create mode 100644 lib/test/esprima/ES6/destructuring-assignment/array-pattern/dup-assignment.tree.json create mode 100644 lib/test/esprima/ES6/destructuring-assignment/array-pattern/elision.js create mode 100644 lib/test/esprima/ES6/destructuring-assignment/array-pattern/elision.tree.json create mode 100644 lib/test/esprima/ES6/destructuring-assignment/array-pattern/member-expr-in-rest.js create mode 100644 lib/test/esprima/ES6/destructuring-assignment/array-pattern/member-expr-in-rest.tree.json create mode 100644 lib/test/esprima/ES6/destructuring-assignment/array-pattern/nested-assignment.diff create mode 100644 lib/test/esprima/ES6/destructuring-assignment/array-pattern/nested-assignment.js create mode 100644 lib/test/esprima/ES6/destructuring-assignment/array-pattern/nested-assignment.tree.json create mode 100644 lib/test/esprima/ES6/destructuring-assignment/array-pattern/nested-cover-grammar.js create mode 100644 lib/test/esprima/ES6/destructuring-assignment/array-pattern/nested-cover-grammar.tree.json create mode 100644 lib/test/esprima/ES6/destructuring-assignment/array-pattern/simple-assignment.js create mode 100644 lib/test/esprima/ES6/destructuring-assignment/array-pattern/simple-assignment.tree.json create mode 100644 lib/test/esprima/ES6/destructuring-assignment/invalid-cover-grammar.failure.json create mode 100644 lib/test/esprima/ES6/destructuring-assignment/invalid-cover-grammar.js create mode 100644 lib/test/esprima/ES6/destructuring-assignment/invalid-group-assignment.failure.json create mode 100644 lib/test/esprima/ES6/destructuring-assignment/invalid-group-assignment.js create mode 100644 lib/test/esprima/ES6/destructuring-assignment/object-pattern/empty-object-pattern-assignment.js create mode 100644 lib/test/esprima/ES6/destructuring-assignment/object-pattern/empty-object-pattern-assignment.tree.json create mode 100644 lib/test/esprima/ES6/destructuring-assignment/object-pattern/invalid-lhs-01.failure.json create mode 100644 lib/test/esprima/ES6/destructuring-assignment/object-pattern/invalid-lhs-01.js create mode 100644 lib/test/esprima/ES6/destructuring-assignment/object-pattern/invalid-lhs-02.failure.json create mode 100644 lib/test/esprima/ES6/destructuring-assignment/object-pattern/invalid-lhs-02.js create mode 100644 lib/test/esprima/ES6/destructuring-assignment/object-pattern/invalid-pattern-with-method.failure.json create mode 100644 lib/test/esprima/ES6/destructuring-assignment/object-pattern/invalid-pattern-with-method.js create mode 100644 lib/test/esprima/ES6/destructuring-assignment/object-pattern/nested-cover-grammar.js create mode 100644 lib/test/esprima/ES6/destructuring-assignment/object-pattern/nested-cover-grammar.tree.json create mode 100644 lib/test/esprima/ES6/destructuring-assignment/object-pattern/object-pattern-assignment.diff create mode 100644 lib/test/esprima/ES6/destructuring-assignment/object-pattern/object-pattern-assignment.js create mode 100644 lib/test/esprima/ES6/destructuring-assignment/object-pattern/object-pattern-assignment.tree.json create mode 100644 lib/test/esprima/ES6/export-declaration/export-const-number.js create mode 100644 lib/test/esprima/ES6/export-declaration/export-const-number.tree.json create mode 100644 lib/test/esprima/ES6/export-declaration/export-default-array.js create mode 100644 lib/test/esprima/ES6/export-declaration/export-default-array.tree.json create mode 100644 lib/test/esprima/ES6/export-declaration/export-default-class.js create mode 100644 lib/test/esprima/ES6/export-declaration/export-default-class.tree.json create mode 100644 lib/test/esprima/ES6/export-declaration/export-default-expression.js create mode 100644 lib/test/esprima/ES6/export-declaration/export-default-expression.tree.json create mode 100644 lib/test/esprima/ES6/export-declaration/export-default-function.js create mode 100644 lib/test/esprima/ES6/export-declaration/export-default-function.tree.json create mode 100644 lib/test/esprima/ES6/export-declaration/export-default-named-function.js create mode 100644 lib/test/esprima/ES6/export-declaration/export-default-named-function.tree.json create mode 100644 lib/test/esprima/ES6/export-declaration/export-default-number.js create mode 100644 lib/test/esprima/ES6/export-declaration/export-default-number.tree.json create mode 100644 lib/test/esprima/ES6/export-declaration/export-default-object.js create mode 100644 lib/test/esprima/ES6/export-declaration/export-default-object.tree.json create mode 100644 lib/test/esprima/ES6/export-declaration/export-default-value.js create mode 100644 lib/test/esprima/ES6/export-declaration/export-default-value.tree.json create mode 100644 lib/test/esprima/ES6/export-declaration/export-from-batch.js create mode 100644 lib/test/esprima/ES6/export-declaration/export-from-batch.tree.json create mode 100644 lib/test/esprima/ES6/export-declaration/export-from-default.js create mode 100644 lib/test/esprima/ES6/export-declaration/export-from-default.tree.json create mode 100644 lib/test/esprima/ES6/export-declaration/export-from-named-as-default.js create mode 100644 lib/test/esprima/ES6/export-declaration/export-from-named-as-default.tree.json create mode 100644 lib/test/esprima/ES6/export-declaration/export-from-named-as-specifier.js create mode 100644 lib/test/esprima/ES6/export-declaration/export-from-named-as-specifier.tree.json create mode 100644 lib/test/esprima/ES6/export-declaration/export-from-named-as-specifiers.js create mode 100644 lib/test/esprima/ES6/export-declaration/export-from-named-as-specifiers.tree.json create mode 100644 lib/test/esprima/ES6/export-declaration/export-from-specifier.js create mode 100644 lib/test/esprima/ES6/export-declaration/export-from-specifier.tree.json create mode 100644 lib/test/esprima/ES6/export-declaration/export-from-specifiers.js create mode 100644 lib/test/esprima/ES6/export-declaration/export-from-specifiers.tree.json create mode 100644 lib/test/esprima/ES6/export-declaration/export-function-declaration.js create mode 100644 lib/test/esprima/ES6/export-declaration/export-function-declaration.tree.json create mode 100644 lib/test/esprima/ES6/export-declaration/export-function.js create mode 100644 lib/test/esprima/ES6/export-declaration/export-function.tree.json create mode 100644 lib/test/esprima/ES6/export-declaration/export-let-number.js create mode 100644 lib/test/esprima/ES6/export-declaration/export-let-number.tree.json create mode 100644 lib/test/esprima/ES6/export-declaration/export-named-as-default.js create mode 100644 lib/test/esprima/ES6/export-declaration/export-named-as-default.tree.json create mode 100644 lib/test/esprima/ES6/export-declaration/export-named-as-specifier.js create mode 100644 lib/test/esprima/ES6/export-declaration/export-named-as-specifier.tree.json create mode 100644 lib/test/esprima/ES6/export-declaration/export-named-as-specifiers.js create mode 100644 lib/test/esprima/ES6/export-declaration/export-named-as-specifiers.tree.json create mode 100644 lib/test/esprima/ES6/export-declaration/export-named-empty.js create mode 100644 lib/test/esprima/ES6/export-declaration/export-named-empty.tree.json create mode 100644 lib/test/esprima/ES6/export-declaration/export-named-specifier.js create mode 100644 lib/test/esprima/ES6/export-declaration/export-named-specifier.tree.json create mode 100644 lib/test/esprima/ES6/export-declaration/export-named-specifiers-comma.js create mode 100644 lib/test/esprima/ES6/export-declaration/export-named-specifiers-comma.tree.json create mode 100644 lib/test/esprima/ES6/export-declaration/export-named-specifiers.js create mode 100644 lib/test/esprima/ES6/export-declaration/export-named-specifiers.tree.json create mode 100644 lib/test/esprima/ES6/export-declaration/export-var-anonymous-function.js create mode 100644 lib/test/esprima/ES6/export-declaration/export-var-anonymous-function.tree.json create mode 100644 lib/test/esprima/ES6/export-declaration/export-var-number.js create mode 100644 lib/test/esprima/ES6/export-declaration/export-var-number.tree.json create mode 100644 lib/test/esprima/ES6/export-declaration/export-var.js create mode 100644 lib/test/esprima/ES6/export-declaration/export-var.tree.json create mode 100644 lib/test/esprima/ES6/export-declaration/invalid-export-batch-missing-from-clause.js create mode 100644 lib/test/esprima/ES6/export-declaration/invalid-export-batch-missing-from-clause.module.json create mode 100644 lib/test/esprima/ES6/export-declaration/invalid-export-batch-token.js create mode 100644 lib/test/esprima/ES6/export-declaration/invalid-export-batch-token.module.json create mode 100644 lib/test/esprima/ES6/export-declaration/invalid-export-default-equal.js create mode 100644 lib/test/esprima/ES6/export-declaration/invalid-export-default-equal.module.json create mode 100644 lib/test/esprima/ES6/export-declaration/invalid-export-default-token.js create mode 100644 lib/test/esprima/ES6/export-declaration/invalid-export-default-token.module.json create mode 100644 lib/test/esprima/ES6/export-declaration/invalid-export-default.js create mode 100644 lib/test/esprima/ES6/export-declaration/invalid-export-default.module.json create mode 100644 lib/test/esprima/ES6/export-declaration/invalid-export-named-default.js create mode 100644 lib/test/esprima/ES6/export-declaration/invalid-export-named-default.module.json create mode 100644 lib/test/esprima/ES6/for-of/for-of-array-pattern-let.js create mode 100644 lib/test/esprima/ES6/for-of/for-of-array-pattern-let.tree.json create mode 100644 lib/test/esprima/ES6/for-of/for-of-array-pattern-var.js create mode 100644 lib/test/esprima/ES6/for-of/for-of-array-pattern-var.tree.json create mode 100644 lib/test/esprima/ES6/for-of/for-of-array-pattern.js create mode 100644 lib/test/esprima/ES6/for-of/for-of-array-pattern.tree.json create mode 100644 lib/test/esprima/ES6/for-of/for-of-let.js create mode 100644 lib/test/esprima/ES6/for-of/for-of-let.tree.json create mode 100644 lib/test/esprima/ES6/for-of/for-of-object-pattern-const.js create mode 100644 lib/test/esprima/ES6/for-of/for-of-object-pattern-const.tree.json create mode 100644 lib/test/esprima/ES6/for-of/for-of-object-pattern-var.js create mode 100644 lib/test/esprima/ES6/for-of/for-of-object-pattern-var.tree.json create mode 100644 lib/test/esprima/ES6/for-of/for-of-object-pattern.js create mode 100644 lib/test/esprima/ES6/for-of/for-of-object-pattern.tree.json create mode 100644 lib/test/esprima/ES6/for-of/for-of-with-const.js create mode 100644 lib/test/esprima/ES6/for-of/for-of-with-const.tree.json create mode 100644 lib/test/esprima/ES6/for-of/for-of-with-let.js create mode 100644 lib/test/esprima/ES6/for-of/for-of-with-let.tree.json create mode 100644 lib/test/esprima/ES6/for-of/for-of-with-var.js create mode 100644 lib/test/esprima/ES6/for-of/for-of-with-var.tree.json create mode 100644 lib/test/esprima/ES6/for-of/for-of.js create mode 100644 lib/test/esprima/ES6/for-of/for-of.tree.json create mode 100644 lib/test/esprima/ES6/for-of/invalid-const-init.failure.json create mode 100644 lib/test/esprima/ES6/for-of/invalid-const-init.js create mode 100644 lib/test/esprima/ES6/for-of/invalid-for-of-array-pattern.failure.json create mode 100644 lib/test/esprima/ES6/for-of/invalid-for-of-array-pattern.js create mode 100644 lib/test/esprima/ES6/for-of/invalid-for-of-object-pattern.failure.json create mode 100644 lib/test/esprima/ES6/for-of/invalid-for-of-object-pattern.js create mode 100644 lib/test/esprima/ES6/for-of/invalid-let-init.failure.json create mode 100644 lib/test/esprima/ES6/for-of/invalid-let-init.js create mode 100644 lib/test/esprima/ES6/for-of/invalid-lhs-init.failure.json create mode 100644 lib/test/esprima/ES6/for-of/invalid-lhs-init.js create mode 100644 lib/test/esprima/ES6/for-of/invalid-strict-for-of-let.failure.json create mode 100644 lib/test/esprima/ES6/for-of/invalid-strict-for-of-let.js create mode 100644 lib/test/esprima/ES6/for-of/invalid-var-init.failure.json create mode 100644 lib/test/esprima/ES6/for-of/invalid-var-init.js create mode 100644 lib/test/esprima/ES6/for-of/invalid_const_let.failure.json create mode 100644 lib/test/esprima/ES6/for-of/invalid_const_let.js create mode 100644 lib/test/esprima/ES6/for-of/invalid_let_let.failure.json create mode 100644 lib/test/esprima/ES6/for-of/invalid_let_let.js create mode 100644 lib/test/esprima/ES6/for-of/let-of-of.js create mode 100644 lib/test/esprima/ES6/for-of/let-of-of.tree.json create mode 100644 lib/test/esprima/ES6/for-of/unexpected-number.failure.json create mode 100644 lib/test/esprima/ES6/for-of/unexpected-number.js create mode 100644 lib/test/esprima/ES6/generator/generator-declaration-with-params.js create mode 100644 lib/test/esprima/ES6/generator/generator-declaration-with-params.tree.json create mode 100644 lib/test/esprima/ES6/generator/generator-declaration-with-yield-delegate.js create mode 100644 lib/test/esprima/ES6/generator/generator-declaration-with-yield-delegate.tree.json create mode 100644 lib/test/esprima/ES6/generator/generator-declaration-with-yield.js create mode 100644 lib/test/esprima/ES6/generator/generator-declaration-with-yield.tree.json create mode 100644 lib/test/esprima/ES6/generator/generator-declaration.js create mode 100644 lib/test/esprima/ES6/generator/generator-declaration.tree.json create mode 100644 lib/test/esprima/ES6/generator/generator-expression-rest-param.js create mode 100644 lib/test/esprima/ES6/generator/generator-expression-rest-param.tree.json create mode 100644 lib/test/esprima/ES6/generator/generator-expression-with-params.js create mode 100644 lib/test/esprima/ES6/generator/generator-expression-with-params.tree.json create mode 100644 lib/test/esprima/ES6/generator/generator-expression-with-yield-delegate.js create mode 100644 lib/test/esprima/ES6/generator/generator-expression-with-yield-delegate.tree.json create mode 100644 lib/test/esprima/ES6/generator/generator-expression-with-yield.js create mode 100644 lib/test/esprima/ES6/generator/generator-expression-with-yield.tree.json create mode 100644 lib/test/esprima/ES6/generator/generator-expression.js create mode 100644 lib/test/esprima/ES6/generator/generator-expression.tree.json create mode 100644 lib/test/esprima/ES6/generator/generator-method-with-computed-name.failure.json create mode 100644 lib/test/esprima/ES6/generator/generator-method-with-computed-name.js create mode 100644 lib/test/esprima/ES6/generator/generator-method-with-invalid-computed-name.failure.json create mode 100644 lib/test/esprima/ES6/generator/generator-method-with-invalid-computed-name.js create mode 100644 lib/test/esprima/ES6/generator/generator-method-with-params.js create mode 100644 lib/test/esprima/ES6/generator/generator-method-with-params.tree.json create mode 100644 lib/test/esprima/ES6/generator/generator-method-with-yield-delegate.js create mode 100644 lib/test/esprima/ES6/generator/generator-method-with-yield-delegate.tree.json create mode 100644 lib/test/esprima/ES6/generator/generator-method-with-yield-expression.js create mode 100644 lib/test/esprima/ES6/generator/generator-method-with-yield-expression.tree.json create mode 100644 lib/test/esprima/ES6/generator/generator-method-with-yield-line-terminator.js create mode 100644 lib/test/esprima/ES6/generator/generator-method-with-yield-line-terminator.tree.json create mode 100644 lib/test/esprima/ES6/generator/generator-method-with-yield.js create mode 100644 lib/test/esprima/ES6/generator/generator-method-with-yield.tree.json create mode 100644 lib/test/esprima/ES6/generator/generator-method.js create mode 100644 lib/test/esprima/ES6/generator/generator-method.tree.json create mode 100644 lib/test/esprima/ES6/generator/generator-parameter-binding-element.failure.json create mode 100644 lib/test/esprima/ES6/generator/generator-parameter-binding-element.js create mode 100644 lib/test/esprima/ES6/generator/generator-parameter-binding-property-reserved.failure.json create mode 100644 lib/test/esprima/ES6/generator/generator-parameter-binding-property-reserved.js create mode 100644 lib/test/esprima/ES6/generator/generator-parameter-binding-property.failure.json create mode 100644 lib/test/esprima/ES6/generator/generator-parameter-binding-property.js create mode 100644 lib/test/esprima/ES6/generator/generator-parameter-computed-property-name.failure.json create mode 100644 lib/test/esprima/ES6/generator/generator-parameter-computed-property-name.js create mode 100644 lib/test/esprima/ES6/generator/generator-parameter-invalid-binding-element.failure.json create mode 100644 lib/test/esprima/ES6/generator/generator-parameter-invalid-binding-element.js create mode 100644 lib/test/esprima/ES6/generator/generator-parameter-invalid-binding-property.failure.json create mode 100644 lib/test/esprima/ES6/generator/generator-parameter-invalid-binding-property.js create mode 100644 lib/test/esprima/ES6/generator/generator-parameter-invalid-computed-property-name.failure.json create mode 100644 lib/test/esprima/ES6/generator/generator-parameter-invalid-computed-property-name.js create mode 100644 lib/test/esprima/ES6/generator/incomplete-yield-delegate.failure.json create mode 100644 lib/test/esprima/ES6/generator/incomplete-yield-delegate.js create mode 100644 lib/test/esprima/ES6/generator/malformed-generator-method-2.failure.json create mode 100644 lib/test/esprima/ES6/generator/malformed-generator-method-2.js create mode 100644 lib/test/esprima/ES6/generator/malformed-generator-method.failure.json create mode 100644 lib/test/esprima/ES6/generator/malformed-generator-method.js create mode 100644 lib/test/esprima/ES6/generator/static-generator-method-with-computed-name.js create mode 100644 lib/test/esprima/ES6/generator/static-generator-method-with-computed-name.tree.json create mode 100644 lib/test/esprima/ES6/generator/static-generator-method.js create mode 100644 lib/test/esprima/ES6/generator/static-generator-method.tree.json create mode 100644 lib/test/esprima/ES6/identifier/dakuten_handakuten.js create mode 100644 lib/test/esprima/ES6/identifier/dakuten_handakuten.tree.json create mode 100644 lib/test/esprima/ES6/identifier/escaped_all.js create mode 100644 lib/test/esprima/ES6/identifier/escaped_all.tree.json create mode 100644 lib/test/esprima/ES6/identifier/escaped_math_alef.js create mode 100644 lib/test/esprima/ES6/identifier/escaped_math_alef.tree.json create mode 100644 lib/test/esprima/ES6/identifier/escaped_math_dal_part.js create mode 100644 lib/test/esprima/ES6/identifier/escaped_math_dal_part.tree.json create mode 100644 lib/test/esprima/ES6/identifier/escaped_math_kaf_lam.js create mode 100644 lib/test/esprima/ES6/identifier/escaped_math_kaf_lam.tree.json create mode 100644 lib/test/esprima/ES6/identifier/escaped_math_zain_start.js create mode 100644 lib/test/esprima/ES6/identifier/escaped_math_zain_start.tree.json create mode 100644 lib/test/esprima/ES6/identifier/escaped_part.js create mode 100644 lib/test/esprima/ES6/identifier/escaped_part.tree.json create mode 100644 lib/test/esprima/ES6/identifier/escaped_start.js create mode 100644 lib/test/esprima/ES6/identifier/escaped_start.tree.json create mode 100644 lib/test/esprima/ES6/identifier/estimated.js create mode 100644 lib/test/esprima/ES6/identifier/estimated.tree.json create mode 100644 lib/test/esprima/ES6/identifier/ethiopic_digits.js create mode 100644 lib/test/esprima/ES6/identifier/ethiopic_digits.tree.json create mode 100644 lib/test/esprima/ES6/identifier/invalid_escaped_surrogate_pairs.failure.json create mode 100644 lib/test/esprima/ES6/identifier/invalid_escaped_surrogate_pairs.js create mode 100644 lib/test/esprima/ES6/identifier/invalid_expression_await.js create mode 100644 lib/test/esprima/ES6/identifier/invalid_expression_await.module.json create mode 100644 lib/test/esprima/ES6/identifier/invalid_function_wait.js create mode 100644 lib/test/esprima/ES6/identifier/invalid_function_wait.module.json create mode 100644 lib/test/esprima/ES6/identifier/invalid_id_smp.failure.json create mode 100644 lib/test/esprima/ES6/identifier/invalid_id_smp.js create mode 100644 lib/test/esprima/ES6/identifier/invalid_lone_surrogate.failure.json create mode 100644 lib/test/esprima/ES6/identifier/invalid_lone_surrogate.source.js create mode 100644 lib/test/esprima/ES6/identifier/invalid_var_await.js create mode 100644 lib/test/esprima/ES6/identifier/invalid_var_await.module.json create mode 100644 lib/test/esprima/ES6/identifier/math_alef.js create mode 100644 lib/test/esprima/ES6/identifier/math_alef.skip create mode 100644 lib/test/esprima/ES6/identifier/math_alef.tree.json create mode 100644 lib/test/esprima/ES6/identifier/math_dal_part.js create mode 100644 lib/test/esprima/ES6/identifier/math_dal_part.skip create mode 100644 lib/test/esprima/ES6/identifier/math_dal_part.tree.json create mode 100644 lib/test/esprima/ES6/identifier/math_kaf_lam.js create mode 100644 lib/test/esprima/ES6/identifier/math_kaf_lam.skip create mode 100644 lib/test/esprima/ES6/identifier/math_kaf_lam.tree.json create mode 100644 lib/test/esprima/ES6/identifier/math_zain_start.js create mode 100644 lib/test/esprima/ES6/identifier/math_zain_start.skip create mode 100644 lib/test/esprima/ES6/identifier/math_zain_start.tree.json create mode 100644 lib/test/esprima/ES6/identifier/module_await.js create mode 100644 lib/test/esprima/ES6/identifier/module_await.skip create mode 100644 lib/test/esprima/ES6/identifier/module_await.tree.json create mode 100644 lib/test/esprima/ES6/identifier/valid_await.js create mode 100644 lib/test/esprima/ES6/identifier/valid_await.tree.json create mode 100644 lib/test/esprima/ES6/identifier/weierstrass.js create mode 100644 lib/test/esprima/ES6/identifier/weierstrass.tree.json create mode 100644 lib/test/esprima/ES6/identifier/weierstrass_weierstrass.js create mode 100644 lib/test/esprima/ES6/identifier/weierstrass_weierstrass.tree.json create mode 100644 lib/test/esprima/ES6/import-declaration/import-default-and-named-specifiers.js create mode 100644 lib/test/esprima/ES6/import-declaration/import-default-and-named-specifiers.tree.json create mode 100644 lib/test/esprima/ES6/import-declaration/import-default-and-namespace-specifiers.js create mode 100644 lib/test/esprima/ES6/import-declaration/import-default-and-namespace-specifiers.tree.json create mode 100644 lib/test/esprima/ES6/import-declaration/import-default-as.js create mode 100644 lib/test/esprima/ES6/import-declaration/import-default-as.tree.json create mode 100644 lib/test/esprima/ES6/import-declaration/import-default.js create mode 100644 lib/test/esprima/ES6/import-declaration/import-default.tree.json create mode 100644 lib/test/esprima/ES6/import-declaration/import-jquery.js create mode 100644 lib/test/esprima/ES6/import-declaration/import-jquery.tree.json create mode 100644 lib/test/esprima/ES6/import-declaration/import-module.js create mode 100644 lib/test/esprima/ES6/import-declaration/import-module.tree.json create mode 100644 lib/test/esprima/ES6/import-declaration/import-named-as-specifier.js create mode 100644 lib/test/esprima/ES6/import-declaration/import-named-as-specifier.tree.json create mode 100644 lib/test/esprima/ES6/import-declaration/import-named-as-specifiers.js create mode 100644 lib/test/esprima/ES6/import-declaration/import-named-as-specifiers.tree.json create mode 100644 lib/test/esprima/ES6/import-declaration/import-named-empty.js create mode 100644 lib/test/esprima/ES6/import-declaration/import-named-empty.tree.json create mode 100644 lib/test/esprima/ES6/import-declaration/import-named-specifier.js create mode 100644 lib/test/esprima/ES6/import-declaration/import-named-specifier.tree.json create mode 100644 lib/test/esprima/ES6/import-declaration/import-named-specifiers-comma.js create mode 100644 lib/test/esprima/ES6/import-declaration/import-named-specifiers-comma.tree.json create mode 100644 lib/test/esprima/ES6/import-declaration/import-named-specifiers.js create mode 100644 lib/test/esprima/ES6/import-declaration/import-named-specifiers.tree.json create mode 100644 lib/test/esprima/ES6/import-declaration/import-namespace-specifier.js create mode 100644 lib/test/esprima/ES6/import-declaration/import-namespace-specifier.tree.json create mode 100644 lib/test/esprima/ES6/import-declaration/import-null-as-nil.js create mode 100644 lib/test/esprima/ES6/import-declaration/import-null-as-nil.tree.json create mode 100644 lib/test/esprima/ES6/import-declaration/invalid-import-default-after-named-after-default.js create mode 100644 lib/test/esprima/ES6/import-declaration/invalid-import-default-after-named-after-default.module.json create mode 100644 lib/test/esprima/ES6/import-declaration/invalid-import-default-after-named.js create mode 100644 lib/test/esprima/ES6/import-declaration/invalid-import-default-after-named.module.json create mode 100644 lib/test/esprima/ES6/import-declaration/invalid-import-default-missing-module-specifier.js create mode 100644 lib/test/esprima/ES6/import-declaration/invalid-import-default-missing-module-specifier.module.json create mode 100644 lib/test/esprima/ES6/import-declaration/invalid-import-default-module-specifier.js create mode 100644 lib/test/esprima/ES6/import-declaration/invalid-import-default-module-specifier.module.json create mode 100644 lib/test/esprima/ES6/import-declaration/invalid-import-default.js create mode 100644 lib/test/esprima/ES6/import-declaration/invalid-import-default.module.json create mode 100644 lib/test/esprima/ES6/import-declaration/invalid-import-missing-comma.js create mode 100644 lib/test/esprima/ES6/import-declaration/invalid-import-missing-comma.module.json create mode 100644 lib/test/esprima/ES6/import-declaration/invalid-import-missing-module-specifier.js create mode 100644 lib/test/esprima/ES6/import-declaration/invalid-import-missing-module-specifier.module.json create mode 100644 lib/test/esprima/ES6/import-declaration/invalid-import-module-specifier.js create mode 100644 lib/test/esprima/ES6/import-declaration/invalid-import-module-specifier.module.json create mode 100644 lib/test/esprima/ES6/import-declaration/invalid-import-named-after-named.js create mode 100644 lib/test/esprima/ES6/import-declaration/invalid-import-named-after-named.module.json create mode 100644 lib/test/esprima/ES6/import-declaration/invalid-import-named-after-namespace.js create mode 100644 lib/test/esprima/ES6/import-declaration/invalid-import-named-after-namespace.module.json create mode 100644 lib/test/esprima/ES6/import-declaration/invalid-import-named-as-missing-from.js create mode 100644 lib/test/esprima/ES6/import-declaration/invalid-import-named-as-missing-from.module.json create mode 100644 lib/test/esprima/ES6/import-declaration/invalid-import-namespace-after-named.js create mode 100644 lib/test/esprima/ES6/import-declaration/invalid-import-namespace-after-named.module.json create mode 100644 lib/test/esprima/ES6/import-declaration/invalid-import-namespace-missing-as.js create mode 100644 lib/test/esprima/ES6/import-declaration/invalid-import-namespace-missing-as.module.json create mode 100644 lib/test/esprima/ES6/import-declaration/invalid-import-specifiers.js create mode 100644 lib/test/esprima/ES6/import-declaration/invalid-import-specifiers.module.json create mode 100644 lib/test/esprima/ES6/lexical-declaration/for_let_in.js create mode 100644 lib/test/esprima/ES6/lexical-declaration/for_let_in.skip create mode 100644 lib/test/esprima/ES6/lexical-declaration/for_let_in.tree.json create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_complex_binding_without_init.failure.json create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_complex_binding_without_init.js create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_const_const.failure.json create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_const_const.js create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_const_forin.failure.json create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_const_forin.js create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_const_let.failure.json create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_const_let.js create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_for_const_declarations.failure.json create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_for_const_declarations.js create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_for_const_let.failure.json create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_for_const_let.js create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_for_let_declarations.failure.json create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_for_let_declarations.js create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_for_let_init.failure.json create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_for_let_init.js create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_for_let_let.failure.json create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_for_let_let.js create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_for_let_pattern.failure.json create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_for_let_pattern.js create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_forin_const_let.failure.json create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_forin_const_let.js create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_forin_let_let.failure.json create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_forin_let_let.js create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_let_declarations.failure.json create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_let_declarations.js create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_let_for_in.failure.json create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_let_for_in.js create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_let_forin.failure.json create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_let_forin.js create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_let_init.failure.json create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_let_init.js create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_let_let.failure.json create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_let_let.js create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_strict_const_const.failure.json create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_strict_const_const.js create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_strict_const_let.failure.json create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_strict_const_let.js create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_1.failure.json create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_1.js create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_2.failure.json create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_2.js create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_3.failure.json create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_3.js create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_4.failure.json create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_4.js create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_5.failure.json create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_5.js create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_6.failure.json create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_6.js create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_7.failure.json create mode 100644 lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_7.js create mode 100644 lib/test/esprima/ES6/lexical-declaration/let_assign.js create mode 100644 lib/test/esprima/ES6/lexical-declaration/let_assign.skip create mode 100644 lib/test/esprima/ES6/lexical-declaration/let_assign.tree.json create mode 100644 lib/test/esprima/ES6/lexical-declaration/let_identifier.js create mode 100644 lib/test/esprima/ES6/lexical-declaration/let_identifier.skip create mode 100644 lib/test/esprima/ES6/lexical-declaration/let_identifier.tree.json create mode 100644 lib/test/esprima/ES6/lexical-declaration/let_member.js create mode 100644 lib/test/esprima/ES6/lexical-declaration/let_member.skip create mode 100644 lib/test/esprima/ES6/lexical-declaration/let_member.tree.json create mode 100644 lib/test/esprima/ES6/lexical-declaration/migrated_0000.js create mode 100644 lib/test/esprima/ES6/lexical-declaration/migrated_0000.tree.json create mode 100644 lib/test/esprima/ES6/lexical-declaration/module_let.js create mode 100644 lib/test/esprima/ES6/lexical-declaration/module_let.tree.json create mode 100644 lib/test/esprima/ES6/meta-property/assign-new-target.js create mode 100644 lib/test/esprima/ES6/meta-property/assign-new-target.tree.json create mode 100644 lib/test/esprima/ES6/meta-property/invalid-dots.failure.json create mode 100644 lib/test/esprima/ES6/meta-property/invalid-dots.js create mode 100644 lib/test/esprima/ES6/meta-property/invalid-new-target.failure.json create mode 100644 lib/test/esprima/ES6/meta-property/invalid-new-target.js create mode 100644 lib/test/esprima/ES6/meta-property/new-new-target.js create mode 100644 lib/test/esprima/ES6/meta-property/new-new-target.tree.json create mode 100644 lib/test/esprima/ES6/meta-property/new-target-declaration.js create mode 100644 lib/test/esprima/ES6/meta-property/new-target-declaration.tree.json create mode 100644 lib/test/esprima/ES6/meta-property/new-target-expression.js create mode 100644 lib/test/esprima/ES6/meta-property/new-target-expression.tree.json create mode 100644 lib/test/esprima/ES6/meta-property/new-target-invoke.js create mode 100644 lib/test/esprima/ES6/meta-property/new-target-invoke.tree.json create mode 100644 lib/test/esprima/ES6/meta-property/new-target-precedence.js create mode 100644 lib/test/esprima/ES6/meta-property/new-target-precedence.tree.json create mode 100644 lib/test/esprima/ES6/meta-property/unknown-property.failure.json create mode 100644 lib/test/esprima/ES6/meta-property/unknown-property.js create mode 100644 lib/test/esprima/ES6/method-definition/migrated_0000.js create mode 100644 lib/test/esprima/ES6/method-definition/migrated_0000.tree.json create mode 100644 lib/test/esprima/ES6/method-definition/migrated_0001.js create mode 100644 lib/test/esprima/ES6/method-definition/migrated_0001.tree.json create mode 100644 lib/test/esprima/ES6/method-definition/migrated_0002.js create mode 100644 lib/test/esprima/ES6/method-definition/migrated_0002.tree.json create mode 100644 lib/test/esprima/ES6/method-definition/migrated_0003.js create mode 100644 lib/test/esprima/ES6/method-definition/migrated_0003.tree.json create mode 100644 lib/test/esprima/ES6/method-definition/migrated_0004.js create mode 100644 lib/test/esprima/ES6/method-definition/migrated_0004.tree.json create mode 100644 lib/test/esprima/ES6/object-initialiser/invalid-proto-getter-literal-identifier.failure.json create mode 100644 lib/test/esprima/ES6/object-initialiser/invalid-proto-getter-literal-identifier.js create mode 100644 lib/test/esprima/ES6/object-initialiser/invalid-proto-identifier-literal.failure.json create mode 100644 lib/test/esprima/ES6/object-initialiser/invalid-proto-identifier-literal.js create mode 100644 lib/test/esprima/ES6/object-initialiser/invalid-proto-identifier-shorthand.failure.json create mode 100644 lib/test/esprima/ES6/object-initialiser/invalid-proto-identifier-shorthand.js create mode 100644 lib/test/esprima/ES6/object-initialiser/invalid-proto-identifiers.failure.json create mode 100644 lib/test/esprima/ES6/object-initialiser/invalid-proto-identifiers.js create mode 100644 lib/test/esprima/ES6/object-initialiser/invalid-proto-literal-identifier.failure.json create mode 100644 lib/test/esprima/ES6/object-initialiser/invalid-proto-literal-identifier.js create mode 100644 lib/test/esprima/ES6/object-initialiser/invalid-proto-literal-shorthand.failure.json create mode 100644 lib/test/esprima/ES6/object-initialiser/invalid-proto-literal-shorthand.js create mode 100644 lib/test/esprima/ES6/object-initialiser/invalid-proto-literals.failure.json create mode 100644 lib/test/esprima/ES6/object-initialiser/invalid-proto-literals.js create mode 100644 lib/test/esprima/ES6/object-initialiser/invalid-proto-setter-literal-identifier.failure.json create mode 100644 lib/test/esprima/ES6/object-initialiser/invalid-proto-setter-literal-identifier.js create mode 100644 lib/test/esprima/ES6/object-initialiser/invalid-proto-shorthand-identifier.failure.json create mode 100644 lib/test/esprima/ES6/object-initialiser/invalid-proto-shorthand-identifier.js create mode 100644 lib/test/esprima/ES6/object-initialiser/invalid-proto-shorthand-literal.failure.json create mode 100644 lib/test/esprima/ES6/object-initialiser/invalid-proto-shorthand-literal.js create mode 100644 lib/test/esprima/ES6/object-initialiser/invalid-proto-shorthands.failure.json create mode 100644 lib/test/esprima/ES6/object-initialiser/invalid-proto-shorthands.js create mode 100644 lib/test/esprima/ES6/object-initialiser/proto-identifier-getter-setter.js create mode 100644 lib/test/esprima/ES6/object-initialiser/proto-identifier-getter-setter.tree.json create mode 100644 lib/test/esprima/ES6/object-initialiser/proto-identifier-getter.js create mode 100644 lib/test/esprima/ES6/object-initialiser/proto-identifier-getter.tree.json create mode 100644 lib/test/esprima/ES6/object-initialiser/proto-identifier-method.js create mode 100644 lib/test/esprima/ES6/object-initialiser/proto-identifier-method.tree.json create mode 100644 lib/test/esprima/ES6/object-initialiser/proto-identifier-setter.js create mode 100644 lib/test/esprima/ES6/object-initialiser/proto-identifier-setter.tree.json create mode 100644 lib/test/esprima/ES6/object-initialiser/proto-literal-getter-setter.js create mode 100644 lib/test/esprima/ES6/object-initialiser/proto-literal-getter-setter.tree.json create mode 100644 lib/test/esprima/ES6/object-initialiser/proto-literal-getter.js create mode 100644 lib/test/esprima/ES6/object-initialiser/proto-literal-getter.tree.json create mode 100644 lib/test/esprima/ES6/object-initialiser/proto-literal-method.js create mode 100644 lib/test/esprima/ES6/object-initialiser/proto-literal-method.tree.json create mode 100644 lib/test/esprima/ES6/object-initialiser/proto-literal-setter.js create mode 100644 lib/test/esprima/ES6/object-initialiser/proto-literal-setter.tree.json create mode 100644 lib/test/esprima/ES6/object-literal-property-value-shorthand/migrated_0000.js create mode 100644 lib/test/esprima/ES6/object-literal-property-value-shorthand/migrated_0000.tree.json create mode 100644 lib/test/esprima/ES6/octal-integer-literal/migrated_0000.js create mode 100644 lib/test/esprima/ES6/octal-integer-literal/migrated_0000.tree.json create mode 100644 lib/test/esprima/ES6/octal-integer-literal/migrated_0001.js create mode 100644 lib/test/esprima/ES6/octal-integer-literal/migrated_0001.tree.json create mode 100644 lib/test/esprima/ES6/octal-integer-literal/migrated_0002.js create mode 100644 lib/test/esprima/ES6/octal-integer-literal/migrated_0002.tree.json create mode 100644 lib/test/esprima/ES6/octal-integer-literal/migrated_0003.js create mode 100644 lib/test/esprima/ES6/octal-integer-literal/migrated_0003.tree.json create mode 100644 lib/test/esprima/ES6/octal-integer-literal/migrated_0004.js create mode 100644 lib/test/esprima/ES6/octal-integer-literal/migrated_0004.tree.json create mode 100644 lib/test/esprima/ES6/octal-integer-literal/migrated_0005.js create mode 100644 lib/test/esprima/ES6/octal-integer-literal/migrated_0005.tree.json create mode 100644 lib/test/esprima/ES6/octal-integer-literal/migrated_0006.js create mode 100644 lib/test/esprima/ES6/octal-integer-literal/migrated_0006.tree.json create mode 100644 lib/test/esprima/ES6/rest-parameter/function-declaration.js create mode 100644 lib/test/esprima/ES6/rest-parameter/function-declaration.tree.json create mode 100644 lib/test/esprima/ES6/rest-parameter/function-expression.js create mode 100644 lib/test/esprima/ES6/rest-parameter/function-expression.tree.json create mode 100644 lib/test/esprima/ES6/rest-parameter/object-method.js create mode 100644 lib/test/esprima/ES6/rest-parameter/object-method.tree.json create mode 100644 lib/test/esprima/ES6/rest-parameter/object-shorthand-method.js create mode 100644 lib/test/esprima/ES6/rest-parameter/object-shorthand-method.tree.json create mode 100644 lib/test/esprima/ES6/rest-property/assignment-with-trailing.js create mode 100644 lib/test/esprima/ES6/rest-property/assignment-with-trailing.tree.json create mode 100644 lib/test/esprima/ES6/rest-property/assignment.diff create mode 100644 lib/test/esprima/ES6/rest-property/assignment.js create mode 100644 lib/test/esprima/ES6/rest-property/assignment.tree.json create mode 100644 lib/test/esprima/ES6/rest-property/let-assignment-with-trailing-comma.diff create mode 100644 lib/test/esprima/ES6/rest-property/let-assignment-with-trailing-comma.js create mode 100644 lib/test/esprima/ES6/rest-property/let-assignment-with-trailing-comma.tree.json create mode 100644 lib/test/esprima/ES6/rest-property/let-assignment-with-trailing.diff create mode 100644 lib/test/esprima/ES6/rest-property/let-assignment-with-trailing.js create mode 100644 lib/test/esprima/ES6/rest-property/let-assignment-with-trailing.tree.json create mode 100644 lib/test/esprima/ES6/rest-property/let-assignment.diff create mode 100644 lib/test/esprima/ES6/rest-property/let-assignment.js create mode 100644 lib/test/esprima/ES6/rest-property/let-assignment.tree.json create mode 100644 lib/test/esprima/ES6/spread-element/call-multi-spread.js create mode 100644 lib/test/esprima/ES6/spread-element/call-multi-spread.tree.json create mode 100644 lib/test/esprima/ES6/spread-element/call-spread-default.js create mode 100644 lib/test/esprima/ES6/spread-element/call-spread-default.tree.json create mode 100644 lib/test/esprima/ES6/spread-element/call-spread-first.js create mode 100644 lib/test/esprima/ES6/spread-element/call-spread-first.tree.json create mode 100644 lib/test/esprima/ES6/spread-element/call-spread-number.js create mode 100644 lib/test/esprima/ES6/spread-element/call-spread-number.tree.json create mode 100644 lib/test/esprima/ES6/spread-element/call-spread.js create mode 100644 lib/test/esprima/ES6/spread-element/call-spread.tree.json create mode 100644 lib/test/esprima/ES6/spread-element/invalid-call-dot-dot.failure.json create mode 100644 lib/test/esprima/ES6/spread-element/invalid-call-dot-dot.js create mode 100644 lib/test/esprima/ES6/spread-element/invalid-call-dots.failure.json create mode 100644 lib/test/esprima/ES6/spread-element/invalid-call-dots.js create mode 100644 lib/test/esprima/ES6/spread-element/invalid-call-spreads.failure.json create mode 100644 lib/test/esprima/ES6/spread-element/invalid-call-spreads.js create mode 100644 lib/test/esprima/ES6/spread-element/invalid-new-dot-dot.failure.json create mode 100644 lib/test/esprima/ES6/spread-element/invalid-new-dot-dot.js create mode 100644 lib/test/esprima/ES6/spread-element/invalid-new-dots.failure.json create mode 100644 lib/test/esprima/ES6/spread-element/invalid-new-dots.js create mode 100644 lib/test/esprima/ES6/spread-element/invalid-new-spreads.failure.json create mode 100644 lib/test/esprima/ES6/spread-element/invalid-new-spreads.js create mode 100644 lib/test/esprima/ES6/spread-element/new-multi-spread.js create mode 100644 lib/test/esprima/ES6/spread-element/new-multi-spread.tree.json create mode 100644 lib/test/esprima/ES6/spread-element/new-spread-default.js create mode 100644 lib/test/esprima/ES6/spread-element/new-spread-default.tree.json create mode 100644 lib/test/esprima/ES6/spread-element/new-spread-first.js create mode 100644 lib/test/esprima/ES6/spread-element/new-spread-first.tree.json create mode 100644 lib/test/esprima/ES6/spread-element/new-spread-number.js create mode 100644 lib/test/esprima/ES6/spread-element/new-spread-number.tree.json create mode 100644 lib/test/esprima/ES6/spread-element/new-spread.js create mode 100644 lib/test/esprima/ES6/spread-element/new-spread.tree.json create mode 100644 lib/test/esprima/ES6/super-property/arrow_super.js create mode 100644 lib/test/esprima/ES6/super-property/arrow_super.tree.json create mode 100644 lib/test/esprima/ES6/super-property/constructor_super.js create mode 100644 lib/test/esprima/ES6/super-property/constructor_super.tree.json create mode 100644 lib/test/esprima/ES6/super-property/invalid_super_access.failure.json create mode 100644 lib/test/esprima/ES6/super-property/invalid_super_access.js create mode 100644 lib/test/esprima/ES6/super-property/invalid_super_id.failure.json create mode 100644 lib/test/esprima/ES6/super-property/invalid_super_id.js create mode 100644 lib/test/esprima/ES6/super-property/invalid_super_not_inside_function.failure.json create mode 100644 lib/test/esprima/ES6/super-property/invalid_super_not_inside_function.js create mode 100644 lib/test/esprima/ES6/super-property/new_super.js create mode 100644 lib/test/esprima/ES6/super-property/new_super.tree.json create mode 100644 lib/test/esprima/ES6/super-property/super_computed.js create mode 100644 lib/test/esprima/ES6/super-property/super_computed.tree.json create mode 100644 lib/test/esprima/ES6/super-property/super_member.js create mode 100644 lib/test/esprima/ES6/super-property/super_member.tree.json create mode 100644 lib/test/esprima/ES6/template-literals/after-switch.failure.json create mode 100644 lib/test/esprima/ES6/template-literals/after-switch.js create mode 100644 lib/test/esprima/ES6/template-literals/dollar-sign.js create mode 100644 lib/test/esprima/ES6/template-literals/dollar-sign.tree.json create mode 100644 lib/test/esprima/ES6/template-literals/escape-sequences.source.js create mode 100644 lib/test/esprima/ES6/template-literals/escape-sequences.tree.json create mode 100644 lib/test/esprima/ES6/template-literals/invalid-escape.failure.json create mode 100644 lib/test/esprima/ES6/template-literals/invalid-escape.js create mode 100644 lib/test/esprima/ES6/template-literals/line-terminators.source.js create mode 100644 lib/test/esprima/ES6/template-literals/line-terminators.tree.json create mode 100644 lib/test/esprima/ES6/template-literals/literal-escape-sequences.source.js create mode 100644 lib/test/esprima/ES6/template-literals/literal-escape-sequences.tree.json create mode 100644 lib/test/esprima/ES6/template-literals/new-expression.js create mode 100644 lib/test/esprima/ES6/template-literals/new-expression.tree.json create mode 100644 lib/test/esprima/ES6/template-literals/octal-literal.failure.json create mode 100644 lib/test/esprima/ES6/template-literals/octal-literal.js create mode 100644 lib/test/esprima/ES6/template-literals/strict-octal-literal.failure.json create mode 100644 lib/test/esprima/ES6/template-literals/strict-octal-literal.js create mode 100644 lib/test/esprima/ES6/template-literals/tagged-interpolation.js create mode 100644 lib/test/esprima/ES6/template-literals/tagged-interpolation.tree.json create mode 100644 lib/test/esprima/ES6/template-literals/tagged-nested-with-object-literal.js create mode 100644 lib/test/esprima/ES6/template-literals/tagged-nested-with-object-literal.tree.json create mode 100644 lib/test/esprima/ES6/template-literals/tagged.js create mode 100644 lib/test/esprima/ES6/template-literals/tagged.tree.json create mode 100644 lib/test/esprima/ES6/template-literals/unclosed-interpolation.failure.json create mode 100644 lib/test/esprima/ES6/template-literals/unclosed-interpolation.js create mode 100644 lib/test/esprima/ES6/template-literals/unclosed-nested.failure.json create mode 100644 lib/test/esprima/ES6/template-literals/unclosed-nested.js create mode 100644 lib/test/esprima/ES6/template-literals/unclosed.failure.json create mode 100644 lib/test/esprima/ES6/template-literals/unclosed.js create mode 100644 lib/test/esprima/ES6/template-literals/untagged.js create mode 100644 lib/test/esprima/ES6/template-literals/untagged.tree.json create mode 100644 lib/test/esprima/ES6/unicode-code-point-escape-sequence/migrated_0000.source.js create mode 100644 lib/test/esprima/ES6/unicode-code-point-escape-sequence/migrated_0000.tree.json create mode 100644 lib/test/esprima/ES6/unicode-code-point-escape-sequence/migrated_0001.source.js create mode 100644 lib/test/esprima/ES6/unicode-code-point-escape-sequence/migrated_0001.tree.json create mode 100644 lib/test/esprima/ES6/unicode-code-point-escape-sequence/migrated_0002.source.js create mode 100644 lib/test/esprima/ES6/unicode-code-point-escape-sequence/migrated_0002.tree.json create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-binding-property.failure.json create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-binding-property.js create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-expression.failure.json create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-expression.js create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-arrow-default.failure.json create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-arrow-default.js create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-arrow-parameter.failure.json create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-arrow-parameter.js create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-arrow-parameters.failure.json create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-arrow-parameters.js create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-catch.failure.json create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-catch.js create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-declaration.failure.json create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-declaration.js create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-export-default.js create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-export-default.module.json create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-expression-name.failure.json create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-expression-name.js create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-expression-parameter.failure.json create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-expression-parameter.js create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-expression-rest.failure.json create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-expression-rest.js create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-function-declaration.failure.json create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-function-declaration.js create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-lexical-declaration.failure.json create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-lexical-declaration.js create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-member-expression.failure.json create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-member-expression.js create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-parameter.failure.json create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-parameter.js create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-rest.failure.json create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-rest.js create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-strict-function-expression.failure.json create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-strict-function-expression.js create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-strict-function-parameter.failure.json create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-strict-function-parameter.js create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-variable-declaration.failure.json create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-generator-variable-declaration.js create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-strict-array-pattern.failure.json create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-strict-array-pattern.js create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-strict-arrow-parameter-default.failure.json create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-strict-arrow-parameter-default.js create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-strict-arrow-parameter-name.failure.json create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-strict-arrow-parameter-name.js create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-strict-binding-element.failure.json create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-strict-binding-element.js create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-strict-catch-parameter.failure.json create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-strict-catch-parameter.js create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-strict-formal-parameter.failure.json create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-strict-formal-parameter.js create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-strict-function-declaration.failure.json create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-strict-function-declaration.js create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-strict-function-expression.failure.json create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-strict-function-expression.js create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-strict-identifier.failure.json create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-strict-identifier.js create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-strict-lexical-declaration.failure.json create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-strict-lexical-declaration.js create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-strict-rest-parameter.failure.json create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-strict-rest-parameter.js create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-strict-variable-declaration.failure.json create mode 100644 lib/test/esprima/ES6/yield/invalid-yield-strict-variable-declaration.js create mode 100644 lib/test/esprima/ES6/yield/yield-array-pattern.js create mode 100644 lib/test/esprima/ES6/yield/yield-array-pattern.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-arrow-concise-body.js create mode 100644 lib/test/esprima/ES6/yield/yield-arrow-concise-body.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-arrow-function-body.diff create mode 100644 lib/test/esprima/ES6/yield/yield-arrow-function-body.js create mode 100644 lib/test/esprima/ES6/yield/yield-arrow-function-body.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-arrow-parameter-default.js create mode 100644 lib/test/esprima/ES6/yield/yield-arrow-parameter-default.skip create mode 100644 lib/test/esprima/ES6/yield/yield-arrow-parameter-default.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-arrow-parameter-name.js create mode 100644 lib/test/esprima/ES6/yield/yield-arrow-parameter-name.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-binding-element.js create mode 100644 lib/test/esprima/ES6/yield/yield-binding-element.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-binding-property.js create mode 100644 lib/test/esprima/ES6/yield/yield-binding-property.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-call-expression-property.js create mode 100644 lib/test/esprima/ES6/yield/yield-call-expression-property.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-catch-parameter.js create mode 100644 lib/test/esprima/ES6/yield/yield-catch-parameter.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-expression-precedence.diff create mode 100644 lib/test/esprima/ES6/yield/yield-expression-precedence.js create mode 100644 lib/test/esprima/ES6/yield/yield-expression-precedence.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-function-declaration-formal-parameter.js create mode 100644 lib/test/esprima/ES6/yield/yield-function-declaration-formal-parameter.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-function-declaration.js create mode 100644 lib/test/esprima/ES6/yield/yield-function-declaration.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-function-expression-parameter.js create mode 100644 lib/test/esprima/ES6/yield/yield-function-expression-parameter.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-function-expression.js create mode 100644 lib/test/esprima/ES6/yield/yield-function-expression.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-generator-arrow-concise-body.js create mode 100644 lib/test/esprima/ES6/yield/yield-generator-arrow-concise-body.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-generator-arrow-default.js create mode 100644 lib/test/esprima/ES6/yield/yield-generator-arrow-default.skip create mode 100644 lib/test/esprima/ES6/yield/yield-generator-arrow-default.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-generator-arrow-function-body.diff create mode 100644 lib/test/esprima/ES6/yield/yield-generator-arrow-function-body.js create mode 100644 lib/test/esprima/ES6/yield/yield-generator-arrow-function-body.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-generator-declaration.js create mode 100644 lib/test/esprima/ES6/yield/yield-generator-declaration.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-generator-default-parameter.diff create mode 100644 lib/test/esprima/ES6/yield/yield-generator-default-parameter.js create mode 100644 lib/test/esprima/ES6/yield/yield-generator-default-parameter.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-generator-function-expression.js create mode 100644 lib/test/esprima/ES6/yield/yield-generator-function-expression.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-generator-function-parameter.diff create mode 100644 lib/test/esprima/ES6/yield/yield-generator-function-parameter.js create mode 100644 lib/test/esprima/ES6/yield/yield-generator-function-parameter.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-generator-method.js create mode 100644 lib/test/esprima/ES6/yield/yield-generator-method.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-generator-parameter-object-pattern.js create mode 100644 lib/test/esprima/ES6/yield/yield-generator-parameter-object-pattern.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-lexical-declaration.js create mode 100644 lib/test/esprima/ES6/yield/yield-lexical-declaration.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-member-expression-property.js create mode 100644 lib/test/esprima/ES6/yield/yield-member-expression-property.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-method.js create mode 100644 lib/test/esprima/ES6/yield/yield-method.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-parameter-object-pattern.js create mode 100644 lib/test/esprima/ES6/yield/yield-parameter-object-pattern.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-rest-parameter.js create mode 100644 lib/test/esprima/ES6/yield/yield-rest-parameter.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-strict-binding-property.js create mode 100644 lib/test/esprima/ES6/yield/yield-strict-binding-property.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-strict-method.js create mode 100644 lib/test/esprima/ES6/yield/yield-strict-method.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-super-property.diff create mode 100644 lib/test/esprima/ES6/yield/yield-super-property.js create mode 100644 lib/test/esprima/ES6/yield/yield-super-property.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-variable-declaration.js create mode 100644 lib/test/esprima/ES6/yield/yield-variable-declaration.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-yield-expression-delegate.diff create mode 100644 lib/test/esprima/ES6/yield/yield-yield-expression-delegate.js create mode 100644 lib/test/esprima/ES6/yield/yield-yield-expression-delegate.tree.json create mode 100644 lib/test/esprima/ES6/yield/yield-yield-expression.diff create mode 100644 lib/test/esprima/ES6/yield/yield-yield-expression.js create mode 100644 lib/test/esprima/ES6/yield/yield-yield-expression.tree.json create mode 100644 lib/test/esprima/JSX/attribute-double-quoted-string.js create mode 100644 lib/test/esprima/JSX/attribute-double-quoted-string.tree.json create mode 100644 lib/test/esprima/JSX/attribute-element.js create mode 100644 lib/test/esprima/JSX/attribute-element.skip create mode 100644 lib/test/esprima/JSX/attribute-element.tree.json create mode 100644 lib/test/esprima/JSX/attribute-entity-decimal.js create mode 100644 lib/test/esprima/JSX/attribute-entity-decimal.tree.json create mode 100644 lib/test/esprima/JSX/attribute-entity-hex.js create mode 100644 lib/test/esprima/JSX/attribute-entity-hex.tree.json create mode 100644 lib/test/esprima/JSX/attribute-entity.js create mode 100644 lib/test/esprima/JSX/attribute-entity.tree.json create mode 100644 lib/test/esprima/JSX/attribute-expression.js create mode 100644 lib/test/esprima/JSX/attribute-expression.tree.json create mode 100644 lib/test/esprima/JSX/attribute-multi-entities.js create mode 100644 lib/test/esprima/JSX/attribute-multi-entities.tree.json create mode 100644 lib/test/esprima/JSX/attribute-null-value.js create mode 100644 lib/test/esprima/JSX/attribute-null-value.tree.json create mode 100644 lib/test/esprima/JSX/attribute-primary.js create mode 100644 lib/test/esprima/JSX/attribute-primary.tree.json create mode 100644 lib/test/esprima/JSX/attribute-single-quoted-string.js create mode 100644 lib/test/esprima/JSX/attribute-single-quoted-string.tree.json create mode 100644 lib/test/esprima/JSX/attribute-spread.js create mode 100644 lib/test/esprima/JSX/attribute-spread.tree.json create mode 100644 lib/test/esprima/JSX/attribute-unknown-entity.js create mode 100644 lib/test/esprima/JSX/attribute-unknown-entity.tree.json create mode 100644 lib/test/esprima/JSX/container-object-expression.js create mode 100644 lib/test/esprima/JSX/container-object-expression.tree.json create mode 100644 lib/test/esprima/JSX/container-series.js create mode 100644 lib/test/esprima/JSX/container-series.tree.json create mode 100644 lib/test/esprima/JSX/empty-child-comment.js create mode 100644 lib/test/esprima/JSX/empty-child-comment.tree.json create mode 100644 lib/test/esprima/JSX/empty-expression-container.js create mode 100644 lib/test/esprima/JSX/empty-expression-container.tree.json create mode 100644 lib/test/esprima/JSX/inside-group-expression.js create mode 100644 lib/test/esprima/JSX/inside-group-expression.tree.json create mode 100644 lib/test/esprima/JSX/invalid-attribute-value-trail.failure.json create mode 100644 lib/test/esprima/JSX/invalid-attribute-value-trail.js create mode 100644 lib/test/esprima/JSX/invalid-closing-trail.failure.json create mode 100644 lib/test/esprima/JSX/invalid-closing-trail.js create mode 100644 lib/test/esprima/JSX/invalid-element.failure.json create mode 100644 lib/test/esprima/JSX/invalid-element.js create mode 100644 lib/test/esprima/JSX/invalid-empty-attribute-expression.failure.json create mode 100644 lib/test/esprima/JSX/invalid-empty-attribute-expression.js create mode 100644 lib/test/esprima/JSX/invalid-empty-selfclosing.failure.json create mode 100644 lib/test/esprima/JSX/invalid-empty-selfclosing.js create mode 100644 lib/test/esprima/JSX/invalid-incomplete-namespace.failure.json create mode 100644 lib/test/esprima/JSX/invalid-incomplete-namespace.js create mode 100644 lib/test/esprima/JSX/invalid-match-member.failure.json create mode 100644 lib/test/esprima/JSX/invalid-match-member.js create mode 100644 lib/test/esprima/JSX/invalid-match-name-namespace.failure.json create mode 100644 lib/test/esprima/JSX/invalid-match-name-namespace.js create mode 100644 lib/test/esprima/JSX/invalid-match-namespace-name.failure.json create mode 100644 lib/test/esprima/JSX/invalid-match-namespace-name.js create mode 100644 lib/test/esprima/JSX/invalid-match-namespace.failure.json create mode 100644 lib/test/esprima/JSX/invalid-match-namespace.js create mode 100644 lib/test/esprima/JSX/invalid-match.failure.json create mode 100644 lib/test/esprima/JSX/invalid-match.js create mode 100644 lib/test/esprima/JSX/invalid-member-incomplete.failure.json create mode 100644 lib/test/esprima/JSX/invalid-member-incomplete.js create mode 100644 lib/test/esprima/JSX/invalid-no-closing.failure.json create mode 100644 lib/test/esprima/JSX/invalid-no-closing.js create mode 100644 lib/test/esprima/JSX/invalid-self-closing.failure.json create mode 100644 lib/test/esprima/JSX/invalid-self-closing.js create mode 100644 lib/test/esprima/JSX/invalid-start-member.failure.json create mode 100644 lib/test/esprima/JSX/invalid-start-member.js create mode 100644 lib/test/esprima/JSX/invalid-start-namespace.failure.json create mode 100644 lib/test/esprima/JSX/invalid-start-namespace.js create mode 100644 lib/test/esprima/JSX/long-member-pair.js create mode 100644 lib/test/esprima/JSX/long-member-pair.tree.json create mode 100644 lib/test/esprima/JSX/long-member.js create mode 100644 lib/test/esprima/JSX/long-member.tree.json create mode 100644 lib/test/esprima/JSX/multi-attributes.js create mode 100644 lib/test/esprima/JSX/multi-attributes.tree.json create mode 100644 lib/test/esprima/JSX/multiline-crlf-text.js create mode 100644 lib/test/esprima/JSX/multiline-crlf-text.skip create mode 100644 lib/test/esprima/JSX/multiline-crlf-text.tree.json create mode 100644 lib/test/esprima/JSX/multiline-text.js create mode 100644 lib/test/esprima/JSX/multiline-text.tree.json create mode 100644 lib/test/esprima/JSX/nested-elements.js create mode 100644 lib/test/esprima/JSX/nested-elements.tree.json create mode 100644 lib/test/esprima/JSX/null-attribute-value.js create mode 100644 lib/test/esprima/JSX/null-attribute-value.tree.json create mode 100644 lib/test/esprima/JSX/simple-deeply-nested-pair.js create mode 100644 lib/test/esprima/JSX/simple-deeply-nested-pair.tree.json create mode 100644 lib/test/esprima/JSX/simple-expression-container.js create mode 100644 lib/test/esprima/JSX/simple-expression-container.tree.json create mode 100644 lib/test/esprima/JSX/simple-member-pair.js create mode 100644 lib/test/esprima/JSX/simple-member-pair.tree.json create mode 100644 lib/test/esprima/JSX/simple-member.js create mode 100644 lib/test/esprima/JSX/simple-member.tree.json create mode 100644 lib/test/esprima/JSX/simple-namespace-pair.js create mode 100644 lib/test/esprima/JSX/simple-namespace-pair.tree.json create mode 100644 lib/test/esprima/JSX/simple-namespace.js create mode 100644 lib/test/esprima/JSX/simple-namespace.tree.json create mode 100644 lib/test/esprima/JSX/simple-nested-pair.js create mode 100644 lib/test/esprima/JSX/simple-nested-pair.tree.json create mode 100644 lib/test/esprima/JSX/simple-pair.js create mode 100644 lib/test/esprima/JSX/simple-pair.tree.json create mode 100644 lib/test/esprima/JSX/simple-selfclosing-linefeed.js create mode 100644 lib/test/esprima/JSX/simple-selfclosing-linefeed.tree.json create mode 100644 lib/test/esprima/JSX/simple-selfclosing-whitespace.js create mode 100644 lib/test/esprima/JSX/simple-selfclosing-whitespace.tree.json create mode 100644 lib/test/esprima/JSX/simple-selfclosing.js create mode 100644 lib/test/esprima/JSX/simple-selfclosing.tree.json create mode 100644 lib/test/esprima/JSX/simple-text.js create mode 100644 lib/test/esprima/JSX/simple-text.tree.json create mode 100644 lib/test/esprima/LICENSE.BSD create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0000.diff create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0000.js create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0000.tree.json create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0001.diff create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0001.js create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0001.tree.json create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0002.js create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0002.tree.json create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0003.js create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0003.tree.json create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0004.js create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0004.tree.json create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0005.js create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0005.tree.json create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0006.js create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0006.tree.json create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0007.js create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0007.tree.json create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0008.js create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0008.tree.json create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0009.js create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0009.tree.json create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0010.js create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0010.tree.json create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0011.js create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0011.tree.json create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0012.js create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0012.tree.json create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0013.js create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0013.tree.json create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0014.js create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0014.tree.json create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0015.js create mode 100644 lib/test/esprima/automatic-semicolon-insertion/migrated_0015.tree.json create mode 100644 lib/test/esprima/comment/migrated_0000.js create mode 100644 lib/test/esprima/comment/migrated_0000.tree.json create mode 100644 lib/test/esprima/comment/migrated_0001.js create mode 100644 lib/test/esprima/comment/migrated_0001.skip create mode 100644 lib/test/esprima/comment/migrated_0001.tree.json create mode 100644 lib/test/esprima/comment/migrated_0002.diff create mode 100644 lib/test/esprima/comment/migrated_0002.js create mode 100644 lib/test/esprima/comment/migrated_0002.tree.json create mode 100644 lib/test/esprima/comment/migrated_0003.diff create mode 100644 lib/test/esprima/comment/migrated_0003.js create mode 100644 lib/test/esprima/comment/migrated_0003.tree.json create mode 100644 lib/test/esprima/comment/migrated_0004.diff create mode 100644 lib/test/esprima/comment/migrated_0004.js create mode 100644 lib/test/esprima/comment/migrated_0004.tree.json create mode 100644 lib/test/esprima/comment/migrated_0005.diff create mode 100644 lib/test/esprima/comment/migrated_0005.js create mode 100644 lib/test/esprima/comment/migrated_0005.tree.json create mode 100644 lib/test/esprima/comment/migrated_0006.js create mode 100644 lib/test/esprima/comment/migrated_0006.skip create mode 100644 lib/test/esprima/comment/migrated_0006.tree.json create mode 100644 lib/test/esprima/comment/migrated_0007.js create mode 100644 lib/test/esprima/comment/migrated_0007.skip create mode 100644 lib/test/esprima/comment/migrated_0007.tree.json create mode 100644 lib/test/esprima/comment/migrated_0008.js create mode 100644 lib/test/esprima/comment/migrated_0008.skip create mode 100644 lib/test/esprima/comment/migrated_0008.tree.json create mode 100644 lib/test/esprima/comment/migrated_0009.js create mode 100644 lib/test/esprima/comment/migrated_0009.skip create mode 100644 lib/test/esprima/comment/migrated_0009.tree.json create mode 100644 lib/test/esprima/comment/migrated_0010.js create mode 100644 lib/test/esprima/comment/migrated_0010.tree.json create mode 100644 lib/test/esprima/comment/migrated_0011.diff create mode 100644 lib/test/esprima/comment/migrated_0011.js create mode 100644 lib/test/esprima/comment/migrated_0011.tree.json create mode 100644 lib/test/esprima/comment/migrated_0012.js create mode 100644 lib/test/esprima/comment/migrated_0012.tree.json create mode 100644 lib/test/esprima/comment/migrated_0013.diff create mode 100644 lib/test/esprima/comment/migrated_0013.js create mode 100644 lib/test/esprima/comment/migrated_0013.tree.json create mode 100644 lib/test/esprima/comment/migrated_0014.diff create mode 100644 lib/test/esprima/comment/migrated_0014.js create mode 100644 lib/test/esprima/comment/migrated_0014.tree.json create mode 100644 lib/test/esprima/comment/migrated_0015.diff create mode 100644 lib/test/esprima/comment/migrated_0015.js create mode 100644 lib/test/esprima/comment/migrated_0015.tree.json create mode 100644 lib/test/esprima/comment/migrated_0016.js create mode 100644 lib/test/esprima/comment/migrated_0016.tree.json create mode 100644 lib/test/esprima/comment/migrated_0017.js create mode 100644 lib/test/esprima/comment/migrated_0017.skip create mode 100644 lib/test/esprima/comment/migrated_0017.tree.json create mode 100644 lib/test/esprima/comment/migrated_0018.diff create mode 100644 lib/test/esprima/comment/migrated_0018.js create mode 100644 lib/test/esprima/comment/migrated_0018.tree.json create mode 100644 lib/test/esprima/comment/migrated_0019.js create mode 100644 lib/test/esprima/comment/migrated_0019.tree.json create mode 100644 lib/test/esprima/comment/migrated_0020.js create mode 100644 lib/test/esprima/comment/migrated_0020.tree.json create mode 100644 lib/test/esprima/comment/migrated_0021.diff create mode 100644 lib/test/esprima/comment/migrated_0021.js create mode 100644 lib/test/esprima/comment/migrated_0021.tree.json create mode 100644 lib/test/esprima/comment/migrated_0022.js create mode 100644 lib/test/esprima/comment/migrated_0022.tree.json create mode 100644 lib/test/esprima/comment/migrated_0023.js create mode 100644 lib/test/esprima/comment/migrated_0023.tree.json create mode 100644 lib/test/esprima/comment/migrated_0024.diff create mode 100644 lib/test/esprima/comment/migrated_0024.js create mode 100644 lib/test/esprima/comment/migrated_0024.tree.json create mode 100644 lib/test/esprima/comment/migrated_0025.js create mode 100644 lib/test/esprima/comment/migrated_0025.skip create mode 100644 lib/test/esprima/comment/migrated_0025.tree.json create mode 100644 lib/test/esprima/comment/migrated_0026.diff create mode 100644 lib/test/esprima/comment/migrated_0026.js create mode 100644 lib/test/esprima/comment/migrated_0026.tree.json create mode 100644 lib/test/esprima/comment/migrated_0027.diff create mode 100644 lib/test/esprima/comment/migrated_0027.js create mode 100644 lib/test/esprima/comment/migrated_0027.tree.json create mode 100644 lib/test/esprima/comment/migrated_0028.diff create mode 100644 lib/test/esprima/comment/migrated_0028.js create mode 100644 lib/test/esprima/comment/migrated_0028.tree.json create mode 100644 lib/test/esprima/comment/migrated_0029.js create mode 100644 lib/test/esprima/comment/migrated_0029.skip create mode 100644 lib/test/esprima/comment/migrated_0029.tree.json create mode 100644 lib/test/esprima/comment/migrated_0030.js create mode 100644 lib/test/esprima/comment/migrated_0030.skip create mode 100644 lib/test/esprima/comment/migrated_0030.tree.json create mode 100644 lib/test/esprima/comment/migrated_0031.js create mode 100644 lib/test/esprima/comment/migrated_0031.skip create mode 100644 lib/test/esprima/comment/migrated_0031.tree.json create mode 100644 lib/test/esprima/comment/migrated_0032.js create mode 100644 lib/test/esprima/comment/migrated_0032.skip create mode 100644 lib/test/esprima/comment/migrated_0032.tree.json create mode 100644 lib/test/esprima/comment/migrated_0033.diff create mode 100644 lib/test/esprima/comment/migrated_0033.js create mode 100644 lib/test/esprima/comment/migrated_0033.tree.json create mode 100644 lib/test/esprima/comment/migrated_0034.diff create mode 100644 lib/test/esprima/comment/migrated_0034.js create mode 100644 lib/test/esprima/comment/migrated_0034.tree.json create mode 100644 lib/test/esprima/comment/migrated_0035.diff create mode 100644 lib/test/esprima/comment/migrated_0035.js create mode 100644 lib/test/esprima/comment/migrated_0035.tree.json create mode 100644 lib/test/esprima/comment/migrated_0036.js create mode 100644 lib/test/esprima/comment/migrated_0036.skip create mode 100644 lib/test/esprima/comment/migrated_0036.tree.json create mode 100644 lib/test/esprima/comment/migrated_0037.js create mode 100644 lib/test/esprima/comment/migrated_0037.skip create mode 100644 lib/test/esprima/comment/migrated_0037.tree.json create mode 100644 lib/test/esprima/comment/migrated_0038.js create mode 100644 lib/test/esprima/comment/migrated_0038.skip create mode 100644 lib/test/esprima/comment/migrated_0038.tree.json create mode 100644 lib/test/esprima/comment/migrated_0039.js create mode 100644 lib/test/esprima/comment/migrated_0039.skip create mode 100644 lib/test/esprima/comment/migrated_0039.tree.json create mode 100644 lib/test/esprima/comment/migrated_0040.js create mode 100644 lib/test/esprima/comment/migrated_0040.skip create mode 100644 lib/test/esprima/comment/migrated_0040.tree.json create mode 100644 lib/test/esprima/comment/migrated_0041.js create mode 100644 lib/test/esprima/comment/migrated_0041.skip create mode 100644 lib/test/esprima/comment/migrated_0041.tree.json create mode 100644 lib/test/esprima/comment/migrated_0042.js create mode 100644 lib/test/esprima/comment/migrated_0042.skip create mode 100644 lib/test/esprima/comment/migrated_0042.tree.json create mode 100644 lib/test/esprima/comment/migrated_0043.js create mode 100644 lib/test/esprima/comment/migrated_0043.tree.json create mode 100644 lib/test/esprima/comment/migrated_0044.js create mode 100644 lib/test/esprima/comment/migrated_0044.tree.json create mode 100644 lib/test/esprima/comment/migrated_0045.diff create mode 100644 lib/test/esprima/comment/migrated_0045.js create mode 100644 lib/test/esprima/comment/migrated_0045.tree.json create mode 100644 lib/test/esprima/comment/migrated_0046.js create mode 100644 lib/test/esprima/comment/migrated_0046.tree.json create mode 100644 lib/test/esprima/comment/migrated_0047.diff create mode 100644 lib/test/esprima/comment/migrated_0047.js create mode 100644 lib/test/esprima/comment/migrated_0047.tree.json create mode 100644 lib/test/esprima/comment/migrated_0048.diff create mode 100644 lib/test/esprima/comment/migrated_0048.js create mode 100644 lib/test/esprima/comment/migrated_0048.tree.json create mode 100644 lib/test/esprima/comment/migrated_0049.diff create mode 100644 lib/test/esprima/comment/migrated_0049.js create mode 100644 lib/test/esprima/comment/migrated_0049.tree.json create mode 100644 lib/test/esprima/comment/migrated_0050.diff create mode 100644 lib/test/esprima/comment/migrated_0050.js create mode 100644 lib/test/esprima/comment/migrated_0050.tree.json create mode 100644 lib/test/esprima/comment/migrated_0051.diff create mode 100644 lib/test/esprima/comment/migrated_0051.js create mode 100644 lib/test/esprima/comment/migrated_0051.tree.json create mode 100644 lib/test/esprima/comment/migrated_0052.diff create mode 100644 lib/test/esprima/comment/migrated_0052.js create mode 100644 lib/test/esprima/comment/migrated_0052.tree.json create mode 100644 lib/test/esprima/comment/migrated_0053.diff create mode 100644 lib/test/esprima/comment/migrated_0053.js create mode 100644 lib/test/esprima/comment/migrated_0053.tree.json create mode 100644 lib/test/esprima/comment/migrated_0054.diff create mode 100644 lib/test/esprima/comment/migrated_0054.js create mode 100644 lib/test/esprima/comment/migrated_0054.tree.json create mode 100644 lib/test/esprima/comment/migrated_0055.js create mode 100644 lib/test/esprima/comment/migrated_0055.tree.json create mode 100644 lib/test/esprima/declaration/const/migrated_0000.js create mode 100644 lib/test/esprima/declaration/const/migrated_0000.tree.json create mode 100644 lib/test/esprima/declaration/const/migrated_0001.diff create mode 100644 lib/test/esprima/declaration/const/migrated_0001.js create mode 100644 lib/test/esprima/declaration/const/migrated_0001.tree.json create mode 100644 lib/test/esprima/declaration/const/migrated_0002.diff create mode 100644 lib/test/esprima/declaration/const/migrated_0002.js create mode 100644 lib/test/esprima/declaration/const/migrated_0002.tree.json create mode 100644 lib/test/esprima/declaration/function/dupe-param.diff create mode 100644 lib/test/esprima/declaration/function/dupe-param.js create mode 100644 lib/test/esprima/declaration/function/dupe-param.tree.json create mode 100644 lib/test/esprima/declaration/function/empty-param.js create mode 100644 lib/test/esprima/declaration/function/empty-param.tree.json create mode 100644 lib/test/esprima/declaration/function/migrated_0000.js create mode 100644 lib/test/esprima/declaration/function/migrated_0000.tree.json create mode 100644 lib/test/esprima/declaration/function/migrated_0001.js create mode 100644 lib/test/esprima/declaration/function/migrated_0001.tree.json create mode 100644 lib/test/esprima/declaration/function/migrated_0002.js create mode 100644 lib/test/esprima/declaration/function/migrated_0002.tree.json create mode 100644 lib/test/esprima/declaration/function/migrated_0003.js create mode 100644 lib/test/esprima/declaration/function/migrated_0003.tree.json create mode 100644 lib/test/esprima/declaration/function/migrated_0004.js create mode 100644 lib/test/esprima/declaration/function/migrated_0004.tree.json create mode 100644 lib/test/esprima/declaration/function/migrated_0005.diff create mode 100644 lib/test/esprima/declaration/function/migrated_0005.js create mode 100644 lib/test/esprima/declaration/function/migrated_0005.tree.json create mode 100644 lib/test/esprima/declaration/function/migrated_0006.js create mode 100644 lib/test/esprima/declaration/function/migrated_0006.tree.json create mode 100644 lib/test/esprima/declaration/function/migrated_0007.js create mode 100644 lib/test/esprima/declaration/function/migrated_0007.tree.json create mode 100644 lib/test/esprima/declaration/function/migrated_0008.diff create mode 100644 lib/test/esprima/declaration/function/migrated_0008.js create mode 100644 lib/test/esprima/declaration/function/migrated_0008.tree.json create mode 100644 lib/test/esprima/declaration/function/migrated_0009.js create mode 100644 lib/test/esprima/declaration/function/migrated_0009.tree.json create mode 100644 lib/test/esprima/declaration/function/migrated_0010.js create mode 100644 lib/test/esprima/declaration/function/migrated_0010.tree.json create mode 100644 lib/test/esprima/declaration/function/migrated_0011.diff create mode 100644 lib/test/esprima/declaration/function/migrated_0011.js create mode 100644 lib/test/esprima/declaration/function/migrated_0011.tree.json create mode 100644 lib/test/esprima/declaration/function/migrated_0012.js create mode 100644 lib/test/esprima/declaration/function/migrated_0012.tree.json create mode 100644 lib/test/esprima/declaration/function/migrated_0013.js create mode 100644 lib/test/esprima/declaration/function/migrated_0013.tree.json create mode 100644 lib/test/esprima/declaration/function/migrated_0014.js create mode 100644 lib/test/esprima/declaration/function/migrated_0014.tree.json create mode 100644 lib/test/esprima/declaration/let/migrated_0000.js create mode 100644 lib/test/esprima/declaration/let/migrated_0000.tree.json create mode 100644 lib/test/esprima/declaration/let/migrated_0001.diff create mode 100644 lib/test/esprima/declaration/let/migrated_0001.js create mode 100644 lib/test/esprima/declaration/let/migrated_0001.tree.json create mode 100644 lib/test/esprima/declaration/let/migrated_0002.diff create mode 100644 lib/test/esprima/declaration/let/migrated_0002.js create mode 100644 lib/test/esprima/declaration/let/migrated_0002.tree.json create mode 100644 lib/test/esprima/declaration/let/migrated_0003.diff create mode 100644 lib/test/esprima/declaration/let/migrated_0003.js create mode 100644 lib/test/esprima/declaration/let/migrated_0003.tree.json create mode 100644 lib/test/esprima/directive-prolog/migrated_0000.js create mode 100644 lib/test/esprima/directive-prolog/migrated_0000.tree.json create mode 100644 lib/test/esprima/directive-prolog/migrated_0001.js create mode 100644 lib/test/esprima/directive-prolog/migrated_0001.tree.json create mode 100644 lib/test/esprima/expression/additive/migrated_0000.js create mode 100644 lib/test/esprima/expression/additive/migrated_0000.tree.json create mode 100644 lib/test/esprima/expression/additive/migrated_0001.js create mode 100644 lib/test/esprima/expression/additive/migrated_0001.tree.json create mode 100644 lib/test/esprima/expression/additive/migrated_0002.js create mode 100644 lib/test/esprima/expression/additive/migrated_0002.tree.json create mode 100644 lib/test/esprima/expression/assignment/migrated_0000.js create mode 100644 lib/test/esprima/expression/assignment/migrated_0000.tree.json create mode 100644 lib/test/esprima/expression/assignment/migrated_0001.js create mode 100644 lib/test/esprima/expression/assignment/migrated_0001.tree.json create mode 100644 lib/test/esprima/expression/assignment/migrated_0002.js create mode 100644 lib/test/esprima/expression/assignment/migrated_0002.tree.json create mode 100644 lib/test/esprima/expression/assignment/migrated_0003.js create mode 100644 lib/test/esprima/expression/assignment/migrated_0003.tree.json create mode 100644 lib/test/esprima/expression/assignment/migrated_0004.js create mode 100644 lib/test/esprima/expression/assignment/migrated_0004.tree.json create mode 100644 lib/test/esprima/expression/assignment/migrated_0005.js create mode 100644 lib/test/esprima/expression/assignment/migrated_0005.tree.json create mode 100644 lib/test/esprima/expression/assignment/migrated_0006.js create mode 100644 lib/test/esprima/expression/assignment/migrated_0006.tree.json create mode 100644 lib/test/esprima/expression/assignment/migrated_0007.js create mode 100644 lib/test/esprima/expression/assignment/migrated_0007.tree.json create mode 100644 lib/test/esprima/expression/assignment/migrated_0008.js create mode 100644 lib/test/esprima/expression/assignment/migrated_0008.tree.json create mode 100644 lib/test/esprima/expression/assignment/migrated_0009.js create mode 100644 lib/test/esprima/expression/assignment/migrated_0009.tree.json create mode 100644 lib/test/esprima/expression/assignment/migrated_0010.js create mode 100644 lib/test/esprima/expression/assignment/migrated_0010.tree.json create mode 100644 lib/test/esprima/expression/assignment/migrated_0011.js create mode 100644 lib/test/esprima/expression/assignment/migrated_0011.tree.json create mode 100644 lib/test/esprima/expression/assignment/migrated_0012.js create mode 100644 lib/test/esprima/expression/assignment/migrated_0012.tree.json create mode 100644 lib/test/esprima/expression/assignment/migrated_0013.js create mode 100644 lib/test/esprima/expression/assignment/migrated_0013.tree.json create mode 100644 lib/test/esprima/expression/binary-bitwise/migrated_0000.js create mode 100644 lib/test/esprima/expression/binary-bitwise/migrated_0000.tree.json create mode 100644 lib/test/esprima/expression/binary-bitwise/migrated_0001.js create mode 100644 lib/test/esprima/expression/binary-bitwise/migrated_0001.tree.json create mode 100644 lib/test/esprima/expression/binary-bitwise/migrated_0002.js create mode 100644 lib/test/esprima/expression/binary-bitwise/migrated_0002.tree.json create mode 100644 lib/test/esprima/expression/binary-logical/migrated_0000.js create mode 100644 lib/test/esprima/expression/binary-logical/migrated_0000.tree.json create mode 100644 lib/test/esprima/expression/binary-logical/migrated_0001.js create mode 100644 lib/test/esprima/expression/binary-logical/migrated_0001.tree.json create mode 100644 lib/test/esprima/expression/binary-logical/migrated_0002.js create mode 100644 lib/test/esprima/expression/binary-logical/migrated_0002.tree.json create mode 100644 lib/test/esprima/expression/binary-logical/migrated_0003.js create mode 100644 lib/test/esprima/expression/binary-logical/migrated_0003.tree.json create mode 100644 lib/test/esprima/expression/binary-logical/migrated_0004.js create mode 100644 lib/test/esprima/expression/binary-logical/migrated_0004.tree.json create mode 100644 lib/test/esprima/expression/binary-logical/migrated_0005.js create mode 100644 lib/test/esprima/expression/binary-logical/migrated_0005.tree.json create mode 100644 lib/test/esprima/expression/binary/migrated_0000.js create mode 100644 lib/test/esprima/expression/binary/migrated_0000.tree.json create mode 100644 lib/test/esprima/expression/binary/migrated_0001.js create mode 100644 lib/test/esprima/expression/binary/migrated_0001.tree.json create mode 100644 lib/test/esprima/expression/binary/migrated_0002.js create mode 100644 lib/test/esprima/expression/binary/migrated_0002.tree.json create mode 100644 lib/test/esprima/expression/binary/migrated_0003.js create mode 100644 lib/test/esprima/expression/binary/migrated_0003.tree.json create mode 100644 lib/test/esprima/expression/binary/migrated_0004.js create mode 100644 lib/test/esprima/expression/binary/migrated_0004.tree.json create mode 100644 lib/test/esprima/expression/binary/migrated_0005.js create mode 100644 lib/test/esprima/expression/binary/migrated_0005.tree.json create mode 100644 lib/test/esprima/expression/binary/migrated_0006.js create mode 100644 lib/test/esprima/expression/binary/migrated_0006.tree.json create mode 100644 lib/test/esprima/expression/binary/migrated_0007.js create mode 100644 lib/test/esprima/expression/binary/migrated_0007.tree.json create mode 100644 lib/test/esprima/expression/binary/migrated_0008.js create mode 100644 lib/test/esprima/expression/binary/migrated_0008.tree.json create mode 100644 lib/test/esprima/expression/binary/migrated_0009.js create mode 100644 lib/test/esprima/expression/binary/migrated_0009.tree.json create mode 100644 lib/test/esprima/expression/binary/migrated_0010.js create mode 100644 lib/test/esprima/expression/binary/migrated_0010.tree.json create mode 100644 lib/test/esprima/expression/binary/migrated_0011.js create mode 100644 lib/test/esprima/expression/binary/migrated_0011.tree.json create mode 100644 lib/test/esprima/expression/binary/migrated_0012.js create mode 100644 lib/test/esprima/expression/binary/migrated_0012.tree.json create mode 100644 lib/test/esprima/expression/binary/migrated_0013.js create mode 100644 lib/test/esprima/expression/binary/migrated_0013.tree.json create mode 100644 lib/test/esprima/expression/binary/migrated_0014.js create mode 100644 lib/test/esprima/expression/binary/migrated_0014.tree.json create mode 100644 lib/test/esprima/expression/binary/migrated_0015.js create mode 100644 lib/test/esprima/expression/binary/migrated_0015.tree.json create mode 100644 lib/test/esprima/expression/binary/migrated_0016.js create mode 100644 lib/test/esprima/expression/binary/migrated_0016.tree.json create mode 100644 lib/test/esprima/expression/binary/migrated_0017.js create mode 100644 lib/test/esprima/expression/binary/migrated_0017.tree.json create mode 100644 lib/test/esprima/expression/bitwise-shift/migrated_0000.js create mode 100644 lib/test/esprima/expression/bitwise-shift/migrated_0000.tree.json create mode 100644 lib/test/esprima/expression/bitwise-shift/migrated_0001.js create mode 100644 lib/test/esprima/expression/bitwise-shift/migrated_0001.tree.json create mode 100644 lib/test/esprima/expression/bitwise-shift/migrated_0002.js create mode 100644 lib/test/esprima/expression/bitwise-shift/migrated_0002.tree.json create mode 100644 lib/test/esprima/expression/complex/migrated_0000.js create mode 100644 lib/test/esprima/expression/complex/migrated_0000.tree.json create mode 100644 lib/test/esprima/expression/conditional/migrated_0000.js create mode 100644 lib/test/esprima/expression/conditional/migrated_0000.tree.json create mode 100644 lib/test/esprima/expression/conditional/migrated_0001.js create mode 100644 lib/test/esprima/expression/conditional/migrated_0001.tree.json create mode 100644 lib/test/esprima/expression/conditional/migrated_0002.js create mode 100644 lib/test/esprima/expression/conditional/migrated_0002.tree.json create mode 100644 lib/test/esprima/expression/equality/migrated_0000.js create mode 100644 lib/test/esprima/expression/equality/migrated_0000.tree.json create mode 100644 lib/test/esprima/expression/equality/migrated_0001.js create mode 100644 lib/test/esprima/expression/equality/migrated_0001.tree.json create mode 100644 lib/test/esprima/expression/equality/migrated_0002.js create mode 100644 lib/test/esprima/expression/equality/migrated_0002.tree.json create mode 100644 lib/test/esprima/expression/equality/migrated_0003.js create mode 100644 lib/test/esprima/expression/equality/migrated_0003.tree.json create mode 100644 lib/test/esprima/expression/grouping/migrated_0000.js create mode 100644 lib/test/esprima/expression/grouping/migrated_0000.tree.json create mode 100644 lib/test/esprima/expression/grouping/migrated_0001.js create mode 100644 lib/test/esprima/expression/grouping/migrated_0001.tree.json create mode 100644 lib/test/esprima/expression/left-hand-side/let_object_computed.js create mode 100644 lib/test/esprima/expression/left-hand-side/let_object_computed.tree.json create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0000.js create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0000.tree.json create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0001.js create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0001.tree.json create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0002.js create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0002.tree.json create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0003.js create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0003.tree.json create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0004.js create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0004.tree.json create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0005.js create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0005.tree.json create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0006.js create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0006.tree.json create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0007.js create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0007.tree.json create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0008.js create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0008.tree.json create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0009.js create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0009.tree.json create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0010.js create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0010.tree.json create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0011.js create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0011.tree.json create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0012.js create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0012.tree.json create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0013.js create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0013.tree.json create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0014.js create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0014.tree.json create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0015.js create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0015.tree.json create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0016.js create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0016.tree.json create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0017.js create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0017.tree.json create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0018.js create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0018.tree.json create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0019.js create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0019.tree.json create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0020.js create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0020.tree.json create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0021.js create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0021.tree.json create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0022.js create mode 100644 lib/test/esprima/expression/left-hand-side/migrated_0022.tree.json create mode 100644 lib/test/esprima/expression/multiplicative/migrated_0000.js create mode 100644 lib/test/esprima/expression/multiplicative/migrated_0000.tree.json create mode 100644 lib/test/esprima/expression/multiplicative/migrated_0001.js create mode 100644 lib/test/esprima/expression/multiplicative/migrated_0001.tree.json create mode 100644 lib/test/esprima/expression/multiplicative/migrated_0002.js create mode 100644 lib/test/esprima/expression/multiplicative/migrated_0002.tree.json create mode 100644 lib/test/esprima/expression/postfix/migrated_0000.js create mode 100644 lib/test/esprima/expression/postfix/migrated_0000.tree.json create mode 100644 lib/test/esprima/expression/postfix/migrated_0001.js create mode 100644 lib/test/esprima/expression/postfix/migrated_0001.tree.json create mode 100644 lib/test/esprima/expression/postfix/migrated_0002.js create mode 100644 lib/test/esprima/expression/postfix/migrated_0002.tree.json create mode 100644 lib/test/esprima/expression/postfix/migrated_0003.js create mode 100644 lib/test/esprima/expression/postfix/migrated_0003.tree.json create mode 100644 lib/test/esprima/expression/postfix/migrated_0004.js create mode 100644 lib/test/esprima/expression/postfix/migrated_0004.tree.json create mode 100644 lib/test/esprima/expression/postfix/migrated_0005.js create mode 100644 lib/test/esprima/expression/postfix/migrated_0005.tree.json create mode 100644 lib/test/esprima/expression/primary/array/migrated_0000.js create mode 100644 lib/test/esprima/expression/primary/array/migrated_0000.tree.json create mode 100644 lib/test/esprima/expression/primary/array/migrated_0001.js create mode 100644 lib/test/esprima/expression/primary/array/migrated_0001.tree.json create mode 100644 lib/test/esprima/expression/primary/array/migrated_0002.js create mode 100644 lib/test/esprima/expression/primary/array/migrated_0002.tree.json create mode 100644 lib/test/esprima/expression/primary/array/migrated_0003.js create mode 100644 lib/test/esprima/expression/primary/array/migrated_0003.tree.json create mode 100644 lib/test/esprima/expression/primary/array/migrated_0004.js create mode 100644 lib/test/esprima/expression/primary/array/migrated_0004.tree.json create mode 100644 lib/test/esprima/expression/primary/array/migrated_0005.js create mode 100644 lib/test/esprima/expression/primary/array/migrated_0005.tree.json create mode 100644 lib/test/esprima/expression/primary/array/migrated_0006.js create mode 100644 lib/test/esprima/expression/primary/array/migrated_0006.tree.json create mode 100644 lib/test/esprima/expression/primary/array/migrated_0007.js create mode 100644 lib/test/esprima/expression/primary/array/migrated_0007.tree.json create mode 100644 lib/test/esprima/expression/primary/array/migrated_0008.source.js create mode 100644 lib/test/esprima/expression/primary/array/migrated_0008.tree.json create mode 100644 lib/test/esprima/expression/primary/array/migrated_0009.source.js create mode 100644 lib/test/esprima/expression/primary/array/migrated_0009.tree.json create mode 100644 lib/test/esprima/expression/primary/array/migrated_0010.source.js create mode 100644 lib/test/esprima/expression/primary/array/migrated_0010.tree.json create mode 100644 lib/test/esprima/expression/primary/array/migrated_0011.source.js create mode 100644 lib/test/esprima/expression/primary/array/migrated_0011.tree.json create mode 100644 lib/test/esprima/expression/primary/array/migrated_0012.source.js create mode 100644 lib/test/esprima/expression/primary/array/migrated_0012.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0000.js create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0000.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0001.js create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0001.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0002.js create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0002.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0003.js create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0003.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0004.js create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0004.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0005.js create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0005.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0006.js create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0006.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0007.js create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0007.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0008.js create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0008.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0009.js create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0009.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0010.diff create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0010.js create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0010.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0011.js create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0011.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0012.js create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0012.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0013.js create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0013.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0014.js create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0014.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0015.js create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0015.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0016.js create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0016.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0017.js create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0017.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0018.js create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0018.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0019.js create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0019.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0020.js create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0020.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0021.js create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0021.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0022.js create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0022.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0023.js create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0023.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0024.js create mode 100644 lib/test/esprima/expression/primary/literal/numeric/migrated_0024.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0000.diff create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0000.js create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0000.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0001.diff create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0001.js create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0001.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0002.diff create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0002.js create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0002.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0003.js create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0003.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0004.js create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0004.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0005.source.js create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0005.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0006.failure.json create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0006.source.js create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0007.diff create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0007.js create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0007.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0008.diff create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0008.js create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0008.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0009.diff create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0009.js create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0009.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0010.diff create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0010.js create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0010.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0011.diff create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0011.js create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0011.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0012.diff create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0012.js create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0012.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0013.diff create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0013.js create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/migrated_0013.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/u-flag-invalid-range-4-hex.failure.json create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/u-flag-invalid-range-4-hex.js create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/u-flag-invalid-range-var-hex.failure.json create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/u-flag-invalid-range-var-hex.js create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/u-flag-surrogate-pair.js create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/u-flag-surrogate-pair.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/u-flag-valid-range.js create mode 100644 lib/test/esprima/expression/primary/literal/regular-expression/u-flag-valid-range.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/string/migrated_0000.js create mode 100644 lib/test/esprima/expression/primary/literal/string/migrated_0000.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/string/migrated_0001.js create mode 100644 lib/test/esprima/expression/primary/literal/string/migrated_0001.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/string/migrated_0002.source.js create mode 100644 lib/test/esprima/expression/primary/literal/string/migrated_0002.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/string/migrated_0003.js create mode 100644 lib/test/esprima/expression/primary/literal/string/migrated_0003.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/string/migrated_0006.js create mode 100644 lib/test/esprima/expression/primary/literal/string/migrated_0006.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/string/migrated_0007.js create mode 100644 lib/test/esprima/expression/primary/literal/string/migrated_0007.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/string/migrated_0008.js create mode 100644 lib/test/esprima/expression/primary/literal/string/migrated_0008.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/string/migrated_0009.js create mode 100644 lib/test/esprima/expression/primary/literal/string/migrated_0009.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/string/migrated_0010.js create mode 100644 lib/test/esprima/expression/primary/literal/string/migrated_0010.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/string/migrated_0011.js create mode 100644 lib/test/esprima/expression/primary/literal/string/migrated_0011.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/string/migrated_0012.js create mode 100644 lib/test/esprima/expression/primary/literal/string/migrated_0012.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/string/migrated_0013.js create mode 100644 lib/test/esprima/expression/primary/literal/string/migrated_0013.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/string/migrated_0015.js create mode 100644 lib/test/esprima/expression/primary/literal/string/migrated_0015.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/string/migrated_0016.js create mode 100644 lib/test/esprima/expression/primary/literal/string/migrated_0016.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/string/migrated_0017.js create mode 100644 lib/test/esprima/expression/primary/literal/string/migrated_0017.tree.json create mode 100644 lib/test/esprima/expression/primary/literal/string/migrated_0018.js create mode 100644 lib/test/esprima/expression/primary/literal/string/migrated_0018.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0000.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0000.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0001.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0001.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0002.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0002.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0003.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0003.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0004.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0004.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0005.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0005.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0006.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0006.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0007.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0007.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0008.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0008.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0009.diff create mode 100644 lib/test/esprima/expression/primary/object/migrated_0009.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0009.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0010.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0010.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0011.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0011.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0012.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0012.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0013.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0013.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0014.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0014.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0015.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0015.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0016.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0016.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0017.diff create mode 100644 lib/test/esprima/expression/primary/object/migrated_0017.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0017.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0018.diff create mode 100644 lib/test/esprima/expression/primary/object/migrated_0018.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0018.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0019.diff create mode 100644 lib/test/esprima/expression/primary/object/migrated_0019.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0019.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0020.diff create mode 100644 lib/test/esprima/expression/primary/object/migrated_0020.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0020.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0021.diff create mode 100644 lib/test/esprima/expression/primary/object/migrated_0021.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0021.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0022.diff create mode 100644 lib/test/esprima/expression/primary/object/migrated_0022.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0022.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0023.diff create mode 100644 lib/test/esprima/expression/primary/object/migrated_0023.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0023.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0024.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0024.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0025.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0025.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0026.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0026.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0027.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0027.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0028.diff create mode 100644 lib/test/esprima/expression/primary/object/migrated_0028.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0028.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0029.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0029.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0030.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0030.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0031.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0031.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0032.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0032.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0033.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0033.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0034.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0034.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0035.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0035.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0036.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0036.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0037.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0037.tree.json create mode 100644 lib/test/esprima/expression/primary/object/migrated_0038.js create mode 100644 lib/test/esprima/expression/primary/object/migrated_0038.tree.json create mode 100644 lib/test/esprima/expression/primary/other/migrated_0000.js create mode 100644 lib/test/esprima/expression/primary/other/migrated_0000.tree.json create mode 100644 lib/test/esprima/expression/primary/other/migrated_0001.js create mode 100644 lib/test/esprima/expression/primary/other/migrated_0001.tree.json create mode 100644 lib/test/esprima/expression/primary/other/migrated_0002.js create mode 100644 lib/test/esprima/expression/primary/other/migrated_0002.tree.json create mode 100644 lib/test/esprima/expression/primary/other/migrated_0003.js create mode 100644 lib/test/esprima/expression/primary/other/migrated_0003.tree.json create mode 100644 lib/test/esprima/expression/relational/migrated_0000.js create mode 100644 lib/test/esprima/expression/relational/migrated_0000.tree.json create mode 100644 lib/test/esprima/expression/relational/migrated_0001.js create mode 100644 lib/test/esprima/expression/relational/migrated_0001.tree.json create mode 100644 lib/test/esprima/expression/relational/migrated_0002.js create mode 100644 lib/test/esprima/expression/relational/migrated_0002.tree.json create mode 100644 lib/test/esprima/expression/relational/migrated_0003.js create mode 100644 lib/test/esprima/expression/relational/migrated_0003.tree.json create mode 100644 lib/test/esprima/expression/relational/migrated_0004.js create mode 100644 lib/test/esprima/expression/relational/migrated_0004.tree.json create mode 100644 lib/test/esprima/expression/relational/migrated_0005.js create mode 100644 lib/test/esprima/expression/relational/migrated_0005.tree.json create mode 100644 lib/test/esprima/expression/relational/migrated_0006.js create mode 100644 lib/test/esprima/expression/relational/migrated_0006.tree.json create mode 100644 lib/test/esprima/expression/unary/migrated_0000.js create mode 100644 lib/test/esprima/expression/unary/migrated_0000.tree.json create mode 100644 lib/test/esprima/expression/unary/migrated_0001.js create mode 100644 lib/test/esprima/expression/unary/migrated_0001.tree.json create mode 100644 lib/test/esprima/expression/unary/migrated_0002.js create mode 100644 lib/test/esprima/expression/unary/migrated_0002.tree.json create mode 100644 lib/test/esprima/expression/unary/migrated_0003.js create mode 100644 lib/test/esprima/expression/unary/migrated_0003.tree.json create mode 100644 lib/test/esprima/expression/unary/migrated_0004.js create mode 100644 lib/test/esprima/expression/unary/migrated_0004.tree.json create mode 100644 lib/test/esprima/expression/unary/migrated_0005.js create mode 100644 lib/test/esprima/expression/unary/migrated_0005.tree.json create mode 100644 lib/test/esprima/expression/unary/migrated_0006.js create mode 100644 lib/test/esprima/expression/unary/migrated_0006.tree.json create mode 100644 lib/test/esprima/expression/unary/migrated_0007.js create mode 100644 lib/test/esprima/expression/unary/migrated_0007.tree.json create mode 100644 lib/test/esprima/expression/unary/migrated_0008.js create mode 100644 lib/test/esprima/expression/unary/migrated_0008.tree.json create mode 100644 lib/test/esprima/expression/unary/migrated_0009.js create mode 100644 lib/test/esprima/expression/unary/migrated_0009.tree.json create mode 100644 lib/test/esprima/expression/unary/migrated_0010.js create mode 100644 lib/test/esprima/expression/unary/migrated_0010.tree.json create mode 100644 lib/test/esprima/expression/unary/migrated_0011.js create mode 100644 lib/test/esprima/expression/unary/migrated_0011.tree.json create mode 100644 lib/test/esprima/expression/unary/migrated_0012.js create mode 100644 lib/test/esprima/expression/unary/migrated_0012.tree.json create mode 100644 lib/test/esprima/invalid-syntax/GH-1106-00.failure.json create mode 100644 lib/test/esprima/invalid-syntax/GH-1106-00.js create mode 100644 lib/test/esprima/invalid-syntax/GH-1106-01.failure.json create mode 100644 lib/test/esprima/invalid-syntax/GH-1106-01.js create mode 100644 lib/test/esprima/invalid-syntax/GH-1106-02.failure.json create mode 100644 lib/test/esprima/invalid-syntax/GH-1106-02.js create mode 100644 lib/test/esprima/invalid-syntax/GH-1106-03.failure.json create mode 100644 lib/test/esprima/invalid-syntax/GH-1106-03.js create mode 100644 lib/test/esprima/invalid-syntax/GH-1106-04.failure.json create mode 100644 lib/test/esprima/invalid-syntax/GH-1106-04.js create mode 100644 lib/test/esprima/invalid-syntax/GH-1106-05.failure.json create mode 100644 lib/test/esprima/invalid-syntax/GH-1106-05.js create mode 100644 lib/test/esprima/invalid-syntax/GH-1106-06.failure.json create mode 100644 lib/test/esprima/invalid-syntax/GH-1106-06.js create mode 100644 lib/test/esprima/invalid-syntax/GH-1106-07.failure.json create mode 100644 lib/test/esprima/invalid-syntax/GH-1106-07.js create mode 100644 lib/test/esprima/invalid-syntax/GH-1106-08.failure.json create mode 100644 lib/test/esprima/invalid-syntax/GH-1106-08.js create mode 100644 lib/test/esprima/invalid-syntax/GH-1106-09.failure.json create mode 100644 lib/test/esprima/invalid-syntax/GH-1106-09.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0000.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0000.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0001.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0001.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0002.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0002.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0003.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0003.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0004.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0004.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0005.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0005.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0006.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0006.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0007.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0007.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0008.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0008.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0009.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0009.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0010.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0010.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0011.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0011.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0012.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0012.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0013.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0013.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0014.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0014.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0015.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0015.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0016.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0016.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0017.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0017.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0018.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0018.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0019.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0019.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0020.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0020.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0021.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0021.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0022.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0022.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0023.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0023.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0024.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0024.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0025.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0025.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0026.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0026.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0027.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0027.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0028.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0028.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0029.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0029.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0030.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0030.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0031.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0031.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0032.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0032.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0033.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0033.source.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0034.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0034.source.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0035.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0035.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0036.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0036.source.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0037.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0037.source.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0038.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0038.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0039.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0039.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0040.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0040.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0041.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0041.source.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0042.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0042.source.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0043.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0043.source.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0044.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0044.source.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0045.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0045.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0046.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0046.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0047.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0047.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0048.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0048.source.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0049.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0049.source.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0050.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0050.source.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0051.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0051.source.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0052.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0052.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0053.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0053.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0054.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0054.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0055.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0055.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0056.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0056.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0057.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0057.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0058.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0058.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0059.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0059.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0060.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0060.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0061.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0061.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0062.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0062.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0063.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0063.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0064.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0064.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0065.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0065.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0066.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0066.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0067.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0067.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0068.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0068.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0069.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0069.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0070.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0070.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0071.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0071.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0072.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0072.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0073.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0073.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0074.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0074.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0075.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0075.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0076.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0076.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0077.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0077.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0078.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0078.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0080.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0080.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0081.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0081.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0082.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0082.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0083.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0083.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0084.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0084.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0085.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0085.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0086.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0086.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0087.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0087.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0088.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0088.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0089.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0089.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0090.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0090.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0091.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0091.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0092.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0092.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0093.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0093.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0094.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0094.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0095.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0095.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0096.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0096.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0097.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0097.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0098.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0098.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0099.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0099.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0100.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0100.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0101.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0101.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0102.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0102.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0103.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0103.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0104.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0104.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0105.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0105.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0106.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0106.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0107.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0107.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0108.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0108.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0109.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0109.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0110.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0110.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0111.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0111.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0112.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0112.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0113.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0113.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0114.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0114.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0115.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0115.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0116.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0116.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0117.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0117.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0118.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0118.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0119.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0119.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0120.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0120.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0121.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0121.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0122.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0122.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0123.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0123.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0124.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0124.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0125.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0125.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0126.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0126.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0127.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0127.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0128.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0128.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0129.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0129.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0130.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0130.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0131.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0131.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0132.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0132.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0133.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0133.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0134.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0134.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0135.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0135.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0136.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0136.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0137.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0137.source.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0138.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0138.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0139.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0139.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0140.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0140.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0141.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0141.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0142.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0142.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0143.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0143.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0144.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0144.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0145.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0145.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0146.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0146.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0147.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0147.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0148.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0148.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0149.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0149.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0150.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0150.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0151.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0151.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0152.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0152.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0153.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0153.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0154.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0154.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0155.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0155.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0156.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0156.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0157.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0157.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0158.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0158.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0159.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0159.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0160.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0160.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0161.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0161.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0162.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0162.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0163.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0163.source.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0164.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0164.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0165.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0165.source.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0166.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0166.source.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0167.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0167.source.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0168.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0168.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0169.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0169.source.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0170.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0170.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0171.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0171.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0172.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0172.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0173.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0173.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0174.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0174.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0175.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0175.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0176.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0176.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0177.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0177.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0178.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0178.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0179.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0179.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0180.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0180.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0181.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0181.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0182.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0182.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0183.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0183.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0184.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0184.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0185.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0185.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0186.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0186.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0187.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0187.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0188.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0188.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0189.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0189.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0190.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0190.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0191.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0191.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0192.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0192.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0193.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0193.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0194.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0194.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0195.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0195.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0196.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0196.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0197.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0197.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0198.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0198.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0199.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0199.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0200.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0200.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0201.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0201.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0202.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0202.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0203.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0203.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0204.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0204.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0205.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0205.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0206.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0206.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0207.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0207.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0208.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0208.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0209.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0209.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0210.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0210.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0211.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0211.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0212.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0212.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0213.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0213.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0214.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0214.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0215.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0215.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0216.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0216.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0217.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0217.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0218.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0218.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0219.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0219.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0220.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0220.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0221.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0221.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0222.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0222.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0223.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0223.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0224.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0224.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0225.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0225.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0226.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0226.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0227.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0227.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0228.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0228.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0229.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0229.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0230.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0230.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0231.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0231.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0232.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0232.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0233.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0233.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0234.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0234.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0235.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0235.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0236.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0236.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0239.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0239.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0240.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0240.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0241.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0241.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0242.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0242.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0243.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0243.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0244.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0244.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0245.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0245.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0246.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0246.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0247.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0247.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0248.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0248.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0249.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0249.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0250.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0250.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0252.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0252.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0254.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0254.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0255.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0255.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0256.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0256.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0257.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0257.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0258.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0258.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0259.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0259.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0260.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0260.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0261.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0261.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0262.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0262.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0263.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0263.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0264.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0264.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0265.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0265.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0266.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0266.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0267.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0267.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0268.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0268.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0269.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0269.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0270.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0270.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0271.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0271.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0272.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0272.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0273.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0273.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0274.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0274.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0275.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0275.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0276.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0276.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0277.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0277.js create mode 100644 lib/test/esprima/invalid-syntax/migrated_0278.failure.json create mode 100644 lib/test/esprima/invalid-syntax/migrated_0278.js create mode 100644 lib/test/esprima/invalid-syntax/strict_assignment_implements.failure.json create mode 100644 lib/test/esprima/invalid-syntax/strict_assignment_implements.js create mode 100644 lib/test/esprima/invalid-syntax/strict_assignment_interface.failure.json create mode 100644 lib/test/esprima/invalid-syntax/strict_assignment_interface.js create mode 100644 lib/test/esprima/invalid-syntax/strict_assignment_let.failure.json create mode 100644 lib/test/esprima/invalid-syntax/strict_assignment_let.js create mode 100644 lib/test/esprima/invalid-syntax/strict_assignment_package.failure.json create mode 100644 lib/test/esprima/invalid-syntax/strict_assignment_package.js create mode 100644 lib/test/esprima/invalid-syntax/strict_assignment_private.failure.json create mode 100644 lib/test/esprima/invalid-syntax/strict_assignment_private.js create mode 100644 lib/test/esprima/invalid-syntax/strict_assignment_protected.failure.json create mode 100644 lib/test/esprima/invalid-syntax/strict_assignment_protected.js create mode 100644 lib/test/esprima/invalid-syntax/strict_assignment_public.failure.json create mode 100644 lib/test/esprima/invalid-syntax/strict_assignment_public.js create mode 100644 lib/test/esprima/invalid-syntax/strict_assignment_static.failure.json create mode 100644 lib/test/esprima/invalid-syntax/strict_assignment_static.js create mode 100644 lib/test/esprima/invalid-syntax/strict_assignment_yield.failure.json create mode 100644 lib/test/esprima/invalid-syntax/strict_assignment_yield.js create mode 100644 lib/test/esprima/source-element/migrated_0000.js create mode 100644 lib/test/esprima/source-element/migrated_0000.skip create mode 100644 lib/test/esprima/source-element/migrated_0000.tree.json create mode 100644 lib/test/esprima/source-option/migrated_0000.diff create mode 100644 lib/test/esprima/source-option/migrated_0000.js create mode 100644 lib/test/esprima/source-option/migrated_0000.tree.json create mode 100644 lib/test/esprima/source-option/migrated_0001.diff create mode 100644 lib/test/esprima/source-option/migrated_0001.js create mode 100644 lib/test/esprima/source-option/migrated_0001.tree.json create mode 100644 lib/test/esprima/source-type-module/error-delete.js create mode 100644 lib/test/esprima/source-type-module/error-delete.module.json create mode 100644 lib/test/esprima/source-type-module/error-export-if.js create mode 100644 lib/test/esprima/source-type-module/error-export-if.module.json create mode 100644 lib/test/esprima/source-type-module/error-export-in-function.js create mode 100644 lib/test/esprima/source-type-module/error-export-in-function.module.json create mode 100644 lib/test/esprima/source-type-module/error-import-in-function.js create mode 100644 lib/test/esprima/source-type-module/error-import-in-function.module.json create mode 100644 lib/test/esprima/source-type-module/error-invalid-export-declaration.failure.json create mode 100644 lib/test/esprima/source-type-module/error-invalid-export-declaration.js create mode 100644 lib/test/esprima/source-type-module/error-invalid-import-declaration.failure.json create mode 100644 lib/test/esprima/source-type-module/error-invalid-import-declaration.js create mode 100644 lib/test/esprima/source-type-module/error-strict.js create mode 100644 lib/test/esprima/source-type-module/error-strict.module.json create mode 100644 lib/test/esprima/statement/block/migrated_0000.diff create mode 100644 lib/test/esprima/statement/block/migrated_0000.js create mode 100644 lib/test/esprima/statement/block/migrated_0000.tree.json create mode 100644 lib/test/esprima/statement/block/migrated_0001.js create mode 100644 lib/test/esprima/statement/block/migrated_0001.tree.json create mode 100644 lib/test/esprima/statement/block/migrated_0002.js create mode 100644 lib/test/esprima/statement/block/migrated_0002.tree.json create mode 100644 lib/test/esprima/statement/break/migrated_0000.diff create mode 100644 lib/test/esprima/statement/break/migrated_0000.js create mode 100644 lib/test/esprima/statement/break/migrated_0000.tree.json create mode 100644 lib/test/esprima/statement/break/migrated_0001.diff create mode 100644 lib/test/esprima/statement/break/migrated_0001.js create mode 100644 lib/test/esprima/statement/break/migrated_0001.tree.json create mode 100644 lib/test/esprima/statement/break/migrated_0002.js create mode 100644 lib/test/esprima/statement/break/migrated_0002.tree.json create mode 100644 lib/test/esprima/statement/break/migrated_0003.js create mode 100644 lib/test/esprima/statement/break/migrated_0003.tree.json create mode 100644 lib/test/esprima/statement/break/semicolon_newline.js create mode 100644 lib/test/esprima/statement/break/semicolon_newline.tree.json create mode 100644 lib/test/esprima/statement/continue/migrated_0000.js create mode 100644 lib/test/esprima/statement/continue/migrated_0000.tree.json create mode 100644 lib/test/esprima/statement/continue/migrated_0001.diff create mode 100644 lib/test/esprima/statement/continue/migrated_0001.js create mode 100644 lib/test/esprima/statement/continue/migrated_0001.tree.json create mode 100644 lib/test/esprima/statement/continue/migrated_0002.diff create mode 100644 lib/test/esprima/statement/continue/migrated_0002.js create mode 100644 lib/test/esprima/statement/continue/migrated_0002.tree.json create mode 100644 lib/test/esprima/statement/continue/migrated_0003.js create mode 100644 lib/test/esprima/statement/continue/migrated_0003.tree.json create mode 100644 lib/test/esprima/statement/continue/migrated_0004.js create mode 100644 lib/test/esprima/statement/continue/migrated_0004.tree.json create mode 100644 lib/test/esprima/statement/debugger/migrated_0000.js create mode 100644 lib/test/esprima/statement/debugger/migrated_0000.tree.json create mode 100644 lib/test/esprima/statement/empty/migrated_0000.js create mode 100644 lib/test/esprima/statement/empty/migrated_0000.tree.json create mode 100644 lib/test/esprima/statement/expression/migrated_0000.js create mode 100644 lib/test/esprima/statement/expression/migrated_0000.tree.json create mode 100644 lib/test/esprima/statement/expression/migrated_0001.js create mode 100644 lib/test/esprima/statement/expression/migrated_0001.tree.json create mode 100644 lib/test/esprima/statement/expression/migrated_0002.source.js create mode 100644 lib/test/esprima/statement/expression/migrated_0002.tree.json create mode 100644 lib/test/esprima/statement/expression/migrated_0003.source.js create mode 100644 lib/test/esprima/statement/expression/migrated_0003.tree.json create mode 100644 lib/test/esprima/statement/expression/migrated_0004.source.js create mode 100644 lib/test/esprima/statement/expression/migrated_0004.tree.json create mode 100644 lib/test/esprima/statement/expression/migrated_0005.source.js create mode 100644 lib/test/esprima/statement/expression/migrated_0005.tree.json create mode 100644 lib/test/esprima/statement/if/migrated_0000.js create mode 100644 lib/test/esprima/statement/if/migrated_0000.tree.json create mode 100644 lib/test/esprima/statement/if/migrated_0001.js create mode 100644 lib/test/esprima/statement/if/migrated_0001.tree.json create mode 100644 lib/test/esprima/statement/if/migrated_0002.js create mode 100644 lib/test/esprima/statement/if/migrated_0002.tree.json create mode 100644 lib/test/esprima/statement/if/migrated_0003.js create mode 100644 lib/test/esprima/statement/if/migrated_0003.tree.json create mode 100644 lib/test/esprima/statement/if/migrated_0004.js create mode 100644 lib/test/esprima/statement/if/migrated_0004.tree.json create mode 100644 lib/test/esprima/statement/if/migrated_0005.js create mode 100644 lib/test/esprima/statement/if/migrated_0005.tree.json create mode 100644 lib/test/esprima/statement/if/migrated_0006.js create mode 100644 lib/test/esprima/statement/if/migrated_0006.tree.json create mode 100644 lib/test/esprima/statement/iteration/const_forin.js create mode 100644 lib/test/esprima/statement/iteration/const_forin.tree.json create mode 100644 lib/test/esprima/statement/iteration/for-in-let.js create mode 100644 lib/test/esprima/statement/iteration/for-in-let.tree.json create mode 100644 lib/test/esprima/statement/iteration/for-let-let.js create mode 100644 lib/test/esprima/statement/iteration/for-let-let.skip create mode 100644 lib/test/esprima/statement/iteration/for-let-let.tree.json create mode 100644 lib/test/esprima/statement/iteration/for-statement-with-seq.js create mode 100644 lib/test/esprima/statement/iteration/for-statement-with-seq.tree.json create mode 100644 lib/test/esprima/statement/iteration/invalid-strict-for-in-let.failure.json create mode 100644 lib/test/esprima/statement/iteration/invalid-strict-for-in-let.js create mode 100644 lib/test/esprima/statement/iteration/migrated_0000.js create mode 100644 lib/test/esprima/statement/iteration/migrated_0000.tree.json create mode 100644 lib/test/esprima/statement/iteration/migrated_0001.js create mode 100644 lib/test/esprima/statement/iteration/migrated_0001.tree.json create mode 100644 lib/test/esprima/statement/iteration/migrated_0002.js create mode 100644 lib/test/esprima/statement/iteration/migrated_0002.tree.json create mode 100644 lib/test/esprima/statement/iteration/migrated_0003.diff create mode 100644 lib/test/esprima/statement/iteration/migrated_0003.js create mode 100644 lib/test/esprima/statement/iteration/migrated_0003.tree.json create mode 100644 lib/test/esprima/statement/iteration/migrated_0004.js create mode 100644 lib/test/esprima/statement/iteration/migrated_0004.tree.json create mode 100644 lib/test/esprima/statement/iteration/migrated_0005.js create mode 100644 lib/test/esprima/statement/iteration/migrated_0005.tree.json create mode 100644 lib/test/esprima/statement/iteration/migrated_0006.js create mode 100644 lib/test/esprima/statement/iteration/migrated_0006.tree.json create mode 100644 lib/test/esprima/statement/iteration/migrated_0007.js create mode 100644 lib/test/esprima/statement/iteration/migrated_0007.tree.json create mode 100644 lib/test/esprima/statement/iteration/migrated_0008.js create mode 100644 lib/test/esprima/statement/iteration/migrated_0008.tree.json create mode 100644 lib/test/esprima/statement/iteration/migrated_0009.js create mode 100644 lib/test/esprima/statement/iteration/migrated_0009.tree.json create mode 100644 lib/test/esprima/statement/iteration/migrated_0010.js create mode 100644 lib/test/esprima/statement/iteration/migrated_0010.tree.json create mode 100644 lib/test/esprima/statement/iteration/migrated_0011.js create mode 100644 lib/test/esprima/statement/iteration/migrated_0011.tree.json create mode 100644 lib/test/esprima/statement/iteration/migrated_0012.diff create mode 100644 lib/test/esprima/statement/iteration/migrated_0012.js create mode 100644 lib/test/esprima/statement/iteration/migrated_0012.tree.json create mode 100644 lib/test/esprima/statement/iteration/migrated_0013.js create mode 100644 lib/test/esprima/statement/iteration/migrated_0013.tree.json create mode 100644 lib/test/esprima/statement/iteration/migrated_0014.js create mode 100644 lib/test/esprima/statement/iteration/migrated_0014.tree.json create mode 100644 lib/test/esprima/statement/iteration/migrated_0015.js create mode 100644 lib/test/esprima/statement/iteration/migrated_0015.tree.json create mode 100644 lib/test/esprima/statement/iteration/migrated_0016.js create mode 100644 lib/test/esprima/statement/iteration/migrated_0016.tree.json create mode 100644 lib/test/esprima/statement/iteration/migrated_0017.js create mode 100644 lib/test/esprima/statement/iteration/migrated_0017.tree.json create mode 100644 lib/test/esprima/statement/iteration/migrated_0018.js create mode 100644 lib/test/esprima/statement/iteration/migrated_0018.tree.json create mode 100644 lib/test/esprima/statement/iteration/migrated_0019.js create mode 100644 lib/test/esprima/statement/iteration/migrated_0019.skip create mode 100644 lib/test/esprima/statement/iteration/migrated_0019.tree.json create mode 100644 lib/test/esprima/statement/iteration/migrated_0020.js create mode 100644 lib/test/esprima/statement/iteration/migrated_0020.tree.json create mode 100644 lib/test/esprima/statement/iteration/migrated_0021.js create mode 100644 lib/test/esprima/statement/iteration/migrated_0021.skip create mode 100644 lib/test/esprima/statement/iteration/migrated_0021.tree.json create mode 100644 lib/test/esprima/statement/iteration/migrated_0022.js create mode 100644 lib/test/esprima/statement/iteration/migrated_0022.skip create mode 100644 lib/test/esprima/statement/iteration/migrated_0022.tree.json create mode 100644 lib/test/esprima/statement/iteration/migrated_0023.js create mode 100644 lib/test/esprima/statement/iteration/migrated_0023.skip create mode 100644 lib/test/esprima/statement/iteration/migrated_0023.tree.json create mode 100644 lib/test/esprima/statement/iteration/migrated_0024.js create mode 100644 lib/test/esprima/statement/iteration/migrated_0024.tree.json create mode 100644 lib/test/esprima/statement/iteration/migrated_0025.js create mode 100644 lib/test/esprima/statement/iteration/migrated_0025.tree.json create mode 100644 lib/test/esprima/statement/iteration/migrated_0026.js create mode 100644 lib/test/esprima/statement/iteration/migrated_0026.tree.json create mode 100644 lib/test/esprima/statement/iteration/pattern-in-for-in.js create mode 100644 lib/test/esprima/statement/iteration/pattern-in-for-in.tree.json create mode 100644 lib/test/esprima/statement/labelled/migrated_0000.js create mode 100644 lib/test/esprima/statement/labelled/migrated_0000.tree.json create mode 100644 lib/test/esprima/statement/labelled/migrated_0001.js create mode 100644 lib/test/esprima/statement/labelled/migrated_0001.tree.json create mode 100644 lib/test/esprima/statement/labelled/migrated_0002.js create mode 100644 lib/test/esprima/statement/labelled/migrated_0002.tree.json create mode 100644 lib/test/esprima/statement/return/migrated_0000.diff create mode 100644 lib/test/esprima/statement/return/migrated_0000.js create mode 100644 lib/test/esprima/statement/return/migrated_0000.tree.json create mode 100644 lib/test/esprima/statement/return/migrated_0001.js create mode 100644 lib/test/esprima/statement/return/migrated_0001.tree.json create mode 100644 lib/test/esprima/statement/return/migrated_0002.js create mode 100644 lib/test/esprima/statement/return/migrated_0002.tree.json create mode 100644 lib/test/esprima/statement/return/migrated_0003.diff create mode 100644 lib/test/esprima/statement/return/migrated_0003.js create mode 100644 lib/test/esprima/statement/return/migrated_0003.tree.json create mode 100644 lib/test/esprima/statement/switch/migrated_0000.js create mode 100644 lib/test/esprima/statement/switch/migrated_0000.tree.json create mode 100644 lib/test/esprima/statement/switch/migrated_0001.js create mode 100644 lib/test/esprima/statement/switch/migrated_0001.tree.json create mode 100644 lib/test/esprima/statement/switch/migrated_0002.diff create mode 100644 lib/test/esprima/statement/switch/migrated_0002.js create mode 100644 lib/test/esprima/statement/switch/migrated_0002.tree.json create mode 100644 lib/test/esprima/statement/throw/migrated_0000.js create mode 100644 lib/test/esprima/statement/throw/migrated_0000.tree.json create mode 100644 lib/test/esprima/statement/throw/migrated_0001.js create mode 100644 lib/test/esprima/statement/throw/migrated_0001.tree.json create mode 100644 lib/test/esprima/statement/throw/migrated_0002.js create mode 100644 lib/test/esprima/statement/throw/migrated_0002.tree.json create mode 100644 lib/test/esprima/statement/try/migrated_0000.js create mode 100644 lib/test/esprima/statement/try/migrated_0000.tree.json create mode 100644 lib/test/esprima/statement/try/migrated_0001.js create mode 100644 lib/test/esprima/statement/try/migrated_0001.tree.json create mode 100644 lib/test/esprima/statement/try/migrated_0002.js create mode 100644 lib/test/esprima/statement/try/migrated_0002.tree.json create mode 100644 lib/test/esprima/statement/try/migrated_0003.diff create mode 100644 lib/test/esprima/statement/try/migrated_0003.js create mode 100644 lib/test/esprima/statement/try/migrated_0003.tree.json create mode 100644 lib/test/esprima/statement/try/migrated_0004.diff create mode 100644 lib/test/esprima/statement/try/migrated_0004.js create mode 100644 lib/test/esprima/statement/try/migrated_0004.tree.json create mode 100644 lib/test/esprima/statement/try/migrated_0005.diff create mode 100644 lib/test/esprima/statement/try/migrated_0005.js create mode 100644 lib/test/esprima/statement/try/migrated_0005.tree.json create mode 100644 lib/test/esprima/statement/try/migrated_0006.diff create mode 100644 lib/test/esprima/statement/try/migrated_0006.js create mode 100644 lib/test/esprima/statement/try/migrated_0006.tree.json create mode 100644 lib/test/esprima/statement/try/strict_simple_catch.js create mode 100644 lib/test/esprima/statement/try/strict_simple_catch.tree.json create mode 100644 lib/test/esprima/statement/variable/complex-pattern-requires-init.failure.json create mode 100644 lib/test/esprima/statement/variable/complex-pattern-requires-init.js create mode 100644 lib/test/esprima/statement/variable/invalid_trailing_comma_1.failure.json create mode 100644 lib/test/esprima/statement/variable/invalid_trailing_comma_1.js create mode 100644 lib/test/esprima/statement/variable/invalid_trailing_comma_2.failure.json create mode 100644 lib/test/esprima/statement/variable/invalid_trailing_comma_2.js create mode 100644 lib/test/esprima/statement/variable/invalid_trailing_comma_3.failure.json create mode 100644 lib/test/esprima/statement/variable/invalid_trailing_comma_3.js create mode 100644 lib/test/esprima/statement/variable/invalid_trailing_comma_4.failure.json create mode 100644 lib/test/esprima/statement/variable/invalid_trailing_comma_4.js create mode 100644 lib/test/esprima/statement/variable/invalid_trailing_comma_5.failure.json create mode 100644 lib/test/esprima/statement/variable/invalid_trailing_comma_5.js create mode 100644 lib/test/esprima/statement/variable/invalid_trailing_comma_6.failure.json create mode 100644 lib/test/esprima/statement/variable/invalid_trailing_comma_6.js create mode 100644 lib/test/esprima/statement/variable/migrated_0000.js create mode 100644 lib/test/esprima/statement/variable/migrated_0000.tree.json create mode 100644 lib/test/esprima/statement/variable/migrated_0001.js create mode 100644 lib/test/esprima/statement/variable/migrated_0001.tree.json create mode 100644 lib/test/esprima/statement/variable/migrated_0002.js create mode 100644 lib/test/esprima/statement/variable/migrated_0002.tree.json create mode 100644 lib/test/esprima/statement/variable/migrated_0003.js create mode 100644 lib/test/esprima/statement/variable/migrated_0003.tree.json create mode 100644 lib/test/esprima/statement/variable/migrated_0004.js create mode 100644 lib/test/esprima/statement/variable/migrated_0004.tree.json create mode 100644 lib/test/esprima/statement/variable/migrated_0005.js create mode 100644 lib/test/esprima/statement/variable/migrated_0005.tree.json create mode 100644 lib/test/esprima/statement/variable/migrated_0006.js create mode 100644 lib/test/esprima/statement/variable/migrated_0006.tree.json create mode 100644 lib/test/esprima/statement/variable/var_let.js create mode 100644 lib/test/esprima/statement/variable/var_let.tree.json create mode 100644 lib/test/esprima/statement/with/migrated_0000.js create mode 100644 lib/test/esprima/statement/with/migrated_0000.tree.json create mode 100644 lib/test/esprima/statement/with/migrated_0001.js create mode 100644 lib/test/esprima/statement/with/migrated_0001.tree.json create mode 100644 lib/test/esprima/statement/with/migrated_0002.diff create mode 100644 lib/test/esprima/statement/with/migrated_0002.js create mode 100644 lib/test/esprima/statement/with/migrated_0002.tree.json create mode 100644 lib/test/esprima/tokenize/empty.skip create mode 100644 lib/test/esprima/tokenize/empty.tokens.json create mode 100644 lib/test/esprima/tokenize/leading_comment.js create mode 100644 lib/test/esprima/tokenize/leading_comment.tokens.json create mode 100644 lib/test/esprima/tokenize/line_comment.js create mode 100644 lib/test/esprima/tokenize/line_comment.tokens.json create mode 100644 lib/test/esprima/tokenize/line_terminators.js create mode 100644 lib/test/esprima/tokenize/line_terminators.tokens.json create mode 100644 lib/test/esprima/tokenize/migrated_0000.js create mode 100644 lib/test/esprima/tokenize/migrated_0000.tokens.json create mode 100644 lib/test/esprima/tokenize/migrated_0001.js create mode 100644 lib/test/esprima/tokenize/migrated_0001.tokens.json create mode 100644 lib/test/esprima/tokenize/migrated_0002.js create mode 100644 lib/test/esprima/tokenize/migrated_0002.tokens.json create mode 100644 lib/test/esprima/tokenize/migrated_0003.js create mode 100644 lib/test/esprima/tokenize/migrated_0003.tokens.json create mode 100644 lib/test/esprima/tokenize/migrated_0004.js create mode 100644 lib/test/esprima/tokenize/migrated_0004.tokens.json create mode 100644 lib/test/esprima/tokenize/migrated_0005.js create mode 100644 lib/test/esprima/tokenize/migrated_0005.tokens.json create mode 100644 lib/test/esprima/tokenize/migrated_0006.js create mode 100644 lib/test/esprima/tokenize/migrated_0006.tokens.json create mode 100644 lib/test/esprima/tokenize/migrated_0007.js create mode 100644 lib/test/esprima/tokenize/migrated_0007.tokens.json create mode 100644 lib/test/esprima/tokenize/migrated_0008.js create mode 100644 lib/test/esprima/tokenize/migrated_0008.tokens.json create mode 100644 lib/test/esprima/tokenize/migrated_0009.js create mode 100644 lib/test/esprima/tokenize/migrated_0009.tokens.json create mode 100644 lib/test/esprima/tokenize/migrated_0010.js create mode 100644 lib/test/esprima/tokenize/migrated_0010.tokens.json create mode 100644 lib/test/esprima/tokenize/migrated_0011.js create mode 100644 lib/test/esprima/tokenize/migrated_0011.tokens.json create mode 100644 lib/test/esprima/tokenize/migrated_0012.js create mode 100644 lib/test/esprima/tokenize/migrated_0012.tokens.json create mode 100644 lib/test/esprima/tokenize/migrated_0013.skip create mode 100644 lib/test/esprima/tokenize/migrated_0013.tokens.json create mode 100644 lib/test/esprima/tokenize/migrated_0014.failure.json create mode 100644 lib/test/esprima/tokenize/migrated_0014.js create mode 100644 lib/test/esprima/tokenize/migrated_0015.failure.json create mode 100644 lib/test/esprima/tokenize/migrated_0015.js create mode 100644 lib/test/esprima/tokenize/migrated_0016.js create mode 100644 lib/test/esprima/tokenize/migrated_0016.tokens.json create mode 100644 lib/test/esprima/tokenize/trailing_comment.js create mode 100644 lib/test/esprima/tokenize/trailing_comment.tokens.json create mode 100644 lib/test/esprima/tolerant-parse/for-in-missing-parenthesis.diff create mode 100644 lib/test/esprima/tolerant-parse/for-in-missing-parenthesis.js create mode 100644 lib/test/esprima/tolerant-parse/for-in-missing-parenthesis.tree.json create mode 100644 lib/test/esprima/tolerant-parse/for-missing-parenthesis.diff create mode 100644 lib/test/esprima/tolerant-parse/for-missing-parenthesis.js create mode 100644 lib/test/esprima/tolerant-parse/for-missing-parenthesis.tree.json create mode 100644 lib/test/esprima/tolerant-parse/for-of-missing-parenthesis.diff create mode 100644 lib/test/esprima/tolerant-parse/for-of-missing-parenthesis.js create mode 100644 lib/test/esprima/tolerant-parse/for-of-missing-parenthesis.tree.json create mode 100644 lib/test/esprima/tolerant-parse/if-missing-parenthesis.diff create mode 100644 lib/test/esprima/tolerant-parse/if-missing-parenthesis.js create mode 100644 lib/test/esprima/tolerant-parse/if-missing-parenthesis.tree.json create mode 100644 lib/test/esprima/tolerant-parse/let_eval.diff create mode 100644 lib/test/esprima/tolerant-parse/let_eval.js create mode 100644 lib/test/esprima/tolerant-parse/let_eval.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0000.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0000.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0000.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0001.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0001.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0001.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0002.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0002.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0002.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0003.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0003.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0003.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0004.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0004.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0004.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0005.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0005.skip create mode 100644 lib/test/esprima/tolerant-parse/migrated_0005.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0006.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0006.skip create mode 100644 lib/test/esprima/tolerant-parse/migrated_0006.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0007.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0007.skip create mode 100644 lib/test/esprima/tolerant-parse/migrated_0007.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0008.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0008.skip create mode 100644 lib/test/esprima/tolerant-parse/migrated_0008.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0009.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0009.skip create mode 100644 lib/test/esprima/tolerant-parse/migrated_0009.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0010.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0010.skip create mode 100644 lib/test/esprima/tolerant-parse/migrated_0010.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0011.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0011.skip create mode 100644 lib/test/esprima/tolerant-parse/migrated_0011.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0012.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0012.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0012.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0013.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0013.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0013.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0014.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0014.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0014.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0015.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0015.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0015.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0016.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0016.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0016.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0017.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0017.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0017.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0018.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0018.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0018.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0019.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0019.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0019.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0020.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0020.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0020.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0021.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0021.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0021.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0022.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0022.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0022.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0023.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0023.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0023.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0024.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0024.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0024.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0025.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0025.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0025.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0026.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0026.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0026.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0027.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0027.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0027.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0028.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0028.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0028.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0029.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0029.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0029.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0030.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0030.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0030.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0031.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0031.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0031.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0032.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0032.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0032.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0033.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0033.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0033.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0034.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0034.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0034.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0035.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0035.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0035.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0036.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0036.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0036.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0037.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0037.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0037.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0038.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0038.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0038.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0039.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0039.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0039.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0040.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0040.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0040.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0041.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0041.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0041.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0042.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0042.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0042.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0043.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0043.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0043.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0044.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0044.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0044.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0045.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0045.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0045.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0046.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0046.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0046.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0047.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0047.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0047.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0048.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0048.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0048.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0049.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0049.skip create mode 100644 lib/test/esprima/tolerant-parse/migrated_0049.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0050.source.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0050.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0051.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0051.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0051.tree.json create mode 100644 lib/test/esprima/tolerant-parse/migrated_0052.diff create mode 100644 lib/test/esprima/tolerant-parse/migrated_0052.js create mode 100644 lib/test/esprima/tolerant-parse/migrated_0052.tree.json create mode 100644 lib/test/esprima/tolerant-parse/string_literal_escape_eight.js create mode 100644 lib/test/esprima/tolerant-parse/string_literal_escape_eight.skip create mode 100644 lib/test/esprima/tolerant-parse/string_literal_escape_eight.tree.json create mode 100644 lib/test/esprima/tolerant-parse/while-missing-parenthesis.diff create mode 100644 lib/test/esprima/tolerant-parse/while-missing-parenthesis.js create mode 100644 lib/test/esprima/tolerant-parse/while-missing-parenthesis.tree.json create mode 100644 lib/test/esprima/whitespace/migrated_0000.source.js create mode 100644 lib/test/esprima/whitespace/migrated_0000.tree.json create mode 100644 lib/test/esprima/whitespace/migrated_0001.source.js create mode 100644 lib/test/esprima/whitespace/migrated_0001.tree.json create mode 100644 lib/test/esprima_tests.js create mode 100644 lib/test/file_utils.ml create mode 100644 lib/test/file_utils.mli create mode 100644 lib/test/flow/ES6/binding-pattern/array-pattern/rest_not_final.js create mode 100644 lib/test/flow/ES6/binding-pattern/array-pattern/rest_not_final.tree.json create mode 100644 lib/test/flow/ES6/binding-pattern/object-pattern/await-prop-in-async-function.js create mode 100644 lib/test/flow/ES6/binding-pattern/object-pattern/await-prop-in-async-function.tree.json create mode 100644 lib/test/flow/ES6/binding-pattern/object-pattern/eval-prop-assignment-strict.js create mode 100644 lib/test/flow/ES6/binding-pattern/object-pattern/eval-prop-assignment-strict.tree.json create mode 100644 lib/test/flow/ES6/binding-pattern/object-pattern/methods_are_invalid.js create mode 100644 lib/test/flow/ES6/binding-pattern/object-pattern/methods_are_invalid.tree.json create mode 100644 lib/test/flow/ES6/binding-pattern/object-pattern/public-prop-assignment-strict.js create mode 100644 lib/test/flow/ES6/binding-pattern/object-pattern/public-prop-assignment-strict.tree.json create mode 100644 lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-alias-assignment-strict.js create mode 100644 lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-alias-assignment-strict.tree.json create mode 100644 lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-alias-invalid-assignment-strict.js create mode 100644 lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-alias-invalid-assignment-strict.tree.json create mode 100644 lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-assignment-strict.js create mode 100644 lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-assignment-strict.tree.json create mode 100644 lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-binding-strict.js create mode 100644 lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-binding-strict.tree.json create mode 100644 lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-in-generator-strict.js create mode 100644 lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-in-generator-strict.tree.json create mode 100644 lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-in-generator.js create mode 100644 lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-in-generator.tree.json create mode 100644 lib/test/flow/ES6/computed_properties/migrated_0000.js create mode 100644 lib/test/flow/ES6/computed_properties/migrated_0000.tree.json create mode 100644 lib/test/flow/ES6/modules/export_default_class_implements.js create mode 100644 lib/test/flow/ES6/modules/export_default_class_implements.tree.json create mode 100644 lib/test/flow/ES6/modules/migrated_0000.js create mode 100644 lib/test/flow/ES6/modules/migrated_0000.tree.json create mode 100644 lib/test/flow/ES6/modules/migrated_0001.js create mode 100644 lib/test/flow/ES6/modules/migrated_0001.tree.json create mode 100644 lib/test/flow/ES6/modules/migrated_0002.js create mode 100644 lib/test/flow/ES6/modules/migrated_0002.tree.json create mode 100644 lib/test/flow/ES6/modules/migrated_0003.js create mode 100644 lib/test/flow/ES6/modules/migrated_0003.tree.json create mode 100644 lib/test/flow/ES6/modules/migrated_0004.js create mode 100644 lib/test/flow/ES6/modules/migrated_0004.tree.json create mode 100644 lib/test/flow/ES6/modules/migrated_0005.js create mode 100644 lib/test/flow/ES6/modules/migrated_0005.tree.json create mode 100644 lib/test/flow/ES6/modules/migrated_0006.js create mode 100644 lib/test/flow/ES6/modules/migrated_0006.tree.json create mode 100644 lib/test/flow/ES6/modules/migrated_0007.js create mode 100644 lib/test/flow/ES6/modules/migrated_0007.tree.json create mode 100644 lib/test/flow/ES6/modules/migrated_0008.js create mode 100644 lib/test/flow/ES6/modules/migrated_0008.options.json create mode 100644 lib/test/flow/ES6/modules/migrated_0008.tree.json create mode 100644 lib/test/flow/ES6/modules/migrated_0009.js create mode 100644 lib/test/flow/ES6/modules/migrated_0009.tree.json create mode 100644 lib/test/flow/ES6/modules/migrated_0010.js create mode 100644 lib/test/flow/ES6/modules/migrated_0010.tree.json create mode 100644 lib/test/flow/ES6/modules/migrated_0011.js create mode 100644 lib/test/flow/ES6/modules/migrated_0011.tree.json create mode 100644 lib/test/flow/ES6/modules/migrated_0012.js create mode 100644 lib/test/flow/ES6/modules/migrated_0012.tree.json create mode 100644 lib/test/flow/ES6/modules/migrated_0013.js create mode 100644 lib/test/flow/ES6/modules/migrated_0013.tree.json create mode 100644 lib/test/flow/ES6/modules/migrated_0014.js create mode 100644 lib/test/flow/ES6/modules/migrated_0014.tree.json create mode 100644 lib/test/flow/ES6/modules/migrated_0015.js create mode 100644 lib/test/flow/ES6/modules/migrated_0015.tree.json create mode 100644 lib/test/flow/ES6/modules/migrated_0016.js create mode 100644 lib/test/flow/ES6/modules/migrated_0016.tree.json create mode 100644 lib/test/flow/ES6/modules/migrated_0017.js create mode 100644 lib/test/flow/ES6/modules/migrated_0017.tree.json create mode 100644 lib/test/flow/ES6/modules/migrated_0018.js create mode 100644 lib/test/flow/ES6/modules/migrated_0018.tree.json create mode 100644 lib/test/flow/ES6/modules/migrated_0019.js create mode 100644 lib/test/flow/ES6/modules/migrated_0019.tree.json create mode 100644 lib/test/flow/ES6/modules/migrated_0020.js create mode 100644 lib/test/flow/ES6/modules/migrated_0020.tree.json create mode 100644 lib/test/flow/ES6/modules/migrated_0021.js create mode 100644 lib/test/flow/ES6/modules/migrated_0021.tree.json create mode 100644 lib/test/flow/ES6/modules/migrated_0022.js create mode 100644 lib/test/flow/ES6/modules/migrated_0022.tree.json create mode 100644 lib/test/flow/ES6/modules/migrated_0023.js create mode 100644 lib/test/flow/ES6/modules/migrated_0023.tree.json create mode 100644 lib/test/flow/ES6/modules/migrated_0024.js create mode 100644 lib/test/flow/ES6/modules/migrated_0024.tree.json create mode 100644 lib/test/flow/ES6/object_short_notation/migrated_0000.js create mode 100644 lib/test/flow/ES6/object_short_notation/migrated_0000.tree.json create mode 100644 lib/test/flow/ES6/object_short_notation/migrated_0001.js create mode 100644 lib/test/flow/ES6/object_short_notation/migrated_0001.tree.json create mode 100644 lib/test/flow/ES6/object_short_notation/migrated_0002.js create mode 100644 lib/test/flow/ES6/object_short_notation/migrated_0002.tree.json create mode 100644 lib/test/flow/ES6/octal-integer-literal/migrated_0000.js create mode 100644 lib/test/flow/ES6/octal-integer-literal/migrated_0000.tree.json create mode 100644 lib/test/flow/ES6/octal-integer-literal/migrated_0001.js create mode 100644 lib/test/flow/ES6/octal-integer-literal/migrated_0001.tree.json create mode 100644 lib/test/flow/ES6/octal-integer-literal/migrated_0002.js create mode 100644 lib/test/flow/ES6/octal-integer-literal/migrated_0002.tree.json create mode 100644 lib/test/flow/ES6/super-property/super-call-in-static-constructor.js create mode 100644 lib/test/flow/ES6/super-property/super-call-in-static-constructor.tree.json create mode 100644 lib/test/flow/ES6/yield/invalid-yield-expression.js create mode 100644 lib/test/flow/ES6/yield/invalid-yield-expression.tree.json create mode 100644 lib/test/flow/ES6/yield/invalid-yield-ident-arrow-param-strict.js create mode 100644 lib/test/flow/ES6/yield/invalid-yield-ident-arrow-param-strict.tree.json create mode 100644 lib/test/flow/ES6/yield/invalid-yield-ident-assign-strict.js create mode 100644 lib/test/flow/ES6/yield/invalid-yield-ident-assign-strict.tree.json create mode 100644 lib/test/flow/ES6/yield/invalid-yield-ident-dstr-strict.js create mode 100644 lib/test/flow/ES6/yield/invalid-yield-ident-dstr-strict.tree.json create mode 100644 lib/test/flow/ES6/yield/invalid-yield-ident-func-param-strict.js create mode 100644 lib/test/flow/ES6/yield/invalid-yield-ident-func-param-strict.tree.json create mode 100644 lib/test/flow/ES6/yield/migrated_0000.js create mode 100644 lib/test/flow/ES6/yield/migrated_0000.tree.json create mode 100644 lib/test/flow/ES6/yield/migrated_0001.js create mode 100644 lib/test/flow/ES6/yield/migrated_0001.tree.json create mode 100644 lib/test/flow/ES6/yield/migrated_0002.js create mode 100644 lib/test/flow/ES6/yield/migrated_0002.tree.json create mode 100644 lib/test/flow/ES6/yield/migrated_0003.js create mode 100644 lib/test/flow/ES6/yield/migrated_0003.tree.json create mode 100644 lib/test/flow/ES6/yield/migrated_0004.js create mode 100644 lib/test/flow/ES6/yield/migrated_0004.tree.json create mode 100644 lib/test/flow/ES6/yield/migrated_0005.js create mode 100644 lib/test/flow/ES6/yield/migrated_0005.tree.json create mode 100644 lib/test/flow/JSX/gt_in_attribute.js create mode 100644 lib/test/flow/JSX/gt_in_attribute.tree.json create mode 100644 lib/test/flow/JSX/html_entity_at_start_of_child.js create mode 100644 lib/test/flow/JSX/html_entity_at_start_of_child.tree.json create mode 100644 lib/test/flow/JSX/invalid_unpaired_gt.js create mode 100644 lib/test/flow/JSX/invalid_unpaired_gt.tree.json create mode 100644 lib/test/flow/JSX/invalid_unpaired_rcurly.js create mode 100644 lib/test/flow/JSX/invalid_unpaired_rcurly.tree.json create mode 100644 lib/test/flow/JSX/migrated_0000.js create mode 100644 lib/test/flow/JSX/migrated_0000.tree.json create mode 100644 lib/test/flow/JSX/migrated_0001.js create mode 100644 lib/test/flow/JSX/migrated_0001.tree.json create mode 100644 lib/test/flow/JSX/migrated_0002.js create mode 100644 lib/test/flow/JSX/migrated_0002.tree.json create mode 100644 lib/test/flow/JSX/mismatched_closing_tag.js create mode 100644 lib/test/flow/JSX/mismatched_closing_tag.tree.json create mode 100644 lib/test/flow/JSX/partial_closing_tag.js create mode 100644 lib/test/flow/JSX/partial_closing_tag.tree.json create mode 100644 lib/test/flow/JSX/partial_opening_tag.js create mode 100644 lib/test/flow/JSX/partial_opening_tag.tree.json create mode 100644 lib/test/flow/JSX/partial_opening_tag_frag.js create mode 100644 lib/test/flow/JSX/partial_opening_tag_frag.tree.json create mode 100644 lib/test/flow/JSX/rcurly_in_attribute.js create mode 100644 lib/test/flow/JSX/rcurly_in_attribute.tree.json create mode 100644 lib/test/flow/JSX_invalid/migrated_0000.js create mode 100644 lib/test/flow/JSX_invalid/migrated_0000.tree.json create mode 100644 lib/test/flow/JSX_invalid/migrated_0001.js create mode 100644 lib/test/flow/JSX_invalid/migrated_0001.tree.json create mode 100644 lib/test/flow/JSX_invalid/migrated_0002.js create mode 100644 lib/test/flow/JSX_invalid/migrated_0002.tree.json create mode 100644 lib/test/flow/array_literal_spreads/migrated_0000.js create mode 100644 lib/test/flow/array_literal_spreads/migrated_0000.tree.json create mode 100644 lib/test/flow/array_literal_spreads/migrated_0001.js create mode 100644 lib/test/flow/array_literal_spreads/migrated_0001.tree.json create mode 100644 lib/test/flow/array_literal_spreads/migrated_0002.js create mode 100644 lib/test/flow/array_literal_spreads/migrated_0002.tree.json create mode 100644 lib/test/flow/array_literal_spreads/migrated_0003.js create mode 100644 lib/test/flow/array_literal_spreads/migrated_0003.tree.json create mode 100644 lib/test/flow/arrow_function/migrated_0000.js create mode 100644 lib/test/flow/arrow_function/migrated_0000.tree.json create mode 100644 lib/test/flow/arrow_function/migrated_0001.js create mode 100644 lib/test/flow/arrow_function/migrated_0001.tree.json create mode 100644 lib/test/flow/arrow_function/migrated_0002.js create mode 100644 lib/test/flow/arrow_function/migrated_0002.tree.json create mode 100644 lib/test/flow/arrow_function/migrated_0003.js create mode 100644 lib/test/flow/arrow_function/migrated_0003.tree.json create mode 100644 lib/test/flow/arrow_function/migrated_0004.js create mode 100644 lib/test/flow/arrow_function/migrated_0004.tree.json create mode 100644 lib/test/flow/arrow_function/migrated_0005.js create mode 100644 lib/test/flow/arrow_function/migrated_0005.tree.json create mode 100644 lib/test/flow/arrow_function/migrated_0006.js create mode 100644 lib/test/flow/arrow_function/migrated_0006.tree.json create mode 100644 lib/test/flow/arrow_function/object_return_type.js create mode 100644 lib/test/flow/arrow_function/object_return_type.tree.json create mode 100644 lib/test/flow/arrow_function/param-dflt-yield-expr.js create mode 100644 lib/test/flow/arrow_function/param-dflt-yield-expr.tree.json create mode 100644 lib/test/flow/arrow_function/param-dflt-yield-id.js create mode 100644 lib/test/flow/arrow_function/param-dflt-yield-id.tree.json create mode 100644 lib/test/flow/arrow_function/tuple_return_type.js create mode 100644 lib/test/flow/arrow_function/tuple_return_type.tree.json create mode 100644 lib/test/flow/arrow_function_invalid/migrated_0000.js create mode 100644 lib/test/flow/arrow_function_invalid/migrated_0000.tree.json create mode 100644 lib/test/flow/arrow_function_invalid/migrated_0001.js create mode 100644 lib/test/flow/arrow_function_invalid/migrated_0001.tree.json create mode 100644 lib/test/flow/arrow_function_invalid/migrated_0002.js create mode 100644 lib/test/flow/arrow_function_invalid/migrated_0002.tree.json create mode 100644 lib/test/flow/arrow_function_invalid/migrated_0003.js create mode 100644 lib/test/flow/arrow_function_invalid/migrated_0003.tree.json create mode 100644 lib/test/flow/arrow_function_invalid/migrated_0004.js create mode 100644 lib/test/flow/arrow_function_invalid/migrated_0004.tree.json create mode 100644 lib/test/flow/async_arrow_functions/migrated_0000.js create mode 100644 lib/test/flow/async_arrow_functions/migrated_0000.tree.json create mode 100644 lib/test/flow/async_arrow_functions/migrated_0001.js create mode 100644 lib/test/flow/async_arrow_functions/migrated_0001.tree.json create mode 100644 lib/test/flow/async_arrow_functions/migrated_0002.js create mode 100644 lib/test/flow/async_arrow_functions/migrated_0002.tree.json create mode 100644 lib/test/flow/async_arrow_functions/migrated_0003.js create mode 100644 lib/test/flow/async_arrow_functions/migrated_0003.tree.json create mode 100644 lib/test/flow/async_arrow_functions/migrated_0004.js create mode 100644 lib/test/flow/async_arrow_functions/migrated_0004.tree.json create mode 100644 lib/test/flow/async_arrow_functions/migrated_0005.js create mode 100644 lib/test/flow/async_arrow_functions/migrated_0005.tree.json create mode 100644 lib/test/flow/async_arrow_functions/migrated_0006.js create mode 100644 lib/test/flow/async_arrow_functions/migrated_0006.tree.json create mode 100644 lib/test/flow/async_arrow_functions/migrated_0007.js create mode 100644 lib/test/flow/async_arrow_functions/migrated_0007.tree.json create mode 100644 lib/test/flow/async_arrow_functions/migrated_0008.js create mode 100644 lib/test/flow/async_arrow_functions/migrated_0008.tree.json create mode 100644 lib/test/flow/async_arrow_functions/migrated_0009.js create mode 100644 lib/test/flow/async_arrow_functions/migrated_0009.tree.json create mode 100644 lib/test/flow/async_arrow_functions/with_type_parameters.js create mode 100644 lib/test/flow/async_arrow_functions/with_type_parameters.tree.json create mode 100644 lib/test/flow/async_arrow_functions/with_type_parameters_types_disabled.js create mode 100644 lib/test/flow/async_arrow_functions/with_type_parameters_types_disabled.options.json create mode 100644 lib/test/flow/async_arrow_functions/with_type_parameters_types_disabled.tree.json create mode 100644 lib/test/flow/async_await/async_computed_method.js create mode 100644 lib/test/flow/async_await/async_computed_method.tree.json create mode 100644 lib/test/flow/async_await/async_generic_method.js create mode 100644 lib/test/flow/async_await/async_generic_method.tree.json create mode 100644 lib/test/flow/async_await/migrated_0000.js create mode 100644 lib/test/flow/async_await/migrated_0000.tree.json create mode 100644 lib/test/flow/async_await/migrated_0001.js create mode 100644 lib/test/flow/async_await/migrated_0001.tree.json create mode 100644 lib/test/flow/async_await/migrated_0002.js create mode 100644 lib/test/flow/async_await/migrated_0002.tree.json create mode 100644 lib/test/flow/async_await/migrated_0003.js create mode 100644 lib/test/flow/async_await/migrated_0003.tree.json create mode 100644 lib/test/flow/async_await/migrated_0004.js create mode 100644 lib/test/flow/async_await/migrated_0004.tree.json create mode 100644 lib/test/flow/async_await/migrated_0005.js create mode 100644 lib/test/flow/async_await/migrated_0005.tree.json create mode 100644 lib/test/flow/async_await/migrated_0006.js create mode 100644 lib/test/flow/async_await/migrated_0006.tree.json create mode 100644 lib/test/flow/async_await/migrated_0007.js create mode 100644 lib/test/flow/async_await/migrated_0007.tree.json create mode 100644 lib/test/flow/async_await/migrated_0008.js create mode 100644 lib/test/flow/async_await/migrated_0008.tree.json create mode 100644 lib/test/flow/async_await/migrated_0009.js create mode 100644 lib/test/flow/async_await/migrated_0009.tree.json create mode 100644 lib/test/flow/async_await/migrated_0010.js create mode 100644 lib/test/flow/async_await/migrated_0010.tree.json create mode 100644 lib/test/flow/async_await/migrated_0011.js create mode 100644 lib/test/flow/async_await/migrated_0011.tree.json create mode 100644 lib/test/flow/async_await/migrated_0012.js create mode 100644 lib/test/flow/async_await/migrated_0012.tree.json create mode 100644 lib/test/flow/async_await/migrated_0013.js create mode 100644 lib/test/flow/async_await/migrated_0013.tree.json create mode 100644 lib/test/flow/async_await/migrated_0014.js create mode 100644 lib/test/flow/async_await/migrated_0014.tree.json create mode 100644 lib/test/flow/async_await/migrated_0015.js create mode 100644 lib/test/flow/async_await/migrated_0015.tree.json create mode 100644 lib/test/flow/async_await/migrated_0016.js create mode 100644 lib/test/flow/async_await/migrated_0016.tree.json create mode 100644 lib/test/flow/async_await/migrated_0017.js create mode 100644 lib/test/flow/async_await/migrated_0017.tree.json create mode 100644 lib/test/flow/async_await/migrated_0018.js create mode 100644 lib/test/flow/async_await/migrated_0018.tree.json create mode 100644 lib/test/flow/async_await/migrated_0019.js create mode 100644 lib/test/flow/async_await/migrated_0019.tree.json create mode 100644 lib/test/flow/async_await/migrated_0020.js create mode 100644 lib/test/flow/async_await/migrated_0020.tree.json create mode 100644 lib/test/flow/async_await/migrated_0021.js create mode 100644 lib/test/flow/async_await/migrated_0021.tree.json create mode 100644 lib/test/flow/async_await/migrated_0022.js create mode 100644 lib/test/flow/async_await/migrated_0022.tree.json create mode 100644 lib/test/flow/async_await/migrated_0023.js create mode 100644 lib/test/flow/async_await/migrated_0023.tree.json create mode 100644 lib/test/flow/async_await/migrated_0024.js create mode 100644 lib/test/flow/async_await/migrated_0024.tree.json create mode 100644 lib/test/flow/async_await/migrated_0025.js create mode 100644 lib/test/flow/async_await/migrated_0025.tree.json create mode 100644 lib/test/flow/async_await/migrated_0026.js create mode 100644 lib/test/flow/async_await/migrated_0026.tree.json create mode 100644 lib/test/flow/async_await/migrated_0027.js create mode 100644 lib/test/flow/async_await/migrated_0027.tree.json create mode 100644 lib/test/flow/async_generators/migrated_0000.js create mode 100644 lib/test/flow/async_generators/migrated_0000.tree.json create mode 100644 lib/test/flow/async_generators/migrated_0001.js create mode 100644 lib/test/flow/async_generators/migrated_0001.tree.json create mode 100644 lib/test/flow/async_generators/migrated_0002.js create mode 100644 lib/test/flow/async_generators/migrated_0002.tree.json create mode 100644 lib/test/flow/async_generators/migrated_0003.js create mode 100644 lib/test/flow/async_generators/migrated_0003.tree.json create mode 100644 lib/test/flow/async_generators/migrated_0004.js create mode 100644 lib/test/flow/async_generators/migrated_0004.tree.json create mode 100644 lib/test/flow/async_generators/migrated_0005.js create mode 100644 lib/test/flow/async_generators/migrated_0005.tree.json create mode 100644 lib/test/flow/async_generators/migrated_0006.js create mode 100644 lib/test/flow/async_generators/migrated_0006.tree.json create mode 100644 lib/test/flow/async_generators/migrated_0007.js create mode 100644 lib/test/flow/async_generators/migrated_0007.tree.json create mode 100644 lib/test/flow/async_generators/migrated_0008.js create mode 100644 lib/test/flow/async_generators/migrated_0008.tree.json create mode 100644 lib/test/flow/bigint/binary-invalid-digit.js create mode 100644 lib/test/flow/bigint/binary-invalid-digit.tree.json create mode 100644 lib/test/flow/bigint/binary-invalid-word.js create mode 100644 lib/test/flow/bigint/binary-invalid-word.tree.json create mode 100644 lib/test/flow/bigint/exponent-part.js create mode 100644 lib/test/flow/bigint/exponent-part.tree.json create mode 100644 lib/test/flow/bigint/float-invalid-dot-dot.js create mode 100644 lib/test/flow/bigint/float-invalid-dot-dot.tree.json create mode 100644 lib/test/flow/bigint/float-invalid-dot.js create mode 100644 lib/test/flow/bigint/float-invalid-dot.tree.json create mode 100644 lib/test/flow/bigint/float-invalid-without-fractional-digits.js create mode 100644 lib/test/flow/bigint/float-invalid-without-fractional-digits.tree.json create mode 100644 lib/test/flow/bigint/float-invalid.js create mode 100644 lib/test/flow/bigint/float-invalid.tree.json create mode 100644 lib/test/flow/bigint/hex-invalid-word.js create mode 100644 lib/test/flow/bigint/hex-invalid-word.tree.json create mode 100644 lib/test/flow/bigint/hexadecimal-invalid-digit.js create mode 100644 lib/test/flow/bigint/hexadecimal-invalid-digit.tree.json create mode 100644 lib/test/flow/bigint/legacy-octal-invalid.js create mode 100644 lib/test/flow/bigint/legacy-octal-invalid.tree.json create mode 100644 lib/test/flow/bigint/octal-new-invalid-word.js create mode 100644 lib/test/flow/bigint/octal-new-invalid-word.tree.json create mode 100644 lib/test/flow/bigint/small-invalid-word.js create mode 100644 lib/test/flow/bigint/small-invalid-word.tree.json create mode 100644 lib/test/flow/bigint/valid-binary.js create mode 100644 lib/test/flow/bigint/valid-binary.tree.json create mode 100644 lib/test/flow/bigint/valid-hex.js create mode 100644 lib/test/flow/bigint/valid-hex.tree.json create mode 100644 lib/test/flow/bigint/valid-large.js create mode 100644 lib/test/flow/bigint/valid-large.tree.json create mode 100644 lib/test/flow/bigint/valid-octal-new.js create mode 100644 lib/test/flow/bigint/valid-octal-new.tree.json create mode 100644 lib/test/flow/bigint/valid-small.js create mode 100644 lib/test/flow/bigint/valid-small.tree.json create mode 100644 lib/test/flow/call_properties/migrated_0000.js create mode 100644 lib/test/flow/call_properties/migrated_0000.tree.json create mode 100644 lib/test/flow/call_properties/migrated_0001.js create mode 100644 lib/test/flow/call_properties/migrated_0001.tree.json create mode 100644 lib/test/flow/call_properties/migrated_0002.js create mode 100644 lib/test/flow/call_properties/migrated_0002.tree.json create mode 100644 lib/test/flow/call_properties/migrated_0003.js create mode 100644 lib/test/flow/call_properties/migrated_0003.tree.json create mode 100644 lib/test/flow/call_properties/migrated_0004.js create mode 100644 lib/test/flow/call_properties/migrated_0004.tree.json create mode 100644 lib/test/flow/call_properties_invalid/migrated_0000.js create mode 100644 lib/test/flow/call_properties_invalid/migrated_0000.tree.json create mode 100644 lib/test/flow/catch/optional_catch_binding.js create mode 100644 lib/test/flow/catch/optional_catch_binding.tree.json create mode 100644 lib/test/flow/class_expression/anonymous_implements.js create mode 100644 lib/test/flow/class_expression/anonymous_implements.tree.json create mode 100644 lib/test/flow/class_expression/anonymous_with_type_params.js create mode 100644 lib/test/flow/class_expression/anonymous_with_type_params.tree.json create mode 100644 lib/test/flow/class_method_kinds/async_as_id_tparams.js create mode 100644 lib/test/flow/class_method_kinds/async_as_id_tparams.tree.json create mode 100644 lib/test/flow/class_method_kinds/async_tparams.js create mode 100644 lib/test/flow/class_method_kinds/async_tparams.tree.json create mode 100644 lib/test/flow/class_method_kinds/get_as_id.js create mode 100644 lib/test/flow/class_method_kinds/get_as_id.tree.json create mode 100644 lib/test/flow/class_method_kinds/get_as_id_tparams.js create mode 100644 lib/test/flow/class_method_kinds/get_as_id_tparams.tree.json create mode 100644 lib/test/flow/class_method_kinds/migrated_0000.js create mode 100644 lib/test/flow/class_method_kinds/migrated_0000.tree.json create mode 100644 lib/test/flow/class_method_kinds/migrated_0001.js create mode 100644 lib/test/flow/class_method_kinds/migrated_0001.tree.json create mode 100644 lib/test/flow/class_method_kinds/migrated_0002.js create mode 100644 lib/test/flow/class_method_kinds/migrated_0002.tree.json create mode 100644 lib/test/flow/class_method_kinds/migrated_0003.js create mode 100644 lib/test/flow/class_method_kinds/migrated_0003.tree.json create mode 100644 lib/test/flow/class_method_kinds/migrated_0004.js create mode 100644 lib/test/flow/class_method_kinds/migrated_0004.tree.json create mode 100644 lib/test/flow/class_method_kinds/migrated_0005.js create mode 100644 lib/test/flow/class_method_kinds/migrated_0005.tree.json create mode 100644 lib/test/flow/class_method_kinds/migrated_0006.js create mode 100644 lib/test/flow/class_method_kinds/migrated_0006.tree.json create mode 100644 lib/test/flow/class_method_kinds/migrated_0007.js create mode 100644 lib/test/flow/class_method_kinds/migrated_0007.tree.json create mode 100644 lib/test/flow/class_method_kinds/multiple_constructors.js create mode 100644 lib/test/flow/class_method_kinds/multiple_constructors.tree.json create mode 100644 lib/test/flow/class_method_kinds/polymorphic_getter.js create mode 100644 lib/test/flow/class_method_kinds/polymorphic_getter.tree.json create mode 100644 lib/test/flow/class_method_kinds/static_async.js create mode 100644 lib/test/flow/class_method_kinds/static_async.tree.json create mode 100644 lib/test/flow/class_method_kinds/static_async_as_id.js create mode 100644 lib/test/flow/class_method_kinds/static_async_as_id.tree.json create mode 100644 lib/test/flow/class_properties/async.js create mode 100644 lib/test/flow/class_properties/async.tree.json create mode 100644 lib/test/flow/class_properties/async_annotated.js create mode 100644 lib/test/flow/class_properties/async_annotated.tree.json create mode 100644 lib/test/flow/class_properties/async_asi.js create mode 100644 lib/test/flow/class_properties/async_asi.tree.json create mode 100644 lib/test/flow/class_properties/async_initializer.js create mode 100644 lib/test/flow/class_properties/async_initializer.options.json create mode 100644 lib/test/flow/class_properties/async_initializer.tree.json create mode 100644 lib/test/flow/class_properties/computed.js create mode 100644 lib/test/flow/class_properties/computed.tree.json create mode 100644 lib/test/flow/class_properties/get.js create mode 100644 lib/test/flow/class_properties/get.tree.json create mode 100644 lib/test/flow/class_properties/migrated_0000.js create mode 100644 lib/test/flow/class_properties/migrated_0000.tree.json create mode 100644 lib/test/flow/class_properties/migrated_0001.js create mode 100644 lib/test/flow/class_properties/migrated_0001.tree.json create mode 100644 lib/test/flow/class_properties/migrated_0002.js create mode 100644 lib/test/flow/class_properties/migrated_0002.options.json create mode 100644 lib/test/flow/class_properties/migrated_0002.tree.json create mode 100644 lib/test/flow/class_properties/migrated_0003.js create mode 100644 lib/test/flow/class_properties/migrated_0003.options.json create mode 100644 lib/test/flow/class_properties/migrated_0003.tree.json create mode 100644 lib/test/flow/class_properties/migrated_0004.js create mode 100644 lib/test/flow/class_properties/migrated_0004.options.json create mode 100644 lib/test/flow/class_properties/migrated_0004.tree.json create mode 100644 lib/test/flow/class_properties/migrated_0005.js create mode 100644 lib/test/flow/class_properties/migrated_0005.tree.json create mode 100644 lib/test/flow/class_properties/migrated_0006.js create mode 100644 lib/test/flow/class_properties/migrated_0006.tree.json create mode 100644 lib/test/flow/class_properties/migrated_0007.js create mode 100644 lib/test/flow/class_properties/migrated_0007.options.json create mode 100644 lib/test/flow/class_properties/migrated_0007.tree.json create mode 100644 lib/test/flow/class_properties/migrated_0008.js create mode 100644 lib/test/flow/class_properties/migrated_0008.options.json create mode 100644 lib/test/flow/class_properties/migrated_0008.tree.json create mode 100644 lib/test/flow/class_properties/migrated_0009.js create mode 100644 lib/test/flow/class_properties/migrated_0009.options.json create mode 100644 lib/test/flow/class_properties/migrated_0009.tree.json create mode 100644 lib/test/flow/class_properties/migrated_0010.js create mode 100644 lib/test/flow/class_properties/migrated_0010.options.json create mode 100644 lib/test/flow/class_properties/migrated_0010.tree.json create mode 100644 lib/test/flow/class_properties/migrated_0011.js create mode 100644 lib/test/flow/class_properties/migrated_0011.tree.json create mode 100644 lib/test/flow/class_properties/migrated_0012.js create mode 100644 lib/test/flow/class_properties/migrated_0012.tree.json create mode 100644 lib/test/flow/class_properties/migrated_0013.js create mode 100644 lib/test/flow/class_properties/migrated_0013.options.json create mode 100644 lib/test/flow/class_properties/migrated_0013.tree.json create mode 100644 lib/test/flow/class_properties/migrated_0014.js create mode 100644 lib/test/flow/class_properties/migrated_0014.tree.json create mode 100644 lib/test/flow/class_properties/migrated_0015.js create mode 100644 lib/test/flow/class_properties/migrated_0015.tree.json create mode 100644 lib/test/flow/class_properties/migrated_0016.js create mode 100644 lib/test/flow/class_properties/migrated_0016.tree.json create mode 100644 lib/test/flow/class_properties/migrated_0017.js create mode 100644 lib/test/flow/class_properties/migrated_0017.tree.json create mode 100644 lib/test/flow/class_properties/migrated_0018.js create mode 100644 lib/test/flow/class_properties/migrated_0018.options.json create mode 100644 lib/test/flow/class_properties/migrated_0018.tree.json create mode 100644 lib/test/flow/class_properties/migrated_0019.js create mode 100644 lib/test/flow/class_properties/migrated_0019.tree.json create mode 100644 lib/test/flow/class_properties/migrated_0020.js create mode 100644 lib/test/flow/class_properties/migrated_0020.tree.json create mode 100644 lib/test/flow/class_properties/migrated_0021.js create mode 100644 lib/test/flow/class_properties/migrated_0021.tree.json create mode 100644 lib/test/flow/class_properties/migrated_0022.js create mode 100644 lib/test/flow/class_properties/migrated_0022.tree.json create mode 100644 lib/test/flow/class_properties/migrated_0023.js create mode 100644 lib/test/flow/class_properties/migrated_0023.options.json create mode 100644 lib/test/flow/class_properties/migrated_0023.tree.json create mode 100644 lib/test/flow/class_properties/migrated_0024.js create mode 100644 lib/test/flow/class_properties/migrated_0024.options.json create mode 100644 lib/test/flow/class_properties/migrated_0024.tree.json create mode 100644 lib/test/flow/class_properties/migrated_0025.js create mode 100644 lib/test/flow/class_properties/migrated_0025.options.json create mode 100644 lib/test/flow/class_properties/migrated_0025.tree.json create mode 100644 lib/test/flow/class_properties/migrated_0026.js create mode 100644 lib/test/flow/class_properties/migrated_0026.tree.json create mode 100644 lib/test/flow/class_properties/migrated_0027.js create mode 100644 lib/test/flow/class_properties/migrated_0027.tree.json create mode 100644 lib/test/flow/class_properties/migrated_0028.js create mode 100644 lib/test/flow/class_properties/migrated_0028.options.json create mode 100644 lib/test/flow/class_properties/migrated_0028.tree.json create mode 100644 lib/test/flow/class_properties/migrated_0029.js create mode 100644 lib/test/flow/class_properties/migrated_0029.tree.json create mode 100644 lib/test/flow/class_properties/migrated_0030.js create mode 100644 lib/test/flow/class_properties/migrated_0030.tree.json create mode 100644 lib/test/flow/class_properties/super-call-in-arrow.js create mode 100644 lib/test/flow/class_properties/super-call-in-arrow.options.json create mode 100644 lib/test/flow/class_properties/super-call-in-arrow.tree.json create mode 100644 lib/test/flow/class_properties/super-prop-in-arrow.js create mode 100644 lib/test/flow/class_properties/super-prop-in-arrow.options.json create mode 100644 lib/test/flow/class_properties/super-prop-in-arrow.tree.json create mode 100644 lib/test/flow/class_properties/super-prop-in-prop.js create mode 100644 lib/test/flow/class_properties/super-prop-in-prop.options.json create mode 100644 lib/test/flow/class_properties/super-prop-in-prop.tree.json create mode 100644 lib/test/flow/class_properties/super-prop.js create mode 100644 lib/test/flow/class_properties/super-prop.options.json create mode 100644 lib/test/flow/class_properties/super-prop.tree.json create mode 100644 lib/test/flow/class_properties/unannotated.js create mode 100644 lib/test/flow/class_properties/unannotated.tree.json create mode 100644 lib/test/flow/class_properties/unannotated_asi.js create mode 100644 lib/test/flow/class_properties/unannotated_asi.tree.json create mode 100644 lib/test/flow/comment_interning/array.js create mode 100644 lib/test/flow/comment_interning/array.options.json create mode 100644 lib/test/flow/comment_interning/array.tree.json create mode 100644 lib/test/flow/comment_interning/array_pattern.js create mode 100644 lib/test/flow/comment_interning/array_pattern.options.json create mode 100644 lib/test/flow/comment_interning/array_pattern.tree.json create mode 100644 lib/test/flow/comment_interning/arrow_function.js create mode 100644 lib/test/flow/comment_interning/arrow_function.options.json create mode 100644 lib/test/flow/comment_interning/arrow_function.tree.json create mode 100644 lib/test/flow/comment_interning/assignment.js create mode 100644 lib/test/flow/comment_interning/assignment.options.json create mode 100644 lib/test/flow/comment_interning/assignment.tree.json create mode 100644 lib/test/flow/comment_interning/binary.js create mode 100644 lib/test/flow/comment_interning/binary.options.json create mode 100644 lib/test/flow/comment_interning/binary.tree.json create mode 100644 lib/test/flow/comment_interning/block.js create mode 100644 lib/test/flow/comment_interning/block.options.json create mode 100644 lib/test/flow/comment_interning/block.tree.json create mode 100644 lib/test/flow/comment_interning/break.js create mode 100644 lib/test/flow/comment_interning/break.options.json create mode 100644 lib/test/flow/comment_interning/break.tree.json create mode 100644 lib/test/flow/comment_interning/call.js create mode 100644 lib/test/flow/comment_interning/call.options.json create mode 100644 lib/test/flow/comment_interning/call.tree.json create mode 100644 lib/test/flow/comment_interning/catch.js create mode 100644 lib/test/flow/comment_interning/catch.options.json create mode 100644 lib/test/flow/comment_interning/catch.tree.json create mode 100644 lib/test/flow/comment_interning/class_declaration.js create mode 100644 lib/test/flow/comment_interning/class_declaration.options.json create mode 100644 lib/test/flow/comment_interning/class_declaration.tree.json create mode 100644 lib/test/flow/comment_interning/class_expression.js create mode 100644 lib/test/flow/comment_interning/class_expression.options.json create mode 100644 lib/test/flow/comment_interning/class_expression.tree.json create mode 100644 lib/test/flow/comment_interning/class_method.js create mode 100644 lib/test/flow/comment_interning/class_method.options.json create mode 100644 lib/test/flow/comment_interning/class_method.tree.json create mode 100644 lib/test/flow/comment_interning/class_property.js create mode 100644 lib/test/flow/comment_interning/class_property.options.json create mode 100644 lib/test/flow/comment_interning/class_property.tree.json create mode 100644 lib/test/flow/comment_interning/conditional.js create mode 100644 lib/test/flow/comment_interning/conditional.options.json create mode 100644 lib/test/flow/comment_interning/conditional.tree.json create mode 100644 lib/test/flow/comment_interning/continue.js create mode 100644 lib/test/flow/comment_interning/continue.options.json create mode 100644 lib/test/flow/comment_interning/continue.tree.json create mode 100644 lib/test/flow/comment_interning/debugger.js create mode 100644 lib/test/flow/comment_interning/debugger.options.json create mode 100644 lib/test/flow/comment_interning/debugger.tree.json create mode 100644 lib/test/flow/comment_interning/declare_class.js create mode 100644 lib/test/flow/comment_interning/declare_class.options.json create mode 100644 lib/test/flow/comment_interning/declare_class.tree.json create mode 100644 lib/test/flow/comment_interning/declare_export_declaration.js create mode 100644 lib/test/flow/comment_interning/declare_export_declaration.options.json create mode 100644 lib/test/flow/comment_interning/declare_export_declaration.tree.json create mode 100644 lib/test/flow/comment_interning/declare_function.js create mode 100644 lib/test/flow/comment_interning/declare_function.options.json create mode 100644 lib/test/flow/comment_interning/declare_function.tree.json create mode 100644 lib/test/flow/comment_interning/declare_interface.js create mode 100644 lib/test/flow/comment_interning/declare_interface.options.json create mode 100644 lib/test/flow/comment_interning/declare_interface.tree.json create mode 100644 lib/test/flow/comment_interning/declare_module.js create mode 100644 lib/test/flow/comment_interning/declare_module.options.json create mode 100644 lib/test/flow/comment_interning/declare_module.tree.json create mode 100644 lib/test/flow/comment_interning/declare_module_exports.js create mode 100644 lib/test/flow/comment_interning/declare_module_exports.options.json create mode 100644 lib/test/flow/comment_interning/declare_module_exports.tree.json create mode 100644 lib/test/flow/comment_interning/declare_type_alias.js create mode 100644 lib/test/flow/comment_interning/declare_type_alias.options.json create mode 100644 lib/test/flow/comment_interning/declare_type_alias.tree.json create mode 100644 lib/test/flow/comment_interning/declare_variable.js create mode 100644 lib/test/flow/comment_interning/declare_variable.options.json create mode 100644 lib/test/flow/comment_interning/declare_variable.tree.json create mode 100644 lib/test/flow/comment_interning/decorator.js create mode 100644 lib/test/flow/comment_interning/decorator.options.json create mode 100644 lib/test/flow/comment_interning/decorator.tree.json create mode 100644 lib/test/flow/comment_interning/do_while.js create mode 100644 lib/test/flow/comment_interning/do_while.options.json create mode 100644 lib/test/flow/comment_interning/do_while.tree.json create mode 100644 lib/test/flow/comment_interning/empty_statement.js create mode 100644 lib/test/flow/comment_interning/empty_statement.options.json create mode 100644 lib/test/flow/comment_interning/empty_statement.tree.json create mode 100644 lib/test/flow/comment_interning/enum_declaration.js create mode 100644 lib/test/flow/comment_interning/enum_declaration.options.json create mode 100644 lib/test/flow/comment_interning/enum_declaration.tree.json create mode 100644 lib/test/flow/comment_interning/export.js create mode 100644 lib/test/flow/comment_interning/export.options.json create mode 100644 lib/test/flow/comment_interning/export.tree.json create mode 100644 lib/test/flow/comment_interning/expression_statement.js create mode 100644 lib/test/flow/comment_interning/expression_statement.options.json create mode 100644 lib/test/flow/comment_interning/expression_statement.tree.json create mode 100644 lib/test/flow/comment_interning/for.js create mode 100644 lib/test/flow/comment_interning/for.options.json create mode 100644 lib/test/flow/comment_interning/for.tree.json create mode 100644 lib/test/flow/comment_interning/function_declaration.js create mode 100644 lib/test/flow/comment_interning/function_declaration.options.json create mode 100644 lib/test/flow/comment_interning/function_declaration.tree.json create mode 100644 lib/test/flow/comment_interning/function_expression.js create mode 100644 lib/test/flow/comment_interning/function_expression.options.json create mode 100644 lib/test/flow/comment_interning/function_expression.tree.json create mode 100644 lib/test/flow/comment_interning/function_type.js create mode 100644 lib/test/flow/comment_interning/function_type.options.json create mode 100644 lib/test/flow/comment_interning/function_type.tree.json create mode 100644 lib/test/flow/comment_interning/if.js create mode 100644 lib/test/flow/comment_interning/if.options.json create mode 100644 lib/test/flow/comment_interning/if.tree.json create mode 100644 lib/test/flow/comment_interning/import.js create mode 100644 lib/test/flow/comment_interning/import.options.json create mode 100644 lib/test/flow/comment_interning/import.tree.json create mode 100644 lib/test/flow/comment_interning/interface.js create mode 100644 lib/test/flow/comment_interning/interface.options.json create mode 100644 lib/test/flow/comment_interning/interface.tree.json create mode 100644 lib/test/flow/comment_interning/jsx_element.js create mode 100644 lib/test/flow/comment_interning/jsx_element.options.json create mode 100644 lib/test/flow/comment_interning/jsx_element.tree.json create mode 100644 lib/test/flow/comment_interning/jsx_fragment.js create mode 100644 lib/test/flow/comment_interning/jsx_fragment.options.json create mode 100644 lib/test/flow/comment_interning/jsx_fragment.tree.json create mode 100644 lib/test/flow/comment_interning/labeled.js create mode 100644 lib/test/flow/comment_interning/labeled.options.json create mode 100644 lib/test/flow/comment_interning/labeled.tree.json create mode 100644 lib/test/flow/comment_interning/literal.js create mode 100644 lib/test/flow/comment_interning/literal.options.json create mode 100644 lib/test/flow/comment_interning/literal.tree.json create mode 100644 lib/test/flow/comment_interning/member.js create mode 100644 lib/test/flow/comment_interning/member.options.json create mode 100644 lib/test/flow/comment_interning/member.tree.json create mode 100644 lib/test/flow/comment_interning/meta_property.js create mode 100644 lib/test/flow/comment_interning/meta_property.options.json create mode 100644 lib/test/flow/comment_interning/meta_property.tree.json create mode 100644 lib/test/flow/comment_interning/new.js create mode 100644 lib/test/flow/comment_interning/new.options.json create mode 100644 lib/test/flow/comment_interning/new.tree.json create mode 100644 lib/test/flow/comment_interning/object.js create mode 100644 lib/test/flow/comment_interning/object.options.json create mode 100644 lib/test/flow/comment_interning/object.tree.json create mode 100644 lib/test/flow/comment_interning/object_pattern.js create mode 100644 lib/test/flow/comment_interning/object_pattern.options.json create mode 100644 lib/test/flow/comment_interning/object_pattern.tree.json create mode 100644 lib/test/flow/comment_interning/object_type.js create mode 100644 lib/test/flow/comment_interning/object_type.options.json create mode 100644 lib/test/flow/comment_interning/object_type.tree.json create mode 100644 lib/test/flow/comment_interning/parenthesized_expression.js create mode 100644 lib/test/flow/comment_interning/parenthesized_expression.options.json create mode 100644 lib/test/flow/comment_interning/parenthesized_expression.tree.json create mode 100644 lib/test/flow/comment_interning/parenthesized_type.js create mode 100644 lib/test/flow/comment_interning/parenthesized_type.options.json create mode 100644 lib/test/flow/comment_interning/parenthesized_type.tree.json create mode 100644 lib/test/flow/comment_interning/program_comment_block.js create mode 100644 lib/test/flow/comment_interning/program_comment_block.options.json create mode 100644 lib/test/flow/comment_interning/program_comment_block.tree.json create mode 100644 lib/test/flow/comment_interning/program_comment_directive.js create mode 100644 lib/test/flow/comment_interning/program_comment_directive.options.json create mode 100644 lib/test/flow/comment_interning/program_comment_directive.tree.json create mode 100644 lib/test/flow/comment_interning/remove_expression_trailing_comments.js create mode 100644 lib/test/flow/comment_interning/remove_expression_trailing_comments.options.json create mode 100644 lib/test/flow/comment_interning/remove_expression_trailing_comments.tree.json create mode 100644 lib/test/flow/comment_interning/remove_type_trailing_comments.js create mode 100644 lib/test/flow/comment_interning/remove_type_trailing_comments.options.json create mode 100644 lib/test/flow/comment_interning/remove_type_trailing_comments.tree.json create mode 100644 lib/test/flow/comment_interning/return.js create mode 100644 lib/test/flow/comment_interning/return.options.json create mode 100644 lib/test/flow/comment_interning/return.tree.json create mode 100644 lib/test/flow/comment_interning/sequence.js create mode 100644 lib/test/flow/comment_interning/sequence.options.json create mode 100644 lib/test/flow/comment_interning/sequence.tree.json create mode 100644 lib/test/flow/comment_interning/super.js create mode 100644 lib/test/flow/comment_interning/super.options.json create mode 100644 lib/test/flow/comment_interning/super.tree.json create mode 100644 lib/test/flow/comment_interning/switch.js create mode 100644 lib/test/flow/comment_interning/switch.options.json create mode 100644 lib/test/flow/comment_interning/switch.tree.json create mode 100644 lib/test/flow/comment_interning/template.js create mode 100644 lib/test/flow/comment_interning/template.options.json create mode 100644 lib/test/flow/comment_interning/template.tree.json create mode 100644 lib/test/flow/comment_interning/this.js create mode 100644 lib/test/flow/comment_interning/this.options.json create mode 100644 lib/test/flow/comment_interning/this.tree.json create mode 100644 lib/test/flow/comment_interning/throw.js create mode 100644 lib/test/flow/comment_interning/throw.options.json create mode 100644 lib/test/flow/comment_interning/throw.tree.json create mode 100644 lib/test/flow/comment_interning/trailing_comma.js create mode 100644 lib/test/flow/comment_interning/trailing_comma.options.json create mode 100644 lib/test/flow/comment_interning/trailing_comma.tree.json create mode 100644 lib/test/flow/comment_interning/try.js create mode 100644 lib/test/flow/comment_interning/try.options.json create mode 100644 lib/test/flow/comment_interning/try.tree.json create mode 100644 lib/test/flow/comment_interning/type_alias.js create mode 100644 lib/test/flow/comment_interning/type_alias.options.json create mode 100644 lib/test/flow/comment_interning/type_alias.tree.json create mode 100644 lib/test/flow/comment_interning/type_cast.js create mode 100644 lib/test/flow/comment_interning/type_cast.options.json create mode 100644 lib/test/flow/comment_interning/type_cast.tree.json create mode 100644 lib/test/flow/comment_interning/type_parameters.js create mode 100644 lib/test/flow/comment_interning/type_parameters.options.json create mode 100644 lib/test/flow/comment_interning/type_parameters.tree.json create mode 100644 lib/test/flow/comment_interning/types.js create mode 100644 lib/test/flow/comment_interning/types.options.json create mode 100644 lib/test/flow/comment_interning/types.tree.json create mode 100644 lib/test/flow/comment_interning/unary.js create mode 100644 lib/test/flow/comment_interning/unary.options.json create mode 100644 lib/test/flow/comment_interning/unary.tree.json create mode 100644 lib/test/flow/comment_interning/update.js create mode 100644 lib/test/flow/comment_interning/update.options.json create mode 100644 lib/test/flow/comment_interning/update.tree.json create mode 100644 lib/test/flow/comment_interning/variable_declaration.js create mode 100644 lib/test/flow/comment_interning/variable_declaration.options.json create mode 100644 lib/test/flow/comment_interning/variable_declaration.tree.json create mode 100644 lib/test/flow/comment_interning/while.js create mode 100644 lib/test/flow/comment_interning/while.options.json create mode 100644 lib/test/flow/comment_interning/while.tree.json create mode 100644 lib/test/flow/comment_interning/with.js create mode 100644 lib/test/flow/comment_interning/with.options.json create mode 100644 lib/test/flow/comment_interning/with.tree.json create mode 100644 lib/test/flow/comment_interning/yield.js create mode 100644 lib/test/flow/comment_interning/yield.options.json create mode 100644 lib/test/flow/comment_interning/yield.tree.json create mode 100644 lib/test/flow/comments/migrated_0000.js create mode 100644 lib/test/flow/comments/migrated_0000.tree.json create mode 100644 lib/test/flow/comments/migrated_0001.js create mode 100644 lib/test/flow/comments/migrated_0001.tree.json create mode 100644 lib/test/flow/comments/migrated_0002.js create mode 100644 lib/test/flow/comments/migrated_0002.tree.json create mode 100644 lib/test/flow/comments/migrated_0003.js create mode 100644 lib/test/flow/comments/migrated_0003.tree.json create mode 100644 lib/test/flow/decorators/migrated_0000.js create mode 100644 lib/test/flow/decorators/migrated_0000.options.json create mode 100644 lib/test/flow/decorators/migrated_0000.tree.json create mode 100644 lib/test/flow/decorators/migrated_0001.js create mode 100644 lib/test/flow/decorators/migrated_0001.options.json create mode 100644 lib/test/flow/decorators/migrated_0001.tree.json create mode 100644 lib/test/flow/decorators/migrated_0002.js create mode 100644 lib/test/flow/decorators/migrated_0002.options.json create mode 100644 lib/test/flow/decorators/migrated_0002.tree.json create mode 100644 lib/test/flow/decorators/migrated_0003.js create mode 100644 lib/test/flow/decorators/migrated_0003.options.json create mode 100644 lib/test/flow/decorators/migrated_0003.tree.json create mode 100644 lib/test/flow/decorators/migrated_0004.js create mode 100644 lib/test/flow/decorators/migrated_0004.options.json create mode 100644 lib/test/flow/decorators/migrated_0004.tree.json create mode 100644 lib/test/flow/decorators/migrated_0005.js create mode 100644 lib/test/flow/decorators/migrated_0005.options.json create mode 100644 lib/test/flow/decorators/migrated_0005.tree.json create mode 100644 lib/test/flow/decorators/migrated_0006.js create mode 100644 lib/test/flow/decorators/migrated_0006.options.json create mode 100644 lib/test/flow/decorators/migrated_0006.tree.json create mode 100644 lib/test/flow/decorators/migrated_0007.js create mode 100644 lib/test/flow/decorators/migrated_0007.options.json create mode 100644 lib/test/flow/decorators/migrated_0007.tree.json create mode 100644 lib/test/flow/decorators/migrated_0008.js create mode 100644 lib/test/flow/decorators/migrated_0008.options.json create mode 100644 lib/test/flow/decorators/migrated_0008.tree.json create mode 100644 lib/test/flow/decorators/migrated_0009.js create mode 100644 lib/test/flow/decorators/migrated_0009.options.json create mode 100644 lib/test/flow/decorators/migrated_0009.tree.json create mode 100644 lib/test/flow/decorators/migrated_0010.js create mode 100644 lib/test/flow/decorators/migrated_0010.options.json create mode 100644 lib/test/flow/decorators/migrated_0010.tree.json create mode 100644 lib/test/flow/decorators/migrated_0011.js create mode 100644 lib/test/flow/decorators/migrated_0011.options.json create mode 100644 lib/test/flow/decorators/migrated_0011.tree.json create mode 100644 lib/test/flow/decorators/migrated_0012.js create mode 100644 lib/test/flow/decorators/migrated_0012.options.json create mode 100644 lib/test/flow/decorators/migrated_0012.tree.json create mode 100644 lib/test/flow/decorators_invalid/migrated_0000.js create mode 100644 lib/test/flow/decorators_invalid/migrated_0000.tree.json create mode 100644 lib/test/flow/decorators_invalid/migrated_0001.js create mode 100644 lib/test/flow/decorators_invalid/migrated_0001.options.json create mode 100644 lib/test/flow/decorators_invalid/migrated_0001.tree.json create mode 100644 lib/test/flow/decorators_invalid/migrated_0002.js create mode 100644 lib/test/flow/decorators_invalid/migrated_0002.options.json create mode 100644 lib/test/flow/decorators_invalid/migrated_0002.tree.json create mode 100644 lib/test/flow/decorators_invalid/migrated_0003.js create mode 100644 lib/test/flow/decorators_invalid/migrated_0003.options.json create mode 100644 lib/test/flow/decorators_invalid/migrated_0003.tree.json create mode 100644 lib/test/flow/decorators_invalid/migrated_0004.js create mode 100644 lib/test/flow/decorators_invalid/migrated_0004.options.json create mode 100644 lib/test/flow/decorators_invalid/migrated_0004.tree.json create mode 100644 lib/test/flow/decorators_invalid/migrated_0005.js create mode 100644 lib/test/flow/decorators_invalid/migrated_0005.options.json create mode 100644 lib/test/flow/decorators_invalid/migrated_0005.tree.json create mode 100644 lib/test/flow/decorators_invalid/migrated_0006.js create mode 100644 lib/test/flow/decorators_invalid/migrated_0006.options.json create mode 100644 lib/test/flow/decorators_invalid/migrated_0006.tree.json create mode 100644 lib/test/flow/decorators_invalid/migrated_0007.js create mode 100644 lib/test/flow/decorators_invalid/migrated_0007.options.json create mode 100644 lib/test/flow/decorators_invalid/migrated_0007.tree.json create mode 100644 lib/test/flow/decorators_invalid/migrated_0008.js create mode 100644 lib/test/flow/decorators_invalid/migrated_0008.options.json create mode 100644 lib/test/flow/decorators_invalid/migrated_0008.tree.json create mode 100644 lib/test/flow/decorators_invalid/migrated_0009.js create mode 100644 lib/test/flow/decorators_invalid/migrated_0009.options.json create mode 100644 lib/test/flow/decorators_invalid/migrated_0009.tree.json create mode 100644 lib/test/flow/decorators_invalid/migrated_0010.js create mode 100644 lib/test/flow/decorators_invalid/migrated_0010.options.json create mode 100644 lib/test/flow/decorators_invalid/migrated_0010.tree.json create mode 100644 lib/test/flow/destructuring_with_default_values/migrated_0000.js create mode 100644 lib/test/flow/destructuring_with_default_values/migrated_0000.tree.json create mode 100644 lib/test/flow/destructuring_with_default_values/migrated_0001.js create mode 100644 lib/test/flow/destructuring_with_default_values/migrated_0001.tree.json create mode 100644 lib/test/flow/destructuring_with_default_values/migrated_0002.js create mode 100644 lib/test/flow/destructuring_with_default_values/migrated_0002.tree.json create mode 100644 lib/test/flow/destructuring_with_default_values/migrated_0003.js create mode 100644 lib/test/flow/destructuring_with_default_values/migrated_0003.tree.json create mode 100644 lib/test/flow/destructuring_with_default_values/migrated_0004.js create mode 100644 lib/test/flow/destructuring_with_default_values/migrated_0004.tree.json create mode 100644 lib/test/flow/destructuring_with_default_values/obj_assignment_pattern_with_literal_key.js create mode 100644 lib/test/flow/destructuring_with_default_values/obj_assignment_pattern_with_literal_key.tree.json create mode 100644 lib/test/flow/dynamic_import/migrated_0000.js create mode 100644 lib/test/flow/dynamic_import/migrated_0000.tree.json create mode 100644 lib/test/flow/dynamic_import/migrated_0001.js create mode 100644 lib/test/flow/dynamic_import/migrated_0001.tree.json create mode 100644 lib/test/flow/dynamic_import/migrated_0002.js create mode 100644 lib/test/flow/dynamic_import/migrated_0002.tree.json create mode 100644 lib/test/flow/dynamic_import/migrated_0003.js create mode 100644 lib/test/flow/dynamic_import/migrated_0003.tree.json create mode 100644 lib/test/flow/dynamic_import/migrated_0004.js create mode 100644 lib/test/flow/dynamic_import/migrated_0004.tree.json create mode 100644 lib/test/flow/dynamic_import/migrated_0005.js create mode 100644 lib/test/flow/dynamic_import/migrated_0005.tree.json create mode 100644 lib/test/flow/dynamic_import/migrated_0006.js create mode 100644 lib/test/flow/dynamic_import/migrated_0006.tree.json create mode 100644 lib/test/flow/enums/enum-boolean-member-not-initialized-explicit.js create mode 100644 lib/test/flow/enums/enum-boolean-member-not-initialized-explicit.options.json create mode 100644 lib/test/flow/enums/enum-boolean-member-not-initialized-explicit.tree.json create mode 100644 lib/test/flow/enums/enum-boolean-member-not-initialized-implicit.js create mode 100644 lib/test/flow/enums/enum-boolean-member-not-initialized-implicit.options.json create mode 100644 lib/test/flow/enums/enum-boolean-member-not-initialized-implicit.tree.json create mode 100644 lib/test/flow/enums/enum-duplicate-member-name.js create mode 100644 lib/test/flow/enums/enum-duplicate-member-name.options.json create mode 100644 lib/test/flow/enums/enum-duplicate-member-name.tree.json create mode 100644 lib/test/flow/enums/enum-end-of-file-after-member-name.js create mode 100644 lib/test/flow/enums/enum-end-of-file-after-member-name.options.json create mode 100644 lib/test/flow/enums/enum-end-of-file-after-member-name.tree.json create mode 100644 lib/test/flow/enums/enum-end-of-file.js create mode 100644 lib/test/flow/enums/enum-end-of-file.options.json create mode 100644 lib/test/flow/enums/enum-end-of-file.tree.json create mode 100644 lib/test/flow/enums/enum-export.js create mode 100644 lib/test/flow/enums/enum-export.options.json create mode 100644 lib/test/flow/enums/enum-export.tree.json create mode 100644 lib/test/flow/enums/enum-inconsistent-member-values-majority-defaulted.js create mode 100644 lib/test/flow/enums/enum-inconsistent-member-values-majority-defaulted.options.json create mode 100644 lib/test/flow/enums/enum-inconsistent-member-values-majority-defaulted.tree.json create mode 100644 lib/test/flow/enums/enum-inconsistent-member-values-mixed-initializers.js create mode 100644 lib/test/flow/enums/enum-inconsistent-member-values-mixed-initializers.options.json create mode 100644 lib/test/flow/enums/enum-inconsistent-member-values-mixed-initializers.tree.json create mode 100644 lib/test/flow/enums/enum-invalid-explicit-type-expression.js create mode 100644 lib/test/flow/enums/enum-invalid-explicit-type-expression.options.json create mode 100644 lib/test/flow/enums/enum-invalid-explicit-type-expression.tree.json create mode 100644 lib/test/flow/enums/enum-invalid-explicit-type-identifier.js create mode 100644 lib/test/flow/enums/enum-invalid-explicit-type-identifier.options.json create mode 100644 lib/test/flow/enums/enum-invalid-explicit-type-identifier.tree.json create mode 100644 lib/test/flow/enums/enum-invalid-export.js create mode 100644 lib/test/flow/enums/enum-invalid-export.options.json create mode 100644 lib/test/flow/enums/enum-invalid-export.tree.json create mode 100644 lib/test/flow/enums/enum-invalid-initializer-separator.js create mode 100644 lib/test/flow/enums/enum-invalid-initializer-separator.options.json create mode 100644 lib/test/flow/enums/enum-invalid-initializer-separator.tree.json create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-boolean-explicit-string.js create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-boolean-explicit-string.options.json create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-boolean-explicit-string.tree.json create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-boolean.js create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-boolean.options.json create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-boolean.tree.json create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-number.js create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-number.options.json create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-number.tree.json create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-string.js create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-string.options.json create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-string.tree.json create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-symbol.js create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-symbol.options.json create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-symbol.tree.json create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-expression-implicit.js create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-expression-implicit.options.json create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-expression-implicit.tree.json create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-literal-explicit-symbol.js create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-literal-explicit-symbol.options.json create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-literal-explicit-symbol.tree.json create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-number-explicit-boolean.js create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-number-explicit-boolean.options.json create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-number-explicit-boolean.tree.json create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-number-explicit-string.js create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-number-explicit-string.options.json create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-number-explicit-string.tree.json create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-parenthesized.js create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-parenthesized.options.json create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-parenthesized.tree.json create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-string-explicit-boolean.js create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-string-explicit-boolean.options.json create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-string-explicit-boolean.tree.json create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-string-explicit-number.js create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-string-explicit-number.options.json create mode 100644 lib/test/flow/enums/enum-invalid-member-initializer-string-explicit-number.tree.json create mode 100644 lib/test/flow/enums/enum-invalid-member-name.js create mode 100644 lib/test/flow/enums/enum-invalid-member-name.options.json create mode 100644 lib/test/flow/enums/enum-invalid-member-name.tree.json create mode 100644 lib/test/flow/enums/enum-invalid-member-separator-no-initializer.js create mode 100644 lib/test/flow/enums/enum-invalid-member-separator-no-initializer.options.json create mode 100644 lib/test/flow/enums/enum-invalid-member-separator-no-initializer.tree.json create mode 100644 lib/test/flow/enums/enum-invalid-member-separator-with-initializer.js create mode 100644 lib/test/flow/enums/enum-invalid-member-separator-with-initializer.options.json create mode 100644 lib/test/flow/enums/enum-invalid-member-separator-with-initializer.tree.json create mode 100644 lib/test/flow/enums/enum-invalid-unknown-members-trailing-comma.js create mode 100644 lib/test/flow/enums/enum-invalid-unknown-members-trailing-comma.options.json create mode 100644 lib/test/flow/enums/enum-invalid-unknown-members-trailing-comma.tree.json create mode 100644 lib/test/flow/enums/enum-invalid-unknown-members.js create mode 100644 lib/test/flow/enums/enum-invalid-unknown-members.options.json create mode 100644 lib/test/flow/enums/enum-invalid-unknown-members.tree.json create mode 100644 lib/test/flow/enums/enum-number-member-not-initialized-explicit.js create mode 100644 lib/test/flow/enums/enum-number-member-not-initialized-explicit.options.json create mode 100644 lib/test/flow/enums/enum-number-member-not-initialized-explicit.tree.json create mode 100644 lib/test/flow/enums/enum-number-member-not-initialized-implicit.js create mode 100644 lib/test/flow/enums/enum-number-member-not-initialized-implicit.options.json create mode 100644 lib/test/flow/enums/enum-number-member-not-initialized-implicit.tree.json create mode 100644 lib/test/flow/enums/enum-option-off.js create mode 100644 lib/test/flow/enums/enum-option-off.options.json create mode 100644 lib/test/flow/enums/enum-option-off.tree.json create mode 100644 lib/test/flow/enums/enum-reserved-word-enum-name.js create mode 100644 lib/test/flow/enums/enum-reserved-word-enum-name.options.json create mode 100644 lib/test/flow/enums/enum-reserved-word-enum-name.tree.json create mode 100644 lib/test/flow/enums/enum-string-member-inconsistently-initialized-majority-defaulted.js create mode 100644 lib/test/flow/enums/enum-string-member-inconsistently-initialized-majority-defaulted.options.json create mode 100644 lib/test/flow/enums/enum-string-member-inconsistently-initialized-majority-defaulted.tree.json create mode 100644 lib/test/flow/enums/enum-string-member-inconsistently-initialized-majority-initialized.js create mode 100644 lib/test/flow/enums/enum-string-member-inconsistently-initialized-majority-initialized.options.json create mode 100644 lib/test/flow/enums/enum-string-member-inconsistently-initialized-majority-initialized.tree.json create mode 100644 lib/test/flow/enums/enum-valid-boolean-explicit.js create mode 100644 lib/test/flow/enums/enum-valid-boolean-explicit.options.json create mode 100644 lib/test/flow/enums/enum-valid-boolean-explicit.tree.json create mode 100644 lib/test/flow/enums/enum-valid-boolean-implicit.js create mode 100644 lib/test/flow/enums/enum-valid-boolean-implicit.options.json create mode 100644 lib/test/flow/enums/enum-valid-boolean-implicit.tree.json create mode 100644 lib/test/flow/enums/enum-valid-empty.js create mode 100644 lib/test/flow/enums/enum-valid-empty.options.json create mode 100644 lib/test/flow/enums/enum-valid-empty.tree.json create mode 100644 lib/test/flow/enums/enum-valid-name.js create mode 100644 lib/test/flow/enums/enum-valid-name.options.json create mode 100644 lib/test/flow/enums/enum-valid-name.tree.json create mode 100644 lib/test/flow/enums/enum-valid-no-trailing-comma.js create mode 100644 lib/test/flow/enums/enum-valid-no-trailing-comma.options.json create mode 100644 lib/test/flow/enums/enum-valid-no-trailing-comma.tree.json create mode 100644 lib/test/flow/enums/enum-valid-number-explicit.js create mode 100644 lib/test/flow/enums/enum-valid-number-explicit.options.json create mode 100644 lib/test/flow/enums/enum-valid-number-explicit.tree.json create mode 100644 lib/test/flow/enums/enum-valid-number-implicit.js create mode 100644 lib/test/flow/enums/enum-valid-number-implicit.options.json create mode 100644 lib/test/flow/enums/enum-valid-number-implicit.tree.json create mode 100644 lib/test/flow/enums/enum-valid-string-explicit-defaulted.js create mode 100644 lib/test/flow/enums/enum-valid-string-explicit-defaulted.options.json create mode 100644 lib/test/flow/enums/enum-valid-string-explicit-defaulted.tree.json create mode 100644 lib/test/flow/enums/enum-valid-string-explicit-initialized.js create mode 100644 lib/test/flow/enums/enum-valid-string-explicit-initialized.options.json create mode 100644 lib/test/flow/enums/enum-valid-string-explicit-initialized.tree.json create mode 100644 lib/test/flow/enums/enum-valid-string-implicit-defaulted.js create mode 100644 lib/test/flow/enums/enum-valid-string-implicit-defaulted.options.json create mode 100644 lib/test/flow/enums/enum-valid-string-implicit-defaulted.tree.json create mode 100644 lib/test/flow/enums/enum-valid-string-implicit-initialized.js create mode 100644 lib/test/flow/enums/enum-valid-string-implicit-initialized.options.json create mode 100644 lib/test/flow/enums/enum-valid-string-implicit-initialized.tree.json create mode 100644 lib/test/flow/enums/enum-valid-symbol.js create mode 100644 lib/test/flow/enums/enum-valid-symbol.options.json create mode 100644 lib/test/flow/enums/enum-valid-symbol.tree.json create mode 100644 lib/test/flow/enums/enum-valid-unknown-members.js create mode 100644 lib/test/flow/enums/enum-valid-unknown-members.options.json create mode 100644 lib/test/flow/enums/enum-valid-unknown-members.tree.json create mode 100644 lib/test/flow/exponentiation/migrated_0000.js create mode 100644 lib/test/flow/exponentiation/migrated_0000.tree.json create mode 100644 lib/test/flow/exponentiation/migrated_0001.js create mode 100644 lib/test/flow/exponentiation/migrated_0001.tree.json create mode 100644 lib/test/flow/exponentiation/migrated_0002.js create mode 100644 lib/test/flow/exponentiation/migrated_0002.tree.json create mode 100644 lib/test/flow/exponentiation/migrated_0003.js create mode 100644 lib/test/flow/exponentiation/migrated_0003.tree.json create mode 100644 lib/test/flow/exponentiation/migrated_0004.js create mode 100644 lib/test/flow/exponentiation/migrated_0004.tree.json create mode 100644 lib/test/flow/export_import_reserved_words/migrated_0000.js create mode 100644 lib/test/flow/export_import_reserved_words/migrated_0000.tree.json create mode 100644 lib/test/flow/export_import_reserved_words/migrated_0001.js create mode 100644 lib/test/flow/export_import_reserved_words/migrated_0001.tree.json create mode 100644 lib/test/flow/export_import_reserved_words/migrated_0002.js create mode 100644 lib/test/flow/export_import_reserved_words/migrated_0002.tree.json create mode 100644 lib/test/flow/export_import_reserved_words/migrated_0003.js create mode 100644 lib/test/flow/export_import_reserved_words/migrated_0003.tree.json create mode 100644 lib/test/flow/export_import_reserved_words/migrated_0004.js create mode 100644 lib/test/flow/export_import_reserved_words/migrated_0004.tree.json create mode 100644 lib/test/flow/export_import_reserved_words/migrated_0005.js create mode 100644 lib/test/flow/export_import_reserved_words/migrated_0005.tree.json create mode 100644 lib/test/flow/export_import_reserved_words/migrated_0006.js create mode 100644 lib/test/flow/export_import_reserved_words/migrated_0006.tree.json create mode 100644 lib/test/flow/export_import_reserved_words/migrated_0007.js create mode 100644 lib/test/flow/export_import_reserved_words/migrated_0007.tree.json create mode 100644 lib/test/flow/export_statements/export_default_async_expression.js create mode 100644 lib/test/flow/export_statements/export_default_async_expression.tree.json create mode 100644 lib/test/flow/export_statements/export_default_async_function.js create mode 100644 lib/test/flow/export_statements/export_default_async_function.tree.json create mode 100644 lib/test/flow/export_statements/export_default_async_generator.js create mode 100644 lib/test/flow/export_statements/export_default_async_generator.tree.json create mode 100644 lib/test/flow/export_statements/export_default_async_id_and_function.js create mode 100644 lib/test/flow/export_statements/export_default_async_id_and_function.tree.json create mode 100644 lib/test/flow/export_statements/export_default_async_id_and_named_function.js create mode 100644 lib/test/flow/export_statements/export_default_async_id_and_named_function.tree.json create mode 100644 lib/test/flow/export_statements/export_default_async_named_function.js create mode 100644 lib/test/flow/export_statements/export_default_async_named_function.tree.json create mode 100644 lib/test/flow/export_statements/export_default_async_named_generator.js create mode 100644 lib/test/flow/export_statements/export_default_async_named_generator.tree.json create mode 100644 lib/test/flow/export_statements/export_missing_comma.js create mode 100644 lib/test/flow/export_statements/export_missing_comma.tree.json create mode 100644 lib/test/flow/export_statements/export_trailing_comma.js create mode 100644 lib/test/flow/export_statements/export_trailing_comma.tree.json create mode 100644 lib/test/flow/expression/assignment/assign_declare.js create mode 100644 lib/test/flow/expression/assignment/assign_declare.tree.json create mode 100644 lib/test/flow/expression/assignment/assign_interface.js create mode 100644 lib/test/flow/expression/assignment/assign_interface.tree.json create mode 100644 lib/test/flow/expression/assignment/assign_of.js create mode 100644 lib/test/flow/expression/assignment/assign_of.tree.json create mode 100644 lib/test/flow/expression/assignment/assign_type.js create mode 100644 lib/test/flow/expression/assignment/assign_type.tree.json create mode 100644 lib/test/flow/expression/assignment/parens.js create mode 100644 lib/test/flow/expression/assignment/parens.tree.json create mode 100644 lib/test/flow/expression/binary-logical/and_on_lhs_of_or.js create mode 100644 lib/test/flow/expression/binary-logical/and_on_lhs_of_or.tree.json create mode 100644 lib/test/flow/expression/binary-logical/migrated_0000.js create mode 100644 lib/test/flow/expression/binary-logical/migrated_0000.tree.json create mode 100644 lib/test/flow/expression/binary-logical/migrated_0001.js create mode 100644 lib/test/flow/expression/binary-logical/migrated_0001.tree.json create mode 100644 lib/test/flow/expression/binary-logical/migrated_0002.js create mode 100644 lib/test/flow/expression/binary-logical/migrated_0002.tree.json create mode 100644 lib/test/flow/expression/binary-logical/migrated_0003.js create mode 100644 lib/test/flow/expression/binary-logical/migrated_0003.tree.json create mode 100644 lib/test/flow/expression/binary-logical/migrated_0004.js create mode 100644 lib/test/flow/expression/binary-logical/migrated_0004.tree.json create mode 100644 lib/test/flow/expression/binary-logical/migrated_0005.js create mode 100644 lib/test/flow/expression/binary-logical/migrated_0005.tree.json create mode 100644 lib/test/flow/expression/left-hand-side/type_property.js create mode 100644 lib/test/flow/expression/left-hand-side/type_property.tree.json create mode 100644 lib/test/flow/expression/sequence/parenthesized_left.js create mode 100644 lib/test/flow/expression/sequence/parenthesized_left.tree.json create mode 100644 lib/test/flow/expression/sequence/parenthesized_right.js create mode 100644 lib/test/flow/expression/sequence/parenthesized_right.tree.json create mode 100644 lib/test/flow/expression/unary/incr_with_parens.js create mode 100644 lib/test/flow/expression/unary/incr_with_parens.tree.json create mode 100644 lib/test/flow/expression/unary/not_with_parens.js create mode 100644 lib/test/flow/expression/unary/not_with_parens.tree.json create mode 100644 lib/test/flow/for_await_loops/migrated_0000.js create mode 100644 lib/test/flow/for_await_loops/migrated_0000.tree.json create mode 100644 lib/test/flow/for_await_loops/migrated_0001.js create mode 100644 lib/test/flow/for_await_loops/migrated_0001.tree.json create mode 100644 lib/test/flow/for_await_loops/migrated_0002.js create mode 100644 lib/test/flow/for_await_loops/migrated_0002.tree.json create mode 100644 lib/test/flow/for_await_loops/migrated_0003.js create mode 100644 lib/test/flow/for_await_loops/migrated_0003.tree.json create mode 100644 lib/test/flow/for_of_loops_invalid/migrated_0000.js create mode 100644 lib/test/flow/for_of_loops_invalid/migrated_0000.tree.json create mode 100644 lib/test/flow/import_statements/migrated_0000.js create mode 100644 lib/test/flow/import_statements/migrated_0000.tree.json create mode 100644 lib/test/flow/import_statements/migrated_0001.js create mode 100644 lib/test/flow/import_statements/migrated_0001.tree.json create mode 100644 lib/test/flow/import_statements/migrated_0002.js create mode 100644 lib/test/flow/import_statements/migrated_0002.tree.json create mode 100644 lib/test/flow/import_statements/missing_as.js create mode 100644 lib/test/flow/import_statements/missing_as.tree.json create mode 100644 lib/test/flow/import_statements/missing_as_and_from.js create mode 100644 lib/test/flow/import_statements/missing_as_and_from.tree.json create mode 100644 lib/test/flow/import_statements/missing_from.js create mode 100644 lib/test/flow/import_statements/missing_from.tree.json create mode 100644 lib/test/flow/import_statements/missing_source.js create mode 100644 lib/test/flow/import_statements/missing_source.tree.json create mode 100644 lib/test/flow/internal_slot/declare_class.js create mode 100644 lib/test/flow/internal_slot/declare_class.tree.json create mode 100644 lib/test/flow/internal_slot/declare_class_static.js create mode 100644 lib/test/flow/internal_slot/declare_class_static.tree.json create mode 100644 lib/test/flow/internal_slot/interface.js create mode 100644 lib/test/flow/internal_slot/interface.tree.json create mode 100644 lib/test/flow/internal_slot/interface_method.js create mode 100644 lib/test/flow/internal_slot/interface_method.tree.json create mode 100644 lib/test/flow/internal_slot/interface_variance.js create mode 100644 lib/test/flow/internal_slot/interface_variance.tree.json create mode 100644 lib/test/flow/internal_slot/object.js create mode 100644 lib/test/flow/internal_slot/object.tree.json create mode 100644 lib/test/flow/internal_slot/object_method.js create mode 100644 lib/test/flow/internal_slot/object_method.tree.json create mode 100644 lib/test/flow/internal_slot/object_optional.js create mode 100644 lib/test/flow/internal_slot/object_optional.tree.json create mode 100644 lib/test/flow/internal_slot/object_variance.js create mode 100644 lib/test/flow/internal_slot/object_variance.tree.json create mode 100644 lib/test/flow/invalid_syntax/class_unexpected_identifier_before_body.js create mode 100644 lib/test/flow/invalid_syntax/class_unexpected_identifier_before_body.tree.json create mode 100644 lib/test/flow/invalid_syntax/migrated_0000.js create mode 100644 lib/test/flow/invalid_syntax/migrated_0000.tree.json create mode 100644 lib/test/flow/invalid_syntax/migrated_0001.js create mode 100644 lib/test/flow/invalid_syntax/migrated_0001.tree.json create mode 100644 lib/test/flow/invalid_syntax/migrated_0002.js create mode 100644 lib/test/flow/invalid_syntax/migrated_0002.tree.json create mode 100644 lib/test/flow/invalid_syntax/migrated_0003.js create mode 100644 lib/test/flow/invalid_syntax/migrated_0003.tree.json create mode 100644 lib/test/flow/invalid_syntax/migrated_0004.js create mode 100644 lib/test/flow/invalid_syntax/migrated_0004.tree.json create mode 100644 lib/test/flow/invalid_syntax/migrated_0005.js create mode 100644 lib/test/flow/invalid_syntax/migrated_0005.tree.json create mode 100644 lib/test/flow/invalid_syntax/migrated_0006.js create mode 100644 lib/test/flow/invalid_syntax/migrated_0006.tree.json create mode 100644 lib/test/flow/invalid_syntax/migrated_0007.js create mode 100644 lib/test/flow/invalid_syntax/migrated_0007.tree.json create mode 100644 lib/test/flow/invalid_syntax/migrated_0008.js create mode 100644 lib/test/flow/invalid_syntax/migrated_0008.tree.json create mode 100644 lib/test/flow/invalid_syntax/migrated_0009.js create mode 100644 lib/test/flow/invalid_syntax/migrated_0009.tree.json create mode 100644 lib/test/flow/invalid_syntax/migrated_0010.js create mode 100644 lib/test/flow/invalid_syntax/migrated_0010.tree.json create mode 100644 lib/test/flow/invalid_syntax/migrated_0011.js create mode 100644 lib/test/flow/invalid_syntax/migrated_0011.tree.json create mode 100644 lib/test/flow/invalid_syntax/migrated_0012.js create mode 100644 lib/test/flow/invalid_syntax/migrated_0012.tree.json create mode 100644 lib/test/flow/invalid_syntax/migrated_0013.js create mode 100644 lib/test/flow/invalid_syntax/migrated_0013.tree.json create mode 100644 lib/test/flow/invalid_syntax/migrated_0014.js create mode 100644 lib/test/flow/invalid_syntax/migrated_0014.tree.json create mode 100644 lib/test/flow/invalid_syntax/migrated_0015.js create mode 100644 lib/test/flow/invalid_syntax/migrated_0015.tree.json create mode 100644 lib/test/flow/invalid_syntax/migrated_0016.js create mode 100644 lib/test/flow/invalid_syntax/migrated_0016.tree.json create mode 100644 lib/test/flow/invalid_syntax/migrated_0017.js create mode 100644 lib/test/flow/invalid_syntax/migrated_0017.tree.json create mode 100644 lib/test/flow/invalid_syntax/migrated_0018.js create mode 100644 lib/test/flow/invalid_syntax/migrated_0018.tree.json create mode 100644 lib/test/flow/invalid_syntax/string_newline.js create mode 100644 lib/test/flow/invalid_syntax/string_newline.tree.json create mode 100644 lib/test/flow/large_numbers/migrated_0000.js create mode 100644 lib/test/flow/large_numbers/migrated_0000.tree.json create mode 100644 lib/test/flow/large_numbers/migrated_0001.js create mode 100644 lib/test/flow/large_numbers/migrated_0001.tree.json create mode 100644 lib/test/flow/large_numbers/migrated_0002.js create mode 100644 lib/test/flow/large_numbers/migrated_0002.tree.json create mode 100644 lib/test/flow/large_numbers/migrated_0003.js create mode 100644 lib/test/flow/large_numbers/migrated_0003.tree.json create mode 100644 lib/test/flow/large_numbers/migrated_0004.js create mode 100644 lib/test/flow/large_numbers/migrated_0004.tree.json create mode 100644 lib/test/flow/nullish_coalescing/missing-plugin.js create mode 100644 lib/test/flow/nullish_coalescing/missing-plugin.tree.json create mode 100644 lib/test/flow/nullish_coalescing/multiple.js create mode 100644 lib/test/flow/nullish_coalescing/multiple.options.json create mode 100644 lib/test/flow/nullish_coalescing/multiple.tree.json create mode 100644 lib/test/flow/nullish_coalescing/multiple_no_whitespace.js create mode 100644 lib/test/flow/nullish_coalescing/multiple_no_whitespace.options.json create mode 100644 lib/test/flow/nullish_coalescing/multiple_no_whitespace.tree.json create mode 100644 lib/test/flow/nullish_coalescing/precedence_and.js create mode 100644 lib/test/flow/nullish_coalescing/precedence_and.options.json create mode 100644 lib/test/flow/nullish_coalescing/precedence_and.tree.json create mode 100644 lib/test/flow/nullish_coalescing/precedence_and_lhs_no_parens.js create mode 100644 lib/test/flow/nullish_coalescing/precedence_and_lhs_no_parens.options.json create mode 100644 lib/test/flow/nullish_coalescing/precedence_and_lhs_no_parens.tree.json create mode 100644 lib/test/flow/nullish_coalescing/precedence_and_nested_lhs.js create mode 100644 lib/test/flow/nullish_coalescing/precedence_and_nested_lhs.options.json create mode 100644 lib/test/flow/nullish_coalescing/precedence_and_nested_lhs.tree.json create mode 100644 lib/test/flow/nullish_coalescing/precedence_and_nested_rhs.js create mode 100644 lib/test/flow/nullish_coalescing/precedence_and_nested_rhs.options.json create mode 100644 lib/test/flow/nullish_coalescing/precedence_and_nested_rhs.tree.json create mode 100644 lib/test/flow/nullish_coalescing/precedence_and_rhs_no_parens.js create mode 100644 lib/test/flow/nullish_coalescing/precedence_and_rhs_no_parens.options.json create mode 100644 lib/test/flow/nullish_coalescing/precedence_and_rhs_no_parens.tree.json create mode 100644 lib/test/flow/nullish_coalescing/precedence_multiple_on_or_rhs_no_parens.js create mode 100644 lib/test/flow/nullish_coalescing/precedence_multiple_on_or_rhs_no_parens.options.json create mode 100644 lib/test/flow/nullish_coalescing/precedence_multiple_on_or_rhs_no_parens.tree.json create mode 100644 lib/test/flow/nullish_coalescing/precedence_or.js create mode 100644 lib/test/flow/nullish_coalescing/precedence_or.options.json create mode 100644 lib/test/flow/nullish_coalescing/precedence_or.tree.json create mode 100644 lib/test/flow/nullish_coalescing/precedence_or_lhs_no_parens.js create mode 100644 lib/test/flow/nullish_coalescing/precedence_or_lhs_no_parens.options.json create mode 100644 lib/test/flow/nullish_coalescing/precedence_or_lhs_no_parens.tree.json create mode 100644 lib/test/flow/nullish_coalescing/precedence_or_no_parens.js create mode 100644 lib/test/flow/nullish_coalescing/precedence_or_no_parens.options.json create mode 100644 lib/test/flow/nullish_coalescing/precedence_or_no_parens.tree.json create mode 100644 lib/test/flow/nullish_coalescing/precedence_or_rhs_no_parens.js create mode 100644 lib/test/flow/nullish_coalescing/precedence_or_rhs_no_parens.options.json create mode 100644 lib/test/flow/nullish_coalescing/precedence_or_rhs_no_parens.tree.json create mode 100644 lib/test/flow/nullish_coalescing/simple.js create mode 100644 lib/test/flow/nullish_coalescing/simple.options.json create mode 100644 lib/test/flow/nullish_coalescing/simple.tree.json create mode 100644 lib/test/flow/numbers/binnumber_word_invalid.js create mode 100644 lib/test/flow/numbers/binnumber_word_invalid.tree.json create mode 100644 lib/test/flow/numbers/migrated_0000.js create mode 100644 lib/test/flow/numbers/migrated_0000.tree.json create mode 100644 lib/test/flow/numbers/migrated_0001.js create mode 100644 lib/test/flow/numbers/migrated_0001.tree.json create mode 100644 lib/test/flow/numbers/migrated_0002.js create mode 100644 lib/test/flow/numbers/migrated_0002.tree.json create mode 100644 lib/test/flow/numbers/non_octal_decimal_integer_literal.js create mode 100644 lib/test/flow/numbers/non_octal_decimal_integer_literal.tree.json create mode 100644 lib/test/flow/numbers/non_octal_decimal_integer_literal_strict.js create mode 100644 lib/test/flow/numbers/non_octal_decimal_integer_literal_strict.tree.json create mode 100644 lib/test/flow/numbers/scientific_leading_decimal.js create mode 100644 lib/test/flow/numbers/scientific_leading_decimal.tree.json create mode 100644 lib/test/flow/numbers/scientific_leading_zero.js create mode 100644 lib/test/flow/numbers/scientific_leading_zero.tree.json create mode 100644 lib/test/flow/numbers/scientific_without_fractional_digits.js create mode 100644 lib/test/flow/numbers/scientific_without_fractional_digits.tree.json create mode 100644 lib/test/flow/numbers/scientific_zero.js create mode 100644 lib/test/flow/numbers/scientific_zero.tree.json create mode 100644 lib/test/flow/numbers/underscored_bin.js create mode 100644 lib/test/flow/numbers/underscored_bin.tree.json create mode 100644 lib/test/flow/numbers/underscored_float.js create mode 100644 lib/test/flow/numbers/underscored_float.tree.json create mode 100644 lib/test/flow/numbers/underscored_float_err_lead.js create mode 100644 lib/test/flow/numbers/underscored_float_err_lead.tree.json create mode 100644 lib/test/flow/numbers/underscored_float_err_trail.js create mode 100644 lib/test/flow/numbers/underscored_float_err_trail.tree.json create mode 100644 lib/test/flow/numbers/underscored_float_whole.js create mode 100644 lib/test/flow/numbers/underscored_float_whole.tree.json create mode 100644 lib/test/flow/numbers/underscored_hex.js create mode 100644 lib/test/flow/numbers/underscored_hex.tree.json create mode 100644 lib/test/flow/numbers/underscored_legacy_octal.js create mode 100644 lib/test/flow/numbers/underscored_legacy_octal.tree.json create mode 100644 lib/test/flow/numbers/underscored_number.js create mode 100644 lib/test/flow/numbers/underscored_number.tree.json create mode 100644 lib/test/flow/numbers/underscored_number_err_double.js create mode 100644 lib/test/flow/numbers/underscored_number_err_double.tree.json create mode 100644 lib/test/flow/numbers/underscored_number_err_lead.js create mode 100644 lib/test/flow/numbers/underscored_number_err_lead.tree.json create mode 100644 lib/test/flow/numbers/underscored_number_err_leading_zero.js create mode 100644 lib/test/flow/numbers/underscored_number_err_leading_zero.tree.json create mode 100644 lib/test/flow/numbers/underscored_number_err_trail.js create mode 100644 lib/test/flow/numbers/underscored_number_err_trail.tree.json create mode 100644 lib/test/flow/numbers/underscored_oct.js create mode 100644 lib/test/flow/numbers/underscored_oct.tree.json create mode 100644 lib/test/flow/object-literal-spread/spread_is_first.js create mode 100644 lib/test/flow/object-literal-spread/spread_is_first.tree.json create mode 100644 lib/test/flow/object-literal-spread/spread_is_last.js create mode 100644 lib/test/flow/object-literal-spread/spread_is_last.tree.json create mode 100644 lib/test/flow/object-literal-spread/spread_is_last_trailing_comma.js create mode 100644 lib/test/flow/object-literal-spread/spread_is_last_trailing_comma.tree.json create mode 100644 lib/test/flow/optional_chaining/class-constructor-call.js create mode 100644 lib/test/flow/optional_chaining/class-constructor-call.options.json create mode 100644 lib/test/flow/optional_chaining/class-constructor-call.tree.json create mode 100644 lib/test/flow/optional_chaining/conditional-decimal.js create mode 100644 lib/test/flow/optional_chaining/conditional-decimal.options.json create mode 100644 lib/test/flow/optional_chaining/conditional-decimal.tree.json create mode 100644 lib/test/flow/optional_chaining/function-call.js create mode 100644 lib/test/flow/optional_chaining/function-call.options.json create mode 100644 lib/test/flow/optional_chaining/function-call.tree.json create mode 100644 lib/test/flow/optional_chaining/member-access-bracket.js create mode 100644 lib/test/flow/optional_chaining/member-access-bracket.options.json create mode 100644 lib/test/flow/optional_chaining/member-access-bracket.tree.json create mode 100644 lib/test/flow/optional_chaining/member-access.js create mode 100644 lib/test/flow/optional_chaining/member-access.options.json create mode 100644 lib/test/flow/optional_chaining/member-access.tree.json create mode 100644 lib/test/flow/optional_chaining/missing-plugin.js create mode 100644 lib/test/flow/optional_chaining/missing-plugin.tree.json create mode 100644 lib/test/flow/optional_chaining/optional-chain-expression.js create mode 100644 lib/test/flow/optional_chaining/optional-chain-expression.options.json create mode 100644 lib/test/flow/optional_chaining/optional-chain-expression.tree.json create mode 100644 lib/test/flow/optional_chaining/parenthesized-chain.js create mode 100644 lib/test/flow/optional_chaining/parenthesized-chain.options.json create mode 100644 lib/test/flow/optional_chaining/parenthesized-chain.tree.json create mode 100644 lib/test/flow/optional_chaining/separated-chaining.js create mode 100644 lib/test/flow/optional_chaining/separated-chaining.options.json create mode 100644 lib/test/flow/optional_chaining/separated-chaining.tree.json create mode 100644 lib/test/flow/optional_chaining/template-literals.js create mode 100644 lib/test/flow/optional_chaining/template-literals.options.json create mode 100644 lib/test/flow/optional_chaining/template-literals.tree.json create mode 100644 lib/test/flow/private_class_properties/constructor.js create mode 100644 lib/test/flow/private_class_properties/constructor.tree.json create mode 100644 lib/test/flow/private_class_properties/delete.js create mode 100644 lib/test/flow/private_class_properties/delete.tree.json create mode 100644 lib/test/flow/private_class_properties/getter.js create mode 100644 lib/test/flow/private_class_properties/getter.tree.json create mode 100644 lib/test/flow/private_class_properties/getter_and_field.js create mode 100644 lib/test/flow/private_class_properties/getter_and_field.tree.json create mode 100644 lib/test/flow/private_class_properties/getter_and_setter.js create mode 100644 lib/test/flow/private_class_properties/getter_and_setter.tree.json create mode 100644 lib/test/flow/private_class_properties/getter_duplicate.js create mode 100644 lib/test/flow/private_class_properties/getter_duplicate.tree.json create mode 100644 lib/test/flow/private_class_properties/getter_whitespace.js create mode 100644 lib/test/flow/private_class_properties/getter_whitespace.tree.json create mode 100644 lib/test/flow/private_class_properties/member.js create mode 100644 lib/test/flow/private_class_properties/member.tree.json create mode 100644 lib/test/flow/private_class_properties/member_whitespace.js create mode 100644 lib/test/flow/private_class_properties/member_whitespace.tree.json create mode 100644 lib/test/flow/private_class_properties/multiple.js create mode 100644 lib/test/flow/private_class_properties/multiple.tree.json create mode 100644 lib/test/flow/private_class_properties/nested.js create mode 100644 lib/test/flow/private_class_properties/nested.tree.json create mode 100644 lib/test/flow/private_class_properties/object_type.js create mode 100644 lib/test/flow/private_class_properties/object_type.tree.json create mode 100644 lib/test/flow/private_class_properties/scope.js create mode 100644 lib/test/flow/private_class_properties/scope.tree.json create mode 100644 lib/test/flow/private_class_properties/setter.js create mode 100644 lib/test/flow/private_class_properties/setter.tree.json create mode 100644 lib/test/flow/private_class_properties/setter_and_field.js create mode 100644 lib/test/flow/private_class_properties/setter_and_field.tree.json create mode 100644 lib/test/flow/private_class_properties/setter_duplicate.js create mode 100644 lib/test/flow/private_class_properties/setter_duplicate.tree.json create mode 100644 lib/test/flow/private_class_properties/super.js create mode 100644 lib/test/flow/private_class_properties/super.tree.json create mode 100644 lib/test/flow/private_class_properties/unannotated.js create mode 100644 lib/test/flow/private_class_properties/unannotated.tree.json create mode 100644 lib/test/flow/private_class_properties/unannotated_asi.js create mode 100644 lib/test/flow/private_class_properties/unannotated_asi.tree.json create mode 100644 lib/test/flow/private_class_properties/valid.js create mode 100644 lib/test/flow/private_class_properties/valid.tree.json create mode 100644 lib/test/flow/private_class_properties/whitespace.js create mode 100644 lib/test/flow/private_class_properties/whitespace.tree.json create mode 100644 lib/test/flow/statement/if/declare_in_consequent.js create mode 100644 lib/test/flow/statement/if/declare_in_consequent.tree.json create mode 100644 lib/test/flow/statement/labelled/label_declare.js create mode 100644 lib/test/flow/statement/labelled/label_declare.tree.json create mode 100644 lib/test/flow/statement/labelled/label_of.js create mode 100644 lib/test/flow/statement/labelled/label_of.tree.json create mode 100644 lib/test/flow/statement/labelled/label_type.js create mode 100644 lib/test/flow/statement/labelled/label_type.tree.json create mode 100644 lib/test/flow/statement/labelled/statement_with_parens.js create mode 100644 lib/test/flow/statement/labelled/statement_with_parens.tree.json create mode 100644 lib/test/flow/statement/labelled/statement_with_parens_no_semi.js create mode 100644 lib/test/flow/statement/labelled/statement_with_parens_no_semi.tree.json create mode 100644 lib/test/flow/statement/return/expression_with_parens.js create mode 100644 lib/test/flow/statement/return/expression_with_parens.tree.json create mode 100644 lib/test/flow/statement/return/expression_with_parens_no_semi.js create mode 100644 lib/test/flow/statement/return/expression_with_parens_no_semi.tree.json create mode 100644 lib/test/flow/statement/throw/expression_with_parens.js create mode 100644 lib/test/flow/statement/throw/expression_with_parens.tree.json create mode 100644 lib/test/flow/statement/throw/expression_with_parens_no_semi.js create mode 100644 lib/test/flow/statement/throw/expression_with_parens_no_semi.tree.json create mode 100644 lib/test/flow/statement/variable/const_ends_with_paren.js create mode 100644 lib/test/flow/statement/variable/const_ends_with_paren.tree.json create mode 100644 lib/test/flow/statement/variable/const_ends_with_paren_no_semi.js create mode 100644 lib/test/flow/statement/variable/const_ends_with_paren_no_semi.tree.json create mode 100644 lib/test/flow/statement/variable/let_ends_with_paren.js create mode 100644 lib/test/flow/statement/variable/let_ends_with_paren.tree.json create mode 100644 lib/test/flow/statement/variable/let_ends_with_paren_no_semi.js create mode 100644 lib/test/flow/statement/variable/let_ends_with_paren_no_semi.tree.json create mode 100644 lib/test/flow/statement/variable/var_ends_with_paren.js create mode 100644 lib/test/flow/statement/variable/var_ends_with_paren.tree.json create mode 100644 lib/test/flow/statement/variable/var_ends_with_paren_no_semi.js create mode 100644 lib/test/flow/statement/variable/var_ends_with_paren_no_semi.tree.json create mode 100644 lib/test/flow/statement/variable/var_named_declare.js create mode 100644 lib/test/flow/statement/variable/var_named_declare.tree.json create mode 100644 lib/test/flow/statement/variable/var_named_type.js create mode 100644 lib/test/flow/statement/variable/var_named_type.tree.json create mode 100644 lib/test/flow/this_param/annotation_required.js create mode 100644 lib/test/flow/this_param/annotation_required.tree.json create mode 100644 lib/test/flow/this_param/arrow_function.js create mode 100644 lib/test/flow/this_param/arrow_function.tree.json create mode 100644 lib/test/flow/this_param/class_constructor.js create mode 100644 lib/test/flow/this_param/class_constructor.tree.json create mode 100644 lib/test/flow/this_param/class_method.js create mode 100644 lib/test/flow/this_param/class_method.tree.json create mode 100644 lib/test/flow/this_param/declare_class.js create mode 100644 lib/test/flow/this_param/declare_class.tree.json create mode 100644 lib/test/flow/this_param/declare_function.js create mode 100644 lib/test/flow/this_param/declare_function.tree.json create mode 100644 lib/test/flow/this_param/function_declaration.js create mode 100644 lib/test/flow/this_param/function_declaration.tree.json create mode 100644 lib/test/flow/this_param/function_expression.js create mode 100644 lib/test/flow/this_param/function_expression.tree.json create mode 100644 lib/test/flow/this_param/function_type.js create mode 100644 lib/test/flow/this_param/function_type.tree.json create mode 100644 lib/test/flow/this_param/function_type_no_annotation.js create mode 100644 lib/test/flow/this_param/function_type_no_annotation.tree.json create mode 100644 lib/test/flow/this_param/getters_and_setters.js create mode 100644 lib/test/flow/this_param/getters_and_setters.tree.json create mode 100644 lib/test/flow/this_param/must_be_first.js create mode 100644 lib/test/flow/this_param/must_be_first.tree.json create mode 100644 lib/test/flow/this_param/no_shorthand_arrow_function.js create mode 100644 lib/test/flow/this_param/no_shorthand_arrow_function.tree.json create mode 100644 lib/test/flow/this_param/not_an_arrow_function.js create mode 100644 lib/test/flow/this_param/not_an_arrow_function.tree.json create mode 100644 lib/test/flow/this_param/object_method.js create mode 100644 lib/test/flow/this_param/object_method.tree.json create mode 100644 lib/test/flow/trailing_commas/migrated_0000.js create mode 100644 lib/test/flow/trailing_commas/migrated_0000.tree.json create mode 100644 lib/test/flow/trailing_commas/migrated_0001.js create mode 100644 lib/test/flow/trailing_commas/migrated_0001.tree.json create mode 100644 lib/test/flow/trailing_commas/migrated_0002.js create mode 100644 lib/test/flow/trailing_commas/migrated_0002.tree.json create mode 100644 lib/test/flow/trailing_commas/migrated_0003.js create mode 100644 lib/test/flow/trailing_commas/migrated_0003.tree.json create mode 100644 lib/test/flow/trailing_commas/migrated_0004.js create mode 100644 lib/test/flow/trailing_commas/migrated_0004.tree.json create mode 100644 lib/test/flow/trailing_commas/migrated_0005.js create mode 100644 lib/test/flow/trailing_commas/migrated_0005.tree.json create mode 100644 lib/test/flow/trailing_commas/migrated_0006.js create mode 100644 lib/test/flow/trailing_commas/migrated_0006.tree.json create mode 100644 lib/test/flow/trailing_commas/migrated_0007.js create mode 100644 lib/test/flow/trailing_commas/migrated_0007.tree.json create mode 100644 lib/test/flow/trailing_commas/migrated_0008.js create mode 100644 lib/test/flow/trailing_commas/migrated_0008.tree.json create mode 100644 lib/test/flow/trailing_commas/migrated_0009.js create mode 100644 lib/test/flow/trailing_commas/migrated_0009.tree.json create mode 100644 lib/test/flow/trailing_commas/migrated_0010.js create mode 100644 lib/test/flow/trailing_commas/migrated_0010.tree.json create mode 100644 lib/test/flow/trailing_commas_invalid/migrated_0000.js create mode 100644 lib/test/flow/trailing_commas_invalid/migrated_0000.tree.json create mode 100644 lib/test/flow/trailing_commas_invalid/migrated_0001.js create mode 100644 lib/test/flow/trailing_commas_invalid/migrated_0001.tree.json create mode 100644 lib/test/flow/trailing_commas_invalid/migrated_0002.js create mode 100644 lib/test/flow/trailing_commas_invalid/migrated_0002.tree.json create mode 100644 lib/test/flow/trailing_commas_invalid/migrated_0003.js create mode 100644 lib/test/flow/trailing_commas_invalid/migrated_0003.tree.json create mode 100644 lib/test/flow/typeapp_call/disabled_ambiguous_call.js create mode 100644 lib/test/flow/typeapp_call/disabled_ambiguous_call.options.json create mode 100644 lib/test/flow/typeapp_call/disabled_ambiguous_call.tree.json create mode 100644 lib/test/flow/typeapp_call/disabled_ambiguous_new.js create mode 100644 lib/test/flow/typeapp_call/disabled_ambiguous_new.options.json create mode 100644 lib/test/flow/typeapp_call/disabled_ambiguous_new.tree.json create mode 100644 lib/test/flow/typeapp_call/function_call.js create mode 100644 lib/test/flow/typeapp_call/function_call.tree.json create mode 100644 lib/test/flow/typeapp_call/function_call_chain.js create mode 100644 lib/test/flow/typeapp_call/function_call_chain.tree.json create mode 100644 lib/test/flow/typeapp_call/function_call_optional.js create mode 100644 lib/test/flow/typeapp_call/function_call_optional.options.json create mode 100644 lib/test/flow/typeapp_call/function_call_optional.tree.json create mode 100644 lib/test/flow/typeapp_call/method_call.js create mode 100644 lib/test/flow/typeapp_call/method_call.tree.json create mode 100644 lib/test/flow/typeapp_call/method_call_computed.js create mode 100644 lib/test/flow/typeapp_call/method_call_computed.tree.json create mode 100644 lib/test/flow/typeapp_call/method_call_optional.js create mode 100644 lib/test/flow/typeapp_call/method_call_optional.options.json create mode 100644 lib/test/flow/typeapp_call/method_call_optional.tree.json create mode 100644 lib/test/flow/typeapp_call/method_call_optional2.js create mode 100644 lib/test/flow/typeapp_call/method_call_optional2.options.json create mode 100644 lib/test/flow/typeapp_call/method_call_optional2.tree.json create mode 100644 lib/test/flow/typeapp_call/new.js create mode 100644 lib/test/flow/typeapp_call/new.tree.json create mode 100644 lib/test/flow/typeapp_call/new_noparens.js create mode 100644 lib/test/flow/typeapp_call/new_noparens.tree.json create mode 100644 lib/test/flow/typeapp_call/rollback_computed.js create mode 100644 lib/test/flow/typeapp_call/rollback_computed.tree.json create mode 100644 lib/test/flow/typeapp_call/rollback_dot.js create mode 100644 lib/test/flow/typeapp_call/rollback_dot.tree.json create mode 100644 lib/test/flow/typeapp_call/rollback_jsx.js create mode 100644 lib/test/flow/typeapp_call/rollback_jsx.tree.json create mode 100644 lib/test/flow/types/aliases/alias_with_parens.js create mode 100644 lib/test/flow/types/aliases/alias_with_parens.tree.json create mode 100644 lib/test/flow/types/aliases/alias_with_parens_no_semi.js create mode 100644 lib/test/flow/types/aliases/alias_with_parens_no_semi.tree.json create mode 100644 lib/test/flow/types/aliases/keyword.js create mode 100644 lib/test/flow/types/aliases/keyword.tree.json create mode 100644 lib/test/flow/types/aliases/line_separator_after_type.js create mode 100644 lib/test/flow/types/aliases/line_separator_after_type.tree.json create mode 100644 lib/test/flow/types/aliases/migrated_0000.js create mode 100644 lib/test/flow/types/aliases/migrated_0000.tree.json create mode 100644 lib/test/flow/types/aliases/migrated_0001.js create mode 100644 lib/test/flow/types/aliases/migrated_0001.tree.json create mode 100644 lib/test/flow/types/aliases/migrated_0002.js create mode 100644 lib/test/flow/types/aliases/migrated_0002.tree.json create mode 100644 lib/test/flow/types/aliases/migrated_0003.js create mode 100644 lib/test/flow/types/aliases/migrated_0003.tree.json create mode 100644 lib/test/flow/types/aliases/migrated_0004.js create mode 100644 lib/test/flow/types/aliases/migrated_0004.tree.json create mode 100644 lib/test/flow/types/aliases/reserved_type.js create mode 100644 lib/test/flow/types/aliases/reserved_type.tree.json create mode 100644 lib/test/flow/types/annotations/explicit_inexact_disallowed_in_non_objects.js create mode 100644 lib/test/flow/types/annotations/explicit_inexact_disallowed_in_non_objects.tree.json create mode 100644 lib/test/flow/types/annotations/explicit_inexact_forbidden_in_exact.js create mode 100644 lib/test/flow/types/annotations/explicit_inexact_forbidden_in_exact.tree.json create mode 100644 lib/test/flow/types/annotations/explicit_inexact_must_appear_last.js create mode 100644 lib/test/flow/types/annotations/explicit_inexact_must_appear_last.tree.json create mode 100644 lib/test/flow/types/annotations/explicit_inexact_object.js create mode 100644 lib/test/flow/types/annotations/explicit_inexact_object.tree.json create mode 100644 lib/test/flow/types/annotations/explicit_inexact_object_invalid.js create mode 100644 lib/test/flow/types/annotations/explicit_inexact_object_invalid.tree.json create mode 100644 lib/test/flow/types/annotations/explicit_inexact_trailing_comma.js create mode 100644 lib/test/flow/types/annotations/explicit_inexact_trailing_comma.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0000.js create mode 100644 lib/test/flow/types/annotations/migrated_0000.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0001.js create mode 100644 lib/test/flow/types/annotations/migrated_0001.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0002.js create mode 100644 lib/test/flow/types/annotations/migrated_0002.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0003.js create mode 100644 lib/test/flow/types/annotations/migrated_0003.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0004.js create mode 100644 lib/test/flow/types/annotations/migrated_0004.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0005.js create mode 100644 lib/test/flow/types/annotations/migrated_0005.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0006.js create mode 100644 lib/test/flow/types/annotations/migrated_0006.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0007.js create mode 100644 lib/test/flow/types/annotations/migrated_0007.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0008.js create mode 100644 lib/test/flow/types/annotations/migrated_0008.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0009.js create mode 100644 lib/test/flow/types/annotations/migrated_0009.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0010.js create mode 100644 lib/test/flow/types/annotations/migrated_0010.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0011.js create mode 100644 lib/test/flow/types/annotations/migrated_0011.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0012.js create mode 100644 lib/test/flow/types/annotations/migrated_0012.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0013.js create mode 100644 lib/test/flow/types/annotations/migrated_0013.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0014.js create mode 100644 lib/test/flow/types/annotations/migrated_0014.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0015.js create mode 100644 lib/test/flow/types/annotations/migrated_0015.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0016.js create mode 100644 lib/test/flow/types/annotations/migrated_0016.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0017.js create mode 100644 lib/test/flow/types/annotations/migrated_0017.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0018.js create mode 100644 lib/test/flow/types/annotations/migrated_0018.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0019.js create mode 100644 lib/test/flow/types/annotations/migrated_0019.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0020.js create mode 100644 lib/test/flow/types/annotations/migrated_0020.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0021.js create mode 100644 lib/test/flow/types/annotations/migrated_0021.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0022.js create mode 100644 lib/test/flow/types/annotations/migrated_0022.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0023.js create mode 100644 lib/test/flow/types/annotations/migrated_0023.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0024.js create mode 100644 lib/test/flow/types/annotations/migrated_0024.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0025.js create mode 100644 lib/test/flow/types/annotations/migrated_0025.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0026.js create mode 100644 lib/test/flow/types/annotations/migrated_0026.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0027.js create mode 100644 lib/test/flow/types/annotations/migrated_0027.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0030.js create mode 100644 lib/test/flow/types/annotations/migrated_0030.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0031.js create mode 100644 lib/test/flow/types/annotations/migrated_0031.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0032.js create mode 100644 lib/test/flow/types/annotations/migrated_0032.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0033.js create mode 100644 lib/test/flow/types/annotations/migrated_0033.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0034.js create mode 100644 lib/test/flow/types/annotations/migrated_0034.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0035.js create mode 100644 lib/test/flow/types/annotations/migrated_0035.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0036.js create mode 100644 lib/test/flow/types/annotations/migrated_0036.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0037.js create mode 100644 lib/test/flow/types/annotations/migrated_0037.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0038.js create mode 100644 lib/test/flow/types/annotations/migrated_0038.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0039.js create mode 100644 lib/test/flow/types/annotations/migrated_0039.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0040.js create mode 100644 lib/test/flow/types/annotations/migrated_0040.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0041.js create mode 100644 lib/test/flow/types/annotations/migrated_0041.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0042.js create mode 100644 lib/test/flow/types/annotations/migrated_0042.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0043.js create mode 100644 lib/test/flow/types/annotations/migrated_0043.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0044.js create mode 100644 lib/test/flow/types/annotations/migrated_0044.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0045.js create mode 100644 lib/test/flow/types/annotations/migrated_0045.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0046.js create mode 100644 lib/test/flow/types/annotations/migrated_0046.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0047.js create mode 100644 lib/test/flow/types/annotations/migrated_0047.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0048.js create mode 100644 lib/test/flow/types/annotations/migrated_0048.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0049.js create mode 100644 lib/test/flow/types/annotations/migrated_0049.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0050.js create mode 100644 lib/test/flow/types/annotations/migrated_0050.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0051.js create mode 100644 lib/test/flow/types/annotations/migrated_0051.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0052.js create mode 100644 lib/test/flow/types/annotations/migrated_0052.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0053.js create mode 100644 lib/test/flow/types/annotations/migrated_0053.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0054.js create mode 100644 lib/test/flow/types/annotations/migrated_0054.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0055.js create mode 100644 lib/test/flow/types/annotations/migrated_0055.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0056.js create mode 100644 lib/test/flow/types/annotations/migrated_0056.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0057.js create mode 100644 lib/test/flow/types/annotations/migrated_0057.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0058.js create mode 100644 lib/test/flow/types/annotations/migrated_0058.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0059.js create mode 100644 lib/test/flow/types/annotations/migrated_0059.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0060.js create mode 100644 lib/test/flow/types/annotations/migrated_0060.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0061.js create mode 100644 lib/test/flow/types/annotations/migrated_0061.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0062.js create mode 100644 lib/test/flow/types/annotations/migrated_0062.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0063.js create mode 100644 lib/test/flow/types/annotations/migrated_0063.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0064.js create mode 100644 lib/test/flow/types/annotations/migrated_0064.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0065.js create mode 100644 lib/test/flow/types/annotations/migrated_0065.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0066.js create mode 100644 lib/test/flow/types/annotations/migrated_0066.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0067.js create mode 100644 lib/test/flow/types/annotations/migrated_0067.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0068.js create mode 100644 lib/test/flow/types/annotations/migrated_0068.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0069.js create mode 100644 lib/test/flow/types/annotations/migrated_0069.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0070.js create mode 100644 lib/test/flow/types/annotations/migrated_0070.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0071.js create mode 100644 lib/test/flow/types/annotations/migrated_0071.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0072.js create mode 100644 lib/test/flow/types/annotations/migrated_0072.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0073.js create mode 100644 lib/test/flow/types/annotations/migrated_0073.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0074.js create mode 100644 lib/test/flow/types/annotations/migrated_0074.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0075.js create mode 100644 lib/test/flow/types/annotations/migrated_0075.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0076.js create mode 100644 lib/test/flow/types/annotations/migrated_0076.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0077.js create mode 100644 lib/test/flow/types/annotations/migrated_0077.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0078.js create mode 100644 lib/test/flow/types/annotations/migrated_0078.tree.json create mode 100644 lib/test/flow/types/annotations/migrated_0079.js create mode 100644 lib/test/flow/types/annotations/migrated_0079.tree.json create mode 100644 lib/test/flow/types/annotations/static_is_reserved_param.js create mode 100644 lib/test/flow/types/annotations/static_is_reserved_param.tree.json create mode 100644 lib/test/flow/types/annotations/static_is_reserved_type.js create mode 100644 lib/test/flow/types/annotations/static_is_reserved_type.tree.json create mode 100644 lib/test/flow/types/annotations/symbol.js create mode 100644 lib/test/flow/types/annotations/symbol.tree.json create mode 100644 lib/test/flow/types/annotations/underscore_is_allowed_trailing_commas.js create mode 100644 lib/test/flow/types/annotations/underscore_is_allowed_trailing_commas.tree.json create mode 100644 lib/test/flow/types/annotations/underscore_is_implicit_anywhere_in_list.js create mode 100644 lib/test/flow/types/annotations/underscore_is_implicit_anywhere_in_list.tree.json create mode 100644 lib/test/flow/types/annotations/underscore_is_implicit_in_calls.js create mode 100644 lib/test/flow/types/annotations/underscore_is_implicit_in_calls.tree.json create mode 100644 lib/test/flow/types/annotations/underscore_is_implicit_in_constructor_calls.js create mode 100644 lib/test/flow/types/annotations/underscore_is_implicit_in_constructor_calls.tree.json create mode 100644 lib/test/flow/types/annotations/underscore_is_implicit_in_methods.js create mode 100644 lib/test/flow/types/annotations/underscore_is_implicit_in_methods.tree.json create mode 100644 lib/test/flow/types/annotations/underscore_is_reserved_elsewhere.js create mode 100644 lib/test/flow/types/annotations/underscore_is_reserved_elsewhere.tree.json create mode 100644 lib/test/flow/types/annotations/unfinished_colon_method.js create mode 100644 lib/test/flow/types/annotations/unfinished_colon_method.tree.json create mode 100644 lib/test/flow/types/annotations/unfinished_colon_param.js create mode 100644 lib/test/flow/types/annotations/unfinished_colon_param.tree.json create mode 100644 lib/test/flow/types/annotations/unfinished_colon_return.js create mode 100644 lib/test/flow/types/annotations/unfinished_colon_return.tree.json create mode 100644 lib/test/flow/types/annotations/unfinished_function_body.js create mode 100644 lib/test/flow/types/annotations/unfinished_function_body.tree.json create mode 100644 lib/test/flow/types/annotations/void_is_reserved_param.js create mode 100644 lib/test/flow/types/annotations/void_is_reserved_param.tree.json create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0000.js create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0000.tree.json create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0001.js create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0001.tree.json create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0002.js create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0002.tree.json create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0003.js create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0003.tree.json create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0004.js create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0004.tree.json create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0005.js create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0005.tree.json create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0006.js create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0006.tree.json create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0007.js create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0007.tree.json create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0008.js create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0008.tree.json create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0009.js create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0009.tree.json create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0010.js create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0010.tree.json create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0011.js create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0011.tree.json create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0012.js create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0012.tree.json create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0013.js create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0013.tree.json create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0014.js create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0014.tree.json create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0015.js create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0015.tree.json create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0016.js create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0016.tree.json create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0017.js create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0017.tree.json create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0018.js create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0018.tree.json create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0019.js create mode 100644 lib/test/flow/types/annotations_in_comments/migrated_0019.tree.json create mode 100644 lib/test/flow/types/annotations_in_comments_invalid/migrated_0000.js create mode 100644 lib/test/flow/types/annotations_in_comments_invalid/migrated_0000.tree.json create mode 100644 lib/test/flow/types/annotations_in_comments_invalid/migrated_0001.js create mode 100644 lib/test/flow/types/annotations_in_comments_invalid/migrated_0001.tree.json create mode 100644 lib/test/flow/types/annotations_in_comments_invalid/migrated_0002.js create mode 100644 lib/test/flow/types/annotations_in_comments_invalid/migrated_0002.tree.json create mode 100644 lib/test/flow/types/annotations_in_comments_invalid/migrated_0003.js create mode 100644 lib/test/flow/types/annotations_in_comments_invalid/migrated_0003.tree.json create mode 100644 lib/test/flow/types/annotations_in_comments_invalid/migrated_0004.js create mode 100644 lib/test/flow/types/annotations_in_comments_invalid/migrated_0004.tree.json create mode 100644 lib/test/flow/types/annotations_in_comments_invalid/migrated_0005.js create mode 100644 lib/test/flow/types/annotations_in_comments_invalid/migrated_0005.tree.json create mode 100644 lib/test/flow/types/annotations_in_comments_invalid/migrated_0006.js create mode 100644 lib/test/flow/types/annotations_in_comments_invalid/migrated_0006.tree.json create mode 100644 lib/test/flow/types/annotations_in_comments_invalid/migrated_0007.js create mode 100644 lib/test/flow/types/annotations_in_comments_invalid/migrated_0007.tree.json create mode 100644 lib/test/flow/types/annotations_in_comments_types_disabled/migrated_0000.js create mode 100644 lib/test/flow/types/annotations_in_comments_types_disabled/migrated_0000.options.json create mode 100644 lib/test/flow/types/annotations_in_comments_types_disabled/migrated_0000.tree.json create mode 100644 lib/test/flow/types/annotations_in_comments_types_disabled/migrated_0001.js create mode 100644 lib/test/flow/types/annotations_in_comments_types_disabled/migrated_0001.options.json create mode 100644 lib/test/flow/types/annotations_in_comments_types_disabled/migrated_0001.tree.json create mode 100644 lib/test/flow/types/bigint_literal/migrated_0000.js create mode 100644 lib/test/flow/types/bigint_literal/migrated_0000.tree.json create mode 100644 lib/test/flow/types/bigint_literal/migrated_0002.js create mode 100644 lib/test/flow/types/bigint_literal/migrated_0002.tree.json create mode 100644 lib/test/flow/types/bigint_literal/migrated_0003.js create mode 100644 lib/test/flow/types/bigint_literal/migrated_0003.tree.json create mode 100644 lib/test/flow/types/bigint_literal/migrated_0004.js create mode 100644 lib/test/flow/types/bigint_literal/migrated_0004.tree.json create mode 100644 lib/test/flow/types/bigint_literal/migrated_0005.js create mode 100644 lib/test/flow/types/bigint_literal/migrated_0005.tree.json create mode 100644 lib/test/flow/types/bigint_literal/migrated_0006.js create mode 100644 lib/test/flow/types/bigint_literal/migrated_0006.tree.json create mode 100644 lib/test/flow/types/bigint_literal/migrated_0007.js create mode 100644 lib/test/flow/types/bigint_literal/migrated_0007.tree.json create mode 100644 lib/test/flow/types/bigint_literal/migrated_0008.js create mode 100644 lib/test/flow/types/bigint_literal/migrated_0008.tree.json create mode 100644 lib/test/flow/types/bigint_literal/migrated_0009.js create mode 100644 lib/test/flow/types/bigint_literal/migrated_0009.tree.json create mode 100644 lib/test/flow/types/bigint_literal_invalid/migrated_0000.js create mode 100644 lib/test/flow/types/bigint_literal_invalid/migrated_0000.tree.json create mode 100644 lib/test/flow/types/bigint_literal_invalid/migrated_0001.js create mode 100644 lib/test/flow/types/bigint_literal_invalid/migrated_0001.tree.json create mode 100644 lib/test/flow/types/bigint_literal_invalid/migrated_0002.js create mode 100644 lib/test/flow/types/bigint_literal_invalid/migrated_0002.tree.json create mode 100644 lib/test/flow/types/bigint_literal_invalid/migrated_0010.js create mode 100644 lib/test/flow/types/bigint_literal_invalid/migrated_0010.tree.json create mode 100644 lib/test/flow/types/boolean_literal/migrated_0000.js create mode 100644 lib/test/flow/types/boolean_literal/migrated_0000.tree.json create mode 100644 lib/test/flow/types/boolean_literal/migrated_0001.js create mode 100644 lib/test/flow/types/boolean_literal/migrated_0001.tree.json create mode 100644 lib/test/flow/types/class_property_variance/migrated_0000.js create mode 100644 lib/test/flow/types/class_property_variance/migrated_0000.tree.json create mode 100644 lib/test/flow/types/class_property_variance/migrated_0001.js create mode 100644 lib/test/flow/types/class_property_variance/migrated_0001.tree.json create mode 100644 lib/test/flow/types/class_property_variance/migrated_0002.js create mode 100644 lib/test/flow/types/class_property_variance/migrated_0002.tree.json create mode 100644 lib/test/flow/types/class_property_variance/migrated_0003.js create mode 100644 lib/test/flow/types/class_property_variance/migrated_0003.tree.json create mode 100644 lib/test/flow/types/class_property_variance/migrated_0004.js create mode 100644 lib/test/flow/types/class_property_variance/migrated_0004.tree.json create mode 100644 lib/test/flow/types/class_property_variance/migrated_0005.js create mode 100644 lib/test/flow/types/class_property_variance/migrated_0005.tree.json create mode 100644 lib/test/flow/types/class_property_variance/migrated_0006.js create mode 100644 lib/test/flow/types/class_property_variance/migrated_0006.tree.json create mode 100644 lib/test/flow/types/class_property_variance/migrated_0007.js create mode 100644 lib/test/flow/types/class_property_variance/migrated_0007.tree.json create mode 100644 lib/test/flow/types/class_property_variance/migrated_0008.js create mode 100644 lib/test/flow/types/class_property_variance/migrated_0008.tree.json create mode 100644 lib/test/flow/types/class_property_variance/migrated_0009.js create mode 100644 lib/test/flow/types/class_property_variance/migrated_0009.tree.json create mode 100644 lib/test/flow/types/class_property_variance/migrated_0010.js create mode 100644 lib/test/flow/types/class_property_variance/migrated_0010.tree.json create mode 100644 lib/test/flow/types/declare_class/basic.js create mode 100644 lib/test/flow/types/declare_class/basic.tree.json create mode 100644 lib/test/flow/types/declare_class/field_named_static.js create mode 100644 lib/test/flow/types/declare_class/field_named_static.tree.json create mode 100644 lib/test/flow/types/declare_class/implements.js create mode 100644 lib/test/flow/types/declare_class/implements.tree.json create mode 100644 lib/test/flow/types/declare_class/implements_and_mixins.js create mode 100644 lib/test/flow/types/declare_class/implements_and_mixins.tree.json create mode 100644 lib/test/flow/types/declare_class/implements_multiple.js create mode 100644 lib/test/flow/types/declare_class/implements_multiple.tree.json create mode 100644 lib/test/flow/types/declare_class/invalid_quoted_static_modifier.js create mode 100644 lib/test/flow/types/declare_class/invalid_quoted_static_modifier.tree.json create mode 100644 lib/test/flow/types/declare_class/method_with_this_return.js create mode 100644 lib/test/flow/types/declare_class/method_with_this_return.tree.json create mode 100644 lib/test/flow/types/declare_class/mixins.js create mode 100644 lib/test/flow/types/declare_class/mixins.tree.json create mode 100644 lib/test/flow/types/declare_class/mixins_multiple.js create mode 100644 lib/test/flow/types/declare_class/mixins_multiple.tree.json create mode 100644 lib/test/flow/types/declare_class/multiple_extends.js create mode 100644 lib/test/flow/types/declare_class/multiple_extends.tree.json create mode 100644 lib/test/flow/types/declare_class/proto.js create mode 100644 lib/test/flow/types/declare_class/proto.tree.json create mode 100644 lib/test/flow/types/declare_class/proto_indexer.js create mode 100644 lib/test/flow/types/declare_class/proto_indexer.tree.json create mode 100644 lib/test/flow/types/declare_class/proto_method.js create mode 100644 lib/test/flow/types/declare_class/proto_method.tree.json create mode 100644 lib/test/flow/types/declare_class/static_indexer.js create mode 100644 lib/test/flow/types/declare_class/static_indexer.tree.json create mode 100644 lib/test/flow/types/declare_class/static_method.js create mode 100644 lib/test/flow/types/declare_class/static_method.tree.json create mode 100644 lib/test/flow/types/declare_class/static_proto.js create mode 100644 lib/test/flow/types/declare_class/static_proto.tree.json create mode 100644 lib/test/flow/types/declare_class/truncated0.js create mode 100644 lib/test/flow/types/declare_class/truncated0.tree.json create mode 100644 lib/test/flow/types/declare_class/truncated1.js create mode 100644 lib/test/flow/types/declare_class/truncated1.tree.json create mode 100644 lib/test/flow/types/declare_class/truncated2.js create mode 100644 lib/test/flow/types/declare_class/truncated2.tree.json create mode 100644 lib/test/flow/types/declare_class_properties/basic.js create mode 100644 lib/test/flow/types/declare_class_properties/basic.tree.json create mode 100644 lib/test/flow/types/declare_class_properties/invalid_async.js create mode 100644 lib/test/flow/types/declare_class_properties/invalid_async.tree.json create mode 100644 lib/test/flow/types/declare_class_properties/invalid_initializer.js create mode 100644 lib/test/flow/types/declare_class_properties/invalid_initializer.tree.json create mode 100644 lib/test/flow/types/declare_class_properties/invalid_missing_annotation.js create mode 100644 lib/test/flow/types/declare_class_properties/invalid_missing_annotation.tree.json create mode 100644 lib/test/flow/types/declare_export/batch/migrated_0000.js create mode 100644 lib/test/flow/types/declare_export/batch/migrated_0000.tree.json create mode 100644 lib/test/flow/types/declare_export/batch/migrated_0001.js create mode 100644 lib/test/flow/types/declare_export/batch/migrated_0001.tree.json create mode 100644 lib/test/flow/types/declare_export/class/migrated_0017.js create mode 100644 lib/test/flow/types/declare_export/class/migrated_0017.tree.json create mode 100644 lib/test/flow/types/declare_export/class/migrated_0018.js create mode 100644 lib/test/flow/types/declare_export/class/migrated_0018.tree.json create mode 100644 lib/test/flow/types/declare_export/class/migrated_0019.js create mode 100644 lib/test/flow/types/declare_export/class/migrated_0019.tree.json create mode 100644 lib/test/flow/types/declare_export/class/migrated_0020.js create mode 100644 lib/test/flow/types/declare_export/class/migrated_0020.tree.json create mode 100644 lib/test/flow/types/declare_export/class/migrated_0021.js create mode 100644 lib/test/flow/types/declare_export/class/migrated_0021.tree.json create mode 100644 lib/test/flow/types/declare_export/declare_export_class_prop_named_static.js create mode 100644 lib/test/flow/types/declare_export/declare_export_class_prop_named_static.tree.json create mode 100644 lib/test/flow/types/declare_export/default/default_with_parens.js create mode 100644 lib/test/flow/types/declare_export/default/default_with_parens.tree.json create mode 100644 lib/test/flow/types/declare_export/default/default_with_parens_no_semi.js create mode 100644 lib/test/flow/types/declare_export/default/default_with_parens_no_semi.tree.json create mode 100644 lib/test/flow/types/declare_export/default/migrated_0022.js create mode 100644 lib/test/flow/types/declare_export/default/migrated_0022.tree.json create mode 100644 lib/test/flow/types/declare_export/default/migrated_0023.js create mode 100644 lib/test/flow/types/declare_export/default/migrated_0023.tree.json create mode 100644 lib/test/flow/types/declare_export/default/migrated_0024.js create mode 100644 lib/test/flow/types/declare_export/default/migrated_0024.tree.json create mode 100644 lib/test/flow/types/declare_export/default/migrated_0025.js create mode 100644 lib/test/flow/types/declare_export/default/migrated_0025.tree.json create mode 100644 lib/test/flow/types/declare_export/default/migrated_0026.js create mode 100644 lib/test/flow/types/declare_export/default/migrated_0026.tree.json create mode 100644 lib/test/flow/types/declare_export/default/migrated_0027.js create mode 100644 lib/test/flow/types/declare_export/default/migrated_0027.tree.json create mode 100644 lib/test/flow/types/declare_export/default/migrated_0028.js create mode 100644 lib/test/flow/types/declare_export/default/migrated_0028.tree.json create mode 100644 lib/test/flow/types/declare_export/default/migrated_0029.js create mode 100644 lib/test/flow/types/declare_export/default/migrated_0029.tree.json create mode 100644 lib/test/flow/types/declare_export/default/migrated_0030.js create mode 100644 lib/test/flow/types/declare_export/default/migrated_0030.tree.json create mode 100644 lib/test/flow/types/declare_export/default/migrated_0031.js create mode 100644 lib/test/flow/types/declare_export/default/migrated_0031.tree.json create mode 100644 lib/test/flow/types/declare_export/default/migrated_0032.js create mode 100644 lib/test/flow/types/declare_export/default/migrated_0032.tree.json create mode 100644 lib/test/flow/types/declare_export/function/migrated_0012.js create mode 100644 lib/test/flow/types/declare_export/function/migrated_0012.tree.json create mode 100644 lib/test/flow/types/declare_export/function/migrated_0013.js create mode 100644 lib/test/flow/types/declare_export/function/migrated_0013.tree.json create mode 100644 lib/test/flow/types/declare_export/function/migrated_0014.js create mode 100644 lib/test/flow/types/declare_export/function/migrated_0014.tree.json create mode 100644 lib/test/flow/types/declare_export/function/migrated_0015.js create mode 100644 lib/test/flow/types/declare_export/function/migrated_0015.tree.json create mode 100644 lib/test/flow/types/declare_export/function/migrated_0016.js create mode 100644 lib/test/flow/types/declare_export/function/migrated_0016.tree.json create mode 100644 lib/test/flow/types/declare_export/named/migrated_0002.js create mode 100644 lib/test/flow/types/declare_export/named/migrated_0002.tree.json create mode 100644 lib/test/flow/types/declare_export/named/migrated_0003.js create mode 100644 lib/test/flow/types/declare_export/named/migrated_0003.tree.json create mode 100644 lib/test/flow/types/declare_export/named/migrated_0004.js create mode 100644 lib/test/flow/types/declare_export/named/migrated_0004.tree.json create mode 100644 lib/test/flow/types/declare_export/named/migrated_0005.js create mode 100644 lib/test/flow/types/declare_export/named/migrated_0005.tree.json create mode 100644 lib/test/flow/types/declare_export/named/migrated_0006.js create mode 100644 lib/test/flow/types/declare_export/named/migrated_0006.tree.json create mode 100644 lib/test/flow/types/declare_export/named/migrated_0007.js create mode 100644 lib/test/flow/types/declare_export/named/migrated_0007.tree.json create mode 100644 lib/test/flow/types/declare_export/named/migrated_0008.js create mode 100644 lib/test/flow/types/declare_export/named/migrated_0008.tree.json create mode 100644 lib/test/flow/types/declare_export/var/migrated_0009.js create mode 100644 lib/test/flow/types/declare_export/var/migrated_0009.tree.json create mode 100644 lib/test/flow/types/declare_export/var/migrated_0010.js create mode 100644 lib/test/flow/types/declare_export/var/migrated_0010.tree.json create mode 100644 lib/test/flow/types/declare_export/var/migrated_0011.js create mode 100644 lib/test/flow/types/declare_export/var/migrated_0011.tree.json create mode 100644 lib/test/flow/types/declare_export_invalid/export_non_default_type.js create mode 100644 lib/test/flow/types/declare_export_invalid/export_non_default_type.tree.json create mode 100644 lib/test/flow/types/declare_export_invalid/export_type/migrated_0000.js create mode 100644 lib/test/flow/types/declare_export_invalid/export_type/migrated_0000.tree.json create mode 100644 lib/test/flow/types/declare_export_invalid/export_type/migrated_0001.js create mode 100644 lib/test/flow/types/declare_export_invalid/export_type/migrated_0001.tree.json create mode 100644 lib/test/flow/types/declare_export_invalid/export_type/migrated_0002.js create mode 100644 lib/test/flow/types/declare_export_invalid/export_type/migrated_0002.tree.json create mode 100644 lib/test/flow/types/declare_export_invalid/export_type/migrated_0003.js create mode 100644 lib/test/flow/types/declare_export_invalid/export_type/migrated_0003.tree.json create mode 100644 lib/test/flow/types/declare_export_invalid/export_type/migrated_0004.js create mode 100644 lib/test/flow/types/declare_export_invalid/export_type/migrated_0004.tree.json create mode 100644 lib/test/flow/types/declare_export_invalid/export_type/migrated_0005.js create mode 100644 lib/test/flow/types/declare_export_invalid/export_type/migrated_0005.tree.json create mode 100644 lib/test/flow/types/declare_export_invalid/export_type/migrated_0006.js create mode 100644 lib/test/flow/types/declare_export_invalid/export_type/migrated_0006.tree.json create mode 100644 lib/test/flow/types/declare_export_invalid/export_type/migrated_0007.js create mode 100644 lib/test/flow/types/declare_export_invalid/export_type/migrated_0007.tree.json create mode 100644 lib/test/flow/types/declare_export_invalid/export_type/migrated_0008.js create mode 100644 lib/test/flow/types/declare_export_invalid/export_type/migrated_0008.tree.json create mode 100644 lib/test/flow/types/declare_export_invalid/let_const/migrated_0009.js create mode 100644 lib/test/flow/types/declare_export_invalid/let_const/migrated_0009.tree.json create mode 100644 lib/test/flow/types/declare_export_invalid/let_const/migrated_0010.js create mode 100644 lib/test/flow/types/declare_export_invalid/let_const/migrated_0010.tree.json create mode 100644 lib/test/flow/types/declare_export_invalid/migrated_0012.js create mode 100644 lib/test/flow/types/declare_export_invalid/migrated_0012.tree.json create mode 100644 lib/test/flow/types/declare_export_invalid/migrated_0014.js create mode 100644 lib/test/flow/types/declare_export_invalid/migrated_0014.tree.json create mode 100644 lib/test/flow/types/declare_interface/migrated_0000.js create mode 100644 lib/test/flow/types/declare_interface/migrated_0000.tree.json create mode 100644 lib/test/flow/types/declare_interface/migrated_0001.js create mode 100644 lib/test/flow/types/declare_interface/migrated_0001.tree.json create mode 100644 lib/test/flow/types/declare_interface/migrated_0002.js create mode 100644 lib/test/flow/types/declare_interface/migrated_0002.tree.json create mode 100644 lib/test/flow/types/declare_interface/migrated_0003.js create mode 100644 lib/test/flow/types/declare_interface/migrated_0003.tree.json create mode 100644 lib/test/flow/types/declare_interface/migrated_0004.js create mode 100644 lib/test/flow/types/declare_interface/migrated_0004.tree.json create mode 100644 lib/test/flow/types/declare_interface/migrated_0005.js create mode 100644 lib/test/flow/types/declare_interface/migrated_0005.tree.json create mode 100644 lib/test/flow/types/declare_interface/migrated_0010.js create mode 100644 lib/test/flow/types/declare_interface/migrated_0010.tree.json create mode 100644 lib/test/flow/types/declare_interface/migrated_0011.js create mode 100644 lib/test/flow/types/declare_interface/migrated_0011.tree.json create mode 100644 lib/test/flow/types/declare_module/migrated_0000.js create mode 100644 lib/test/flow/types/declare_module/migrated_0000.tree.json create mode 100644 lib/test/flow/types/declare_module/migrated_0001.js create mode 100644 lib/test/flow/types/declare_module/migrated_0001.tree.json create mode 100644 lib/test/flow/types/declare_module/migrated_0002.js create mode 100644 lib/test/flow/types/declare_module/migrated_0002.tree.json create mode 100644 lib/test/flow/types/declare_module/migrated_0003.js create mode 100644 lib/test/flow/types/declare_module/migrated_0003.tree.json create mode 100644 lib/test/flow/types/declare_module_exports/migrated_0000.js create mode 100644 lib/test/flow/types/declare_module_exports/migrated_0000.tree.json create mode 100644 lib/test/flow/types/declare_module_exports/migrated_0001.js create mode 100644 lib/test/flow/types/declare_module_exports/migrated_0001.tree.json create mode 100644 lib/test/flow/types/declare_module_exports_invalid/migrated_0000.js create mode 100644 lib/test/flow/types/declare_module_exports_invalid/migrated_0000.tree.json create mode 100644 lib/test/flow/types/declare_module_exports_invalid/migrated_0001.js create mode 100644 lib/test/flow/types/declare_module_exports_invalid/migrated_0001.tree.json create mode 100644 lib/test/flow/types/declare_module_invalid/migrated_0000.js create mode 100644 lib/test/flow/types/declare_module_invalid/migrated_0000.tree.json create mode 100644 lib/test/flow/types/declare_module_invalid/migrated_0001.js create mode 100644 lib/test/flow/types/declare_module_invalid/migrated_0001.tree.json create mode 100644 lib/test/flow/types/declare_module_invalid/migrated_0002.js create mode 100644 lib/test/flow/types/declare_module_invalid/migrated_0002.tree.json create mode 100644 lib/test/flow/types/declare_module_invalid/migrated_0003.js create mode 100644 lib/test/flow/types/declare_module_invalid/migrated_0003.tree.json create mode 100644 lib/test/flow/types/declare_module_invalid/migrated_0004.js create mode 100644 lib/test/flow/types/declare_module_invalid/migrated_0004.tree.json create mode 100644 lib/test/flow/types/declare_module_invalid/migrated_0005.js create mode 100644 lib/test/flow/types/declare_module_invalid/migrated_0005.tree.json create mode 100644 lib/test/flow/types/declare_module_with_exports/export_type_with_parens.js create mode 100644 lib/test/flow/types/declare_module_with_exports/export_type_with_parens.tree.json create mode 100644 lib/test/flow/types/declare_module_with_exports/export_type_with_parens_no_semi.js create mode 100644 lib/test/flow/types/declare_module_with_exports/export_type_with_parens_no_semi.tree.json create mode 100644 lib/test/flow/types/declare_module_with_exports/migrated_0000.js create mode 100644 lib/test/flow/types/declare_module_with_exports/migrated_0000.tree.json create mode 100644 lib/test/flow/types/declare_module_with_exports/migrated_0001.js create mode 100644 lib/test/flow/types/declare_module_with_exports/migrated_0001.tree.json create mode 100644 lib/test/flow/types/declare_module_with_exports/migrated_0002.js create mode 100644 lib/test/flow/types/declare_module_with_exports/migrated_0002.tree.json create mode 100644 lib/test/flow/types/declare_module_with_exports/migrated_0003.js create mode 100644 lib/test/flow/types/declare_module_with_exports/migrated_0003.tree.json create mode 100644 lib/test/flow/types/declare_module_with_exports/migrated_0004.js create mode 100644 lib/test/flow/types/declare_module_with_exports/migrated_0004.tree.json create mode 100644 lib/test/flow/types/declare_module_with_exports/migrated_0005.js create mode 100644 lib/test/flow/types/declare_module_with_exports/migrated_0005.tree.json create mode 100644 lib/test/flow/types/declare_module_with_exports/migrated_0006.js create mode 100644 lib/test/flow/types/declare_module_with_exports/migrated_0006.tree.json create mode 100644 lib/test/flow/types/declare_module_with_exports/migrated_0007.js create mode 100644 lib/test/flow/types/declare_module_with_exports/migrated_0007.tree.json create mode 100644 lib/test/flow/types/declare_module_with_exports/migrated_0008.js create mode 100644 lib/test/flow/types/declare_module_with_exports/migrated_0008.tree.json create mode 100644 lib/test/flow/types/declare_module_with_exports/migrated_0009.js create mode 100644 lib/test/flow/types/declare_module_with_exports/migrated_0009.tree.json create mode 100644 lib/test/flow/types/declare_module_with_exports/migrated_0010.js create mode 100644 lib/test/flow/types/declare_module_with_exports/migrated_0010.tree.json create mode 100644 lib/test/flow/types/declare_module_with_exports/migrated_0011.js create mode 100644 lib/test/flow/types/declare_module_with_exports/migrated_0011.tree.json create mode 100644 lib/test/flow/types/declare_statements/declare_class_prop_named_static.js create mode 100644 lib/test/flow/types/declare_statements/declare_class_prop_named_static.tree.json create mode 100644 lib/test/flow/types/declare_statements/migrated_0000.js create mode 100644 lib/test/flow/types/declare_statements/migrated_0000.tree.json create mode 100644 lib/test/flow/types/declare_statements/migrated_0001.js create mode 100644 lib/test/flow/types/declare_statements/migrated_0001.tree.json create mode 100644 lib/test/flow/types/declare_statements/migrated_0002.js create mode 100644 lib/test/flow/types/declare_statements/migrated_0002.tree.json create mode 100644 lib/test/flow/types/declare_statements/migrated_0003.js create mode 100644 lib/test/flow/types/declare_statements/migrated_0003.tree.json create mode 100644 lib/test/flow/types/declare_statements/migrated_0004.js create mode 100644 lib/test/flow/types/declare_statements/migrated_0004.tree.json create mode 100644 lib/test/flow/types/declare_statements/migrated_0005.js create mode 100644 lib/test/flow/types/declare_statements/migrated_0005.tree.json create mode 100644 lib/test/flow/types/declare_statements/migrated_0006.js create mode 100644 lib/test/flow/types/declare_statements/migrated_0006.tree.json create mode 100644 lib/test/flow/types/declare_statements/migrated_0007.js create mode 100644 lib/test/flow/types/declare_statements/migrated_0007.tree.json create mode 100644 lib/test/flow/types/declare_statements/migrated_0008.js create mode 100644 lib/test/flow/types/declare_statements/migrated_0008.tree.json create mode 100644 lib/test/flow/types/declare_statements/migrated_0009.js create mode 100644 lib/test/flow/types/declare_statements/migrated_0009.tree.json create mode 100644 lib/test/flow/types/declare_statements/migrated_0010.js create mode 100644 lib/test/flow/types/declare_statements/migrated_0010.tree.json create mode 100644 lib/test/flow/types/declare_statements/migrated_0011.js create mode 100644 lib/test/flow/types/declare_statements/migrated_0011.tree.json create mode 100644 lib/test/flow/types/declare_statements/migrated_0012.js create mode 100644 lib/test/flow/types/declare_statements/migrated_0012.tree.json create mode 100644 lib/test/flow/types/declare_statements/migrated_0013.js create mode 100644 lib/test/flow/types/declare_statements/migrated_0013.tree.json create mode 100644 lib/test/flow/types/declare_statements_invalid/migrated_0000.js create mode 100644 lib/test/flow/types/declare_statements_invalid/migrated_0000.tree.json create mode 100644 lib/test/flow/types/declare_statements_invalid/migrated_0002.js create mode 100644 lib/test/flow/types/declare_statements_invalid/migrated_0002.tree.json create mode 100644 lib/test/flow/types/declare_type_alias/basic.js create mode 100644 lib/test/flow/types/declare_type_alias/basic.tree.json create mode 100644 lib/test/flow/types/exact_objects/migrated_0000.js create mode 100644 lib/test/flow/types/exact_objects/migrated_0000.tree.json create mode 100644 lib/test/flow/types/exact_objects/migrated_0001.js create mode 100644 lib/test/flow/types/exact_objects/migrated_0001.tree.json create mode 100644 lib/test/flow/types/function_predicates/migrated_0000.js create mode 100644 lib/test/flow/types/function_predicates/migrated_0000.tree.json create mode 100644 lib/test/flow/types/function_predicates/migrated_0001.js create mode 100644 lib/test/flow/types/function_predicates/migrated_0001.tree.json create mode 100644 lib/test/flow/types/function_predicates/migrated_0002.js create mode 100644 lib/test/flow/types/function_predicates/migrated_0002.tree.json create mode 100644 lib/test/flow/types/function_predicates/migrated_0003.js create mode 100644 lib/test/flow/types/function_predicates/migrated_0003.tree.json create mode 100644 lib/test/flow/types/function_predicates/migrated_0004.js create mode 100644 lib/test/flow/types/function_predicates/migrated_0004.tree.json create mode 100644 lib/test/flow/types/function_predicates/migrated_0005.js create mode 100644 lib/test/flow/types/function_predicates/migrated_0005.tree.json create mode 100644 lib/test/flow/types/function_predicates/migrated_0006.js create mode 100644 lib/test/flow/types/function_predicates/migrated_0006.tree.json create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/inside_generics.js create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/inside_generics.tree.json create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/inside_generics_inside_return.js create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/inside_generics_inside_return.tree.json create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/invalid_some_named_some_anonymous.js create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/invalid_some_named_some_anonymous.tree.json create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0000.js create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0000.tree.json create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0001.js create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0001.tree.json create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0002.js create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0002.tree.json create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0003.js create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0003.tree.json create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0004.js create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0004.tree.json create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0005.js create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0005.tree.json create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0006.js create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0006.tree.json create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0007.js create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0007.tree.json create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0008.js create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0008.tree.json create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0009.js create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0009.tree.json create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0010.js create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0010.tree.json create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0011.js create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0011.tree.json create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0012.js create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0012.tree.json create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0013.js create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0013.tree.json create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0014.js create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0014.tree.json create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0015.js create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0015.tree.json create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0016.js create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0016.tree.json create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0017.js create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0017.tree.json create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0018.js create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0018.tree.json create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0019.js create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0019.tree.json create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0020.js create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0020.tree.json create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0021.js create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0021.tree.json create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0022.js create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0022.tree.json create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0023.js create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0023.tree.json create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0024.js create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0024.tree.json create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0025.js create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0025.tree.json create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0026.js create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0026.tree.json create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0027.js create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0027.tree.json create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/some_named_some_anonymous.js create mode 100644 lib/test/flow/types/function_types_with_anonymous_parameters/some_named_some_anonymous.tree.json create mode 100644 lib/test/flow/types/grouping/function.js create mode 100644 lib/test/flow/types/grouping/function.tree.json create mode 100644 lib/test/flow/types/grouping/function_param.js create mode 100644 lib/test/flow/types/grouping/function_param.tree.json create mode 100644 lib/test/flow/types/grouping/intersection.js create mode 100644 lib/test/flow/types/grouping/intersection.tree.json create mode 100644 lib/test/flow/types/grouping/intersection_of_union.js create mode 100644 lib/test/flow/types/grouping/intersection_of_union.tree.json create mode 100644 lib/test/flow/types/grouping/method.js create mode 100644 lib/test/flow/types/grouping/method.tree.json create mode 100644 lib/test/flow/types/grouping/migrated_0000.js create mode 100644 lib/test/flow/types/grouping/migrated_0000.tree.json create mode 100644 lib/test/flow/types/grouping/migrated_0001.js create mode 100644 lib/test/flow/types/grouping/migrated_0001.tree.json create mode 100644 lib/test/flow/types/grouping/migrated_0003.js create mode 100644 lib/test/flow/types/grouping/migrated_0003.tree.json create mode 100644 lib/test/flow/types/grouping/migrated_0004.js create mode 100644 lib/test/flow/types/grouping/migrated_0004.tree.json create mode 100644 lib/test/flow/types/grouping/migrated_0005.js create mode 100644 lib/test/flow/types/grouping/migrated_0005.tree.json create mode 100644 lib/test/flow/types/grouping/migrated_0006.js create mode 100644 lib/test/flow/types/grouping/migrated_0006.tree.json create mode 100644 lib/test/flow/types/grouping/nullable.js create mode 100644 lib/test/flow/types/grouping/nullable.tree.json create mode 100644 lib/test/flow/types/grouping/object_type_call_property.js create mode 100644 lib/test/flow/types/grouping/object_type_call_property.tree.json create mode 100644 lib/test/flow/types/grouping/object_type_indexer.js create mode 100644 lib/test/flow/types/grouping/object_type_indexer.tree.json create mode 100644 lib/test/flow/types/grouping/object_type_property.js create mode 100644 lib/test/flow/types/grouping/object_type_property.tree.json create mode 100644 lib/test/flow/types/grouping/object_type_spread_property.js create mode 100644 lib/test/flow/types/grouping/object_type_spread_property.tree.json create mode 100644 lib/test/flow/types/grouping/typeof.js create mode 100644 lib/test/flow/types/grouping/typeof.tree.json create mode 100644 lib/test/flow/types/grouping/union.js create mode 100644 lib/test/flow/types/grouping/union.tree.json create mode 100644 lib/test/flow/types/grouping_invalid/migrated_0000.js create mode 100644 lib/test/flow/types/grouping_invalid/migrated_0000.tree.json create mode 100644 lib/test/flow/types/import_type_shorthand/migrated_0000.js create mode 100644 lib/test/flow/types/import_type_shorthand/migrated_0000.tree.json create mode 100644 lib/test/flow/types/import_type_shorthand/migrated_0001.js create mode 100644 lib/test/flow/types/import_type_shorthand/migrated_0001.tree.json create mode 100644 lib/test/flow/types/import_type_shorthand/migrated_0002.js create mode 100644 lib/test/flow/types/import_type_shorthand/migrated_0002.tree.json create mode 100644 lib/test/flow/types/import_type_shorthand/migrated_0003.js create mode 100644 lib/test/flow/types/import_type_shorthand/migrated_0003.tree.json create mode 100644 lib/test/flow/types/import_type_shorthand/migrated_0004.js create mode 100644 lib/test/flow/types/import_type_shorthand/migrated_0004.tree.json create mode 100644 lib/test/flow/types/import_type_shorthand/migrated_0005.js create mode 100644 lib/test/flow/types/import_type_shorthand/migrated_0005.tree.json create mode 100644 lib/test/flow/types/import_type_shorthand/migrated_0006.js create mode 100644 lib/test/flow/types/import_type_shorthand/migrated_0006.tree.json create mode 100644 lib/test/flow/types/import_type_shorthand/migrated_0007.js create mode 100644 lib/test/flow/types/import_type_shorthand/migrated_0007.tree.json create mode 100644 lib/test/flow/types/import_type_shorthand/migrated_0008.js create mode 100644 lib/test/flow/types/import_type_shorthand/migrated_0008.tree.json create mode 100644 lib/test/flow/types/import_type_shorthand/migrated_0009.js create mode 100644 lib/test/flow/types/import_type_shorthand/migrated_0009.tree.json create mode 100644 lib/test/flow/types/import_type_shorthand/reserved_type.js create mode 100644 lib/test/flow/types/import_type_shorthand/reserved_type.tree.json create mode 100644 lib/test/flow/types/import_type_shorthand/type_as_as.js create mode 100644 lib/test/flow/types/import_type_shorthand/type_as_as.tree.json create mode 100644 lib/test/flow/types/import_type_shorthand/typeof_in_typeof.js create mode 100644 lib/test/flow/types/import_type_shorthand/typeof_in_typeof.tree.json create mode 100644 lib/test/flow/types/import_type_shorthand/typeof_in_typeof_reserved_type.js create mode 100644 lib/test/flow/types/import_type_shorthand/typeof_in_typeof_reserved_type.tree.json create mode 100644 lib/test/flow/types/import_type_shorthand/typeof_in_typeof_reserved_value.js create mode 100644 lib/test/flow/types/import_type_shorthand/typeof_in_typeof_reserved_value.tree.json create mode 100644 lib/test/flow/types/import_type_shorthand/typeof_reserved_type.js create mode 100644 lib/test/flow/types/import_type_shorthand/typeof_reserved_type.tree.json create mode 100644 lib/test/flow/types/import_type_shorthand/typeof_reserved_value.js create mode 100644 lib/test/flow/types/import_type_shorthand/typeof_reserved_value.tree.json create mode 100644 lib/test/flow/types/import_types/default_reserved_type.js create mode 100644 lib/test/flow/types/import_types/default_reserved_type.tree.json create mode 100644 lib/test/flow/types/import_types/default_reserved_value.js create mode 100644 lib/test/flow/types/import_types/default_reserved_value.tree.json create mode 100644 lib/test/flow/types/import_types/migrated_0000.js create mode 100644 lib/test/flow/types/import_types/migrated_0000.tree.json create mode 100644 lib/test/flow/types/import_types/named_reserved_type.js create mode 100644 lib/test/flow/types/import_types/named_reserved_type.tree.json create mode 100644 lib/test/flow/types/import_types/named_reserved_value.js create mode 100644 lib/test/flow/types/import_types/named_reserved_value.tree.json create mode 100644 lib/test/flow/types/import_types/namespace.js create mode 100644 lib/test/flow/types/import_types/namespace.tree.json create mode 100644 lib/test/flow/types/import_types/namespace_reserved_type.js create mode 100644 lib/test/flow/types/import_types/namespace_reserved_type.tree.json create mode 100644 lib/test/flow/types/import_types/namespace_reserved_value.js create mode 100644 lib/test/flow/types/import_types/namespace_reserved_value.tree.json create mode 100644 lib/test/flow/types/import_types/typeof_default_reserved_type.js create mode 100644 lib/test/flow/types/import_types/typeof_default_reserved_type.tree.json create mode 100644 lib/test/flow/types/import_types/typeof_named_reserved_type.js create mode 100644 lib/test/flow/types/import_types/typeof_named_reserved_type.tree.json create mode 100644 lib/test/flow/types/import_types/typeof_named_reserved_type_alias.js create mode 100644 lib/test/flow/types/import_types/typeof_named_reserved_type_alias.tree.json create mode 100644 lib/test/flow/types/import_types/typeof_namespace_reserved_type.js create mode 100644 lib/test/flow/types/import_types/typeof_namespace_reserved_type.tree.json create mode 100644 lib/test/flow/types/instance_spread_invalid/migrated_0000.js create mode 100644 lib/test/flow/types/instance_spread_invalid/migrated_0000.tree.json create mode 100644 lib/test/flow/types/instance_spread_invalid/migrated_0001.js create mode 100644 lib/test/flow/types/instance_spread_invalid/migrated_0001.tree.json create mode 100644 lib/test/flow/types/interfaces/implements_reserved_type.js create mode 100644 lib/test/flow/types/interfaces/implements_reserved_type.tree.json create mode 100644 lib/test/flow/types/interfaces/implements_reserved_value.js create mode 100644 lib/test/flow/types/interfaces/implements_reserved_value.tree.json create mode 100644 lib/test/flow/types/interfaces/inline.js create mode 100644 lib/test/flow/types/interfaces/inline.tree.json create mode 100644 lib/test/flow/types/interfaces/migrated_0000.js create mode 100644 lib/test/flow/types/interfaces/migrated_0000.tree.json create mode 100644 lib/test/flow/types/interfaces/migrated_0001.js create mode 100644 lib/test/flow/types/interfaces/migrated_0001.tree.json create mode 100644 lib/test/flow/types/interfaces/migrated_0002.js create mode 100644 lib/test/flow/types/interfaces/migrated_0002.tree.json create mode 100644 lib/test/flow/types/interfaces/migrated_0003.js create mode 100644 lib/test/flow/types/interfaces/migrated_0003.tree.json create mode 100644 lib/test/flow/types/interfaces/migrated_0004.js create mode 100644 lib/test/flow/types/interfaces/migrated_0004.tree.json create mode 100644 lib/test/flow/types/interfaces/migrated_0005.js create mode 100644 lib/test/flow/types/interfaces/migrated_0005.tree.json create mode 100644 lib/test/flow/types/interfaces/migrated_0006.js create mode 100644 lib/test/flow/types/interfaces/migrated_0006.tree.json create mode 100644 lib/test/flow/types/interfaces/migrated_0007.js create mode 100644 lib/test/flow/types/interfaces/migrated_0007.tree.json create mode 100644 lib/test/flow/types/interfaces/migrated_0008.js create mode 100644 lib/test/flow/types/interfaces/migrated_0008.tree.json create mode 100644 lib/test/flow/types/interfaces/migrated_0009.js create mode 100644 lib/test/flow/types/interfaces/migrated_0009.tree.json create mode 100644 lib/test/flow/types/interfaces/migrated_0010.js create mode 100644 lib/test/flow/types/interfaces/migrated_0010.tree.json create mode 100644 lib/test/flow/types/interfaces/migrated_0011.js create mode 100644 lib/test/flow/types/interfaces/migrated_0011.tree.json create mode 100644 lib/test/flow/types/interfaces/prop_named_static.js create mode 100644 lib/test/flow/types/interfaces/prop_named_static.tree.json create mode 100644 lib/test/flow/types/interfaces/reserved_type.js create mode 100644 lib/test/flow/types/interfaces/reserved_type.tree.json create mode 100644 lib/test/flow/types/interfaces/reserved_value.js create mode 100644 lib/test/flow/types/interfaces/reserved_value.tree.json create mode 100644 lib/test/flow/types/invalid_keywords/migrated_0000.js create mode 100644 lib/test/flow/types/invalid_keywords/migrated_0000.tree.json create mode 100644 lib/test/flow/types/invalid_keywords/migrated_0001.js create mode 100644 lib/test/flow/types/invalid_keywords/migrated_0001.tree.json create mode 100644 lib/test/flow/types/keyword_variable_collision/arguments.js create mode 100644 lib/test/flow/types/keyword_variable_collision/arguments.tree.json create mode 100644 lib/test/flow/types/keyword_variable_collision/arguments_strict.js create mode 100644 lib/test/flow/types/keyword_variable_collision/arguments_strict.tree.json create mode 100644 lib/test/flow/types/keyword_variable_collision/eval.js create mode 100644 lib/test/flow/types/keyword_variable_collision/eval.tree.json create mode 100644 lib/test/flow/types/keyword_variable_collision/eval_strict.js create mode 100644 lib/test/flow/types/keyword_variable_collision/eval_strict.tree.json create mode 100644 lib/test/flow/types/keyword_variable_collision/opaque_collision.js create mode 100644 lib/test/flow/types/keyword_variable_collision/opaque_collision.tree.json create mode 100644 lib/test/flow/types/keyword_variable_collision/opaque_in_exp.js create mode 100644 lib/test/flow/types/keyword_variable_collision/opaque_in_exp.tree.json create mode 100644 lib/test/flow/types/keyword_variable_collision/opaque_in_func.js create mode 100644 lib/test/flow/types/keyword_variable_collision/opaque_in_func.tree.json create mode 100644 lib/test/flow/types/member/migrated_0000.js create mode 100644 lib/test/flow/types/member/migrated_0000.tree.json create mode 100644 lib/test/flow/types/member/migrated_0001.js create mode 100644 lib/test/flow/types/member/migrated_0001.tree.json create mode 100644 lib/test/flow/types/member/migrated_0002.js create mode 100644 lib/test/flow/types/member/migrated_0002.tree.json create mode 100644 lib/test/flow/types/member/migrated_0003.js create mode 100644 lib/test/flow/types/member/migrated_0003.tree.json create mode 100644 lib/test/flow/types/member/reserved_words.js create mode 100644 lib/test/flow/types/member/reserved_words.tree.json create mode 100644 lib/test/flow/types/number_literal/migrated_0000.js create mode 100644 lib/test/flow/types/number_literal/migrated_0000.tree.json create mode 100644 lib/test/flow/types/number_literal/migrated_0001.js create mode 100644 lib/test/flow/types/number_literal/migrated_0001.tree.json create mode 100644 lib/test/flow/types/number_literal/migrated_0002.js create mode 100644 lib/test/flow/types/number_literal/migrated_0002.tree.json create mode 100644 lib/test/flow/types/number_literal/migrated_0003.js create mode 100644 lib/test/flow/types/number_literal/migrated_0003.tree.json create mode 100644 lib/test/flow/types/number_literal/migrated_0004.js create mode 100644 lib/test/flow/types/number_literal/migrated_0004.tree.json create mode 100644 lib/test/flow/types/number_literal/migrated_0005.js create mode 100644 lib/test/flow/types/number_literal/migrated_0005.tree.json create mode 100644 lib/test/flow/types/number_literal/migrated_0006.js create mode 100644 lib/test/flow/types/number_literal/migrated_0006.tree.json create mode 100644 lib/test/flow/types/number_literal/migrated_0007.js create mode 100644 lib/test/flow/types/number_literal/migrated_0007.tree.json create mode 100644 lib/test/flow/types/number_literal/migrated_0008.js create mode 100644 lib/test/flow/types/number_literal/migrated_0008.tree.json create mode 100644 lib/test/flow/types/number_literal/migrated_0009.js create mode 100644 lib/test/flow/types/number_literal/migrated_0009.tree.json create mode 100644 lib/test/flow/types/number_literal/migrated_0010.js create mode 100644 lib/test/flow/types/number_literal/migrated_0010.tree.json create mode 100644 lib/test/flow/types/number_literal_invalid/migrated_0000.js create mode 100644 lib/test/flow/types/number_literal_invalid/migrated_0000.tree.json create mode 100644 lib/test/flow/types/number_literal_invalid/migrated_0001.js create mode 100644 lib/test/flow/types/number_literal_invalid/migrated_0001.tree.json create mode 100644 lib/test/flow/types/object/indexers/reserved_type_indexer_name.js create mode 100644 lib/test/flow/types/object/indexers/reserved_type_indexer_name.tree.json create mode 100644 lib/test/flow/types/object/indexers/reserved_word_indexer_name.js create mode 100644 lib/test/flow/types/object/indexers/reserved_word_indexer_name.tree.json create mode 100644 lib/test/flow/types/object/methods/generic_method.js create mode 100644 lib/test/flow/types/object/methods/generic_method.tree.json create mode 100644 lib/test/flow/types/object/methods/method.js create mode 100644 lib/test/flow/types/object/methods/method.tree.json create mode 100644 lib/test/flow/types/object/unexpected_proto.js create mode 100644 lib/test/flow/types/object/unexpected_proto.tree.json create mode 100644 lib/test/flow/types/object/unexpected_static.js create mode 100644 lib/test/flow/types/object/unexpected_static.tree.json create mode 100644 lib/test/flow/types/object_type_property_variance/migrated_0000.js create mode 100644 lib/test/flow/types/object_type_property_variance/migrated_0000.tree.json create mode 100644 lib/test/flow/types/object_type_property_variance/migrated_0001.js create mode 100644 lib/test/flow/types/object_type_property_variance/migrated_0001.tree.json create mode 100644 lib/test/flow/types/object_type_property_variance/migrated_0002.js create mode 100644 lib/test/flow/types/object_type_property_variance/migrated_0002.tree.json create mode 100644 lib/test/flow/types/object_type_property_variance/migrated_0003.js create mode 100644 lib/test/flow/types/object_type_property_variance/migrated_0003.tree.json create mode 100644 lib/test/flow/types/object_type_property_variance/migrated_0004.js create mode 100644 lib/test/flow/types/object_type_property_variance/migrated_0004.tree.json create mode 100644 lib/test/flow/types/object_type_property_variance/migrated_0005.js create mode 100644 lib/test/flow/types/object_type_property_variance/migrated_0005.tree.json create mode 100644 lib/test/flow/types/object_type_property_variance/migrated_0006.js create mode 100644 lib/test/flow/types/object_type_property_variance/migrated_0006.tree.json create mode 100644 lib/test/flow/types/object_type_property_variance/migrated_0007.js create mode 100644 lib/test/flow/types/object_type_property_variance/migrated_0007.tree.json create mode 100644 lib/test/flow/types/object_type_property_variance/migrated_0008.js create mode 100644 lib/test/flow/types/object_type_property_variance/migrated_0008.tree.json create mode 100644 lib/test/flow/types/object_type_property_variance/migrated_0009.js create mode 100644 lib/test/flow/types/object_type_property_variance/migrated_0009.tree.json create mode 100644 lib/test/flow/types/object_type_property_variance/migrated_0010.js create mode 100644 lib/test/flow/types/object_type_property_variance/migrated_0010.tree.json create mode 100644 lib/test/flow/types/object_type_property_variance/migrated_0011.js create mode 100644 lib/test/flow/types/object_type_property_variance/migrated_0011.tree.json create mode 100644 lib/test/flow/types/object_type_spread/migrated_0000.js create mode 100644 lib/test/flow/types/object_type_spread/migrated_0000.tree.json create mode 100644 lib/test/flow/types/object_type_spread/migrated_0001.js create mode 100644 lib/test/flow/types/object_type_spread/migrated_0001.tree.json create mode 100644 lib/test/flow/types/object_type_spread/migrated_0002.js create mode 100644 lib/test/flow/types/object_type_spread/migrated_0002.tree.json create mode 100644 lib/test/flow/types/object_type_spread/migrated_0003.js create mode 100644 lib/test/flow/types/object_type_spread/migrated_0003.tree.json create mode 100644 lib/test/flow/types/object_type_spread/migrated_0004.js create mode 100644 lib/test/flow/types/object_type_spread/migrated_0004.tree.json create mode 100644 lib/test/flow/types/object_type_spread/migrated_0005.js create mode 100644 lib/test/flow/types/object_type_spread/migrated_0005.tree.json create mode 100644 lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_init_eol.js create mode 100644 lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_init_eol.tree.json create mode 100644 lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_neither.js create mode 100644 lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_neither.tree.json create mode 100644 lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_st_no_t.js create mode 100644 lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_st_no_t.tree.json create mode 100644 lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_t_and_st.js create mode 100644 lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_t_and_st.tree.json create mode 100644 lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_t_no_st.js create mode 100644 lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_t_no_st.tree.json create mode 100644 lib/test/flow/types/opaque_aliases/declare/opaque_declare_neither.js create mode 100644 lib/test/flow/types/opaque_aliases/declare/opaque_declare_neither.tree.json create mode 100644 lib/test/flow/types/opaque_aliases/declare/opaque_declare_st_no_t.js create mode 100644 lib/test/flow/types/opaque_aliases/declare/opaque_declare_st_no_t.tree.json create mode 100644 lib/test/flow/types/opaque_aliases/declare/opaque_declare_t_and_st.js create mode 100644 lib/test/flow/types/opaque_aliases/declare/opaque_declare_t_and_st.tree.json create mode 100644 lib/test/flow/types/opaque_aliases/declare/opaque_declare_t_no_st.js create mode 100644 lib/test/flow/types/opaque_aliases/declare/opaque_declare_t_no_st.tree.json create mode 100644 lib/test/flow/types/opaque_aliases/invalid/opaque_invalid1.js create mode 100644 lib/test/flow/types/opaque_aliases/invalid/opaque_invalid1.tree.json create mode 100644 lib/test/flow/types/opaque_aliases/invalid/opaque_invalid2.js create mode 100644 lib/test/flow/types/opaque_aliases/invalid/opaque_invalid2.tree.json create mode 100644 lib/test/flow/types/opaque_aliases/invalid/opaque_subtype_allow_export.js create mode 100644 lib/test/flow/types/opaque_aliases/invalid/opaque_subtype_allow_export.tree.json create mode 100644 lib/test/flow/types/opaque_aliases/invalid/opaque_subtype_invalid1.js create mode 100644 lib/test/flow/types/opaque_aliases/invalid/opaque_subtype_invalid1.tree.json create mode 100644 lib/test/flow/types/opaque_aliases/invalid/opaque_subtype_invalid2.js create mode 100644 lib/test/flow/types/opaque_aliases/invalid/opaque_subtype_invalid2.tree.json create mode 100644 lib/test/flow/types/opaque_aliases/invalid/opaque_subtype_invalid3.js create mode 100644 lib/test/flow/types/opaque_aliases/invalid/opaque_subtype_invalid3.tree.json create mode 100644 lib/test/flow/types/opaque_aliases/invalid/opaque_type_allow_export.js create mode 100644 lib/test/flow/types/opaque_aliases/invalid/opaque_type_allow_export.tree.json create mode 100644 lib/test/flow/types/opaque_aliases/invalid/reserved_type.js create mode 100644 lib/test/flow/types/opaque_aliases/invalid/reserved_type.tree.json create mode 100644 lib/test/flow/types/opaque_aliases/valid/declare_opaque.js create mode 100644 lib/test/flow/types/opaque_aliases/valid/declare_opaque.tree.json create mode 100644 lib/test/flow/types/opaque_aliases/valid/opaque_subtype.js create mode 100644 lib/test/flow/types/opaque_aliases/valid/opaque_subtype.tree.json create mode 100644 lib/test/flow/types/opaque_aliases/valid/opaque_subtype_export.js create mode 100644 lib/test/flow/types/opaque_aliases/valid/opaque_subtype_export.tree.json create mode 100644 lib/test/flow/types/opaque_aliases/valid/opaque_type.js create mode 100644 lib/test/flow/types/opaque_aliases/valid/opaque_type.tree.json create mode 100644 lib/test/flow/types/opaque_aliases/valid/opaque_type_export.js create mode 100644 lib/test/flow/types/opaque_aliases/valid/opaque_type_export.tree.json create mode 100644 lib/test/flow/types/opaque_aliases/valid/reserved_value.js create mode 100644 lib/test/flow/types/opaque_aliases/valid/reserved_value.tree.json create mode 100644 lib/test/flow/types/optional_indexer_name/migrated_0000.js create mode 100644 lib/test/flow/types/optional_indexer_name/migrated_0000.tree.json create mode 100644 lib/test/flow/types/optional_indexer_name/migrated_0001.js create mode 100644 lib/test/flow/types/optional_indexer_name/migrated_0001.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0000.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0000.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0001.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0001.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0002.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0002.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0003.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0003.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0004.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0004.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0005.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0005.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0006.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0006.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0007.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0007.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0008.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0008.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0009.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0009.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0010.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0010.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0011.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0011.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0012.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0012.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0013.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0013.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0014.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0014.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0015.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0015.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0016.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0016.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0017.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0017.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0018.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0018.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0019.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0019.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0020.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0020.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0021.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0021.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0022.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0022.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0023.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0023.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0024.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0024.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0025.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0025.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0026.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0026.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0027.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0027.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0028.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0028.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0029.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0029.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0030.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0030.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0031.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0031.tree.json create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0032.js create mode 100644 lib/test/flow/types/parameter_defaults/migrated_0032.tree.json create mode 100644 lib/test/flow/types/reserved/reserved.js create mode 100644 lib/test/flow/types/reserved/reserved.tree.json create mode 100644 lib/test/flow/types/string_literal/migrated_0000.js create mode 100644 lib/test/flow/types/string_literal/migrated_0000.tree.json create mode 100644 lib/test/flow/types/string_literal/migrated_0001.js create mode 100644 lib/test/flow/types/string_literal/migrated_0001.tree.json create mode 100644 lib/test/flow/types/string_literal/migrated_0002.js create mode 100644 lib/test/flow/types/string_literal/migrated_0002.tree.json create mode 100644 lib/test/flow/types/string_literal_invalid/migrated_0000.js create mode 100644 lib/test/flow/types/string_literal_invalid/migrated_0000.tree.json create mode 100644 lib/test/flow/types/this_constraints/declare_class_getter.js create mode 100644 lib/test/flow/types/this_constraints/declare_class_getter.tree.json create mode 100644 lib/test/flow/types/this_constraints/declare_class_method_0.js create mode 100644 lib/test/flow/types/this_constraints/declare_class_method_0.tree.json create mode 100644 lib/test/flow/types/this_constraints/declare_class_method_1.js create mode 100644 lib/test/flow/types/this_constraints/declare_class_method_1.tree.json create mode 100644 lib/test/flow/types/this_constraints/declare_class_method_2.js create mode 100644 lib/test/flow/types/this_constraints/declare_class_method_2.tree.json create mode 100644 lib/test/flow/types/this_constraints/declare_class_setter.js create mode 100644 lib/test/flow/types/this_constraints/declare_class_setter.tree.json create mode 100644 lib/test/flow/types/this_constraints/declare_function_0.js create mode 100644 lib/test/flow/types/this_constraints/declare_function_0.tree.json create mode 100644 lib/test/flow/types/this_constraints/declare_function_1.js create mode 100644 lib/test/flow/types/this_constraints/declare_function_1.tree.json create mode 100644 lib/test/flow/types/this_constraints/declare_function_2.js create mode 100644 lib/test/flow/types/this_constraints/declare_function_2.tree.json create mode 100644 lib/test/flow/types/this_constraints/error_not_first.js create mode 100644 lib/test/flow/types/this_constraints/error_not_first.tree.json create mode 100644 lib/test/flow/types/this_constraints/error_optional.js create mode 100644 lib/test/flow/types/this_constraints/error_optional.tree.json create mode 100644 lib/test/flow/types/this_constraints/error_repeated.js create mode 100644 lib/test/flow/types/this_constraints/error_repeated.tree.json create mode 100644 lib/test/flow/types/this_constraints/function_type_0.js create mode 100644 lib/test/flow/types/this_constraints/function_type_0.tree.json create mode 100644 lib/test/flow/types/this_constraints/function_type_1.js create mode 100644 lib/test/flow/types/this_constraints/function_type_1.tree.json create mode 100644 lib/test/flow/types/this_constraints/function_type_2.js create mode 100644 lib/test/flow/types/this_constraints/function_type_2.tree.json create mode 100644 lib/test/flow/types/this_constraints/no_ambiguity_with_anonymous_this_0.js create mode 100644 lib/test/flow/types/this_constraints/no_ambiguity_with_anonymous_this_0.tree.json create mode 100644 lib/test/flow/types/this_constraints/no_ambiguity_with_anonymous_this_1.js create mode 100644 lib/test/flow/types/this_constraints/no_ambiguity_with_anonymous_this_1.tree.json create mode 100644 lib/test/flow/types/this_constraints/object_type_method_0.js create mode 100644 lib/test/flow/types/this_constraints/object_type_method_0.tree.json create mode 100644 lib/test/flow/types/this_constraints/object_type_method_1.js create mode 100644 lib/test/flow/types/this_constraints/object_type_method_1.tree.json create mode 100644 lib/test/flow/types/this_constraints/object_type_method_2.js create mode 100644 lib/test/flow/types/this_constraints/object_type_method_2.tree.json create mode 100644 lib/test/flow/types/tuples/migrated_0000.js create mode 100644 lib/test/flow/types/tuples/migrated_0000.tree.json create mode 100644 lib/test/flow/types/tuples/migrated_0001.js create mode 100644 lib/test/flow/types/tuples/migrated_0001.tree.json create mode 100644 lib/test/flow/types/tuples/migrated_0002.js create mode 100644 lib/test/flow/types/tuples/migrated_0002.tree.json create mode 100644 lib/test/flow/types/tuples/migrated_0003.js create mode 100644 lib/test/flow/types/tuples/migrated_0003.tree.json create mode 100644 lib/test/flow/types/typecasts/migrated_0000.js create mode 100644 lib/test/flow/types/typecasts/migrated_0000.tree.json create mode 100644 lib/test/flow/types/typecasts/migrated_0001.js create mode 100644 lib/test/flow/types/typecasts/migrated_0001.tree.json create mode 100644 lib/test/flow/types/typecasts/migrated_0002.js create mode 100644 lib/test/flow/types/typecasts/migrated_0002.tree.json create mode 100644 lib/test/flow/types/typecasts/migrated_0003.js create mode 100644 lib/test/flow/types/typecasts/migrated_0003.tree.json create mode 100644 lib/test/flow/types/typecasts_invalid/migrated_0000.js create mode 100644 lib/test/flow/types/typecasts_invalid/migrated_0000.tree.json create mode 100644 lib/test/flow/types/typecasts_invalid/migrated_0001.js create mode 100644 lib/test/flow/types/typecasts_invalid/migrated_0001.tree.json create mode 100644 lib/test/flow/uninitialized_const_bindings/migrated_0000.js create mode 100644 lib/test/flow/uninitialized_const_bindings/migrated_0000.tree.json create mode 100644 lib/test/flow/uninitialized_const_bindings/migrated_0001.js create mode 100644 lib/test/flow/uninitialized_const_bindings/migrated_0001.tree.json create mode 100644 lib/test/flow/uninitialized_const_bindings_invalid/migrated_0000.js create mode 100644 lib/test/flow/uninitialized_const_bindings_invalid/migrated_0000.tree.json create mode 100644 lib/test/flow/uninitialized_destructured_bindings/migrated_0000.js create mode 100644 lib/test/flow/uninitialized_destructured_bindings/migrated_0000.tree.json create mode 100644 lib/test/flow/uninitialized_destructured_bindings/migrated_0001.js create mode 100644 lib/test/flow/uninitialized_destructured_bindings/migrated_0001.tree.json create mode 100644 lib/test/flow/uninitialized_destructured_bindings/migrated_0002.js create mode 100644 lib/test/flow/uninitialized_destructured_bindings/migrated_0002.tree.json create mode 100644 lib/test/flow/uninitialized_destructured_bindings/migrated_0003.js create mode 100644 lib/test/flow/uninitialized_destructured_bindings/migrated_0003.tree.json create mode 100644 lib/test/flow/uninitialized_destructured_bindings/migrated_0004.js create mode 100644 lib/test/flow/uninitialized_destructured_bindings/migrated_0004.tree.json create mode 100644 lib/test/flow/uninitialized_destructured_bindings/migrated_0005.js create mode 100644 lib/test/flow/uninitialized_destructured_bindings/migrated_0005.tree.json create mode 100644 lib/test/flow/uninitialized_destructured_bindings/migrated_0006.js create mode 100644 lib/test/flow/uninitialized_destructured_bindings/migrated_0006.tree.json create mode 100644 lib/test/flow/uninitialized_destructured_bindings/migrated_0007.js create mode 100644 lib/test/flow/uninitialized_destructured_bindings/migrated_0007.tree.json create mode 100644 lib/test/flow/uninitialized_destructured_bindings/migrated_0008.js create mode 100644 lib/test/flow/uninitialized_destructured_bindings/migrated_0008.tree.json create mode 100644 lib/test/flow/uninitialized_destructured_bindings_invalid/migrated_0000.js create mode 100644 lib/test/flow/uninitialized_destructured_bindings_invalid/migrated_0000.tree.json create mode 100644 lib/test/flow/uninitialized_destructured_bindings_invalid/migrated_0001.js create mode 100644 lib/test/flow/uninitialized_destructured_bindings_invalid/migrated_0001.tree.json create mode 100644 lib/test/flow/uninitialized_destructured_bindings_invalid/migrated_0002.js create mode 100644 lib/test/flow/uninitialized_destructured_bindings_invalid/migrated_0002.tree.json create mode 100644 lib/test/test262_baseline.txt delete mode 100644 lib/yarn.lock delete mode 100644 ppx_tools_versioned.5.2/.depend delete mode 100644 ppx_tools_versioned.5.2/.ocp-indent delete mode 100644 ppx_tools_versioned.5.2/.travis.yml delete mode 100644 ppx_tools_versioned.5.2/LICENSE delete mode 100644 ppx_tools_versioned.5.2/Makefile delete mode 100644 ppx_tools_versioned.5.2/README.md delete mode 100644 ppx_tools_versioned.5.2/ast_convenience_402.ml delete mode 100644 ppx_tools_versioned.5.2/ast_convenience_402.mli delete mode 100644 ppx_tools_versioned.5.2/ast_convenience_403.ml delete mode 100644 ppx_tools_versioned.5.2/ast_convenience_403.mli delete mode 100644 ppx_tools_versioned.5.2/ast_convenience_404.ml delete mode 100644 ppx_tools_versioned.5.2/ast_convenience_404.mli delete mode 100644 ppx_tools_versioned.5.2/ast_convenience_405.ml delete mode 100644 ppx_tools_versioned.5.2/ast_convenience_405.mli delete mode 100644 ppx_tools_versioned.5.2/ast_convenience_406.ml delete mode 100644 ppx_tools_versioned.5.2/ast_convenience_406.mli delete mode 100644 ppx_tools_versioned.5.2/ast_lifter_402.ml delete mode 100644 ppx_tools_versioned.5.2/ast_lifter_403.ml delete mode 100644 ppx_tools_versioned.5.2/ast_lifter_404.ml delete mode 100644 ppx_tools_versioned.5.2/ast_lifter_405.ml delete mode 100644 ppx_tools_versioned.5.2/ast_lifter_406.ml delete mode 100644 ppx_tools_versioned.5.2/ast_mapper_class_402.ml delete mode 100644 ppx_tools_versioned.5.2/ast_mapper_class_402.mli delete mode 100644 ppx_tools_versioned.5.2/ast_mapper_class_403.ml delete mode 100644 ppx_tools_versioned.5.2/ast_mapper_class_403.mli delete mode 100644 ppx_tools_versioned.5.2/ast_mapper_class_404.ml delete mode 100644 ppx_tools_versioned.5.2/ast_mapper_class_404.mli delete mode 100644 ppx_tools_versioned.5.2/ast_mapper_class_405.ml delete mode 100644 ppx_tools_versioned.5.2/ast_mapper_class_405.mli delete mode 100644 ppx_tools_versioned.5.2/ast_mapper_class_406.ml delete mode 100644 ppx_tools_versioned.5.2/ast_mapper_class_406.mli delete mode 100644 ppx_tools_versioned.5.2/example/ppx_once/META delete mode 100644 ppx_tools_versioned.5.2/example/ppx_once/Makefile delete mode 100644 ppx_tools_versioned.5.2/example/ppx_once/ppx_once.ml delete mode 100644 ppx_tools_versioned.5.2/example/ppx_once/standalone.ml delete mode 100644 ppx_tools_versioned.5.2/gen/update_jbuild.ml delete mode 100644 ppx_tools_versioned.5.2/jbuild delete mode 100644 ppx_tools_versioned.5.2/jbuild-workspace.dev delete mode 100644 ppx_tools_versioned.5.2/jbuild.inc delete mode 100644 ppx_tools_versioned.5.2/pkg/pkg.ml delete mode 100644 ppx_tools_versioned.5.2/ppx_metaquot_402.ml delete mode 100644 ppx_tools_versioned.5.2/ppx_metaquot_403.ml delete mode 100644 ppx_tools_versioned.5.2/ppx_metaquot_404.ml delete mode 100644 ppx_tools_versioned.5.2/ppx_metaquot_405.ml delete mode 100644 ppx_tools_versioned.5.2/ppx_metaquot_406.ml delete mode 100644 ppx_tools_versioned.5.2/ppx_metaquot_run.ml delete mode 100644 ppx_tools_versioned.5.2/ppx_tools_402.ml delete mode 100644 ppx_tools_versioned.5.2/ppx_tools_403.ml delete mode 100644 ppx_tools_versioned.5.2/ppx_tools_404.ml delete mode 100644 ppx_tools_versioned.5.2/ppx_tools_405.ml delete mode 100644 ppx_tools_versioned.5.2/ppx_tools_406.ml delete mode 100644 ppx_tools_versioned.5.2/ppx_tools_versioned.nopam delete mode 100644 sedlex-1.99.4/.gitignore delete mode 100644 sedlex-1.99.4/CHANGES delete mode 100644 sedlex-1.99.4/LICENSE delete mode 100644 sedlex-1.99.4/META delete mode 100644 sedlex-1.99.4/Makefile delete mode 100644 sedlex-1.99.4/README.md delete mode 100644 sedlex-1.99.4/examples/Makefile delete mode 100644 sedlex-1.99.4/examples/complement.ml delete mode 100644 sedlex-1.99.4/examples/repeat.ml delete mode 100644 sedlex-1.99.4/examples/subtraction.ml delete mode 100644 sedlex-1.99.4/examples/tokenizer.ml delete mode 100644 sedlex-1.99.4/nopam delete mode 100644 sedlex-1.99.4/src/lib/Makefile delete mode 100644 sedlex-1.99.4/src/lib/dune delete mode 100755 sedlex-1.99.4/src/lib/sedlexing.ml delete mode 100644 sedlex-1.99.4/src/lib/sedlexing.mli delete mode 100644 sedlex-1.99.4/src/syntax/Makefile delete mode 100644 sedlex-1.99.4/src/syntax/dune delete mode 100644 sedlex-1.99.4/src/syntax/ppx_sedlex.ml delete mode 100644 sedlex-1.99.4/src/syntax/sedlex.ml delete mode 100644 sedlex-1.99.4/src/syntax/sedlex.mli delete mode 100755 sedlex-1.99.4/src/syntax/sedlex_cset.ml delete mode 100644 sedlex-1.99.4/src/syntax/sedlex_cset.mli delete mode 100644 sedlex-1.99.4/src/syntax/unicode63.ml delete mode 100644 sedlex-1.99.4/src/syntax/unicode63.mli diff --git a/esy.lock/.gitattributes b/esy.lock/.gitattributes index 25366ae..e0b4e26 100644 --- a/esy.lock/.gitattributes +++ b/esy.lock/.gitattributes @@ -1,3 +1,3 @@ # Set eol to LF so files aren't converted to CRLF-eol on Windows. -* text eol=lf +* text eol=lf linguist-generated diff --git a/esy.lock/.gitignore b/esy.lock/.gitignore index a221be2..a41b623 100644 --- a/esy.lock/.gitignore +++ b/esy.lock/.gitignore @@ -1,3 +1,4 @@ # Reset any possible .gitignore, we want all esy.lock to be un-ignored. !* +_esy/ \ No newline at end of file diff --git a/esy.lock/index.json b/esy.lock/index.json index 054b6d5..5110022 100644 --- a/esy.lock/index.json +++ b/esy.lock/index.json @@ -1,15 +1,31 @@ { - "checksum": "2d6646f2afdefedd8cf0bec2c3267d24", + "checksum": "3dd535d07546a5de19662de2b8da062e", "root": "@esy-ocaml/flow-parser@link-dev:./package.json", "node": { - "ocaml@4.7.1004@d41d8cd9": { - "id": "ocaml@4.7.1004@d41d8cd9", + "ocaml@4.10.2000@d41d8cd9": { + "id": "ocaml@4.10.2000@d41d8cd9", "name": "ocaml", - "version": "4.7.1004", + "version": "4.10.2000", "source": { "type": "install", "source": [ - "archive:https://registry.npmjs.org/ocaml/-/ocaml-4.7.1004.tgz#sha1:731ca0ddb4d845d2ed2da8af50f70c5ba9092114" + "archive:https://registry.npmjs.org/ocaml/-/ocaml-4.10.2000.tgz#sha1:9e9a6305340fdcac2b105f26f20de4255686edc0" + ] + }, + "overrides": [], + "dependencies": [], + "devDependencies": [] + }, + "esy-m4@github:esy-packages/esy-m4#c7cf0ac9221be2b1f9d90e83559ca08397a629e7@d41d8cd9": { + "id": + "esy-m4@github:esy-packages/esy-m4#c7cf0ac9221be2b1f9d90e83559ca08397a629e7@d41d8cd9", + "name": "esy-m4", + "version": + "github:esy-packages/esy-m4#c7cf0ac9221be2b1f9d90e83559ca08397a629e7", + "source": { + "type": "install", + "source": [ + "github:esy-packages/esy-m4#c7cf0ac9221be2b1f9d90e83559ca08397a629e7" ] }, "overrides": [], @@ -34,14 +50,14 @@ }, "overrides": [], "dependencies": [ - "ocaml@4.7.1004@d41d8cd9", "@opam/easy-format@opam:1.3.2@0484b3c4", - "@opam/dune@opam:1.11.3@9894df55", "@opam/cppo@opam:1.6.6@f4f83858", + "ocaml@4.10.2000@d41d8cd9", "@opam/easy-format@opam:1.3.2@0484b3c4", + "@opam/dune@opam:2.8.2@3d714e5f", "@opam/cppo@opam:1.6.7@c28ac3ae", "@opam/biniou@opam:1.2.1@d7570399", "@esy-ocaml/substs@0.0.1@d41d8cd9" ], "devDependencies": [ - "ocaml@4.7.1004@d41d8cd9", "@opam/easy-format@opam:1.3.2@0484b3c4", - "@opam/dune@opam:1.11.3@9894df55", "@opam/biniou@opam:1.2.1@d7570399" + "ocaml@4.10.2000@d41d8cd9", "@opam/easy-format@opam:1.3.2@0484b3c4", + "@opam/dune@opam:2.8.2@3d714e5f", "@opam/biniou@opam:1.2.1@d7570399" ] }, "@opam/wtf8@opam:1.0.2@23c2982b": { @@ -62,40 +78,237 @@ }, "overrides": [], "dependencies": [ - "ocaml@4.7.1004@d41d8cd9", "@opam/dune@opam:1.11.3@9894df55", + "ocaml@4.10.2000@d41d8cd9", "@opam/dune@opam:2.8.2@3d714e5f", + "@esy-ocaml/substs@0.0.1@d41d8cd9" + ], + "devDependencies": [ + "ocaml@4.10.2000@d41d8cd9", "@opam/dune@opam:2.8.2@3d714e5f" + ] + }, + "@opam/uchar@opam:0.0.2@c8218eea": { + "id": "@opam/uchar@opam:0.0.2@c8218eea", + "name": "@opam/uchar", + "version": "opam:0.0.2", + "source": { + "type": "install", + "source": [ + "archive:https://opam.ocaml.org/cache/md5/c9/c9ba2c738d264c420c642f7bb1cf4a36#md5:c9ba2c738d264c420c642f7bb1cf4a36", + "archive:https://github.com/ocaml/uchar/releases/download/v0.0.2/uchar-0.0.2.tbz#md5:c9ba2c738d264c420c642f7bb1cf4a36" + ], + "opam": { + "name": "uchar", + "version": "0.0.2", + "path": "esy.lock/opam/uchar.0.0.2" + } + }, + "overrides": [], + "dependencies": [ + "ocaml@4.10.2000@d41d8cd9", "@opam/ocamlbuild@opam:0.14.0@6ac75d03", + "@esy-ocaml/substs@0.0.1@d41d8cd9" + ], + "devDependencies": [ "ocaml@4.10.2000@d41d8cd9" ] + }, + "@opam/sedlex@opam:2.2@c2724f17": { + "id": "@opam/sedlex@opam:2.2@c2724f17", + "name": "@opam/sedlex", + "version": "opam:2.2", + "source": { + "type": "install", + "source": [ + "archive:https://opam.ocaml.org/cache/md5/5b/5bb2b819ac42959b8d7583abd2a2e610#md5:5bb2b819ac42959b8d7583abd2a2e610", + "archive:https://github.com/ocaml-community/sedlex/archive/v2.2.tar.gz#md5:5bb2b819ac42959b8d7583abd2a2e610" + ], + "opam": { + "name": "sedlex", + "version": "2.2", + "path": "esy.lock/opam/sedlex.2.2" + } + }, + "overrides": [], + "dependencies": [ + "ocaml@4.10.2000@d41d8cd9", "@opam/uchar@opam:0.0.2@c8218eea", + "@opam/ppx_tools_versioned@opam:5.4.0@32d1a414", + "@opam/ocaml-migrate-parsetree@opam:1.8.0@305b6173", + "@opam/gen@opam:0.5.3@332ff1b4", "@opam/dune@opam:2.8.2@3d714e5f", "@esy-ocaml/substs@0.0.1@d41d8cd9" ], "devDependencies": [ - "ocaml@4.7.1004@d41d8cd9", "@opam/dune@opam:1.11.3@9894df55" + "ocaml@4.10.2000@d41d8cd9", "@opam/uchar@opam:0.0.2@c8218eea", + "@opam/ppx_tools_versioned@opam:5.4.0@32d1a414", + "@opam/ocaml-migrate-parsetree@opam:1.8.0@305b6173", + "@opam/gen@opam:0.5.3@332ff1b4", "@opam/dune@opam:2.8.2@3d714e5f" ] }, - "@opam/result@opam:1.4@6fb665c3": { - "id": "@opam/result@opam:1.4@6fb665c3", + "@opam/result@opam:1.5@6b753c82": { + "id": "@opam/result@opam:1.5@6b753c82", "name": "@opam/result", - "version": "opam:1.4", + "version": "opam:1.5", "source": { "type": "install", "source": [ - "archive:https://opam.ocaml.org/cache/md5/d3/d3162dbc501a2af65c8c71e0866541da#md5:d3162dbc501a2af65c8c71e0866541da", - "archive:https://github.com/janestreet/result/archive/1.4.tar.gz#md5:d3162dbc501a2af65c8c71e0866541da" + "archive:https://opam.ocaml.org/cache/md5/1b/1b82dec78849680b49ae9a8a365b831b#md5:1b82dec78849680b49ae9a8a365b831b", + "archive:https://github.com/janestreet/result/releases/download/1.5/result-1.5.tbz#md5:1b82dec78849680b49ae9a8a365b831b" ], "opam": { "name": "result", + "version": "1.5", + "path": "esy.lock/opam/result.1.5" + } + }, + "overrides": [], + "dependencies": [ + "ocaml@4.10.2000@d41d8cd9", "@opam/dune@opam:2.8.2@3d714e5f", + "@esy-ocaml/substs@0.0.1@d41d8cd9" + ], + "devDependencies": [ + "ocaml@4.10.2000@d41d8cd9", "@opam/dune@opam:2.8.2@3d714e5f" + ] + }, + "@opam/ppxfind@opam:1.4@d75848d2": { + "id": "@opam/ppxfind@opam:1.4@d75848d2", + "name": "@opam/ppxfind", + "version": "opam:1.4", + "source": { + "type": "install", + "source": [ + "archive:https://opam.ocaml.org/cache/sha256/98/98291c69f04f7f7b7cdad1b5d786c70fc595559d4663cc04cb711ac132db4971#sha256:98291c69f04f7f7b7cdad1b5d786c70fc595559d4663cc04cb711ac132db4971", + "archive:https://github.com/jeremiedimino/ppxfind/releases/download/1.4/ppxfind-1.4.tbz#sha256:98291c69f04f7f7b7cdad1b5d786c70fc595559d4663cc04cb711ac132db4971" + ], + "opam": { + "name": "ppxfind", "version": "1.4", - "path": "esy.lock/opam/result.1.4" + "path": "esy.lock/opam/ppxfind.1.4" } }, "overrides": [], "dependencies": [ - "ocaml@4.7.1004@d41d8cd9", "@opam/dune@opam:1.11.3@9894df55", + "ocaml@4.10.2000@d41d8cd9", "@opam/ocamlfind@opam:1.8.1@ff07b0f9", + "@opam/ocaml-migrate-parsetree@opam:1.8.0@305b6173", + "@opam/dune@opam:2.8.2@3d714e5f", "@esy-ocaml/substs@0.0.1@d41d8cd9" + ], + "devDependencies": [ + "ocaml@4.10.2000@d41d8cd9", "@opam/ocamlfind@opam:1.8.1@ff07b0f9", + "@opam/ocaml-migrate-parsetree@opam:1.8.0@305b6173", + "@opam/dune@opam:2.8.2@3d714e5f" + ] + }, + "@opam/ppx_tools_versioned@opam:5.4.0@32d1a414": { + "id": "@opam/ppx_tools_versioned@opam:5.4.0@32d1a414", + "name": "@opam/ppx_tools_versioned", + "version": "opam:5.4.0", + "source": { + "type": "install", + "source": [ + "archive:https://opam.ocaml.org/cache/md5/3e/3e809a11cae99f57c051d3d0100311f6#md5:3e809a11cae99f57c051d3d0100311f6", + "archive:https://github.com/ocaml-ppx/ppx_tools_versioned/archive/5.4.0.tar.gz#md5:3e809a11cae99f57c051d3d0100311f6" + ], + "opam": { + "name": "ppx_tools_versioned", + "version": "5.4.0", + "path": "esy.lock/opam/ppx_tools_versioned.5.4.0" + } + }, + "overrides": [], + "dependencies": [ + "ocaml@4.10.2000@d41d8cd9", + "@opam/ocaml-migrate-parsetree@opam:1.8.0@305b6173", + "@opam/dune@opam:2.8.2@3d714e5f", "@esy-ocaml/substs@0.0.1@d41d8cd9" + ], + "devDependencies": [ + "ocaml@4.10.2000@d41d8cd9", + "@opam/ocaml-migrate-parsetree@opam:1.8.0@305b6173", + "@opam/dune@opam:2.8.2@3d714e5f" + ] + }, + "@opam/ppx_tools@opam:6.3@e259a756": { + "id": "@opam/ppx_tools@opam:6.3@e259a756", + "name": "@opam/ppx_tools", + "version": "opam:6.3", + "source": { + "type": "install", + "source": [ + "archive:https://opam.ocaml.org/cache/sha256/f6/f6f37ff7ffda48606fa3ceb1756ad8f7312e3ca1f12e8c1349686f468a621f58#sha256:f6f37ff7ffda48606fa3ceb1756ad8f7312e3ca1f12e8c1349686f468a621f58", + "archive:https://github.com/ocaml-ppx/ppx_tools/releases/download/6.3/ppx_tools-6.3.tbz#sha256:f6f37ff7ffda48606fa3ceb1756ad8f7312e3ca1f12e8c1349686f468a621f58" + ], + "opam": { + "name": "ppx_tools", + "version": "6.3", + "path": "esy.lock/opam/ppx_tools.6.3" + } + }, + "overrides": [], + "dependencies": [ + "ocaml@4.10.2000@d41d8cd9", "@opam/dune@opam:2.8.2@3d714e5f", + "@opam/cppo@opam:1.6.7@c28ac3ae", "@esy-ocaml/substs@0.0.1@d41d8cd9" + ], + "devDependencies": [ + "ocaml@4.10.2000@d41d8cd9", "@opam/dune@opam:2.8.2@3d714e5f" + ] + }, + "@opam/ppx_gen_rec@opam:1.1.0@83c02ec8": { + "id": "@opam/ppx_gen_rec@opam:1.1.0@83c02ec8", + "name": "@opam/ppx_gen_rec", + "version": "opam:1.1.0", + "source": { + "type": "install", + "source": [ + "archive:https://opam.ocaml.org/cache/sha256/70/7061496354023c182f189f02ee3dc5a8ae54dbb75b66a5effb09226ce722913b#sha256:7061496354023c182f189f02ee3dc5a8ae54dbb75b66a5effb09226ce722913b", + "archive:https://github.com/flowtype/ocaml-ppx_gen_rec/releases/download/v1.1.0/ppx_gen_rec-v1.1.0.tbz#sha256:7061496354023c182f189f02ee3dc5a8ae54dbb75b66a5effb09226ce722913b" + ], + "opam": { + "name": "ppx_gen_rec", + "version": "1.1.0", + "path": "esy.lock/opam/ppx_gen_rec.1.1.0" + } + }, + "overrides": [], + "dependencies": [ + "ocaml@4.10.2000@d41d8cd9", + "@opam/ocaml-migrate-parsetree@opam:1.8.0@305b6173", + "@opam/dune@opam:2.8.2@3d714e5f", "@esy-ocaml/substs@0.0.1@d41d8cd9" + ], + "devDependencies": [ + "ocaml@4.10.2000@d41d8cd9", + "@opam/ocaml-migrate-parsetree@opam:1.8.0@305b6173", + "@opam/dune@opam:2.8.2@3d714e5f" + ] + }, + "@opam/ppx_deriving@opam:4.5@870c733d": { + "id": "@opam/ppx_deriving@opam:4.5@870c733d", + "name": "@opam/ppx_deriving", + "version": "opam:4.5", + "source": { + "type": "install", + "source": [ + "archive:https://opam.ocaml.org/cache/sha512/f7/f79153c5231ba1e03a3491fde95ca82ecb62fe05b60a649a374d2fbc5ea5dd9242126de7dfbe917c22fd7077c026c940e18c6b36c5ce0ec4bb6e07f11d2b710b#sha512:f79153c5231ba1e03a3491fde95ca82ecb62fe05b60a649a374d2fbc5ea5dd9242126de7dfbe917c22fd7077c026c940e18c6b36c5ce0ec4bb6e07f11d2b710b", + "archive:https://github.com/ocaml-ppx/ppx_deriving/archive/v4.5.tar.gz#sha512:f79153c5231ba1e03a3491fde95ca82ecb62fe05b60a649a374d2fbc5ea5dd9242126de7dfbe917c22fd7077c026c940e18c6b36c5ce0ec4bb6e07f11d2b710b" + ], + "opam": { + "name": "ppx_deriving", + "version": "4.5", + "path": "esy.lock/opam/ppx_deriving.4.5" + } + }, + "overrides": [], + "dependencies": [ + "ocaml@4.10.2000@d41d8cd9", "@opam/result@opam:1.5@6b753c82", + "@opam/ppxfind@opam:1.4@d75848d2", + "@opam/ppx_tools@opam:6.3@e259a756", + "@opam/ppx_derivers@opam:1.2.1@ecf0aa45", + "@opam/ocaml-migrate-parsetree@opam:1.8.0@305b6173", + "@opam/dune@opam:2.8.2@3d714e5f", "@opam/cppo@opam:1.6.7@c28ac3ae", "@esy-ocaml/substs@0.0.1@d41d8cd9" ], "devDependencies": [ - "ocaml@4.7.1004@d41d8cd9", "@opam/dune@opam:1.11.3@9894df55" + "ocaml@4.10.2000@d41d8cd9", "@opam/result@opam:1.5@6b753c82", + "@opam/ppx_tools@opam:6.3@e259a756", + "@opam/ppx_derivers@opam:1.2.1@ecf0aa45", + "@opam/ocaml-migrate-parsetree@opam:1.8.0@305b6173", + "@opam/dune@opam:2.8.2@3d714e5f" ] }, - "@opam/ppx_derivers@opam:1.2.1@aee9c3db": { - "id": "@opam/ppx_derivers@opam:1.2.1@aee9c3db", + "@opam/ppx_derivers@opam:1.2.1@ecf0aa45": { + "id": "@opam/ppx_derivers@opam:1.2.1@ecf0aa45", "name": "@opam/ppx_derivers", "version": "opam:1.2.1", "source": { @@ -112,11 +325,11 @@ }, "overrides": [], "dependencies": [ - "ocaml@4.7.1004@d41d8cd9", "@opam/dune@opam:1.11.3@9894df55", + "ocaml@4.10.2000@d41d8cd9", "@opam/dune@opam:2.8.2@3d714e5f", "@esy-ocaml/substs@0.0.1@d41d8cd9" ], "devDependencies": [ - "ocaml@4.7.1004@d41d8cd9", "@opam/dune@opam:1.11.3@9894df55" + "ocaml@4.10.2000@d41d8cd9", "@opam/dune@opam:2.8.2@3d714e5f" ] }, "@opam/ocamlfind@opam:1.8.1@ff07b0f9": { @@ -143,91 +356,124 @@ } ], "dependencies": [ - "ocaml@4.7.1004@d41d8cd9", "@opam/conf-m4@opam:1@da6f4f44", + "ocaml@4.10.2000@d41d8cd9", "@opam/conf-m4@opam:1@196bf219", "@esy-ocaml/substs@0.0.1@d41d8cd9" ], - "devDependencies": [ "ocaml@4.7.1004@d41d8cd9" ] + "devDependencies": [ "ocaml@4.10.2000@d41d8cd9" ] }, - "@opam/ocaml-migrate-parsetree@opam:1.4.0@7f2e4334": { - "id": "@opam/ocaml-migrate-parsetree@opam:1.4.0@7f2e4334", + "@opam/ocamlbuild@opam:0.14.0@6ac75d03": { + "id": "@opam/ocamlbuild@opam:0.14.0@6ac75d03", + "name": "@opam/ocamlbuild", + "version": "opam:0.14.0", + "source": { + "type": "install", + "source": [ + "archive:https://opam.ocaml.org/cache/sha256/87/87b29ce96958096c0a1a8eeafeb6268077b2d11e1bf2b3de0f5ebc9cf8d42e78#sha256:87b29ce96958096c0a1a8eeafeb6268077b2d11e1bf2b3de0f5ebc9cf8d42e78", + "archive:https://github.com/ocaml/ocamlbuild/archive/0.14.0.tar.gz#sha256:87b29ce96958096c0a1a8eeafeb6268077b2d11e1bf2b3de0f5ebc9cf8d42e78" + ], + "opam": { + "name": "ocamlbuild", + "version": "0.14.0", + "path": "esy.lock/opam/ocamlbuild.0.14.0" + } + }, + "overrides": [ + { + "opamoverride": + "esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.0_opam_override" + } + ], + "dependencies": [ + "ocaml@4.10.2000@d41d8cd9", "@esy-ocaml/substs@0.0.1@d41d8cd9" + ], + "devDependencies": [ "ocaml@4.10.2000@d41d8cd9" ] + }, + "@opam/ocaml-migrate-parsetree@opam:1.8.0@305b6173": { + "id": "@opam/ocaml-migrate-parsetree@opam:1.8.0@305b6173", "name": "@opam/ocaml-migrate-parsetree", - "version": "opam:1.4.0", + "version": "opam:1.8.0", "source": { "type": "install", "source": [ - "archive:https://opam.ocaml.org/cache/sha256/23/231fbdc205187b3ee266b535d9cfe44b599067b2f6e97883c782ea7bb577d3b8#sha256:231fbdc205187b3ee266b535d9cfe44b599067b2f6e97883c782ea7bb577d3b8", - "archive:https://github.com/ocaml-ppx/ocaml-migrate-parsetree/releases/download/v1.4.0/ocaml-migrate-parsetree-v1.4.0.tbz#sha256:231fbdc205187b3ee266b535d9cfe44b599067b2f6e97883c782ea7bb577d3b8" + "archive:https://opam.ocaml.org/cache/sha256/b1/b1c2d176ff1444041f2775786ba605be796e46dfd2acb06c96f35d2bb88b8fb5#sha256:b1c2d176ff1444041f2775786ba605be796e46dfd2acb06c96f35d2bb88b8fb5", + "archive:https://github.com/ocaml-ppx/ocaml-migrate-parsetree/releases/download/v1.8.0/ocaml-migrate-parsetree-v1.8.0.tbz#sha256:b1c2d176ff1444041f2775786ba605be796e46dfd2acb06c96f35d2bb88b8fb5" ], "opam": { "name": "ocaml-migrate-parsetree", - "version": "1.4.0", - "path": "esy.lock/opam/ocaml-migrate-parsetree.1.4.0" + "version": "1.8.0", + "path": "esy.lock/opam/ocaml-migrate-parsetree.1.8.0" } }, "overrides": [], "dependencies": [ - "ocaml@4.7.1004@d41d8cd9", "@opam/result@opam:1.4@6fb665c3", - "@opam/ppx_derivers@opam:1.2.1@aee9c3db", - "@opam/dune@opam:1.11.3@9894df55", "@esy-ocaml/substs@0.0.1@d41d8cd9" + "ocaml@4.10.2000@d41d8cd9", "@opam/result@opam:1.5@6b753c82", + "@opam/ppx_derivers@opam:1.2.1@ecf0aa45", + "@opam/dune@opam:2.8.2@3d714e5f", "@esy-ocaml/substs@0.0.1@d41d8cd9" ], "devDependencies": [ - "ocaml@4.7.1004@d41d8cd9", "@opam/result@opam:1.4@6fb665c3", - "@opam/ppx_derivers@opam:1.2.1@aee9c3db", - "@opam/dune@opam:1.11.3@9894df55" + "ocaml@4.10.2000@d41d8cd9", "@opam/result@opam:1.5@6b753c82", + "@opam/ppx_derivers@opam:1.2.1@ecf0aa45", + "@opam/dune@opam:2.8.2@3d714e5f" ] }, - "@opam/merlin@opam:3.3.2@7a364181": { - "id": "@opam/merlin@opam:3.3.2@7a364181", + "@opam/merlin@opam:3.4.2@9a4d1fd4": { + "id": "@opam/merlin@opam:3.4.2@9a4d1fd4", "name": "@opam/merlin", - "version": "opam:3.3.2", + "version": "opam:3.4.2", "source": { "type": "install", "source": [ - "archive:https://opam.ocaml.org/cache/sha256/1d/1d1c71e663b1e58acf19069cebd1e8d18f7dbe513c6065347d162cdd2c2de801#sha256:1d1c71e663b1e58acf19069cebd1e8d18f7dbe513c6065347d162cdd2c2de801", - "archive:https://github.com/ocaml/merlin/releases/download/v3.3.2/merlin-v3.3.2.tbz#sha256:1d1c71e663b1e58acf19069cebd1e8d18f7dbe513c6065347d162cdd2c2de801" + "archive:https://opam.ocaml.org/cache/sha256/e1/e1b7b897b11119d92995c558530149fd07bd67a4aaf140f55f3c4ffb5e882a81#sha256:e1b7b897b11119d92995c558530149fd07bd67a4aaf140f55f3c4ffb5e882a81", + "archive:https://github.com/ocaml/merlin/releases/download/v3.4.2/merlin-v3.4.2.tbz#sha256:e1b7b897b11119d92995c558530149fd07bd67a4aaf140f55f3c4ffb5e882a81" ], "opam": { "name": "merlin", - "version": "3.3.2", - "path": "esy.lock/opam/merlin.3.3.2" + "version": "3.4.2", + "path": "esy.lock/opam/merlin.3.4.2" } }, "overrides": [], "dependencies": [ - "ocaml@4.7.1004@d41d8cd9", "@opam/yojson@opam:1.7.0@7056d985", - "@opam/ocamlfind@opam:1.8.1@ff07b0f9", - "@opam/dune@opam:1.11.3@9894df55", "@esy-ocaml/substs@0.0.1@d41d8cd9" + "ocaml@4.10.2000@d41d8cd9", "@opam/yojson@opam:1.7.0@7056d985", + "@opam/result@opam:1.5@6b753c82", "@opam/dune@opam:2.8.2@3d714e5f", + "@opam/dot-merlin-reader@opam:3.4.2@55baebb0", + "@opam/csexp@opam:1.3.2@5cea14af", "@esy-ocaml/substs@0.0.1@d41d8cd9" ], "devDependencies": [ - "ocaml@4.7.1004@d41d8cd9", "@opam/yojson@opam:1.7.0@7056d985", - "@opam/ocamlfind@opam:1.8.1@ff07b0f9", - "@opam/dune@opam:1.11.3@9894df55" + "ocaml@4.10.2000@d41d8cd9", "@opam/yojson@opam:1.7.0@7056d985", + "@opam/result@opam:1.5@6b753c82", "@opam/dune@opam:2.8.2@3d714e5f", + "@opam/dot-merlin-reader@opam:3.4.2@55baebb0", + "@opam/csexp@opam:1.3.2@5cea14af" ] }, - "@opam/gen@opam:0.5.2@77c41e95": { - "id": "@opam/gen@opam:0.5.2@77c41e95", + "@opam/gen@opam:0.5.3@332ff1b4": { + "id": "@opam/gen@opam:0.5.3@332ff1b4", "name": "@opam/gen", - "version": "opam:0.5.2", + "version": "opam:0.5.3", "source": { "type": "install", "source": [ - "archive:https://opam.ocaml.org/cache/md5/dd/dd731ef527022ea698955db687e6cb5f#md5:dd731ef527022ea698955db687e6cb5f", - "archive:https://github.com/c-cube/gen/archive/0.5.2.tar.gz#md5:dd731ef527022ea698955db687e6cb5f" + "archive:https://opam.ocaml.org/cache/md5/f2/f242db157222474b9715fef49a1259a4#md5:f242db157222474b9715fef49a1259a4", + "archive:https://github.com/c-cube/gen/archive/0.5.3.tar.gz#md5:f242db157222474b9715fef49a1259a4" ], "opam": { "name": "gen", - "version": "0.5.2", - "path": "esy.lock/opam/gen.0.5.2" + "version": "0.5.3", + "path": "esy.lock/opam/gen.0.5.3" } }, "overrides": [], "dependencies": [ - "@opam/dune@opam:1.11.3@9894df55", + "ocaml@4.10.2000@d41d8cd9", + "@opam/dune-configurator@opam:2.8.2@c90ff40b", + "@opam/dune@opam:2.8.2@3d714e5f", "@opam/base-bytes@opam:base@19d0c2ff", "@esy-ocaml/substs@0.0.1@d41d8cd9" ], "devDependencies": [ - "@opam/dune@opam:1.11.3@9894df55", + "ocaml@4.10.2000@d41d8cd9", + "@opam/dune-configurator@opam:2.8.2@c90ff40b", + "@opam/dune@opam:2.8.2@3d714e5f", "@opam/base-bytes@opam:base@19d0c2ff" ] }, @@ -249,74 +495,153 @@ }, "overrides": [], "dependencies": [ - "ocaml@4.7.1004@d41d8cd9", "@opam/dune@opam:1.11.3@9894df55", + "ocaml@4.10.2000@d41d8cd9", "@opam/dune@opam:2.8.2@3d714e5f", + "@esy-ocaml/substs@0.0.1@d41d8cd9" + ], + "devDependencies": [ + "ocaml@4.10.2000@d41d8cd9", "@opam/dune@opam:2.8.2@3d714e5f" + ] + }, + "@opam/dune-configurator@opam:2.8.2@c90ff40b": { + "id": "@opam/dune-configurator@opam:2.8.2@c90ff40b", + "name": "@opam/dune-configurator", + "version": "opam:2.8.2", + "source": { + "type": "install", + "source": [ + "archive:https://opam.ocaml.org/cache/sha256/e2/e2c4e8230f7c96236503fd75f22bdbc263639971bf104509e446855ded35ae1e#sha256:e2c4e8230f7c96236503fd75f22bdbc263639971bf104509e446855ded35ae1e", + "archive:https://github.com/ocaml/dune/releases/download/2.8.2/dune-2.8.2.tbz#sha256:e2c4e8230f7c96236503fd75f22bdbc263639971bf104509e446855ded35ae1e" + ], + "opam": { + "name": "dune-configurator", + "version": "2.8.2", + "path": "esy.lock/opam/dune-configurator.2.8.2" + } + }, + "overrides": [], + "dependencies": [ + "ocaml@4.10.2000@d41d8cd9", "@opam/result@opam:1.5@6b753c82", + "@opam/dune@opam:2.8.2@3d714e5f", "@opam/csexp@opam:1.3.2@5cea14af", "@esy-ocaml/substs@0.0.1@d41d8cd9" ], "devDependencies": [ - "ocaml@4.7.1004@d41d8cd9", "@opam/dune@opam:1.11.3@9894df55" + "ocaml@4.10.2000@d41d8cd9", "@opam/result@opam:1.5@6b753c82", + "@opam/dune@opam:2.8.2@3d714e5f", "@opam/csexp@opam:1.3.2@5cea14af" ] }, - "@opam/dune@opam:1.11.3@9894df55": { - "id": "@opam/dune@opam:1.11.3@9894df55", + "@opam/dune@opam:2.8.2@3d714e5f": { + "id": "@opam/dune@opam:2.8.2@3d714e5f", "name": "@opam/dune", - "version": "opam:1.11.3", + "version": "opam:2.8.2", "source": { "type": "install", "source": [ - "archive:https://opam.ocaml.org/cache/sha256/c8/c83a63e7e8245611b0e11d6adea07c6484dc1b4efffacb176315cd6674d4bbd2#sha256:c83a63e7e8245611b0e11d6adea07c6484dc1b4efffacb176315cd6674d4bbd2", - "archive:https://github.com/ocaml/dune/releases/download/1.11.3/dune-build-info-1.11.3.tbz#sha256:c83a63e7e8245611b0e11d6adea07c6484dc1b4efffacb176315cd6674d4bbd2" + "archive:https://opam.ocaml.org/cache/sha256/e2/e2c4e8230f7c96236503fd75f22bdbc263639971bf104509e446855ded35ae1e#sha256:e2c4e8230f7c96236503fd75f22bdbc263639971bf104509e446855ded35ae1e", + "archive:https://github.com/ocaml/dune/releases/download/2.8.2/dune-2.8.2.tbz#sha256:e2c4e8230f7c96236503fd75f22bdbc263639971bf104509e446855ded35ae1e" ], "opam": { "name": "dune", - "version": "1.11.3", - "path": "esy.lock/opam/dune.1.11.3" + "version": "2.8.2", + "path": "esy.lock/opam/dune.2.8.2" } }, - "overrides": [ - { - "opamoverride": - "esy.lock/overrides/opam__s__dune_opam__c__1.11.3_opam_override" - } - ], + "overrides": [], "dependencies": [ - "ocaml@4.7.1004@d41d8cd9", "@opam/base-unix@opam:base@87d0b2eb", + "ocaml@4.10.2000@d41d8cd9", "@opam/base-unix@opam:base@87d0b2eb", "@opam/base-threads@opam:base@36803084", "@esy-ocaml/substs@0.0.1@d41d8cd9" ], "devDependencies": [ - "ocaml@4.7.1004@d41d8cd9", "@opam/base-unix@opam:base@87d0b2eb", + "ocaml@4.10.2000@d41d8cd9", "@opam/base-unix@opam:base@87d0b2eb", "@opam/base-threads@opam:base@36803084" ] }, - "@opam/cppo@opam:1.6.6@f4f83858": { - "id": "@opam/cppo@opam:1.6.6@f4f83858", + "@opam/dot-merlin-reader@opam:3.4.2@55baebb0": { + "id": "@opam/dot-merlin-reader@opam:3.4.2@55baebb0", + "name": "@opam/dot-merlin-reader", + "version": "opam:3.4.2", + "source": { + "type": "install", + "source": [ + "archive:https://opam.ocaml.org/cache/sha256/e1/e1b7b897b11119d92995c558530149fd07bd67a4aaf140f55f3c4ffb5e882a81#sha256:e1b7b897b11119d92995c558530149fd07bd67a4aaf140f55f3c4ffb5e882a81", + "archive:https://github.com/ocaml/merlin/releases/download/v3.4.2/merlin-v3.4.2.tbz#sha256:e1b7b897b11119d92995c558530149fd07bd67a4aaf140f55f3c4ffb5e882a81" + ], + "opam": { + "name": "dot-merlin-reader", + "version": "3.4.2", + "path": "esy.lock/opam/dot-merlin-reader.3.4.2" + } + }, + "overrides": [], + "dependencies": [ + "ocaml@4.10.2000@d41d8cd9", "@opam/yojson@opam:1.7.0@7056d985", + "@opam/result@opam:1.5@6b753c82", + "@opam/ocamlfind@opam:1.8.1@ff07b0f9", + "@opam/dune@opam:2.8.2@3d714e5f", "@opam/csexp@opam:1.3.2@5cea14af", + "@esy-ocaml/substs@0.0.1@d41d8cd9" + ], + "devDependencies": [ + "ocaml@4.10.2000@d41d8cd9", "@opam/yojson@opam:1.7.0@7056d985", + "@opam/result@opam:1.5@6b753c82", + "@opam/ocamlfind@opam:1.8.1@ff07b0f9", + "@opam/dune@opam:2.8.2@3d714e5f", "@opam/csexp@opam:1.3.2@5cea14af" + ] + }, + "@opam/csexp@opam:1.3.2@5cea14af": { + "id": "@opam/csexp@opam:1.3.2@5cea14af", + "name": "@opam/csexp", + "version": "opam:1.3.2", + "source": { + "type": "install", + "source": [ + "archive:https://opam.ocaml.org/cache/sha256/f2/f21f427b277f07e8bfd050e00c640a5893c1bf4b689147640fa383255dcf1c4a#sha256:f21f427b277f07e8bfd050e00c640a5893c1bf4b689147640fa383255dcf1c4a", + "archive:https://github.com/ocaml-dune/csexp/releases/download/1.3.2/csexp-1.3.2.tbz#sha256:f21f427b277f07e8bfd050e00c640a5893c1bf4b689147640fa383255dcf1c4a" + ], + "opam": { + "name": "csexp", + "version": "1.3.2", + "path": "esy.lock/opam/csexp.1.3.2" + } + }, + "overrides": [], + "dependencies": [ + "ocaml@4.10.2000@d41d8cd9", "@opam/result@opam:1.5@6b753c82", + "@opam/dune@opam:2.8.2@3d714e5f", "@esy-ocaml/substs@0.0.1@d41d8cd9" + ], + "devDependencies": [ + "ocaml@4.10.2000@d41d8cd9", "@opam/result@opam:1.5@6b753c82", + "@opam/dune@opam:2.8.2@3d714e5f" + ] + }, + "@opam/cppo@opam:1.6.7@c28ac3ae": { + "id": "@opam/cppo@opam:1.6.7@c28ac3ae", "name": "@opam/cppo", - "version": "opam:1.6.6", + "version": "opam:1.6.7", "source": { "type": "install", "source": [ - "archive:https://opam.ocaml.org/cache/sha256/e7/e7272996a7789175b87bb998efd079794a8db6625aae990d73f7b4484a07b8a0#sha256:e7272996a7789175b87bb998efd079794a8db6625aae990d73f7b4484a07b8a0", - "archive:https://github.com/ocaml-community/cppo/releases/download/v1.6.6/cppo-v1.6.6.tbz#sha256:e7272996a7789175b87bb998efd079794a8db6625aae990d73f7b4484a07b8a0" + "archive:https://opam.ocaml.org/cache/sha256/db/db553e3e6c206df09b1858c3aef5e21e56564d593642a3c78bcedb6af36f529d#sha256:db553e3e6c206df09b1858c3aef5e21e56564d593642a3c78bcedb6af36f529d", + "archive:https://github.com/ocaml-community/cppo/releases/download/v1.6.7/cppo-v1.6.7.tbz#sha256:db553e3e6c206df09b1858c3aef5e21e56564d593642a3c78bcedb6af36f529d" ], "opam": { "name": "cppo", - "version": "1.6.6", - "path": "esy.lock/opam/cppo.1.6.6" + "version": "1.6.7", + "path": "esy.lock/opam/cppo.1.6.7" } }, "overrides": [], "dependencies": [ - "ocaml@4.7.1004@d41d8cd9", "@opam/dune@opam:1.11.3@9894df55", + "ocaml@4.10.2000@d41d8cd9", "@opam/dune@opam:2.8.2@3d714e5f", "@opam/base-unix@opam:base@87d0b2eb", "@esy-ocaml/substs@0.0.1@d41d8cd9" ], "devDependencies": [ - "ocaml@4.7.1004@d41d8cd9", "@opam/dune@opam:1.11.3@9894df55", + "ocaml@4.10.2000@d41d8cd9", "@opam/dune@opam:2.8.2@3d714e5f", "@opam/base-unix@opam:base@87d0b2eb" ] }, - "@opam/conf-m4@opam:1@da6f4f44": { - "id": "@opam/conf-m4@opam:1@da6f4f44", + "@opam/conf-m4@opam:1@196bf219": { + "id": "@opam/conf-m4@opam:1@196bf219", "name": "@opam/conf-m4", "version": "opam:1", "source": { @@ -328,8 +653,16 @@ "path": "esy.lock/opam/conf-m4.1" } }, - "overrides": [], - "dependencies": [ "@esy-ocaml/substs@0.0.1@d41d8cd9" ], + "overrides": [ + { + "opamoverride": + "esy.lock/overrides/opam__s__conf_m4_opam__c__1_opam_override" + } + ], + "dependencies": [ + "esy-m4@github:esy-packages/esy-m4#c7cf0ac9221be2b1f9d90e83559ca08397a629e7@d41d8cd9", + "@esy-ocaml/substs@0.0.1@d41d8cd9" + ], "devDependencies": [] }, "@opam/biniou@opam:1.2.1@d7570399": { @@ -350,12 +683,12 @@ }, "overrides": [], "dependencies": [ - "ocaml@4.7.1004@d41d8cd9", "@opam/easy-format@opam:1.3.2@0484b3c4", - "@opam/dune@opam:1.11.3@9894df55", "@esy-ocaml/substs@0.0.1@d41d8cd9" + "ocaml@4.10.2000@d41d8cd9", "@opam/easy-format@opam:1.3.2@0484b3c4", + "@opam/dune@opam:2.8.2@3d714e5f", "@esy-ocaml/substs@0.0.1@d41d8cd9" ], "devDependencies": [ - "ocaml@4.7.1004@d41d8cd9", "@opam/easy-format@opam:1.3.2@0484b3c4", - "@opam/dune@opam:1.11.3@9894df55" + "ocaml@4.10.2000@d41d8cd9", "@opam/easy-format@opam:1.3.2@0484b3c4", + "@opam/dune@opam:2.8.2@3d714e5f" ] }, "@opam/base-unix@opam:base@87d0b2eb": { @@ -407,11 +740,11 @@ }, "overrides": [], "dependencies": [ - "ocaml@4.7.1004@d41d8cd9", "@opam/ocamlfind@opam:1.8.1@ff07b0f9", + "ocaml@4.10.2000@d41d8cd9", "@opam/ocamlfind@opam:1.8.1@ff07b0f9", "@esy-ocaml/substs@0.0.1@d41d8cd9" ], "devDependencies": [ - "ocaml@4.7.1004@d41d8cd9", "@opam/ocamlfind@opam:1.8.1@ff07b0f9" + "ocaml@4.10.2000@d41d8cd9", "@opam/ocamlfind@opam:1.8.1@ff07b0f9" ] }, "@esy-ocaml/substs@0.0.1@d41d8cd9": { @@ -439,12 +772,16 @@ }, "overrides": [], "dependencies": [ - "ocaml@4.7.1004@d41d8cd9", "@opam/wtf8@opam:1.0.2@23c2982b", - "@opam/ocaml-migrate-parsetree@opam:1.4.0@7f2e4334", - "@opam/gen@opam:0.5.2@77c41e95", "@opam/dune@opam:1.11.3@9894df55" + "ocaml@4.10.2000@d41d8cd9", "@opam/wtf8@opam:1.0.2@23c2982b", + "@opam/sedlex@opam:2.2@c2724f17", + "@opam/ppx_tools_versioned@opam:5.4.0@32d1a414", + "@opam/ppx_gen_rec@opam:1.1.0@83c02ec8", + "@opam/ppx_deriving@opam:4.5@870c733d", + "@opam/ocaml-migrate-parsetree@opam:1.8.0@305b6173", + "@opam/gen@opam:0.5.3@332ff1b4", "@opam/dune@opam:2.8.2@3d714e5f" ], "devDependencies": [ - "ocaml@4.7.1004@d41d8cd9", "@opam/merlin@opam:3.3.2@7a364181" + "ocaml@4.10.2000@d41d8cd9", "@opam/merlin@opam:3.4.2@9a4d1fd4" ] } } diff --git a/esy.lock/opam/conf-m4.1/opam b/esy.lock/opam/conf-m4.1/opam index df03511..c6feb2a 100644 --- a/esy.lock/opam/conf-m4.1/opam +++ b/esy.lock/opam/conf-m4.1/opam @@ -3,7 +3,7 @@ maintainer: "tim@gfxmonk.net" homepage: "http://www.gnu.org/software/m4/m4.html" bug-reports: "https://github.com/ocaml/opam-repository/issues" authors: "GNU Project" -license: "GPL-3" +license: "GPL-3.0-only" build: [["sh" "-exc" "echo | m4"]] depexts: [ ["m4"] {os-family = "debian"} diff --git a/esy.lock/opam/cppo.1.6.6/opam b/esy.lock/opam/cppo.1.6.7/opam similarity index 64% rename from esy.lock/opam/cppo.1.6.6/opam rename to esy.lock/opam/cppo.1.6.7/opam index f683f8b..eddcc1e 100644 --- a/esy.lock/opam/cppo.1.6.6/opam +++ b/esy.lock/opam/cppo.1.6.7/opam @@ -2,11 +2,11 @@ opam-version: "2.0" maintainer: "martin@mjambon.com" authors: "Martin Jambon" license: "BSD-3-Clause" -homepage: "http://mjambon.com/cppo.html" +homepage: "https://github.com/ocaml-community/cppo" doc: "https://ocaml-community.github.io/cppo/" bug-reports: "https://github.com/ocaml-community/cppo/issues" depends: [ - "ocaml" {>= "4.03"} + "ocaml" {>= "4.02.3"} "dune" {>= "1.0"} "base-unix" ] @@ -28,10 +28,12 @@ Cppo is: * reasonably fast * simple to install and to maintain """ +x-commit-hash: "7d217864a5fdc4551699e248137a2f8b719d2078" url { - src: "https://github.com/ocaml-community/cppo/releases/download/v1.6.6/cppo-v1.6.6.tbz" + src: + "https://github.com/ocaml-community/cppo/releases/download/v1.6.7/cppo-v1.6.7.tbz" checksum: [ - "sha256=e7272996a7789175b87bb998efd079794a8db6625aae990d73f7b4484a07b8a0" - "sha512=44ecf9d225d9e45490a2feac0bde04865ca398dba6c3579e3370fcd1ea255707b8883590852af8b2df87123801062b9f3acce2455c092deabf431f9c4fb8d8eb" + "sha256=db553e3e6c206df09b1858c3aef5e21e56564d593642a3c78bcedb6af36f529d" + "sha512=9722b50fd23aaccf86816313333a3bf8fc7c6b4ef06b153e5e1e1aaf14670cf51a4aac52fb1b4a0e5531699c4047a1eff6c24c969f7e5063e78096c2195b5819" ] } diff --git a/esy.lock/opam/csexp.1.3.2/opam b/esy.lock/opam/csexp.1.3.2/opam new file mode 100644 index 0000000..1508d17 --- /dev/null +++ b/esy.lock/opam/csexp.1.3.2/opam @@ -0,0 +1,58 @@ +opam-version: "2.0" +synopsis: "Parsing and printing of S-expressions in Canonical form" +description: """ + +This library provides minimal support for Canonical S-expressions +[1]. Canonical S-expressions are a binary encoding of S-expressions +that is super simple and well suited for communication between +programs. + +This library only provides a few helpers for simple applications. If +you need more advanced support, such as parsing from more fancy input +sources, you should consider copying the code of this library given +how simple parsing S-expressions in canonical form is. + +To avoid a dependency on a particular S-expression library, the only +module of this library is parameterised by the type of S-expressions. + +[1] https://en.wikipedia.org/wiki/Canonical_S-expressions +""" +maintainer: ["Jeremie Dimino "] +authors: [ + "Quentin Hocquet " + "Jane Street Group, LLC " + "Jeremie Dimino " +] +license: "MIT" +homepage: "https://github.com/ocaml-dune/csexp" +doc: "https://ocaml-dune.github.io/csexp/" +bug-reports: "https://github.com/ocaml-dune/csexp/issues" +depends: [ + "dune" {>= "1.11"} + "ocaml" {>= "4.02.3"} + "result" {>= "1.5"} +] +dev-repo: "git+https://github.com/ocaml-dune/csexp.git" +build: [ + ["dune" "subst"] {pinned} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "@install" +# "@runtest" {with-test & ocaml:version >= "4.04"} + "@doc" {with-doc} + ] +] +x-commit-hash: "19a2e7bc171a707059c73d78dd18e4e3ff03ac9b" +url { + src: + "https://github.com/ocaml-dune/csexp/releases/download/1.3.2/csexp-1.3.2.tbz" + checksum: [ + "sha256=f21f427b277f07e8bfd050e00c640a5893c1bf4b689147640fa383255dcf1c4a" + "sha512=ff1bd6a7c6bb3a73ca9ab0506c9ec1f357657deaa9ecc7eb32955817d9b0f266d976af3e2b8fc34c621cb0caf1fde55f9a609dd184e2054f500bf09afeb83026" + ] +} diff --git a/esy.lock/opam/dot-merlin-reader.3.4.2/opam b/esy.lock/opam/dot-merlin-reader.3.4.2/opam new file mode 100644 index 0000000..e740ed7 --- /dev/null +++ b/esy.lock/opam/dot-merlin-reader.3.4.2/opam @@ -0,0 +1,28 @@ +opam-version: "2.0" +maintainer: "defree@gmail.com" +authors: "The Merlin team" +synopsis: "Reads config files for merlin" +homepage: "https://github.com/ocaml/merlin" +bug-reports: "https://github.com/ocaml/merlin/issues" +dev-repo: "git+https://github.com/ocaml/merlin.git" +build: [ + ["dune" "subst"] {pinned} + ["dune" "build" "-p" name "-j" jobs] +] +depends: [ + "ocaml" {>= "4.02.1" & < "4.12"} + "dune" {>= "1.8.0"} + "yojson" {>= "1.6.0"} + "ocamlfind" {>= "1.6.0"} + "csexp" {>= "1.2.3"} + "result" {>= "1.5"} +] +x-commit-hash: "c9761a552380838e9f530b5c47c0ea3c47c33565" +url { + src: + "https://github.com/ocaml/merlin/releases/download/v3.4.2/merlin-v3.4.2.tbz" + checksum: [ + "sha256=e1b7b897b11119d92995c558530149fd07bd67a4aaf140f55f3c4ffb5e882a81" + "sha512=7c39c70fc923971c4eca9432061077941498574c0b804efc20af244c1c9ab34c9178d7eb50ab750feaac30696e7ff911a0ccd5fb86341b68485bedae472aa15f" + ] +} diff --git a/esy.lock/opam/dune-configurator.2.8.2/opam b/esy.lock/opam/dune-configurator.2.8.2/opam new file mode 100644 index 0000000..17a9f29 --- /dev/null +++ b/esy.lock/opam/dune-configurator.2.8.2/opam @@ -0,0 +1,47 @@ +opam-version: "2.0" +synopsis: "Helper library for gathering system configuration" +description: """ +dune-configurator is a small library that helps writing OCaml scripts that +test features available on the system, in order to generate config.h +files for instance. +Among other things, dune-configurator allows one to: +- test if a C program compiles +- query pkg-config +- import #define from OCaml header files +- generate config.h file +""" +maintainer: ["Jane Street Group, LLC "] +authors: ["Jane Street Group, LLC "] +license: "MIT" +homepage: "https://github.com/ocaml/dune" +doc: "https://dune.readthedocs.io/" +bug-reports: "https://github.com/ocaml/dune/issues" +depends: [ + "dune" {>= "2.8"} + "ocaml" {>= "4.03.0"} + "result" + "csexp" {>= "1.3.0"} + "odoc" {with-doc} +] +dev-repo: "git+https://github.com/ocaml/dune.git" +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "@install" + "@doc" {with-doc} + ] +] +x-commit-hash: "6c471da57bea666267a8a63034aed57962f378b0" +url { + src: "https://github.com/ocaml/dune/releases/download/2.8.2/dune-2.8.2.tbz" + checksum: [ + "sha256=e2c4e8230f7c96236503fd75f22bdbc263639971bf104509e446855ded35ae1e" + "sha512=d3cca73f5a72440273f7b4e3934dfa7e89fcb64710f3c734d2583123f5d9f3e573f0ab96a4892b2f11313038da6b4e2c614951199ffef0a3f12669d729b25376" + ] +} diff --git a/esy.lock/opam/dune.1.11.3/opam b/esy.lock/opam/dune.2.8.2/opam similarity index 52% rename from esy.lock/opam/dune.1.11.3/opam rename to esy.lock/opam/dune.2.8.2/opam index af3286b..da9bacb 100644 --- a/esy.lock/opam/dune.1.11.3/opam +++ b/esy.lock/opam/dune.2.8.2/opam @@ -1,14 +1,14 @@ opam-version: "2.0" -synopsis: "Fast, portable and opinionated build system" +synopsis: "Fast, portable, and opinionated build system" description: """ dune is a build system that was designed to simplify the release of Jane Street packages. It reads metadata from "dune" files following a very simple s-expression syntax. -dune is fast, it has very low-overhead and support parallel builds on -all platforms. It has no system dependencies, all you need to build -dune and packages using dune is OCaml. You don't need or make or bash +dune is fast, has very low-overhead, and supports parallel builds on +all platforms. It has no system dependencies; all you need to build +dune or packages using dune is OCaml. You don't need make or bash as long as the packages themselves don't use bash explicitly. dune supports multi-package development by simply dropping multiple @@ -25,29 +25,34 @@ license: "MIT" homepage: "https://github.com/ocaml/dune" doc: "https://dune.readthedocs.io/" bug-reports: "https://github.com/ocaml/dune/issues" -depends: [ - "ocaml" {>= "4.02"} - "base-unix" - "base-threads" -] conflicts: [ - "jbuilder" {!= "transition"} + "merlin" {< "3.4.0"} + "ocaml-lsp-server" {< "1.3.0"} + "dune-configurator" {< "2.3.0"} "odoc" {< "1.3.0"} "dune-release" {< "1.3.0"} + "js_of_ocaml-compiler" {< "3.6.0"} + "jbuilder" {= "transition"} ] dev-repo: "git+https://github.com/ocaml/dune.git" build: [ # opam 2 sets OPAM_SWITCH_PREFIX, so we don't need a hardcoded path ["ocaml" "configure.ml" "--libdir" lib] {opam-version < "2"} - ["ocaml" "bootstrap.ml"] - ["./boot.exe" "--release" "--subst"] {pinned} - ["./boot.exe" "--release" "-j" jobs] + ["ocaml" "bootstrap.ml" "-j" jobs] + ["./dune.exe" "build" "-p" name "--profile" "dune-bootstrap" "-j" jobs] +] +depends: [ + # Please keep the lower bound in sync with .github/workflows/workflow.yml, + # dune-project and min_ocaml_version in bootstrap.ml + ("ocaml" {>= "4.08"} | ("ocaml" {< "4.08~~"} & "ocamlfind-secondary")) + "base-unix" + "base-threads" ] +x-commit-hash: "6c471da57bea666267a8a63034aed57962f378b0" url { - src: - "https://github.com/ocaml/dune/releases/download/1.11.3/dune-build-info-1.11.3.tbz" + src: "https://github.com/ocaml/dune/releases/download/2.8.2/dune-2.8.2.tbz" checksum: [ - "sha256=c83a63e7e8245611b0e11d6adea07c6484dc1b4efffacb176315cd6674d4bbd2" - "sha512=2c1532b91d223e6ea0628c5f5174792c1bb4113a464f6d8b878b3c58be1136beb84ba2d9883a330fa20e550367588aa923ba06ffb9b615a098a21374a9377e81" + "sha256=e2c4e8230f7c96236503fd75f22bdbc263639971bf104509e446855ded35ae1e" + "sha512=d3cca73f5a72440273f7b4e3934dfa7e89fcb64710f3c734d2583123f5d9f3e573f0ab96a4892b2f11313038da6b4e2c614951199ffef0a3f12669d729b25376" ] } diff --git a/esy.lock/opam/gen.0.5.2/opam b/esy.lock/opam/gen.0.5.2/opam deleted file mode 100644 index 96c3da0..0000000 --- a/esy.lock/opam/gen.0.5.2/opam +++ /dev/null @@ -1,29 +0,0 @@ -opam-version: "2.0" -synopsis: "Iterators for OCaml, both restartable and consumable" -maintainer: "simon.cruanes.2007@m4x.org" -authors: ["Simon Cruanes" "ELLIOTTCABLE"] -tags: ["gen" "iterator" "iter" "fold"] -homepage: "https://github.com/c-cube/gen/" -doc: "https://c-cube.github.io/gen/" -bug-reports: "https://github.com/c-cube/gen/issues" -depends: [ - "dune" - "base-bytes" - "odoc" {with-doc} - "qtest" {with-test} - "qcheck" {with-test} - "qtest" {with-test} -] -build: [ - ["dune" "build" "@install" "-p" name] - ["dune" "runtest" "-p" name] {with-test} - ["dune" "build" "@doc" "-p" name] {with-doc} -] -dev-repo: "git+https://github.com/c-cube/gen.git" -url { - src: "https://github.com/c-cube/gen/archive/0.5.2.tar.gz" - checksum: [ - "md5=dd731ef527022ea698955db687e6cb5f" - "sha512=c84e5ea0c9b3a678b6a5c935eacf91265a79b68a48375c44aa5f159d4cb02283c1be0786e172a153666c670bc7ee37b931004b8747a99e5f4ab90ca63e097ff5" - ] -} \ No newline at end of file diff --git a/esy.lock/opam/gen.0.5.3/opam b/esy.lock/opam/gen.0.5.3/opam new file mode 100644 index 0000000..051969d --- /dev/null +++ b/esy.lock/opam/gen.0.5.3/opam @@ -0,0 +1,30 @@ +opam-version: "2.0" +maintainer: "simon.cruanes.2007@m4x.org" +synopsis: "Iterators for OCaml, both restartable and consumable" +build: [ + ["dune" "build" "@install" "-p" name "-j" jobs] + ["dune" "runtest" "-p" name "-j" jobs] {with-test} + ["dune" "build" "@doc" "-p" name "-j" jobs] {with-doc} +] +depends: [ + "dune" {>= "1.1"} + "dune-configurator" + "base-bytes" + "odoc" {with-doc} + "qcheck" {with-test & < "0.14"} + "qtest" {with-test} + "ocaml" { >= "4.03.0" } +] +tags: [ "gen" "iterator" "iter" "fold" ] +homepage: "https://github.com/c-cube/gen/" +doc: "https://c-cube.github.io/gen/" +bug-reports: "https://github.com/c-cube/gen/issues" +dev-repo: "git+https://github.com/c-cube/gen.git" +authors: ["Simon Cruanes" "ELLIOTTCABLE"] +url { + src: "https://github.com/c-cube/gen/archive/0.5.3.tar.gz" + checksum: [ + "md5=f242db157222474b9715fef49a1259a4" + "sha512=192178de106d2ae5f936caead8b21b4b9ec1b8fe35ba56296825900ea15a4ea702caf8824ac34d4478d107b954e22c3dffd81f12d4c08fbd6d9760f49a0deb14" + ] +} diff --git a/esy.lock/opam/merlin.3.3.2/opam b/esy.lock/opam/merlin.3.4.2/opam similarity index 77% rename from esy.lock/opam/merlin.3.3.2/opam rename to esy.lock/opam/merlin.3.4.2/opam index 47fb8f5..3e22916 100644 --- a/esy.lock/opam/merlin.3.3.2/opam +++ b/esy.lock/opam/merlin.3.4.2/opam @@ -1,5 +1,4 @@ opam-version: "2.0" -name: "merlin" maintainer: "defree@gmail.com" authors: "The Merlin team" homepage: "https://github.com/ocaml/merlin" @@ -8,13 +7,17 @@ dev-repo: "git+https://github.com/ocaml/merlin.git" build: [ ["dune" "subst"] {pinned} ["dune" "build" "-p" name "-j" jobs] + ["dune" "runtest" "-p" name "-j" "1"] {with-test & ocaml:version >= "4.03"} ] depends: [ - "ocaml" {>= "4.02.1" & < "4.09"} + "ocaml" {>= "4.02.3" & < "4.12"} "dune" {>= "1.8.0"} - "ocamlfind" {>= "1.5.2"} - "yojson" + "dot-merlin-reader" {= version} + "yojson" {>= "1.6.0"} "mdx" {with-test & >= "1.3.0"} + "conf-jq" {with-test} + "csexp" {>= "1.2.3"} + "result" {>= "1.5"} ] synopsis: "Editor helper, provides completion, typing and source browsing in Vim and Emacs" @@ -60,11 +63,12 @@ See https://github.com/OCamlPro/opam-user-setup " {success & !user-setup:installed} ] +x-commit-hash: "c9761a552380838e9f530b5c47c0ea3c47c33565" url { src: - "https://github.com/ocaml/merlin/releases/download/v3.3.2/merlin-v3.3.2.tbz" + "https://github.com/ocaml/merlin/releases/download/v3.4.2/merlin-v3.4.2.tbz" checksum: [ - "sha256=1d1c71e663b1e58acf19069cebd1e8d18f7dbe513c6065347d162cdd2c2de801" - "sha512=3ae021669808a40b4449f1cbdaca40b605ea5779a6204addd8b0ee4af9f14f528d55ca43a8dd3c7d547fb8e4cb256c09a9151d5559ef24dad83b5ab05aa146a2" + "sha256=e1b7b897b11119d92995c558530149fd07bd67a4aaf140f55f3c4ffb5e882a81" + "sha512=7c39c70fc923971c4eca9432061077941498574c0b804efc20af244c1c9ab34c9178d7eb50ab750feaac30696e7ff911a0ccd5fb86341b68485bedae472aa15f" ] } diff --git a/esy.lock/opam/ocaml-migrate-parsetree.1.4.0/opam b/esy.lock/opam/ocaml-migrate-parsetree.1.8.0/opam similarity index 76% rename from esy.lock/opam/ocaml-migrate-parsetree.1.4.0/opam rename to esy.lock/opam/ocaml-migrate-parsetree.1.8.0/opam index 4152207..fbf553a 100644 --- a/esy.lock/opam/ocaml-migrate-parsetree.1.4.0/opam +++ b/esy.lock/opam/ocaml-migrate-parsetree.1.8.0/opam @@ -27,11 +27,12 @@ This library converts parsetrees, outcometree and ast mappers between different OCaml versions. High-level functions help making PPX rewriters independent of a compiler version. """ +x-commit-hash: "1d72648812bb235d1576f483cacdf546e25c03d8" url { src: - "https://github.com/ocaml-ppx/ocaml-migrate-parsetree/releases/download/v1.4.0/ocaml-migrate-parsetree-v1.4.0.tbz" + "https://github.com/ocaml-ppx/ocaml-migrate-parsetree/releases/download/v1.8.0/ocaml-migrate-parsetree-v1.8.0.tbz" checksum: [ - "sha256=231fbdc205187b3ee266b535d9cfe44b599067b2f6e97883c782ea7bb577d3b8" - "sha512=61ee91d2d146cc2d2ff2d5dc4ef5dea4dc4d3c8dbd8b4c9586d64b6ad7302327ab35547aa0a5b0103c3f07b66b13d416a1bee6d4d117293cd3cabe44113ec6d4" + "sha256=b1c2d176ff1444041f2775786ba605be796e46dfd2acb06c96f35d2bb88b8fb5" + "sha512=c14ffacbba9fda34243b3e8310ce49414415b530bbd982eaa6c1891517c5a9a6a35887afa7d6f15f7f94e225a7f15cc25417fd3337e685d4a7d6ee160e50e66e" ] } diff --git a/esy.lock/opam/ocamlbuild.0.14.0/opam b/esy.lock/opam/ocamlbuild.0.14.0/opam new file mode 100644 index 0000000..8deabee --- /dev/null +++ b/esy.lock/opam/ocamlbuild.0.14.0/opam @@ -0,0 +1,36 @@ +opam-version: "2.0" +maintainer: "Gabriel Scherer " +authors: ["Nicolas Pouillard" "Berke Durak"] +homepage: "https://github.com/ocaml/ocamlbuild/" +bug-reports: "https://github.com/ocaml/ocamlbuild/issues" +license: "LGPL-2.1-only with OCaml-LGPL-linking-exception" +doc: "https://github.com/ocaml/ocamlbuild/blob/master/manual/manual.adoc" +dev-repo: "git+https://github.com/ocaml/ocamlbuild.git" +build: [ + [ + make + "-f" + "configure.make" + "all" + "OCAMLBUILD_PREFIX=%{prefix}%" + "OCAMLBUILD_BINDIR=%{bin}%" + "OCAMLBUILD_LIBDIR=%{lib}%" + "OCAMLBUILD_MANDIR=%{man}%" + "OCAML_NATIVE=%{ocaml:native}%" + "OCAML_NATIVE_TOOLS=%{ocaml:native}%" + ] + [make "check-if-preinstalled" "all" "opam-install"] +] +conflicts: [ + "base-ocamlbuild" + "ocamlfind" {< "1.6.2"} +] +synopsis: + "OCamlbuild is a build system with builtin rules to easily build most OCaml projects." +depends: [ + "ocaml" {>= "4.03"} +] +url { + src: "https://github.com/ocaml/ocamlbuild/archive/0.14.0.tar.gz" + checksum: "sha256=87b29ce96958096c0a1a8eeafeb6268077b2d11e1bf2b3de0f5ebc9cf8d42e78" +} diff --git a/esy.lock/opam/ppx_derivers.1.2.1/opam b/esy.lock/opam/ppx_derivers.1.2.1/opam index 602bce3..3d10814 100644 --- a/esy.lock/opam/ppx_derivers.1.2.1/opam +++ b/esy.lock/opam/ppx_derivers.1.2.1/opam @@ -1,7 +1,7 @@ opam-version: "2.0" maintainer: "jeremie@dimino.org" authors: ["Jérémie Dimino"] -license: "BSD3" +license: "BSD-3-Clause" homepage: "https://github.com/ocaml-ppx/ppx_derivers" bug-reports: "https://github.com/ocaml-ppx/ppx_derivers/issues" dev-repo: "git://github.com/ocaml-ppx/ppx_derivers.git" diff --git a/esy.lock/opam/ppx_deriving.4.5/opam b/esy.lock/opam/ppx_deriving.4.5/opam new file mode 100644 index 0000000..4bbc9c9 --- /dev/null +++ b/esy.lock/opam/ppx_deriving.4.5/opam @@ -0,0 +1,35 @@ +opam-version: "2.0" +maintainer: "thierry.martinez@inria.fr" +authors: [ "whitequark " ] +license: "MIT" +homepage: "https://github.com/ocaml-ppx/ppx_deriving" +doc: "https://ocaml-ppx.github.io/ppx_deriving/" +bug-reports: "https://github.com/ocaml-ppx/ppx_deriving/issues" +dev-repo: "git+https://github.com/ocaml-ppx/ppx_deriving.git" +tags: [ "syntax" ] +build: [ + ["dune" "subst"] {dev} + ["dune" "build" "-p" name "-j" jobs] + ["dune" "runtest" "-p" name "-j" jobs] {with-test} + ["dune" "build" "@doc" "-p" name "-j" jobs] {with-doc} +] +depends: [ + "dune" {>= "1.6.3"} + "cppo" {build} + "ppxfind" {build} + "ocaml-migrate-parsetree" {< "2.0.0"} + "ppx_derivers" + "ppx_tools" {>= "4.02.3"} + "result" + "ounit" {with-test} + "ocaml" {>= "4.02" & < "4.13.0"} +] +synopsis: "Type-driven code generation for OCaml >=4.02.2" +description: """ +ppx_deriving provides common infrastructure for generating +code based on type definitions, and a set of useful plugins +for common tasks. +""" +url { + src: "https://github.com/ocaml-ppx/ppx_deriving/archive/v4.5.tar.gz" + checksum: "sha512=f79153c5231ba1e03a3491fde95ca82ecb62fe05b60a649a374d2fbc5ea5dd9242126de7dfbe917c22fd7077c026c940e18c6b36c5ce0ec4bb6e07f11d2b710b"} diff --git a/esy.lock/opam/ppx_gen_rec.1.1.0/opam b/esy.lock/opam/ppx_gen_rec.1.1.0/opam new file mode 100644 index 0000000..321ab48 --- /dev/null +++ b/esy.lock/opam/ppx_gen_rec.1.1.0/opam @@ -0,0 +1,27 @@ +opam-version: "2.0" +maintainer: "Marshall Roch " +authors: ["Marshall Roch "] +license: "MIT" +homepage: "https://github.com/flowtype/ocaml-ppx_gen_rec" +bug-reports: "https://github.com/flowtype/ocaml-ppx_gen_rec/issues" +depends: [ + "ocaml" + "dune" + "ocaml-migrate-parsetree" {>= "1.1.0" & < "2.0.0"} +] +build: ["dune" "build" "-p" name "-j" jobs] +dev-repo: "git+https://github.com/flowtype/ocaml-ppx_gen_rec.git" +synopsis: "A ppx rewriter that transforms a recursive module expression into a `struct`" +description: """ +In a recursive module expression, the struct can be derived from the signature automatically +by the compiler. This package does the same thing, but doing it this way allows ppx_deriving +to transform the signature and struct separately. +""" +url { + src: + "https://github.com/flowtype/ocaml-ppx_gen_rec/releases/download/v1.1.0/ppx_gen_rec-v1.1.0.tbz" + checksum: [ + "sha256=7061496354023c182f189f02ee3dc5a8ae54dbb75b66a5effb09226ce722913b" + "sha512=37dded76035765673947d1d5d5e49ae7d36f80baaf7b5315d78e1392546c93d12ee164ce23baec6007879d3a8277c860c130d27b09be77b0caf736c7144881f0" + ] +} diff --git a/esy.lock/opam/ppx_tools.6.3/opam b/esy.lock/opam/ppx_tools.6.3/opam new file mode 100644 index 0000000..621425b --- /dev/null +++ b/esy.lock/opam/ppx_tools.6.3/opam @@ -0,0 +1,24 @@ +opam-version: "2.0" +synopsis: "Tools for authors of ppx rewriters and other syntactic tools" +maintainer: "Kate " +authors: "Alain Frisch " +license: "MIT" +tags: [ "syntax" ] +homepage: "https://github.com/ocaml-ppx/ppx_tools" +bug-reports: "https://github.com/ocaml-ppx/ppx_tools/issues" +dev-repo: "git+https://github.com/ocaml-ppx/ppx_tools.git" +build: ["dune" "build" "-p" name "-j" jobs] +depends: [ + "ocaml" {>= "4.08.0" & < "4.13.0"} + "dune" {>= "1.6"} + "cppo" {build} +] +url { + src: + "https://github.com/ocaml-ppx/ppx_tools/releases/download/6.3/ppx_tools-6.3.tbz" + checksum: [ + "sha256=f6f37ff7ffda48606fa3ceb1756ad8f7312e3ca1f12e8c1349686f468a621f58" + "sha512=103102a1bf0fcc1335d53199d576b9c433222b5daaa17c13af93dab30aba0a0193965f1f7c9fd168c62f181aa10233670286e53775e9adf11f5a27cbdb18dc24" + ] +} +x-commit-hash: "108b134c0bf9a3b352d4153a78f370055521c86d" diff --git a/esy.lock/opam/ppx_tools_versioned.5.4.0/opam b/esy.lock/opam/ppx_tools_versioned.5.4.0/opam new file mode 100644 index 0000000..9305dd1 --- /dev/null +++ b/esy.lock/opam/ppx_tools_versioned.5.4.0/opam @@ -0,0 +1,27 @@ +opam-version: "2.0" +version: "5.4.0" +maintainer: "frederic.bour@lakaban.net" +authors: [ + "Frédéric Bour " + "Alain Frisch " +] +license: "MIT" +homepage: "https://github.com/ocaml-ppx/ppx_tools_versioned" +bug-reports: "https://github.com/ocaml-ppx/ppx_tools_versioned/issues" +dev-repo: "git://github.com/ocaml-ppx/ppx_tools_versioned.git" +tags: [ "syntax" ] +build: [ + ["dune" "subst"] {pinned} + ["dune" "build" "-p" name "-j" jobs] + ["dune" "runtest" "-p" name "-j" jobs] {with-test} +] +depends: [ + "ocaml" {>= "4.02.0"} + "dune" {>= "1.0"} + "ocaml-migrate-parsetree" {>= "1.7.0" & < "2.0.0"} +] +synopsis: "A variant of ppx_tools based on ocaml-migrate-parsetree" +url { + src: "https://github.com/ocaml-ppx/ppx_tools_versioned/archive/5.4.0.tar.gz" + checksum: "md5=3e809a11cae99f57c051d3d0100311f6" +} diff --git a/esy.lock/opam/ppxfind.1.4/opam b/esy.lock/opam/ppxfind.1.4/opam new file mode 100644 index 0000000..57eefe4 --- /dev/null +++ b/esy.lock/opam/ppxfind.1.4/opam @@ -0,0 +1,41 @@ +opam-version: "2.0" +synopsis: "Tool combining ocamlfind and ppx" +description: """ +Ppxfind is a small command line tool that among other things allows +to use old style ppx rewriters with jbuilder. +""" +maintainer: ["Jérémie Dimino "] +authors: ["Jérémie Dimino "] +license: "BSD3" +homepage: "https://github.com/jeremiedimino/ppxfind" +doc: "https://jeremiedimino.github.io/ppxfind/" +bug-reports: "https://github.com/jeremiedimino/ppxfind/issues" +depends: [ + "dune" {>= "2.0"} + "ocaml-migrate-parsetree" {>= "1.6.0" & < "2.0.0"} + "ocamlfind" + "ocaml" {>= "4.02.3"} +] +build: [ + ["dune" "subst"] {pinned} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] +] +dev-repo: "git+https://github.com/jeremiedimino/ppxfind.git" +url { + src: + "https://github.com/jeremiedimino/ppxfind/releases/download/1.4/ppxfind-1.4.tbz" + checksum: [ + "sha256=98291c69f04f7f7b7cdad1b5d786c70fc595559d4663cc04cb711ac132db4971" + "sha512=f80b0ee09fb536aa9f154da80d06a1b68ba3b10605fb7338bd6449beb5c8d00e983bf66b4a63e12659ae1410fea56d0a2c4cfd43584616438504628035bcb981" + ] +} diff --git a/esy.lock/opam/result.1.4/opam b/esy.lock/opam/result.1.5/opam similarity index 80% rename from esy.lock/opam/result.1.4/opam rename to esy.lock/opam/result.1.5/opam index f0e9aa7..671af04 100644 --- a/esy.lock/opam/result.1.4/opam +++ b/esy.lock/opam/result.1.5/opam @@ -4,7 +4,7 @@ authors: ["Jane Street Group, LLC "] homepage: "https://github.com/janestreet/result" dev-repo: "git+https://github.com/janestreet/result.git" bug-reports: "https://github.com/janestreet/result/issues" -license: "BSD3" +license: "BSD-3-Clause" build: [["dune" "build" "-p" name "-j" jobs]] depends: [ "ocaml" @@ -17,6 +17,6 @@ while staying compatible with older version of OCaml should use the Result module defined in this library.""" url { src: - "https://github.com/janestreet/result/archive/1.4.tar.gz" - checksum: "md5=d3162dbc501a2af65c8c71e0866541da" + "https://github.com/janestreet/result/releases/download/1.5/result-1.5.tbz" + checksum: "md5=1b82dec78849680b49ae9a8a365b831b" } diff --git a/esy.lock/opam/sedlex.2.2/opam b/esy.lock/opam/sedlex.2.2/opam new file mode 100644 index 0000000..56ba5a3 --- /dev/null +++ b/esy.lock/opam/sedlex.2.2/opam @@ -0,0 +1,38 @@ +opam-version: "2.0" +synopsis: "An OCaml lexer generator for Unicode" +description: " +sedlex is a lexer generator for OCaml. It is similar to ocamllex, but supports +Unicode. Unlike ocamllex, sedlex allows lexer specifications within regular +OCaml source files. Lexing specific constructs are provided via a ppx syntax +extension. +" +license: "MIT" +doc: "https://ocaml-community.github.io/sedlex/index.html" +maintainer: "Alain Frisch " +authors: [ + "Alain Frisch " + "https://github.com/ocaml-community/sedlex/graphs/contributors" +] +homepage: "https://github.com/ocaml-community/sedlex" +dev-repo: "git+https://github.com/ocaml-community/sedlex.git" +bug-reports: "https://github.com/ocaml-community/sedlex/issues" +build: [ + ["dune" "build" "-p" name "-j" jobs] + ["dune" "runtest" "-p" name "-j" jobs] {with-test} + ["dune" "build" "@doc" "-p" name "-j" jobs] {with-doc} +] +depends: [ + "ocaml" {>= "4.02.3"} + "dune" {>= "1.8"} + "ppx_tools_versioned" {>= "5.2.3"} + "ocaml-migrate-parsetree" {< "2.0.0"} + "gen" + "uchar" +] +url { + src: "https://github.com/ocaml-community/sedlex/archive/v2.2.tar.gz" + checksum: [ + "md5=5bb2b819ac42959b8d7583abd2a2e610" + "sha512=c38940654d8d2a4b8f627bc9109b0fd983c520d8db05bf4b514ddc05cf50946c086d3558dfced64cc8f2b4eaabc6155426eb44ee6d903e3520ebb65daadf990a" + ] +} diff --git a/esy.lock/opam/uchar.0.0.2/opam b/esy.lock/opam/uchar.0.0.2/opam new file mode 100644 index 0000000..428d7aa --- /dev/null +++ b/esy.lock/opam/uchar.0.0.2/opam @@ -0,0 +1,36 @@ +opam-version: "2.0" +maintainer: "Daniel Bünzli " +authors: ["Daniel Bünzli "] +homepage: "http://ocaml.org" +doc: "https://ocaml.github.io/uchar/" +dev-repo: "git+https://github.com/ocaml/uchar.git" +bug-reports: "https://github.com/ocaml/uchar/issues" +tags: [ "text" "character" "unicode" "compatibility" "org:ocaml.org" ] +license: "typeof OCaml system" +depends: [ + "ocaml" {>= "3.12.0"} + "ocamlbuild" {build} +] +build: [ + ["ocaml" "pkg/git.ml"] + [ + "ocaml" + "pkg/build.ml" + "native=%{ocaml:native}%" + "native-dynlink=%{ocaml:native-dynlink}%" + ] +] +synopsis: "Compatibility library for OCaml's Uchar module" +description: """ +The `uchar` package provides a compatibility library for the +[`Uchar`][1] module introduced in OCaml 4.03. + +The `uchar` package is distributed under the license of the OCaml +compiler. See [LICENSE](LICENSE) for details. + +[1]: http://caml.inria.fr/pub/docs/manual-ocaml/libref/Uchar.html""" +url { + src: + "https://github.com/ocaml/uchar/releases/download/v0.0.2/uchar-0.0.2.tbz" + checksum: "md5=c9ba2c738d264c420c642f7bb1cf4a36" +} diff --git a/esy.lock/overrides/opam__s__conf_m4_opam__c__1_opam_override/package.json b/esy.lock/overrides/opam__s__conf_m4_opam__c__1_opam_override/package.json new file mode 100644 index 0000000..ca6a373 --- /dev/null +++ b/esy.lock/overrides/opam__s__conf_m4_opam__c__1_opam_override/package.json @@ -0,0 +1,6 @@ +{ + "build": "true", + "dependencies": { + "esy-m4": "esy-packages/esy-m4#c7cf0ac9221be2b1f9d90e83559ca08397a629e7" + } +} diff --git a/esy.lock/overrides/opam__s__dune_opam__c__1.11.3_opam_override/package.json b/esy.lock/overrides/opam__s__dune_opam__c__1.11.3_opam_override/package.json deleted file mode 100644 index 064c7e3..0000000 --- a/esy.lock/overrides/opam__s__dune_opam__c__1.11.3_opam_override/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "build": [ - [ - "ocaml", - "bootstrap.ml" - ], - [ - "./boot.exe", - "--release", - "-j", - "4" - ] - ] -} diff --git a/esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.0_opam_override/files/ocamlbuild-0.14.0.patch b/esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.0_opam_override/files/ocamlbuild-0.14.0.patch new file mode 100644 index 0000000..4d5bea0 --- /dev/null +++ b/esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.0_opam_override/files/ocamlbuild-0.14.0.patch @@ -0,0 +1,463 @@ +--- ./Makefile ++++ ./Makefile +@@ -213,7 +213,7 @@ + rm -f man/ocamlbuild.1 + + man/options_man.byte: src/ocamlbuild_pack.cmo +- $(OCAMLC) $^ -I src man/options_man.ml -o man/options_man.byte ++ $(OCAMLC) -I +unix unix.cma $^ -I src man/options_man.ml -o man/options_man.byte + + clean:: + rm -f man/options_man.cm* +--- ./src/command.ml ++++ ./src/command.ml +@@ -148,9 +148,10 @@ + let self = string_of_command_spec_with_calls call_with_tags call_with_target resolve_virtuals in + let b = Buffer.create 256 in + (* The best way to prevent bash from switching to its windows-style +- * quote-handling is to prepend an empty string before the command name. *) ++ * quote-handling is to prepend an empty string before the command name. ++ * space seems to work, too - and the ouput is nicer *) + if Sys.os_type = "Win32" then +- Buffer.add_string b "''"; ++ Buffer.add_char b ' '; + let first = ref true in + let put_space () = + if !first then +@@ -260,7 +261,7 @@ + + let execute_many ?(quiet=false) ?(pretend=false) cmds = + add_parallel_stat (List.length cmds); +- let degraded = !*My_unix.is_degraded || Sys.os_type = "Win32" in ++ let degraded = !*My_unix.is_degraded in + let jobs = !jobs in + if jobs < 0 then invalid_arg "jobs < 0"; + let max_jobs = if jobs = 0 then None else Some jobs in +--- ./src/findlib.ml ++++ ./src/findlib.ml +@@ -66,9 +66,6 @@ + (fun command -> lexer & Lexing.from_string & run_and_read command) + command + +-let run_and_read command = +- Printf.ksprintf run_and_read command +- + let rec query name = + try + Hashtbl.find packages name +@@ -135,7 +132,8 @@ + with Not_found -> s + + let list () = +- List.map before_space (split_nl & run_and_read "%s list" ocamlfind) ++ let cmd = Shell.quote_filename_if_needed ocamlfind ^ " list" in ++ List.map before_space (split_nl & run_and_read cmd) + + (* The closure algorithm is easy because the dependencies are already closed + and sorted for each package. We only have to make the union. We could also +--- ./src/main.ml ++++ ./src/main.ml +@@ -162,6 +162,9 @@ + Tags.mem "traverse" tags + || List.exists (Pathname.is_prefix path_name) !Options.include_dirs + || List.exists (Pathname.is_prefix path_name) target_dirs) ++ && ((* beware: !Options.build_dir is an absolute directory *) ++ Pathname.normalize !Options.build_dir ++ <> Pathname.normalize (Pathname.pwd/path_name)) + end + end + end +--- ./src/my_std.ml ++++ ./src/my_std.ml +@@ -271,13 +271,107 @@ + try Array.iter (fun x -> if x = basename then raise Exit) a; false + with Exit -> true + ++let command_plain = function ++| [| |] -> 0 ++| margv -> ++ let rec waitpid a b = ++ match Unix.waitpid a b with ++ | exception (Unix.Unix_error(Unix.EINTR,_,_)) -> waitpid a b ++ | x -> x ++ in ++ let pid = Unix.(create_process margv.(0) margv stdin stdout stderr) in ++ let pid', process_status = waitpid [] pid in ++ assert (pid = pid'); ++ match process_status with ++ | Unix.WEXITED n -> n ++ | Unix.WSIGNALED _ -> 2 (* like OCaml's uncaught exceptions *) ++ | Unix.WSTOPPED _ -> 127 ++ ++(* can't use Lexers because of circular dependency *) ++let split_path_win str = ++ let rec aux pos = ++ try ++ let i = String.index_from str pos ';' in ++ let len = i - pos in ++ if len = 0 then ++ aux (succ i) ++ else ++ String.sub str pos (i - pos) :: aux (succ i) ++ with Not_found | Invalid_argument _ -> ++ let len = String.length str - pos in ++ if len = 0 then [] else [String.sub str pos len] ++ in ++ aux 0 ++ ++let windows_shell = lazy begin ++ let rec iter = function ++ | [] -> [| "bash.exe" ; "--norc" ; "--noprofile" |] ++ | hd::tl -> ++ let dash = Filename.concat hd "dash.exe" in ++ if Sys.file_exists dash then [|dash|] else ++ let bash = Filename.concat hd "bash.exe" in ++ if Sys.file_exists bash = false then iter tl else ++ (* if sh.exe and bash.exe exist in the same dir, choose sh.exe *) ++ let sh = Filename.concat hd "sh.exe" in ++ if Sys.file_exists sh then [|sh|] else [|bash ; "--norc" ; "--noprofile"|] ++ in ++ split_path_win (try Sys.getenv "PATH" with Not_found -> "") |> iter ++end ++ ++let prep_windows_cmd cmd = ++ (* workaround known ocaml bug, remove later *) ++ if String.contains cmd '\t' && String.contains cmd ' ' = false then ++ " " ^ cmd ++ else ++ cmd ++ ++let run_with_shell = function ++| "" -> 0 ++| cmd -> ++ let cmd = prep_windows_cmd cmd in ++ let shell = Lazy.force windows_shell in ++ let qlen = Filename.quote cmd |> String.length in ++ (* old versions of dash had problems with bs *) ++ try ++ if qlen < 7_900 then ++ command_plain (Array.append shell [| "-ec" ; cmd |]) ++ else begin ++ (* it can still work, if the called command is a cygwin tool *) ++ let ch_closed = ref false in ++ let file_deleted = ref false in ++ let fln,ch = ++ Filename.open_temp_file ++ ~mode:[Open_binary] ++ "ocamlbuildtmp" ++ ".sh" ++ in ++ try ++ let f_slash = String.map ( fun x -> if x = '\\' then '/' else x ) fln in ++ output_string ch cmd; ++ ch_closed:= true; ++ close_out ch; ++ let ret = command_plain (Array.append shell [| "-e" ; f_slash |]) in ++ file_deleted:= true; ++ Sys.remove fln; ++ ret ++ with ++ | x -> ++ if !ch_closed = false then ++ close_out_noerr ch; ++ if !file_deleted = false then ++ (try Sys.remove fln with _ -> ()); ++ raise x ++ end ++ with ++ | (Unix.Unix_error _) as x -> ++ (* Sys.command doesn't raise an exception, so run_with_shell also won't ++ raise *) ++ Printexc.to_string x ^ ":" ^ cmd |> prerr_endline; ++ 1 ++ + let sys_command = +- match Sys.os_type with +- | "Win32" -> fun cmd -> +- if cmd = "" then 0 else +- let cmd = "bash --norc -c " ^ Filename.quote cmd in +- Sys.command cmd +- | _ -> fun cmd -> if cmd = "" then 0 else Sys.command cmd ++ if Sys.win32 then run_with_shell ++ else fun cmd -> if cmd = "" then 0 else Sys.command cmd + + (* FIXME warning fix and use Filename.concat *) + let filename_concat x y = +--- ./src/my_std.mli ++++ ./src/my_std.mli +@@ -69,3 +69,6 @@ + + val split_ocaml_version : (int * int * int * string) option + (** (major, minor, patchlevel, rest) *) ++ ++val windows_shell : string array Lazy.t ++val prep_windows_cmd : string -> string +--- ./src/ocamlbuild_executor.ml ++++ ./src/ocamlbuild_executor.ml +@@ -34,6 +34,8 @@ + job_stdin : out_channel; + job_stderr : in_channel; + job_buffer : Buffer.t; ++ job_pid : int; ++ job_tmp_file: string option; + mutable job_dying : bool; + };; + +@@ -76,6 +78,61 @@ + in + loop 0 + ;; ++ ++let open_process_full_win cmd env = ++ let (in_read, in_write) = Unix.pipe () in ++ let (out_read, out_write) = Unix.pipe () in ++ let (err_read, err_write) = Unix.pipe () in ++ Unix.set_close_on_exec in_read; ++ Unix.set_close_on_exec out_write; ++ Unix.set_close_on_exec err_read; ++ let inchan = Unix.in_channel_of_descr in_read in ++ let outchan = Unix.out_channel_of_descr out_write in ++ let errchan = Unix.in_channel_of_descr err_read in ++ let shell = Lazy.force Ocamlbuild_pack.My_std.windows_shell in ++ let test_cmd = ++ String.concat " " (List.map Filename.quote (Array.to_list shell)) ^ ++ "-ec " ^ ++ Filename.quote (Ocamlbuild_pack.My_std.prep_windows_cmd cmd) in ++ let argv,tmp_file = ++ if String.length test_cmd < 7_900 then ++ Array.append ++ shell ++ [| "-ec" ; Ocamlbuild_pack.My_std.prep_windows_cmd cmd |],None ++ else ++ let fln,ch = Filename.open_temp_file ~mode:[Open_binary] "ocamlbuild" ".sh" in ++ output_string ch (Ocamlbuild_pack.My_std.prep_windows_cmd cmd); ++ close_out ch; ++ let fln' = String.map (function '\\' -> '/' | c -> c) fln in ++ Array.append ++ shell ++ [| "-c" ; fln' |], Some fln in ++ let pid = ++ Unix.create_process_env argv.(0) argv env out_read in_write err_write in ++ Unix.close out_read; ++ Unix.close in_write; ++ Unix.close err_write; ++ (pid, inchan, outchan, errchan,tmp_file) ++ ++let close_process_full_win (pid,inchan, outchan, errchan, tmp_file) = ++ let delete tmp_file = ++ match tmp_file with ++ | None -> () ++ | Some x -> try Sys.remove x with Sys_error _ -> () in ++ let tmp_file_deleted = ref false in ++ try ++ close_in inchan; ++ close_out outchan; ++ close_in errchan; ++ let res = snd(Unix.waitpid [] pid) in ++ tmp_file_deleted := true; ++ delete tmp_file; ++ res ++ with ++ | x when tmp_file <> None && !tmp_file_deleted = false -> ++ delete tmp_file; ++ raise x ++ + (* ***) + (*** execute *) + (* XXX: Add test for non reentrancy *) +@@ -130,10 +187,16 @@ + (*** add_job *) + let add_job cmd rest result id = + (*display begin fun oc -> fp oc "Job %a is %s\n%!" print_job_id id cmd; end;*) +- let (stdout', stdin', stderr') = open_process_full cmd env in ++ let (pid,stdout', stdin', stderr', tmp_file) = ++ if Sys.win32 then open_process_full_win cmd env else ++ let a,b,c = open_process_full cmd env in ++ -1,a,b,c,None ++ in + incr jobs_active; +- set_nonblock (doi stdout'); +- set_nonblock (doi stderr'); ++ if not Sys.win32 then ( ++ set_nonblock (doi stdout'); ++ set_nonblock (doi stderr'); ++ ); + let job = + { job_id = id; + job_command = cmd; +@@ -143,7 +206,9 @@ + job_stdin = stdin'; + job_stderr = stderr'; + job_buffer = Buffer.create 1024; +- job_dying = false } ++ job_dying = false; ++ job_tmp_file = tmp_file; ++ job_pid = pid } + in + outputs := FDM.add (doi stdout') job (FDM.add (doi stderr') job !outputs); + jobs := JS.add job !jobs; +@@ -199,6 +264,7 @@ + try + read fd u 0 (Bytes.length u) + with ++ | Unix.Unix_error(Unix.EPIPE,_,_) when Sys.win32 -> 0 + | Unix.Unix_error(e,_,_) -> + let msg = error_message e in + display (fun oc -> fp oc +@@ -241,14 +307,19 @@ + decr jobs_active; + + (* PR#5371: we would get EAGAIN below otherwise *) +- clear_nonblock (doi job.job_stdout); +- clear_nonblock (doi job.job_stderr); +- ++ if not Sys.win32 then ( ++ clear_nonblock (doi job.job_stdout); ++ clear_nonblock (doi job.job_stderr); ++ ); + do_read ~loop:true (doi job.job_stdout) job; + do_read ~loop:true (doi job.job_stderr) job; + outputs := FDM.remove (doi job.job_stdout) (FDM.remove (doi job.job_stderr) !outputs); + jobs := JS.remove job !jobs; +- let status = close_process_full (job.job_stdout, job.job_stdin, job.job_stderr) in ++ let status = ++ if Sys.win32 then ++ close_process_full_win (job.job_pid, job.job_stdout, job.job_stdin, job.job_stderr, job.job_tmp_file) ++ else ++ close_process_full (job.job_stdout, job.job_stdin, job.job_stderr) in + + let shown = ref false in + +--- ./src/ocamlbuild_unix_plugin.ml ++++ ./src/ocamlbuild_unix_plugin.ml +@@ -48,12 +48,22 @@ + end + + let run_and_open s kont = ++ let s_orig = s in ++ let s = ++ (* Be consistent! My_unix.run_and_open uses My_std.sys_command and ++ sys_command uses bash. *) ++ if Sys.win32 = false then s else ++ let l = match Lazy.force My_std.windows_shell |> Array.to_list with ++ | hd::tl -> (Filename.quote hd)::tl ++ | _ -> assert false in ++ "\"" ^ (String.concat " " l) ^ " -ec " ^ Filename.quote (" " ^ s) ^ "\"" ++ in + let ic = Unix.open_process_in s in + let close () = + match Unix.close_process_in ic with + | Unix.WEXITED 0 -> () + | Unix.WEXITED _ | Unix.WSIGNALED _ | Unix.WSTOPPED _ -> +- failwith (Printf.sprintf "Error while running: %s" s) in ++ failwith (Printf.sprintf "Error while running: %s" s_orig) in + let res = try + kont ic + with e -> (close (); raise e) +--- ./src/options.ml ++++ ./src/options.ml +@@ -174,11 +174,24 @@ + build_dir := Filename.concat (Sys.getcwd ()) s + else + build_dir := s ++ ++let slashify = ++ if Sys.win32 then fun p -> String.map (function '\\' -> '/' | x -> x) p ++ else fun p ->p ++ ++let sb () = ++ match Sys.os_type with ++ | "Win32" -> ++ (try set_binary_mode_out stdout true with _ -> ()); ++ | _ -> () ++ ++ + let spec = ref ( + let print_version () = ++ sb (); + Printf.printf "ocamlbuild %s\n%!" Ocamlbuild_config.version; raise Exit_OK + in +- let print_vnum () = print_endline Ocamlbuild_config.version; raise Exit_OK in ++ let print_vnum () = sb (); print_endline Ocamlbuild_config.version; raise Exit_OK in + Arg.align + [ + "-version", Unit print_version , " Display the version"; +@@ -257,8 +270,8 @@ + "-build-dir", String set_build_dir, " Set build directory (implies no-links)"; + "-install-lib-dir", Set_string Ocamlbuild_where.libdir, " Set the install library directory"; + "-install-bin-dir", Set_string Ocamlbuild_where.bindir, " Set the install binary directory"; +- "-where", Unit (fun () -> print_endline !Ocamlbuild_where.libdir; raise Exit_OK), " Display the install library directory"; +- "-which", String (fun cmd -> print_endline (find_tool cmd); raise Exit_OK), " Display path to the tool command"; ++ "-where", Unit (fun () -> sb (); print_endline (slashify !Ocamlbuild_where.libdir); raise Exit_OK), " Display the install library directory"; ++ "-which", String (fun cmd -> sb (); print_endline (slashify (find_tool cmd)); raise Exit_OK), " Display path to the tool command"; + "-ocamlc", set_cmd ocamlc, " Set the OCaml bytecode compiler"; + "-plugin-ocamlc", set_cmd plugin_ocamlc, " Set the OCaml bytecode compiler \ + used when building myocamlbuild.ml (only)"; +--- ./src/pathname.ml ++++ ./src/pathname.ml +@@ -84,6 +84,26 @@ + | x :: xs -> x :: normalize_list xs + + let normalize x = ++ let x = ++ if Sys.win32 = false then ++ x ++ else ++ let len = String.length x in ++ let b = Bytes.create len in ++ for i = 0 to pred len do ++ match x.[i] with ++ | '\\' -> Bytes.set b i '/' ++ | c -> Bytes.set b i c ++ done; ++ if len > 1 then ( ++ let c1 = Bytes.get b 0 in ++ let c2 = Bytes.get b 1 in ++ if c2 = ':' && c1 >= 'a' && c1 <= 'z' && ++ ( len = 2 || Bytes.get b 2 = '/') then ++ Bytes.set b 0 (Char.uppercase_ascii c1) ++ ); ++ Bytes.unsafe_to_string b ++ in + if Glob.eval not_normal_form_re x then + let root, paths = split x in + join root (normalize_list paths) +--- ./src/shell.ml ++++ ./src/shell.ml +@@ -24,12 +24,26 @@ + | 'a'..'z' | 'A'..'Z' | '0'..'9' | '.' | '-' | '/' | '_' | ':' | '@' | '+' | ',' -> loop (pos + 1) + | _ -> false in + loop 0 ++ ++let generic_quote quotequote s = ++ let l = String.length s in ++ let b = Buffer.create (l + 20) in ++ Buffer.add_char b '\''; ++ for i = 0 to l - 1 do ++ if s.[i] = '\'' ++ then Buffer.add_string b quotequote ++ else Buffer.add_char b s.[i] ++ done; ++ Buffer.add_char b '\''; ++ Buffer.contents b ++let unix_quote = generic_quote "'\\''" ++ + let quote_filename_if_needed s = + if is_simple_filename s then s + (* We should probably be using [Filename.unix_quote] except that function + * isn't exported. Users on Windows will have to live with not being able to + * install OCaml into c:\o'caml. Too bad. *) +- else if Sys.os_type = "Win32" then Printf.sprintf "'%s'" s ++ else if Sys.os_type = "Win32" then unix_quote s + else Filename.quote s + let chdir dir = + reset_filesys_cache (); +@@ -37,7 +51,7 @@ + let run args target = + reset_readdir_cache (); + let cmd = String.concat " " (List.map quote_filename_if_needed args) in +- if !*My_unix.is_degraded || Sys.os_type = "Win32" then ++ if !*My_unix.is_degraded then + begin + Log.event cmd target Tags.empty; + let st = sys_command cmd in diff --git a/esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.0_opam_override/package.json b/esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.0_opam_override/package.json new file mode 100644 index 0000000..b24be7b --- /dev/null +++ b/esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.0_opam_override/package.json @@ -0,0 +1,27 @@ +{ + "build": [ + [ + "bash", + "-c", + "#{os == 'windows' ? 'patch -p1 < ocamlbuild-0.14.0.patch' : 'true'}" + ], + [ + "make", + "-f", + "configure.make", + "all", + "OCAMLBUILD_PREFIX=#{self.install}", + "OCAMLBUILD_BINDIR=#{self.bin}", + "OCAMLBUILD_LIBDIR=#{self.lib}", + "OCAMLBUILD_MANDIR=#{self.man}", + "OCAMLBUILD_NATIVE=true", + "OCAMLBUILD_NATIVE_TOOLS=true" + ], + [ + "make", + "check-if-preinstalled", + "all", + "#{os == 'windows' ? 'install' : 'opam-install'}" + ] + ] +} diff --git a/lib/.gitignore b/lib/.gitignore new file mode 100644 index 0000000..8c4e88b --- /dev/null +++ b/lib/.gitignore @@ -0,0 +1,8 @@ +dist/ +lex_test +parse_test +lexer_flow.ml +flow_parser.js +perf_test +pfff_test +node_modules/ diff --git a/lib/META b/lib/META new file mode 100644 index 0000000..8ebc982 --- /dev/null +++ b/lib/META @@ -0,0 +1,6 @@ +name="parser_flow" +version="0.143.1" +requires = "sedlex wtf8" +description="flow parser ocamlfind package" +archive(byte)="parser_flow.cma" +archive(native)="parser_flow.cmxa" diff --git a/lib/Makefile b/lib/Makefile new file mode 100644 index 0000000..613cb39 --- /dev/null +++ b/lib/Makefile @@ -0,0 +1,129 @@ +# Copyright (c) Facebook, Inc. and its affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +DIR:=$(dir $(abspath $(lastword $(MAKEFILE_LIST)))) +TOP=$(DIR)/../.. +REL_DIR=src/parser + +OCB = ocamlbuild -use-ocamlfind + +NATIVE_OBJECT_FILES=\ + src/hack_forked/utils/sys/files.o\ + src/hack_forked/utils/sys/gc_profiling.o\ + src/hack_forked/utils/sys/getrusage.o\ + src/hack_forked/utils/sys/nproc.o\ + src/hack_forked/utils/sys/realpath.o\ + src/hack_forked/utils/sys/sysinfo.o\ + src/hack_forked/utils/sys/processor_info.o\ + src/hack_forked/utils/sys/priorities.o + +RUNNER_DEPS=\ + src/heap\ + src/hack_forked/injection/default_injector\ + src/hack_forked/third-party/core\ + src/hack_forked/utils/collections\ + src/hack_forked/utils/core\ + src/hack_forked/utils/disk\ + src/hack_forked/utils/hh_json\ + src/hack_forked/utils/string\ + src/hack_forked/utils/sys\ + src/common/utils\ + src/parser\ + src/parser_utils + +OCAML_PATH=$(shell ocamlc -where) +OCAML_HEADERS=\ + $(sort $(patsubst $(OCAML_PATH)/%,dist/libflowparser/include/%, \ + $(filter $(OCAML_PATH)/%,$(shell \ + $(CC) -I $(OCAML_PATH) -MM -MT deps libflowparser.h \ + )))) + +all: build-parser + +clean: + $(OCB) -clean; \ + cd $(TOP); \ + $(OCB) -clean; \ + rm -f $(REL_DIR)/flow_parser.js; \ + rm -rf $(REL_DIR)/dist + +build-parser: + cd $(TOP); \ + $(OCB) -no-links $(REL_DIR)/parser_flow.cmxa + +.PHONY: libflowparser.native.o +libflowparser.native.o: + cd $(TOP) && $(OCB) -no-links -tag "runtime_variant(_pic)" \ + $(REL_DIR)/libflowparser.native.o + +dist/libflowparser/lib/libflowparser.a: libflowparser.native.o + @mkdir -p "$(@D)" + if [ ! -e "$@" -o "$(OCAML_PATH)/libasmrun_pic.a" -nt "$@" -o "$(TOP)/_build/$(REL_DIR)/libflowparser.native.o" -nt "$@" ]; then \ + echo "Rebuilding $@"; \ + cp "$(OCAML_PATH)/libasmrun_pic.a" "$@"; \ + ar rcs "$@" "$(TOP)/_build/$(REL_DIR)/libflowparser.native.o"; \ + else \ + echo "Not rebuilding $@, already up to date"; \ + fi + test -e "$@" || exit 1 + +$(OCAML_HEADERS): dist/libflowparser/include/%: $(OCAML_PATH)/% + @mkdir -p "$(@D)" + cp "$<" "$@" + +dist/libflowparser/include/flowparser/libflowparser.h: libflowparser.h + @mkdir -p "$(@D)" + cp "$<" "$@" + +dist/libflowparser.zip: \ + $(OCAML_HEADERS) \ + dist/libflowparser/include/flowparser/libflowparser.h \ + dist/libflowparser/lib/libflowparser.a + cd dist && zip -r $(@F) libflowparser + +js: + cd $(TOP); \ + $(OCB) -no-links -pkgs js_of_ocaml $(REL_DIR)/flow_parser_dot_js.byte; \ + [ -e "$(REL_DIR)/flow_parser.js" -a "$(REL_DIR)/flow_parser.js" -nt "_build/$(REL_DIR)/flow_parser_dot_js.byte" ] || \ + js_of_ocaml --opt 3 \ + -o $(REL_DIR)/flow_parser.js \ + _build/$(REL_DIR)/flow_parser_dot_js.byte + +test-js: js + cd $(TOP)/packages/flow-parser; npm test + +../../_build/$(REL_DIR)/test/run_tests.native: build-parser + cd $(TOP); \ + $(OCB) -no-links \ + -ocamlc "ocamlopt" \ + $(NATIVE_OBJECT_FILES); \ + $(OCB) -no-links \ + $(foreach dir,$(RUNNER_DEPS),-I $(dir)) \ + -lflags "$(NATIVE_OBJECT_FILES)" \ + $(REL_DIR)/test/run_tests.native + +test-esprima-ocaml: ../../_build/$(REL_DIR)/test/run_tests.native + cd $(TOP); \ + _build/$(REL_DIR)/test/run_tests.native $(REL_DIR)/test/esprima/ + +test-hardcoded-ocaml: ../../_build/$(REL_DIR)/test/run_tests.native + cd $(TOP); \ + _build/$(REL_DIR)/test/run_tests.native $(REL_DIR)/test/flow/ + +test-ocaml: test-esprima-ocaml test-hardcoded-ocaml + +test: test-js test-ocaml + +ocamlfind-install: + cd $(TOP); \ + $(OCB) $(REL_DIR)/parser_flow.cma $(REL_DIR)/parser_flow.cmxa; \ + ocamlfind install flow_parser $(REL_DIR)/META \ + _build/$(REL_DIR)/parser_flow.a \ + _build/$(REL_DIR)/parser_flow.cma \ + _build/$(REL_DIR)/parser_flow.cmxa \ + _build/$(REL_DIR)/*.cmi + +lexer.native: lexer.ml + $(OCB) $@ diff --git a/lib/__tests__/offset_utils_test.ml b/lib/__tests__/offset_utils_test.ml new file mode 100644 index 0000000..baa2037 --- /dev/null +++ b/lib/__tests__/offset_utils_test.ml @@ -0,0 +1,193 @@ +(* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + *) + +open OUnit2 + +let pos line column = Loc.{ line; column } + +(* UTF-8 encoding of code point 0x2028, line separator *) +let line_sep = "\xe2\x80\xa8" + +(* UTF-8 encoding of code point 0x2029, paragraph separator *) +let par_sep = "\xe2\x80\xa9" + +(* UTF-8 encoding of code point 0x1f603, some form of a smiley *) +let smiley = "\xf0\x9f\x98\x83" + +(* UTF-8 encoding of code point 0x10000, a Mycenaean Greek character. It is notable because it is + * the lowest code point which is represented as a surrogate pair in UTF-16. *) +let linear_b_syllable_b008_a = "\xf0\x90\x80\x80" + +(* UTF-8 encoding of code point 0xffff, which is a noncharacter. It is notable because it is the + * highest code point which is represented as a single code unit in UTF-16. *) +let not_a_character = "\xef\xbf\xbf" + +(* UFT-8 encoding of code point 0xfffd, a replacement character used in place of a character + * unrepresentable in Unicode. It is notable because it is the highest code point besides + * noncharacters that is represented as a single code unit in UTF-16. *) +let replacement_character = "\xef\xbf\xbd" + +let str_with_smiley = Printf.sprintf "foo %s bar\nbaz\n" smiley + +let str_with_utf16_edge_cases = + Printf.sprintf + "foo %s bar %s baz %s qux" + linear_b_syllable_b008_a + not_a_character + replacement_character + +let get_offset table pos = + try Offset_utils.offset table pos + with Offset_utils.Offset_lookup_failed (_pos, msg) -> + assert_failure + (Printf.sprintf "Lookup failed: %s\nTable:\n%s" msg (Offset_utils.debug_string table)) + +let run_with_kind ctxt text (line, col) ~kind expected_offset = + let table = Offset_utils.make ~kind text in + let offset = get_offset table (pos line col) in + assert_equal ~ctxt ~printer:string_of_int expected_offset offset + +let run ctxt text pos (utf8_expected_offset, js_expected_offset) = + run_with_kind ctxt text pos ~kind:Offset_utils.Utf8 utf8_expected_offset; + run_with_kind ctxt text pos ~kind:Offset_utils.JavaScript js_expected_offset + +let run_expect_failure_with_kind text (line, col) ~kind expected_msg = + let table = Offset_utils.make ~kind text in + let p = pos line col in + let f () = Offset_utils.offset table p in + let expected_exn = Offset_utils.Offset_lookup_failed (p, expected_msg) in + assert_raises expected_exn f + +let run_expect_failure text pos expected_msg = + run_expect_failure_with_kind text pos ~kind:Offset_utils.Utf8 expected_msg; + run_expect_failure_with_kind text pos ~kind:Offset_utils.JavaScript expected_msg + +class loc_extractor = + object (this) + inherit [Loc.t, Loc.t, unit, unit] Flow_polymorphic_ast_mapper.mapper + + (* Locations built up in reverse order *) + val mutable locs = [] + + method get_locs = locs + + method on_loc_annot loc = locs <- loc :: locs + + method on_type_annot = this#on_loc_annot + end + +let extract_locs ast = + let extractor = new loc_extractor in + let (_ : (unit, unit) Flow_ast.Program.t) = extractor#program ast in + List.rev extractor#get_locs + +(* This tests to make sure that we can find an offset for all real-world locations that the parser + * can produce, and that I haven't made any incorrect assumptions about edge cases in the rest of + * the tests. *) +let run_full_test source = + let (ast, _) = Parser_flow.program ~fail:false source in + let all_locs = extract_locs ast in + let all_positions = + Loc.( + let all_starts = List.map (fun { start; _ } -> start) all_locs in + let all_ends = List.map (fun { _end; _ } -> _end) all_locs in + all_starts @ all_ends) + in + let offset_table = Offset_utils.make ~kind:Offset_utils.Utf8 source in + (* Just make sure it doesn't crash *) + List.iter + begin + fun loc -> + let (_ : int) = get_offset offset_table loc in + () + end + all_positions + +let tests = + "offset_utils" + >::: [ + ("empty_line" >:: fun ctxt -> run ctxt "foo\n\nbar" (3, 0) (5, 5)); + ( "Loc.none" >:: fun ctxt -> + (* This is a fake location but it's used often enough that we should at least not crash when + * encountering it. *) + run ctxt "" (0, 0) (0, 0) ); + ("first_char" >:: fun ctxt -> run ctxt "foo bar\n" (1, 0) (0, 0)); + ("last_char" >:: fun ctxt -> run ctxt "foo bar\n" (1, 6) (6, 6)); + ( "column_after_last" >:: fun ctxt -> + (* The parser gives us locations where the `end` position is exclusive. Even though the last + * character of the "foo" token is in column 2, the location of "foo" is given as + * ((1, 0), (1, 3)). Because of this, we need to make sure we can look up locations that are + * after the final column of a line, even though these locations don't correspond with an actual + * character. *) + run ctxt "foo\nbar\n" (1, 3) (3, 3) ); + ( "char_after_last" >:: fun ctxt -> + (* See the comment in the previous test *) + run ctxt "foo\nbar" (2, 3) (7, 7) ); + ( "empty" >:: fun ctxt -> + (* Similar to above, we should be able to get one offset in an empty string *) + run ctxt "" (1, 0) (0, 0) ); + ("no_last_line_terminator" >:: fun ctxt -> run ctxt "foo bar" (1, 6) (6, 6)); + ("multi_line" >:: fun ctxt -> run ctxt "foo\nbar\n" (2, 1) (5, 5)); + ("carriage_return" >:: fun ctxt -> run ctxt "foo\rbar\r" (2, 1) (5, 5)); + ("windows_line_terminator" >:: fun ctxt -> run ctxt "foo\r\nbar\r\n" (2, 1) (6, 6)); + ( "unicode_line_separator" >:: fun ctxt -> + (* Each line separator character is 3 bytes, or 1 JS code unit. The returned offset + * reflects that. *) + run ctxt (Printf.sprintf "foo%sbar%s" line_sep line_sep) (2, 1) (7, 5) ); + ( "unicode_paragraph_separator" >:: fun ctxt -> + (* Each paragraph separator character is 3 bytes, or 1 JS code unit. The returned offset + * reflects that. *) + run ctxt (Printf.sprintf "foo%sbar%s" par_sep par_sep) (2, 1) (7, 5) ); + ("offset_before_multibyte_char" >:: fun ctxt -> run ctxt str_with_smiley (1, 3) (3, 3)); + ( "offset_of_multibyte_char" >:: fun ctxt -> + (* This is the position of the smiley. The offset should give us the first byte in the + * character. *) + run ctxt str_with_smiley (1, 4) (4, 4) ); + ( "offset_after_multibyte_char" >:: fun ctxt -> + (* This is the position after the smiley. The offset should reflect the width of the multibyte + * character (4 bytes in UTF-8 and 2 code units in JS in this case). *) + run ctxt str_with_smiley (1, 5) (8, 6) ); + ( "offset_line_after_multibyte_char" >:: fun ctxt -> + run ctxt str_with_smiley (2, 0) (13, 11) ); + ( "offset_of_multi_unit_utf16_char" >:: fun ctxt -> + run ctxt str_with_utf16_edge_cases (1, 4) (4, 4) ); + ( "offset_after_multi_unit_utf16_char" >:: fun ctxt -> + run ctxt str_with_utf16_edge_cases (1, 5) (8, 6) ); + ( "offset_of_single_unit_utf16_char" >:: fun ctxt -> + run ctxt str_with_utf16_edge_cases (1, 10) (13, 11) ); + ( "offset_after_single_unit_utf16_char" >:: fun ctxt -> + run ctxt str_with_utf16_edge_cases (1, 11) (16, 12) ); + ( "offset_of_single_unit_utf16_char2" >:: fun ctxt -> + run ctxt str_with_utf16_edge_cases (1, 16) (21, 17) ); + ( "offset_after_single_unit_utf16_char2" >:: fun ctxt -> + run ctxt str_with_utf16_edge_cases (1, 17) (24, 18) ); + ( "out_of_bounds_line" >:: fun _ctxt -> + run_expect_failure "foo\n" (5, 0) "Failure while looking up line. Index: 4. Length: 2." + ); + ( "out_of_bounds_column" >:: fun _ctxt -> + run_expect_failure + "foo\n" + (1, 10) + "Failure while looking up column. Index: 10. Length: 4." ); + ( "full_test" >:: fun _ctxt -> + (* Note that there is no newline at the end of the string -- I found a bug in an initial version + * which was exposed by not having a final newline character. *) + let source = "const foo = 4;\nconst bar = foo + 2;" in + run_full_test source ); + ( "lexing_error_newline_test" >:: fun _ctxt -> + let source = "\"foo\nbar\"" in + run_full_test source ); + ( "lexing_error_throw" >:: fun _ctxt -> + let source = "throw\n" in + run_full_test source ); + ( "lexing_error_regex_newline" >:: fun _ctxt -> + let source = "/\n/" in + run_full_test source ); + ( "lexing_error_complex_regex_newline" >:: fun _ctxt -> + let source = "/a\\\n/" in + run_full_test source ); + ] diff --git a/lib/__tests__/parser_tests.ml b/lib/__tests__/parser_tests.ml new file mode 100644 index 0000000..cc2cae3 --- /dev/null +++ b/lib/__tests__/parser_tests.ml @@ -0,0 +1,12 @@ +(* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + *) + +open OUnit2 + +let tests = "parser_utils" >::: [Offset_utils_test.tests] + +let () = run_test_tt_main tests diff --git a/lib/ast.ml b/lib/ast.ml deleted file mode 100644 index 98ab56e..0000000 --- a/lib/ast.ml +++ /dev/null @@ -1,1132 +0,0 @@ -(** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - *) - -(* - * An Ocaml implementation of the SpiderMonkey Parser API - * https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API - *) - -module rec Identifier : sig - type 'M t = 'M * string -end = Identifier - -and PrivateName : sig - type 'M t = 'M * 'M Identifier.t -end = PrivateName - -and Literal : sig - module RegExp : sig - type t = { - pattern: string; - flags: string; - } - end - - (* Literals also carry along their raw value *) - type t = { - value: value; - raw: string; - } - and value = - | String of string - | Boolean of bool - | Null - | Number of float - | RegExp of RegExp.t -end = Literal - -and StringLiteral : sig - type t = { - value: string; - raw: string; - } -end = StringLiteral - -and NumberLiteral : sig - type t = { - value: float; - raw: string; - } -end = NumberLiteral - -and Variance : sig - type 'M t = 'M * t' - and t' = Plus | Minus -end = Variance - -and Type : sig - module Function : sig - module Param : sig - type 'M t = 'M * 'M t' - and 'M t' = { - name: 'M Identifier.t option; - annot: 'M Type.t; - optional: bool; - } - end - module RestParam : sig - type 'M t = 'M * 'M t' - and 'M t' = { - argument: 'M Param.t - } - end - module Params : sig - type 'M t = 'M * 'M t' - and 'M t' = { - params: 'M Param.t list; - rest: 'M RestParam.t option; - } - end - type 'M t = { - tparams: 'M Type.ParameterDeclaration.t option; - params: 'M Params.t; - return: 'M Type.t; - } - end - - module Generic : sig - module Identifier : sig - type 'M t = - | Unqualified of 'M Identifier.t - | Qualified of 'M qualified - and 'M qualified = 'M * 'M qualified' - and 'M qualified' = { - qualification: 'M t; - id: 'M Identifier.t - } - end - type 'M t = { - id: 'M Identifier.t; - targs: 'M Type.ParameterInstantiation.t option; - } - end - - module Object : sig - module Property : sig - type 'M value = - | Init of 'M Type.t - | Get of ('M * 'M Function.t) - | Set of ('M * 'M Function.t) - type 'M t' = { - key: 'M Expression.Object.Property.key; - value: 'M value; - optional: bool; - static: bool; - proto: bool; - _method: bool; - variance: 'M Variance.t option; - } - type 'M t = 'M * 'M t' - end - module SpreadProperty : sig - type 'M t = 'M * 'M t' - and 'M t' = { - argument: 'M Type.t; - } - end - module Indexer: sig - type 'M t' = { - id: 'M Identifier.t option; - key: 'M Type.t; - value: 'M Type.t; - static: bool; - variance: 'M Variance.t option; - } - and 'M t = 'M * 'M t' - end - module CallProperty: sig - type 'M t = 'M * 'M t' - and 'M t' = { - value: 'M * 'M Function.t; - static: bool; - } - end - module InternalSlot: sig - type 'M t = 'M * 'M t' - and 'M t' = { - id: 'M Identifier.t; - value: 'M Type.t; - optional: bool; - static: bool; - _method: bool; - } - end - type 'M property = - | Property of 'M Property.t - | SpreadProperty of 'M SpreadProperty.t - | Indexer of 'M Indexer.t - | CallProperty of 'M CallProperty.t - | InternalSlot of 'M InternalSlot.t - type 'M t = { - exact: bool; - properties: 'M property list; - } - end - - module Interface : sig - type 'M t = { - body: 'M * 'M Object.t; - extends: ('M * 'M Generic.t) list; - } - end - - type 'M t = 'M * 'M t' - (* Yes, we could add a little complexity here to show that Any and Void - * should never be declared nullable, but that check can happen later *) - and 'M t' = - | Any - | Mixed - | Empty - | Void - | Null - | Number - | String - | Boolean - | Nullable of 'M t - | Function of 'M Function.t - | Object of 'M Object.t - | Interface of 'M Interface.t - | Array of 'M t - | Generic of 'M Generic.t - | Union of 'M t * 'M t * 'M t list - | Intersection of 'M t * 'M t * 'M t list - | Typeof of 'M t - | Tuple of 'M t list - | StringLiteral of StringLiteral.t - | NumberLiteral of NumberLiteral.t - | BooleanLiteral of bool - | Exists - - (* Type.annotation is a concrete syntax node with a location that starts at - * the colon and ends after the type. For example, "var a: number", the - * identifier a would have a property annot which contains a - * Type.annotation with a location from column 6-14 *) - and 'M annotation = 'M * 'M t - - module ParameterDeclaration : sig - module TypeParam : sig - type 'M t = 'M * 'M t' - and 'M t' = { - name: 'M Identifier.t; - bound: 'M Type.annotation option; - variance: 'M Variance.t option; - default: 'M Type.t option; - } - end - type 'M t = 'M * 'M t' - and 'M t' = 'M TypeParam.t list - end - module ParameterInstantiation : sig - type 'M t = 'M * 'M t' - and 'M t' = 'M Type.t list - end - - module Predicate : sig - type 'M t = 'M * 'M t' - and 'M t' = - | Declared of 'M Expression.t - | Inferred - end - -end = Type - -and Statement : sig - module Block : sig - type 'M t = { - body: 'M Statement.t list - } - end - module If : sig - type 'M t = { - test: 'M Expression.t; - consequent: 'M Statement.t; - alternate: 'M Statement.t option; - } - end - module Labeled : sig - type 'M t = { - label: 'M Identifier.t; - body: 'M Statement.t; - } - end - module Break : sig - type 'M t = { - label: 'M Identifier.t option; - } - end - module Continue : sig - type 'M t = { - label: 'M Identifier.t option; - } - end - module With : sig - type 'M t = { - _object: 'M Expression.t; - body: 'M Statement.t; - } - end - module TypeAlias : sig - type 'M t = { - id: 'M Identifier.t; - tparams: 'M Type.ParameterDeclaration.t option; - right: 'M Type.t; - } - end - module OpaqueType: sig - type 'M t = { - id: 'M Identifier.t; - tparams: 'M Type.ParameterDeclaration.t option; - impltype: 'M Type.t option; - supertype: 'M Type.t option; - } - end - module Switch : sig - module Case : sig - type 'M t = 'M * 'M t' - and 'M t' = { - test: 'M Expression.t option; - consequent: 'M Statement.t list; - } - end - type 'M t = { - discriminant: 'M Expression.t; - cases: 'M Case.t list; - } - end - module Return : sig - type 'M t = { - argument: 'M Expression.t option; - } - end - module Throw : sig - type 'M t = { - argument: 'M Expression.t; - } - end - module Try : sig - module CatchClause : sig - type 'M t = 'M * 'M t' - and 'M t' = { - param: 'M Pattern.t option; - body: 'M * 'M Block.t; - } - end - type 'M t = { - block: 'M * 'M Block.t; - handler: 'M CatchClause.t option; - finalizer: ('M * 'M Block.t) option; - } - end - module VariableDeclaration : sig - module Declarator : sig - type 'M t = 'M * 'M t' - and 'M t' = { - id: 'M Pattern.t; - init: 'M Expression.t option; - } - end - type kind = - | Var - | Let - | Const - type 'M t = { - declarations: 'M Declarator.t list; - kind: kind; - } - end - module While : sig - type 'M t = { - test: 'M Expression.t; - body: 'M Statement.t; - } - end - module DoWhile : sig - type 'M t = { - body: 'M Statement.t; - test: 'M Expression.t; - } - end - module For : sig - type 'M init = - | InitDeclaration of ('M * 'M VariableDeclaration.t) - | InitExpression of 'M Expression.t - type 'M t = { - init: 'M init option; - test: 'M Expression.t option; - update: 'M Expression.t option; - body: 'M Statement.t; - } - end - module ForIn : sig - type 'M left = - | LeftDeclaration of ('M * 'M VariableDeclaration.t) - | LeftPattern of 'M Pattern.t - type 'M t = { - left: 'M left; - right: 'M Expression.t; - body: 'M Statement.t; - each: bool; - } - end - module ForOf : sig - type 'M left = - | LeftDeclaration of ('M * 'M VariableDeclaration.t) - | LeftPattern of 'M Pattern.t - type 'M t = { - left: 'M left; - right: 'M Expression.t; - body: 'M Statement.t; - async: bool; - } - end - module Interface : sig - type 'M t = { - id: 'M Identifier.t; - tparams: 'M Type.ParameterDeclaration.t option; - extends: ('M * 'M Type.Generic.t) list; - body: 'M * 'M Type.Object.t; - } - end - module DeclareClass : sig - type 'M t = { - id: 'M Identifier.t; - tparams: 'M Type.ParameterDeclaration.t option; - body: 'M * 'M Type.Object.t; - extends: ('M * 'M Type.Generic.t) option; - mixins: ('M * 'M Type.Generic.t) list; - implements: 'M Class.Implements.t list; - } - end - module DeclareVariable : sig - type 'M t = { - id: 'M Identifier.t; - annot: 'M Type.annotation option; - } - end - module DeclareFunction : sig - type 'M t = { - id: 'M Identifier.t; - annot: 'M Type.annotation; - predicate: 'M Type.Predicate.t option; - } - end - module DeclareModule : sig - type 'M id = - | Identifier of 'M Identifier.t - | Literal of ('M * StringLiteral.t) - - type 'M module_kind = - | CommonJS of 'M - | ES of 'M - - type 'M t = { - id: 'M id; - body: 'M * 'M Block.t; - kind: 'M module_kind; - } - end - module ExportNamedDeclaration : sig - module ExportSpecifier : sig - type 'M t = 'M * 'M t' - and 'M t' = { - local: 'M Identifier.t; - exported: 'M Identifier.t option; - } - end - type 'M specifier = - | ExportSpecifiers of 'M ExportSpecifier.t list - | ExportBatchSpecifier of 'M * 'M Identifier.t option - type 'M t = { - declaration: 'M Statement.t option; - specifiers: 'M specifier option; - source: ('M * StringLiteral.t) option; - exportKind: Statement.exportKind; - } - end - module ExportDefaultDeclaration : sig - type 'M declaration = - | Declaration of 'M Statement.t - | Expression of 'M Expression.t - type 'M t = { - default: 'M; - declaration: 'M declaration; - } - end - module DeclareExportDeclaration : sig - type 'M declaration = - (* declare export var *) - | Variable of ('M * 'M DeclareVariable.t) - (* declare export function *) - | Function of ('M * 'M DeclareFunction.t) - (* declare export class *) - | Class of ('M * 'M DeclareClass.t) - (* declare export default [type] - * this corresponds to things like - * export default 1+1; *) - | DefaultType of 'M Type.t - (* declare export type *) - | NamedType of ('M * 'M TypeAlias.t) - (* declare export opaque type *) - | NamedOpaqueType of ('M * 'M OpaqueType.t) - (* declare export interface *) - | Interface of ('M * 'M Interface.t) - - type 'M t = { - default: 'M option; - declaration: 'M declaration option; - specifiers: 'M ExportNamedDeclaration.specifier option; - source: ('M * StringLiteral.t) option; - } - end - module ImportDeclaration : sig - type importKind = - | ImportType - | ImportTypeof - | ImportValue - - type 'M specifier = - | ImportNamedSpecifiers of 'M named_specifier list - | ImportNamespaceSpecifier of ('M * 'M Identifier.t) - and 'M named_specifier = { - kind: importKind option; - local: 'M Identifier.t option; - remote: 'M Identifier.t; - } - - type 'M t = { - importKind: importKind; - source: ('M * StringLiteral.t); - default: 'M Identifier.t option; - specifiers: 'M specifier option; - } - end - module Expression : sig - type 'M t = { - expression: 'M Expression.t; - directive: string option; - } - end - - type exportKind = - | ExportType - | ExportValue - - type 'M t = 'M * 'M t' - and 'M t' = - | Block of 'M Block.t - | Break of 'M Break.t - | ClassDeclaration of 'M Class.t - | Continue of 'M Continue.t - | Debugger - | DeclareClass of 'M DeclareClass.t - | DeclareExportDeclaration of 'M DeclareExportDeclaration.t - | DeclareFunction of 'M DeclareFunction.t - | DeclareInterface of 'M Interface.t - | DeclareModule of 'M DeclareModule.t - | DeclareModuleExports of 'M Type.annotation - | DeclareTypeAlias of 'M TypeAlias.t - | DeclareOpaqueType of 'M OpaqueType.t - | DeclareVariable of 'M DeclareVariable.t - | DoWhile of 'M DoWhile.t - | Empty - | ExportDefaultDeclaration of 'M ExportDefaultDeclaration.t - | ExportNamedDeclaration of 'M ExportNamedDeclaration.t - | Expression of 'M Expression.t - | For of 'M For.t - | ForIn of 'M ForIn.t - | ForOf of 'M ForOf.t - | FunctionDeclaration of 'M Function.t - | If of 'M If.t - | ImportDeclaration of 'M ImportDeclaration.t - | InterfaceDeclaration of 'M Interface.t - | Labeled of 'M Labeled.t - | Return of 'M Return.t - | Switch of 'M Switch.t - | Throw of 'M Throw.t - | Try of 'M Try.t - | TypeAlias of 'M TypeAlias.t - | OpaqueType of 'M OpaqueType.t - | VariableDeclaration of 'M VariableDeclaration.t - | While of 'M While.t - | With of 'M With.t -end = Statement - -and Expression : sig - module SpreadElement : sig - type 'M t = 'M * 'M t' - and 'M t' = { - argument: 'M Expression.t; - } - end - type 'M expression_or_spread = - | Expression of 'M Expression.t - | Spread of 'M SpreadElement.t - - module Array : sig - type 'M t = { - elements: 'M expression_or_spread option list; - } - end - module TemplateLiteral : sig - module Element : sig - type value = { - raw: string; - cooked: string; - } - type 'M t = 'M * t' - and t' = { - value: value; - tail: bool; - } - end - type 'M t = { - quasis: 'M Element.t list; - expressions: 'M Expression.t list; - } - end - module TaggedTemplate : sig - type 'M t = { - tag: 'M Expression.t; - quasi: 'M * 'M TemplateLiteral.t; - } - end - module Object : sig - module Property : sig - type 'M key = - | Literal of ('M * Literal.t) - | Identifier of 'M Identifier.t - | PrivateName of 'M PrivateName.t - | Computed of 'M Expression.t - type 'M t = 'M * 'M t' - and 'M t' = - | Init of { - key: 'M key; - value: 'M Expression.t; - shorthand: bool; - } - | Method of { - key: 'M key; - value: 'M * 'M Function.t; - } - | Get of { - key: 'M key; - value: 'M * 'M Function.t; - } - | Set of { - key: 'M key; - value: 'M * 'M Function.t; - } - end - module SpreadProperty : sig - type 'M t = 'M * 'M t' - and 'M t' = { - argument: 'M Expression.t; - } - end - type 'M property = - | Property of 'M Property.t - | SpreadProperty of 'M SpreadProperty.t - type 'M t = { - properties: 'M property list; - } - end - module Sequence : sig - type 'M t = { - expressions: 'M Expression.t list; - } - end - module Unary : sig - type operator = - | Minus - | Plus - | Not - | BitNot - | Typeof - | Void - | Delete - | Await - type 'M t = { - operator: operator; - prefix: bool; - argument: 'M Expression.t - } - end - module Binary : sig - type operator = - | Equal - | NotEqual - | StrictEqual - | StrictNotEqual - | LessThan - | LessThanEqual - | GreaterThan - | GreaterThanEqual - | LShift - | RShift - | RShift3 - | Plus - | Minus - | Mult - | Exp - | Div - | Mod - | BitOr - | Xor - | BitAnd - | In - | Instanceof - type 'M t = { - operator: operator; - left: 'M Expression.t; - right: 'M Expression.t; - } - end - module Assignment : sig - type operator = - | Assign - | PlusAssign - | MinusAssign - | MultAssign - | ExpAssign - | DivAssign - | ModAssign - | LShiftAssign - | RShiftAssign - | RShift3Assign - | BitOrAssign - | BitXorAssign - | BitAndAssign - type 'M t = { - operator: operator; - left: 'M Pattern.t; - right: 'M Expression.t; - } - end - module Update : sig - type operator = - | Increment - | Decrement - type 'M t = { - operator: operator; - argument: 'M Expression.t; - prefix: bool; - } - end - module Logical : sig - type operator = - | Or - | And - | NullishCoalesce - type 'M t = { - operator: operator; - left: 'M Expression.t; - right: 'M Expression.t; - } - end - module Conditional : sig - type 'M t = { - test: 'M Expression.t; - consequent: 'M Expression.t; - alternate: 'M Expression.t; - } - end - module New : sig - type 'M t = { - callee: 'M Expression.t; - targs: 'M Type.ParameterInstantiation.t option; - arguments: 'M expression_or_spread list; - } - end - module Call : sig - type 'M t = { - callee: 'M Expression.t; - targs: 'M Type.ParameterInstantiation.t option; - arguments: 'M expression_or_spread list; - } - end - module OptionalCall : sig - type 'M t = { - call: 'M Call.t; - optional: bool; - } - end - module Member : sig - type 'M property = - | PropertyIdentifier of 'M Identifier.t - | PropertyPrivateName of 'M PrivateName.t - | PropertyExpression of 'M Expression.t - type 'M t = { - _object: 'M Expression.t; - property: 'M property; - computed: bool; - } - end - module OptionalMember : sig - type 'M t = { - member: 'M Member.t; - optional: bool; - } - end - module Yield : sig - type 'M t = { - argument: 'M Expression.t option; - delegate: bool; - } - end - module Comprehension : sig - module Block : sig - type 'M t = 'M * 'M t' - and 'M t' = { - left: 'M Pattern.t; - right: 'M Expression.t; - each: bool; - } - end - type 'M t = { - blocks: 'M Block.t list; - filter: 'M Expression.t option; - } - end - module Generator : sig - type 'M t = { - blocks: 'M Comprehension.Block.t list; - filter: 'M Expression.t option; - } - end - module TypeCast : sig - type 'M t = { - expression: 'M Expression.t; - annot: 'M Type.annotation; - } - end - module MetaProperty : sig - type 'M t = { - meta: 'M Identifier.t; - property: 'M Identifier.t; - } - end - - type 'M t = 'M * 'M t' - and 'M t' = - | Array of 'M Array.t - | ArrowFunction of 'M Function.t - | Assignment of 'M Assignment.t - | Binary of 'M Binary.t - | Call of 'M Call.t - | Class of 'M Class.t - | Comprehension of 'M Comprehension.t - | Conditional of 'M Conditional.t - | Function of 'M Function.t - | Generator of 'M Generator.t - | Identifier of 'M Identifier.t - | Import of 'M t - | JSXElement of 'M JSX.element - | JSXFragment of 'M JSX.fragment - | Literal of Literal.t - | Logical of 'M Logical.t - | Member of 'M Member.t - | MetaProperty of 'M MetaProperty.t - | New of 'M New.t - | Object of 'M Object.t - | OptionalCall of 'M OptionalCall.t - | OptionalMember of 'M OptionalMember.t - | Sequence of 'M Sequence.t - | Super - | TaggedTemplate of 'M TaggedTemplate.t - | TemplateLiteral of 'M TemplateLiteral.t - | This - | TypeCast of 'M TypeCast.t - | Unary of 'M Unary.t - | Update of 'M Update.t - | Yield of 'M Yield.t -end = Expression - -and JSX : sig - module Identifier : sig - type 'M t = 'M * t' - and t' = { - name: string; - } - end - - module NamespacedName : sig - type 'M t = 'M * 'M t' - and 'M t' = { - namespace: 'M Identifier.t; - name: 'M Identifier.t; - } - end - - module ExpressionContainer : sig - type 'M t = { - expression: 'M expression; - } - and 'M expression = - | Expression of 'M Expression.t - | EmptyExpression of 'M - end - - module Text : sig - type t = { - value: string; - raw: string; - } - end - - module Attribute : sig - type 'M t = 'M * 'M t' - and 'M name = - | Identifier of 'M Identifier.t - | NamespacedName of 'M NamespacedName.t - and 'M value = - | Literal of 'M * Literal.t - | ExpressionContainer of 'M * 'M ExpressionContainer.t - and 'M t' = { - name: 'M name; - value: 'M value option; - } - end - - module SpreadAttribute : sig - type 'M t = 'M * 'M t' - and 'M t' = { - argument: 'M Expression.t; - } - end - - module MemberExpression : sig - type 'M t = 'M * 'M t' - and 'M _object = - | Identifier of 'M Identifier.t - | MemberExpression of 'M t - and 'M t' = { - _object: 'M _object; - property: 'M Identifier.t; - } - end - - type 'M name = - | Identifier of 'M Identifier.t - | NamespacedName of 'M NamespacedName.t - | MemberExpression of 'M MemberExpression.t - - module Opening : sig - type 'M t = 'M * 'M t' - - and 'M attribute = - | Attribute of 'M Attribute.t - | SpreadAttribute of 'M SpreadAttribute.t - - and 'M t' = { - name: 'M name; - selfClosing: bool; - attributes: 'M attribute list; - } - end - - module Closing : sig - type 'M t = 'M * 'M t' - and 'M t' = { - name: 'M name; - } - end - - type 'M child = 'M * 'M child' - and 'M child' = - | Element of 'M element - | Fragment of 'M fragment - | ExpressionContainer of 'M ExpressionContainer.t - | SpreadChild of 'M Expression.t - | Text of Text.t - - and 'M element = { - openingElement: 'M Opening.t; - closingElement: 'M Closing.t option; - children: 'M child list - } - - and 'M fragment = { - frag_openingElement: 'M; - frag_closingElement: 'M option; - frag_children: 'M child list; - } - -end = JSX - -and Pattern : sig - module Object : sig - module Property : sig - type 'M key = - | Literal of ('M * Literal.t) - | Identifier of 'M Identifier.t - | Computed of 'M Expression.t - type 'M t = 'M * 'M t' - and 'M t' = { - key: 'M key; - pattern: 'M Pattern.t; - shorthand: bool; - } - end - module RestProperty : sig - type 'M t = 'M * 'M t' - and 'M t' = { - argument: 'M Pattern.t; - } - end - type 'M property = - | Property of 'M Property.t - | RestProperty of 'M RestProperty.t - type 'M t = { - properties: 'M property list; - annot: 'M Type.annotation option; - } - end - module Array : sig - module RestElement : sig - type 'M t = 'M * 'M t' - and 'M t' = { - argument: 'M Pattern.t; - } - end - type 'M element = - | Element of 'M Pattern.t - | RestElement of 'M RestElement.t - type 'M t = { - elements: 'M element option list; - annot: 'M Type.annotation option; - } - end - module Assignment : sig - type 'M t = { - left: 'M Pattern.t; - right: 'M Expression.t; - } - end - module Identifier : sig - type 'M t = { - name: 'M Identifier.t; - annot: 'M Type.annotation option; - optional: bool; - } - end - type 'M t = 'M * 'M t' - and 'M t' = - | Object of 'M Object.t - | Array of 'M Array.t - | Assignment of 'M Assignment.t - | Identifier of 'M Identifier.t - | Expression of 'M Expression.t -end = Pattern - -and Comment : sig - type 'M t = 'M * t' - and t' = - | Block of string - | Line of string -end = Comment - -and Class : sig - module Method : sig - type 'M t = 'M * 'M t' - and kind = - | Constructor - | Method - | Get - | Set - and 'M t' = { - kind: kind; - key: 'M Expression.Object.Property.key; - value: 'M * 'M Function.t; - static: bool; - decorators: 'M Class.Decorator.t list; - } - end - module Property : sig - type 'M t = 'M * 'M t' - and 'M t' = { - key: 'M Expression.Object.Property.key; - value: 'M Expression.t option; - annot: 'M Type.annotation option; - static: bool; - variance: 'M Variance.t option; - } - end - module PrivateField: sig - type 'M t = 'M * 'M t' - and 'M t' = { - key: 'M PrivateName.t; - value: 'M Expression.t option; - annot: 'M Type.annotation option; - static: bool; - variance: 'M Variance.t option; - } - end - module Implements : sig - type 'M t = 'M * 'M t' - and 'M t' = { - id: 'M Identifier.t; - targs: 'M Type.ParameterInstantiation.t option; - } - end - module Body : sig - type 'M element = - | Method of 'M Method.t - | Property of 'M Property.t - | PrivateField of 'M PrivateField.t - type 'M t = 'M * 'M t' - and 'M t' = { - body: 'M element list; - } - end - module Decorator : sig - type 'M t = 'M * 'M t' - and 'M t' = { - expression: 'M Expression.t; - } - end - type 'M t = { - id: 'M Identifier.t option; - body: 'M Class.Body.t; - tparams: 'M Type.ParameterDeclaration.t option; - super: 'M Expression.t option; - super_targs: 'M Type.ParameterInstantiation.t option; - implements: 'M Class.Implements.t list; - classDecorators: 'M Decorator.t list; - } -end = Class - -and Function : sig - module RestElement : sig - type 'M t = 'M * 'M t' - and 'M t' = { - argument: 'M Pattern.t; - } - end - module Params : sig - type 'M t = 'M * 'M t' - and 'M t' = { - params: 'M Pattern.t list; - rest: 'M RestElement.t option; - } - end - type 'M body = - | BodyBlock of ('M * 'M Statement.Block.t) - | BodyExpression of 'M Expression.t - type 'M t = { - id: 'M Identifier.t option; - params: 'M Params.t; - body: 'M body; - async: bool; - generator: bool; - predicate: 'M Type.Predicate.t option; - expression: bool; - return: 'M Type.annotation option; - tparams: 'M Type.ParameterDeclaration.t option; - } -end = Function - -type 'M program = 'M * 'M Statement.t list * 'M Comment.t list diff --git a/lib/ast_utils.ml b/lib/ast_utils.ml deleted file mode 100644 index ba82da0..0000000 --- a/lib/ast_utils.ml +++ /dev/null @@ -1,68 +0,0 @@ -(** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - *) - -open Ast - -type binding = Loc.t * string - -let rec bindings_of_pattern = - let open Pattern in - let property acc = - let open Object in - function - | Property (_, { Property.pattern = (_, p); _ }) - | RestProperty (_, { RestProperty.argument = (_, p) }) -> - bindings_of_pattern acc p - in - let element acc = - let open Array in - function - | None -> acc - | Some (Element (_, p)) - | Some (RestElement (_, { RestElement.argument = (_, p) })) -> - bindings_of_pattern acc p - in - fun acc -> - function - | Identifier { Identifier.name; _ } -> - name::acc - | Object { Object.properties; _ } -> - List.fold_left property acc properties - | Array { Array.elements; _ } -> - List.fold_left element acc elements - | Assignment { Assignment.left = (_, p); _ } -> - bindings_of_pattern acc p - | Expression _ -> - failwith "expression pattern" - -let bindings_of_variable_declarations = - let open Ast.Statement.VariableDeclaration in - List.fold_left (fun acc -> function - | _, { Declarator.id = (_, pattern); _ } -> - bindings_of_pattern acc pattern - ) [] - -let partition_directives statements = - let open Ast.Statement in - let rec helper directives = function - | ((_, Expression { Expression.directive = Some _; _ }) as directive)::rest -> - helper (directive::directives) rest - | rest -> List.rev directives, rest - in - helper [] statements - -let negate_number_literal (value, raw) = - let raw_len = String.length raw in - let raw = if raw_len > 0 && raw.[0] = '-' - then String.sub raw 1 (raw_len - 1) - else "-" ^ raw - in - ~-. value, raw - -let loc_of_statement = fst - -let loc_of_expression = fst diff --git a/lib/ast_utils.mli b/lib/ast_utils.mli deleted file mode 100644 index 7a6d99a..0000000 --- a/lib/ast_utils.mli +++ /dev/null @@ -1,31 +0,0 @@ -(** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - *) - -type binding = Loc.t * string - -val bindings_of_pattern: - binding list -> - Loc.t Ast.Pattern.t' -> - binding list - -val bindings_of_variable_declarations: - Loc.t Ast.Statement.VariableDeclaration.Declarator.t list -> - binding list - -val partition_directives: - Loc.t Ast.Statement.t list -> - Loc.t Ast.Statement.t list * Loc.t Ast.Statement.t list - -val negate_number_literal: - float * string -> - float * string - -val loc_of_expression: - 'a Ast.Expression.t -> 'a - -val loc_of_statement: - 'a Ast.Statement.t -> 'a diff --git a/lib/comment_attachment.ml b/lib/comment_attachment.ml new file mode 100644 index 0000000..7baeb41 --- /dev/null +++ b/lib/comment_attachment.ml @@ -0,0 +1,772 @@ +(* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + *) + +module Ast = Flow_ast +open Flow_ast +open Parser_env + +let id = Flow_ast_mapper.id + +let map_loc = Flow_ast_mapper.map_loc + +let map_opt = Flow_ast_mapper.map_opt + +let id_list_last (map : 'a -> 'a) (lst : 'a list) : 'a list = + match List.rev lst with + | [] -> lst + | hd :: tl -> + let hd' = map hd in + if hd == hd' then + lst + else + List.rev (hd' :: tl) + +(* Mapper that removes all trailing comments that appear after a given position in an AST node *) +class ['loc] trailing_comments_remover ~after_pos = + object (this) + inherit ['loc] Flow_ast_mapper.mapper + + method! syntax comments = + let open Syntax in + let { trailing; _ } = comments in + let trailing' = + List.filter (fun (loc, _) -> Loc.(pos_cmp loc.start after_pos < 0)) trailing + in + if List.length trailing = List.length trailing' then + comments + else + { comments with trailing = trailing' } + + method! array _loc expr = + let open Ast.Expression.Array in + let { comments; _ } = expr in + id this#syntax_opt comments expr (fun comments' -> { expr with comments = comments' }) + + method! array_type t = + let open Ast.Type.Array in + let { comments; _ } = t in + id this#syntax_opt comments t (fun comments' -> { t with comments = comments' }) + + method! assignment _loc expr = + let open Ast.Expression.Assignment in + let { right; comments; _ } = expr in + let right' = this#expression right in + let comments' = this#syntax_opt comments in + if right == right' && comments == comments' then + expr + else + { expr with right = right'; comments = comments' } + + method! binary _loc expr = + let open Ast.Expression.Binary in + let { right; comments; _ } = expr in + let right' = this#expression right in + let comments' = this#syntax_opt comments in + if right == right' && comments == comments' then + expr + else + { expr with right = right'; comments = comments' } + + method! block _loc stmt = + let open Ast.Statement.Block in + let { comments; _ } = stmt in + id this#syntax_opt comments stmt (fun comments' -> { stmt with comments = comments' }) + + method! call _annot expr = + let open Ast.Expression.Call in + let { arguments; comments; _ } = expr in + let arguments' = this#call_arguments arguments in + let comments' = this#syntax_opt comments in + if arguments == arguments' && comments == comments' then + expr + else + { expr with arguments = arguments'; comments = comments' } + + method! call_arguments arg_list = + let open Ast.Expression.ArgList in + let (loc, { arguments; comments }) = arg_list in + id this#syntax_opt comments arg_list (fun comments' -> + (loc, { arguments; comments = comments' })) + + method! call_type_args targs = + let open Ast.Expression.CallTypeArgs in + let (loc, { arguments; comments }) = targs in + id this#syntax_opt comments targs (fun comments' -> + (loc, { arguments; comments = comments' })) + + method! class_ _loc cls = + let open Ast.Class in + let { body; comments; _ } = cls in + let body' = this#class_body body in + let comments' = this#syntax_opt comments in + if body == body' && comments == comments' then + cls + else + { cls with body = body'; comments = comments' } + + method! class_body body = + let open Ast.Class.Body in + let (loc, { body = _body; comments }) = body in + id this#syntax_opt comments body (fun comments' -> + (loc, { body = _body; comments = comments' })) + + method! class_extends _loc extends = + let open Ast.Class.Extends in + let { expr; targs; _ } = extends in + if targs = None then + id this#expression expr extends (fun expr' -> { extends with expr = expr' }) + else + id (map_opt this#type_args) targs extends (fun targs' -> { extends with targs = targs' }) + + method! class_implements implements = + let open Ast.Class.Implements in + let (loc, { interfaces; comments }) = implements in + id (id_list_last this#class_implements_interface) interfaces implements (fun interfaces' -> + (loc, { interfaces = interfaces'; comments })) + + method! class_implements_interface interface = + let open Ast.Class.Implements.Interface in + let (loc, { id = id_; targs }) = interface in + if targs = None then + id this#identifier id_ interface (fun id' -> (loc, { id = id'; targs })) + else + id (map_opt this#type_args) targs interface (fun targs' -> + (loc, { id = id_; targs = targs' })) + + method! computed_key key = + let open Ast.ComputedKey in + let (loc, { expression; comments }) = key in + id this#syntax_opt comments key (fun comments' -> (loc, { expression; comments = comments' })) + + method! conditional _loc expr = + let open Ast.Expression.Conditional in + let { alternate; comments; _ } = expr in + let alternate' = this#expression alternate in + let comments' = this#syntax_opt comments in + if alternate == alternate' && comments = comments' then + expr + else + { expr with alternate = alternate'; comments = comments' } + + method! function_ _loc func = + let open Ast.Function in + let { body; comments; _ } = func in + let body' = this#function_body_any body in + let comments' = this#syntax_opt comments in + if body == body' && comments == comments' then + func + else + { func with body = body'; comments = comments' } + + method! function_params (loc, params) = + let open Ast.Function.Params in + let { comments; _ } = params in + id this#syntax_opt comments (loc, params) (fun comments' -> + (loc, { params with comments = comments' })) + + method! function_type _loc func = + let open Ast.Type.Function in + let { return; comments; _ } = func in + let return' = this#type_ return in + let comments' = this#syntax_opt comments in + if return == return' && comments == comments' then + func + else + { func with return = return'; comments = comments' } + + method! generic_identifier_type git = + let open Ast.Type.Generic.Identifier in + match git with + | Unqualified i -> id this#identifier i git (fun i -> Unqualified i) + | Qualified (loc, ({ id; _ } as qualified)) -> + let id' = this#identifier id in + if id == id' then + git + else + Qualified (loc, { qualified with id = id' }) + + method! import _loc expr = + let open Ast.Expression.Import in + let { comments; _ } = expr in + id this#syntax_opt comments expr (fun comments' -> { expr with comments = comments' }) + + method! interface_type _loc t = + let open Ast.Type.Interface in + let { body; comments; _ } = t in + let body' = map_loc this#object_type body in + let comments' = this#syntax_opt comments in + if body == body' && comments == comments' then + t + else + { t with body = body'; comments = comments' } + + method! intersection_type _loc t = + let { Ast.Type.Intersection.types = (t0, t1, ts); comments } = t in + let (t1', ts') = + match ts with + | [] -> (this#type_ t1, []) + | _ -> (t1, id_list_last this#type_ ts) + in + let comments' = this#syntax_opt comments in + if t1 == t1' && ts == ts' && comments == comments' then + t + else + { Ast.Type.Intersection.types = (t0, t1', ts'); comments = comments' } + + method! jsx_element _loc elem = + let open Ast.JSX in + let { comments; _ } = elem in + id this#syntax_opt comments elem (fun comments' -> { elem with comments = comments' }) + + method! jsx_fragment _loc frag = + let open Ast.JSX in + let { frag_comments = comments; _ } = frag in + id this#syntax_opt comments frag (fun comments' -> { frag with frag_comments = comments' }) + + method! logical _loc expr = + let open Ast.Expression.Logical in + let { right; comments; _ } = expr in + let right' = this#expression right in + let comments' = this#syntax_opt comments in + if right == right' && comments == comments' then + expr + else + { expr with right = right'; comments = comments' } + + method! new_ _loc expr = + let open Ast.Expression.New in + let { callee; targs; arguments; comments } = expr in + let comments' = this#syntax_opt comments in + match (targs, arguments) with + (* new Callee() *) + | (_, Some _) -> + let arguments' = map_opt this#call_arguments arguments in + if arguments == arguments' && comments == comments' then + expr + else + { expr with arguments = arguments'; comments = comments' } + (* new Callee *) + | (Some _, _) -> + let targs' = map_opt this#call_type_args targs in + if targs == targs' && comments == comments' then + expr + else + { expr with targs = targs'; comments = comments' } + (* new Callee *) + | (None, None) -> + let callee' = this#expression callee in + if callee == callee' && comments == comments' then + expr + else + { expr with callee = callee'; comments = comments' } + + method! member _loc expr = + let open Ast.Expression.Member in + let { property; comments; _ } = expr in + let property' = this#member_property property in + let comments' = this#syntax_opt comments in + if property == property' && comments == comments' then + expr + else + { expr with property = property'; comments = comments' } + + method! object_ _loc expr = + let open Ast.Expression.Object in + let { comments; _ } = expr in + id this#syntax_opt comments expr (fun comments' -> { expr with comments = comments' }) + + method! object_type _loc obj = + let open Ast.Type.Object in + let { comments; _ } = obj in + id this#syntax_opt comments obj (fun comments' -> { obj with comments = comments' }) + + method! predicate pred = + let open Ast.Type.Predicate in + let (loc, { kind; comments }) = pred in + id this#syntax_opt comments pred (fun comments' -> (loc, { kind; comments = comments' })) + + method! sequence _loc expr = + let open Ast.Expression.Sequence in + let { expressions; comments } = expr in + let expressions' = id_list_last this#expression expressions in + let comments' = this#syntax_opt comments in + if expressions == expressions' && comments == comments' then + expr + else + { expressions = expressions'; comments = comments' } + + method! template_literal _loc expr = + let open Ast.Expression.TemplateLiteral in + let { comments; _ } = expr in + id this#syntax_opt comments expr (fun comments' -> { expr with comments = comments' }) + + method! tuple_type t = + let open Ast.Type.Tuple in + let { comments; _ } = t in + id this#syntax_opt comments t (fun comments' -> { t with comments = comments' }) + + method! type_cast _loc expr = + let open Ast.Expression.TypeCast in + let { comments; _ } = expr in + id this#syntax_opt comments expr (fun comments' -> { expr with comments = comments' }) + + method! type_params tparams = + let open Ast.Type.TypeParams in + let (loc, { params; comments }) = tparams in + id this#syntax_opt comments tparams (fun comments' -> (loc, { params; comments = comments' })) + + method! union_type _loc t = + let { Ast.Type.Union.types = (t0, t1, ts); comments } = t in + let (t1', ts') = + match ts with + | [] -> (this#type_ t1, []) + | _ -> (t1, id_list_last this#type_ ts) + in + let comments' = this#syntax_opt comments in + if t1 == t1' && ts == ts' && comments == comments' then + t + else + { Ast.Type.Union.types = (t0, t1', ts'); comments = comments' } + + method! variable_declarator ~kind decl = + let open Ast.Statement.VariableDeclaration.Declarator in + let (loc, { id = ident; init }) = decl in + match init with + | None -> + id (this#variable_declarator_pattern ~kind) ident decl (fun ident' -> + (loc, { id = ident'; init })) + | Some init -> + id this#expression init decl (fun init' -> (loc, { id = ident; init = Some init' })) + end + +type trailing_and_remover_result = { + trailing: Loc.t Comment.t list; + remove_trailing: 'a. 'a -> (Loc.t trailing_comments_remover -> 'a -> 'a) -> 'a; +} + +(* Returns a remover function which removes comments beginning after the previous token. + No trailing comments are returned, since all comments since the last loc should be removed. *) +let trailing_and_remover_after_last_loc : Parser_env.env -> trailing_and_remover_result = + fun env -> + let open Loc in + let remover = + match Parser_env.last_loc env with + | None -> None + | Some _ when not (Peek.has_eaten_comments env) -> None + | Some last_loc -> + Parser_env.consume_comments_until env last_loc._end; + let remover = new trailing_comments_remover ~after_pos:last_loc._end in + Some remover + in + { + trailing = []; + remove_trailing = + (fun node f -> + match remover with + | None -> node + | Some remover -> f remover node); + } + +(* Consumes and returns comments on the same line as the previous token. Also returns a remover + function which can be used to remove comments beginning after the previous token's line. *) +let trailing_and_remover_after_last_line : Parser_env.env -> trailing_and_remover_result = + fun env -> + let open Loc in + let (trailing, remover) = + match Parser_env.last_loc env with + | None -> ([], None) + | Some _ when not (Peek.has_eaten_comments env) -> (Eat.comments_until_next_line env, None) + | Some last_loc -> + Parser_env.consume_comments_until env last_loc._end; + let trailing = Eat.comments_until_next_line env in + let next_line_start = { line = last_loc._end.line + 1; column = 0 } in + let remover = new trailing_comments_remover ~after_pos:next_line_start in + (trailing, Some remover) + in + { + trailing; + remove_trailing = + (fun node f -> + match remover with + | None -> node + | Some remover -> f remover node); + } + +let trailing_and_remover : Parser_env.env -> trailing_and_remover_result = + fun env -> + if Peek.is_line_terminator env then + trailing_and_remover_after_last_line env + else + trailing_and_remover_after_last_loc env + +let id_remove_trailing env id = + let { remove_trailing; _ } = trailing_and_remover env in + remove_trailing id (fun remover id -> remover#identifier id) + +let expression_remove_trailing env expr = + let { remove_trailing; _ } = trailing_and_remover env in + remove_trailing expr (fun remover expr -> remover#expression expr) + +let block_remove_trailing env block = + let { remove_trailing; _ } = trailing_and_remover env in + remove_trailing block (fun remover (loc, str) -> (loc, remover#block loc str)) + +let type_params_remove_trailing env tparams = + match tparams with + | None -> None + | Some tparams -> + let { remove_trailing; _ } = trailing_and_remover env in + Some (remove_trailing tparams (fun remover tparams -> remover#type_params tparams)) + +let type_remove_trailing env ty = + let { remove_trailing; _ } = trailing_and_remover env in + remove_trailing ty (fun remover ty -> remover#type_ ty) + +let type_annotation_hint_remove_trailing env annot = + let { remove_trailing; _ } = trailing_and_remover env in + remove_trailing annot (fun remover annot -> remover#type_annotation_hint annot) + +let function_params_remove_trailing env params = + let { remove_trailing; _ } = trailing_and_remover env in + remove_trailing params (fun remover params -> remover#function_params params) + +let predicate_remove_trailing env pred = + match pred with + | None -> None + | Some pred -> + let { remove_trailing; _ } = trailing_and_remover env in + Some (remove_trailing pred (fun remover pred -> remover#predicate pred)) + +let object_key_remove_trailing env key = + let { remove_trailing; _ } = trailing_and_remover env in + remove_trailing key (fun remover key -> remover#object_key key) + +let generic_type_remove_trailing env ty = + let { remove_trailing; _ } = trailing_and_remover env in + remove_trailing ty (fun remover ty -> map_loc remover#generic_type ty) + +let generic_type_list_remove_trailing env extends = + let { remove_trailing; _ } = trailing_and_remover env in + remove_trailing extends (fun remover extends -> + id_list_last (map_loc remover#generic_type) extends) + +let class_implements_remove_trailing env implements = + let { remove_trailing; _ } = trailing_and_remover env in + remove_trailing implements (fun remover impl -> remover#class_implements impl) + +let string_literal_remove_trailing env str = + let { remove_trailing; _ } = trailing_and_remover env in + remove_trailing str (fun remover (loc, str) -> (loc, remover#string_literal_type loc str)) + +let statement_add_comments + ((loc, stmt) : (Loc.t, Loc.t) Statement.t) (comments : (Loc.t, unit) Syntax.t option) : + (Loc.t, Loc.t) Statement.t = + let open Statement in + let merge_comments inner = Flow_ast_utils.merge_comments ~inner ~outer:comments in + let merge_comments_with_internal inner = + Flow_ast_utils.merge_comments_with_internal ~inner ~outer:comments + in + ( loc, + match stmt with + | Block ({ Block.comments; _ } as s) -> + Block { s with Block.comments = merge_comments_with_internal comments } + | Break ({ Break.comments; _ } as s) -> + Break { s with Break.comments = merge_comments comments } + | ClassDeclaration ({ Class.comments; _ } as s) -> + ClassDeclaration { s with Class.comments = merge_comments comments } + | Continue ({ Continue.comments; _ } as s) -> + Continue { s with Continue.comments = merge_comments comments } + | Debugger { Debugger.comments } -> Debugger { Debugger.comments = merge_comments comments } + | DeclareClass ({ DeclareClass.comments; _ } as s) -> + DeclareClass { s with DeclareClass.comments = merge_comments comments } + | DeclareExportDeclaration ({ DeclareExportDeclaration.comments; _ } as s) -> + DeclareExportDeclaration + { s with DeclareExportDeclaration.comments = merge_comments comments } + | DeclareFunction ({ DeclareFunction.comments; _ } as s) -> + DeclareFunction { s with DeclareFunction.comments = merge_comments comments } + | DeclareInterface ({ Interface.comments; _ } as s) -> + DeclareInterface { s with Interface.comments = merge_comments comments } + | DeclareModule ({ DeclareModule.comments; _ } as s) -> + DeclareModule { s with DeclareModule.comments = merge_comments comments } + | DeclareModuleExports ({ DeclareModuleExports.comments; _ } as s) -> + DeclareModuleExports { s with DeclareModuleExports.comments = merge_comments comments } + | DeclareTypeAlias ({ TypeAlias.comments; _ } as s) -> + DeclareTypeAlias { s with TypeAlias.comments = merge_comments comments } + | DeclareOpaqueType ({ OpaqueType.comments; _ } as s) -> + DeclareOpaqueType { s with OpaqueType.comments = merge_comments comments } + | DeclareVariable ({ DeclareVariable.comments; _ } as s) -> + DeclareVariable { s with DeclareVariable.comments = merge_comments comments } + | DoWhile ({ DoWhile.comments; _ } as s) -> + DoWhile { s with DoWhile.comments = merge_comments comments } + | Empty { Empty.comments } -> Empty { Empty.comments = merge_comments comments } + | EnumDeclaration ({ EnumDeclaration.comments; _ } as s) -> + EnumDeclaration { s with EnumDeclaration.comments = merge_comments comments } + | ExportDefaultDeclaration ({ ExportDefaultDeclaration.comments; _ } as s) -> + ExportDefaultDeclaration + { s with ExportDefaultDeclaration.comments = merge_comments comments } + | ExportNamedDeclaration ({ ExportNamedDeclaration.comments; _ } as s) -> + ExportNamedDeclaration { s with ExportNamedDeclaration.comments = merge_comments comments } + | Expression ({ Expression.comments; _ } as s) -> + Expression { s with Expression.comments = merge_comments comments } + | For ({ For.comments; _ } as s) -> For { s with For.comments = merge_comments comments } + | ForIn ({ ForIn.comments; _ } as s) -> + ForIn { s with ForIn.comments = merge_comments comments } + | ForOf ({ ForOf.comments; _ } as s) -> + ForOf { s with ForOf.comments = merge_comments comments } + | FunctionDeclaration ({ Function.comments; _ } as s) -> + FunctionDeclaration { s with Function.comments = merge_comments comments } + | If ({ If.comments; _ } as s) -> If { s with If.comments = merge_comments comments } + | ImportDeclaration ({ ImportDeclaration.comments; _ } as s) -> + ImportDeclaration { s with ImportDeclaration.comments = merge_comments comments } + | InterfaceDeclaration ({ Interface.comments; _ } as s) -> + InterfaceDeclaration { s with Interface.comments = merge_comments comments } + | Labeled ({ Labeled.comments; _ } as s) -> + Labeled { s with Labeled.comments = merge_comments comments } + | Return ({ Return.comments; _ } as s) -> + Return { s with Return.comments = merge_comments comments } + | Switch ({ Switch.comments; _ } as s) -> + Switch { s with Switch.comments = merge_comments comments } + | Throw ({ Throw.comments; _ } as s) -> + Throw { s with Throw.comments = merge_comments comments } + | Try ({ Try.comments; _ } as s) -> Try { s with Try.comments = merge_comments comments } + | TypeAlias ({ TypeAlias.comments; _ } as s) -> + TypeAlias { s with TypeAlias.comments = merge_comments comments } + | OpaqueType ({ OpaqueType.comments; _ } as s) -> + OpaqueType { s with OpaqueType.comments = merge_comments comments } + | VariableDeclaration ({ VariableDeclaration.comments; _ } as s) -> + VariableDeclaration { s with VariableDeclaration.comments = merge_comments comments } + | While ({ While.comments; _ } as s) -> + While { s with While.comments = merge_comments comments } + | With ({ With.comments; _ } as s) -> With { s with With.comments = merge_comments comments } ) + +(* Collects the first leading and last trailing comment on an AST node or its children. + The first leading comment is the first attached comment that begins before the given node's loc, + and the last trailing comment is the last attached comment that begins after the given node's loc. *) +class ['loc] comment_bounds_collector ~loc = + object (this) + inherit ['loc] Flow_ast_mapper.mapper + + val mutable first_leading = None + + val mutable last_trailing = None + + method comment_bounds = (first_leading, last_trailing) + + method collect_comments : 'internal. ('loc, 'internal) Syntax.t -> unit = + function + | { Syntax.leading; trailing; _ } -> + List.iter this#visit_leading_comment leading; + List.iter this#visit_trailing_comment trailing + + method collect_comments_opt = + function + | None -> () + | Some comments -> this#collect_comments comments + + method visit_leading_comment ((comment_loc, _) as comment) = + let open Loc in + match first_leading with + | None -> if pos_cmp comment_loc.start loc.start < 0 then first_leading <- Some comment + | Some (current_first_loc, _) -> + if pos_cmp comment_loc.start current_first_loc.start < 0 then first_leading <- Some comment + + method visit_trailing_comment ((comment_loc, _) as comment) = + let open Loc in + match last_trailing with + | None -> if pos_cmp comment_loc.start loc._end >= 0 then last_trailing <- Some comment + | Some (current_last_loc, _) -> + if pos_cmp current_last_loc.start comment_loc.start < 0 then last_trailing <- Some comment + + method! syntax comments = + this#collect_comments comments; + comments + + method! block _loc block = + let { Statement.Block.comments; _ } = block in + this#collect_comments_opt comments; + block + end + +(* Given an AST node and a function to collect all its comments, return the first leading + and last trailing comment on the node. *) +let comment_bounds loc node f = + let collector = new comment_bounds_collector ~loc in + ignore (f collector node); + collector#comment_bounds + +(* Expand node's loc to include its attached comments *) +let expand_loc_with_comment_bounds loc (first_leading, last_trailing) = + let open Loc in + let start = + match first_leading with + | None -> loc + | Some (first_leading_loc, _) -> first_leading_loc + in + let _end = + match last_trailing with + | None -> loc + | Some (last_trailing_loc, _) -> last_trailing_loc + in + btwn start _end + +(* Remove the trailing comment bound if it is a line comment *) +let comment_bounds_without_trailing_line_comment (leading, trailing) = + match trailing with + | Some (_, { Ast.Comment.kind = Ast.Comment.Line; _ }) -> (leading, None) + | _ -> (leading, trailing) + +let collect_without_trailing_line_comment collector = + comment_bounds_without_trailing_line_comment collector#comment_bounds + +(* Return the first leading and last trailing comment of a statement *) +let statement_comment_bounds ((loc, _) as stmt : (Loc.t, Loc.t) Statement.t) : + Loc.t Comment.t option * Loc.t Comment.t option = + let collector = new comment_bounds_collector ~loc in + ignore (collector#statement stmt); + collector#comment_bounds + +let expression_comment_bounds ((loc, _) as expr) = + let collector = new comment_bounds_collector ~loc in + ignore (collector#expression expr); + collector#comment_bounds + +let type_comment_bounds ((loc, _) as ty) = + let collector = new comment_bounds_collector ~loc in + ignore (collector#type_ ty); + collector#comment_bounds + +let block_comment_bounds (loc, block) = + let collector = new comment_bounds_collector ~loc in + ignore (collector#block loc block); + collector#comment_bounds + +let object_property_comment_bounds property = + let open Ast.Expression.Object in + let collector = + match property with + | Property ((loc, _) as p) -> + let collector = new comment_bounds_collector ~loc in + ignore (collector#object_property p); + collector + | SpreadProperty ((loc, _) as p) -> + let collector = new comment_bounds_collector ~loc in + ignore (collector#spread_property p); + collector + in + collect_without_trailing_line_comment collector + +let object_type_property_comment_bounds property = + let open Ast.Type.Object in + let collector = + match property with + | Property ((loc, _) as p) -> + let collector = new comment_bounds_collector ~loc in + ignore (collector#object_property_type p); + collector + | SpreadProperty ((loc, _) as p) -> + let collector = new comment_bounds_collector ~loc in + ignore (collector#object_spread_property_type p); + collector + | Indexer ((loc, _) as p) -> + let collector = new comment_bounds_collector ~loc in + ignore (collector#object_indexer_property_type p); + collector + | InternalSlot ((loc, _) as p) -> + let collector = new comment_bounds_collector ~loc in + ignore (collector#object_internal_slot_property_type p); + collector + | CallProperty ((loc, _) as p) -> + let collector = new comment_bounds_collector ~loc in + ignore (collector#object_call_property_type p); + collector + in + collect_without_trailing_line_comment collector + +let object_pattern_property_comment_bounds loc property = + let collector = new comment_bounds_collector ~loc in + ignore (collector#pattern_object_p property); + collect_without_trailing_line_comment collector + +let switch_case_comment_bounds (loc, case) = + let collector = new comment_bounds_collector ~loc in + ignore (collector#switch_case loc case); + collector#comment_bounds + +let function_param_comment_bounds (loc, param) = + let collector = new comment_bounds_collector ~loc in + ignore (collector#function_param (loc, param)); + collect_without_trailing_line_comment collector + +let function_rest_param_comment_bounds (loc, param) = + let collector = new comment_bounds_collector ~loc in + ignore (collector#function_rest_param (loc, param)); + collect_without_trailing_line_comment collector + +let function_this_param_comment_bounds (loc, param) = + let collector = new comment_bounds_collector ~loc in + ignore (collector#function_this_param (loc, param)); + collect_without_trailing_line_comment collector + +let function_type_param_comment_bounds (loc, param) = + let collector = new comment_bounds_collector ~loc in + ignore (collector#function_param_type (loc, param)); + collect_without_trailing_line_comment collector + +let function_type_rest_param_comment_bounds (loc, param) = + let collector = new comment_bounds_collector ~loc in + ignore (collector#function_rest_param_type (loc, param)); + collect_without_trailing_line_comment collector + +let function_type_this_param_comment_bounds (loc, param) = + let collector = new comment_bounds_collector ~loc in + ignore (collector#function_this_param_type (loc, param)); + collect_without_trailing_line_comment collector + +let array_element_comment_bounds loc element = + let collector = new comment_bounds_collector ~loc in + ignore (collector#array_element element); + collect_without_trailing_line_comment collector + +let array_pattern_element_comment_bounds loc element = + let collector = new comment_bounds_collector ~loc in + ignore (collector#pattern_array_e element); + collect_without_trailing_line_comment collector + +let expression_or_spread_comment_bounds loc expr_or_spread = + let collector = new comment_bounds_collector ~loc in + ignore (collector#expression_or_spread expr_or_spread); + collect_without_trailing_line_comment collector + +let call_type_arg_comment_bounds loc arg = + let collector = new comment_bounds_collector ~loc in + ignore (collector#call_type_arg arg); + collect_without_trailing_line_comment collector + +let type_param_comment_bounds (loc, param) = + let collector = new comment_bounds_collector ~loc in + ignore (collector#type_param (loc, param)); + collect_without_trailing_line_comment collector + +let function_body_comment_bounds body = + let loc = + match body with + | Ast.Function.BodyBlock (loc, _) -> loc + | Ast.Function.BodyExpression (loc, _) -> loc + in + let collector = new comment_bounds_collector ~loc in + ignore (collector#function_body_any body); + collector#comment_bounds + +let if_alternate_statement_comment_bounds loc alternate = + let collector = new comment_bounds_collector ~loc in + ignore (collector#if_alternate_statement loc alternate); + collector#comment_bounds + +let member_property_comment_bounds loc property = + let collector = new comment_bounds_collector ~loc in + ignore (collector#member_property property); + collector#comment_bounds diff --git a/lib/declaration_parser.ml b/lib/declaration_parser.ml index 005d220..5aa8f78 100644 --- a/lib/declaration_parser.ml +++ b/lib/declaration_parser.ml @@ -1,103 +1,117 @@ -(** - * Copyright (c) 2013-present, Facebook, Inc. +(* + * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. *) +module Ast = Flow_ast open Token open Parser_common open Parser_env -open Ast -module Error = Parse_error -module SSet = Set.Make(String) +open Flow_ast +open Comment_attachment +module SSet = Set.Make (String) module type DECLARATION = sig - val async: env -> bool - val generator: env -> bool - val variance: env -> bool -> bool -> Loc.t Variance.t option - val function_params: await:bool -> yield:bool -> env -> Loc.t Ast.Function.Params.t - val function_body: env -> async:bool -> generator:bool -> Loc.t * Loc.t Function.body * bool - val is_simple_function_params: Loc.t Ast.Function.Params.t -> bool - val strict_post_check: env -> strict:bool -> simple:bool -> Loc.t Identifier.t option -> Loc.t Ast.Function.Params.t -> unit - val concise_function_body: env -> async:bool -> generator:bool -> Loc.t Function.body * bool - val variable: env -> Loc.t Statement.t * (Loc.t * Error.t) list - val variable_declaration_list: env -> Loc.t Statement.VariableDeclaration.Declarator.t list * (Loc.t * Error.t) list - val let_: env -> Loc.t Statement.VariableDeclaration.t * (Loc.t * Error.t) list - val const: env -> Loc.t Statement.VariableDeclaration.t * (Loc.t * Error.t) list - val var: env -> Loc.t Statement.VariableDeclaration.t * (Loc.t * Error.t) list - val _function: env -> Loc.t Statement.t -end + val async : env -> bool * Loc.t Comment.t list -module Declaration - (Parse: Parser_common.PARSER) - (Type: Type_parser.TYPE) -: DECLARATION -= struct - let check_param = - let rec pattern ((env, _) as check_env) (loc, p) = Pattern.(match p with - | Object o -> _object check_env o - | Array arr -> _array check_env arr - | Assignment { Assignment.left; _ } -> pattern check_env left - | Identifier id -> identifier_pattern check_env id - | Expression _ -> ( - error_at env (loc, Error.ExpectedPatternFoundExpression); - check_env - ) - ) + val generator : env -> bool * Loc.t Comment.t list - and _object check_env o = - List.fold_left - object_property - check_env - o.Pattern.Object.properties + val variance : env -> bool -> bool -> Loc.t Variance.t option - and object_property check_env = Pattern.Object.(function - | Property (_, property) -> Property.( - let check_env = match property.key with - | Identifier id -> identifier_no_dupe_check check_env id - | _ -> check_env in - pattern check_env property.pattern) - | RestProperty (_, { RestProperty.argument; }) -> - pattern check_env argument) + val function_params : await:bool -> yield:bool -> env -> (Loc.t, Loc.t) Ast.Function.Params.t - and _array check_env arr = - List.fold_left - array_element - check_env - arr.Pattern.Array.elements + val function_body : + env -> async:bool -> generator:bool -> expression:bool -> (Loc.t, Loc.t) Function.body * bool + + val is_simple_function_params : (Loc.t, Loc.t) Ast.Function.Params.t -> bool - and array_element check_env = Pattern.Array.(function - | None -> check_env - | Some (Element p) -> pattern check_env p - | Some (RestElement (_, { RestElement.argument; })) -> - pattern check_env argument) + val strict_post_check : + env -> + strict:bool -> + simple:bool -> + (Loc.t, Loc.t) Identifier.t option -> + (Loc.t, Loc.t) Ast.Function.Params.t -> + unit - and identifier_pattern check_env {Pattern.Identifier.name=id; _;} = - identifier check_env id + val let_ : + env -> + (Loc.t, Loc.t) Statement.VariableDeclaration.Declarator.t list + * Loc.t Ast.Comment.t list + * (Loc.t * Parse_error.t) list - and identifier (env, param_names) (loc, name as id) = - if SSet.mem name param_names - then error_at env (loc, Error.StrictParamDupe); - let env, param_names = - identifier_no_dupe_check (env, param_names) id in - env, SSet.add name param_names + val const : + env -> + (Loc.t, Loc.t) Statement.VariableDeclaration.Declarator.t list + * Loc.t Ast.Comment.t list + * (Loc.t * Parse_error.t) list - and identifier_no_dupe_check (env, param_names) (loc, name) = - if is_restricted name - then strict_error_at env (loc, Error.StrictParamName); - if is_future_reserved name || is_strict_reserved name - then strict_error_at env (loc, Error.StrictReservedWord); - env, param_names + val var : + env -> + (Loc.t, Loc.t) Statement.VariableDeclaration.Declarator.t list + * Loc.t Ast.Comment.t list + * (Loc.t * Parse_error.t) list - in pattern + val _function : env -> (Loc.t, Loc.t) Statement.t + + val enum_declaration : env -> (Loc.t, Loc.t) Statement.t +end + +module Declaration (Parse : Parser_common.PARSER) (Type : Type_parser.TYPE) : DECLARATION = struct + module Enum = Enum_parser.Enum (Parse) + + let check_param = + let rec pattern ((env, _) as check_env) (loc, p) = + Pattern.( + match p with + | Object o -> _object check_env o + | Array arr -> _array check_env arr + | Identifier id -> identifier_pattern check_env id + | Expression _ -> + error_at env (loc, Parse_error.ExpectedPatternFoundExpression); + check_env) + and _object check_env o = List.fold_left object_property check_env o.Pattern.Object.properties + and object_property check_env = + let open Pattern.Object in + function + | Property (_, property) -> + Property.( + let check_env = + match property.key with + | Identifier id -> identifier_no_dupe_check check_env id + | _ -> check_env + in + pattern check_env property.pattern) + | RestElement (_, { Pattern.RestElement.argument; comments = _ }) -> + pattern check_env argument + and _array check_env arr = List.fold_left array_element check_env arr.Pattern.Array.elements + and array_element check_env = + let open Pattern.Array in + function + | Hole _ -> check_env + | Element (_, { Element.argument; default = _ }) -> pattern check_env argument + | RestElement (_, { Pattern.RestElement.argument; comments = _ }) -> + pattern check_env argument + and identifier_pattern check_env { Pattern.Identifier.name = id; _ } = identifier check_env id + and identifier (env, param_names) ((loc, { Identifier.name; comments = _ }) as id) = + if SSet.mem name param_names then error_at env (loc, Parse_error.StrictParamDupe); + let (env, param_names) = identifier_no_dupe_check (env, param_names) id in + (env, SSet.add name param_names) + and identifier_no_dupe_check (env, param_names) (loc, { Identifier.name; comments = _ }) = + if is_restricted name then strict_error_at env (loc, Parse_error.StrictParamName); + if is_future_reserved name || is_strict_reserved name then + strict_error_at env (loc, Parse_error.StrictReservedWord); + (env, param_names) + in + pattern (* Strict is true if we were already in strict mode or if we are newly in * strict mode due to a directive in the function. * Simple is the IsSimpleParameterList thing from the ES6 spec *) - let strict_post_check env ~strict ~simple id (_, { Ast.Function.Params.params; rest }) = - if strict || not simple - then + let strict_post_check + env ~strict ~simple id (_, { Ast.Function.Params.params; rest; this_ = _; comments = _ }) = + if strict || not simple then ( (* If we are doing this check due to strict mode than there are two * cases to consider. The first is when we were already in strict mode * and therefore already threw strict errors. In this case we want to @@ -105,240 +119,308 @@ module Declaration * originally parsed in non-strict mode but now are strict. Then we * want to do these checks in strict mode *) let env = - if strict - then env |> with_strict (not (Parser_env.in_strict_mode env)) - else env in + if strict then + env |> with_strict (not (Parser_env.in_strict_mode env)) + else + env + in (match id with - | Some (loc, name) -> - if is_restricted name - then strict_error_at env (loc, Error.StrictFunctionName); - if is_future_reserved name || is_strict_reserved name - then strict_error_at env (loc, Error.StrictReservedWord) + | Some (loc, { Identifier.name; comments = _ }) -> + if is_restricted name then strict_error_at env (loc, Parse_error.StrictFunctionName); + if is_future_reserved name || is_strict_reserved name then + strict_error_at env (loc, Parse_error.StrictReservedWord) | None -> ()); - let acc = List.fold_left check_param (env, SSet.empty) params in + let acc = + List.fold_left + (fun acc (_, { Function.Param.argument; default = _ }) -> check_param acc argument) + (env, SSet.empty) + params + in match rest with - | Some (_, { Function.RestElement.argument }) -> - ignore (check_param acc argument) - | None -> - () + | Some (_, { Function.RestParam.argument; comments = _ }) -> ignore (check_param acc argument) + | None -> () + ) let function_params = - let rec param env = - let left = Parse.pattern env Error.StrictParamName in - (* TODO: shouldn't Parse.pattern recognize Assignment patterns? *) - if Peek.token env = T_ASSIGN - then begin - Expect.token env T_ASSIGN; - let right = Parse.assignment env in - let loc = Loc.btwn (fst left) (fst right) in - (loc, Pattern.Assignment { Pattern.Assignment.left; right }) - end else - left - and param_list env acc = - match Peek.token env with - | T_EOF - | T_RPAREN - | T_ELLIPSIS as t -> - let rest = - if t = T_ELLIPSIS then begin - let start_loc = Peek.loc env in - Expect.token env T_ELLIPSIS; - let id = Parse.pattern env Error.StrictParamName in - let loc = Loc.btwn start_loc (fst id) in - Some (loc, { Function.RestElement.argument = id; }) - end else + let rec param = + with_loc (fun env -> + if Peek.token env = T_THIS then error env Parse_error.ThisParamMustBeFirst; + let argument = Parse.pattern env Parse_error.StrictParamName in + let default = + if Peek.token env = T_ASSIGN then ( + Expect.token env T_ASSIGN; + Some (Parse.assignment env) + ) else None in - if Peek.token env <> T_RPAREN - then error env Error.ParameterAfterRestParameter; - { Ast.Function.Params.params = List.rev acc; rest } + { Function.Param.argument; default }) + and param_list env acc = + match Peek.token env with + | (T_EOF | T_RPAREN | T_ELLIPSIS) as t -> + let rest = + if t = T_ELLIPSIS then + let leading = Peek.comments env in + let (loc, id) = + with_loc + (fun env -> + Expect.token env T_ELLIPSIS; + Parse.pattern env Parse_error.StrictParamName) + env + in + Some + ( loc, + { + Function.RestParam.argument = id; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + } ) + else + None + in + if Peek.token env <> T_RPAREN then error env Parse_error.ParameterAfterRestParameter; + (List.rev acc, rest) | _ -> - let the_param = param env in - if Peek.token env <> T_RPAREN - then Expect.token env T_COMMA; - param_list env (the_param::acc) - - in fun ~await ~yield -> with_loc (fun env -> - let env = env - |> with_allow_await await - |> with_allow_yield yield - |> with_in_formal_parameters true - in - Expect.token env T_LPAREN; - let params = param_list env [] in - Expect.token env T_RPAREN; - params - ) + let the_param = param env in + if Peek.token env <> T_RPAREN then Expect.token env T_COMMA; + param_list env (the_param :: acc) + in + let this_param_annotation env = + if should_parse_types env && Peek.token env = T_THIS then ( + let leading = Peek.comments env in + let (this_loc, this_param) = + with_loc + (fun env -> + Expect.token env T_THIS; + if Peek.token env <> T_COLON then begin + error env Parse_error.ThisParamAnnotationRequired; + None + end else + Some (Type.annotation env)) + env + in + match this_param with + | None -> None + | Some annot -> + if Peek.token env = T_COMMA then Eat.token env; + Some + ( this_loc, + { + Ast.Function.ThisParam.annot; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + } ) + ) else + None + in + fun ~await ~yield -> + with_loc (fun env -> + let env = + env + |> with_allow_await await + |> with_allow_yield yield + |> with_in_formal_parameters true + in + let leading = Peek.comments env in + Expect.token env T_LPAREN; + let this_ = this_param_annotation env in + let (params, rest) = param_list env [] in + let internal = Peek.comments env in + Expect.token env T_RPAREN; + let trailing = Eat.trailing_comments env in + { + Ast.Function.Params.params; + rest; + comments = Flow_ast_utils.mk_comments_with_internal_opt ~leading ~trailing ~internal; + this_; + }) - let function_body env ~async ~generator = + let function_body env ~async ~generator ~expression = let env = enter_function env ~async ~generator in - let loc, block, strict = Parse.function_block_body env in - loc, Function.BodyBlock (loc, block), strict - - let concise_function_body env ~async ~generator = - let env = env |> with_in_function true in - match Peek.token env with - | T_LCURLY -> - let _, body, strict = function_body env ~async ~generator in - body, strict - | _ -> - let env = enter_function env ~async ~generator in - let expr = Parse.assignment env in - Function.BodyExpression expr, in_strict_mode env + let (loc, block, strict) = Parse.function_block_body env ~expression in + (Function.BodyBlock (loc, block), strict) let variance env is_async is_generator = let loc = Peek.loc env in - let variance = match Peek.token env with - | T_PLUS -> + let variance = + match Peek.token env with + | T_PLUS -> + let leading = Peek.comments env in Eat.token env; - Some (loc, Variance.Plus) - | T_MINUS -> + Some + ( loc, + { Variance.kind = Variance.Plus; comments = Flow_ast_utils.mk_comments_opt ~leading () } + ) + | T_MINUS -> + let leading = Peek.comments env in Eat.token env; - Some (loc, Variance.Minus) - | _ -> - None + Some + ( loc, + { + Variance.kind = Variance.Minus; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + } ) + | _ -> None in match variance with | Some (loc, _) when is_async || is_generator -> - error_at env (loc, Error.UnexpectedVariance); - None - | _ -> - variance + error_at env (loc, Parse_error.UnexpectedVariance); + None + | _ -> variance - let generator env = Expect.maybe env T_MULT + let generator env = + if Peek.token env = T_MULT then ( + let leading = Peek.comments env in + Eat.token env; + (true, leading) + ) else + (false, []) - let async env = Expect.maybe env T_ASYNC + (* Returns true and consumes a token if the token is `async` and the token after it is on + the same line (see https://tc39.github.io/ecma262/#sec-async-function-definitions) *) + let async env = + if Peek.token env = T_ASYNC && not (Peek.ith_is_line_terminator ~i:1 env) then + let leading = Peek.comments env in + let () = Eat.token env in + (true, leading) + else + (false, []) let is_simple_function_params = let is_simple_param = function - | _, Pattern.Identifier _ -> true - | _ -> false - - in fun (_, { Ast.Function.Params.params; rest }) -> + | (_, { Ast.Function.Param.argument = (_, Pattern.Identifier _); default = None }) -> true + | _ -> false + in + fun (_, { Ast.Function.Params.params; rest; comments = _; this_ = _ }) -> rest = None && List.for_all is_simple_param params - let _function env = - let start_loc = Peek.loc env in - let async = async env in - Expect.token env T_FUNCTION; - let generator = generator env in - let (tparams, id) = ( - match in_export env, Peek.token env with - | true, T_LPAREN -> (None, None) - | true, T_LESS_THAN -> - let typeParams = Type.type_parameter_declaration env in - let id = if Peek.token env = T_LPAREN then None else Some ( - Parse.identifier ~restricted_error:Error.StrictFunctionName env - ) in - (typeParams, id) - | _ -> - let id = - Parse.identifier ~restricted_error:Error.StrictFunctionName env + let _function = + with_loc (fun env -> + let (async, leading_async) = async env in + let (sig_loc, (generator, tparams, id, params, return, predicate, leading)) = + with_loc + (fun env -> + let leading_function = Peek.comments env in + Expect.token env T_FUNCTION; + let (generator, leading_generator) = generator env in + let leading = List.concat [leading_async; leading_function; leading_generator] in + let (tparams, id) = + match (in_export env, Peek.token env) with + | (true, T_LPAREN) -> (None, None) + | (true, T_LESS_THAN) -> + let tparams = type_params_remove_trailing env (Type.type_params env) in + let id = + if Peek.token env = T_LPAREN then + None + else + let id = + id_remove_trailing + env + (Parse.identifier ~restricted_error:Parse_error.StrictFunctionName env) + in + Some id + in + (tparams, id) + | _ -> + let id = + id_remove_trailing + env + (Parse.identifier ~restricted_error:Parse_error.StrictFunctionName env) + in + let tparams = type_params_remove_trailing env (Type.type_params env) in + (tparams, Some id) + in + let params = + let params = function_params ~await:async ~yield:generator env in + if Peek.token env = T_COLON then + params + else + function_params_remove_trailing env params + in + let (return, predicate) = Type.annotation_and_predicate_opt env in + let (return, predicate) = + match predicate with + | None -> (type_annotation_hint_remove_trailing env return, predicate) + | Some _ -> (return, predicate_remove_trailing env predicate) + in + (generator, tparams, id, params, return, predicate, leading)) + env in - (Type.type_parameter_declaration env, Some id) - ) in - let params = - let yield, await = match async, generator with - | true, true -> true, true (* proposal-async-iteration/#prod-AsyncGeneratorDeclaration *) - | true, false -> false, allow_await env (* #prod-AsyncFunctionDeclaration *) - | false, true -> true, false (* #prod-GeneratorDeclaration *) - | false, false -> false, false (* #prod-FunctionDeclaration *) - in - function_params ~await ~yield env - in - let (return, predicate) = Type.annotation_and_predicate_opt env in - let _, body, strict = function_body env ~async ~generator in - let simple = is_simple_function_params params in - strict_post_check env ~strict ~simple id params; - let end_loc, expression = Ast.Function.( - match body with - | BodyBlock (loc, _) -> loc, false - | BodyExpression (loc, _) -> loc, true) in - Loc.btwn start_loc end_loc, Statement.(FunctionDeclaration Function.({ - id; - params; - body; - generator; - async; - predicate; - expression; - return; - tparams; - })) + let (body, strict) = function_body env ~async ~generator ~expression:false in + let simple = is_simple_function_params params in + strict_post_check env ~strict ~simple id params; + Statement.FunctionDeclaration + { + Function.id; + params; + body; + generator; + async; + predicate; + return; + tparams; + sig_loc; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + }) let variable_declaration_list = let variable_declaration env = - let loc, (decl, errs) = with_loc (fun env -> - let id = Parse.pattern env Error.StrictVarName in - let init, errs = if Peek.token env = T_ASSIGN - then begin - Expect.token env T_ASSIGN; - Some (Parse.assignment env), [] - end else Ast.Pattern.( - match id with - | _, Identifier _ -> None, [] - | loc, _ -> None, [(loc, Error.NoUninitializedDestructuring)] - ) in - Ast.Statement.VariableDeclaration.Declarator.({ - id; - init; - }), errs - ) env in - (loc, decl), errs - - in let rec helper env decls errs = - let decl, errs_ = variable_declaration env in - let decls = decl::decls in - let errs = errs_ @ errs in - if Peek.token env = T_COMMA - then begin - Expect.token env T_COMMA; + let (loc, (decl, err)) = + with_loc + (fun env -> + let id = Parse.pattern env Parse_error.StrictVarName in + let (init, err) = + if Eat.maybe env T_ASSIGN then + (Some (Parse.assignment env), None) + else + match id with + | (_, Ast.Pattern.Identifier _) -> (None, None) + | (loc, _) -> (None, Some (loc, Parse_error.NoUninitializedDestructuring)) + in + (Ast.Statement.VariableDeclaration.Declarator.{ id; init }, err)) + env + in + ((loc, decl), err) + in + let rec helper env decls errs = + let (decl, err) = variable_declaration env in + let decls = decl :: decls in + let errs = + match err with + | Some x -> x :: errs + | None -> errs + in + if Eat.maybe env T_COMMA then helper env decls errs - end else - List.rev decls, List.rev errs - - in fun env -> helper env [] [] + else + (List.rev decls, List.rev errs) + in + (fun env -> helper env [] []) - let declarations token kind env = + let declarations token env = + let leading = Peek.comments env in Expect.token env token; - let declarations, errs = variable_declaration_list env in - Statement.VariableDeclaration.({ - kind; - declarations; - }), errs + let (declarations, errs) = variable_declaration_list env in + (declarations, leading, errs) - let var = declarations T_VAR Statement.VariableDeclaration.Var + let var = declarations T_VAR let const env = let env = env |> with_no_let true in - let variable, errs = - declarations T_CONST Statement.VariableDeclaration.Const env in + let (declarations, leading_comments, errs) = declarations T_CONST env in (* Make sure all consts defined are initialized *) - let errs = Statement.VariableDeclaration.( - List.fold_left (fun errs decl -> - match decl with - | loc, { Declarator.init = None; _ } -> - (loc, Error.NoUninitializedConst)::errs - | _ -> errs - ) errs variable.declarations - ) in - variable, List.rev errs + let errs = + List.fold_left + (fun errs decl -> + match decl with + | (loc, { Statement.VariableDeclaration.Declarator.init = None; _ }) -> + (loc, Parse_error.NoUninitializedConst) :: errs + | _ -> errs) + errs + declarations + in + (declarations, leading_comments, List.rev errs) let let_ env = let env = env |> with_no_let true in - declarations T_LET Statement.VariableDeclaration.Let env + declarations T_LET env - let variable env = - let loc, (decl, errs) = with_loc (fun env -> - let variable, errs = match Peek.token env with - | T_CONST -> const env - | T_LET -> let_ env - | T_VAR -> var env - | _ -> - error_unexpected env; - (* We need to return something. This is as good as anything else *) - var env in - Statement.VariableDeclaration variable, errs - ) env in - (loc, decl), errs + let enum_declaration = Enum.declaration end diff --git a/lib/dune b/lib/dune index 909d04a..669d154 100644 --- a/lib/dune +++ b/lib/dune @@ -1,9 +1,9 @@ (library (name Flow_parser) (public_name flow-parser) - (libraries flow-parser.sedlex wtf8) + (libraries sedlex wtf8) (modules (:standard \ flow_parser_js flow_parser_dot_js)) - (preprocess (pps flow-parser.sedlex_ppx)) + (preprocess (pps ppx_gen_rec ppx_deriving.std sedlex.ppx)) (flags (:standard (-w -39))) ) diff --git a/lib/enum_common.ml b/lib/enum_common.ml new file mode 100644 index 0000000..74dbdff --- /dev/null +++ b/lib/enum_common.ml @@ -0,0 +1,19 @@ +(* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + *) + +type explicit_type = + | Boolean + | Number + | String + | Symbol +[@@deriving ord] + +let string_of_explicit_type = function + | Boolean -> "boolean" + | Number -> "number" + | String -> "string" + | Symbol -> "symbol" diff --git a/lib/enum_parser.ml b/lib/enum_parser.ml new file mode 100644 index 0000000..22e93bd --- /dev/null +++ b/lib/enum_parser.ml @@ -0,0 +1,410 @@ +(* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + *) + +open Flow_ast +open Parser_common +open Parser_env +open Token +module SSet = Set.Make (String) + +module Enum (Parse : Parser_common.PARSER) : sig + val declaration : env -> (Loc.t, Loc.t) Statement.t +end = struct + open Flow_ast.Statement.EnumDeclaration + + type members = { + boolean_members: (Loc.t BooleanLiteral.t, Loc.t) InitializedMember.t list; + number_members: (Loc.t NumberLiteral.t, Loc.t) InitializedMember.t list; + string_members: (Loc.t StringLiteral.t, Loc.t) InitializedMember.t list; + defaulted_members: Loc.t DefaultedMember.t list; + } + + type acc = { + members: members; + seen_names: SSet.t; + has_unknown_members: bool; + } + + type init = + | NoInit + | InvalidInit of Loc.t + | BooleanInit of Loc.t * Loc.t BooleanLiteral.t + | NumberInit of Loc.t * Loc.t NumberLiteral.t + | StringInit of Loc.t * Loc.t StringLiteral.t + + let empty_members = + { boolean_members = []; number_members = []; string_members = []; defaulted_members = [] } + + let empty_acc = { members = empty_members; seen_names = SSet.empty; has_unknown_members = false } + + let end_of_member_init env = + match Peek.token env with + | T_SEMICOLON + | T_COMMA + | T_RCURLY -> + true + | _ -> false + + let member_init env = + let loc = Peek.loc env in + let leading = Peek.comments env in + match Peek.token env with + | T_NUMBER { kind; raw } -> + let value = Parse.number env kind raw in + let trailing = Eat.trailing_comments env in + if end_of_member_init env then + NumberInit + ( loc, + { + NumberLiteral.value; + raw; + comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + } ) + else + InvalidInit loc + | T_STRING (loc, value, raw, octal) -> + if octal then strict_error env Parse_error.StrictOctalLiteral; + Eat.token env; + let trailing = Eat.trailing_comments env in + if end_of_member_init env then + StringInit + ( loc, + { + StringLiteral.value; + raw; + comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + } ) + else + InvalidInit loc + | (T_TRUE | T_FALSE) as token -> + Eat.token env; + let trailing = Eat.trailing_comments env in + if end_of_member_init env then + BooleanInit + ( loc, + { + BooleanLiteral.value = token = T_TRUE; + comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + } ) + else + InvalidInit loc + | _ -> + Eat.token env; + InvalidInit loc + + let member_raw = + with_loc (fun env -> + let id = identifier_name env in + let init = + match Peek.token env with + | T_ASSIGN -> + Expect.token env T_ASSIGN; + member_init env + | T_COLON -> + let (_, { Identifier.name = member_name; _ }) = id in + error env (Parse_error.EnumInvalidInitializerSeparator { member_name }); + Expect.token env T_COLON; + member_init env + | _ -> NoInit + in + (id, init)) + + let check_explicit_type_mismatch env ~enum_name ~explicit_type ~member_name literal_type loc = + match explicit_type with + | Some enum_type when enum_type <> literal_type -> + error_at + env + (loc, Parse_error.EnumInvalidMemberInitializer { enum_name; explicit_type; member_name }) + | _ -> () + + let is_a_to_z c = c >= 'a' && c <= 'z' + + let enum_member ~enum_name ~explicit_type acc env = + let { members; seen_names; _ } = acc in + let (member_loc, (id, init)) = member_raw env in + let (id_loc, { Identifier.name = member_name; _ }) = id in + (* if we parsed an empty name, something has gone wrong and we should abort analysis *) + if member_name = "" then + acc + else ( + if is_a_to_z @@ member_name.[0] then + error_at env (id_loc, Parse_error.EnumInvalidMemberName { enum_name; member_name }); + if SSet.mem member_name seen_names then + error_at env (id_loc, Parse_error.EnumDuplicateMemberName { enum_name; member_name }); + let acc = { acc with seen_names = SSet.add member_name seen_names } in + let check_explicit_type_mismatch = + check_explicit_type_mismatch env ~enum_name ~explicit_type ~member_name + in + match init with + | BooleanInit (loc, value) -> + check_explicit_type_mismatch Enum_common.Boolean loc; + let member = (member_loc, { InitializedMember.id; init = (loc, value) }) in + { acc with members = { members with boolean_members = member :: members.boolean_members } } + | NumberInit (loc, value) -> + check_explicit_type_mismatch Enum_common.Number loc; + let member = (member_loc, { InitializedMember.id; init = (loc, value) }) in + { acc with members = { members with number_members = member :: members.number_members } } + | StringInit (loc, value) -> + check_explicit_type_mismatch Enum_common.String loc; + let member = (member_loc, { InitializedMember.id; init = (loc, value) }) in + { acc with members = { members with string_members = member :: members.string_members } } + | InvalidInit loc -> + error_at + env + (loc, Parse_error.EnumInvalidMemberInitializer { enum_name; explicit_type; member_name }); + acc + | NoInit -> + begin + match explicit_type with + | Some Enum_common.Boolean -> + error_at + env + (member_loc, Parse_error.EnumBooleanMemberNotInitialized { enum_name; member_name }); + acc + | Some Enum_common.Number -> + error_at + env + (member_loc, Parse_error.EnumNumberMemberNotInitialized { enum_name; member_name }); + acc + | Some Enum_common.String + | Some Enum_common.Symbol + | None -> + let member = (member_loc, { DefaultedMember.id }) in + { + acc with + members = { members with defaulted_members = member :: members.defaulted_members }; + } + end + ) + + let rec enum_members ~enum_name ~explicit_type acc env = + match Peek.token env with + | T_RCURLY + | T_EOF -> + ( { + boolean_members = List.rev acc.members.boolean_members; + number_members = List.rev acc.members.number_members; + string_members = List.rev acc.members.string_members; + defaulted_members = List.rev acc.members.defaulted_members; + }, + acc.has_unknown_members ) + | T_ELLIPSIS -> + let loc = Peek.loc env in + Eat.token env; + (match Peek.token env with + | T_RCURLY + | T_EOF -> + () + | T_COMMA -> + Expect.token env T_COMMA; + let trailing_comma = + match Peek.token env with + | T_RCURLY + | T_EOF -> + true + | _ -> false + in + error_at env (loc, Parse_error.EnumInvalidEllipsis { trailing_comma }) + | _ -> error_at env (loc, Parse_error.EnumInvalidEllipsis { trailing_comma = false })); + enum_members ~enum_name ~explicit_type { acc with has_unknown_members = true } env + | _ -> + let acc = enum_member ~enum_name ~explicit_type acc env in + (match Peek.token env with + | T_RCURLY + | T_EOF -> + () + | T_SEMICOLON -> + error env Parse_error.EnumInvalidMemberSeparator; + Expect.token env T_SEMICOLON + | _ -> Expect.token env T_COMMA); + enum_members ~enum_name ~explicit_type acc env + + let string_body + ~env ~enum_name ~is_explicit ~has_unknown_members string_members defaulted_members comments = + let initialized_len = List.length string_members in + let defaulted_len = List.length defaulted_members in + let defaulted_body () = + StringBody + { + StringBody.members = StringBody.Defaulted defaulted_members; + explicit_type = is_explicit; + has_unknown_members; + comments; + } + in + let initialized_body () = + StringBody + { + StringBody.members = StringBody.Initialized string_members; + explicit_type = is_explicit; + has_unknown_members; + comments; + } + in + match (initialized_len, defaulted_len) with + | (0, 0) + | (0, _) -> + defaulted_body () + | (_, 0) -> initialized_body () + | _ when defaulted_len > initialized_len -> + List.iter + (fun (loc, _) -> + error_at env (loc, Parse_error.EnumStringMemberInconsistentlyInitailized { enum_name })) + string_members; + defaulted_body () + | _ -> + List.iter + (fun (loc, _) -> + error_at env (loc, Parse_error.EnumStringMemberInconsistentlyInitailized { enum_name })) + defaulted_members; + initialized_body () + + let parse_explicit_type ~enum_name env = + if Eat.maybe env T_OF then ( + Eat.push_lex_mode env Lex_mode.TYPE; + let result = + match Peek.token env with + | T_BOOLEAN_TYPE BOOLEAN -> Some Enum_common.Boolean + | T_NUMBER_TYPE -> Some Enum_common.Number + | T_STRING_TYPE -> Some Enum_common.String + | T_SYMBOL_TYPE -> Some Enum_common.Symbol + | T_IDENTIFIER { value; _ } -> + let supplied_type = Some value in + error env (Parse_error.EnumInvalidExplicitType { enum_name; supplied_type }); + None + | _ -> + error env (Parse_error.EnumInvalidExplicitType { enum_name; supplied_type = None }); + None + in + Eat.token env; + Eat.pop_lex_mode env; + result + ) else + None + + let enum_body ~enum_name ~name_loc = + with_loc (fun env -> + let explicit_type = parse_explicit_type ~enum_name env in + let leading = + if explicit_type <> None then + Peek.comments env + else + [] + in + Expect.token env T_LCURLY; + let (members, has_unknown_members) = enum_members ~enum_name ~explicit_type empty_acc env in + Expect.token env T_RCURLY; + let trailing = + match Peek.token env with + | T_EOF + | T_RCURLY -> + Eat.trailing_comments env + | _ when Peek.is_line_terminator env -> Eat.comments_until_next_line env + | _ -> [] + in + let comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () in + let body = + match explicit_type with + | Some Enum_common.Boolean -> + BooleanBody + { + BooleanBody.members = members.boolean_members; + explicit_type = true; + has_unknown_members; + comments; + } + | Some Enum_common.Number -> + NumberBody + { + NumberBody.members = members.number_members; + explicit_type = true; + has_unknown_members; + comments; + } + | Some Enum_common.String -> + string_body + ~env + ~enum_name + ~is_explicit:true + ~has_unknown_members + members.string_members + members.defaulted_members + comments + | Some Enum_common.Symbol -> + SymbolBody + { SymbolBody.members = members.defaulted_members; has_unknown_members; comments } + | None -> + let bools_len = List.length members.boolean_members in + let nums_len = List.length members.number_members in + let strs_len = List.length members.string_members in + let defaulted_len = List.length members.defaulted_members in + let empty () = + StringBody + { + StringBody.members = StringBody.Defaulted []; + explicit_type = false; + has_unknown_members; + comments; + } + in + begin + match (bools_len, nums_len, strs_len, defaulted_len) with + | (0, 0, 0, 0) -> empty () + | (0, 0, _, _) -> + string_body + ~env + ~enum_name + ~is_explicit:false + ~has_unknown_members + members.string_members + members.defaulted_members + comments + | (_, 0, 0, _) when bools_len >= defaulted_len -> + List.iter + (fun (loc, { DefaultedMember.id = (_, { Identifier.name = member_name; _ }) }) -> + error_at + env + (loc, Parse_error.EnumBooleanMemberNotInitialized { enum_name; member_name })) + members.defaulted_members; + BooleanBody + { + BooleanBody.members = members.boolean_members; + explicit_type = false; + has_unknown_members; + comments; + } + | (0, _, 0, _) when nums_len >= defaulted_len -> + List.iter + (fun (loc, { DefaultedMember.id = (_, { Identifier.name = member_name; _ }) }) -> + error_at + env + (loc, Parse_error.EnumNumberMemberNotInitialized { enum_name; member_name })) + members.defaulted_members; + NumberBody + { + NumberBody.members = members.number_members; + explicit_type = false; + has_unknown_members; + comments; + } + | _ -> + error_at env (name_loc, Parse_error.EnumInconsistentMemberValues { enum_name }); + empty () + end + in + body) + + let declaration = + with_loc (fun env -> + let leading = Peek.comments env in + Expect.token env T_ENUM; + let id = Parse.identifier env in + let (name_loc, { Identifier.name = enum_name; _ }) = id in + let body = enum_body ~enum_name ~name_loc env in + let comments = Flow_ast_utils.mk_comments_opt ~leading () in + Statement.EnumDeclaration { id; body; comments }) +end diff --git a/lib/estree_translator.ml b/lib/estree_translator.ml index e6e970d..34da230 100644 --- a/lib/estree_translator.ml +++ b/lib/estree_translator.ml @@ -1,1493 +1,1882 @@ -(** - * Copyright (c) 2013-present, Facebook, Inc. +(* + * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. *) +module Ast = Flow_ast module type Config = sig - val include_locs: bool - val include_comments: bool + val include_locs : bool + + val include_comments : bool + + (* FIXME(festevezga, T39098154) Temporary flag while we're migrating from one approach to another *) + val include_interned_comments : bool end -module Translate (Impl : Translator_intf.S) (Config : Config) : (sig +module Translate (Impl : Translator_intf.S) (Config : Config) : sig type t - val program: - Loc.t * Loc.t Ast.Statement.t list * (Loc.t * Ast.Comment.t') list -> - t - val expression: Loc.t Ast.Expression.t -> t - val errors: (Loc.t * Parse_error.t) list -> t -end with type t = Impl.t) = struct + + val program : Offset_utils.t option -> (Loc.t, Loc.t) Ast.Program.t -> t + + val expression : Offset_utils.t option -> (Loc.t, Loc.t) Ast.Expression.t -> t + + val errors : (Loc.t * Parse_error.t) list -> t +end +with type t = Impl.t = struct type t = Impl.t + type functions = { + program: (Loc.t, Loc.t) Ast.Program.t -> t; + expression: (Loc.t, Loc.t) Ast.Expression.t -> t; + } + open Ast open Impl - let array_of_list fn list = array (List.map fn list) - let int x = number (float x) + let array_of_list fn list = array (List.rev_map fn list |> List.rev) + let option f = function | Some v -> f v | None -> null - let position p = - obj [ - "line", int p.Loc.line; - "column", int p.Loc.column; - ] - - let loc location = - let source = match Loc.source location with - | Some File_key.LibFile src - | Some File_key.SourceFile src - | Some File_key.JsonFile src - | Some File_key.ResourceFile src -> string src - | Some File_key.Builtins -> string "(global)" - | None -> null - in - obj [ - "source", source; - "start", position location.Loc.start; - "end", position location.Loc._end; - ] + let hint f = function + | Ast.Type.Available v -> f v + | Ast.Type.Missing _ -> null - let range location = Loc.( - array [ - int location.start.offset; - int location._end.offset; - ] - ) + let position p = obj [("line", int p.Loc.line); ("column", int p.Loc.column)] - let node _type location props = - let prefix = - if Config.include_locs then - (* sorted backwards due to the rev_append below *) - [ "range", range location; - "loc", loc location; - "type", string _type; ] - else - [ "type", string _type; ] + let loc location = + let source = + match Loc.source location with + | Some (File_key.LibFile src) + | Some (File_key.SourceFile src) + | Some (File_key.JsonFile src) + | Some (File_key.ResourceFile src) -> + string src + | Some File_key.Builtins -> string "(global)" + | None -> null in - obj (List.rev_append prefix props) + obj + [ + ("source", source); + ("start", position location.Loc.start); + ("end", position location.Loc._end); + ] let errors l = let error (location, e) = - obj [ - "loc", loc location; - "message", string (Parse_error.PP.error e); - ] - in array_of_list error l - - let rec program (loc, statements, comments) = - let body = statement_list statements in - let props = - if Config.include_comments then [ "body", body; "comments", comment_list comments; ] - else [ "body", body; ] + obj [("loc", loc location); ("message", string (Parse_error.PP.error e))] in - node "Program" loc props - - and statement_list statements = array_of_list statement statements - and statement = Statement.(function - | loc, Empty -> node "EmptyStatement" loc [] - | loc, Block b -> block (loc, b) - | loc, Expression expr -> - node "ExpressionStatement" loc [ - "expression", expression expr.Expression.expression; - "directive", option string expr.Expression.directive; - ] - | loc, If _if -> If.( - node "IfStatement" loc [ - "test", expression _if.test; - "consequent", statement _if.consequent; - "alternate", option statement _if.alternate; - ] - ) - | loc, Labeled labeled -> Labeled.( - node "LabeledStatement" loc [ - "label", identifier labeled.label; - "body", statement labeled.body; - ] - ) - | loc, Break break -> - node "BreakStatement" loc [ - "label", option identifier break.Break.label; - ] - | loc, Continue continue -> - node "ContinueStatement" loc [ - "label", option identifier continue.Continue.label; - ] - | loc, With _with -> With.( - node "WithStatement" loc [ - "object", expression _with._object; - "body", statement _with.body; - ] - ) - | loc, TypeAlias alias -> type_alias (loc, alias) - | loc, OpaqueType opaque_t -> opaque_type ~declare:false (loc, opaque_t) - | loc, Switch switch -> Switch.( - node "SwitchStatement" loc [ - "discriminant", expression switch.discriminant; - "cases", array_of_list case switch.cases; - ] - ) - | loc, Return return -> - node "ReturnStatement" loc [ - "argument", option expression return.Return.argument; - ] - | loc, Throw throw -> - node "ThrowStatement" loc [ - "argument", expression throw.Throw.argument; - ] - | loc, Try _try -> Try.( - node "TryStatement" loc [ - "block", block _try.block; - "handler", option catch _try.handler; - "finalizer", option block _try.finalizer; - ] - ) - | loc, While _while -> While.( - node "WhileStatement" loc [ - "test", expression _while.test; - "body", statement _while.body; - ] - ) - | loc, DoWhile dowhile -> DoWhile.( - node "DoWhileStatement" loc [ - "body", statement dowhile.body; - "test", expression dowhile.test; - ] - ) - | loc, For _for -> For.( - let init = function - | InitDeclaration init -> variable_declaration init - | InitExpression expr -> expression expr - in - node "ForStatement" loc [ - "init", option init _for.init; - "test", option expression _for.test; - "update", option expression _for.update; - "body", statement _for.body; - ] - ) - | loc, ForIn forin -> ForIn.( - let left = match forin.left with - | LeftDeclaration left -> variable_declaration left - | LeftPattern left -> pattern left - in - node "ForInStatement" loc [ - "left", left; - "right", expression forin.right; - "body", statement forin.body; - "each", bool forin.each; - ] - ) - | loc, ForOf forof -> ForOf.( - let type_ = - if forof.async - then "ForAwaitStatement" - else "ForOfStatement" + array_of_list error l + + let format_internal_comments = function + | None -> None + | Some { Ast.Syntax.leading; trailing; internal } -> + Flow_ast_utils.mk_comments_opt ~leading ~trailing:(internal @ trailing) () + + (* This is basically a lightweight class. We close over some state and then return more than one + * function that can access that state. We don't need most class features though, so let's avoid + * the dynamic dispatch and the disruptive change. *) + let make_functions offset_table = + let range offset_table location = + Loc.( + array + [ + int (Offset_utils.offset offset_table location.start); + int (Offset_utils.offset offset_table location._end); + ]) + in + let rec node _type location ?comments props = + let locs = + if Config.include_locs then + (* sorted backwards due to the rev_append below *) + let range = + match offset_table with + | Some table -> [("range", range table location)] + | None -> [] + in + range @ [("loc", loc location)] + else + [] in - let left = match forof.left with - | LeftDeclaration left -> variable_declaration left - | LeftPattern left -> pattern left + let comments = + let open Ast.Syntax in + match (Config.include_interned_comments, comments) with + | (true, Some c) -> + (match c with + | { leading = _ :: _ as l; trailing = _ :: _ as t; _ } -> + [("leadingComments", comment_list l); ("trailingComments", comment_list t)] + | { leading = _ :: _ as l; trailing = []; _ } -> [("leadingComments", comment_list l)] + | { leading = []; trailing = _ :: _ as t; _ } -> [("trailingComments", comment_list t)] + | _ -> []) + | (_, _) -> [] in - node type_ loc [ - "left", left; - "right", expression forof.right; - "body", statement forof.body; - ] - ) - | loc, Debugger -> node "DebuggerStatement" loc [] - | loc, ClassDeclaration c -> class_declaration (loc, c) - | loc, InterfaceDeclaration i -> interface_declaration (loc, i) - | loc, VariableDeclaration var -> variable_declaration (loc, var) - | loc, FunctionDeclaration fn -> function_declaration (loc, fn) - | loc, DeclareVariable d -> declare_variable (loc, d) - | loc, DeclareFunction d -> declare_function (loc, d) - | loc, DeclareClass d -> declare_class (loc, d) - | loc, DeclareInterface i -> declare_interface (loc, i) - | loc, DeclareTypeAlias a -> declare_type_alias (loc, a) - | loc, DeclareOpaqueType t -> opaque_type ~declare:true (loc, t) - | loc, DeclareModule m -> DeclareModule.( - let id = match m.id with - | Literal lit -> string_literal lit - | Identifier id -> identifier id + let prefix = locs @ comments @ [("type", string _type)] in + obj (List.rev_append prefix props) + and program (loc, { Ast.Program.statements; comments; all_comments }) = + let body = statement_list statements in + let props = + if Config.include_comments then + [("body", body); ("comments", comment_list all_comments)] + else + [("body", body)] in - node "DeclareModule" loc [ - "id", id; - "body", block m.body; - "kind", ( - match m.kind with - | DeclareModule.CommonJS _ -> string "CommonJS" - | DeclareModule.ES _ -> string "ES" - ) - ] - ) - | loc, DeclareExportDeclaration export -> DeclareExportDeclaration.( - match export.specifiers with - | Some (ExportNamedDeclaration.ExportBatchSpecifier (_, None)) -> - node "DeclareExportAllDeclaration" loc [ - "source", option string_literal export.source; - ] - | _ -> - let declaration = match export.declaration with - | Some (Variable v) -> declare_variable v - | Some (Function f) -> declare_function f - | Some (Class c) -> declare_class c - | Some (DefaultType t) -> _type t - | Some (NamedType t) -> type_alias t - | Some (NamedOpaqueType t) -> opaque_type ~declare:true t - | Some (Interface i) -> interface_declaration i + node ?comments "Program" loc props + and statement_list statements = array_of_list statement statements + and statement = + let open Statement in + function + | (loc, Empty { Empty.comments }) -> node ?comments "EmptyStatement" loc [] + | (loc, Block b) -> block (loc, b) + | (loc, Expression { Expression.expression = expr; directive; comments }) -> + node + ?comments + "ExpressionStatement" + loc + [("expression", expression expr); ("directive", option string directive)] + | (loc, If { If.test; consequent; alternate; comments }) -> + let alternate = + match alternate with | None -> null - in - node "DeclareExportDeclaration" loc [ - "default", bool ( - match export.default with - | Some _ -> true - | None -> false); - "declaration", declaration; - "specifiers", export_specifiers export.specifiers; - "source", option string_literal export.source; + | Some (_, { If.Alternate.body; comments = alternate_comments }) -> + statement (Comment_attachment.statement_add_comments body alternate_comments) + in + node + ?comments + "IfStatement" + loc + [ + ("test", expression test); ("consequent", statement consequent); ("alternate", alternate); ] - ) - | loc, DeclareModuleExports annot -> - node "DeclareModuleExports" loc [ - "typeAnnotation", type_annotation annot - ] - | loc, ExportNamedDeclaration export -> ExportNamedDeclaration.( - match export.specifiers with - | Some (ExportBatchSpecifier (_, None)) -> - node "ExportAllDeclaration" loc [ - "source", option string_literal export.source; - "exportKind", string (export_kind export.exportKind); + | (loc, Labeled { Labeled.label; body; comments }) -> + node + ?comments + "LabeledStatement" + loc + [("label", identifier label); ("body", statement body)] + | (loc, Break { Break.label; comments }) -> + node ?comments "BreakStatement" loc [("label", option identifier label)] + | (loc, Continue { Continue.label; comments }) -> + node ?comments "ContinueStatement" loc [("label", option identifier label)] + | (loc, With { With._object; body; comments }) -> + node + ?comments + "WithStatement" + loc + [("object", expression _object); ("body", statement body)] + | (loc, TypeAlias alias) -> type_alias (loc, alias) + | (loc, OpaqueType opaque_t) -> opaque_type ~declare:false (loc, opaque_t) + | (loc, Switch { Switch.discriminant; cases; comments }) -> + node + ?comments + "SwitchStatement" + loc + [("discriminant", expression discriminant); ("cases", array_of_list case cases)] + | (loc, Return { Return.argument; comments }) -> + node ?comments "ReturnStatement" loc [("argument", option expression argument)] + | (loc, Throw { Throw.argument; comments }) -> + node ?comments "ThrowStatement" loc [("argument", expression argument)] + | (loc, Try { Try.block = block_; handler; finalizer; comments }) -> + node + ?comments + "TryStatement" + loc + [ + ("block", block block_); + ("handler", option catch handler); + ("finalizer", option block finalizer); ] - | _ -> - node "ExportNamedDeclaration" loc [ - "declaration", option statement export.declaration; - "specifiers", export_specifiers export.specifiers; - "source", option string_literal export.source; - "exportKind", string (export_kind export.exportKind); + | (loc, While { While.test; body; comments }) -> + node ?comments "WhileStatement" loc [("test", expression test); ("body", statement body)] + | (loc, DoWhile { DoWhile.body; test; comments }) -> + node ?comments "DoWhileStatement" loc [("body", statement body); ("test", expression test)] + | (loc, For { For.init = init_; test; update; body; comments }) -> + let init = function + | For.InitDeclaration init -> variable_declaration init + | For.InitExpression expr -> expression expr + in + node + ?comments + "ForStatement" + loc + [ + ("init", option init init_); + ("test", option expression test); + ("update", option expression update); + ("body", statement body); ] - ) - | loc, ExportDefaultDeclaration export -> ExportDefaultDeclaration.( - let declaration = match export.declaration with - | Declaration stmt -> statement stmt - | ExportDefaultDeclaration.Expression expr -> expression expr + | (loc, ForIn { ForIn.left; right; body; each; comments }) -> + let left = + match left with + | ForIn.LeftDeclaration left -> variable_declaration left + | ForIn.LeftPattern left -> pattern left in - node "ExportDefaultDeclaration" loc [ - "declaration", declaration; - "exportKind", string (export_kind Statement.ExportValue); - ] - ) - | loc, ImportDeclaration import -> ImportDeclaration.( - let specifiers = match import.specifiers with - | Some (ImportNamedSpecifiers specifiers) -> - List.map (fun {local; remote; kind;} -> - import_named_specifier local remote kind - ) specifiers - | Some (ImportNamespaceSpecifier id) -> - [import_namespace_specifier id] - | None -> - [] + node + ?comments + "ForInStatement" + loc + [ + ("left", left); + ("right", expression right); + ("body", statement body); + ("each", bool each); + ] + | (loc, ForOf { ForOf.await; left; right; body; comments }) -> + let left = + match left with + | ForOf.LeftDeclaration left -> variable_declaration left + | ForOf.LeftPattern left -> pattern left in - - let specifiers = match import.default with - | Some default -> (import_default_specifier default)::specifiers + node + ?comments + "ForOfStatement" + loc + [ + ("left", left); + ("right", expression right); + ("body", statement body); + ("await", bool await); + ] + | (loc, EnumDeclaration enum) -> enum_declaration (loc, enum) + | (loc, Debugger { Debugger.comments }) -> node ?comments "DebuggerStatement" loc [] + | (loc, ClassDeclaration c) -> class_declaration (loc, c) + | (loc, InterfaceDeclaration i) -> interface_declaration (loc, i) + | (loc, VariableDeclaration var) -> variable_declaration (loc, var) + | (loc, FunctionDeclaration fn) -> function_declaration (loc, fn) + | (loc, DeclareVariable d) -> declare_variable (loc, d) + | (loc, DeclareFunction d) -> declare_function (loc, d) + | (loc, DeclareClass d) -> declare_class (loc, d) + | (loc, DeclareInterface i) -> declare_interface (loc, i) + | (loc, DeclareTypeAlias a) -> declare_type_alias (loc, a) + | (loc, DeclareOpaqueType t) -> opaque_type ~declare:true (loc, t) + | (loc, DeclareModule { DeclareModule.id; body; kind; comments }) -> + let id = + match id with + | DeclareModule.Literal lit -> string_literal lit + | DeclareModule.Identifier id -> identifier id + in + node + ?comments + "DeclareModule" + loc + [ + ("id", id); + ("body", block body); + ( "kind", + match kind with + | DeclareModule.CommonJS _ -> string "CommonJS" + | DeclareModule.ES _ -> string "ES" ); + ] + | ( loc, + DeclareExportDeclaration + { DeclareExportDeclaration.specifiers; declaration; default; source; comments } ) -> + begin + match specifiers with + | Some (ExportNamedDeclaration.ExportBatchSpecifier (_, None)) -> + node + ?comments + "DeclareExportAllDeclaration" + loc + [("source", option string_literal source)] + | _ -> + let declaration = + match declaration with + | Some (DeclareExportDeclaration.Variable v) -> declare_variable v + | Some (DeclareExportDeclaration.Function f) -> declare_function f + | Some (DeclareExportDeclaration.Class c) -> declare_class c + | Some (DeclareExportDeclaration.DefaultType t) -> _type t + | Some (DeclareExportDeclaration.NamedType t) -> type_alias t + | Some (DeclareExportDeclaration.NamedOpaqueType t) -> opaque_type ~declare:true t + | Some (DeclareExportDeclaration.Interface i) -> interface_declaration i + | None -> null + in + node + ?comments + "DeclareExportDeclaration" + loc + [ + ( "default", + bool + (match default with + | Some _ -> true + | None -> false) ); + ("declaration", declaration); + ("specifiers", export_specifiers specifiers); + ("source", option string_literal source); + ] + end + | (loc, DeclareModuleExports { DeclareModuleExports.annot; comments }) -> + node ?comments "DeclareModuleExports" loc [("typeAnnotation", type_annotation annot)] + | ( loc, + ExportNamedDeclaration + { ExportNamedDeclaration.specifiers; declaration; source; export_kind; comments } ) -> + begin + match specifiers with + | Some (ExportNamedDeclaration.ExportBatchSpecifier (_, None)) -> + node + ?comments + "ExportAllDeclaration" + loc + [ + ("source", option string_literal source); + ("exportKind", string (string_of_export_kind export_kind)); + ] + | _ -> + node + ?comments + "ExportNamedDeclaration" + loc + [ + ("declaration", option statement declaration); + ("specifiers", export_specifiers specifiers); + ("source", option string_literal source); + ("exportKind", string (string_of_export_kind export_kind)); + ] + end + | ( loc, + ExportDefaultDeclaration + { + ExportDefaultDeclaration.declaration; + default = _ (* TODO: confirm we shouldn't use this *); + comments; + } ) -> + let declaration = + match declaration with + | ExportDefaultDeclaration.Declaration stmt -> statement stmt + | ExportDefaultDeclaration.Expression expr -> expression expr + in + node + ?comments + "ExportDefaultDeclaration" + loc + [ + ("declaration", declaration); + ("exportKind", string (string_of_export_kind Statement.ExportValue)); + ] + | ( loc, + ImportDeclaration { ImportDeclaration.specifiers; default; import_kind; source; comments } + ) -> + let specifiers = + match specifiers with + | Some (ImportDeclaration.ImportNamedSpecifiers specifiers) -> + List.map + (fun { ImportDeclaration.local; remote; kind } -> + import_named_specifier local remote kind) + specifiers + | Some (ImportDeclaration.ImportNamespaceSpecifier id) -> [import_namespace_specifier id] + | None -> [] + in + let specifiers = + match default with + | Some default -> import_default_specifier default :: specifiers | None -> specifiers in - - let import_kind = match import.importKind with - | ImportType -> "type" - | ImportTypeof -> "typeof" - | ImportValue -> "value" + let import_kind = + match import_kind with + | ImportDeclaration.ImportType -> "type" + | ImportDeclaration.ImportTypeof -> "typeof" + | ImportDeclaration.ImportValue -> "value" in - - node "ImportDeclaration" loc [ - "specifiers", array specifiers; - "source", string_literal import.source; - "importKind", string (import_kind); - ] - ) - ) - - and expression = Expression.(function - | loc, This -> node "ThisExpression" loc [] - | loc, Super -> node "Super" loc [] - | loc, Array arr -> - node "ArrayExpression" loc [ - "elements", array_of_list (option expression_or_spread) arr.Array.elements; - ] - | loc, Object _object -> - node "ObjectExpression" loc [ - "properties", array_of_list object_property _object.Object.properties; - ] - | loc, Function _function -> function_expression (loc, _function) - | loc, ArrowFunction arrow -> Function.( - let body = (match arrow.body with - | BodyBlock b -> block b - | BodyExpression expr -> expression expr) + node + ?comments + "ImportDeclaration" + loc + [ + ("specifiers", array specifiers); + ("source", string_literal source); + ("importKind", string import_kind); + ] + and expression = + let open Expression in + function + | (loc, This { This.comments }) -> node ?comments "ThisExpression" loc [] + | (loc, Super { Super.comments }) -> node ?comments "Super" loc [] + | (loc, Array { Array.elements; comments }) -> + node + ?comments:(format_internal_comments comments) + "ArrayExpression" + loc + [("elements", array_of_list array_element elements)] + | (loc, Object { Object.properties; comments }) -> + node + ?comments:(format_internal_comments comments) + "ObjectExpression" + loc + [("properties", array_of_list object_property properties)] + | (loc, Function _function) -> function_expression (loc, _function) + | ( loc, + ArrowFunction + { + Function.params = (_, { Function.Params.comments = params_comments; _ }) as params; + async; + predicate = predicate_; + tparams; + return; + body; + comments = func_comments; + sig_loc = _; + (* TODO: arrows shouldn't have these: *) + id = _; + generator = _; + } ) -> + let (body, expression) = + match body with + | Function.BodyBlock b -> (block b, false) + | Function.BodyExpression expr -> (expression expr, true) in - node "ArrowFunctionExpression" loc [ - "id", option identifier arrow.id; - "params", function_params arrow.params; - "body", body; - "async", bool arrow.async; - "generator", bool arrow.generator; - "predicate", option predicate arrow.predicate; - "expression", bool arrow.expression; - "returnType", option type_annotation arrow.return; - "typeParameters", option type_parameter_declaration arrow.tparams; - ] - ) - | loc, Sequence sequence -> - node "SequenceExpression" loc [ - "expressions", array_of_list expression sequence.Sequence.expressions; - ] - | loc, Unary unary -> Unary.( - match unary.operator with - | Await -> - (* await is defined as a separate expression in ast-types - * - * TODO - * 1) Send a PR to ast-types - * (https://github.com/benjamn/ast-types/issues/113) - * 2) Output a UnaryExpression - * 3) Modify the esprima test runner to compare AwaitExpression and - * our UnaryExpression - * *) - node "AwaitExpression" loc [ - "argument", expression unary.argument; + let return = + match return with + | Ast.Type.Missing _ -> None + | Ast.Type.Available t -> Some t + in + let comments = + Flow_ast_utils.merge_comments + ~outer:func_comments + ~inner:(format_internal_comments params_comments) + in + node + ?comments + "ArrowFunctionExpression" + loc + [ + ("id", null); + ("params", function_params params); + ("body", body); + ("async", bool async); + ("generator", bool false); + ("predicate", option predicate predicate_); + ("expression", bool expression); + ("returnType", option type_annotation return); + ("typeParameters", option type_parameter_declaration tparams); ] - | _ -> begin - let operator = match unary.operator with - | Minus -> "-" - | Plus -> "+" - | Not -> "!" - | BitNot -> "~" - | Typeof -> "typeof" - | Void -> "void" - | Delete -> "delete" - | Await -> failwith "matched above" - in - node "UnaryExpression" loc [ - "operator", string operator; - "prefix", bool unary.prefix; - "argument", expression unary.argument; + | (loc, Sequence { Sequence.expressions; comments }) -> + node + ?comments + "SequenceExpression" + loc + [("expressions", array_of_list expression expressions)] + | (loc, Unary { Unary.operator; argument; comments }) -> + Unary.( + (match operator with + | Await -> node ?comments "AwaitExpression" loc [("argument", expression argument)] + | _ -> + let operator = + match operator with + | Minus -> "-" + | Plus -> "+" + | Not -> "!" + | BitNot -> "~" + | Typeof -> "typeof" + | Void -> "void" + | Delete -> "delete" + | Await -> failwith "matched above" + in + node + ?comments + "UnaryExpression" + loc + [ + ("operator", string operator); + ("prefix", bool true); + ("argument", expression argument); + ])) + | (loc, Binary { Binary.left; operator; right; comments }) -> + node + ?comments + "BinaryExpression" + loc + [ + ("operator", string (Flow_ast_utils.string_of_binary_operator operator)); + ("left", expression left); + ("right", expression right); ] - end - ) - | loc, Binary binary -> Binary.( - let operator = match binary.operator with - | Equal -> "==" - | NotEqual -> "!=" - | StrictEqual -> "===" - | StrictNotEqual -> "!==" - | LessThan -> "<" - | LessThanEqual -> "<=" - | GreaterThan -> ">" - | GreaterThanEqual -> ">=" - | LShift -> "<<" - | RShift -> ">>" - | RShift3 -> ">>>" - | Plus -> "+" - | Minus -> "-" - | Mult -> "*" - | Exp -> "**" - | Div -> "/" - | Mod -> "%" - | BitOr -> "|" - | Xor -> "^" - | BitAnd -> "&" - | In -> "in" - | Instanceof -> "instanceof" + | (loc, TypeCast { TypeCast.expression = expr; annot; comments }) -> + node + ?comments + "TypeCastExpression" + loc + [("expression", expression expr); ("typeAnnotation", type_annotation annot)] + | (loc, Assignment { Assignment.left; operator; right; comments }) -> + let operator = + match operator with + | None -> "=" + | Some op -> Flow_ast_utils.string_of_assignment_operator op in - node "BinaryExpression" loc [ - "operator", string operator; - "left", expression binary.left; - "right", expression binary.right; - ] - ) - | loc, TypeCast typecast -> TypeCast.( - node "TypeCastExpression" loc [ - "expression", expression typecast.expression; - "typeAnnotation", type_annotation typecast.annot; - ] - ) - | loc, Assignment assignment -> Assignment.( - let operator = match assignment.operator with - | Assign -> "=" - | PlusAssign -> "+=" - | MinusAssign -> "-=" - | MultAssign -> "*=" - | ExpAssign -> "**=" - | DivAssign -> "/=" - | ModAssign -> "%=" - | LShiftAssign -> "<<=" - | RShiftAssign -> ">>=" - | RShift3Assign -> ">>>=" - | BitOrAssign -> "|=" - | BitXorAssign -> "^=" - | BitAndAssign -> "&=" + node + ?comments + "AssignmentExpression" + loc + [("operator", string operator); ("left", pattern left); ("right", expression right)] + | (loc, Update { Update.operator; argument; prefix; comments }) -> + let operator = + match operator with + | Update.Increment -> "++" + | Update.Decrement -> "--" in - node "AssignmentExpression" loc [ - "operator", string operator; - "left", pattern assignment.left; - "right", expression assignment.right; - ] - ) - | loc, Update update -> Update.( - let operator = match update.operator with - | Increment -> "++" - | Decrement -> "--" + node + ?comments + "UpdateExpression" + loc + [ + ("operator", string operator); ("argument", expression argument); ("prefix", bool prefix); + ] + | (loc, Logical { Logical.left; operator; right; comments }) -> + let operator = + match operator with + | Logical.Or -> "||" + | Logical.And -> "&&" + | Logical.NullishCoalesce -> "??" in - node "UpdateExpression" loc [ - "operator", string operator; - "argument", expression update.argument; - "prefix", bool update.prefix; - ] - ) - | loc, Logical logical -> Logical.( - let operator = match logical.operator with - | Or -> "||" - | And -> "&&" - | NullishCoalesce -> "??" + node + ?comments + "LogicalExpression" + loc + [("operator", string operator); ("left", expression left); ("right", expression right)] + | (loc, Conditional { Conditional.test; consequent; alternate; comments }) -> + node + ?comments + "ConditionalExpression" + loc + [ + ("test", expression test); + ("consequent", expression consequent); + ("alternate", expression alternate); + ] + | (loc, New { New.callee; targs; arguments; comments }) -> + let (arguments, comments) = + match arguments with + | Some ((_, { ArgList.comments = args_comments; _ }) as arguments) -> + ( arg_list arguments, + Flow_ast_utils.merge_comments + ~inner:(format_internal_comments args_comments) + ~outer:comments ) + | None -> (array [], comments) in - node "LogicalExpression" loc [ - "operator", string operator; - "left", expression logical.left; - "right", expression logical.right; - ] - ) - | loc, Conditional conditional -> Conditional.( - node "ConditionalExpression" loc [ - "test", expression conditional.test; - "consequent", expression conditional.consequent; - "alternate", expression conditional.alternate; + node + ?comments + "NewExpression" + loc + [ + ("callee", expression callee); + ("typeArguments", option call_type_args targs); + ("arguments", arguments); + ] + | ( loc, + Call + ({ Call.comments; arguments = (_, { ArgList.comments = args_comments; _ }); _ } as call) + ) -> + let comments = + Flow_ast_utils.merge_comments + ~inner:(format_internal_comments args_comments) + ~outer:comments + in + node ?comments "CallExpression" loc (call_node_properties call) + | ( loc, + OptionalCall + { + OptionalCall.call = + { Call.comments; arguments = (_, { ArgList.comments = args_comments; _ }); _ } as + call; + optional; + } ) -> + let comments = + Flow_ast_utils.merge_comments + ~inner:(format_internal_comments args_comments) + ~outer:comments + in + node + ?comments + "OptionalCallExpression" + loc + (call_node_properties call @ [("optional", bool optional)]) + | (loc, Member ({ Member.comments; _ } as member)) -> + node ?comments "MemberExpression" loc (member_node_properties member) + | (loc, OptionalMember { OptionalMember.member = { Member.comments; _ } as member; optional }) + -> + node + ?comments + "OptionalMemberExpression" + loc + (member_node_properties member @ [("optional", bool optional)]) + | (loc, Yield { Yield.argument; delegate; comments }) -> + node + ?comments + "YieldExpression" + loc + [("argument", option expression argument); ("delegate", bool delegate)] + | (loc, Comprehension { Comprehension.blocks; filter }) -> + node + "ComprehensionExpression" + loc + [ + ("blocks", array_of_list comprehension_block blocks); + ("filter", option expression filter); + ] + | (loc, Generator { Generator.blocks; filter }) -> + node + "GeneratorExpression" + loc + [ + ("blocks", array_of_list comprehension_block blocks); + ("filter", option expression filter); + ] + | (_loc, Identifier id) -> identifier id + | (loc, Literal ({ Literal.value = Ast.Literal.BigInt _; _ } as lit)) -> + bigint_literal (loc, lit) + | (loc, Literal lit) -> literal (loc, lit) + | (loc, TemplateLiteral lit) -> template_literal (loc, lit) + | (loc, TaggedTemplate tagged) -> tagged_template (loc, tagged) + | (loc, Class c) -> class_expression (loc, c) + | (loc, JSXElement element) -> jsx_element (loc, element) + | (loc, JSXFragment fragment) -> jsx_fragment (loc, fragment) + | (loc, MetaProperty { MetaProperty.meta; property; comments }) -> + node + ?comments + "MetaProperty" + loc + [("meta", identifier meta); ("property", identifier property)] + | (loc, Import { Import.argument; comments }) -> + node ?comments "ImportExpression" loc [("source", expression argument)] + and function_declaration + ( loc, + { + Function.id; + params = (_, { Function.Params.comments = params_comments; _ }) as params; + async; + generator; + predicate = predicate_; + tparams; + return; + body; + comments = func_comments; + sig_loc = _; + } ) = + let body = + match body with + | Function.BodyBlock b -> b + | Function.BodyExpression _ -> failwith "Unexpected FunctionDeclaration with BodyExpression" + in + let return = + match return with + | Ast.Type.Missing _ -> None + | Ast.Type.Available t -> Some t + in + let comments = + Flow_ast_utils.merge_comments + ~outer:func_comments + ~inner:(format_internal_comments params_comments) + in + node + ?comments + "FunctionDeclaration" + loc + [ + (* estree hasn't come around to the idea that function decls can have + optional ids, but acorn, babel, espree and esprima all have, so let's + do it too. see https://github.com/estree/estree/issues/98 *) + ("id", option identifier id); + ("params", function_params params); + ("body", block body); + ("async", bool async); + ("generator", bool generator); + ("predicate", option predicate predicate_); + ("expression", bool false); + ("returnType", option type_annotation return); + ("typeParameters", option type_parameter_declaration tparams); ] - ) - | loc, New _new -> New.( - node "NewExpression" loc [ - "callee", expression _new.callee; - "typeArguments", option type_parameter_instantiation _new.targs; - "arguments", array_of_list expression_or_spread _new.arguments; + and function_expression + ( loc, + { + Function.id; + params = (_, { Function.Params.comments = params_comments; _ }) as params; + async; + generator; + predicate = predicate_; + tparams; + return; + body; + comments = func_comments; + sig_loc = _; + } ) = + let body = + match body with + | Function.BodyBlock b -> b + | Function.BodyExpression _ -> failwith "Unexpected FunctionExpression with BodyExpression" + in + let return = + match return with + | Ast.Type.Missing _ -> None + | Ast.Type.Available t -> Some t + in + let comments = + Flow_ast_utils.merge_comments + ~outer:func_comments + ~inner:(format_internal_comments params_comments) + in + node + ?comments + "FunctionExpression" + loc + [ + ("id", option identifier id); + ("params", function_params params); + ("body", block body); + ("async", bool async); + ("generator", bool generator); + ("predicate", option predicate predicate_); + ("expression", bool false); + ("returnType", option type_annotation return); + ("typeParameters", option type_parameter_declaration tparams); ] - ) - | loc, Call call -> - node "CallExpression" loc (call_node_properties call) - | loc, OptionalCall opt_call -> OptionalCall.( - node "OptionalCallExpression" loc (call_node_properties opt_call.call @ [ - "optional", bool opt_call.optional; - ]) - ) - | loc, Member member -> - node "MemberExpression" loc (member_node_properties member) - | loc, OptionalMember opt_member -> OptionalMember.( - node "OptionalMemberExpression" loc (member_node_properties opt_member.member @ [ - "optional", bool opt_member.optional; - ]) - ) - | loc, Yield yield -> Yield.( - node "YieldExpression" loc [ - "argument", option expression yield.argument; - "delegate", bool yield.delegate; + and identifier (loc, { Identifier.name; comments }) = + node + "Identifier" + ?comments + loc + [("name", string name); ("typeAnnotation", null); ("optional", bool false)] + and private_name (loc, { PrivateName.id; comments }) = + node ?comments "PrivateName" loc [("id", identifier id)] + and pattern_identifier + loc { Pattern.Identifier.name = (_, { Identifier.name; comments }); annot; optional } = + node + ?comments + "Identifier" + loc + [ + ("name", string name); + ("typeAnnotation", hint type_annotation annot); + ("optional", bool optional); ] - ) - | loc, Comprehension comp -> Comprehension.( - node "ComprehensionExpression" loc [ - "blocks", array_of_list comprehension_block comp.blocks; - "filter", option expression comp.filter; + and arg_list (_loc, { Expression.ArgList.arguments; comments = _ }) = + (* ESTree does not have a unique node for argument lists, so there's nowhere to + include the loc. *) + array_of_list expression_or_spread arguments + and case (loc, { Statement.Switch.Case.test; consequent; comments }) = + node + ?comments + "SwitchCase" + loc + [("test", option expression test); ("consequent", array_of_list statement consequent)] + and catch (loc, { Statement.Try.CatchClause.param; body; comments }) = + node ?comments "CatchClause" loc [("param", option pattern param); ("body", block body)] + and block (loc, { Statement.Block.body; comments }) = + node + ?comments:(format_internal_comments comments) + "BlockStatement" + loc + [("body", statement_list body)] + and declare_variable (loc, { Statement.DeclareVariable.id; annot; comments }) = + let id_loc = + Loc.btwn + (fst id) + (match annot with + | Ast.Type.Available annot -> fst annot + | Ast.Type.Missing _ -> fst id) + in + node + ?comments + "DeclareVariable" + loc + [ + ("id", pattern_identifier id_loc { Pattern.Identifier.name = id; annot; optional = false }); ] - ) - | loc, Generator gen -> Generator.( - node "GeneratorExpression" loc [ - "blocks", array_of_list comprehension_block gen.blocks; - "filter", option expression gen.filter; + and declare_function + (loc, { Statement.DeclareFunction.id; annot; predicate = predicate_; comments }) = + let id_loc = Loc.btwn (fst id) (fst annot) in + node + ?comments + "DeclareFunction" + loc + [ + ( "id", + pattern_identifier + id_loc + { Pattern.Identifier.name = id; annot = Ast.Type.Available annot; optional = false } + ); + ("predicate", option predicate predicate_); ] - ) - | _loc, Identifier id -> identifier id - | loc, Literal lit -> literal (loc, lit) - | loc, TemplateLiteral lit -> template_literal (loc, lit) - | loc, TaggedTemplate tagged -> tagged_template (loc, tagged) - | loc, Class c -> class_expression (loc, c) - | loc, JSXElement element -> jsx_element (loc, element) - | loc, JSXFragment fragment -> jsx_fragment (loc, fragment) - | loc, MetaProperty meta_prop -> MetaProperty.( - node "MetaProperty" loc [ - "meta", identifier meta_prop.meta; - "property", identifier meta_prop.property; + and declare_class + (loc, { Statement.DeclareClass.id; tparams; body; extends; implements; mixins; comments }) = + (* TODO: extends shouldn't return an array *) + let extends = + match extends with + | Some extends -> array [interface_extends extends] + | None -> array [] + in + let implements = + match implements with + | Some (_, { Class.Implements.interfaces; comments = _ }) -> + array_of_list class_implements interfaces + | None -> array [] + in + node + ?comments + "DeclareClass" + loc + [ + ("id", identifier id); + ("typeParameters", option type_parameter_declaration tparams); + ("body", object_type ~include_inexact:false body); + ("extends", extends); + ("implements", implements); + ("mixins", array_of_list interface_extends mixins); ] - ) - | loc, Import arg -> node "CallExpression" loc [ - "callee", node "Import" (Loc.btwn loc (fst arg)) []; - "arguments", array_of_list expression [arg]; - ] - ) - - and function_declaration (loc, fn) = Function.( - let body = match fn.body with - | BodyBlock b -> block b - | BodyExpression b -> expression b in - - node "FunctionDeclaration" loc [ - (* estree hasn't come around to the idea that function decls can have - optional ids, but acorn, babel, espree and esprima all have, so let's - do it too. see https://github.com/estree/estree/issues/98 *) - "id", option identifier fn.id; - "params", function_params fn.params; - "body", body; - "async", bool fn.async; - "generator", bool fn.generator; - "predicate", option predicate fn.predicate; - "expression", bool fn.expression; - "returnType", option type_annotation fn.return; - "typeParameters", option type_parameter_declaration fn.tparams; - ] - ) - - and function_expression (loc, _function) = Function.( - let body = match _function.body with - | BodyBlock b -> block b - | BodyExpression expr -> expression expr - in - node "FunctionExpression" loc [ - "id", option identifier _function.id; - "params", function_params _function.params; - "body", body; - "async", bool _function.async; - "generator", bool _function.generator; - "predicate", option predicate _function.predicate; - "expression", bool _function.expression; - "returnType", option type_annotation _function.return; - "typeParameters", option type_parameter_declaration _function.tparams; - ] - ) - - and identifier (loc, name) = - node "Identifier" loc [ - "name", string name; - "typeAnnotation", null; - "optional", bool false; - ] - - and private_name (loc, name) = - node "PrivateName" loc [ - "id", identifier name; - ] - - and pattern_identifier loc { - Pattern.Identifier.name; annot; optional; - } = - node "Identifier" loc [ - "name", string (snd name); - "typeAnnotation", option type_annotation annot; - "optional", bool optional; - ] - - and case (loc, c) = Statement.Switch.Case.( - node "SwitchCase" loc [ - "test", option expression c.test; - "consequent", array_of_list statement c.consequent; - ] - ) - - and catch (loc, c) = Statement.Try.CatchClause.( - node "CatchClause" loc [ - "param", option pattern c.param; - "body", block c.body; - ] - ) - - and block (loc, b) = - node "BlockStatement" loc [ - "body", statement_list b.Statement.Block.body; - ] - - and declare_variable (loc, d) = Statement.DeclareVariable.( - let id_loc = Loc.btwn (fst d.id) (match d.annot with - | Some annot -> fst annot - | None -> fst d.id) in - node "DeclareVariable" loc [ - "id", pattern_identifier id_loc { - Pattern.Identifier.name = d.id; - annot = d.annot; - optional = false; - }; - ] - ) - - and declare_function (loc, d) = Statement.DeclareFunction.( - let id_loc = Loc.btwn (fst d.id) (fst d.annot) in - node "DeclareFunction" loc [ - "id", pattern_identifier id_loc { - Pattern.Identifier.name = d.id; - annot = Some d.annot; - optional = false; - }; - "predicate", option predicate d.predicate - ] - ) - - and declare_class (loc, { Statement.DeclareClass. - id; - tparams; - body; - extends; - implements; - mixins; - }) = - (* TODO: extends shouldn't return an array *) - let extends = match extends with - | Some extends -> array [interface_extends extends] - | None -> array [] - in - node "DeclareClass" loc [ - "id", identifier id; - "typeParameters", option type_parameter_declaration tparams; - "body", object_type body; - "extends", extends; - "implements", array_of_list class_implements implements; - "mixins", array_of_list interface_extends mixins; - ] - - and declare_interface (loc, { Statement.Interface. - id; - tparams; - body; - extends; - }) = - node "DeclareInterface" loc [ - "id", identifier id; - "typeParameters", option type_parameter_declaration tparams; - "body", object_type body; - "extends", array_of_list interface_extends extends; - ] - - and export_kind = function - | Statement.ExportType -> "type" - | Statement.ExportValue -> "value" - - and export_specifiers = Statement.ExportNamedDeclaration.(function - | Some (ExportSpecifiers specifiers) -> - array_of_list export_specifier specifiers - | Some (ExportBatchSpecifier (loc, Some name)) -> - array [ - node "ExportNamespaceSpecifier" loc [ - "exported", identifier name - ] + and declare_interface (loc, { Statement.Interface.id; tparams; body; extends; comments }) = + node + ?comments + "DeclareInterface" + loc + [ + ("id", identifier id); + ("typeParameters", option type_parameter_declaration tparams); + ("body", object_type ~include_inexact:false body); + ("extends", array_of_list interface_extends extends); ] - | Some (ExportBatchSpecifier (_, None)) -> + and string_of_export_kind = function + | Statement.ExportType -> "type" + | Statement.ExportValue -> "value" + and export_specifiers = + let open Statement.ExportNamedDeclaration in + function + | Some (ExportSpecifiers specifiers) -> array_of_list export_specifier specifiers + | Some (ExportBatchSpecifier (loc, Some name)) -> + array [node "ExportNamespaceSpecifier" loc [("exported", identifier name)]] + | Some (ExportBatchSpecifier (_, None)) -> (* this should've been handled by callers, since this represents an ExportAllDeclaration, not a specifier. *) array [] - | None -> - array [] - ) - - and declare_type_alias (loc, { Statement.TypeAlias. - id; - tparams; - right; - }) = - node "DeclareTypeAlias" loc [ - "id", identifier id; - "typeParameters", option type_parameter_declaration tparams; - "right", _type right; - ] - - and type_alias (loc, alias) = Statement.TypeAlias.( - node "TypeAlias" loc [ - "id", identifier alias.id; - "typeParameters", option type_parameter_declaration alias.tparams; - "right", _type alias.right; - ] - ) - and opaque_type ~declare (loc, opaque_t) = Statement.OpaqueType.( - let name = if declare then "DeclareOpaqueType" else "OpaqueType" in - node name loc [ - "id", identifier opaque_t.id; - "typeParameters", option type_parameter_declaration opaque_t.tparams; - "impltype", option _type opaque_t.impltype; - "supertype", option _type opaque_t.supertype; - ] - ) - - and class_declaration (loc, c) = Class.( - node "ClassDeclaration" loc [ - (* estree hasn't come around to the idea that class decls can have - optional ids, but acorn, babel, espree and esprima all have, so let's - do it too. see https://github.com/estree/estree/issues/98 *) - "id", option identifier c.id; - "body", class_body c.body; - "typeParameters", option type_parameter_declaration c.tparams; - "superClass", option expression c.super; - "superTypeParameters", option type_parameter_instantiation c.super_targs; - "implements", array_of_list class_implements c.implements; - "decorators", array_of_list class_decorator c.classDecorators; - ] - ) - - and class_decorator (loc, { Ast.Class.Decorator.expression = expr }) = - node "Decorator" loc [ - "expression", expression expr; - ] - - and class_expression (loc, c) = Class.( - node "ClassExpression" loc [ - "id", option identifier c.id; - "body", class_body c.body; - "typeParameters", option type_parameter_declaration c.tparams; - "superClass", option expression c.super; - "superTypeParameters", option type_parameter_instantiation c.super_targs; - "implements", array_of_list class_implements c.implements; - "decorators", array_of_list class_decorator c.classDecorators; - ] - ) - - and class_implements (loc, implements) = Class.Implements.( - node "ClassImplements" loc [ - "id", identifier implements.id; - "typeParameters", option type_parameter_instantiation implements.targs; - ] - ) - - and class_body (loc, body) = Class.Body.( - node "ClassBody" loc [ - "body", array_of_list class_element body.body; - ] - ) - - and class_element = Class.Body.(function - | Method m -> class_method m - | PrivateField p -> class_private_field p - | Property p -> class_property p) - - and class_method (loc, method_) = - let { Class.Method.key; value; kind; static; decorators; } = method_ in - let key, computed = Expression.Object.Property.(match key with - | Literal lit -> literal lit, false - | Identifier id -> identifier id, false - | PrivateName name -> private_name name, false - | Computed expr -> expression expr, true) in - let kind = Class.Method.(match kind with - | Constructor -> "constructor" - | Method -> "method" - | Get -> "get" - | Set -> "set") in - node "MethodDefinition" loc [ - "key", key; - "value", function_expression value; - "kind", string kind; - "static", bool static; - "computed", bool computed; - "decorators", array_of_list class_decorator decorators; - ] - - and class_private_field (loc, prop) = Class.PrivateField.( - let (_, key) = prop.key in - node "ClassPrivateProperty" loc [ - "key", identifier key; - "value", option expression prop.value; - "typeAnnotation", option type_annotation prop.annot; - "static", bool prop.static; - "variance", option variance prop.variance; - ] - ) - and class_property (loc, prop) = Class.Property.( - let key, computed = (match prop.key with - | Expression.Object.Property.Literal lit -> literal lit, false - | Expression.Object.Property.Identifier id -> identifier id, false - | Expression.Object.Property.PrivateName _ -> - failwith "Internal Error: Private name found in class prop" - | Expression.Object.Property.Computed expr -> expression expr, true) in - node "ClassProperty" loc [ - "key", key; - "value", option expression prop.value; - "typeAnnotation", option type_annotation prop.annot; - "computed", bool computed; - "static", bool prop.static; - "variance", option variance prop.variance; - ] - ) - - and interface_declaration (loc, i) = Statement.Interface.( - node "InterfaceDeclaration" loc [ - "id", identifier i.id; - "typeParameters", option type_parameter_declaration i.tparams; - "body", object_type i.body; - "extends", array_of_list interface_extends i.extends; - ] - ) - - and interface_extends (loc, g) = Type.Generic.( - let id = match g.id with - | Identifier.Unqualified id -> identifier id - | Identifier.Qualified q -> generic_type_qualified_identifier q - in - node "InterfaceExtends" loc [ - "id", id; - "typeParameters", option type_parameter_instantiation g.targs; - ] - ) - - and pattern = Pattern.(function - | loc, Object obj -> - node "ObjectPattern" loc [ - "properties", array_of_list object_pattern_property obj.Object.properties; - "typeAnnotation", option type_annotation obj.Object.annot; + | None -> array [] + and declare_type_alias (loc, { Statement.TypeAlias.id; tparams; right; comments }) = + node + ?comments + "DeclareTypeAlias" + loc + [ + ("id", identifier id); + ("typeParameters", option type_parameter_declaration tparams); + ("right", _type right); ] - | loc, Array arr -> - node "ArrayPattern" loc [ - "elements", array_of_list (option array_pattern_element) arr.Array.elements; - "typeAnnotation", option type_annotation arr.Array.annot; + and type_alias (loc, { Statement.TypeAlias.id; tparams; right; comments }) = + node + ?comments + "TypeAlias" + loc + [ + ("id", identifier id); + ("typeParameters", option type_parameter_declaration tparams); + ("right", _type right); ] - | loc, Assignment { Assignment.left; right } -> - node "AssignmentPattern" loc [ - "left", pattern left; - "right", expression right + and opaque_type + ~declare (loc, { Statement.OpaqueType.id; tparams; impltype; supertype; comments }) = + let name = + if declare then + "DeclareOpaqueType" + else + "OpaqueType" + in + node + ?comments + name + loc + [ + ("id", identifier id); + ("typeParameters", option type_parameter_declaration tparams); + ("impltype", option _type impltype); + ("supertype", option _type supertype); ] - | loc, Identifier pattern_id -> - pattern_identifier loc pattern_id - | _loc, Expression expr -> expression expr) - - and function_params = Ast.Function.Params.(function - | _, { params; rest = Some (rest_loc, { Function.RestElement.argument }) } -> - let rest = node "RestElement" rest_loc [ - "argument", pattern argument; - ] in - let rev_params = params |> List.map pattern |> List.rev in - let params = List.rev (rest::rev_params) in - array params - | _, { params; rest = None } -> - array_of_list pattern params - ) - - and array_pattern_element = Pattern.Array.(function - | Element p -> pattern p - | RestElement (loc, { RestElement.argument; }) -> - node "RestElement" loc [ - "argument", pattern argument; + and class_declaration ast = class_helper "ClassDeclaration" ast + and class_expression ast = class_helper "ClassExpression" ast + and class_helper + node_type (loc, { Class.id; extends; body; tparams; implements; class_decorators; comments }) + = + let (super, super_targs, comments) = + match extends with + | Some (_, { Class.Extends.expr; targs; comments = extends_comments }) -> + (Some expr, targs, Flow_ast_utils.merge_comments ~outer:comments ~inner:extends_comments) + | None -> (None, None, comments) + in + let (implements, comments) = + match implements with + | Some (_, { Class.Implements.interfaces; comments = implements_comments }) -> + ( array_of_list class_implements interfaces, + Flow_ast_utils.merge_comments ~outer:comments ~inner:implements_comments ) + | None -> (array [], comments) + in + node + ?comments + node_type + loc + [ + (* estree hasn't come around to the idea that class decls can have + optional ids, but acorn, babel, espree and esprima all have, so let's + do it too. see https://github.com/estree/estree/issues/98 *) + ("id", option identifier id); + ("body", class_body body); + ("typeParameters", option type_parameter_declaration tparams); + ("superClass", option expression super); + ("superTypeParameters", option type_args super_targs); + ("implements", implements); + ("decorators", array_of_list class_decorator class_decorators); ] - ) - - and object_property = Expression.Object.(function - | Property (loc, prop) -> Property.( - let key, value, kind, method_, shorthand = match prop with - | Init { key; value; shorthand } -> - key, expression value, "init", false, shorthand - | Method { key; value = (loc, func) } -> - key, function_expression (loc, func), "init", true, false - | Get { key; value = (loc, func) } -> - key, function_expression (loc, func), "get", false, false - | Set { key; value = (loc, func) } -> - key, function_expression (loc, func), "set", false, false + and class_decorator (loc, { Class.Decorator.expression = expr; comments }) = + node ?comments "Decorator" loc [("expression", expression expr)] + and class_implements (loc, { Class.Implements.Interface.id; targs }) = + node "ClassImplements" loc [("id", identifier id); ("typeParameters", option type_args targs)] + and class_body (loc, { Class.Body.body; comments }) = + node ?comments "ClassBody" loc [("body", array_of_list class_element body)] + and class_element = + Class.Body.( + function + | Method m -> class_method m + | PrivateField p -> class_private_field p + | Property p -> class_property p) + and class_method (loc, { Class.Method.key; value; kind; static; decorators; comments }) = + let (key, computed, comments) = + let open Expression.Object.Property in + match key with + | Literal lit -> (literal lit, false, comments) + | Identifier id -> (identifier id, false, comments) + | PrivateName name -> (private_name name, false, comments) + | Computed (_, { ComputedKey.expression = expr; comments = computed_comments }) -> + ( expression expr, + true, + Flow_ast_utils.merge_comments ~outer:comments ~inner:computed_comments ) in - let key, computed = match key with - | Literal lit -> literal lit, false - | Identifier id -> identifier id, false - | PrivateName _ -> failwith "Internal Error: Found private field in object props" - | Computed expr -> expression expr, true + let kind = + Class.Method.( + match kind with + | Constructor -> "constructor" + | Method -> "method" + | Get -> "get" + | Set -> "set") in - node "Property" loc [ - "key", key; - "value", value; - "kind", string kind; - "method", bool method_; - "shorthand", bool shorthand; - "computed", bool computed; - ] - ) - | SpreadProperty(loc, prop) -> SpreadProperty.( - node "SpreadProperty" loc [ - "argument", expression prop.argument; - ] - )) - - and object_pattern_property = Pattern.Object.(function - | Property (loc, prop) -> Property.( - let key, computed = (match prop.key with - | Literal lit -> literal lit, false - | Identifier id -> identifier id, false - | Computed expr -> expression expr, true) in - node "Property" loc [ - "key", key; - "value", pattern prop.pattern; - "kind", string "init"; - "method", bool false; - "shorthand", bool prop.shorthand; - "computed", bool computed; - ] - ) - | RestProperty (loc, prop) -> RestProperty.( - node "RestProperty" loc [ - "argument", pattern prop.argument; - ] - ) - ) - - and expression_or_spread = Expression.(function - | Expression expr -> expression expr - | Spread (loc, { SpreadElement.argument; }) -> - node "SpreadElement" loc [ - "argument", expression argument; + node + ?comments + "MethodDefinition" + loc + [ + ("key", key); + ("value", function_expression value); + ("kind", string kind); + ("static", bool static); + ("computed", bool computed); + ("decorators", array_of_list class_decorator decorators); ] - ) - - and comprehension_block (loc, b) = Expression.Comprehension.Block.( - node "ComprehensionBlock" loc [ - "left", pattern b.left; - "right", expression b.right; - "each", bool b.each; - ] - ) - - and literal (loc, lit) = Literal.( - let { value; raw; } = lit in - let value_ = match value with - | String str -> string str - | Boolean b -> bool b - | Null -> null - | Number f -> number f - | RegExp { RegExp.pattern; flags; } -> regexp loc pattern flags - in - let props = match value with - | RegExp { RegExp.pattern; flags; } -> - let regex = obj [ - "pattern", string pattern; - "flags", string flags; - ] in - [ "value", value_; "raw", string raw; "regex", regex ] - | _ -> - [ "value", value_; "raw", string raw; ] - in - node "Literal" loc props - ) - - and string_literal (loc, lit) = StringLiteral.( - node "Literal" loc [ - "value", string lit.value; - "raw", string lit.raw; - ] - ) - - and template_literal (loc, value) = Expression.TemplateLiteral.( - node "TemplateLiteral" loc [ - "quasis", array_of_list template_element value.quasis; - "expressions", array_of_list expression value.expressions; - ] - ) - - and template_element (loc, element) = Expression.TemplateLiteral.Element.( - let value = obj [ - "raw", string element.value.raw; - "cooked", string element.value.cooked; - ] in - node "TemplateElement" loc [ - "value", value; - "tail", bool element.tail; - ] - ) - - and tagged_template (loc, tagged) = Expression.TaggedTemplate.( - node "TaggedTemplateExpression" loc [ - "tag", expression tagged.tag; - "quasi", template_literal tagged.quasi; - ] - ) - - and variable_declaration (loc, var) = Statement.VariableDeclaration.( - let kind = match var.kind with - | Var -> "var" - | Let -> "let" - | Const -> "const" - in - node "VariableDeclaration" loc [ - "declarations", array_of_list variable_declarator var.declarations; - "kind", string kind; - ] - ) - - and variable_declarator (loc, declarator) = - Statement.VariableDeclaration.Declarator.( - node "VariableDeclarator" loc [ - "id", pattern declarator.id; - "init", option expression declarator.init; - ] - ) - - and variance (loc, sigil) = - let kind = Variance.(match sigil with - | Plus -> string "plus" - | Minus -> string "minus" - ) in - node "Variance" loc [ "kind", kind ] - - and _type (loc, t) = Type.( - match t with - | Any -> any_type loc - | Mixed -> mixed_type loc - | Empty -> empty_type loc - | Void -> void_type loc - | Null -> null_type loc - | Number -> number_type loc - | String -> string_type loc - | Boolean -> boolean_type loc - | Nullable t -> nullable_type loc t - | Function fn -> function_type (loc, fn) - | Object o -> object_type (loc, o) - | Interface i -> interface_type (loc, i) - | Array t -> array_type loc t - | Generic g -> generic_type (loc, g) - | Union (t0, t1, ts) -> union_type (loc, t0::t1::ts) - | Intersection (t0, t1, ts) -> intersection_type (loc, t0::t1::ts) - | Typeof t -> typeof_type (loc, t) - | Tuple t -> tuple_type (loc, t) - | StringLiteral s -> string_literal_type (loc, s) - | NumberLiteral n -> number_literal_type (loc, n) - | BooleanLiteral b -> boolean_literal_type (loc, b) - | Exists -> exists_type loc - ) - - and any_type loc = node "AnyTypeAnnotation" loc [] - - and mixed_type loc = node "MixedTypeAnnotation" loc [] - - and empty_type loc = node "EmptyTypeAnnotation" loc [] - - and void_type loc = node "VoidTypeAnnotation" loc [] - - and null_type loc = node "NullLiteralTypeAnnotation" loc [] - - and number_type loc = node "NumberTypeAnnotation" loc [] - - and string_type loc = node "StringTypeAnnotation" loc [] - - and boolean_type loc = node "BooleanTypeAnnotation" loc [] - - and nullable_type loc t = - node "NullableTypeAnnotation" loc [ - "typeAnnotation", _type t; - ] - - and function_type (loc, fn) = Type.Function.( - let (_, { Params.params; rest }) = fn.params in - node "FunctionTypeAnnotation" loc [ - "params", array_of_list function_type_param params; - "returnType", _type fn.return; - "rest", option function_type_rest rest; - "typeParameters", option type_parameter_declaration fn.tparams; - ] - ) - - and function_type_param (loc, param) = Type.Function.Param.( - node "FunctionTypeParam" loc [ - "name", option identifier param.name; - "typeAnnotation", _type param.annot; - "optional", bool param.optional; - ] - ) - - and function_type_rest (_loc, { Type.Function.RestParam.argument }) = - (* TODO: add a node for the rest param itself, including the `...`, - like we do with RestElement on normal functions. This should be - coordinated with Babel, ast-types, etc. so keeping the status quo for - now. Here's an example: *) - (* node "FunctionTypeRestParam" loc [ - "argument", function_type_param argument; - ] *) - function_type_param argument - - and object_type (loc, o) = Type.Object.( - let props, ixs, calls, slots = List.fold_left (fun (props, ixs, calls, slots) -> + and class_private_field + ( loc, + { + Class.PrivateField.key = (_, { PrivateName.id; comments = key_comments }); + value; + annot; + static; + variance = variance_; + comments; + } ) = + let (value, declare) = + match value with + | Class.Property.Declared -> (None, true) + | Class.Property.Uninitialized -> (None, false) + | Class.Property.Initialized x -> (Some x, false) + in + let comments = Flow_ast_utils.merge_comments ~outer:comments ~inner:key_comments in + let props = + [ + ("key", identifier id); + ("value", option expression value); + ("typeAnnotation", hint type_annotation annot); + ("static", bool static); + ("variance", option variance variance_); + ] + @ + if declare then + [("declare", bool declare)] + else + [] + in + node ?comments "ClassPrivateProperty" loc props + and class_property + (loc, { Class.Property.key; value; annot; static; variance = variance_; comments }) = + let (key, computed, comments) = + match key with + | Expression.Object.Property.Literal lit -> (literal lit, false, comments) + | Expression.Object.Property.Identifier id -> (identifier id, false, comments) + | Expression.Object.Property.PrivateName _ -> + failwith "Internal Error: Private name found in class prop" + | Expression.Object.Property.Computed + (_, { ComputedKey.expression = expr; comments = key_comments }) -> + (expression expr, true, Flow_ast_utils.merge_comments ~outer:comments ~inner:key_comments) + in + let (value, declare) = + match value with + | Class.Property.Declared -> (None, true) + | Class.Property.Uninitialized -> (None, false) + | Class.Property.Initialized x -> (Some x, false) + in + let props = + [ + ("key", key); + ("value", option expression value); + ("typeAnnotation", hint type_annotation annot); + ("computed", bool computed); + ("static", bool static); + ("variance", option variance variance_); + ] + @ + if declare then + [("declare", bool declare)] + else + [] + in + node ?comments "ClassProperty" loc props + and enum_declaration (loc, { Statement.EnumDeclaration.id; body; comments }) = + let open Statement.EnumDeclaration in + let enum_body = + match body with + | (loc, BooleanBody { BooleanBody.members; explicit_type; has_unknown_members; comments }) + -> + node + ?comments + "EnumBooleanBody" + loc + [ + ( "members", + array_of_list + (fun (loc, { InitializedMember.id; init }) -> + node + "EnumBooleanMember" + loc + [("id", identifier id); ("init", boolean_literal init)]) + members ); + ("explicitType", bool explicit_type); + ("hasUnknownMembers", bool has_unknown_members); + ] + | (loc, NumberBody { NumberBody.members; explicit_type; has_unknown_members; comments }) -> + node + ?comments + "EnumNumberBody" + loc + [ + ( "members", + array_of_list + (fun (loc, { InitializedMember.id; init }) -> + node + "EnumNumberMember" + loc + [("id", identifier id); ("init", number_literal init)]) + members ); + ("explicitType", bool explicit_type); + ("hasUnknownMembers", bool has_unknown_members); + ] + | (loc, StringBody { StringBody.members; explicit_type; has_unknown_members; comments }) -> + let members = + match members with + | StringBody.Defaulted defaulted_members -> + List.map + (fun (loc, { DefaultedMember.id }) -> + node "EnumDefaultedMember" loc [("id", identifier id)]) + defaulted_members + | StringBody.Initialized initialized_members -> + List.map + (fun (loc, { InitializedMember.id; init }) -> + node "EnumStringMember" loc [("id", identifier id); ("init", string_literal init)]) + initialized_members + in + node + ?comments + "EnumStringBody" + loc + [ + ("members", array members); + ("explicitType", bool explicit_type); + ("hasUnknownMembers", bool has_unknown_members); + ] + | (loc, SymbolBody { SymbolBody.members; has_unknown_members; comments }) -> + node + ?comments + "EnumSymbolBody" + loc + [ + ( "members", + array_of_list + (fun (loc, { DefaultedMember.id }) -> + node "EnumDefaultedMember" loc [("id", identifier id)]) + members ); + ("hasUnknownMembers", bool has_unknown_members); + ] + in + node ?comments "EnumDeclaration" loc [("id", identifier id); ("body", enum_body)] + and interface_declaration (loc, { Statement.Interface.id; tparams; body; extends; comments }) = + node + ?comments + "InterfaceDeclaration" + loc + [ + ("id", identifier id); + ("typeParameters", option type_parameter_declaration tparams); + ("body", object_type ~include_inexact:false body); + ("extends", array_of_list interface_extends extends); + ] + and interface_extends (loc, { Type.Generic.id; targs; comments }) = + let id = + match id with + | Type.Generic.Identifier.Unqualified id -> identifier id + | Type.Generic.Identifier.Qualified q -> generic_type_qualified_identifier q + in + node ?comments "InterfaceExtends" loc [("id", id); ("typeParameters", option type_args targs)] + and pattern = + Pattern.( + function + | (loc, Object { Object.properties; annot; comments }) -> + node + ?comments:(format_internal_comments comments) + "ObjectPattern" + loc + [ + ("properties", array_of_list object_pattern_property properties); + ("typeAnnotation", hint type_annotation annot); + ] + | (loc, Array { Array.elements; annot; comments }) -> + node + ?comments:(format_internal_comments comments) + "ArrayPattern" + loc + [ + ("elements", array_of_list array_pattern_element elements); + ("typeAnnotation", hint type_annotation annot); + ] + | (loc, Identifier pattern_id) -> pattern_identifier loc pattern_id + | (_loc, Expression expr) -> expression expr) + and function_param (loc, { Ast.Function.Param.argument; default }) = + match default with + | Some default -> + node "AssignmentPattern" loc [("left", pattern argument); ("right", expression default)] + | None -> pattern argument + and this_param (loc, { Function.ThisParam.annot; comments }) = + node + ?comments + "Identifier" + loc + [("name", string "this"); ("typeAnnotation", type_annotation annot)] + and function_params = + let open Ast.Function.Params in function - | Property p -> - let prop = object_type_property p in - prop::props, ixs, calls, slots - | SpreadProperty p -> - let prop = object_type_spread_property p in - prop::props, ixs, calls, slots - | Indexer i -> - let ix = object_type_indexer i in - props, ix::ixs, calls, slots - | CallProperty c -> - let call = object_type_call_property c in - props, ixs, call::calls, slots - | InternalSlot s -> - let slot = object_type_internal_slot s in - props, ixs, calls, slot::slots - ) ([], [], [], []) o.properties in - node "ObjectTypeAnnotation" loc [ - "exact", bool o.exact; - "properties", array (List.rev props); - "indexers", array (List.rev ixs); - "callProperties", array (List.rev calls); - "internalSlots", array (List.rev slots); - ] - ) - - and object_type_property (loc, { Type.Object.Property. - key; value; optional; static; proto; variance = variance_; _method; - }) = - let key = match key with - | Expression.Object.Property.Literal lit -> literal lit - | Expression.Object.Property.Identifier id -> identifier id - | Expression.Object.Property.PrivateName _ -> - failwith "Internal Error: Found private field in object props" - | Expression.Object.Property.Computed _ -> - failwith "There should not be computed object type property keys" - in - let value, kind = match value with - | Type.Object.Property.Init value -> _type value, "init" - | Type.Object.Property.Get (loc, f) -> function_type (loc, f), "get" - | Type.Object.Property.Set (loc, f) -> function_type (loc, f), "set" - in - node "ObjectTypeProperty" loc [ - "key", key; - "value", value; - "method", bool _method; - "optional", bool optional; - "static", bool static; - "proto", bool proto; - "variance", option variance variance_; - "kind", string kind; - ] - - and object_type_spread_property (loc, prop) = Type.Object.SpreadProperty.( - node "ObjectTypeSpreadProperty" loc [ - "argument", _type prop.argument; - ] - ) - - and object_type_indexer (loc, indexer) = Type.Object.Indexer.( - node "ObjectTypeIndexer" loc [ - "id", option identifier indexer.id; - "key", _type indexer.key; - "value", _type indexer.value; - "static", bool indexer.static; - "variance", option variance indexer.variance; - ] - ) - - and object_type_call_property (loc, callProperty) = Type.Object.CallProperty.( - node "ObjectTypeCallProperty" loc [ - "value", function_type callProperty.value; - "static", bool callProperty.static; - ] - ) - - and object_type_internal_slot (loc, slot) = Type.Object.InternalSlot.( - node "ObjectTypeInternalSlot" loc [ - "id", identifier slot.id; - "optional", bool slot.optional; - "static", bool slot.static; - "method", bool slot._method; - ] - ) - - and interface_type (loc, i) = Type.Interface.( - node "InterfaceTypeAnnotation" loc [ - "extends", array_of_list interface_extends i.extends; - "body", object_type i.body; - ] - ) - - and array_type loc t = - node "ArrayTypeAnnotation" loc [ - "elementType", (_type t); - ] - - and generic_type_qualified_identifier (loc, q) = Type.Generic.Identifier.( - let qualification = match q.qualification with - | Unqualified id -> identifier id - | Qualified q -> generic_type_qualified_identifier q - in - node "QualifiedTypeIdentifier" loc [ - "qualification", qualification; - "id", identifier q.id; - ] - ) - - and generic_type (loc, g) = Type.Generic.( - let id = match g.id with - | Identifier.Unqualified id -> identifier id - | Identifier.Qualified q -> generic_type_qualified_identifier q - in - node "GenericTypeAnnotation" loc [ - "id", id; - "typeParameters", option type_parameter_instantiation g.targs; - ] - ) - - and union_type (loc, ts) = - node "UnionTypeAnnotation" loc [ - "types", array_of_list _type ts; - ] - - and intersection_type (loc, ts) = - node "IntersectionTypeAnnotation" loc [ - "types", array_of_list _type ts; - ] - - and typeof_type (loc, t) = - node "TypeofTypeAnnotation" loc [ - "argument", _type t; - ] - - and tuple_type (loc, tl) = - node "TupleTypeAnnotation" loc [ - "types", array_of_list _type tl; - ] - - and string_literal_type (loc, s) = Ast.StringLiteral.( - node "StringLiteralTypeAnnotation" loc [ - "value", string s.value; - "raw", string s.raw; - ] - ) - - and number_literal_type (loc, s) = Ast.NumberLiteral.( - node "NumberLiteralTypeAnnotation" loc [ - "value", number s.value; - "raw", string s.raw; - ] - ) - - and boolean_literal_type (loc, value) = - node "BooleanLiteralTypeAnnotation" loc [ - "value", bool value; - "raw", string (if value then "true" else "false"); - ] - - and exists_type loc = node "ExistsTypeAnnotation" loc [] - - and type_annotation (loc, ty) = - node "TypeAnnotation" loc [ - "typeAnnotation", _type ty; - ] - - and type_parameter_declaration (loc, params) = - node "TypeParameterDeclaration" loc [ - "params", array_of_list type_param params; - ] - - and type_param (loc, { Type.ParameterDeclaration.TypeParam. - name = (_, name); - bound; - variance = tp_var; - default; - }) = - node "TypeParameter" loc [ - (* we track the location of the name, but don't expose it here for - backwards-compatibility. TODO: change this? *) - "name", string name; - "bound", option type_annotation bound; - "variance", option variance tp_var; - "default", option _type default; - ] - - and type_parameter_instantiation (loc, targs) = - node "TypeParameterInstantiation" loc [ - "params", array_of_list _type targs; - ] - - and jsx_element (loc, (element: Loc.t JSX.element)) = JSX.( - node "JSXElement" loc [ - "openingElement", jsx_opening element.openingElement; - "closingElement", option jsx_closing element.closingElement; - "children", array_of_list jsx_child element.children; - ] - ) - - and jsx_fragment (loc, (fragment: Loc.t JSX.fragment)) = JSX.( - node "JSXFragment" loc [ - "openingFragment", jsx_opening_fragment fragment.frag_openingElement; - "children", array_of_list jsx_child fragment.frag_children; - "closingFragment", option jsx_closing_fragment fragment.frag_closingElement - ] - ) - - and jsx_opening (loc, opening) = JSX.Opening.( - node "JSXOpeningElement" loc [ - "name", jsx_name opening.name; - "attributes", array_of_list jsx_opening_attribute opening.attributes; - "selfClosing", bool opening.selfClosing; - ] - ) - - and jsx_opening_fragment loc = - node "JSXOpeningFragment" loc [] - - and jsx_opening_attribute = JSX.Opening.(function - | Attribute attribute -> jsx_attribute attribute - | SpreadAttribute attribute -> jsx_spread_attribute attribute - ) - - and jsx_closing (loc, closing) = JSX.Closing.( - node "JSXClosingElement" loc [ - "name", jsx_name closing.name; - ] - ) - - and jsx_closing_fragment loc = - node "JSXClosingFragment" loc [] - - and jsx_child = JSX.(function - | loc, Element element -> jsx_element (loc, element) - | loc, Fragment fragment -> jsx_fragment (loc, fragment) - | loc, ExpressionContainer expr -> jsx_expression_container (loc, expr) - | loc, SpreadChild expr -> - node "JSXSpreadChild" loc [ - "expression", expression expr; + | ( _, + { + params; + rest = Some (rest_loc, { Function.RestParam.argument; comments }); + comments = _; + this_; + } ) -> + let rest = node ?comments "RestElement" rest_loc [("argument", pattern argument)] in + let rev_params = List.rev_map function_param params in + let params = List.rev (rest :: rev_params) in + let params = + match this_ with + | Some this -> this_param this :: params + | None -> params + in + array params + | (_, { params; rest = None; this_; comments = _ }) -> + let params = List.map function_param params in + let params = + match this_ with + | Some this -> this_param this :: params + | None -> params + in + array params + and rest_element loc { Pattern.RestElement.argument; comments } = + node ?comments "RestElement" loc [("argument", pattern argument)] + and array_pattern_element = + let open Pattern.Array in + function + | Hole _ -> null + | Element (loc, { Element.argument; default = Some default }) -> + node "AssignmentPattern" loc [("left", pattern argument); ("right", expression default)] + | Element (_loc, { Element.argument; default = None }) -> pattern argument + | RestElement (loc, el) -> rest_element loc el + and object_property = + let open Expression.Object in + function + | Property (loc, prop) -> + Property.( + let (key, value, kind, method_, shorthand, comments) = + match prop with + | Init { key; value; shorthand } -> + (key, expression value, "init", false, shorthand, None) + | Method { key; value = (loc, func) } -> + (key, function_expression (loc, func), "init", true, false, None) + | Get { key; value = (loc, func); comments } -> + (key, function_expression (loc, func), "get", false, false, comments) + | Set { key; value = (loc, func); comments } -> + (key, function_expression (loc, func), "set", false, false, comments) + in + let (key, computed, comments) = + match key with + | Literal lit -> (literal lit, false, comments) + | Identifier id -> (identifier id, false, comments) + | PrivateName _ -> failwith "Internal Error: Found private field in object props" + | Computed (_, { ComputedKey.expression = expr; comments = key_comments }) -> + ( expression expr, + true, + Flow_ast_utils.merge_comments ~outer:comments ~inner:key_comments ) + in + node + ?comments + "Property" + loc + [ + ("key", key); + ("value", value); + ("kind", string kind); + ("method", bool method_); + ("shorthand", bool shorthand); + ("computed", bool computed); + ]) + | SpreadProperty (loc, { SpreadProperty.argument; comments }) -> + node ?comments "SpreadProperty" loc [("argument", expression argument)] + and object_pattern_property = + let open Pattern.Object in + function + | Property (loc, { Property.key; pattern = patt; default; shorthand }) -> + let (key, computed, comments) = + match key with + | Property.Literal lit -> (literal lit, false, None) + | Property.Identifier id -> (identifier id, false, None) + | Property.Computed (_, { ComputedKey.expression = expr; comments }) -> + (expression expr, true, comments) + in + let value = + match default with + | Some default -> + let loc = Loc.btwn (fst patt) (fst default) in + node "AssignmentPattern" loc [("left", pattern patt); ("right", expression default)] + | None -> pattern patt + in + node + ?comments + "Property" + loc + [ + ("key", key); + ("value", value); + ("kind", string "init"); + ("method", bool false); + ("shorthand", bool shorthand); + ("computed", bool computed); + ] + | RestElement (loc, el) -> rest_element loc el + and spread_element (loc, { Expression.SpreadElement.argument; comments }) = + node ?comments "SpreadElement" loc [("argument", expression argument)] + and expression_or_spread = + let open Expression in + function + | Expression expr -> expression expr + | Spread spread -> spread_element spread + and array_element = + let open Expression.Array in + function + | Hole _ -> null + | Expression expr -> expression expr + | Spread spread -> spread_element spread + and comprehension_block (loc, { Expression.Comprehension.Block.left; right; each }) = + node + "ComprehensionBlock" + loc + [("left", pattern left); ("right", expression right); ("each", bool each)] + and literal (loc, { Literal.value; raw; comments }) = + let value_ = + match value with + | Literal.String str -> string str + | Literal.Boolean b -> bool b + | Literal.Null -> null + | Literal.Number f -> number f + | Literal.BigInt _ -> failwith "We should not create Literal nodes for bigints" + | Literal.RegExp { Literal.RegExp.pattern; flags } -> regexp loc pattern flags + in + let props = + match value with + | Literal.RegExp { Literal.RegExp.pattern; flags } -> + let regex = obj [("pattern", string pattern); ("flags", string flags)] in + [("value", value_); ("raw", string raw); ("regex", regex)] + | _ -> [("value", value_); ("raw", string raw)] + in + node ?comments "Literal" loc props + and number_literal (loc, { NumberLiteral.value; raw; comments }) = + node ?comments "Literal" loc [("value", number value); ("raw", string raw)] + and bigint_literal (loc, { Literal.raw; comments; _ }) = + node ?comments "BigIntLiteral" loc [("value", null); ("bigint", string raw)] + and string_literal (loc, { StringLiteral.value; raw; comments }) = + node ?comments "Literal" loc [("value", string value); ("raw", string raw)] + and boolean_literal (loc, { BooleanLiteral.value; comments }) = + let raw = + if value then + "true" + else + "false" + in + node ?comments "Literal" loc [("value", bool value); ("raw", string raw)] + and template_literal (loc, { Expression.TemplateLiteral.quasis; expressions; comments }) = + node + ?comments + "TemplateLiteral" + loc + [ + ("quasis", array_of_list template_element quasis); + ("expressions", array_of_list expression expressions); ] - | loc, Text str -> jsx_text (loc, str) - ) - - and jsx_name = JSX.(function - | Identifier id -> jsx_identifier id - | NamespacedName namespaced_name -> jsx_namespaced_name namespaced_name - | MemberExpression member -> jsx_member_expression member - ) - - and jsx_attribute (loc, attribute) = JSX.Attribute.( - let name = match attribute.name with - | Identifier id -> jsx_identifier id - | NamespacedName namespaced_name -> jsx_namespaced_name namespaced_name - in - node "JSXAttribute" loc [ - "name", name; - "value", option jsx_attribute_value attribute.value; - ] - ) - - and jsx_attribute_value = JSX.Attribute.(function - | Literal (loc, value) -> literal (loc, value) - | ExpressionContainer (loc, expr) -> jsx_expression_container (loc, expr) - ) - - and jsx_spread_attribute (loc, attribute) = JSX.SpreadAttribute.( - node "JSXSpreadAttribute" loc [ - "argument", expression attribute.argument; - ] - ) - - and jsx_expression_container (loc, expr) = JSX.ExpressionContainer.( - let expression = match expr.expression with - | Expression expr -> expression expr - | EmptyExpression empty_loc -> - node "JSXEmptyExpression" empty_loc [] - in - node "JSXExpressionContainer" loc [ - "expression", expression; - ] - ) - - and jsx_text (loc, text) = JSX.Text.( - let { value; raw; } = text in - node "JSXText" loc [ - "value", string value; - "raw", string raw; - ] - ) - - and jsx_member_expression (loc, member_expression) = JSX.MemberExpression.( - let _object = match member_expression._object with - | Identifier id -> jsx_identifier id - | MemberExpression member -> jsx_member_expression member in - node "JSXMemberExpression" loc [ - "object", _object; - "property", jsx_identifier member_expression.property; - ] - ) - - and jsx_namespaced_name (loc, namespaced_name) = JSX.NamespacedName.( - node "JSXNamespacedName" loc [ - "namespace", jsx_identifier namespaced_name.namespace; - "name", jsx_identifier namespaced_name.name; - ] - ) - - and jsx_identifier (loc, id) = JSX.Identifier.( - node "JSXIdentifier" loc [ - "name", string id.name; - ] - ) - - and export_specifier (loc, specifier) = - let open Statement.ExportNamedDeclaration.ExportSpecifier in - let exported = match specifier.exported with - | Some exported -> identifier exported - | None -> identifier specifier.local - in - node "ExportSpecifier" loc [ - "local", identifier specifier.local; - "exported", exported; - ] - - and import_default_specifier id = - node "ImportDefaultSpecifier" (fst id) [ - "local", identifier id; - ] - - and import_namespace_specifier (loc, id) = - node "ImportNamespaceSpecifier" loc [ - "local", identifier id; - ] - - and import_named_specifier local_id remote_id kind = - let span_loc = - match local_id with - | Some local_id -> Loc.btwn (fst remote_id) (fst local_id) - | None -> fst remote_id - in - let local_id = match local_id with - | Some id -> id - | None -> remote_id - in - node "ImportSpecifier" span_loc [ - "imported", identifier remote_id; - "local", identifier local_id; - "importKind", ( + and template_element + ( loc, + { + Expression.TemplateLiteral.Element.value = + { Expression.TemplateLiteral.Element.raw; cooked }; + tail; + } ) = + let value = obj [("raw", string raw); ("cooked", string cooked)] in + node "TemplateElement" loc [("value", value); ("tail", bool tail)] + and tagged_template (loc, { Expression.TaggedTemplate.tag; quasi; comments }) = + node + ?comments + "TaggedTemplateExpression" + loc + [("tag", expression tag); ("quasi", template_literal quasi)] + and variable_declaration (loc, { Statement.VariableDeclaration.kind; declarations; comments }) = + let kind = match kind with - | Some Statement.ImportDeclaration.ImportType -> string "type" - | Some Statement.ImportDeclaration.ImportTypeof -> string "typeof" - | Some Statement.ImportDeclaration.ImportValue | None -> null - ); - ] - - and comment_list comments = array_of_list comment comments - - and comment (loc, c) = Comment.( - let _type, value = match c with - | Line s -> "Line", s - | Block s -> "Block", s in - node _type loc [ - "value", string value; - ] - ) - - and predicate (loc, p) = Ast.Type.Predicate.( - let _type, value = match p with - | Declared e -> "DeclaredPredicate", ["value", expression e] - | Inferred -> "InferredPredicate", [] + | Statement.VariableDeclaration.Var -> "var" + | Statement.VariableDeclaration.Let -> "let" + | Statement.VariableDeclaration.Const -> "const" + in + node + ?comments + "VariableDeclaration" + loc + [("declarations", array_of_list variable_declarator declarations); ("kind", string kind)] + and variable_declarator (loc, { Statement.VariableDeclaration.Declarator.id; init }) = + node "VariableDeclarator" loc [("id", pattern id); ("init", option expression init)] + and variance (loc, { Variance.kind; comments }) = + let kind = + Variance.( + match kind with + | Plus -> string "plus" + | Minus -> string "minus") + in + node ?comments "Variance" loc [("kind", kind)] + and _type (loc, t) = + Type.( + match t with + | Any comments -> any_type loc comments + | Mixed comments -> mixed_type loc comments + | Empty comments -> empty_type loc comments + | Void comments -> void_type loc comments + | Null comments -> null_type loc comments + | Symbol comments -> symbol_type loc comments + | Number comments -> number_type loc comments + | BigInt comments -> bigint_type loc comments + | String comments -> string_type loc comments + | Boolean comments -> boolean_type loc comments + | Nullable t -> nullable_type loc t + | Function fn -> function_type (loc, fn) + | Object o -> object_type ~include_inexact:true (loc, o) + | Interface i -> interface_type (loc, i) + | Array t -> array_type loc t + | Generic g -> generic_type (loc, g) + | Union t -> union_type (loc, t) + | Intersection t -> intersection_type (loc, t) + | Typeof t -> typeof_type (loc, t) + | Tuple t -> tuple_type (loc, t) + | StringLiteral s -> string_literal_type (loc, s) + | NumberLiteral n -> number_literal_type (loc, n) + | BigIntLiteral n -> bigint_literal_type (loc, n) + | BooleanLiteral b -> boolean_literal_type (loc, b) + | Exists comments -> exists_type loc comments) + and any_type loc comments = node ?comments "AnyTypeAnnotation" loc [] + and mixed_type loc comments = node ?comments "MixedTypeAnnotation" loc [] + and empty_type loc comments = node ?comments "EmptyTypeAnnotation" loc [] + and void_type loc comments = node ?comments "VoidTypeAnnotation" loc [] + and null_type loc comments = node ?comments "NullLiteralTypeAnnotation" loc [] + and symbol_type loc comments = node ?comments "SymbolTypeAnnotation" loc [] + and number_type loc comments = node ?comments "NumberTypeAnnotation" loc [] + and bigint_type loc comments = node ?comments "BigIntTypeAnnotation" loc [] + and string_type loc comments = node ?comments "StringTypeAnnotation" loc [] + and boolean_type loc comments = node ?comments "BooleanTypeAnnotation" loc [] + and nullable_type loc { Type.Nullable.argument; comments } = + node ?comments "NullableTypeAnnotation" loc [("typeAnnotation", _type argument)] + and function_type + ( loc, + { + Type.Function.params = + (_, { Type.Function.Params.this_; params; rest; comments = params_comments }); + return; + tparams; + comments = func_comments; + } ) = + let comments = + Flow_ast_utils.merge_comments + ~inner:(format_internal_comments params_comments) + ~outer:func_comments + in + node + ?comments + "FunctionTypeAnnotation" + loc + [ + ("params", array_of_list function_type_param params); + ("this", option function_type_this_constraint this_); + ("returnType", _type return); + ("rest", option function_type_rest rest); + ("typeParameters", option type_parameter_declaration tparams); + ] + and function_type_param ?comments (loc, { Type.Function.Param.name; annot; optional }) = + node + ?comments + "FunctionTypeParam" + loc + [ + ("name", option identifier name); + ("typeAnnotation", _type annot); + ("optional", bool optional); + ] + and function_type_rest (_loc, { Type.Function.RestParam.argument; comments }) = + (* TODO: add a node for the rest param itself, including the `...`, + like we do with RestElement on normal functions. This should be + coordinated with Babel, ast-types, etc. so keeping the status quo for + now. Here's an example: *) + (* node "FunctionTypeRestParam" loc [ + "argument", function_type_param argument; + ] *) + function_type_param ?comments argument + and function_type_this_constraint (loc, { Type.Function.ThisParam.annot = (_, annot); comments }) + = + node + ?comments + "FunctionTypeParam" + loc + [ + ("name", option identifier None); ("typeAnnotation", _type annot); ("optional", bool false); + ] + and object_type ~include_inexact (loc, { Type.Object.properties; exact; inexact; comments }) = + Type.Object.( + let (props, ixs, calls, slots) = + List.fold_left + (fun (props, ixs, calls, slots) -> function + | Property p -> + let prop = object_type_property p in + (prop :: props, ixs, calls, slots) + | SpreadProperty p -> + let prop = object_type_spread_property p in + (prop :: props, ixs, calls, slots) + | Indexer i -> + let ix = object_type_indexer i in + (props, ix :: ixs, calls, slots) + | CallProperty c -> + let call = object_type_call_property c in + (props, ixs, call :: calls, slots) + | InternalSlot s -> + let slot = object_type_internal_slot s in + (props, ixs, calls, slot :: slots)) + ([], [], [], []) + properties + in + let fields = + [ + ("exact", bool exact); + ("properties", array (List.rev props)); + ("indexers", array (List.rev ixs)); + ("callProperties", array (List.rev calls)); + ("internalSlots", array (List.rev slots)); + ] + in + let fields = + if include_inexact then + ("inexact", bool inexact) :: fields + else + fields + in + node ?comments:(format_internal_comments comments) "ObjectTypeAnnotation" loc fields) + and object_type_property + ( loc, + { + Type.Object.Property.key; + value; + optional; + static; + proto; + variance = variance_; + _method; + comments; + } ) = + let key = + match key with + | Expression.Object.Property.Literal lit -> literal lit + | Expression.Object.Property.Identifier id -> identifier id + | Expression.Object.Property.PrivateName _ -> + failwith "Internal Error: Found private field in object props" + | Expression.Object.Property.Computed _ -> + failwith "There should not be computed object type property keys" + in + let (value, kind) = + match value with + | Type.Object.Property.Init value -> (_type value, "init") + | Type.Object.Property.Get (loc, f) -> (function_type (loc, f), "get") + | Type.Object.Property.Set (loc, f) -> (function_type (loc, f), "set") + in + node + ?comments + "ObjectTypeProperty" + loc + [ + ("key", key); + ("value", value); + ("method", bool _method); + ("optional", bool optional); + ("static", bool static); + ("proto", bool proto); + ("variance", option variance variance_); + ("kind", string kind); + ] + and object_type_spread_property (loc, { Type.Object.SpreadProperty.argument; comments }) = + node ?comments "ObjectTypeSpreadProperty" loc [("argument", _type argument)] + and object_type_indexer + (loc, { Type.Object.Indexer.id; key; value; static; variance = variance_; comments }) = + node + ?comments + "ObjectTypeIndexer" + loc + [ + ("id", option identifier id); + ("key", _type key); + ("value", _type value); + ("static", bool static); + ("variance", option variance variance_); + ] + and object_type_call_property (loc, { Type.Object.CallProperty.value; static; comments }) = + node + ?comments + "ObjectTypeCallProperty" + loc + [("value", function_type value); ("static", bool static)] + and object_type_internal_slot + (loc, { Type.Object.InternalSlot.id; optional; static; _method; value; comments }) = + node + ?comments + "ObjectTypeInternalSlot" + loc + [ + ("id", identifier id); + ("optional", bool optional); + ("static", bool static); + ("method", bool _method); + ("value", _type value); + ] + and interface_type (loc, { Type.Interface.extends; body; comments }) = + node + ?comments + "InterfaceTypeAnnotation" + loc + [ + ("extends", array_of_list interface_extends extends); + ("body", object_type ~include_inexact:false body); + ] + and array_type loc { Type.Array.argument; comments } = + node ?comments "ArrayTypeAnnotation" loc [("elementType", _type argument)] + and generic_type_qualified_identifier (loc, { Type.Generic.Identifier.id; qualification }) = + let qualification = + match qualification with + | Type.Generic.Identifier.Unqualified id -> identifier id + | Type.Generic.Identifier.Qualified q -> generic_type_qualified_identifier q + in + node "QualifiedTypeIdentifier" loc [("qualification", qualification); ("id", identifier id)] + and generic_type (loc, { Type.Generic.id; targs; comments }) = + let id = + match id with + | Type.Generic.Identifier.Unqualified id -> identifier id + | Type.Generic.Identifier.Qualified q -> generic_type_qualified_identifier q + in + node + ?comments + "GenericTypeAnnotation" + loc + [("id", id); ("typeParameters", option type_args targs)] + and union_type (loc, { Type.Union.types = (t0, t1, ts); comments }) = + node ?comments "UnionTypeAnnotation" loc [("types", array_of_list _type (t0 :: t1 :: ts))] + and intersection_type (loc, { Type.Intersection.types = (t0, t1, ts); comments }) = + node + ?comments + "IntersectionTypeAnnotation" + loc + [("types", array_of_list _type (t0 :: t1 :: ts))] + and typeof_type (loc, { Type.Typeof.argument; internal = _; comments }) = + node ?comments "TypeofTypeAnnotation" loc [("argument", _type argument)] + and tuple_type (loc, { Type.Tuple.types; comments }) = + node ?comments "TupleTypeAnnotation" loc [("types", array_of_list _type types)] + and string_literal_type (loc, { Ast.StringLiteral.value; raw; comments }) = + node + ?comments + "StringLiteralTypeAnnotation" + loc + [("value", string value); ("raw", string raw)] + and number_literal_type (loc, { Ast.NumberLiteral.value; raw; comments }) = + node + ?comments + "NumberLiteralTypeAnnotation" + loc + [("value", number value); ("raw", string raw)] + and bigint_literal_type (loc, { Ast.BigIntLiteral.bigint; comments; _ }) = + let raw = bigint in + node ?comments "BigIntLiteralTypeAnnotation" loc [("value", null); ("raw", string raw)] + and boolean_literal_type (loc, { Ast.BooleanLiteral.value; comments }) = + node + ?comments + "BooleanLiteralTypeAnnotation" + loc + [ + ("value", bool value); + ( "raw", + string + ( if value then + "true" + else + "false" ) ); + ] + and exists_type loc comments = node ?comments "ExistsTypeAnnotation" loc [] + and type_annotation (loc, ty) = node "TypeAnnotation" loc [("typeAnnotation", _type ty)] + and type_parameter_declaration (loc, { Type.TypeParams.params; comments }) = + node + ?comments:(format_internal_comments comments) + "TypeParameterDeclaration" + loc + [("params", array_of_list type_param params)] + and type_param + ( loc, + { + Type.TypeParam.name = (_, { Identifier.name; comments }); + bound; + variance = tp_var; + default; + } ) = + node + ?comments + "TypeParameter" + loc + [ + (* we track the location of the name, but don't expose it here for + backwards-compatibility. TODO: change this? *) + ("name", string name); + ("bound", hint type_annotation bound); + ("variance", option variance tp_var); + ("default", option _type default); + ] + and type_args (loc, { Type.TypeArgs.arguments; comments }) = + node + ?comments:(format_internal_comments comments) + "TypeParameterInstantiation" + loc + [("params", array_of_list _type arguments)] + and call_type_args (loc, { Expression.CallTypeArgs.arguments; comments }) = + node + ?comments:(format_internal_comments comments) + "TypeParameterInstantiation" + loc + [("params", array_of_list call_type_arg arguments)] + and call_type_arg x = + match x with + | Expression.CallTypeArg.Explicit t -> _type t + | Expression.CallTypeArg.Implicit (loc, { Expression.CallTypeArg.Implicit.comments }) -> + generic_type + ( loc, + { + Type.Generic.id = + Type.Generic.Identifier.Unqualified (Flow_ast_utils.ident_of_source (loc, "_")); + targs = None; + comments; + } ) + and jsx_element + (loc, { JSX.opening_element; closing_element; children = (_loc, children); comments }) = + node + ?comments + "JSXElement" + loc + [ + ("openingElement", jsx_opening opening_element); + ("closingElement", option jsx_closing closing_element); + ("children", array_of_list jsx_child children); + ] + and jsx_fragment + ( loc, + { + JSX.frag_opening_element; + frag_closing_element; + frag_children = (_loc, frag_children); + frag_comments; + } ) = + node + ?comments:frag_comments + "JSXFragment" + loc + [ + ("openingFragment", jsx_opening_fragment frag_opening_element); + ("children", array_of_list jsx_child frag_children); + ("closingFragment", jsx_closing_fragment frag_closing_element); + ] + and jsx_opening (loc, { JSX.Opening.name; attributes; self_closing }) = + node + "JSXOpeningElement" + loc + [ + ("name", jsx_name name); + ("attributes", array_of_list jsx_opening_attribute attributes); + ("selfClosing", bool self_closing); + ] + and jsx_opening_fragment loc = node "JSXOpeningFragment" loc [] + and jsx_opening_attribute = + JSX.Opening.( + function + | Attribute attribute -> jsx_attribute attribute + | SpreadAttribute attribute -> jsx_spread_attribute attribute) + and jsx_closing (loc, { JSX.Closing.name }) = + node "JSXClosingElement" loc [("name", jsx_name name)] + and jsx_closing_fragment loc = node "JSXClosingFragment" loc [] + and jsx_child = + JSX.( + function + | (loc, Element element) -> jsx_element (loc, element) + | (loc, Fragment fragment) -> jsx_fragment (loc, fragment) + | (loc, ExpressionContainer expr) -> jsx_expression_container (loc, expr) + | (loc, SpreadChild spread) -> jsx_spread_child (loc, spread) + | (loc, Text str) -> jsx_text (loc, str)) + and jsx_name = + JSX.( + function + | Identifier id -> jsx_identifier id + | NamespacedName namespaced_name -> jsx_namespaced_name namespaced_name + | MemberExpression member -> jsx_member_expression member) + and jsx_attribute (loc, { JSX.Attribute.name; value }) = + let name = + match name with + | JSX.Attribute.Identifier id -> jsx_identifier id + | JSX.Attribute.NamespacedName namespaced_name -> jsx_namespaced_name namespaced_name + in + node "JSXAttribute" loc [("name", name); ("value", option jsx_attribute_value value)] + and jsx_attribute_value = + JSX.Attribute.( + function + | Literal (loc, value) -> literal (loc, value) + | ExpressionContainer (loc, expr) -> jsx_expression_container (loc, expr)) + and jsx_spread_attribute (loc, { JSX.SpreadAttribute.argument; comments }) = + node ?comments "JSXSpreadAttribute" loc [("argument", expression argument)] + and jsx_expression_container (loc, { JSX.ExpressionContainer.expression = expr; comments }) = + let expression = + match expr with + | JSX.ExpressionContainer.Expression expr -> expression expr + | JSX.ExpressionContainer.EmptyExpression -> + let empty_loc = + Loc. + { + loc with + start = { loc.start with column = loc.start.column + 1 }; + _end = { loc._end with column = loc._end.column - 1 }; + } + in + node "JSXEmptyExpression" empty_loc [] + in + node + ?comments:(format_internal_comments comments) + "JSXExpressionContainer" + loc + [("expression", expression)] + and jsx_spread_child (loc, { JSX.SpreadChild.expression = expr; comments }) = + node ?comments "JSXSpreadChild" loc [("expression", expression expr)] + and jsx_text (loc, { JSX.Text.value; raw }) = + node "JSXText" loc [("value", string value); ("raw", string raw)] + and jsx_member_expression (loc, { JSX.MemberExpression._object; property }) = + let _object = + match _object with + | JSX.MemberExpression.Identifier id -> jsx_identifier id + | JSX.MemberExpression.MemberExpression member -> jsx_member_expression member + in + node "JSXMemberExpression" loc [("object", _object); ("property", jsx_identifier property)] + and jsx_namespaced_name (loc, { JSX.NamespacedName.namespace; name }) = + node + "JSXNamespacedName" + loc + [("namespace", jsx_identifier namespace); ("name", jsx_identifier name)] + and jsx_identifier (loc, { JSX.Identifier.name; comments }) = + node ?comments "JSXIdentifier" loc [("name", string name)] + and export_specifier (loc, { Statement.ExportNamedDeclaration.ExportSpecifier.exported; local }) + = + let exported = + match exported with + | Some exported -> identifier exported + | None -> identifier local + in + node "ExportSpecifier" loc [("local", identifier local); ("exported", exported)] + and import_default_specifier id = + node "ImportDefaultSpecifier" (fst id) [("local", identifier id)] + and import_namespace_specifier (loc, id) = + node "ImportNamespaceSpecifier" loc [("local", identifier id)] + and import_named_specifier local_id remote_id kind = + let span_loc = + match local_id with + | Some local_id -> Loc.btwn (fst remote_id) (fst local_id) + | None -> fst remote_id + in + let local_id = + match local_id with + | Some id -> id + | None -> remote_id + in + node + "ImportSpecifier" + span_loc + [ + ("imported", identifier remote_id); + ("local", identifier local_id); + ( "importKind", + match kind with + | Some Statement.ImportDeclaration.ImportType -> string "type" + | Some Statement.ImportDeclaration.ImportTypeof -> string "typeof" + | Some Statement.ImportDeclaration.ImportValue + | None -> + null ); + ] + and comment_list comments = array_of_list comment comments + and comment (loc, c) = + Comment.( + let (_type, value) = + match c with + | { kind = Line; text = s; _ } -> ("Line", s) + | { kind = Block; text = s; _ } -> ("Block", s) + in + node _type loc [("value", string value)]) + and predicate (loc, { Ast.Type.Predicate.kind; comments }) = + let open Ast.Type.Predicate in + let (_type, value) = + match kind with + | Declared e -> ("DeclaredPredicate", [("value", expression e)]) + | Inferred -> ("InferredPredicate", []) + in + node ?comments _type loc value + and call_node_properties { Expression.Call.callee; targs; arguments; comments = _ } = + [ + ("callee", expression callee); + ("typeArguments", option call_type_args targs); + ("arguments", arg_list arguments); + ] + and member_node_properties { Expression.Member._object; property; comments = _ } = + let (property, computed) = + match property with + | Expression.Member.PropertyIdentifier id -> (identifier id, false) + | Expression.Member.PropertyPrivateName name -> (private_name name, false) + | Expression.Member.PropertyExpression expr -> (expression expr, true) + in + [("object", expression _object); ("property", property); ("computed", bool computed)] in - node _type loc value - ) + { program; expression } - and call_node_properties call = Expression.Call.([ - "callee", expression call.callee; - "typeArguments", option type_parameter_instantiation call.targs; - "arguments", array_of_list expression_or_spread call.arguments; - ]) + let program offset_table = (make_functions offset_table).program - and member_node_properties member = Expression.Member.( - let property = match member.property with - | PropertyIdentifier id -> identifier id - | PropertyPrivateName name -> private_name name - | PropertyExpression expr -> expression expr - in - [ - "object", expression member._object; - "property", property; - "computed", bool member.computed; - ] - ) + let expression offset_table = (make_functions offset_table).expression end diff --git a/lib/expression_parser.ml b/lib/expression_parser.ml index 8eca023..6f0ac1c 100644 --- a/lib/expression_parser.ml +++ b/lib/expression_parser.ml @@ -1,83 +1,115 @@ -(** - * Copyright (c) 2013-present, Facebook, Inc. +(* + * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. *) +module Ast = Flow_ast open Token open Parser_env -open Ast -module Error = Parse_error +open Flow_ast open Parser_common +open Comment_attachment module type EXPRESSION = sig - val assignment: env -> Loc.t Expression.t - val assignment_cover: env -> pattern_cover - val conditional: env -> Loc.t Expression.t - val property_name_include_private: env -> Loc.t * Loc.t Identifier.t * bool - val is_assignable_lhs: Loc.t Expression.t -> bool - val left_hand_side: env -> Loc.t Expression.t - val number: env -> number_type -> string -> float - val sequence: env -> Loc.t Expression.t list -> Loc.t Expression.t + val assignment : env -> (Loc.t, Loc.t) Expression.t + + val assignment_cover : env -> pattern_cover + + val conditional : env -> (Loc.t, Loc.t) Expression.t + + val property_name_include_private : + env -> Loc.t * (Loc.t, Loc.t) Identifier.t * bool * Loc.t Comment.t list + + val is_assignable_lhs : (Loc.t, Loc.t) Expression.t -> bool + + val left_hand_side : env -> (Loc.t, Loc.t) Expression.t + + val number : env -> number_type -> string -> float + + val sequence : + env -> start_loc:Loc.t -> (Loc.t, Loc.t) Expression.t list -> (Loc.t, Loc.t) Expression.t end module Expression - (Parse: PARSER) - (Type: Type_parser.TYPE) - (Declaration: Declaration_parser.DECLARATION) - (Pattern_cover: Pattern_cover.COVER) -: EXPRESSION = struct - type op_precedence = Left_assoc of int | Right_assoc of int + (Parse : PARSER) + (Type : Type_parser.TYPE) + (Declaration : Declaration_parser.DECLARATION) + (Pattern_cover : Pattern_cover.COVER) : EXPRESSION = struct + type op_precedence = + | Left_assoc of int + | Right_assoc of int + + type group_cover = + | Group_expr of (Loc.t, Loc.t) Expression.t + | Group_typecast of (Loc.t, Loc.t) Expression.TypeCast.t + let is_tighter a b = - let a_prec = match a with Left_assoc x -> x | Right_assoc x -> x - 1 in - let b_prec = match b with Left_assoc x -> x | Right_assoc x -> x in + let a_prec = + match a with + | Left_assoc x -> x + | Right_assoc x -> x - 1 + in + let b_prec = + match b with + | Left_assoc x -> x + | Right_assoc x -> x + in a_prec >= b_prec - let is_assignable_lhs = Expression.(function - | _, MetaProperty { MetaProperty.meta = (_, "new"); property = (_, "target") } - -> false (* #sec-static-semantics-static-semantics-isvalidsimpleassignmenttarget *) - - | _, Array _ - | _, Identifier _ - | _, Member _ - | _, MetaProperty _ - | _, Object _ - -> true - - | _, ArrowFunction _ - | _, Assignment _ - | _, Binary _ - | _, Call _ - | _, Class _ - | _, Comprehension _ - | _, Conditional _ - | _, Function _ - | _, Generator _ - | _, Import _ - | _, JSXElement _ - | _, JSXFragment _ - | _, Literal _ - | _, Logical _ - | _, New _ - | _, OptionalCall _ - | _, OptionalMember _ - | _, Sequence _ - | _, Super - | _, TaggedTemplate _ - | _, TemplateLiteral _ - | _, This - | _, TypeCast _ - | _, Unary _ - | _, Update _ - | _, Yield _ - -> false - ) + let is_assignable_lhs = + let open Expression in + function + | ( _, + MetaProperty + { + MetaProperty.meta = (_, { Identifier.name = "new"; comments = _ }); + property = (_, { Identifier.name = "target"; comments = _ }); + comments = _; + } ) -> + false + (* #sec-static-semantics-static-semantics-isvalidsimpleassignmenttarget *) + | (_, Array _) + | (_, Identifier _) + | (_, Member _) + | (_, MetaProperty _) + | (_, Object _) -> + true + | (_, ArrowFunction _) + | (_, Assignment _) + | (_, Binary _) + | (_, Call _) + | (_, Class _) + | (_, Comprehension _) + | (_, Conditional _) + | (_, Function _) + | (_, Generator _) + | (_, Import _) + | (_, JSXElement _) + | (_, JSXFragment _) + | (_, Literal _) + | (_, Logical _) + | (_, New _) + | (_, OptionalCall _) + | (_, OptionalMember _) + | (_, Sequence _) + | (_, Super _) + | (_, TaggedTemplate _) + | (_, TemplateLiteral _) + | (_, This _) + | (_, TypeCast _) + | (_, Unary _) + | (_, Update _) + | (_, Yield _) -> + false let as_expression = Pattern_cover.as_expression + let as_pattern = Pattern_cover.as_pattern (* AssignmentExpression : + * [+Yield] YieldExpression * ConditionalExpression * LeftHandSideExpression = AssignmentExpression * LeftHandSideExpression AssignmentOperator AssignmentExpression @@ -88,303 +120,382 @@ module Expression *) let rec assignment_cover = let assignment_but_not_arrow_function_cover env = + let start_loc = Peek.loc env in let expr_or_pattern = conditional_cover env in match assignment_op env with | Some operator -> - let left = as_pattern env expr_or_pattern in - let right = assignment env in - let loc = Loc.btwn (fst left) (fst right) in - - Cover_expr (loc, Expression.(Assignment { Assignment. - operator; - left; - right; - })) + let expr = + with_loc + ~start_loc + (fun env -> + let left = as_pattern env expr_or_pattern in + let right = assignment env in + Expression.(Assignment { Assignment.operator; left; right; comments = None })) + env + in + Cover_expr expr | _ -> expr_or_pattern - - in let error_callback _ = function + in + let error_callback _ = function (* Don't rollback on these errors. *) - | Error.StrictReservedWord -> () + | Parse_error.StrictReservedWord -> () (* Everything else causes a rollback *) | _ -> raise Try.Rollback - - (* So we may or may not be parsing the first part of an arrow function - * (the part before the =>). We might end up parsing that whole thing or - * we might end up parsing only part of it and thinking we're done. We - * need to look at the next token to figure out if we really parsed an - * assignment expression or if this is just the beginning of an arrow - * function *) - in let try_assignment_but_not_arrow_function env = + (* So we may or may not be parsing the first part of an arrow function + * (the part before the =>). We might end up parsing that whole thing or + * we might end up parsing only part of it and thinking we're done. We + * need to look at the next token to figure out if we really parsed an + * assignment expression or if this is just the beginning of an arrow + * function *) + in + let try_assignment_but_not_arrow_function env = let env = env |> with_error_callback error_callback in let ret = assignment_but_not_arrow_function_cover env in match Peek.token env with - | T_ARROW -> (* x => 123 *) + | T_ARROW -> + (* x => 123 *) raise Try.Rollback - | T_COLON when last_token env = Some T_RPAREN-> (* (x): number => 123 *) + | T_COLON when last_token env = Some T_RPAREN -> + (* (x): number => 123 *) raise Try.Rollback (* async x => 123 -- and we've already parsed async as an identifier * expression *) - | _ when Peek.is_identifier env -> begin match ret with - | Cover_expr (_, Expression.Identifier (_, "async")) + | _ when Peek.is_identifier env -> + begin + match ret with + | Cover_expr (_, Expression.Identifier (_, { Identifier.name = "async"; comments = _ })) when not (Peek.is_line_terminator env) -> - raise Try.Rollback - | _ -> ret + raise Try.Rollback + | _ -> ret end | _ -> ret - in fun env -> - match Peek.token env, Peek.is_identifier env with - | T_YIELD, _ when (allow_yield env) -> Cover_expr (yield env) - | T_LPAREN, _ - | T_LESS_THAN, _ - | _, true -> - + in + fun env -> + match (Peek.token env, Peek.is_identifier env) with + | (T_YIELD, _) when allow_yield env -> Cover_expr (yield env) + | ((T_LPAREN as t), _) + | ((T_LESS_THAN as t), _) + | ((T_THIS as t), _) + | (t, true) -> (* Ok, we don't know if this is going to be an arrow function or a * regular assignment expression. Let's first try to parse it as an * assignment expression. If that fails we'll try an arrow function. + * Unless it begins with `async <` in which case we first try parsing + * it as an arrow function, and then an assignment expression. *) - (match Try.to_parse env try_assignment_but_not_arrow_function with + let (initial, secondary) = + if t = T_ASYNC && should_parse_types env && Peek.ith_token ~i:1 env = T_LESS_THAN then + (try_arrow_function, try_assignment_but_not_arrow_function) + else + (try_assignment_but_not_arrow_function, try_arrow_function) + in + (match Try.to_parse env initial with | Try.ParsedSuccessfully expr -> expr | Try.FailedToParse -> - (match Try.to_parse env try_arrow_function with - | Try.ParsedSuccessfully expr -> expr - | Try.FailedToParse -> - - (* Well shoot. It doesn't parse cleanly as a normal - * expression or as an arrow_function. Let's treat it as a - * normal assignment expression gone wrong *) - assignment_but_not_arrow_function_cover env - ) - ) + (match Try.to_parse env secondary with + | Try.ParsedSuccessfully expr -> expr + | Try.FailedToParse -> + (* Well shoot. It doesn't parse cleanly as a normal + * expression or as an arrow_function. Let's treat it as a + * normal assignment expression gone wrong *) + assignment_but_not_arrow_function_cover env)) | _ -> assignment_but_not_arrow_function_cover env - and assignment env = - as_expression env (assignment_cover env) - - and yield env = with_loc (fun env -> - if in_formal_parameters env then error env Error.YieldInFormalParameters; - Expect.token env T_YIELD; - let argument, delegate = - if Peek.is_implicit_semicolon env then None, false - else - let delegate = Expect.maybe env T_MULT in - let has_argument = match Peek.token env with - | T_SEMICOLON - | T_RBRACKET - | T_RCURLY - | T_RPAREN - | T_COLON - | T_COMMA -> false - | _ -> true + and assignment env = as_expression env (assignment_cover env) + + and yield env = + with_loc + (fun env -> + if in_formal_parameters env then error env Parse_error.YieldInFormalParameters; + let leading = Peek.comments env in + Expect.token env T_YIELD; + let (argument, delegate) = + if Peek.is_implicit_semicolon env then + (None, false) + else + let delegate = Eat.maybe env T_MULT in + let has_argument = + match Peek.token env with + | T_SEMICOLON + | T_RBRACKET + | T_RCURLY + | T_RPAREN + | T_COLON + | T_COMMA -> + false + | _ -> true + in + let argument = + if delegate || has_argument then + Some (assignment env) + else + None + in + (argument, delegate) in - let argument = - if delegate || has_argument - then Some (assignment env) - else None in - argument, delegate - in - Expression.(Yield Yield.({ - argument; - delegate; - })) - ) env - - and is_lhs = Expression.(function - | _, MetaProperty { MetaProperty.meta = (_, "new"); property = (_, "target") } - -> false (* #sec-static-semantics-static-semantics-isvalidsimpleassignmenttarget *) - - | _, Identifier _ - | _, Member _ - | _, MetaProperty _ - -> true - - | _, Array _ - | _, ArrowFunction _ - | _, Assignment _ - | _, Binary _ - | _, Call _ - | _, Class _ - | _, Comprehension _ - | _, Conditional _ - | _, Function _ - | _, Generator _ - | _, Import _ - | _, JSXElement _ - | _, JSXFragment _ - | _, Literal _ - | _, Logical _ - | _, New _ - | _, Object _ - | _, OptionalCall _ - | _, OptionalMember _ - | _, Sequence _ - | _, Super - | _, TaggedTemplate _ - | _, TemplateLiteral _ - | _, This - | _, TypeCast _ - | _, Unary _ - | _, Update _ - | _, Yield _ - -> false - ) + let trailing = + match argument with + | None -> Eat.trailing_comments env + | Some _ -> [] + in + let open Expression in + Yield + Yield. + { argument; delegate; comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () }) + env + + and is_lhs = + let open Expression in + function + | ( _, + MetaProperty + { + MetaProperty.meta = (_, { Identifier.name = "new"; comments = _ }); + property = (_, { Identifier.name = "target"; comments = _ }); + comments = _; + } ) -> + false + (* #sec-static-semantics-static-semantics-isvalidsimpleassignmenttarget *) + | (_, Identifier _) + | (_, Member _) + | (_, MetaProperty _) -> + true + | (_, Array _) + | (_, ArrowFunction _) + | (_, Assignment _) + | (_, Binary _) + | (_, Call _) + | (_, Class _) + | (_, Comprehension _) + | (_, Conditional _) + | (_, Function _) + | (_, Generator _) + | (_, Import _) + | (_, JSXElement _) + | (_, JSXFragment _) + | (_, Literal _) + | (_, Logical _) + | (_, New _) + | (_, Object _) + | (_, OptionalCall _) + | (_, OptionalMember _) + | (_, Sequence _) + | (_, Super _) + | (_, TaggedTemplate _) + | (_, TemplateLiteral _) + | (_, This _) + | (_, TypeCast _) + | (_, Unary _) + | (_, Update _) + | (_, Yield _) -> + false and assignment_op env = - let op = Expression.Assignment.(match Peek.token env with - | T_RSHIFT3_ASSIGN -> Some RShift3Assign - | T_RSHIFT_ASSIGN -> Some RShiftAssign - | T_LSHIFT_ASSIGN -> Some LShiftAssign - | T_BIT_XOR_ASSIGN -> Some BitXorAssign - | T_BIT_OR_ASSIGN -> Some BitOrAssign - | T_BIT_AND_ASSIGN -> Some BitAndAssign - | T_MOD_ASSIGN -> Some ModAssign - | T_DIV_ASSIGN -> Some DivAssign - | T_MULT_ASSIGN -> Some MultAssign - | T_EXP_ASSIGN -> Some ExpAssign - | T_MINUS_ASSIGN -> Some MinusAssign - | T_PLUS_ASSIGN -> Some PlusAssign - | T_ASSIGN -> Some Assign - | _ -> None) in + let op = + let open Expression.Assignment in + match Peek.token env with + | T_RSHIFT3_ASSIGN -> Some (Some RShift3Assign) + | T_RSHIFT_ASSIGN -> Some (Some RShiftAssign) + | T_LSHIFT_ASSIGN -> Some (Some LShiftAssign) + | T_BIT_XOR_ASSIGN -> Some (Some BitXorAssign) + | T_BIT_OR_ASSIGN -> Some (Some BitOrAssign) + | T_BIT_AND_ASSIGN -> Some (Some BitAndAssign) + | T_MOD_ASSIGN -> Some (Some ModAssign) + | T_DIV_ASSIGN -> Some (Some DivAssign) + | T_MULT_ASSIGN -> Some (Some MultAssign) + | T_EXP_ASSIGN -> Some (Some ExpAssign) + | T_MINUS_ASSIGN -> Some (Some MinusAssign) + | T_PLUS_ASSIGN -> Some (Some PlusAssign) + | T_ASSIGN -> Some None + | _ -> None + in if op <> None then Eat.token env; op + (* ConditionalExpression : + * LogicalExpression + * LogicalExpression ? AssignmentExpression : AssignmentExpression + *) and conditional_cover env = let start_loc = Peek.loc env in let expr = logical_cover env in - if Peek.token env = T_PLING - then begin - Expect.token env T_PLING; + if Peek.token env = T_PLING then ( + Eat.token env; + (* no_in is ignored for the consequent *) let env' = env |> with_no_in false in let consequent = assignment env' in Expect.token env T_COLON; - let end_loc, alternate = with_loc assignment env in + let (end_loc, alternate) = with_loc assignment env in let loc = Loc.btwn start_loc end_loc in - Cover_expr (loc, Expression.(Conditional { Conditional. - test = as_expression env expr; - consequent; - alternate; - })) - end else expr + Cover_expr + ( loc, + let open Expression in + Conditional + { Conditional.test = as_expression env expr; consequent; alternate; comments = None } ) + ) else + expr and conditional env = as_expression env (conditional_cover env) + (* + * LogicalANDExpression : + * BinaryExpression + * LogicalANDExpression && BitwiseORExpression + * + * LogicalORExpression : + * LogicalANDExpression + * LogicalORExpression || LogicalANDExpression + * LogicalORExpression ?? LogicalANDExpression + * + * LogicalExpression : + * LogicalORExpression + *) and logical_cover = let open Expression in let make_logical env left right operator loc = let left = as_expression env left in let right = as_expression env right in - Cover_expr (loc, Logical {Logical.operator; left; right;}) - in let rec logical_and env left lloc = + Cover_expr (loc, Logical { Logical.operator; left; right; comments = None }) + in + let rec logical_and env left lloc = match Peek.token env with | T_AND -> - Expect.token env T_AND; - let rloc, right = with_loc binary_cover env in - let loc = Loc.btwn lloc rloc in - logical_and env (make_logical env left right Logical.And loc) loc - | _ -> lloc, left + Eat.token env; + let (rloc, right) = with_loc binary_cover env in + let loc = Loc.btwn lloc rloc in + let left = make_logical env left right Logical.And loc in + (* `a && b ?? c` is an error, but to recover, try to parse it like `(a && b) ?? c`. *) + let (loc, left) = coalesce ~allowed:false env left loc in + logical_and env left loc + | _ -> (lloc, left) and logical_or env left lloc = - let options = parse_options env in match Peek.token env with | T_OR -> - Expect.token env T_OR; - let rloc, right = with_loc binary_cover env in - let rloc, right = logical_and env right rloc in - let loc = Loc.btwn lloc rloc in - logical_or env (make_logical env left right Logical.Or loc) loc + Eat.token env; + let (rloc, right) = with_loc binary_cover env in + let (rloc, right) = logical_and env right rloc in + let loc = Loc.btwn lloc rloc in + let left = make_logical env left right Logical.Or loc in + (* `a || b ?? c` is an error, but to recover, try to parse it like `(a || b) ?? c`. *) + let (loc, left) = coalesce ~allowed:false env left loc in + logical_or env left loc + | _ -> (lloc, left) + and coalesce ~allowed env left lloc = + match Peek.token env with | T_PLING_PLING -> - if not options.esproposal_nullish_coalescing - then error env Parse_error.NullishCoalescingDisabled; - - Expect.token env T_PLING_PLING; - let rloc, right = with_loc binary_cover env in - let rloc, right = logical_and env right rloc in - let loc = Loc.btwn lloc rloc in - logical_or env (make_logical env left right Logical.NullishCoalesce loc) loc - | _ -> left - in fun env -> - let loc, left = with_loc binary_cover env in - let loc, left = logical_and env left loc in - logical_or env left loc + let options = parse_options env in + if not options.esproposal_nullish_coalescing then + error env Parse_error.NullishCoalescingDisabled; + + if not allowed then error env (Parse_error.NullishCoalescingUnexpectedLogical "??"); + + Expect.token env T_PLING_PLING; + let (rloc, right) = with_loc binary_cover env in + let (rloc, right) = + match Peek.token env with + | (T_AND | T_OR) as t -> + (* `a ?? b || c` is an error. To recover, treat it like `a ?? (b || c)`. *) + error env (Parse_error.NullishCoalescingUnexpectedLogical (Token.value_of_token t)); + let (rloc, right) = logical_and env right rloc in + logical_or env right rloc + | _ -> (rloc, right) + in + let loc = Loc.btwn lloc rloc in + coalesce ~allowed:true env (make_logical env left right Logical.NullishCoalesce loc) loc + | _ -> (lloc, left) + in + fun env -> + let (loc, left) = with_loc binary_cover env in + let (_, left) = + match Peek.token env with + | T_PLING_PLING -> coalesce ~allowed:true env left loc + | _ -> + let (loc, left) = logical_and env left loc in + logical_or env left loc + in + left and binary_cover = let binary_op env = - let ret = Expression.Binary.(match Peek.token env with - (* Most BinaryExpression operators are left associative *) - (* Lowest pri *) - | T_BIT_OR -> Some (BitOr, Left_assoc 2) - | T_BIT_XOR -> Some (Xor, Left_assoc 3) - | T_BIT_AND -> Some (BitAnd, Left_assoc 4) - | T_EQUAL -> Some (Equal, Left_assoc 5) - | T_STRICT_EQUAL -> Some (StrictEqual, Left_assoc 5) - | T_NOT_EQUAL -> Some (NotEqual, Left_assoc 5) - | T_STRICT_NOT_EQUAL -> Some (StrictNotEqual, Left_assoc 5) - | T_LESS_THAN -> Some (LessThan, Left_assoc 6) - | T_LESS_THAN_EQUAL -> Some (LessThanEqual, Left_assoc 6) - | T_GREATER_THAN -> Some (GreaterThan, Left_assoc 6) - | T_GREATER_THAN_EQUAL -> Some (GreaterThanEqual, Left_assoc 6) - | T_IN -> - if (no_in env) then None else Some (In, Left_assoc 6) - | T_INSTANCEOF -> Some (Instanceof, Left_assoc 6) - | T_LSHIFT -> Some (LShift, Left_assoc 7) - | T_RSHIFT -> Some (RShift, Left_assoc 7) - | T_RSHIFT3 -> Some (RShift3, Left_assoc 7) - | T_PLUS -> Some (Plus, Left_assoc 8) - | T_MINUS -> Some (Minus, Left_assoc 8) - | T_MULT -> Some (Mult, Left_assoc 9) - | T_DIV -> Some (Div, Left_assoc 9) - | T_MOD -> Some (Mod, Left_assoc 9) - | T_EXP -> Some (Exp, Right_assoc 10) - (* Highest priority *) - | _ -> None) - in if ret <> None then Eat.token env; + let ret = + let open Expression.Binary in + match Peek.token env with + (* Most BinaryExpression operators are left associative *) + (* Lowest pri *) + | T_BIT_OR -> Some (BitOr, Left_assoc 2) + | T_BIT_XOR -> Some (Xor, Left_assoc 3) + | T_BIT_AND -> Some (BitAnd, Left_assoc 4) + | T_EQUAL -> Some (Equal, Left_assoc 5) + | T_STRICT_EQUAL -> Some (StrictEqual, Left_assoc 5) + | T_NOT_EQUAL -> Some (NotEqual, Left_assoc 5) + | T_STRICT_NOT_EQUAL -> Some (StrictNotEqual, Left_assoc 5) + | T_LESS_THAN -> Some (LessThan, Left_assoc 6) + | T_LESS_THAN_EQUAL -> Some (LessThanEqual, Left_assoc 6) + | T_GREATER_THAN -> Some (GreaterThan, Left_assoc 6) + | T_GREATER_THAN_EQUAL -> Some (GreaterThanEqual, Left_assoc 6) + | T_IN -> + if no_in env then + None + else + Some (In, Left_assoc 6) + | T_INSTANCEOF -> Some (Instanceof, Left_assoc 6) + | T_LSHIFT -> Some (LShift, Left_assoc 7) + | T_RSHIFT -> Some (RShift, Left_assoc 7) + | T_RSHIFT3 -> Some (RShift3, Left_assoc 7) + | T_PLUS -> Some (Plus, Left_assoc 8) + | T_MINUS -> Some (Minus, Left_assoc 8) + | T_MULT -> Some (Mult, Left_assoc 9) + | T_DIV -> Some (Div, Left_assoc 9) + | T_MOD -> Some (Mod, Left_assoc 9) + | T_EXP -> Some (Exp, Right_assoc 10) + (* Highest priority *) + | _ -> None + in + if ret <> None then Eat.token env; ret - - in let make_binary left right operator loc = - loc, Expression.(Binary Binary.({ - operator; - left; - right; - })) - - in let rec add_to_stack right (rop, rpri) rloc = function - | (left, (lop, lpri), lloc)::rest when is_tighter lpri rpri -> - let loc = Loc.btwn lloc rloc in - let right = make_binary left right lop loc in - add_to_stack right (rop, rpri) loc rest - | stack -> (right, (rop, rpri), rloc)::stack - - in let rec collapse_stack right rloc = function + in + let make_binary left right operator loc = + (loc, Expression.(Binary Binary.{ operator; left; right; comments = None })) + in + let rec add_to_stack right (rop, rpri) rloc = function + | (left, (lop, lpri), lloc) :: rest when is_tighter lpri rpri -> + let loc = Loc.btwn lloc rloc in + let right = make_binary left right lop loc in + add_to_stack right (rop, rpri) loc rest + | stack -> (right, (rop, rpri), rloc) :: stack + in + let rec collapse_stack right rloc = function | [] -> right - | (left, (lop, _), lloc)::rest -> - let loc = Loc.btwn lloc rloc in - collapse_stack (make_binary left right lop loc) loc rest - - in let rec helper env stack = - let right_loc, (is_unary, right) = with_loc (fun env -> - let is_unary = peek_unary_op env <> None in - let right = unary_cover (env |> with_no_in false) in - is_unary, right - ) env in - if Peek.token env = T_LESS_THAN - then begin + | (left, (lop, _), lloc) :: rest -> + let loc = Loc.btwn lloc rloc in + collapse_stack (make_binary left right lop loc) loc rest + in + let rec helper env stack = + let (right_loc, (is_unary, right)) = + with_loc + (fun env -> + let is_unary = peek_unary_op env <> None in + let right = unary_cover (env |> with_no_in false) in + (is_unary, right)) + env + in + ( if Peek.token env = T_LESS_THAN then match right with - | Cover_expr (_, Expression.JSXElement _) -> - error env Error.AdjacentJSXElements - | _ -> () - end; - match stack, binary_op env with - | [], None -> - right - | _, None -> + | Cover_expr (_, Expression.JSXElement _) -> error env Parse_error.AdjacentJSXElements + | _ -> () ); + match (stack, binary_op env) with + | ([], None) -> right + | (_, None) -> let right = as_expression env right in Cover_expr (collapse_stack right right_loc stack) - | _, Some (rop, rpri) -> + | (_, Some (rop, rpri)) -> if is_unary && rop = Expression.Binary.Exp then - error_at env (right_loc, Error.InvalidLHSInExponentiation); + error_at env (right_loc, Parse_error.InvalidLHSInExponentiation); let right = as_expression env right in helper env (add_to_stack right (rop, rpri) right_loc stack) - - in fun env -> helper env [] + in + (fun env -> helper env []) and peek_unary_op env = let open Expression.Unary in @@ -406,164 +517,205 @@ module Expression and unary_cover env = let begin_loc = Peek.loc env in + let leading = Peek.comments env in let op = peek_unary_op env in match op with - | None -> begin - let op = Expression.Update.(match Peek.token env with + | None -> + let op = + let open Expression.Update in + match Peek.token env with | T_INCR -> Some Increment | T_DECR -> Some Decrement - | _ -> None) in - match op with - | None -> postfix_cover env - | Some operator -> - Eat.token env; - let end_loc, argument = with_loc unary env in - if not (is_lhs argument) - then error_at env (fst argument, Error.InvalidLHSInAssignment); - (match argument with - | _, Expression.Identifier (_, name) - when is_restricted name -> - strict_error env Error.StrictLHSPrefix - | _ -> ()); - let loc = Loc.btwn begin_loc end_loc in - Cover_expr (loc, Expression.(Update { Update. - operator; - prefix = true; - argument; - })) - end + | _ -> None + in + (match op with + | None -> postfix_cover env + | Some operator -> + Eat.token env; + let (end_loc, argument) = with_loc unary env in + if not (is_lhs argument) then error_at env (fst argument, Parse_error.InvalidLHSInAssignment); + (match argument with + | (_, Expression.Identifier (_, { Identifier.name; comments = _ })) when is_restricted name + -> + strict_error env Parse_error.StrictLHSPrefix + | _ -> ()); + let loc = Loc.btwn begin_loc end_loc in + Cover_expr + ( loc, + Expression.( + Update + { + Update.operator; + prefix = true; + argument; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + }) )) | Some operator -> Eat.token env; - let end_loc, argument = with_loc unary env in + let (end_loc, argument) = with_loc unary env in let loc = Loc.btwn begin_loc end_loc in - Expression.(match operator, argument with - | Unary.Delete, (_, Identifier _) -> - strict_error_at env (loc, Error.StrictDelete) - | Unary.Delete, (_, Member member) -> - begin match member.Ast.Expression.Member.property with + let open Expression in + (match (operator, argument) with + | (Unary.Delete, (_, Identifier _)) -> strict_error_at env (loc, Parse_error.StrictDelete) + | (Unary.Delete, (_, Member member)) -> + begin + match member.Ast.Expression.Member.property with | Ast.Expression.Member.PropertyPrivateName _ -> - error_at env (loc, Error.PrivateDelete) - | _ -> () end + error_at env (loc, Parse_error.PrivateDelete) + | _ -> () + end | _ -> ()); - Cover_expr (loc, Expression.(Unary { Unary. - operator; - prefix = true; - argument; - })) + Cover_expr + ( loc, + let open Expression in + Unary { Unary.operator; argument; comments = Flow_ast_utils.mk_comments_opt ~leading () } + ) and unary env = as_expression env (unary_cover env) and postfix_cover env = let argument = left_hand_side_cover env in (* No line terminator allowed before operator *) - if Peek.is_line_terminator env - then argument - else let op = Expression.Update.(match Peek.token env with - | T_INCR -> Some Increment - | T_DECR -> Some Decrement - | _ -> None) in - match op with - | None -> argument - | Some operator -> + if Peek.is_line_terminator env then + argument + else + let op = + let open Expression.Update in + match Peek.token env with + | T_INCR -> Some Increment + | T_DECR -> Some Decrement + | _ -> None + in + match op with + | None -> argument + | Some operator -> let argument = as_expression env argument in - if not (is_lhs argument) - then error_at env (fst argument, Error.InvalidLHSInAssignment); + if not (is_lhs argument) then error_at env (fst argument, Parse_error.InvalidLHSInAssignment); (match argument with - | _, Expression.Identifier (_, name) - when is_restricted name -> - strict_error env Error.StrictLHSPostfix + | (_, Expression.Identifier (_, { Identifier.name; comments = _ })) when is_restricted name + -> + strict_error env Parse_error.StrictLHSPostfix | _ -> ()); let end_loc = Peek.loc env in Eat.token env; + let trailing = Eat.trailing_comments env in let loc = Loc.btwn (fst argument) end_loc in - Cover_expr (loc, Expression.(Update { Update. - operator; - prefix = false; - argument; - })) + Cover_expr + ( loc, + Expression.( + Update + { + Update.operator; + prefix = false; + argument; + comments = Flow_ast_utils.mk_comments_opt ~trailing (); + }) ) and left_hand_side_cover env = let start_loc = Peek.loc env in let allow_new = not (no_new env) in let env = with_no_new false env in - let expr = match Peek.token env with - | T_NEW when allow_new -> Cover_expr (new_expression env) - | T_IMPORT -> Cover_expr (import env) - | T_SUPER -> Cover_expr (super env) - | _ when Peek.is_function env -> Cover_expr (_function env) - | _ -> primary_cover env in + let expr = + match Peek.token env with + | T_NEW when allow_new -> Cover_expr (new_expression env) + | T_IMPORT -> Cover_expr (import env) + | T_SUPER -> Cover_expr (super env) + | _ when Peek.is_function env -> Cover_expr (_function env) + | _ -> primary_cover env + in call_cover env start_loc expr and left_hand_side env = as_expression env (left_hand_side_cover env) and super env = - let allowed, call_allowed = match allow_super env with - | No_super -> false, false - | Super_prop -> true, false - | Super_prop_or_call -> true, true + let (allowed, call_allowed) = + match allow_super env with + | No_super -> (false, false) + | Super_prop -> (true, false) + | Super_prop_or_call -> (true, true) in let loc = Peek.loc env in + let leading = Peek.comments env in Expect.token env T_SUPER; - let super = loc, Expression.Super in + let trailing = Eat.trailing_comments env in + let super = + ( loc, + Expression.Super + { Expression.Super.comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () } ) + in match Peek.token env with | T_PERIOD | T_LBRACKET -> let super = - if not allowed then begin + if not allowed then ( error_at env (loc, Parse_error.UnexpectedSuper); - loc, Expression.Identifier (loc, "super") - end else + (loc, Expression.Identifier (Flow_ast_utils.ident_of_source (loc, "super"))) + ) else super in call ~allow_optional_chain:false env loc super | T_LPAREN -> let super = - if not call_allowed then begin + if not call_allowed then ( error_at env (loc, Parse_error.UnexpectedSuperCall); - loc, Expression.Identifier (loc, "super") - end else + (loc, Expression.Identifier (Flow_ast_utils.ident_of_source (loc, "super"))) + ) else super in call ~allow_optional_chain:false env loc super | _ -> - if not allowed - then error_at env (loc, Parse_error.UnexpectedSuper) - else error_unexpected env; + if not allowed then + error_at env (loc, Parse_error.UnexpectedSuper) + else + error_unexpected ~expected:"either a call or access of `super`" env; super - and import env = with_loc (fun env -> - Expect.token env T_IMPORT; - Expect.token env T_LPAREN; - let arg = assignment (with_no_in false env) in - Expect.token env T_RPAREN; - Expression.Import arg - ) env - - and call_cover ?(allow_optional_chain=true) ?(in_optional_chain=false) env start_loc left = + and import env = + with_loc + (fun env -> + let leading = Peek.comments env in + Expect.token env T_IMPORT; + let leading_arg = Peek.comments env in + Expect.token env T_LPAREN; + let argument = add_comments (assignment (with_no_in false env)) ~leading:leading_arg in + Expect.token env T_RPAREN; + let trailing = Eat.trailing_comments env in + Expression.Import + { + Expression.Import.argument; + comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + }) + env + + and call_cover ?(allow_optional_chain = true) ?(in_optional_chain = false) env start_loc left = let left = member_cover ~allow_optional_chain ~in_optional_chain env start_loc left in let optional = last_token env = Some T_PLING_PERIOD in - let arguments ?targs env = - let args_loc, arguments = arguments env in + let left_to_callee env = + let { remove_trailing; _ } = trailing_and_remover env in + remove_trailing (as_expression env left) (fun remover left -> remover#expression left) + in + let arguments ?targs env callee = + let (args_loc, arguments) = arguments env in let loc = Loc.btwn start_loc args_loc in - let call = { Expression.Call. - callee = as_expression env left; - targs; - arguments; - } in - let call = if optional || in_optional_chain - then Expression.(OptionalCall { OptionalCall. - call; - optional; - }) - else Expression.Call call + let call = + { Expression.Call.callee; targs; arguments = (args_loc, arguments); comments = None } + in + let call = + if optional || in_optional_chain then + let open Expression in + OptionalCall { OptionalCall.call; optional } + else + Expression.Call call in - call_cover ~allow_optional_chain ~in_optional_chain env start_loc - (Cover_expr (loc, call)) + let in_optional_chain = in_optional_chain || optional in + call_cover ~allow_optional_chain ~in_optional_chain env start_loc (Cover_expr (loc, call)) in - if no_call env then left - else match Peek.token env with - | T_LPAREN -> arguments env - | T_LESS_THAN when should_parse_types env -> + if no_call env then + left + else + match Peek.token env with + | T_LPAREN -> arguments env (left_to_callee env) + | T_LESS_THAN when should_parse_types env -> (* If we are parsing types, then f(e) is a function call with a type application. If we aren't, it's a nested binary expression. *) let error_callback _ _ = raise Try.Rollback in @@ -571,577 +723,961 @@ module Expression (* Parameterized call syntax is ambiguous, so we fall back to standard parsing if it fails. *) Try.or_else env ~fallback:left (fun env -> - let targs = Type.type_parameter_instantiation env in - arguments ?targs env - ) - | _ -> left + let callee = left_to_callee env in + let targs = call_type_args env in + arguments ?targs env callee) + | _ -> left - and call ?(allow_optional_chain=true) env start_loc left = + and call ?(allow_optional_chain = true) env start_loc left = as_expression env (call_cover ~allow_optional_chain env start_loc (Cover_expr left)) and new_expression env = - let start_loc = Peek.loc env in - Expect.token env T_NEW; + with_loc + (fun env -> + let start_loc = Peek.loc env in + let leading = Peek.comments env in + Expect.token env T_NEW; + + if in_function env && Peek.token env = T_PERIOD then ( + let trailing = Eat.trailing_comments env in + Eat.token env; + let meta = + Flow_ast_utils.ident_of_source + (start_loc, "new") + ?comments:(Flow_ast_utils.mk_comments_opt ~leading ~trailing ()) + in + match Peek.token env with + | T_IDENTIFIER { raw = "target"; _ } -> + let property = Parse.identifier env in + Expression.(MetaProperty MetaProperty.{ meta; property; comments = None }) + | _ -> + error_unexpected ~expected:"the identifier `target`" env; + Eat.token env; - if in_function env && Peek.token env = T_PERIOD then begin - Expect.token env T_PERIOD; - let meta = start_loc, "new" in - match Peek.token env with - | T_IDENTIFIER { raw = "target"; _ } -> - let property = Parse.identifier env in - let end_loc = fst property in - Loc.btwn start_loc end_loc, Expression.(MetaProperty MetaProperty.({ - meta; - property; - })) - | _ -> - error_unexpected env; - Eat.token env; (* skip unknown identifier *) - start_loc, Expression.Identifier meta (* return `new` identifier *) - end else - let callee_loc = Peek.loc env in - let expr = match Peek.token env with - | T_NEW -> new_expression env - | T_SUPER -> super (env |> with_no_call true) - | _ when Peek.is_function env -> _function env - | _ -> primary env in - let callee = member ~allow_optional_chain:false (env |> with_no_call true) callee_loc expr in - (* You can do something like - * new raw`42` - *) - let callee = match Peek.token env with - | T_TEMPLATE_PART part -> tagged_template env callee_loc callee part - | _ -> callee in - let targs = - (* If we are parsing types, then new C(e) is a constructor with a - type application. If we aren't, it's a nested binary expression. *) - if should_parse_types env - then - (* Parameterized call syntax is ambiguous, so we fall back to - standard parsing if it fails. *) - let error_callback _ _ = raise Try.Rollback in - let env = env |> with_error_callback error_callback in - Try.or_else env ~fallback:None Type.type_parameter_instantiation - else - None + (* skip unknown identifier *) + Expression.Identifier meta + (* return `new` identifier *) + ) else + let callee_loc = Peek.loc env in + let expr = + match Peek.token env with + | T_NEW -> new_expression env + | T_SUPER -> super (env |> with_no_call true) + | _ when Peek.is_function env -> _function env + | _ -> primary env + in + let callee = + member ~allow_optional_chain:false (env |> with_no_call true) callee_loc expr + in + (* You can do something like + * new raw`42` + *) + let callee = + let callee = + match Peek.token env with + | T_TEMPLATE_PART part -> tagged_template env callee_loc callee part + | _ -> callee + in + (* Remove trailing comments if the callee is followed by args or type args *) + if Peek.token env = T_LPAREN || (should_parse_types env && Peek.token env = T_LESS_THAN) + then + let { remove_trailing; _ } = trailing_and_remover env in + remove_trailing callee (fun remover callee -> remover#expression callee) + else + callee + in + let targs = + (* If we are parsing types, then new C(e) is a constructor with a + type application. If we aren't, it's a nested binary expression. *) + if should_parse_types env then + (* Parameterized call syntax is ambiguous, so we fall back to + standard parsing if it fails. *) + let error_callback _ _ = raise Try.Rollback in + let env = env |> with_error_callback error_callback in + Try.or_else env ~fallback:None call_type_args + else + None + in + let arguments = + match Peek.token env with + | T_LPAREN -> Some (arguments env) + | _ -> None + in + let comments = Flow_ast_utils.mk_comments_opt ~leading () in + Expression.(New New.{ callee; targs; arguments; comments })) + env + + and call_type_args = + let args = + let rec args_helper env acc = + match Peek.token env with + | T_EOF + | T_GREATER_THAN -> + List.rev acc + | _ -> + let t = + match Peek.token env with + | T_IDENTIFIER { value = "_"; _ } -> + let loc = Peek.loc env in + let leading = Peek.comments env in + Expect.identifier env "_"; + let trailing = Eat.trailing_comments env in + Expression.CallTypeArg.Implicit + ( loc, + { + Expression.CallTypeArg.Implicit.comments = + Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + } ) + | _ -> Expression.CallTypeArg.Explicit (Type._type env) + in + let acc = t :: acc in + if Peek.token env <> T_GREATER_THAN then Expect.token env T_COMMA; + args_helper env acc in - let end_loc, arguments = match Peek.token env, targs with - | T_LPAREN, _ -> arguments env - | _, Some (targs_loc, _) -> targs_loc, [] - | _ -> fst callee, [] in - - Loc.btwn start_loc end_loc, Expression.(New New.({ - callee; - targs; - arguments; - })) + fun env -> + let leading = Peek.comments env in + Expect.token env T_LESS_THAN; + let arguments = args_helper env [] in + let internal = Peek.comments env in + Expect.token env T_GREATER_THAN; + let trailing = + if Peek.token env = T_LPAREN then + let { trailing; _ } = trailing_and_remover env in + trailing + else + Eat.trailing_comments env + in + { + Expression.CallTypeArgs.arguments; + comments = Flow_ast_utils.mk_comments_with_internal_opt ~leading ~trailing ~internal; + } + in + fun env -> + if Peek.token env = T_LESS_THAN then + Some (with_loc args env) + else + None and arguments = + let spread_element env = + let leading = Peek.comments env in + Expect.token env T_ELLIPSIS; + let argument = assignment env in + Expression.SpreadElement.{ argument; comments = Flow_ast_utils.mk_comments_opt ~leading () } + in let argument env = match Peek.token env with - | T_ELLIPSIS -> - let start_loc = Peek.loc env in - Expect.token env T_ELLIPSIS; - let argument = assignment env in - let loc = Loc.btwn start_loc (fst argument) in - Expression.(Spread (loc, SpreadElement.({ - argument; - }))) + | T_ELLIPSIS -> Expression.Spread (with_loc spread_element env) | _ -> Expression.Expression (assignment env) - - in let rec arguments' env acc = + in + let rec arguments' env acc = match Peek.token env with | T_EOF - | T_RPAREN -> List.rev acc + | T_RPAREN -> + List.rev acc | _ -> - let acc = (argument env)::acc in - if Peek.token env <> T_RPAREN - then Expect.token env T_COMMA; - arguments' env acc - - in fun env -> - let start_loc = Peek.loc env in - Expect.token env T_LPAREN; - - let args = arguments' env [] - - in let end_loc = Peek.loc env in - Expect.token env T_RPAREN; - Loc.btwn start_loc end_loc, args + let acc = argument env :: acc in + if Peek.token env <> T_RPAREN then Expect.token env T_COMMA; + arguments' env acc + in + fun env -> + with_loc + (fun env -> + let leading = Peek.comments env in + Expect.token env T_LPAREN; + let args = arguments' env [] in + let internal = Peek.comments env in + Expect.token env T_RPAREN; + let trailing = Eat.trailing_comments env in + { + Expression.ArgList.arguments = args; + comments = Flow_ast_utils.mk_comments_with_internal_opt ~leading ~trailing ~internal; + }) + env and member_cover = - let dynamic ?(allow_optional_chain=true) ?(in_optional_chain=false) - ?(optional=false) env start_loc left = + let dynamic + ?(allow_optional_chain = true) + ?(in_optional_chain = false) + ?(optional = false) + env + start_loc + left = let expr = Parse.expression (env |> with_no_call false) in let last_loc = Peek.loc env in Expect.token env T_RBRACKET; + let trailing = Eat.trailing_comments env in let loc = Loc.btwn start_loc last_loc in - let member = Expression.Member.({ - _object = as_expression env left; - property = PropertyExpression expr; - computed = true; - }) in - let member = if in_optional_chain - then Expression.(OptionalMember { OptionalMember. - member; - optional; - }) - else Expression.Member member + let member = + Expression.Member. + { + _object = as_expression env left; + property = PropertyExpression expr; + comments = Flow_ast_utils.mk_comments_opt ~trailing (); + } + in + let member = + if in_optional_chain then + let open Expression in + OptionalMember { OptionalMember.member; optional } + else + Expression.Member member in - call_cover ~allow_optional_chain ~in_optional_chain env start_loc - (Cover_expr (loc, member)) + call_cover ~allow_optional_chain ~in_optional_chain env start_loc (Cover_expr (loc, member)) in - let static ?(allow_optional_chain=true) ?(in_optional_chain=false) - ?(optional=false) env start_loc left = - let id_loc, id, is_private = property_name_include_private env in - if is_private then add_used_private env (snd id) id_loc; + let static + ?(allow_optional_chain = true) + ?(in_optional_chain = false) + ?(optional = false) + env + start_loc + left = + let (id_loc, id, is_private, leading) = property_name_include_private env in + if is_private then add_used_private env (Flow_ast_utils.name_of_ident id) id_loc; let loc = Loc.btwn start_loc id_loc in let open Expression.Member in - let property = if is_private then PropertyPrivateName (id_loc, id) - else PropertyIdentifier id in + let property = + if is_private then + PropertyPrivateName + (id_loc, { PrivateName.id; comments = Flow_ast_utils.mk_comments_opt ~leading () }) + else + PropertyIdentifier id + in (* super.PrivateName is a syntax error *) - begin match left with - | Cover_expr (_, Ast.Expression.Super) when is_private -> - error_at env (loc, Error.SuperPrivate) - | _ -> () end; - let member = Expression.Member.({ - _object = as_expression env left; - property; - computed = false; - }) in - let member = if in_optional_chain - then Expression.(OptionalMember { OptionalMember. - member; - optional; - }) - else Expression.Member member + begin + match left with + | Cover_expr (_, Ast.Expression.Super _) when is_private -> + error_at env (loc, Parse_error.SuperPrivate) + | _ -> () + end; + let member = + Expression.Member.{ _object = as_expression env left; property; comments = None } + in + let member = + if in_optional_chain then + let open Expression in + OptionalMember { OptionalMember.member; optional } + else + Expression.Member member in - call_cover ~allow_optional_chain ~in_optional_chain env start_loc - (Cover_expr (loc, member)) + call_cover ~allow_optional_chain ~in_optional_chain env start_loc (Cover_expr (loc, member)) in - fun ?(allow_optional_chain=true) ?(in_optional_chain=false) env start_loc left -> + fun ?(allow_optional_chain = true) ?(in_optional_chain = false) env start_loc left -> let options = parse_options env in match Peek.token env with | T_PLING_PERIOD -> - if not options.esproposal_optional_chaining - then error env Parse_error.OptionalChainingDisabled; + if not options.esproposal_optional_chaining then + error env Parse_error.OptionalChainingDisabled; - if not allow_optional_chain - then error env Parse_error.OptionalChainNew; + if not allow_optional_chain then error env Parse_error.OptionalChainNew; - Expect.token env T_PLING_PERIOD; - begin match Peek.token env with + Expect.token env T_PLING_PERIOD; + begin + match Peek.token env with | T_TEMPLATE_PART _ -> error env Parse_error.OptionalChainTemplate; left | T_LPAREN -> left | T_LESS_THAN when should_parse_types env -> left | T_LBRACKET -> - Expect.token env T_LBRACKET; - dynamic ~allow_optional_chain ~in_optional_chain:true - ~optional:true env start_loc left + Eat.token env; + dynamic ~allow_optional_chain ~in_optional_chain:true ~optional:true env start_loc left | _ -> - static ~allow_optional_chain ~in_optional_chain:true - ~optional:true env start_loc left - end + static ~allow_optional_chain ~in_optional_chain:true ~optional:true env start_loc left + end | T_LBRACKET -> - Expect.token env T_LBRACKET; - dynamic ~allow_optional_chain ~in_optional_chain env start_loc left + Eat.token env; + dynamic ~allow_optional_chain ~in_optional_chain env start_loc left | T_PERIOD -> - Expect.token env T_PERIOD; - static ~allow_optional_chain ~in_optional_chain env start_loc left + Eat.token env; + static ~allow_optional_chain ~in_optional_chain env start_loc left | T_TEMPLATE_PART part -> - if in_optional_chain - then error env Parse_error.OptionalChainTemplate; + if in_optional_chain then error env Parse_error.OptionalChainTemplate; - let expr = tagged_template env start_loc (as_expression env left) part in - call_cover ~allow_optional_chain:false env start_loc (Cover_expr expr) + let expr = tagged_template env start_loc (as_expression env left) part in + call_cover ~allow_optional_chain:false env start_loc (Cover_expr expr) | _ -> left - and member ?(allow_optional_chain=true) env start_loc left = + and member ?(allow_optional_chain = true) env start_loc left = as_expression env (member_cover ~allow_optional_chain env start_loc (Cover_expr left)) and _function env = - let start_loc = Peek.loc env in - let async = Declaration.async env in - Expect.token env T_FUNCTION; - let generator = Declaration.generator env in - let yield, await = match async, generator with - | true, true -> true, true (* proposal-async-iteration/#prod-AsyncGeneratorExpression *) - | true, false -> false, true (* #prod-AsyncFunctionExpression *) - | false, true -> true, false (* #prod-GeneratorExpression *) - | false, false -> false, false (* #prod-FunctionExpression *) - in - let id, tparams = - if Peek.token env = T_LPAREN - then None, None - else begin - let id = match Peek.token env with - | T_LESS_THAN -> None - | _ -> - let env = env |> with_allow_await await |> with_allow_yield yield in - Some (Parse.identifier ~restricted_error:Error.StrictFunctionName env) in - id, Type.type_parameter_declaration env - end in - - (* #sec-function-definitions-static-semantics-early-errors *) - let env = env |> with_allow_super No_super in - - let params = Declaration.function_params ~await ~yield env in - let return, predicate = Type.annotation_and_predicate_opt env in - let end_loc, body, strict = - Declaration.function_body env ~async ~generator in - let simple = Declaration.is_simple_function_params params in - Declaration.strict_post_check env ~strict ~simple id params; - let expression = Function.( - match body with - | BodyBlock _ -> false - | BodyExpression _ -> true) in - Loc.btwn start_loc end_loc, Expression.(Function Function.({ - id; - params; - body; - generator; - async; - predicate; - expression; - return; - tparams; - })) + with_loc + (fun env -> + let (async, leading_async) = Declaration.async env in + let (sig_loc, (id, params, generator, predicate, return, tparams, leading)) = + with_loc + (fun env -> + let leading_function = Peek.comments env in + Expect.token env T_FUNCTION; + let (generator, leading_generator) = Declaration.generator env in + let leading = List.concat [leading_async; leading_function; leading_generator] in + (* `await` is a keyword in async functions: + - proposal-async-iteration/#prod-AsyncGeneratorExpression + - #prod-AsyncFunctionExpression *) + let await = async in + (* `yield` is a keyword in generator functions: + - proposal-async-iteration/#prod-AsyncGeneratorExpression + - #prod-GeneratorExpression *) + let yield = generator in + let (id, tparams) = + if Peek.token env = T_LPAREN then + (None, None) + else + let id = + match Peek.token env with + | T_LESS_THAN -> None + | _ -> + let env = env |> with_allow_await await |> with_allow_yield yield in + let id = + id_remove_trailing + env + (Parse.identifier ~restricted_error:Parse_error.StrictFunctionName env) + in + Some id + in + let tparams = type_params_remove_trailing env (Type.type_params env) in + (id, tparams) + in + (* #sec-function-definitions-static-semantics-early-errors *) + let env = env |> with_allow_super No_super in + let params = + let params = Declaration.function_params ~await ~yield env in + if Peek.token env = T_COLON then + params + else + function_params_remove_trailing env params + in + let (return, predicate) = Type.annotation_and_predicate_opt env in + let (return, predicate) = + match predicate with + | None -> (type_annotation_hint_remove_trailing env return, predicate) + | Some _ -> (return, predicate_remove_trailing env predicate) + in + (id, params, generator, predicate, return, tparams, leading)) + env + in + let (body, strict) = Declaration.function_body env ~async ~generator ~expression:true in + let simple = Declaration.is_simple_function_params params in + Declaration.strict_post_check env ~strict ~simple id params; + Expression.Function + { + Function.id; + params; + body; + generator; + async; + predicate; + return; + tparams; + sig_loc; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + }) + env and number env kind raw = - let value = match kind with - | LEGACY_OCTAL -> - strict_error env Error.StrictOctalLiteral; - begin try Int64.to_float (Int64.of_string ("0o"^raw)) - with Failure _ -> failwith ("Invalid legacy octal "^raw) - end - | BINARY - | OCTAL -> - begin try Int64.to_float (Int64.of_string raw) - with Failure _ -> failwith ("Invalid binary/octal "^raw) - end - | NORMAL -> - begin try Lexer.FloatOfString.float_of_string raw - with - | _ when Sys.win32 -> - error env Parse_error.WindowsFloatOfString; - 789.0 - | Failure _ -> - failwith ("Invalid number "^raw) - end + let value = + match kind with + | LEGACY_OCTAL -> + strict_error env Parse_error.StrictOctalLiteral; + begin + try Int64.to_float (Int64.of_string ("0o" ^ raw)) + with Failure _ -> failwith ("Invalid legacy octal " ^ raw) + end + | LEGACY_NON_OCTAL -> + strict_error env Parse_error.StrictNonOctalLiteral; + begin + try float_of_string raw with Failure _ -> failwith ("Invalid number " ^ raw) + end + | BINARY + | OCTAL -> + begin + try Int64.to_float (Int64.of_string raw) + with Failure _ -> failwith ("Invalid binary/octal " ^ raw) + end + | NORMAL -> + begin + try float_of_string raw with Failure _ -> failwith ("Invalid number " ^ raw) + end in Expect.token env (T_NUMBER { kind; raw }); value + and bigint_strip_n raw = + let size = String.length raw in + let str = + if size != 0 && raw.[size - 1] == 'n' then + String.sub raw 0 (size - 1) + else + raw + in + str + + and bigint env kind raw = + let value = + match kind with + | BIG_BINARY + | BIG_OCTAL -> + let postraw = bigint_strip_n raw in + begin + try Int64.to_float (Int64.of_string postraw) + with Failure _ -> failwith ("Invalid bigint binary/octal " ^ postraw) + end + | BIG_NORMAL -> + let postraw = bigint_strip_n raw in + begin + try float_of_string postraw with Failure _ -> failwith ("Invalid bigint " ^ postraw) + end + in + Expect.token env (T_BIGINT { kind; raw }); + value + and primary_cover env = let loc = Peek.loc env in + let leading = Peek.comments env in match Peek.token env with | T_THIS -> - Expect.token env T_THIS; - Cover_expr (loc, Expression.This) + Eat.token env; + let trailing = Eat.trailing_comments env in + Cover_expr + ( loc, + Expression.This + { Expression.This.comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () } ) | T_NUMBER { kind; raw } -> - let value = Literal.Number (number env kind raw) in - Cover_expr (loc, Expression.(Literal { Literal.value; raw; })) + let value = Literal.Number (number env kind raw) in + let trailing = Eat.trailing_comments env in + Cover_expr + ( loc, + let open Expression in + Literal + { Literal.value; raw; comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () } + ) + | T_BIGINT { kind; raw } -> + let value = Literal.BigInt (bigint env kind raw) in + let trailing = Eat.trailing_comments env in + Cover_expr + ( loc, + let open Expression in + Literal + { Literal.value; raw; comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () } + ) | T_STRING (loc, value, raw, octal) -> - if octal then strict_error env Error.StrictOctalLiteral; - Expect.token env (T_STRING (loc, value, raw, octal)); - let value = Literal.String value in - Cover_expr (loc, Expression.(Literal { Literal.value; raw; })) + if octal then strict_error env Parse_error.StrictOctalLiteral; + Eat.token env; + let value = Literal.String value in + let trailing = Eat.trailing_comments env in + Cover_expr + ( loc, + Expression.Literal + { Literal.value; raw; comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () } + ) | (T_TRUE | T_FALSE) as token -> - Expect.token env token; - let truthy = token = T_TRUE in - let raw = if truthy then "true" else "false" in - let value = Literal.Boolean truthy in - Cover_expr (loc, Expression.(Literal { Literal.value; raw; })) + Eat.token env; + let truthy = token = T_TRUE in + let raw = + if truthy then + "true" + else + "false" + in + let value = Literal.Boolean truthy in + let trailing = Eat.trailing_comments env in + Cover_expr + ( loc, + Expression.Literal + { Literal.value; raw; comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () } + ) | T_NULL -> - Expect.token env T_NULL; - let raw = "null" in - let value = Literal.Null in - Cover_expr (loc, Expression.(Literal { Literal.value; raw; })) + Eat.token env; + let raw = "null" in + let value = Literal.Null in + let trailing = Eat.trailing_comments env in + Cover_expr + ( loc, + Expression.Literal + { Literal.value; raw; comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () } + ) | T_LPAREN -> Cover_expr (group env) | T_LCURLY -> - let loc, obj, errs = Parse.object_initializer env in - Cover_patt ((loc, Expression.Object obj), errs) + let (loc, obj, errs) = Parse.object_initializer env in + Cover_patt ((loc, Expression.Object obj), errs) | T_LBRACKET -> - let loc, arr, errs = array_initializer env in - Cover_patt ((loc, Expression.Array arr), errs) + let (loc, (arr, errs)) = with_loc array_initializer env in + Cover_patt ((loc, Expression.Array arr), errs) | T_DIV - | T_DIV_ASSIGN -> Cover_expr (regexp env) + | T_DIV_ASSIGN -> + Cover_expr (regexp env) | T_LESS_THAN -> - let loc, expression = match Parse.jsx_element_or_fragment env with - | (loc, `Element e) -> (loc, Expression.JSXElement e) - | (loc, `Fragment f) -> (loc, Expression.JSXFragment f) in - Cover_expr (loc, expression) + let (loc, expression) = + match Parse.jsx_element_or_fragment env with + | (loc, `Element e) -> (loc, Expression.JSXElement e) + | (loc, `Fragment f) -> (loc, Expression.JSXFragment f) + in + Cover_expr (loc, expression) | T_TEMPLATE_PART part -> - let loc, template = template_literal env part in - Cover_expr (loc, Expression.TemplateLiteral template) + let (loc, template) = template_literal env part in + Cover_expr (loc, Expression.TemplateLiteral template) | T_CLASS -> Cover_expr (Parse.class_expression env) | _ when Peek.is_identifier env -> - let id = Parse.identifier env in - Cover_expr (fst id, Expression.Identifier id) + let id = Parse.identifier env in + Cover_expr (fst id, Expression.Identifier id) | t -> - error_unexpected env; - (* Let's get rid of the bad token *) - begin match t with T_ERROR _ -> Eat.token env | _ -> () end; - (* Really no idea how to recover from this. I suppose a null - * expression is as good as anything *) - let value = Literal.Null in - let raw = "null" in - Cover_expr (loc, Expression.(Literal { Literal.value; raw; })) + error_unexpected env; + + (* Let's get rid of the bad token *) + begin + match t with + | T_ERROR _ -> Eat.token env + | _ -> () + end; + + (* Really no idea how to recover from this. I suppose a null + * expression is as good as anything *) + let value = Literal.Null in + let raw = "null" in + let trailing = [] in + Cover_expr + ( loc, + let open Expression in + Literal + { Literal.value; raw; comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () } + ) and primary env = as_expression env (primary_cover env) and template_literal = let rec template_parts env quasis expressions = let expr = Parse.expression env in - let expressions = expr::expressions in + let expressions = expr :: expressions in match Peek.token env with | T_RCURLY -> - Eat.push_lex_mode env Lex_mode.TEMPLATE; - let loc, part, is_tail = match Peek.token env with - | T_TEMPLATE_PART (loc, {cooked; raw; _}, tail) -> - let open Ast.Expression.TemplateLiteral in - Eat.token env; - loc, { Element.value = { Element.cooked; raw; }; tail; }, tail - | _ -> assert false in - Eat.pop_lex_mode env; - let quasis = (loc, part)::quasis in - if is_tail - then loc, List.rev quasis, List.rev expressions - else template_parts env quasis expressions + Eat.push_lex_mode env Lex_mode.TEMPLATE; + let (loc, part, is_tail) = + match Peek.token env with + | T_TEMPLATE_PART (loc, { cooked; raw; _ }, tail) -> + let open Ast.Expression.TemplateLiteral in + Eat.token env; + (loc, { Element.value = { Element.cooked; raw }; tail }, tail) + | _ -> assert false + in + Eat.pop_lex_mode env; + let quasis = (loc, part) :: quasis in + if is_tail then + (loc, List.rev quasis, List.rev expressions) + else + template_parts env quasis expressions | _ -> - (* Malformed template *) - error_unexpected env; - let imaginary_quasi = fst expr, { Expression.TemplateLiteral.Element. - value = { Expression.TemplateLiteral.Element. - raw = ""; - cooked = ""; - }; - tail = true; - } in - fst expr, List.rev (imaginary_quasi::quasis), List.rev expressions - - in fun env ((start_loc, {cooked; raw; _}, is_tail) as part) -> + (* Malformed template *) + error_unexpected ~expected:"a template literal part" env; + let imaginary_quasi = + ( fst expr, + { + Expression.TemplateLiteral.Element.value = + { Expression.TemplateLiteral.Element.raw = ""; cooked = "" }; + tail = true; + } ) + in + (fst expr, List.rev (imaginary_quasi :: quasis), List.rev expressions) + in + fun env ((start_loc, { cooked; raw; _ }, is_tail) as part) -> + let leading = Peek.comments env in Expect.token env (T_TEMPLATE_PART part); - let end_loc, quasis, expressions = - let head = Ast.Expression.TemplateLiteral.(start_loc, { - Element.value = { Element.cooked; raw; }; - tail = is_tail; - }) in - if is_tail - then start_loc, [head], [] - else template_parts env [head] [] in + let (end_loc, quasis, expressions) = + let head = + Ast.Expression.TemplateLiteral. + (start_loc, { Element.value = { Element.cooked; raw }; tail = is_tail }) + in + if is_tail then + (start_loc, [head], []) + else + template_parts env [head] [] + in + let trailing = Eat.trailing_comments env in let loc = Loc.btwn start_loc end_loc in - loc, Expression.TemplateLiteral.({ - quasis; - expressions; - }) + ( loc, + Expression.TemplateLiteral. + { quasis; expressions; comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () } + ) and tagged_template env start_loc tag part = + let tag = expression_remove_trailing env tag in let quasi = template_literal env part in - Loc.btwn start_loc (fst quasi), Expression.(TaggedTemplate TaggedTemplate.({ - tag; - quasi; - })) + ( Loc.btwn start_loc (fst quasi), + Expression.(TaggedTemplate TaggedTemplate.{ tag; quasi; comments = None }) ) and group env = - Expect.token env T_LPAREN; - let expression = assignment env in - let ret = (match Peek.token env with - | T_COMMA -> sequence env [expression] - | T_COLON -> - let annot = Type.annotation env in - Expression.(Loc.btwn (fst expression) (fst annot), - TypeCast TypeCast.({ - expression; - annot; - })) - | _ -> expression) in - Expect.token env T_RPAREN; - ret + let leading = Peek.comments env in + let (loc, cover) = + with_loc + (fun env -> + Expect.token env T_LPAREN; + let expr_start_loc = Peek.loc env in + let expression = assignment env in + let ret = + match Peek.token env with + | T_COLON -> + let annot = Type.annotation env in + Group_typecast Expression.TypeCast.{ expression; annot; comments = None } + | T_COMMA -> Group_expr (sequence env ~start_loc:expr_start_loc [expression]) + | _ -> Group_expr expression + in + Expect.token env T_RPAREN; + ret) + env + in + let trailing = Eat.trailing_comments env in + let ret = + match cover with + | Group_expr expr -> expr + | Group_typecast cast -> (loc, Expression.TypeCast cast) + in + add_comments ret ~leading ~trailing + + and add_comments ?(leading = []) ?(trailing = []) (loc, expression) = + let merge_comments inner = + Flow_ast_utils.merge_comments + ~inner + ~outer:(Flow_ast_utils.mk_comments_opt ~leading ~trailing ()) + in + let merge_comments_with_internal inner = + Flow_ast_utils.merge_comments_with_internal + ~inner + ~outer:(Flow_ast_utils.mk_comments_opt ~leading ~trailing ()) + in + let open Expression in + ( loc, + match expression with + | Array ({ Array.comments; _ } as e) -> + Array { e with Array.comments = merge_comments_with_internal comments } + | ArrowFunction ({ Function.comments; _ } as e) -> + ArrowFunction { e with Function.comments = merge_comments comments } + | Assignment ({ Assignment.comments; _ } as e) -> + Assignment { e with Assignment.comments = merge_comments comments } + | Binary ({ Binary.comments; _ } as e) -> + Binary { e with Binary.comments = merge_comments comments } + | Call ({ Call.comments; _ } as e) -> Call { e with Call.comments = merge_comments comments } + | Class ({ Class.comments; _ } as e) -> + Class { e with Class.comments = merge_comments comments } + | Conditional ({ Conditional.comments; _ } as e) -> + Conditional { e with Conditional.comments = merge_comments comments } + | Function ({ Function.comments; _ } as e) -> + Function { e with Function.comments = merge_comments comments } + | Identifier (loc, ({ Identifier.comments; _ } as e)) -> + Identifier (loc, { e with Identifier.comments = merge_comments comments }) + | Import ({ Import.comments; _ } as e) -> + Import { e with Import.comments = merge_comments comments } + | JSXElement ({ JSX.comments; _ } as e) -> + JSXElement { e with JSX.comments = merge_comments comments } + | JSXFragment ({ JSX.frag_comments; _ } as e) -> + JSXFragment { e with JSX.frag_comments = merge_comments frag_comments } + | Literal ({ Literal.comments; _ } as e) -> + Literal { e with Literal.comments = merge_comments comments } + | Logical ({ Logical.comments; _ } as e) -> + Logical { e with Logical.comments = merge_comments comments } + | Member ({ Member.comments; _ } as e) -> + Member { e with Member.comments = merge_comments comments } + | MetaProperty ({ MetaProperty.comments; _ } as e) -> + MetaProperty { e with MetaProperty.comments = merge_comments comments } + | New ({ New.comments; _ } as e) -> New { e with New.comments = merge_comments comments } + | Object ({ Object.comments; _ } as e) -> + Object { e with Object.comments = merge_comments_with_internal comments } + | OptionalCall ({ OptionalCall.call = { Call.comments; _ } as call; _ } as optional_call) -> + OptionalCall + { + optional_call with + OptionalCall.call = { call with Call.comments = merge_comments comments }; + } + | OptionalMember + ({ OptionalMember.member = { Member.comments; _ } as member; _ } as optional_member) -> + OptionalMember + { + optional_member with + OptionalMember.member = { member with Member.comments = merge_comments comments }; + } + | Sequence ({ Sequence.comments; _ } as e) -> + Sequence { e with Sequence.comments = merge_comments comments } + | Super { Super.comments; _ } -> Super { Super.comments = merge_comments comments } + | TaggedTemplate ({ TaggedTemplate.comments; _ } as e) -> + TaggedTemplate { e with TaggedTemplate.comments = merge_comments comments } + | TemplateLiteral ({ TemplateLiteral.comments; _ } as e) -> + TemplateLiteral { e with TemplateLiteral.comments = merge_comments comments } + | This { This.comments; _ } -> This { This.comments = merge_comments comments } + | TypeCast ({ TypeCast.comments; _ } as e) -> + TypeCast { e with TypeCast.comments = merge_comments comments } + | Unary ({ Unary.comments; _ } as e) -> + Unary { e with Unary.comments = merge_comments comments } + | Update ({ Update.comments; _ } as e) -> + Update { e with Update.comments = merge_comments comments } + | Yield ({ Yield.comments; _ } as e) -> + Yield { e with Yield.comments = merge_comments comments } + (* TODO: Delete once all expressions support comment attachment *) + | _ -> expression ) and array_initializer = let rec elements env (acc, errs) = match Peek.token env with | T_EOF - | T_RBRACKET -> List.rev acc, Pattern_cover.rev_errors errs + | T_RBRACKET -> + (List.rev acc, Pattern_cover.rev_errors errs) | T_COMMA -> - Expect.token env T_COMMA; - elements env (None::acc, errs) + let loc = Peek.loc env in + Eat.token env; + elements env (Expression.Array.Hole loc :: acc, errs) | T_ELLIPSIS -> - let loc, (argument, new_errs) = with_loc (fun env -> - Expect.token env T_ELLIPSIS; - match assignment_cover env with - | Cover_expr argument -> argument, Pattern_cover.empty_errors - | Cover_patt (argument, new_errs) -> argument, new_errs - ) env in - let elem = Expression.(Spread (loc, SpreadElement.({ - argument; - }))) in - let is_last = Peek.token env = T_RBRACKET in - - (* if this array is interpreted as a pattern, the spread becomes an AssignmentRestElement - which must be the last element. We can easily error about additional elements since - they will be in the element list, but a trailing elision, like `[...x,]`, is not part - of the AST. so, keep track of the error so we can raise it if this is a pattern. *) - let new_errs = - if not is_last && Peek.ith_token ~i:1 env = T_RBRACKET then - let if_patt = (loc, Parse_error.ElementAfterRestElement)::new_errs.if_patt in - { new_errs with if_patt } - else new_errs - in - - if not is_last then Expect.token env T_COMMA; - let acc = Some elem :: acc in - let errs = Pattern_cover.rev_append_errors new_errs errs in - elements env (acc, errs) + let leading = Peek.comments env in + let (loc, (argument, new_errs)) = + with_loc + (fun env -> + Eat.token env; + match assignment_cover env with + | Cover_expr argument -> (argument, Pattern_cover.empty_errors) + | Cover_patt (argument, new_errs) -> (argument, new_errs)) + env + in + let elem = + Expression.( + Array.Spread + ( loc, + SpreadElement.{ argument; comments = Flow_ast_utils.mk_comments_opt ~leading () } )) + in + let is_last = Peek.token env = T_RBRACKET in + (* if this array is interpreted as a pattern, the spread becomes an AssignmentRestElement + which must be the last element. We can easily error about additional elements since + they will be in the element list, but a trailing elision, like `[...x,]`, is not part + of the AST. so, keep track of the error so we can raise it if this is a pattern. *) + let new_errs = + if (not is_last) && Peek.ith_token ~i:1 env = T_RBRACKET then + let if_patt = (loc, Parse_error.ElementAfterRestElement) :: new_errs.if_patt in + { new_errs with if_patt } + else + new_errs + in + if not is_last then Expect.token env T_COMMA; + let acc = elem :: acc in + let errs = Pattern_cover.rev_append_errors new_errs errs in + elements env (acc, errs) | _ -> - let elem, new_errs = match assignment_cover env with - | Cover_expr elem -> elem, Pattern_cover.empty_errors - | Cover_patt (elem, new_errs) -> elem, new_errs - in - if Peek.token env <> T_RBRACKET then Expect.token env T_COMMA; - let acc = Some (Expression.Expression elem) :: acc in - let errs = Pattern_cover.rev_append_errors new_errs errs in - elements env (acc, errs) - - in fun env -> - let loc, (elements, errs) = with_loc (fun env -> - Expect.token env T_LBRACKET; - let res = elements env ([], Pattern_cover.empty_errors) in - Expect.token env T_RBRACKET; - res - ) env in - loc, { Expression.Array.elements; }, errs + let (elem, new_errs) = + match assignment_cover env with + | Cover_expr elem -> (elem, Pattern_cover.empty_errors) + | Cover_patt (elem, new_errs) -> (elem, new_errs) + in + if Peek.token env <> T_RBRACKET then Expect.token env T_COMMA; + let acc = Expression.Array.Expression elem :: acc in + let errs = Pattern_cover.rev_append_errors new_errs errs in + elements env (acc, errs) + in + fun env -> + let leading = Peek.comments env in + Expect.token env T_LBRACKET; + let (elems, errs) = elements env ([], Pattern_cover.empty_errors) in + let internal = Peek.comments env in + Expect.token env T_RBRACKET; + let trailing = Eat.trailing_comments env in + ( { + Ast.Expression.Array.elements = elems; + comments = Flow_ast_utils.mk_comments_with_internal_opt ~leading ~trailing ~internal; + }, + errs ) and regexp env = Eat.push_lex_mode env Lex_mode.REGEXP; let loc = Peek.loc env in - let raw, pattern, raw_flags = match Peek.token env with + let leading = Peek.comments env in + let tkn = Peek.token env in + let (raw, pattern, raw_flags, trailing) = + match tkn with | T_REGEXP (_, pattern, flags) -> - Eat.token env; - let raw = "/" ^ pattern ^ "/" ^ flags in - raw, pattern, flags - | _ -> assert false in + Eat.token env; + let trailing = Eat.trailing_comments env in + let raw = "/" ^ pattern ^ "/" ^ flags in + (raw, pattern, flags, trailing) + | _ -> assert false + in Eat.pop_lex_mode env; let filtered_flags = Buffer.create (String.length raw_flags) in - String.iter (function - | 'g' | 'i' | 'm' | 's' | 'u' | 'y' as c -> Buffer.add_char filtered_flags c - | _ -> ()) raw_flags; + String.iter + (function + | ('g' | 'i' | 'm' | 's' | 'u' | 'y') as c -> Buffer.add_char filtered_flags c + | _ -> ()) + raw_flags; let flags = Buffer.contents filtered_flags in - if flags <> raw_flags - then error env (Error.InvalidRegExpFlags raw_flags); - let value = Literal.(RegExp { RegExp.pattern; flags; }) in - loc, Expression.(Literal { Literal.value; raw; }) + if flags <> raw_flags then error env (Parse_error.InvalidRegExpFlags raw_flags); + let value = Literal.(RegExp { RegExp.pattern; flags }) in + ( loc, + let open Expression in + Literal + { Literal.value; raw; comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () } ) and try_arrow_function = (* Certain errors (almost all errors) cause a rollback *) - let error_callback _ = Error.(function - (* Don't rollback on these errors. *) - | StrictParamName - | StrictReservedWord - | ParameterAfterRestParameter - | NewlineBeforeArrow - | YieldInFormalParameters -> () - (* Everything else causes a rollback *) - | _ -> raise Try.Rollback) in - + let error_callback _ = + Parse_error.( + function + (* Don't rollback on these errors. *) + | StrictParamName + | StrictReservedWord + | ParameterAfterRestParameter + | NewlineBeforeArrow + | YieldInFormalParameters + | ThisParamBannedInArrowFunctions -> + () + (* Everything else causes a rollback *) + | _ -> raise Try.Rollback) + in + let concise_function_body env ~async = + (* arrow functions can't be generators *) + let env = enter_function env ~async ~generator:false in + match Peek.token env with + | T_LCURLY -> + let (loc, body, strict) = Parse.function_block_body env ~expression:true in + (Function.BodyBlock (loc, body), strict) + | _ -> + let expr = Parse.assignment env in + (Function.BodyExpression expr, in_strict_mode env) + in fun env -> let env = env |> with_error_callback error_callback in - let start_loc = Peek.loc env in (* a T_ASYNC could either be a parameter name or it could be indicating * that it's an async function *) - let async = Peek.ith_token ~i:1 env <> T_ARROW && Declaration.async env in - let tparams = Type.type_parameter_declaration env in - let params, return, predicate = - (* Disallow all fancy features for identifier => body *) - if Peek.is_identifier env && tparams = None - then - let loc, name = - Parse.identifier ~restricted_error:Error.StrictParamName env in - let param = loc, Pattern.Identifier { - Pattern.Identifier.name = loc, name; - annot=None; - optional=false; - } in - (loc, { Ast.Function.Params.params = [param]; rest = None }), None, None + let (async, leading) = + if Peek.ith_token ~i:1 env <> T_ARROW then + Declaration.async env else - let params = - let yield = allow_yield env in - let await = allow_await env in - Declaration.function_params ~await ~yield env - in - (* There's an ambiguity if you use a function type as the return - * type for an arrow function. So we disallow anonymous function - * types in arrow function return types unless the function type is - * enclosed in parens *) - let return, predicate = env - |> with_no_anon_function_type true - |> Type.annotation_and_predicate_opt in - params, return, predicate in - + (false, []) + in + let (sig_loc, (tparams, params, return, predicate)) = + with_loc + (fun env -> + let tparams = type_params_remove_trailing env (Type.type_params env) in + (* Disallow all fancy features for identifier => body *) + if Peek.is_identifier env && tparams = None then + let ((loc, _) as name) = + Parse.identifier ~restricted_error:Parse_error.StrictParamName env + in + let param = + ( loc, + { + Ast.Function.Param.argument = + ( loc, + Pattern.Identifier + { + Pattern.Identifier.name; + annot = Ast.Type.Missing (Peek.loc_skip_lookahead env); + optional = false; + } ); + default = None; + } ) + in + ( tparams, + ( loc, + { + Ast.Function.Params.params = [param]; + rest = None; + comments = None; + this_ = None; + } ), + Ast.Type.Missing Loc.{ loc with start = loc._end }, + None ) + else + let params = + let yield = allow_yield env in + let await = allow_await env in + Declaration.function_params ~await ~yield env + in + (* There's an ambiguity if you use a function type as the return + * type for an arrow function. So we disallow anonymous function + * types in arrow function return types unless the function type is + * enclosed in parens *) + let (return, predicate) = + env |> with_no_anon_function_type true |> Type.annotation_and_predicate_opt + in + (tparams, params, return, predicate)) + env + in (* It's hard to tell if an invalid expression was intended to be an * arrow function before we see the =>. If there are no params, that * implies "()" which is only ever found in arrow params. Similarly, * rest params indicate arrow functions. Therefore, if we see a rest * param or an empty param list then we can disable the rollback and * instead generate errors as if we were parsing an arrow function *) - let env = match params with - | _, { Ast.Function.Params.rest = Some _; _ } - | _, { Ast.Function.Params.params = []; _ } -> without_error_callback env + let env = + match params with + | (_, { Ast.Function.Params.params = _; rest = Some _; this_ = None; comments = _ }) + | (_, { Ast.Function.Params.params = []; rest = _; this_ = None; comments = _ }) -> + without_error_callback env | _ -> env in - if Peek.is_line_terminator env && Peek.token env = T_ARROW - then error env Error.NewlineBeforeArrow; + (* Disallow this param annotations in arrow functions *) + let params = + match params with + | (loc, ({ Ast.Function.Params.this_ = Some (this_loc, _); _ } as params)) -> + error_at env (this_loc, Parse_error.ThisParamBannedInArrowFunctions); + (loc, { params with Ast.Function.Params.this_ = None }) + | _ -> params + in + + if Peek.is_line_terminator env && Peek.token env = T_ARROW then + error env Parse_error.NewlineBeforeArrow; Expect.token env T_ARROW; (* Now we know for sure this is an arrow function *) let env = without_error_callback env in - - let end_loc, (body, strict) = with_loc - (Declaration.concise_function_body ~async ~generator:false) - env - in + let (end_loc, (body, strict)) = with_loc (concise_function_body ~async) env in let simple = Declaration.is_simple_function_params params in Declaration.strict_post_check env ~strict ~simple None params; - let expression = Function.( - match body with - | BodyBlock _ -> false - | BodyExpression _ -> true) in let loc = Loc.btwn start_loc end_loc in - Cover_expr (loc, Expression.(ArrowFunction { Function. - id = None; - params; - body; - async; - generator = false; (* arrow functions cannot be generators *) - predicate; - expression; - return; - tparams; - })) - - and sequence env acc = - match Peek.token env with - | T_COMMA -> - Expect.token env T_COMMA; + Cover_expr + ( loc, + let open Expression in + ArrowFunction + { + Function.id = None; + params; + body; + async; + generator = false; + (* arrow functions cannot be generators *) + predicate; + return; + tparams; + sig_loc; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + } ) + + and sequence = + let rec helper acc env = + match Peek.token env with + | T_COMMA -> + Eat.token env; let expr = assignment env in - sequence env (expr::acc) - | _ -> - let (last_loc, _) = List.hd acc in - let expressions = List.rev acc in - let (first_loc, _) = List.hd expressions in - Loc.btwn first_loc last_loc, Expression.(Sequence Sequence.({ - expressions; - })) + helper (expr :: acc) env + | _ -> + let expressions = List.rev acc in + Expression.(Sequence Sequence.{ expressions; comments = None }) + in + (fun env ~start_loc acc -> with_loc ~start_loc (helper acc) env) and property_name_include_private env = let start_loc = Peek.loc env in - let is_private = Expect.maybe env T_POUND in - let id_loc, ident = identifier_name env in - let loc = Loc.btwn start_loc id_loc in - loc, (id_loc, ident), is_private + let (loc, (is_private, id, leading)) = + with_loc + (fun env -> + let (is_private, leading) = + match Peek.token env with + | T_POUND -> + let leading = Peek.comments env in + Eat.token env; + (true, leading) + | _ -> (false, []) + in + let id = identifier_name env in + (is_private, id, leading)) + env + in + if is_private && start_loc.Loc._end <> (fst id).Loc.start then + error_at env (loc, Parse_error.WhitespaceInPrivateName); + (loc, id, is_private, leading) end diff --git a/lib/file_key.ml b/lib/file_key.ml index 1c0afec..85220e8 100644 --- a/lib/file_key.ml +++ b/lib/file_key.ml @@ -1,5 +1,5 @@ -(** - * Copyright (c) 2013-present, Facebook, Inc. +(* + * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -13,13 +13,22 @@ type t = these, just check that they exist *) | ResourceFile of string | Builtins +[@@deriving show, eq] let to_string = function - | LibFile x | SourceFile x | JsonFile x | ResourceFile x -> x + | LibFile x + | SourceFile x + | JsonFile x + | ResourceFile x -> + x | Builtins -> "(global)" let to_path = function - | LibFile x | SourceFile x | JsonFile x | ResourceFile x -> Ok x + | LibFile x + | SourceFile x + | JsonFile x + | ResourceFile x -> + Ok x | Builtins -> Error "File key refers to a builtin" let compare = @@ -27,23 +36,25 @@ let compare = JSON files are basically source files. We don't actually read resource files so they come last *) let order_of_filename = function - | Builtins -> 1 - | LibFile _ -> 2 - | SourceFile _ -> 3 - | JsonFile _ -> 3 - | ResourceFile _ -> 4 + | Builtins -> 1 + | LibFile _ -> 2 + | SourceFile _ -> 3 + | JsonFile _ -> 3 + | ResourceFile _ -> 4 in fun a b -> - let k = (order_of_filename a) - (order_of_filename b) in - if k <> 0 then k - else String.compare (to_string a) (to_string b) + let k = order_of_filename a - order_of_filename b in + if k <> 0 then + k + else + String.compare (to_string a) (to_string b) let compare_opt a b = - match a, b with - | Some _, None -> -1 - | None, Some _ -> 1 - | None, None -> 0 - | Some a, Some b -> compare a b + match (a, b) with + | (Some _, None) -> -1 + | (None, Some _) -> 1 + | (None, None) -> 0 + | (Some a, Some b) -> compare a b let is_lib_file = function | LibFile _ -> true @@ -63,14 +74,12 @@ let exists f = function | LibFile filename | SourceFile filename | JsonFile filename - | ResourceFile filename -> f filename + | ResourceFile filename -> + f filename | Builtins -> false -let check_suffix filename suffix = - exists (fun fn -> Filename.check_suffix fn suffix) filename +let check_suffix filename suffix = exists (fun fn -> Filename.check_suffix fn suffix) filename -let chop_suffix filename suffix = - map (fun fn -> Filename.chop_suffix fn suffix) filename +let chop_suffix filename suffix = map (fun fn -> Filename.chop_suffix fn suffix) filename -let with_suffix filename suffix = - map (fun fn -> fn ^ suffix) filename +let with_suffix filename suffix = map (fun fn -> fn ^ suffix) filename diff --git a/lib/flow_ast.ml b/lib/flow_ast.ml new file mode 100644 index 0000000..6492b7c --- /dev/null +++ b/lib/flow_ast.ml @@ -0,0 +1,1866 @@ +(* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + *) + +[%%gen +(* + * An Ocaml implementation of the SpiderMonkey Parser API + * https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API + *) + +module rec Syntax : sig + type ('M, 'internal) t = { + leading: 'M Comment.t list; + trailing: 'M Comment.t list; + internal: 'internal; + } + [@@deriving show] +end = + Syntax + +and Identifier : sig + type ('M, 'T) t = 'T * 'M t' + + and 'M t' = { + name: string; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] +end = + Identifier + +and PrivateName : sig + type 'M t = 'M * 'M t' + + and 'M t' = { + id: ('M, 'M) Identifier.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] +end = + PrivateName + +and Literal : sig + module RegExp : sig + type t = { + pattern: string; + flags: string; + } + [@@deriving show] + end + + (* Literals also carry along their raw value *) + type 'M t = { + value: value; + raw: string; + comments: ('M, unit) Syntax.t option; + } + + and value = + | String of string + | Boolean of bool + | Null + | Number of float + | BigInt of float + | RegExp of RegExp.t + [@@deriving show] +end = + Literal + +and StringLiteral : sig + type 'M t = { + value: string; + raw: string; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] +end = + StringLiteral + +and NumberLiteral : sig + type 'M t = { + value: float; + raw: string; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] +end = + NumberLiteral + +and BigIntLiteral : sig + type 'M t = { + approx_value: float; + (* Warning! Might lose precision! *) + bigint: string; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] +end = + BigIntLiteral + +and BooleanLiteral : sig + type 'M t = { + value: bool; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] +end = + BooleanLiteral + +and Variance : sig + type 'M t = 'M * 'M t' + + and kind = + | Plus + | Minus + + and 'M t' = { + kind: kind; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] +end = + Variance + +and ComputedKey : sig + type ('M, 'T) t = 'M * ('M, 'T) ComputedKey.t' + + and ('M, 'T) t' = { + expression: ('M, 'T) Expression.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] +end = + ComputedKey + +and Type : sig + module Function : sig + module Param : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + name: ('M, 'T) Identifier.t option; + annot: ('M, 'T) Type.t; + optional: bool; + } + [@@deriving show] + end + + module RestParam : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + argument: ('M, 'T) Param.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module ThisParam : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + annot: ('M, 'T) Type.annotation; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Params : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + this_: ('M, 'T) ThisParam.t option; + params: ('M, 'T) Param.t list; + rest: ('M, 'T) RestParam.t option; + comments: ('M, 'M Comment.t list) Syntax.t option; + } + [@@deriving show] + end + + type ('M, 'T) t = { + tparams: ('M, 'T) Type.TypeParams.t option; + params: ('M, 'T) Params.t; + return: ('M, 'T) Type.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Generic : sig + module Identifier : sig + type ('M, 'T) t = + | Unqualified of ('M, 'T) Identifier.t + | Qualified of ('M, 'T) qualified + + and ('M, 'T) qualified = 'M * ('M, 'T) qualified' + + and ('M, 'T) qualified' = { + qualification: ('M, 'T) t; + id: ('M, 'T) Identifier.t; + } + [@@deriving show] + end + + type ('M, 'T) t = { + id: ('M, 'T) Identifier.t; + targs: ('M, 'T) Type.TypeArgs.t option; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Object : sig + module Property : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + key: ('M, 'T) Expression.Object.Property.key; + value: ('M, 'T) value; + optional: bool; + static: bool; + proto: bool; + _method: bool; + variance: 'M Variance.t option; + comments: ('M, unit) Syntax.t option; + } + + and ('M, 'T) value = + | Init of ('M, 'T) Type.t + | Get of ('M * ('M, 'T) Function.t) + | Set of ('M * ('M, 'T) Function.t) + [@@deriving show] + end + + module SpreadProperty : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + argument: ('M, 'T) Type.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Indexer : sig + type ('M, 'T) t' = { + id: ('M, 'M) Identifier.t option; + key: ('M, 'T) Type.t; + value: ('M, 'T) Type.t; + static: bool; + variance: 'M Variance.t option; + comments: ('M, unit) Syntax.t option; + } + + and ('M, 'T) t = 'M * ('M, 'T) t' [@@deriving show] + end + + module CallProperty : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + value: 'M * ('M, 'T) Function.t; + static: bool; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module InternalSlot : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + id: ('M, 'M) Identifier.t; + value: ('M, 'T) Type.t; + optional: bool; + static: bool; + _method: bool; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + type ('M, 'T) t = { + exact: bool; + (* Inexact indicates the presence of ... in the object. It is more + * easily understood if exact is read as "explicitly exact" and "inexact" + * is read as "explicitly inexact". + * + * This confusion will go away when we get rid of the exact flag in favor + * of inexact as part of the work to make object types exact by default. + * *) + inexact: bool; + properties: ('M, 'T) property list; + comments: ('M, 'M Comment.t list) Syntax.t option; + } + + and ('M, 'T) property = + | Property of ('M, 'T) Property.t + | SpreadProperty of ('M, 'T) SpreadProperty.t + | Indexer of ('M, 'T) Indexer.t + | CallProperty of ('M, 'T) CallProperty.t + | InternalSlot of ('M, 'T) InternalSlot.t + [@@deriving show] + end + + module Interface : sig + type ('M, 'T) t = { + body: 'M * ('M, 'T) Object.t; + extends: ('M * ('M, 'T) Generic.t) list; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Nullable : sig + type ('M, 'T) t = { + argument: ('M, 'T) Type.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Typeof : sig + type ('M, 'T) t = { + argument: ('M, 'T) Type.t; + (* TODO T64309494 *) + internal: bool; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Tuple : sig + type ('M, 'T) t = { + types: ('M, 'T) Type.t list; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Array : sig + type ('M, 'T) t = { + argument: ('M, 'T) Type.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Union : sig + type ('M, 'T) t = { + types: ('M, 'T) Type.t * ('M, 'T) Type.t * ('M, 'T) Type.t list; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Intersection : sig + type ('M, 'T) t = { + types: ('M, 'T) Type.t * ('M, 'T) Type.t * ('M, 'T) Type.t list; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + type ('M, 'T) t = 'T * ('M, 'T) t' + + (* Yes, we could add a little complexity here to show that Any and Void + * should never be declared nullable, but that check can happen later *) + and ('M, 'T) t' = + | Any of ('M, unit) Syntax.t option + | Mixed of ('M, unit) Syntax.t option + | Empty of ('M, unit) Syntax.t option + | Void of ('M, unit) Syntax.t option + | Null of ('M, unit) Syntax.t option + | Number of ('M, unit) Syntax.t option + | BigInt of ('M, unit) Syntax.t option + | String of ('M, unit) Syntax.t option + | Boolean of ('M, unit) Syntax.t option + | Symbol of ('M, unit) Syntax.t option + | Exists of ('M, unit) Syntax.t option + | Nullable of ('M, 'T) Nullable.t + | Function of ('M, 'T) Function.t + | Object of ('M, 'T) Object.t + | Interface of ('M, 'T) Interface.t + | Array of ('M, 'T) Array.t + | Generic of ('M, 'T) Generic.t + | Union of ('M, 'T) Union.t + | Intersection of ('M, 'T) Intersection.t + | Typeof of ('M, 'T) Typeof.t + | Tuple of ('M, 'T) Tuple.t + | StringLiteral of 'M StringLiteral.t + | NumberLiteral of 'M NumberLiteral.t + | BigIntLiteral of 'M BigIntLiteral.t + | BooleanLiteral of 'M BooleanLiteral.t + + (* Type.annotation is a concrete syntax node with a location that starts at + * the colon and ends after the type. For example, "var a: number", the + * identifier a would have a property annot which contains a + * Type.annotation with a location from column 6-14 *) + and ('M, 'T) annotation = 'M * ('M, 'T) t + + and ('M, 'T) annotation_or_hint = + | Missing of 'T + | Available of ('M, 'T) Type.annotation + [@@deriving show] + + module TypeParam : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + name: ('M, 'M) Identifier.t; + bound: ('M, 'T) Type.annotation_or_hint; + variance: 'M Variance.t option; + default: ('M, 'T) Type.t option; + } + [@@deriving show] + end + + module TypeParams : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + params: ('M, 'T) TypeParam.t list; + comments: ('M, 'M Comment.t list) Syntax.t option; + } + [@@deriving show] + end + + module TypeArgs : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + arguments: ('M, 'T) Type.t list; + comments: ('M, 'M Comment.t list) Syntax.t option; + } + [@@deriving show] + end + + module Predicate : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + kind: ('M, 'T) kind; + comments: ('M, unit) Syntax.t option; + } + + and ('M, 'T) kind = + | Declared of ('M, 'T) Expression.t + | Inferred + [@@deriving show] + end +end = + Type + +and Statement : sig + module Block : sig + type ('M, 'T) t = { + body: ('M, 'T) Statement.t list; + comments: ('M, 'M Comment.t list) Syntax.t option; + } + [@@deriving show] + end + + module If : sig + module Alternate : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + body: ('M, 'T) Statement.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + type ('M, 'T) t = { + test: ('M, 'T) Expression.t; + consequent: ('M, 'T) Statement.t; + alternate: ('M, 'T) Alternate.t option; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Labeled : sig + type ('M, 'T) t = { + label: ('M, 'M) Identifier.t; + body: ('M, 'T) Statement.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Break : sig + type 'M t = { + label: ('M, 'M) Identifier.t option; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Continue : sig + type 'M t = { + label: ('M, 'M) Identifier.t option; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Debugger : sig + type 'M t = { comments: ('M, unit) Syntax.t option } [@@deriving show] + end + + module With : sig + type ('M, 'T) t = { + _object: ('M, 'T) Expression.t; + body: ('M, 'T) Statement.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module TypeAlias : sig + type ('M, 'T) t = { + id: ('M, 'T) Identifier.t; + tparams: ('M, 'T) Type.TypeParams.t option; + right: ('M, 'T) Type.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module OpaqueType : sig + type ('M, 'T) t = { + id: ('M, 'T) Identifier.t; + tparams: ('M, 'T) Type.TypeParams.t option; + impltype: ('M, 'T) Type.t option; + supertype: ('M, 'T) Type.t option; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Switch : sig + module Case : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + test: ('M, 'T) Expression.t option; + consequent: ('M, 'T) Statement.t list; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + type ('M, 'T) t = { + discriminant: ('M, 'T) Expression.t; + cases: ('M, 'T) Case.t list; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Return : sig + type ('M, 'T) t = { + argument: ('M, 'T) Expression.t option; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Throw : sig + type ('M, 'T) t = { + argument: ('M, 'T) Expression.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Try : sig + module CatchClause : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + param: ('M, 'T) Pattern.t option; + body: 'M * ('M, 'T) Block.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + type ('M, 'T) t = { + block: 'M * ('M, 'T) Block.t; + handler: ('M, 'T) CatchClause.t option; + finalizer: ('M * ('M, 'T) Block.t) option; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module VariableDeclaration : sig + module Declarator : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + id: ('M, 'T) Pattern.t; + init: ('M, 'T) Expression.t option; + } + [@@deriving show] + end + + type ('M, 'T) t = { + declarations: ('M, 'T) Declarator.t list; + kind: kind; + comments: ('M, unit) Syntax.t option; + } + + and kind = + | Var + | Let + | Const + [@@deriving show] + end + + module While : sig + type ('M, 'T) t = { + test: ('M, 'T) Expression.t; + body: ('M, 'T) Statement.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module DoWhile : sig + type ('M, 'T) t = { + body: ('M, 'T) Statement.t; + test: ('M, 'T) Expression.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module For : sig + type ('M, 'T) t = { + init: ('M, 'T) init option; + test: ('M, 'T) Expression.t option; + update: ('M, 'T) Expression.t option; + body: ('M, 'T) Statement.t; + comments: ('M, unit) Syntax.t option; + } + + and ('M, 'T) init = + | InitDeclaration of ('M * ('M, 'T) VariableDeclaration.t) + | InitExpression of ('M, 'T) Expression.t + [@@deriving show] + end + + module ForIn : sig + type ('M, 'T) t = { + left: ('M, 'T) left; + right: ('M, 'T) Expression.t; + body: ('M, 'T) Statement.t; + each: bool; + comments: ('M, unit) Syntax.t option; + } + + and ('M, 'T) left = + | LeftDeclaration of ('M * ('M, 'T) VariableDeclaration.t) + | LeftPattern of ('M, 'T) Pattern.t + [@@deriving show] + end + + module ForOf : sig + type ('M, 'T) t = { + left: ('M, 'T) left; + right: ('M, 'T) Expression.t; + body: ('M, 'T) Statement.t; + await: bool; + comments: ('M, unit) Syntax.t option; + } + + and ('M, 'T) left = + | LeftDeclaration of ('M * ('M, 'T) VariableDeclaration.t) + | LeftPattern of ('M, 'T) Pattern.t + [@@deriving show] + end + + module EnumDeclaration : sig + module DefaultedMember : sig + type 'M t = 'M * 'M t' + + and 'M t' = { id: ('M, 'M) Identifier.t } [@@deriving show] + end + + module InitializedMember : sig + type ('I, 'M) t = 'M * ('I, 'M) t' + + and ('I, 'M) t' = { + id: ('M, 'M) Identifier.t; + init: 'M * 'I; + } + [@@deriving show] + end + + module BooleanBody : sig + type 'M t = { + members: ('M BooleanLiteral.t, 'M) InitializedMember.t list; + explicit_type: bool; + has_unknown_members: bool; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module NumberBody : sig + type 'M t = { + members: ('M NumberLiteral.t, 'M) InitializedMember.t list; + explicit_type: bool; + has_unknown_members: bool; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module StringBody : sig + type 'M t = { + members: ('M StringLiteral.t, 'M) members; + explicit_type: bool; + has_unknown_members: bool; + comments: ('M, unit) Syntax.t option; + } + + and ('I, 'M) members = + | Defaulted of 'M DefaultedMember.t list + | Initialized of ('I, 'M) InitializedMember.t list + [@@deriving show] + end + + module SymbolBody : sig + type 'M t = { + members: 'M DefaultedMember.t list; + has_unknown_members: bool; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + type ('M, 'T) t = { + id: ('M, 'T) Identifier.t; + body: 'M body; + comments: ('M, unit) Syntax.t option; + } + + and 'M body = 'M * 'M body' + + and 'M body' = + | BooleanBody of 'M BooleanBody.t + | NumberBody of 'M NumberBody.t + | StringBody of 'M StringBody.t + | SymbolBody of 'M SymbolBody.t + [@@deriving show] + end + + module Interface : sig + type ('M, 'T) t = { + id: ('M, 'T) Identifier.t; + tparams: ('M, 'T) Type.TypeParams.t option; + extends: ('M * ('M, 'T) Type.Generic.t) list; + body: 'M * ('M, 'T) Type.Object.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module DeclareClass : sig + type ('M, 'T) t = { + id: ('M, 'T) Identifier.t; + tparams: ('M, 'T) Type.TypeParams.t option; + body: 'M * ('M, 'T) Type.Object.t; + extends: ('M * ('M, 'T) Type.Generic.t) option; + mixins: ('M * ('M, 'T) Type.Generic.t) list; + implements: ('M, 'T) Class.Implements.t option; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module DeclareVariable : sig + type ('M, 'T) t = { + id: ('M, 'T) Identifier.t; + annot: ('M, 'T) Type.annotation_or_hint; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module DeclareFunction : sig + type ('M, 'T) t = { + id: ('M, 'T) Identifier.t; + annot: ('M, 'T) Type.annotation; + predicate: ('M, 'T) Type.Predicate.t option; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module DeclareModule : sig + type ('M, 'T) id = + | Identifier of ('M, 'T) Identifier.t + | Literal of ('T * 'M StringLiteral.t) + + and 'M module_kind = + | CommonJS of 'M + | ES of 'M + + and ('M, 'T) t = { + id: ('M, 'T) id; + body: 'M * ('M, 'T) Block.t; + kind: 'M module_kind; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module DeclareModuleExports : sig + type ('M, 'T) t = { + annot: ('M, 'T) Type.annotation; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module ExportNamedDeclaration : sig + module ExportSpecifier : sig + type 'M t = 'M * 'M t' + + and 'M t' = { + local: ('M, 'M) Identifier.t; + exported: ('M, 'M) Identifier.t option; + } + [@@deriving show] + end + + type ('M, 'T) t = { + declaration: ('M, 'T) Statement.t option; + specifiers: 'M specifier option; + source: ('M * 'M StringLiteral.t) option; + export_kind: Statement.export_kind; + comments: ('M, unit) Syntax.t option; + } + + and 'M specifier = + | ExportSpecifiers of 'M ExportSpecifier.t list + | ExportBatchSpecifier of 'M * ('M, 'M) Identifier.t option + [@@deriving show] + end + + module ExportDefaultDeclaration : sig + type ('M, 'T) t = { + default: 'M; + declaration: ('M, 'T) declaration; + comments: ('M, unit) Syntax.t option; + } + + and ('M, 'T) declaration = + | Declaration of ('M, 'T) Statement.t + | Expression of ('M, 'T) Expression.t + [@@deriving show] + end + + module DeclareExportDeclaration : sig + type ('M, 'T) declaration = + (* declare export var *) + | Variable of ('M * ('M, 'T) DeclareVariable.t) + (* declare export function *) + | Function of ('M * ('M, 'T) DeclareFunction.t) + (* declare export class *) + | Class of ('M * ('M, 'T) DeclareClass.t) + (* declare export default [type] + * this corresponds to things like + * export default 1+1; *) + | DefaultType of ('M, 'T) Type.t + (* declare export type *) + | NamedType of ('M * ('M, 'T) TypeAlias.t) + (* declare export opaque type *) + | NamedOpaqueType of ('M * ('M, 'T) OpaqueType.t) + (* declare export interface *) + | Interface of ('M * ('M, 'T) Interface.t) + + and ('M, 'T) t = { + default: 'M option; + declaration: ('M, 'T) declaration option; + specifiers: 'M ExportNamedDeclaration.specifier option; + source: ('M * 'M StringLiteral.t) option; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module ImportDeclaration : sig + type import_kind = + | ImportType + | ImportTypeof + | ImportValue + + and ('M, 'T) specifier = + | ImportNamedSpecifiers of ('M, 'T) named_specifier list + | ImportNamespaceSpecifier of ('M * ('M, 'T) Identifier.t) + + and ('M, 'T) named_specifier = { + kind: import_kind option; + local: ('M, 'T) Identifier.t option; + remote: ('M, 'T) Identifier.t; + } + + and ('M, 'T) t = { + import_kind: import_kind; + source: 'M * 'M StringLiteral.t; + default: ('M, 'T) Identifier.t option; + specifiers: ('M, 'T) specifier option; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Expression : sig + type ('M, 'T) t = { + expression: ('M, 'T) Expression.t; + directive: string option; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Empty : sig + type 'M t = { comments: ('M, unit) Syntax.t option } [@@deriving show] + end + + type export_kind = + | ExportType + | ExportValue + + and ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = + | Block of ('M, 'T) Block.t + | Break of 'M Break.t + | ClassDeclaration of ('M, 'T) Class.t + | Continue of 'M Continue.t + | Debugger of 'M Debugger.t + | DeclareClass of ('M, 'T) DeclareClass.t + | DeclareExportDeclaration of ('M, 'T) DeclareExportDeclaration.t + | DeclareFunction of ('M, 'T) DeclareFunction.t + | DeclareInterface of ('M, 'T) Interface.t + | DeclareModule of ('M, 'T) DeclareModule.t + | DeclareModuleExports of ('M, 'T) DeclareModuleExports.t + | DeclareTypeAlias of ('M, 'T) TypeAlias.t + | DeclareOpaqueType of ('M, 'T) OpaqueType.t + | DeclareVariable of ('M, 'T) DeclareVariable.t + | DoWhile of ('M, 'T) DoWhile.t + | Empty of 'M Empty.t + | EnumDeclaration of ('M, 'T) EnumDeclaration.t + | ExportDefaultDeclaration of ('M, 'T) ExportDefaultDeclaration.t + | ExportNamedDeclaration of ('M, 'T) ExportNamedDeclaration.t + | Expression of ('M, 'T) Expression.t + | For of ('M, 'T) For.t + | ForIn of ('M, 'T) ForIn.t + | ForOf of ('M, 'T) ForOf.t + | FunctionDeclaration of ('M, 'T) Function.t + | If of ('M, 'T) If.t + | ImportDeclaration of ('M, 'T) ImportDeclaration.t + | InterfaceDeclaration of ('M, 'T) Interface.t + | Labeled of ('M, 'T) Labeled.t + | Return of ('M, 'T) Return.t + | Switch of ('M, 'T) Switch.t + | Throw of ('M, 'T) Throw.t + | Try of ('M, 'T) Try.t + | TypeAlias of ('M, 'T) TypeAlias.t + | OpaqueType of ('M, 'T) OpaqueType.t + | VariableDeclaration of ('M, 'T) VariableDeclaration.t + | While of ('M, 'T) While.t + | With of ('M, 'T) With.t + [@@deriving show] +end = + Statement + +and Expression : sig + module CallTypeArg : sig + module Implicit : sig + type ('M, 'T) t = 'T * 'M t' + + and 'M t' = { comments: ('M, unit) Syntax.t option } [@@deriving show] + end + + type ('M, 'T) t = + | Explicit of ('M, 'T) Type.t + | Implicit of ('M, 'T) Implicit.t + [@@deriving show] + end + + module CallTypeArgs : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + arguments: ('M, 'T) CallTypeArg.t list; + comments: ('M, 'M Comment.t list) Syntax.t option; + } + [@@deriving show] + end + + module SpreadElement : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + argument: ('M, 'T) Expression.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Array : sig + type ('M, 'T) element = + | Expression of ('M, 'T) Expression.t + | Spread of ('M, 'T) SpreadElement.t + | Hole of 'M + [@@deriving show] + + type ('M, 'T) t = { + elements: ('M, 'T) element list; + comments: ('M, 'M Comment.t list) Syntax.t option; + } + [@@deriving show] + end + + module TemplateLiteral : sig + module Element : sig + type value = { + raw: string; + cooked: string; + } + + and 'M t = 'M * t' + + and t' = { + value: value; + tail: bool; + } + [@@deriving show] + end + + type ('M, 'T) t = { + quasis: 'M Element.t list; + expressions: ('M, 'T) Expression.t list; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module TaggedTemplate : sig + type ('M, 'T) t = { + tag: ('M, 'T) Expression.t; + quasi: 'M * ('M, 'T) TemplateLiteral.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Object : sig + module Property : sig + type ('M, 'T) key = + | Literal of ('T * 'M Literal.t) + | Identifier of ('M, 'T) Identifier.t + | PrivateName of 'M PrivateName.t + | Computed of ('M, 'T) ComputedKey.t + + and ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = + | Init of { + key: ('M, 'T) key; + value: ('M, 'T) Expression.t; + shorthand: bool; + } + | Method of { + key: ('M, 'T) key; + value: 'M * ('M, 'T) Function.t; + } + | Get of { + key: ('M, 'T) key; + value: 'M * ('M, 'T) Function.t; + comments: ('M, unit) Syntax.t option; + } + | Set of { + key: ('M, 'T) key; + value: 'M * ('M, 'T) Function.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module SpreadProperty : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + argument: ('M, 'T) Expression.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + type ('M, 'T) property = + | Property of ('M, 'T) Property.t + | SpreadProperty of ('M, 'T) SpreadProperty.t + + and ('M, 'T) t = { + properties: ('M, 'T) property list; + comments: ('M, 'M Comment.t list) Syntax.t option; + } + [@@deriving show] + end + + module Sequence : sig + type ('M, 'T) t = { + expressions: ('M, 'T) Expression.t list; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Unary : sig + type operator = + | Minus + | Plus + | Not + | BitNot + | Typeof + | Void + | Delete + | Await + + and ('M, 'T) t = { + operator: operator; + argument: ('M, 'T) Expression.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Binary : sig + type operator = + | Equal + | NotEqual + | StrictEqual + | StrictNotEqual + | LessThan + | LessThanEqual + | GreaterThan + | GreaterThanEqual + | LShift + | RShift + | RShift3 + | Plus + | Minus + | Mult + | Exp + | Div + | Mod + | BitOr + | Xor + | BitAnd + | In + | Instanceof + + and ('M, 'T) t = { + operator: operator; + left: ('M, 'T) Expression.t; + right: ('M, 'T) Expression.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Assignment : sig + type operator = + | PlusAssign + | MinusAssign + | MultAssign + | ExpAssign + | DivAssign + | ModAssign + | LShiftAssign + | RShiftAssign + | RShift3Assign + | BitOrAssign + | BitXorAssign + | BitAndAssign + + and ('M, 'T) t = { + operator: operator option; + left: ('M, 'T) Pattern.t; + right: ('M, 'T) Expression.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Update : sig + type operator = + | Increment + | Decrement + + and ('M, 'T) t = { + operator: operator; + argument: ('M, 'T) Expression.t; + prefix: bool; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Logical : sig + type operator = + | Or + | And + | NullishCoalesce + + and ('M, 'T) t = { + operator: operator; + left: ('M, 'T) Expression.t; + right: ('M, 'T) Expression.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Conditional : sig + type ('M, 'T) t = { + test: ('M, 'T) Expression.t; + consequent: ('M, 'T) Expression.t; + alternate: ('M, 'T) Expression.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + type ('M, 'T) expression_or_spread = + | Expression of ('M, 'T) Expression.t + | Spread of ('M, 'T) SpreadElement.t + [@@deriving show] + + module ArgList : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + arguments: ('M, 'T) expression_or_spread list; + comments: ('M, 'M Comment.t list) Syntax.t option; + } + [@@deriving show] + end + + module New : sig + type ('M, 'T) t = { + callee: ('M, 'T) Expression.t; + targs: ('M, 'T) Expression.CallTypeArgs.t option; + arguments: ('M, 'T) ArgList.t option; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Call : sig + type ('M, 'T) t = { + callee: ('M, 'T) Expression.t; + targs: ('M, 'T) Expression.CallTypeArgs.t option; + arguments: ('M, 'T) ArgList.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module OptionalCall : sig + type ('M, 'T) t = { + call: ('M, 'T) Call.t; + optional: bool; + } + [@@deriving show] + end + + module Member : sig + type ('M, 'T) property = + | PropertyIdentifier of ('M, 'T) Identifier.t + | PropertyPrivateName of 'M PrivateName.t + | PropertyExpression of ('M, 'T) Expression.t + + and ('M, 'T) t = { + _object: ('M, 'T) Expression.t; + property: ('M, 'T) property; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module OptionalMember : sig + type ('M, 'T) t = { + member: ('M, 'T) Member.t; + optional: bool; + } + [@@deriving show] + end + + module Yield : sig + type ('M, 'T) t = { + argument: ('M, 'T) Expression.t option; + comments: ('M, unit) Syntax.t option; + delegate: bool; + } + [@@deriving show] + end + + module Comprehension : sig + module Block : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + left: ('M, 'T) Pattern.t; + right: ('M, 'T) Expression.t; + each: bool; + } + [@@deriving show] + end + + type ('M, 'T) t = { + blocks: ('M, 'T) Block.t list; + filter: ('M, 'T) Expression.t option; + } + [@@deriving show] + end + + module Generator : sig + type ('M, 'T) t = { + blocks: ('M, 'T) Comprehension.Block.t list; + filter: ('M, 'T) Expression.t option; + } + [@@deriving show] + end + + module TypeCast : sig + type ('M, 'T) t = { + expression: ('M, 'T) Expression.t; + annot: ('M, 'T) Type.annotation; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module MetaProperty : sig + type 'M t = { + meta: ('M, 'M) Identifier.t; + property: ('M, 'M) Identifier.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module This : sig + type 'M t = { comments: ('M, unit) Syntax.t option } [@@deriving show] + end + + module Super : sig + type 'M t = { comments: ('M, unit) Syntax.t option } [@@deriving show] + end + + module Import : sig + type ('M, 'T) t = { + argument: ('M, 'T) Expression.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + type ('M, 'T) t = 'T * ('M, 'T) t' + + and ('M, 'T) t' = + | Array of ('M, 'T) Array.t + | ArrowFunction of ('M, 'T) Function.t + | Assignment of ('M, 'T) Assignment.t + | Binary of ('M, 'T) Binary.t + | Call of ('M, 'T) Call.t + | Class of ('M, 'T) Class.t + | Comprehension of ('M, 'T) Comprehension.t + | Conditional of ('M, 'T) Conditional.t + | Function of ('M, 'T) Function.t + | Generator of ('M, 'T) Generator.t + | Identifier of ('M, 'T) Identifier.t + | Import of ('M, 'T) Import.t + | JSXElement of ('M, 'T) JSX.element + | JSXFragment of ('M, 'T) JSX.fragment + | Literal of 'M Literal.t + | Logical of ('M, 'T) Logical.t + | Member of ('M, 'T) Member.t + | MetaProperty of 'M MetaProperty.t + | New of ('M, 'T) New.t + | Object of ('M, 'T) Object.t + | OptionalCall of ('M, 'T) OptionalCall.t + | OptionalMember of ('M, 'T) OptionalMember.t + | Sequence of ('M, 'T) Sequence.t + | Super of 'M Super.t + | TaggedTemplate of ('M, 'T) TaggedTemplate.t + | TemplateLiteral of ('M, 'T) TemplateLiteral.t + | This of 'M This.t + | TypeCast of ('M, 'T) TypeCast.t + | Unary of ('M, 'T) Unary.t + | Update of ('M, 'T) Update.t + | Yield of ('M, 'T) Yield.t + [@@deriving show] +end = + Expression + +and JSX : sig + module Identifier : sig + type ('M, 'T) t = 'T * 'M t' + + and 'M t' = { + name: string; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module NamespacedName : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + namespace: ('M, 'T) Identifier.t; + name: ('M, 'T) Identifier.t; + } + [@@deriving show] + end + + module ExpressionContainer : sig + type ('M, 'T) t = { + expression: ('M, 'T) expression; + comments: ('M, 'M Comment.t list) Syntax.t option; + } + + and ('M, 'T) expression = + | Expression of ('M, 'T) Expression.t + | EmptyExpression + [@@deriving show] + end + + module Text : sig + type t = { + value: string; + raw: string; + } + [@@deriving show] + end + + module Attribute : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) name = + | Identifier of ('M, 'T) Identifier.t + | NamespacedName of ('M, 'T) NamespacedName.t + + and ('M, 'T) value = + | Literal of 'T * 'M Literal.t + | ExpressionContainer of 'T * ('M, 'T) ExpressionContainer.t + + and ('M, 'T) t' = { + name: ('M, 'T) name; + value: ('M, 'T) value option; + } + [@@deriving show] + end + + module SpreadAttribute : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + argument: ('M, 'T) Expression.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module MemberExpression : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) _object = + | Identifier of ('M, 'T) Identifier.t + | MemberExpression of ('M, 'T) t + + and ('M, 'T) t' = { + _object: ('M, 'T) _object; + property: ('M, 'T) Identifier.t; + } + [@@deriving show] + end + + type ('M, 'T) name = + | Identifier of ('M, 'T) Identifier.t + | NamespacedName of ('M, 'T) NamespacedName.t + | MemberExpression of ('M, 'T) MemberExpression.t + [@@deriving show] + + module Opening : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) attribute = + | Attribute of ('M, 'T) Attribute.t + | SpreadAttribute of ('M, 'T) SpreadAttribute.t + + and ('M, 'T) t' = { + name: ('M, 'T) name; + self_closing: bool; + attributes: ('M, 'T) attribute list; + } + [@@deriving show] + end + + module Closing : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { name: ('M, 'T) name } [@@deriving show] + end + + module SpreadChild : sig + type ('M, 'T) t = { + expression: ('M, 'T) Expression.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + type ('M, 'T) child = 'M * ('M, 'T) child' + + and ('M, 'T) child' = + | Element of ('M, 'T) element + | Fragment of ('M, 'T) fragment + | ExpressionContainer of ('M, 'T) ExpressionContainer.t + | SpreadChild of ('M, 'T) SpreadChild.t + | Text of Text.t + + and ('M, 'T) element = { + opening_element: ('M, 'T) Opening.t; + closing_element: ('M, 'T) Closing.t option; + children: 'M * ('M, 'T) child list; + comments: ('M, unit) Syntax.t option; + } + + and ('M, 'T) fragment = { + frag_opening_element: 'M; + frag_closing_element: 'M; + frag_children: 'M * ('M, 'T) child list; + frag_comments: ('M, unit) Syntax.t option; + } + [@@deriving show] +end = + JSX + +and Pattern : sig + module RestElement : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + argument: ('M, 'T) Pattern.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Object : sig + module Property : sig + type ('M, 'T) key = + | Literal of ('M * 'M Literal.t) + | Identifier of ('M, 'T) Identifier.t + | Computed of ('M, 'T) ComputedKey.t + + and ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + key: ('M, 'T) key; + pattern: ('M, 'T) Pattern.t; + default: ('M, 'T) Expression.t option; + shorthand: bool; + } + [@@deriving show] + end + + type ('M, 'T) property = + | Property of ('M, 'T) Property.t + | RestElement of ('M, 'T) RestElement.t + + and ('M, 'T) t = { + properties: ('M, 'T) property list; + annot: ('M, 'T) Type.annotation_or_hint; + comments: ('M, 'M Comment.t list) Syntax.t option; + } + [@@deriving show] + end + + module Array : sig + module Element : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + argument: ('M, 'T) Pattern.t; + default: ('M, 'T) Expression.t option; + } + [@@deriving show] + end + + type ('M, 'T) element = + | Element of ('M, 'T) Element.t + | RestElement of ('M, 'T) RestElement.t + | Hole of 'M + + and ('M, 'T) t = { + elements: ('M, 'T) element list; + annot: ('M, 'T) Type.annotation_or_hint; + comments: ('M, 'M Comment.t list) Syntax.t option; + } + [@@deriving show] + end + + module Identifier : sig + type ('M, 'T) t = { + name: ('M, 'T) Identifier.t; + annot: ('M, 'T) Type.annotation_or_hint; + optional: bool; + } + [@@deriving show] + end + + type ('M, 'T) t = 'T * ('M, 'T) t' + + and ('M, 'T) t' = + | Object of ('M, 'T) Object.t + | Array of ('M, 'T) Array.t + | Identifier of ('M, 'T) Identifier.t + | Expression of ('M, 'T) Expression.t + [@@deriving show] +end = + Pattern + +and Comment : sig + type 'M t = 'M * t' + + and kind = + | Block + | Line + + and t' = { + kind: kind; + text: string; + on_newline: bool; + } + [@@deriving show] +end = + Comment + +and Class : sig + module Method : sig + type ('M, 'T) t = 'T * ('M, 'T) t' + + and kind = + | Constructor + | Method + | Get + | Set + + and ('M, 'T) t' = { + kind: kind; + key: ('M, 'T) Expression.Object.Property.key; + value: 'M * ('M, 'T) Function.t; + static: bool; + decorators: ('M, 'T) Class.Decorator.t list; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Property : sig + type ('M, 'T) t = 'T * ('M, 'T) t' + + and ('M, 'T) t' = { + key: ('M, 'T) Expression.Object.Property.key; + value: ('M, 'T) value; + annot: ('M, 'T) Type.annotation_or_hint; + static: bool; + variance: 'M Variance.t option; + comments: ('M, unit) Syntax.t option; + } + + and ('M, 'T) value = + | Declared + | Uninitialized + | Initialized of ('M, 'T) Expression.t + [@@deriving show] + end + + module PrivateField : sig + type ('M, 'T) t = 'T * ('M, 'T) t' + + and ('M, 'T) t' = { + key: 'M PrivateName.t; + value: ('M, 'T) Class.Property.value; + annot: ('M, 'T) Type.annotation_or_hint; + static: bool; + variance: 'M Variance.t option; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Extends : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + expr: ('M, 'T) Expression.t; + targs: ('M, 'T) Type.TypeArgs.t option; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Implements : sig + module Interface : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + id: ('M, 'T) Identifier.t; + targs: ('M, 'T) Type.TypeArgs.t option; + } + [@@deriving show] + end + + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + interfaces: ('M, 'T) Interface.t list; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Body : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + body: ('M, 'T) element list; + comments: ('M, unit) Syntax.t option; + } + + and ('M, 'T) element = + | Method of ('M, 'T) Method.t + | Property of ('M, 'T) Property.t + | PrivateField of ('M, 'T) PrivateField.t + [@@deriving show] + end + + module Decorator : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + expression: ('M, 'T) Expression.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + type ('M, 'T) t = { + id: ('M, 'T) Identifier.t option; + body: ('M, 'T) Class.Body.t; + tparams: ('M, 'T) Type.TypeParams.t option; + extends: ('M, 'T) Extends.t option; + implements: ('M, 'T) Implements.t option; + class_decorators: ('M, 'T) Decorator.t list; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] +end = + Class + +and Function : sig + module RestParam : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + argument: ('M, 'T) Pattern.t; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Param : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + argument: ('M, 'T) Pattern.t; + default: ('M, 'T) Expression.t option; + } + [@@deriving show] + end + + module ThisParam : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + annot: ('M, 'T) Type.annotation; + comments: ('M, unit) Syntax.t option; + } + [@@deriving show] + end + + module Params : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + this_: ('M, 'T) ThisParam.t option; + params: ('M, 'T) Param.t list; + rest: ('M, 'T) RestParam.t option; + comments: ('M, 'M Comment.t list) Syntax.t option; + } + [@@deriving show] + end + + type ('M, 'T) t = { + id: ('M, 'T) Identifier.t option; + params: ('M, 'T) Params.t; + body: ('M, 'T) body; + async: bool; + generator: bool; + predicate: ('M, 'T) Type.Predicate.t option; + return: ('M, 'T) Type.annotation_or_hint; + tparams: ('M, 'T) Type.TypeParams.t option; + comments: ('M, unit) Syntax.t option; + (* Location of the signature portion of a function, e.g. + * function foo(): void {} + * ^^^^^^^^^^^^^^^^^^^^ + *) + sig_loc: 'M; + } + + and ('M, 'T) body = + | BodyBlock of ('M * ('M, 'T) Statement.Block.t) + | BodyExpression of ('M, 'T) Expression.t + [@@deriving show] +end = + Function + +and Program : sig + type ('M, 'T) t = 'M * ('M, 'T) t' + + and ('M, 'T) t' = { + statements: ('M, 'T) Statement.t list; + comments: ('M, unit) Syntax.t option; + all_comments: 'M Comment.t list; + } + [@@deriving show] +end = + Program] diff --git a/lib/flow_ast_mapper.ml b/lib/flow_ast_mapper.ml new file mode 100644 index 0000000..b74e143 --- /dev/null +++ b/lib/flow_ast_mapper.ml @@ -0,0 +1,2431 @@ +(* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + *) + +module Ast = Flow_ast + +let map_opt : 'node. ('node -> 'node) -> 'node option -> 'node option = + fun map opt -> + match opt with + | Some item -> + let item' = map item in + if item == item' then + opt + else + Some item' + | None -> opt + +let id_loc : 'node 'a. ('loc -> 'node -> 'node) -> 'loc -> 'node -> 'a -> ('node -> 'a) -> 'a = + fun map loc item same diff -> + let item' = map loc item in + if item == item' then + same + else + diff item' + +let id : 'node 'a. ('node -> 'node) -> 'node -> 'a -> ('node -> 'a) -> 'a = + fun map item same diff -> + let item' = map item in + if item == item' then + same + else + diff item' + +let map_loc : 'node. ('loc -> 'node -> 'node) -> 'loc * 'node -> 'loc * 'node = + fun map same -> + let (loc, item) = same in + id_loc map loc item same (fun diff -> (loc, diff)) + +let map_list map lst = + let (rev_lst, changed) = + List.fold_left + (fun (lst', changed) item -> + let item' = map item in + (item' :: lst', changed || item' != item)) + ([], false) + lst + in + if changed then + List.rev rev_lst + else + lst + +let map_list_multiple map lst = + let (rev_lst, changed) = + List.fold_left + (fun (lst', changed) item -> + match map item with + | [] -> (lst', true) + | [item'] -> (item' :: lst', changed || item != item') + | items' -> (List.rev_append items' lst', true)) + ([], false) + lst + in + if changed then + List.rev rev_lst + else + lst + +class ['loc] mapper = + object (this) + method program (program : ('loc, 'loc) Ast.Program.t) = + let open Ast.Program in + let (loc, { statements; comments; all_comments }) = program in + let statements' = this#toplevel_statement_list statements in + let comments' = this#syntax_opt comments in + let all_comments' = map_list this#comment all_comments in + if statements == statements' && comments == comments' && all_comments == all_comments' then + program + else + (loc, { statements = statements'; comments = comments'; all_comments = all_comments' }) + + method statement (stmt : ('loc, 'loc) Ast.Statement.t) = + let open Ast.Statement in + match stmt with + | (loc, Block block) -> id_loc this#block loc block stmt (fun block -> (loc, Block block)) + | (loc, Break break) -> id_loc this#break loc break stmt (fun break -> (loc, Break break)) + | (loc, ClassDeclaration cls) -> + id_loc this#class_ loc cls stmt (fun cls -> (loc, ClassDeclaration cls)) + | (loc, Continue cont) -> + id_loc this#continue loc cont stmt (fun cont -> (loc, Continue cont)) + | (loc, Debugger dbg) -> id_loc this#debugger loc dbg stmt (fun dbg -> (loc, Debugger dbg)) + | (loc, DeclareClass stuff) -> + id_loc this#declare_class loc stuff stmt (fun stuff -> (loc, DeclareClass stuff)) + | (loc, DeclareExportDeclaration decl) -> + id_loc this#declare_export_declaration loc decl stmt (fun decl -> + (loc, DeclareExportDeclaration decl)) + | (loc, DeclareFunction stuff) -> + id_loc this#declare_function loc stuff stmt (fun stuff -> (loc, DeclareFunction stuff)) + | (loc, DeclareInterface stuff) -> + id_loc this#declare_interface loc stuff stmt (fun stuff -> (loc, DeclareInterface stuff)) + | (loc, DeclareModule m) -> + id_loc this#declare_module loc m stmt (fun m -> (loc, DeclareModule m)) + | (loc, DeclareTypeAlias stuff) -> + id_loc this#declare_type_alias loc stuff stmt (fun stuff -> (loc, DeclareTypeAlias stuff)) + | (loc, DeclareVariable stuff) -> + id_loc this#declare_variable loc stuff stmt (fun stuff -> (loc, DeclareVariable stuff)) + | (loc, DeclareModuleExports annot) -> + id_loc this#declare_module_exports loc annot stmt (fun annot -> + (loc, DeclareModuleExports annot)) + | (loc, DoWhile stuff) -> + id_loc this#do_while loc stuff stmt (fun stuff -> (loc, DoWhile stuff)) + | (loc, Empty empty) -> id_loc this#empty loc empty stmt (fun empty -> (loc, Empty empty)) + | (loc, EnumDeclaration enum) -> + id_loc this#enum_declaration loc enum stmt (fun enum -> (loc, EnumDeclaration enum)) + | (loc, ExportDefaultDeclaration decl) -> + id_loc this#export_default_declaration loc decl stmt (fun decl -> + (loc, ExportDefaultDeclaration decl)) + | (loc, ExportNamedDeclaration decl) -> + id_loc this#export_named_declaration loc decl stmt (fun decl -> + (loc, ExportNamedDeclaration decl)) + | (loc, Expression expr) -> + id_loc this#expression_statement loc expr stmt (fun expr -> (loc, Expression expr)) + | (loc, For for_stmt) -> + id_loc this#for_statement loc for_stmt stmt (fun for_stmt -> (loc, For for_stmt)) + | (loc, ForIn stuff) -> + id_loc this#for_in_statement loc stuff stmt (fun stuff -> (loc, ForIn stuff)) + | (loc, ForOf stuff) -> + id_loc this#for_of_statement loc stuff stmt (fun stuff -> (loc, ForOf stuff)) + | (loc, FunctionDeclaration func) -> + id_loc this#function_declaration loc func stmt (fun func -> (loc, FunctionDeclaration func)) + | (loc, If if_stmt) -> + id_loc this#if_statement loc if_stmt stmt (fun if_stmt -> (loc, If if_stmt)) + | (loc, ImportDeclaration decl) -> + id_loc this#import_declaration loc decl stmt (fun decl -> (loc, ImportDeclaration decl)) + | (loc, InterfaceDeclaration stuff) -> + id_loc this#interface_declaration loc stuff stmt (fun stuff -> + (loc, InterfaceDeclaration stuff)) + | (loc, Labeled label) -> + id_loc this#labeled_statement loc label stmt (fun label -> (loc, Labeled label)) + | (loc, OpaqueType otype) -> + id_loc this#opaque_type loc otype stmt (fun otype -> (loc, OpaqueType otype)) + | (loc, Return ret) -> id_loc this#return loc ret stmt (fun ret -> (loc, Return ret)) + | (loc, Switch switch) -> + id_loc this#switch loc switch stmt (fun switch -> (loc, Switch switch)) + | (loc, Throw throw) -> id_loc this#throw loc throw stmt (fun throw -> (loc, Throw throw)) + | (loc, Try try_stmt) -> + id_loc this#try_catch loc try_stmt stmt (fun try_stmt -> (loc, Try try_stmt)) + | (loc, VariableDeclaration decl) -> + id_loc this#variable_declaration loc decl stmt (fun decl -> (loc, VariableDeclaration decl)) + | (loc, While stuff) -> id_loc this#while_ loc stuff stmt (fun stuff -> (loc, While stuff)) + | (loc, With stuff) -> id_loc this#with_ loc stuff stmt (fun stuff -> (loc, With stuff)) + | (loc, TypeAlias stuff) -> + id_loc this#type_alias loc stuff stmt (fun stuff -> (loc, TypeAlias stuff)) + | (loc, DeclareOpaqueType otype) -> + id_loc this#opaque_type loc otype stmt (fun otype -> (loc, OpaqueType otype)) + + method comment (c : 'loc Ast.Comment.t) = c + + method syntax_opt + : 'internal. ('loc, 'internal) Ast.Syntax.t option -> ('loc, 'internal) Ast.Syntax.t option + = + map_opt this#syntax + + method syntax : 'internal. ('loc, 'internal) Ast.Syntax.t -> ('loc, 'internal) Ast.Syntax.t = + fun attached -> + let open Ast.Syntax in + let { leading; trailing; internal } = attached in + let leading' = map_list this#comment leading in + let trailing' = map_list this#comment trailing in + if leading == leading' && trailing == trailing' then + attached + else + { leading = leading'; trailing = trailing'; internal } + + method expression (expr : ('loc, 'loc) Ast.Expression.t) = + let open Ast.Expression in + match expr with + | (loc, Array x) -> id_loc this#array loc x expr (fun x -> (loc, Array x)) + | (loc, ArrowFunction x) -> + id_loc this#arrow_function loc x expr (fun x -> (loc, ArrowFunction x)) + | (loc, Assignment x) -> id_loc this#assignment loc x expr (fun x -> (loc, Assignment x)) + | (loc, Binary x) -> id_loc this#binary loc x expr (fun x -> (loc, Binary x)) + | (loc, Call x) -> id_loc this#call loc x expr (fun x -> (loc, Call x)) + | (loc, Class x) -> id_loc this#class_ loc x expr (fun x -> (loc, Class x)) + | (loc, Comprehension x) -> + id_loc this#comprehension loc x expr (fun x -> (loc, Comprehension x)) + | (loc, Conditional x) -> id_loc this#conditional loc x expr (fun x -> (loc, Conditional x)) + | (loc, Function x) -> id_loc this#function_expression loc x expr (fun x -> (loc, Function x)) + | (loc, Generator x) -> id_loc this#generator loc x expr (fun x -> (loc, Generator x)) + | (loc, Identifier x) -> id this#identifier x expr (fun x -> (loc, Identifier x)) + | (loc, Import x) -> id (this#import loc) x expr (fun x -> (loc, Import x)) + | (loc, JSXElement x) -> id_loc this#jsx_element loc x expr (fun x -> (loc, JSXElement x)) + | (loc, JSXFragment x) -> id_loc this#jsx_fragment loc x expr (fun x -> (loc, JSXFragment x)) + | (loc, Literal x) -> id_loc this#literal loc x expr (fun x -> (loc, Literal x)) + | (loc, Logical x) -> id_loc this#logical loc x expr (fun x -> (loc, Logical x)) + | (loc, Member x) -> id_loc this#member loc x expr (fun x -> (loc, Member x)) + | (loc, MetaProperty x) -> + id_loc this#meta_property loc x expr (fun x -> (loc, MetaProperty x)) + | (loc, New x) -> id_loc this#new_ loc x expr (fun x -> (loc, New x)) + | (loc, Object x) -> id_loc this#object_ loc x expr (fun x -> (loc, Object x)) + | (loc, OptionalCall x) -> id (this#optional_call loc) x expr (fun x -> (loc, OptionalCall x)) + | (loc, OptionalMember x) -> + id_loc this#optional_member loc x expr (fun x -> (loc, OptionalMember x)) + | (loc, Sequence x) -> id_loc this#sequence loc x expr (fun x -> (loc, Sequence x)) + | (loc, Super x) -> id_loc this#super_expression loc x expr (fun x -> (loc, Super x)) + | (loc, TaggedTemplate x) -> + id_loc this#tagged_template loc x expr (fun x -> (loc, TaggedTemplate x)) + | (loc, TemplateLiteral x) -> + id_loc this#template_literal loc x expr (fun x -> (loc, TemplateLiteral x)) + | (loc, This x) -> id_loc this#this_expression loc x expr (fun x -> (loc, This x)) + | (loc, TypeCast x) -> id_loc this#type_cast loc x expr (fun x -> (loc, TypeCast x)) + | (loc, Unary x) -> id_loc this#unary_expression loc x expr (fun x -> (loc, Unary x)) + | (loc, Update x) -> id_loc this#update_expression loc x expr (fun x -> (loc, Update x)) + | (loc, Yield x) -> id_loc this#yield loc x expr (fun x -> (loc, Yield x)) + + method array _loc (expr : ('loc, 'loc) Ast.Expression.Array.t) = + let open Ast.Expression in + let { Array.elements; comments } = expr in + let elements' = map_list this#array_element elements in + let comments' = this#syntax_opt comments in + if elements == elements' && comments == comments' then + expr + else + { Array.elements = elements'; comments = comments' } + + method array_element element = + let open Ast.Expression.Array in + match element with + | Expression expr -> id this#expression expr element (fun expr -> Expression expr) + | Spread spread -> id this#spread_element spread element (fun spread -> Spread spread) + | Hole _ -> element + + method arrow_function loc (expr : ('loc, 'loc) Ast.Function.t) = this#function_ loc expr + + method assignment _loc (expr : ('loc, 'loc) Ast.Expression.Assignment.t) = + let open Ast.Expression.Assignment in + let { operator = _; left; right; comments } = expr in + let left' = this#assignment_pattern left in + let right' = this#expression right in + let comments' = this#syntax_opt comments in + if left == left' && right == right' && comments == comments' then + expr + else + { expr with left = left'; right = right'; comments = comments' } + + method binary _loc (expr : ('loc, 'loc) Ast.Expression.Binary.t) = + let open Ast.Expression.Binary in + let { operator = _; left; right; comments } = expr in + let left' = this#expression left in + let right' = this#expression right in + let comments' = this#syntax_opt comments in + if left == left' && right == right' && comments == comments' then + expr + else + { expr with left = left'; right = right'; comments = comments' } + + method block _loc (stmt : ('loc, 'loc) Ast.Statement.Block.t) = + let open Ast.Statement.Block in + let { body; comments } = stmt in + let body' = this#statement_list body in + let comments' = this#syntax_opt comments in + if body == body' && comments == comments' then + stmt + else + { body = body'; comments = comments' } + + method break _loc (break : 'loc Ast.Statement.Break.t) = + let open Ast.Statement.Break in + let { label; comments } = break in + let label' = map_opt this#label_identifier label in + let comments' = this#syntax_opt comments in + if label == label' && comments == comments' then + break + else + { label = label'; comments = comments' } + + method call _loc (expr : ('loc, 'loc) Ast.Expression.Call.t) = + let open Ast.Expression.Call in + let { callee; targs; arguments; comments } = expr in + let callee' = this#expression callee in + let targs' = map_opt this#call_type_args targs in + let arguments' = this#call_arguments arguments in + let comments' = this#syntax_opt comments in + if callee == callee' && targs == targs' && arguments == arguments' && comments == comments' + then + expr + else + { callee = callee'; targs = targs'; arguments = arguments'; comments = comments' } + + method call_arguments (arg_list : ('loc, 'loc) Ast.Expression.ArgList.t) = + let open Ast.Expression.ArgList in + let (loc, { arguments; comments }) = arg_list in + let arguments' = map_list this#expression_or_spread arguments in + let comments' = this#syntax_opt comments in + if arguments == arguments' && comments == comments' then + arg_list + else + (loc, { arguments = arguments'; comments = comments' }) + + method optional_call loc (expr : ('loc, 'loc) Ast.Expression.OptionalCall.t) = + let open Ast.Expression.OptionalCall in + let { call; optional = _ } = expr in + let call' = this#call loc call in + if call == call' then + expr + else + { expr with call = call' } + + method call_type_args (targs : ('loc, 'loc) Ast.Expression.CallTypeArgs.t) = + let open Ast.Expression.CallTypeArgs in + let (loc, { arguments; comments }) = targs in + let arguments' = map_list this#call_type_arg arguments in + let comments' = this#syntax_opt comments in + if arguments == arguments' && comments == comments' then + targs + else + (loc, { arguments = arguments'; comments = comments' }) + + method call_type_arg t = + let open Ast.Expression.CallTypeArg in + match t with + | Explicit x -> + let x' = this#type_ x in + if x' == x then + t + else + Explicit x' + | Implicit (loc, { Implicit.comments }) -> + let comments' = this#syntax_opt comments in + if comments == comments' then + t + else + Implicit (loc, { Implicit.comments = comments' }) + + method catch_body (body : 'loc * ('loc, 'loc) Ast.Statement.Block.t) = map_loc this#block body + + method catch_clause _loc (clause : ('loc, 'loc) Ast.Statement.Try.CatchClause.t') = + let open Ast.Statement.Try.CatchClause in + let { param; body; comments } = clause in + let param' = map_opt this#catch_clause_pattern param in + let body' = this#catch_body body in + let comments' = this#syntax_opt comments in + if param == param' && body == body' && comments == comments' then + clause + else + { param = param'; body = body'; comments = comments' } + + method class_ _loc (cls : ('loc, 'loc) Ast.Class.t) = + let open Ast.Class in + let { id; body; tparams = _; extends; implements; class_decorators; comments } = cls in + let id' = map_opt this#class_identifier id in + let body' = this#class_body body in + let extends' = map_opt (map_loc this#class_extends) extends in + let implements' = map_opt this#class_implements implements in + let class_decorators' = map_list this#class_decorator class_decorators in + let comments' = this#syntax_opt comments in + if + id == id' + && body == body' + && extends == extends' + && implements == implements' + && class_decorators == class_decorators' + && comments = comments' + then + cls + else + { + cls with + id = id'; + body = body'; + extends = extends'; + implements = implements'; + class_decorators = class_decorators'; + comments = comments'; + } + + method class_extends _loc (extends : ('loc, 'loc) Ast.Class.Extends.t') = + let open Ast.Class.Extends in + let { expr; targs; comments } = extends in + let expr' = this#expression expr in + let targs' = map_opt this#type_args targs in + let comments' = this#syntax_opt comments in + if expr == expr' && targs == targs' && comments == comments' then + extends + else + { expr = expr'; targs = targs'; comments = comments' } + + method class_identifier (ident : ('loc, 'loc) Ast.Identifier.t) = + this#pattern_identifier ~kind:Ast.Statement.VariableDeclaration.Let ident + + method class_body (cls_body : ('loc, 'loc) Ast.Class.Body.t) = + let open Ast.Class.Body in + let (loc, { body; comments }) = cls_body in + let body' = map_list this#class_element body in + let comments' = this#syntax_opt comments in + if body == body' && comments == comments' then + cls_body + else + (loc, { body = body'; comments = comments' }) + + method class_decorator (dec : ('loc, 'loc) Ast.Class.Decorator.t) = + let open Ast.Class.Decorator in + let (loc, { expression; comments }) = dec in + let expression' = this#expression expression in + let comments' = this#syntax_opt comments in + if expression == expression' && comments == comments' then + dec + else + (loc, { expression = expression'; comments = comments' }) + + method class_element (elem : ('loc, 'loc) Ast.Class.Body.element) = + let open Ast.Class.Body in + match elem with + | Method (loc, meth) -> + id_loc this#class_method loc meth elem (fun meth -> Method (loc, meth)) + | Property (loc, prop) -> + id_loc this#class_property loc prop elem (fun prop -> Property (loc, prop)) + | PrivateField (loc, field) -> + id_loc this#class_private_field loc field elem (fun field -> PrivateField (loc, field)) + + method class_implements (implements : ('loc, 'loc) Ast.Class.Implements.t) = + let open Ast.Class.Implements in + let (loc, { interfaces; comments }) = implements in + let interfaces' = map_list this#class_implements_interface interfaces in + let comments' = this#syntax_opt comments in + if interfaces == interfaces' && comments == comments' then + implements + else + (loc, { interfaces = interfaces'; comments = comments' }) + + method class_implements_interface (interface : ('loc, 'loc) Ast.Class.Implements.Interface.t) = + let open Ast.Class.Implements.Interface in + let (loc, { id; targs }) = interface in + let id' = this#identifier id in + let targs' = map_opt this#type_args targs in + if id == id' && targs == targs' then + interface + else + (loc, { id = id'; targs = targs' }) + + method class_method _loc (meth : ('loc, 'loc) Ast.Class.Method.t') = + let open Ast.Class.Method in + let { kind = _; key; value; static = _; decorators; comments } = meth in + let key' = this#object_key key in + let value' = map_loc this#function_expression value in + let decorators' = map_list this#class_decorator decorators in + let comments' = this#syntax_opt comments in + if key == key' && value == value' && decorators == decorators' && comments == comments' then + meth + else + { meth with key = key'; value = value'; decorators = decorators'; comments = comments' } + + method class_property _loc (prop : ('loc, 'loc) Ast.Class.Property.t') = + let open Ast.Class.Property in + let { key; value; annot; static = _; variance; comments } = prop in + let key' = this#object_key key in + let value' = this#class_property_value value in + let annot' = this#type_annotation_hint annot in + let variance' = this#variance variance in + let comments' = this#syntax_opt comments in + if + key == key' + && value == value' + && annot' == annot + && variance' == variance + && comments' == comments + then + prop + else + { + prop with + key = key'; + value = value'; + annot = annot'; + variance = variance'; + comments = comments'; + } + + method class_property_value (value : ('loc, 'loc) Ast.Class.Property.value) = + let open Ast.Class.Property in + match value with + | Declared -> value + | Uninitialized -> value + | Initialized x -> + let x' = this#expression x in + if x == x' then + value + else + Initialized x' + + method class_private_field _loc (prop : ('loc, 'loc) Ast.Class.PrivateField.t') = + let open Ast.Class.PrivateField in + let { key; value; annot; static = _; variance; comments } = prop in + let key' = this#private_name key in + let value' = this#class_property_value value in + let annot' = this#type_annotation_hint annot in + let variance' = this#variance variance in + let comments' = this#syntax_opt comments in + if + key == key' + && value == value' + && annot' == annot + && variance' == variance + && comments' == comments + then + prop + else + { + prop with + key = key'; + value = value'; + annot = annot'; + variance = variance'; + comments = comments'; + } + + (* TODO *) + method comprehension _loc (expr : ('loc, 'loc) Ast.Expression.Comprehension.t) = expr + + method conditional _loc (expr : ('loc, 'loc) Ast.Expression.Conditional.t) = + let open Ast.Expression.Conditional in + let { test; consequent; alternate; comments } = expr in + let test' = this#predicate_expression test in + let consequent' = this#expression consequent in + let alternate' = this#expression alternate in + let comments' = this#syntax_opt comments in + if + test == test' + && consequent == consequent' + && alternate == alternate' + && comments = comments' + then + expr + else + { test = test'; consequent = consequent'; alternate = alternate'; comments = comments' } + + method continue _loc (cont : 'loc Ast.Statement.Continue.t) = + let open Ast.Statement.Continue in + let { label; comments } = cont in + let label' = map_opt this#label_identifier label in + let comments' = this#syntax_opt comments in + if label == label' && comments == comments' then + cont + else + { label = label'; comments = comments' } + + method debugger _loc (dbg : 'loc Ast.Statement.Debugger.t) = + let open Ast.Statement.Debugger in + let { comments } = dbg in + let comments' = this#syntax_opt comments in + if comments == comments' then + dbg + else + { comments = comments' } + + method declare_class _loc (decl : ('loc, 'loc) Ast.Statement.DeclareClass.t) = + let open Ast.Statement.DeclareClass in + let { id = ident; tparams; body; extends; mixins; implements; comments } = decl in + let id' = this#class_identifier ident in + let tparams' = map_opt this#type_params tparams in + let body' = map_loc this#object_type body in + let extends' = map_opt (map_loc this#generic_type) extends in + let mixins' = map_list (map_loc this#generic_type) mixins in + let implements' = map_opt this#class_implements implements in + let comments' = this#syntax_opt comments in + if + id' == ident + && tparams' == tparams + && body' == body + && extends' == extends + && mixins' == mixins + && implements' == implements + && comments' == comments + then + decl + else + { + id = id'; + tparams = tparams'; + body = body'; + extends = extends'; + mixins = mixins'; + implements = implements'; + comments = comments'; + } + + method declare_export_declaration + _loc (decl : ('loc, 'loc) Ast.Statement.DeclareExportDeclaration.t) = + let open Ast.Statement.DeclareExportDeclaration in + let { default; source; specifiers; declaration; comments } = decl in + let specifiers' = map_opt this#export_named_specifier specifiers in + let declaration' = map_opt this#declare_export_declaration_decl declaration in + let comments' = this#syntax_opt comments in + if specifiers == specifiers' && declaration == declaration' && comments == comments' then + decl + else + { + default; + source; + specifiers = specifiers'; + declaration = declaration'; + comments = comments'; + } + + method declare_export_declaration_decl + (decl : ('loc, 'loc) Ast.Statement.DeclareExportDeclaration.declaration) = + let open Ast.Statement.DeclareExportDeclaration in + match decl with + | Variable (loc, dv) -> + let dv' = this#declare_variable loc dv in + if dv' == dv then + decl + else + Variable (loc, dv') + | Function (loc, df) -> + let df' = this#declare_function loc df in + if df' == df then + decl + else + Function (loc, df') + | Class (loc, dc) -> + let dc' = this#declare_class loc dc in + if dc' == dc then + decl + else + Class (loc, dc') + | DefaultType t -> + let t' = this#type_ t in + if t' == t then + decl + else + DefaultType t' + | NamedType (loc, ta) -> + let ta' = this#type_alias loc ta in + if ta' == ta then + decl + else + NamedType (loc, ta') + | NamedOpaqueType (loc, ot) -> + let ot' = this#opaque_type loc ot in + if ot' == ot then + decl + else + NamedOpaqueType (loc, ot') + | Interface (loc, i) -> + let i' = this#interface loc i in + if i' == i then + decl + else + Interface (loc, i') + + method declare_function _loc (decl : ('loc, 'loc) Ast.Statement.DeclareFunction.t) = + let open Ast.Statement.DeclareFunction in + let { id = ident; annot; predicate; comments } = decl in + let id' = this#function_identifier ident in + let annot' = this#type_annotation annot in + let predicate' = map_opt this#predicate predicate in + let comments' = this#syntax_opt comments in + if id' == ident && annot' == annot && predicate' == predicate && comments' == comments then + decl + else + { id = id'; annot = annot'; predicate = predicate'; comments = comments' } + + method declare_interface loc (decl : ('loc, 'loc) Ast.Statement.Interface.t) = + this#interface loc decl + + method declare_module _loc (m : ('loc, 'loc) Ast.Statement.DeclareModule.t) = + let open Ast.Statement.DeclareModule in + let { id; body; kind; comments } = m in + let body' = map_loc this#block body in + let comments' = this#syntax_opt comments in + if body' == body && comments = comments' then + m + else + { id; body = body'; kind; comments = comments' } + + method declare_module_exports _loc (exports : ('loc, 'loc) Ast.Statement.DeclareModuleExports.t) + = + let open Ast.Statement.DeclareModuleExports in + let { annot; comments } = exports in + let annot' = this#type_annotation annot in + let comments' = this#syntax_opt comments in + if annot == annot' && comments == comments' then + exports + else + { annot = annot'; comments = comments' } + + method declare_type_alias loc (decl : ('loc, 'loc) Ast.Statement.TypeAlias.t) = + this#type_alias loc decl + + method declare_variable _loc (decl : ('loc, 'loc) Ast.Statement.DeclareVariable.t) = + let open Ast.Statement.DeclareVariable in + let { id = ident; annot; comments } = decl in + let id' = this#pattern_identifier ~kind:Ast.Statement.VariableDeclaration.Var ident in + let annot' = this#type_annotation_hint annot in + let comments' = this#syntax_opt comments in + if id' == ident && annot' == annot && comments' == comments then + decl + else + { id = id'; annot = annot'; comments = comments' } + + method do_while _loc (stuff : ('loc, 'loc) Ast.Statement.DoWhile.t) = + let open Ast.Statement.DoWhile in + let { body; test; comments } = stuff in + let body' = this#statement body in + let test' = this#predicate_expression test in + let comments' = this#syntax_opt comments in + if body == body' && test == test' && comments == comments' then + stuff + else + { body = body'; test = test'; comments = comments' } + + method empty _loc empty = + let open Ast.Statement.Empty in + let { comments } = empty in + let comments' = this#syntax_opt comments in + if comments == comments' then + empty + else + { comments = comments' } + + method enum_declaration _loc (enum : ('loc, 'loc) Ast.Statement.EnumDeclaration.t) = + let open Ast.Statement.EnumDeclaration in + let { id = ident; body; comments } = enum in + let id' = this#identifier ident in + let body' = + match body with + | (loc, BooleanBody boolean_body) -> + id this#enum_boolean_body boolean_body body (fun body -> (loc, BooleanBody body)) + | (loc, NumberBody number_body) -> + id this#enum_number_body number_body body (fun body -> (loc, NumberBody body)) + | (loc, StringBody string_body) -> + id this#enum_string_body string_body body (fun body -> (loc, StringBody body)) + | (loc, SymbolBody symbol_body) -> + id this#enum_symbol_body symbol_body body (fun body -> (loc, SymbolBody body)) + in + let comments' = this#syntax_opt comments in + if ident == id' && body == body' && comments == comments' then + enum + else + { id = id'; body = body'; comments = comments' } + + method enum_boolean_body (body : 'loc Ast.Statement.EnumDeclaration.BooleanBody.t) = + let open Ast.Statement.EnumDeclaration.BooleanBody in + let { members; explicit_type = _; has_unknown_members = _; comments } = body in + let members' = map_list this#enum_boolean_member members in + let comments' = this#syntax_opt comments in + if members == members' && comments == comments' then + body + else + { body with members = members'; comments = comments' } + + method enum_number_body (body : 'loc Ast.Statement.EnumDeclaration.NumberBody.t) = + let open Ast.Statement.EnumDeclaration.NumberBody in + let { members; explicit_type = _; has_unknown_members = _; comments } = body in + let members' = map_list this#enum_number_member members in + let comments' = this#syntax_opt comments in + if members == members' && comments == comments' then + body + else + { body with members = members'; comments = comments' } + + method enum_string_body (body : 'loc Ast.Statement.EnumDeclaration.StringBody.t) = + let open Ast.Statement.EnumDeclaration.StringBody in + let { members; explicit_type = _; has_unknown_members = _; comments } = body in + let members' = + match members with + | Defaulted members -> Defaulted (map_list this#enum_defaulted_member members) + | Initialized members -> Initialized (map_list this#enum_string_member members) + in + let comments' = this#syntax_opt comments in + if members == members' && comments == comments' then + body + else + { body with members = members'; comments = comments' } + + method enum_symbol_body (body : 'loc Ast.Statement.EnumDeclaration.SymbolBody.t) = + let open Ast.Statement.EnumDeclaration.SymbolBody in + let { members; has_unknown_members = _; comments } = body in + let members' = map_list this#enum_defaulted_member members in + let comments' = this#syntax_opt comments in + if members == members' && comments == comments' then + body + else + { body with members = members'; comments = comments' } + + method enum_defaulted_member (member : 'loc Ast.Statement.EnumDeclaration.DefaultedMember.t) = + let open Ast.Statement.EnumDeclaration.DefaultedMember in + let (loc, { id = ident }) = member in + let id' = this#identifier ident in + if ident = id' then + member + else + (loc, { id = id' }) + + method enum_boolean_member + (member : + ('loc Ast.BooleanLiteral.t, 'loc) Ast.Statement.EnumDeclaration.InitializedMember.t) = + let open Ast.Statement.EnumDeclaration.InitializedMember in + let (loc, { id = ident; init }) = member in + let id' = this#identifier ident in + if ident = id' then + member + else + (loc, { id = id'; init }) + + method enum_number_member + (member : + ('loc Ast.NumberLiteral.t, 'loc) Ast.Statement.EnumDeclaration.InitializedMember.t) = + let open Ast.Statement.EnumDeclaration.InitializedMember in + let (loc, { id = ident; init }) = member in + let id' = this#identifier ident in + if ident = id' then + member + else + (loc, { id = id'; init }) + + method enum_string_member + (member : + ('loc Ast.StringLiteral.t, 'loc) Ast.Statement.EnumDeclaration.InitializedMember.t) = + let open Ast.Statement.EnumDeclaration.InitializedMember in + let (loc, { id = ident; init }) = member in + let id' = this#identifier ident in + if ident = id' then + member + else + (loc, { id = id'; init }) + + method export_default_declaration + _loc (decl : ('loc, 'loc) Ast.Statement.ExportDefaultDeclaration.t) = + let open Ast.Statement.ExportDefaultDeclaration in + let { default; declaration; comments } = decl in + let declaration' = this#export_default_declaration_decl declaration in + let comments' = this#syntax_opt comments in + if declaration' == declaration && comments' == comments then + decl + else + { default; declaration = declaration'; comments = comments' } + + method export_default_declaration_decl + (decl : ('loc, 'loc) Ast.Statement.ExportDefaultDeclaration.declaration) = + let open Ast.Statement.ExportDefaultDeclaration in + match decl with + | Declaration stmt -> id this#statement stmt decl (fun stmt -> Declaration stmt) + | Expression expr -> id this#expression expr decl (fun expr -> Expression expr) + + method export_named_declaration + _loc (decl : ('loc, 'loc) Ast.Statement.ExportNamedDeclaration.t) = + let open Ast.Statement.ExportNamedDeclaration in + let { export_kind; source; specifiers; declaration; comments } = decl in + let specifiers' = map_opt this#export_named_specifier specifiers in + let declaration' = map_opt this#statement declaration in + let comments' = this#syntax_opt comments in + if specifiers == specifiers' && declaration == declaration' && comments == comments' then + decl + else + { + export_kind; + source; + specifiers = specifiers'; + declaration = declaration'; + comments = comments'; + } + + method export_named_declaration_specifier + (spec : 'loc Ast.Statement.ExportNamedDeclaration.ExportSpecifier.t) = + let open Ast.Statement.ExportNamedDeclaration.ExportSpecifier in + let (loc, { local; exported }) = spec in + let local' = this#identifier local in + let exported' = map_opt this#identifier exported in + if local == local' && exported == exported' then + spec + else + (loc, { local = local'; exported = exported' }) + + method export_named_specifier (spec : 'loc Ast.Statement.ExportNamedDeclaration.specifier) = + let open Ast.Statement.ExportNamedDeclaration in + match spec with + | ExportSpecifiers spec_list -> + let spec_list' = map_list this#export_named_declaration_specifier spec_list in + if spec_list == spec_list' then + spec + else + ExportSpecifiers spec_list' + | ExportBatchSpecifier (loc, id_opt) -> + let id_opt' = map_opt this#identifier id_opt in + if id_opt == id_opt' then + spec + else + ExportBatchSpecifier (loc, id_opt') + + method expression_statement _loc (stmt : ('loc, 'loc) Ast.Statement.Expression.t) = + let open Ast.Statement.Expression in + let { expression = expr; directive; comments } = stmt in + let expr' = this#expression expr in + let comments' = this#syntax_opt comments in + if expr == expr' && comments == comments' then + stmt + else + { expression = expr'; directive; comments = comments' } + + method expression_or_spread expr_or_spread = + let open Ast.Expression in + match expr_or_spread with + | Expression expr -> id this#expression expr expr_or_spread (fun expr -> Expression expr) + | Spread spread -> id this#spread_element spread expr_or_spread (fun spread -> Spread spread) + + method for_in_statement _loc (stmt : ('loc, 'loc) Ast.Statement.ForIn.t) = + let open Ast.Statement.ForIn in + let { left; right; body; each; comments } = stmt in + let left' = this#for_in_statement_lhs left in + let right' = this#expression right in + let body' = this#statement body in + let comments' = this#syntax_opt comments in + if left == left' && right == right' && body == body' && comments == comments' then + stmt + else + { left = left'; right = right'; body = body'; each; comments = comments' } + + method for_in_statement_lhs (left : ('loc, 'loc) Ast.Statement.ForIn.left) = + let open Ast.Statement.ForIn in + match left with + | LeftDeclaration (loc, decl) -> + id_loc this#variable_declaration loc decl left (fun decl -> LeftDeclaration (loc, decl)) + | LeftPattern patt -> + id this#for_in_assignment_pattern patt left (fun patt -> LeftPattern patt) + + method for_of_statement _loc (stuff : ('loc, 'loc) Ast.Statement.ForOf.t) = + let open Ast.Statement.ForOf in + let { left; right; body; await; comments } = stuff in + let left' = this#for_of_statement_lhs left in + let right' = this#expression right in + let body' = this#statement body in + let comments' = this#syntax_opt comments in + if left == left' && right == right' && body == body' && comments == comments' then + stuff + else + { left = left'; right = right'; body = body'; await; comments = comments' } + + method for_of_statement_lhs (left : ('loc, 'loc) Ast.Statement.ForOf.left) = + let open Ast.Statement.ForOf in + match left with + | LeftDeclaration (loc, decl) -> + id_loc this#variable_declaration loc decl left (fun decl -> LeftDeclaration (loc, decl)) + | LeftPattern patt -> + id this#for_of_assignment_pattern patt left (fun patt -> LeftPattern patt) + + method for_statement _loc (stmt : ('loc, 'loc) Ast.Statement.For.t) = + let open Ast.Statement.For in + let { init; test; update; body; comments } = stmt in + let init' = map_opt this#for_statement_init init in + let test' = map_opt this#predicate_expression test in + let update' = map_opt this#expression update in + let body' = this#statement body in + let comments' = this#syntax_opt comments in + if + init == init' + && test == test' + && update == update' + && body == body' + && comments == comments' + then + stmt + else + { init = init'; test = test'; update = update'; body = body'; comments = comments' } + + method for_statement_init (init : ('loc, 'loc) Ast.Statement.For.init) = + let open Ast.Statement.For in + match init with + | InitDeclaration (loc, decl) -> + id_loc this#variable_declaration loc decl init (fun decl -> InitDeclaration (loc, decl)) + | InitExpression expr -> id this#expression expr init (fun expr -> InitExpression expr) + + method function_param_type (fpt : ('loc, 'loc) Ast.Type.Function.Param.t) = + let open Ast.Type.Function.Param in + let (loc, { annot; name; optional }) = fpt in + let annot' = this#type_ annot in + let name' = map_opt this#identifier name in + if annot' == annot && name' == name then + fpt + else + (loc, { annot = annot'; name = name'; optional }) + + method function_rest_param_type (frpt : ('loc, 'loc) Ast.Type.Function.RestParam.t) = + let open Ast.Type.Function.RestParam in + let (loc, { argument; comments }) = frpt in + let argument' = this#function_param_type argument in + let comments' = this#syntax_opt comments in + if argument' == argument && comments' == comments then + frpt + else + (loc, { argument = argument'; comments = comments' }) + + method function_this_param_type (this_param : ('loc, 'loc) Ast.Type.Function.ThisParam.t) = + let open Ast.Type.Function.ThisParam in + let (loc, { annot; comments }) = this_param in + let annot' = this#type_annotation annot in + let comments' = this#syntax_opt comments in + if annot' == annot && comments' == comments then + this_param + else + (loc, { annot = annot'; comments = comments' }) + + method function_type _loc (ft : ('loc, 'loc) Ast.Type.Function.t) = + let open Ast.Type.Function in + let { + params = (params_loc, { Params.this_; params = ps; rest = rpo; comments = params_comments }); + return; + tparams; + comments = func_comments; + } = + ft + in + let this_' = map_opt this#function_this_param_type this_ in + let ps' = map_list this#function_param_type ps in + let rpo' = map_opt this#function_rest_param_type rpo in + let return' = this#type_ return in + let tparams' = map_opt this#type_params tparams in + let func_comments' = this#syntax_opt func_comments in + let params_comments' = this#syntax_opt params_comments in + if + ps' == ps + && rpo' == rpo + && return' == return + && tparams' == tparams + && func_comments' == func_comments + && params_comments' == params_comments + && this_' == this_ + then + ft + else + { + params = + ( params_loc, + { Params.this_ = this_'; params = ps'; rest = rpo'; comments = params_comments' } ); + return = return'; + tparams = tparams'; + comments = func_comments'; + } + + method label_identifier (ident : ('loc, 'loc) Ast.Identifier.t) = this#identifier ident + + method object_property_value_type (opvt : ('loc, 'loc) Ast.Type.Object.Property.value) = + let open Ast.Type.Object.Property in + match opvt with + | Init t -> id this#type_ t opvt (fun t -> Init t) + | Get (loc, ft) -> id_loc this#function_type loc ft opvt (fun ft -> Get (loc, ft)) + | Set (loc, ft) -> id_loc this#function_type loc ft opvt (fun ft -> Set (loc, ft)) + + method object_property_type (opt : ('loc, 'loc) Ast.Type.Object.Property.t) = + let open Ast.Type.Object.Property in + let (loc, { key; value; optional; static; proto; _method; variance; comments }) = opt in + let key' = this#object_key key in + let value' = this#object_property_value_type value in + let variance' = this#variance variance in + let comments' = this#syntax_opt comments in + if key' == key && value' == value && variance' == variance && comments' == comments then + opt + else + ( loc, + { + key = key'; + value = value'; + optional; + static; + proto; + _method; + variance = variance'; + comments = comments'; + } ) + + method object_spread_property_type (opt : ('loc, 'loc) Ast.Type.Object.SpreadProperty.t) = + let open Ast.Type.Object.SpreadProperty in + let (loc, { argument; comments }) = opt in + let argument' = this#type_ argument in + let comments' = this#syntax_opt comments in + if argument' == argument && comments == comments' then + opt + else + (loc, { argument = argument'; comments = comments' }) + + method object_indexer_property_type (opt : ('loc, 'loc) Ast.Type.Object.Indexer.t) = + let open Ast.Type.Object.Indexer in + let (loc, { id; key; value; static; variance; comments }) = opt in + let key' = this#type_ key in + let value' = this#type_ value in + let variance' = this#variance variance in + let comments' = this#syntax_opt comments in + if key' == key && value' == value && variance' == variance && comments' == comments then + opt + else + (loc, { id; key = key'; value = value'; static; variance = variance'; comments = comments' }) + + method object_internal_slot_property_type (slot : ('loc, 'loc) Ast.Type.Object.InternalSlot.t) = + let open Ast.Type.Object.InternalSlot in + let (loc, { id; value; optional; static; _method; comments }) = slot in + let id' = this#identifier id in + let value' = this#type_ value in + let comments' = this#syntax_opt comments in + if id == id' && value == value' && comments == comments' then + slot + else + (loc, { id = id'; value = value'; optional; static; _method; comments = comments' }) + + method object_call_property_type (call : ('loc, 'loc) Ast.Type.Object.CallProperty.t) = + let open Ast.Type.Object.CallProperty in + let (loc, { value = (value_loc, value); static; comments }) = call in + let value' = this#function_type value_loc value in + let comments' = this#syntax_opt comments in + if value == value' && comments == comments' then + call + else + (loc, { value = (value_loc, value'); static; comments = comments' }) + + method object_type _loc (ot : ('loc, 'loc) Ast.Type.Object.t) = + let open Ast.Type.Object in + let { properties; exact; inexact; comments } = ot in + let properties' = + map_list + (fun p -> + match p with + | Property p' -> id this#object_property_type p' p (fun p' -> Property p') + | SpreadProperty p' -> + id this#object_spread_property_type p' p (fun p' -> SpreadProperty p') + | Indexer p' -> id this#object_indexer_property_type p' p (fun p' -> Indexer p') + | InternalSlot p' -> + id this#object_internal_slot_property_type p' p (fun p' -> InternalSlot p') + | CallProperty p' -> id this#object_call_property_type p' p (fun p' -> CallProperty p')) + properties + in + let comments' = this#syntax_opt comments in + if properties' == properties && comments == comments' then + ot + else + { properties = properties'; exact; inexact; comments = comments' } + + method interface_type _loc (i : ('loc, 'loc) Ast.Type.Interface.t) = + let open Ast.Type.Interface in + let { extends; body; comments } = i in + let extends' = map_list (map_loc this#generic_type) extends in + let body' = map_loc this#object_type body in + let comments' = this#syntax_opt comments in + if extends' == extends && body' == body && comments == comments' then + i + else + { extends = extends'; body = body'; comments = comments' } + + method generic_identifier_type (git : ('loc, 'loc) Ast.Type.Generic.Identifier.t) = + let open Ast.Type.Generic.Identifier in + match git with + | Unqualified i -> id this#identifier i git (fun i -> Unqualified i) + | Qualified (loc, { qualification; id }) -> + let qualification' = this#generic_identifier_type qualification in + let id' = this#identifier id in + if qualification' == qualification && id' == id then + git + else + Qualified (loc, { qualification = qualification'; id = id' }) + + method variance (variance : 'loc Ast.Variance.t option) = + match variance with + | None -> None + | Some (loc, { Ast.Variance.kind; comments }) -> + let comments' = this#syntax_opt comments in + if comments == comments' then + variance + else + Some (loc, { Ast.Variance.kind; comments = comments' }) + + method type_args (targs : ('loc, 'loc) Ast.Type.TypeArgs.t) = + let open Ast.Type.TypeArgs in + let (loc, { arguments; comments }) = targs in + let arguments' = map_list this#type_ arguments in + let comments' = this#syntax_opt comments in + if arguments == arguments' && comments == comments' then + targs + else + (loc, { arguments = arguments'; comments = comments' }) + + method type_params (tparams : ('loc, 'loc) Ast.Type.TypeParams.t) = + let open Ast.Type.TypeParams in + let (loc, { params = tps; comments }) = tparams in + let tps' = map_list this#type_param tps in + let comments' = this#syntax_opt comments in + if tps' == tps && comments' == comments then + tparams + else + (loc, { params = tps'; comments = comments' }) + + method type_param (tparam : ('loc, 'loc) Ast.Type.TypeParam.t) = + let open Ast.Type.TypeParam in + let (loc, { name; bound; variance; default }) = tparam in + let name' = this#identifier name in + let bound' = this#type_annotation_hint bound in + let variance' = this#variance variance in + let default' = map_opt this#type_ default in + if name' == name && bound' == bound && variance' == variance && default' == default then + tparam + else + (loc, { name = name'; bound = bound'; variance = variance'; default = default' }) + + method generic_type _loc (gt : ('loc, 'loc) Ast.Type.Generic.t) = + let open Ast.Type.Generic in + let { id; targs; comments } = gt in + let id' = this#generic_identifier_type id in + let targs' = map_opt this#type_args targs in + let comments' = this#syntax_opt comments in + if id' == id && targs' == targs && comments' == comments then + gt + else + { id = id'; targs = targs'; comments = comments' } + + method string_literal_type _loc (lit : 'loc Ast.StringLiteral.t) = + let open Ast.StringLiteral in + let { value; raw; comments } = lit in + let comments' = this#syntax_opt comments in + if comments == comments' then + lit + else + { value; raw; comments = comments' } + + method number_literal_type _loc (lit : 'loc Ast.NumberLiteral.t) = + let open Ast.NumberLiteral in + let { value; raw; comments } = lit in + let comments' = this#syntax_opt comments in + if comments == comments' then + lit + else + { value; raw; comments = comments' } + + method bigint_literal_type _loc (lit : 'loc Ast.BigIntLiteral.t) = + let open Ast.BigIntLiteral in + let { approx_value; bigint; comments } = lit in + let comments' = this#syntax_opt comments in + if comments == comments' then + lit + else + { approx_value; bigint; comments = comments' } + + method boolean_literal_type _loc (lit : 'loc Ast.BooleanLiteral.t) = + let open Ast.BooleanLiteral in + let { value; comments } = lit in + let comments' = this#syntax_opt comments in + if comments == comments' then + lit + else + { value; comments = comments' } + + method nullable_type (t : ('loc, 'loc) Ast.Type.Nullable.t) = + let open Ast.Type.Nullable in + let { argument; comments } = t in + let argument' = this#type_ argument in + let comments' = this#syntax_opt comments in + if argument == argument' && comments == comments' then + t + else + { argument = argument'; comments = comments' } + + method typeof_type (t : ('loc, 'loc) Ast.Type.Typeof.t) = + let open Ast.Type.Typeof in + let { argument; internal; comments } = t in + let argument' = this#type_ argument in + let comments' = this#syntax_opt comments in + if argument == argument' && comments == comments' then + t + else + { argument = argument'; internal; comments = comments' } + + method tuple_type (t : ('loc, 'loc) Ast.Type.Tuple.t) = + let open Ast.Type.Tuple in + let { types; comments } = t in + let types' = map_list this#type_ types in + let comments' = this#syntax_opt comments in + if types == types' && comments == comments' then + t + else + { types = types'; comments = comments' } + + method array_type (t : ('loc, 'loc) Ast.Type.Array.t) = + let open Ast.Type.Array in + let { argument; comments } = t in + let argument' = this#type_ argument in + let comments' = this#syntax_opt comments in + if argument == argument' && comments == comments' then + t + else + { argument = argument'; comments = comments' } + + method union_type _loc (t : ('loc, 'loc) Ast.Type.Union.t) = + let open Ast.Type.Union in + let { types = (t0, t1, ts); comments } = t in + let t0' = this#type_ t0 in + let t1' = this#type_ t1 in + let ts' = map_list this#type_ ts in + let comments' = this#syntax_opt comments in + if t0' == t0 && t1' == t1 && ts' == ts && comments' == comments then + t + else + { types = (t0', t1', ts'); comments = comments' } + + method intersection_type _loc (t : ('loc, 'loc) Ast.Type.Intersection.t) = + let open Ast.Type.Intersection in + let { types = (t0, t1, ts); comments } = t in + let t0' = this#type_ t0 in + let t1' = this#type_ t1 in + let ts' = map_list this#type_ ts in + let comments' = this#syntax_opt comments in + if t0' == t0 && t1' == t1 && ts' == ts && comments' == comments then + t + else + { types = (t0', t1', ts'); comments = comments' } + + method type_ (t : ('loc, 'loc) Ast.Type.t) = + let open Ast.Type in + match t with + | (loc, Any comments) -> id this#syntax_opt comments t (fun comments -> (loc, Any comments)) + | (loc, Mixed comments) -> + id this#syntax_opt comments t (fun comments -> (loc, Mixed comments)) + | (loc, Empty comments) -> + id this#syntax_opt comments t (fun comments -> (loc, Empty comments)) + | (loc, Void comments) -> id this#syntax_opt comments t (fun comments -> (loc, Void comments)) + | (loc, Null comments) -> id this#syntax_opt comments t (fun comments -> (loc, Null comments)) + | (loc, Symbol comments) -> + id this#syntax_opt comments t (fun comments -> (loc, Symbol comments)) + | (loc, Number comments) -> + id this#syntax_opt comments t (fun comments -> (loc, Number comments)) + | (loc, BigInt comments) -> + id this#syntax_opt comments t (fun comments -> (loc, BigInt comments)) + | (loc, String comments) -> + id this#syntax_opt comments t (fun comments -> (loc, String comments)) + | (loc, Boolean comments) -> + id this#syntax_opt comments t (fun comments -> (loc, Boolean comments)) + | (loc, Exists comments) -> + id this#syntax_opt comments t (fun comments -> (loc, Exists comments)) + | (loc, Nullable t') -> id this#nullable_type t' t (fun t' -> (loc, Nullable t')) + | (loc, Array t') -> id this#array_type t' t (fun t' -> (loc, Array t')) + | (loc, Typeof t') -> id this#typeof_type t' t (fun t' -> (loc, Typeof t')) + | (loc, Function ft) -> id_loc this#function_type loc ft t (fun ft -> (loc, Function ft)) + | (loc, Object ot) -> id_loc this#object_type loc ot t (fun ot -> (loc, Object ot)) + | (loc, Interface i) -> id_loc this#interface_type loc i t (fun i -> (loc, Interface i)) + | (loc, Generic gt) -> id_loc this#generic_type loc gt t (fun gt -> (loc, Generic gt)) + | (loc, StringLiteral lit) -> + id_loc this#string_literal_type loc lit t (fun lit -> (loc, StringLiteral lit)) + | (loc, NumberLiteral lit) -> + id_loc this#number_literal_type loc lit t (fun lit -> (loc, NumberLiteral lit)) + | (loc, BigIntLiteral lit) -> + id_loc this#bigint_literal_type loc lit t (fun lit -> (loc, BigIntLiteral lit)) + | (loc, BooleanLiteral lit) -> + id_loc this#boolean_literal_type loc lit t (fun lit -> (loc, BooleanLiteral lit)) + | (loc, Union t') -> id_loc this#union_type loc t' t (fun t' -> (loc, Union t')) + | (loc, Intersection t') -> + id_loc this#intersection_type loc t' t (fun t' -> (loc, Intersection t')) + | (loc, Tuple t') -> id this#tuple_type t' t (fun t' -> (loc, Tuple t')) + + method type_annotation (annot : ('loc, 'loc) Ast.Type.annotation) = + let (loc, a) = annot in + id this#type_ a annot (fun a -> (loc, a)) + + method type_annotation_hint (return : ('M, 'T) Ast.Type.annotation_or_hint) = + let open Ast.Type in + match return with + | Available annot -> + let annot' = this#type_annotation annot in + if annot' == annot then + return + else + Available annot' + | Missing _loc -> return + + method function_declaration loc (stmt : ('loc, 'loc) Ast.Function.t) = this#function_ loc stmt + + method function_expression loc (stmt : ('loc, 'loc) Ast.Function.t) = this#function_ loc stmt + + (* Internal helper for function declarations, function expressions and arrow functions *) + method function_ _loc (expr : ('loc, 'loc) Ast.Function.t) = + let open Ast.Function in + let { + id = ident; + params; + body; + async; + generator; + predicate; + return; + tparams; + sig_loc; + comments; + } = + expr + in + let ident' = map_opt this#function_identifier ident in + let params' = this#function_params params in + let return' = this#type_annotation_hint return in + let body' = this#function_body_any body in + let predicate' = map_opt this#predicate predicate in + let tparams' = map_opt this#type_params tparams in + let comments' = this#syntax_opt comments in + if + ident == ident' + && params == params' + && body == body' + && predicate = predicate' + && return == return' + && tparams == tparams' + && comments == comments' + then + expr + else + { + id = ident'; + params = params'; + return = return'; + body = body'; + async; + generator; + predicate = predicate'; + tparams = tparams'; + sig_loc; + comments = comments'; + } + + method function_params (params : ('loc, 'loc) Ast.Function.Params.t) = + let open Ast.Function in + let (loc, { Params.params = params_list; rest; comments; this_ }) = params in + let params_list' = map_list this#function_param params_list in + let rest' = map_opt this#function_rest_param rest in + let this_' = map_opt this#function_this_param this_ in + let comments' = this#syntax_opt comments in + if params_list == params_list' && rest == rest' && comments == comments' && this_ == this_' + then + params + else + (loc, { Params.params = params_list'; rest = rest'; comments = comments'; this_ = this_' }) + + method function_this_param (this_param : ('loc, 'loc) Ast.Function.ThisParam.t) = + let open Ast.Function.ThisParam in + let (loc, { annot; comments }) = this_param in + let annot' = this#type_annotation annot in + let comments' = this#syntax_opt comments in + if annot' == annot && comments' == comments then + this_param + else + (loc, { annot = annot'; comments = comments' }) + + method function_param (param : ('loc, 'loc) Ast.Function.Param.t) = + let open Ast.Function.Param in + let (loc, { argument; default }) = param in + let argument' = this#function_param_pattern argument in + let default' = map_opt this#expression default in + if argument == argument' && default == default' then + param + else + (loc, { argument = argument'; default = default' }) + + method function_body_any (body : ('loc, 'loc) Ast.Function.body) = + match body with + | Ast.Function.BodyBlock (loc, block) -> + id_loc this#function_body loc block body (fun block -> Ast.Function.BodyBlock (loc, block)) + | Ast.Function.BodyExpression expr -> + id this#expression expr body (fun expr -> Ast.Function.BodyExpression expr) + + method function_body loc (block : ('loc, 'loc) Ast.Statement.Block.t) = this#block loc block + + method function_identifier (ident : ('loc, 'loc) Ast.Identifier.t) = + this#pattern_identifier ~kind:Ast.Statement.VariableDeclaration.Var ident + + (* TODO *) + method generator _loc (expr : ('loc, 'loc) Ast.Expression.Generator.t) = expr + + method identifier (id : ('loc, 'loc) Ast.Identifier.t) = + let open Ast.Identifier in + let (loc, { name; comments }) = id in + let comments' = this#syntax_opt comments in + if comments == comments' then + id + else + (loc, { name; comments = comments' }) + + method interface _loc (interface : ('loc, 'loc) Ast.Statement.Interface.t) = + let open Ast.Statement.Interface in + let { id = ident; tparams; extends; body; comments } = interface in + let id' = this#class_identifier ident in + let tparams' = map_opt this#type_params tparams in + let extends' = map_list (map_loc this#generic_type) extends in + let body' = map_loc this#object_type body in + let comments' = this#syntax_opt comments in + if + id' == ident + && tparams' == tparams + && extends' == extends + && body' == body + && comments' == comments + then + interface + else + { id = id'; tparams = tparams'; extends = extends'; body = body'; comments = comments' } + + method interface_declaration loc (decl : ('loc, 'loc) Ast.Statement.Interface.t) = + this#interface loc decl + + method private_name (name : 'loc Ast.PrivateName.t) = + let open Ast.PrivateName in + let (loc, { id; comments }) = name in + let id' = this#identifier id in + let comments' = this#syntax_opt comments in + if id == id' && comments == comments' then + name + else + (loc, { id = id'; comments = comments' }) + + method computed_key (key : ('loc, 'loc) Ast.ComputedKey.t) = + let open Ast.ComputedKey in + let (loc, { expression; comments }) = key in + let expression' = this#expression expression in + let comments' = this#syntax_opt comments in + if expression == expression' && comments == comments' then + key + else + (loc, { expression = expression'; comments = comments' }) + + method import _loc (expr : ('loc, 'loc) Ast.Expression.Import.t) = + let open Ast.Expression.Import in + let { argument; comments } = expr in + let argument' = this#expression argument in + let comments' = this#syntax_opt comments in + if argument == argument' && comments == comments' then + expr + else + { argument = argument'; comments = comments' } + + method if_consequent_statement ~has_else (stmt : ('loc, 'loc) Ast.Statement.t) = + ignore has_else; + this#statement stmt + + method if_alternate_statement _loc (altern : ('loc, 'loc) Ast.Statement.If.Alternate.t') = + let open Ast.Statement.If.Alternate in + let { body; comments } = altern in + let body' = this#statement body in + let comments' = this#syntax_opt comments in + if body == body' && comments == comments' then + altern + else + { body = body'; comments = comments' } + + method if_statement _loc (stmt : ('loc, 'loc) Ast.Statement.If.t) = + let open Ast.Statement.If in + let { test; consequent; alternate; comments } = stmt in + let test' = this#predicate_expression test in + let consequent' = this#if_consequent_statement ~has_else:(alternate <> None) consequent in + let alternate' = map_opt (map_loc this#if_alternate_statement) alternate in + let comments' = this#syntax_opt comments in + if + test == test' + && consequent == consequent' + && alternate == alternate' + && comments == comments' + then + stmt + else + { test = test'; consequent = consequent'; alternate = alternate'; comments = comments' } + + method import_declaration _loc (decl : ('loc, 'loc) Ast.Statement.ImportDeclaration.t) = + let open Ast.Statement.ImportDeclaration in + let { import_kind; source; specifiers; default; comments } = decl in + let specifiers' = map_opt this#import_specifier specifiers in + let default' = map_opt this#import_default_specifier default in + let comments' = this#syntax_opt comments in + if specifiers == specifiers' && default == default' && comments == comments' then + decl + else + { import_kind; source; specifiers = specifiers'; default = default'; comments = comments' } + + method import_specifier (specifier : ('loc, 'loc) Ast.Statement.ImportDeclaration.specifier) = + let open Ast.Statement.ImportDeclaration in + match specifier with + | ImportNamedSpecifiers named_specifiers -> + let named_specifiers' = map_list this#import_named_specifier named_specifiers in + if named_specifiers == named_specifiers' then + specifier + else + ImportNamedSpecifiers named_specifiers' + | ImportNamespaceSpecifier (loc, ident) -> + id_loc this#import_namespace_specifier loc ident specifier (fun ident -> + ImportNamespaceSpecifier (loc, ident)) + + method import_named_specifier + (specifier : ('loc, 'loc) Ast.Statement.ImportDeclaration.named_specifier) = + let open Ast.Statement.ImportDeclaration in + let { kind; local; remote } = specifier in + let remote' = this#identifier remote in + let local' = + match local with + | None -> None + | Some ident -> + id + (this#pattern_identifier ~kind:Ast.Statement.VariableDeclaration.Let) + ident + local + (fun ident -> Some ident) + in + if local == local' && remote == remote' then + specifier + else + { kind; local = local'; remote = remote' } + + method import_default_specifier (id : ('loc, 'loc) Ast.Identifier.t) = + this#pattern_identifier ~kind:Ast.Statement.VariableDeclaration.Let id + + method import_namespace_specifier _loc (id : ('loc, 'loc) Ast.Identifier.t) = + this#pattern_identifier ~kind:Ast.Statement.VariableDeclaration.Let id + + method jsx_element _loc (expr : ('loc, 'loc) Ast.JSX.element) = + let open Ast.JSX in + let { opening_element; closing_element; children; comments } = expr in + let opening_element' = this#jsx_opening_element opening_element in + let closing_element' = map_opt this#jsx_closing_element closing_element in + let children' = this#jsx_children children in + let comments' = this#syntax_opt comments in + if + opening_element == opening_element' + && closing_element == closing_element' + && children == children' + && comments == comments' + then + expr + else + { + opening_element = opening_element'; + closing_element = closing_element'; + children = children'; + comments = comments'; + } + + method jsx_fragment _loc (expr : ('loc, 'loc) Ast.JSX.fragment) = + let open Ast.JSX in + let { frag_children; frag_comments; _ } = expr in + let children' = this#jsx_children frag_children in + let frag_comments' = this#syntax_opt frag_comments in + if frag_children == children' && frag_comments == frag_comments' then + expr + else + { expr with frag_children = children'; frag_comments = frag_comments' } + + method jsx_opening_element (elem : ('loc, 'loc) Ast.JSX.Opening.t) = + let open Ast.JSX.Opening in + let (loc, { name; self_closing; attributes }) = elem in + let name' = this#jsx_name name in + let attributes' = map_list this#jsx_opening_attribute attributes in + if name == name' && attributes == attributes' then + elem + else + (loc, { name = name'; self_closing; attributes = attributes' }) + + method jsx_closing_element (elem : ('loc, 'loc) Ast.JSX.Closing.t) = + let open Ast.JSX.Closing in + let (loc, { name }) = elem in + let name' = this#jsx_name name in + if name == name' then + elem + else + (loc, { name = name' }) + + method jsx_opening_attribute (jsx_attr : ('loc, 'loc) Ast.JSX.Opening.attribute) = + let open Ast.JSX.Opening in + match jsx_attr with + | Attribute attr -> id this#jsx_attribute attr jsx_attr (fun attr -> Attribute attr) + | SpreadAttribute (loc, attr) -> + id_loc this#jsx_spread_attribute loc attr jsx_attr (fun attr -> SpreadAttribute (loc, attr)) + + method jsx_spread_attribute _loc (attr : ('loc, 'loc) Ast.JSX.SpreadAttribute.t') = + let open Ast.JSX.SpreadAttribute in + let { argument; comments } = attr in + let argument' = this#expression argument in + let comments' = this#syntax_opt comments in + if argument == argument' && comments == comments' then + attr + else + { argument = argument'; comments = comments' } + + method jsx_attribute (attr : ('loc, 'loc) Ast.JSX.Attribute.t) = + let open Ast.JSX.Attribute in + let (loc, { name; value }) = attr in + let value' = map_opt this#jsx_attribute_value value in + if value == value' then + attr + else + (loc, { name; value = value' }) + + method jsx_attribute_value (value : ('loc, 'loc) Ast.JSX.Attribute.value) = + let open Ast.JSX.Attribute in + match value with + | Literal _ -> value + | ExpressionContainer (loc, expr) -> + id_loc this#jsx_expression loc expr value (fun expr -> ExpressionContainer (loc, expr)) + + method jsx_children ((loc, children) as orig : 'loc * ('loc, 'loc) Ast.JSX.child list) = + let children' = map_list this#jsx_child children in + if children == children' then + orig + else + (loc, children') + + method jsx_child (child : ('loc, 'loc) Ast.JSX.child) = + let open Ast.JSX in + match child with + | (loc, Element elem) -> + id_loc this#jsx_element loc elem child (fun elem -> (loc, Element elem)) + | (loc, Fragment frag) -> + id_loc this#jsx_fragment loc frag child (fun frag -> (loc, Fragment frag)) + | (loc, ExpressionContainer expr) -> + id_loc this#jsx_expression loc expr child (fun expr -> (loc, ExpressionContainer expr)) + | (loc, SpreadChild spread) -> + id this#jsx_spread_child spread child (fun spread -> (loc, SpreadChild spread)) + | (_loc, Text _) -> child + + method jsx_expression _loc (jsx_expr : ('loc, 'loc) Ast.JSX.ExpressionContainer.t) = + let open Ast.JSX.ExpressionContainer in + let { expression; comments } = jsx_expr in + let comments' = this#syntax_opt comments in + match expression with + | Expression expr -> + let expr' = this#expression expr in + if expr == expr' && comments == comments' then + jsx_expr + else + { expression = Expression expr'; comments = comments' } + | EmptyExpression -> + if comments == comments' then + jsx_expr + else + { expression = EmptyExpression; comments = comments' } + + method jsx_spread_child (jsx_spread_child : ('loc, 'loc) Ast.JSX.SpreadChild.t) = + let open Ast.JSX.SpreadChild in + let { expression; comments } = jsx_spread_child in + let expression' = this#expression expression in + let comments' = this#syntax_opt comments in + if expression == expression' && comments == comments' then + jsx_spread_child + else + { expression = expression'; comments = comments' } + + method jsx_name (name : ('loc, 'loc) Ast.JSX.name) = + let open Ast.JSX in + let name' = + match name with + | Identifier id -> Identifier (this#jsx_identifier id) + | NamespacedName namespaced_name -> + NamespacedName (this#jsx_namespaced_name namespaced_name) + | MemberExpression member_exp -> MemberExpression (this#jsx_member_expression member_exp) + in + (* structural equality since it's easier than checking equality in each branch of the match + * above *) + if name = name' then + name + else + name' + + method jsx_namespaced_name (namespaced_name : ('loc, 'loc) Ast.JSX.NamespacedName.t) = + let open Ast.JSX in + NamespacedName.( + let (loc, { namespace; name }) = namespaced_name in + let namespace' = this#jsx_identifier namespace in + let name' = this#jsx_identifier name in + if namespace == namespace' && name == name' then + namespaced_name + else + (loc, { namespace = namespace'; name = name' })) + + method jsx_member_expression (member_exp : ('loc, 'loc) Ast.JSX.MemberExpression.t) = + let open Ast.JSX in + let (loc, { MemberExpression._object; MemberExpression.property }) = member_exp in + let _object' = + match _object with + | MemberExpression.Identifier id -> + let id' = this#jsx_identifier id in + if id' == id then + _object + else + MemberExpression.Identifier id' + | MemberExpression.MemberExpression nested_exp -> + let nested_exp' = this#jsx_member_expression nested_exp in + if nested_exp' == nested_exp then + _object + else + MemberExpression.MemberExpression nested_exp' + in + let property' = this#jsx_identifier property in + if _object == _object' && property == property' then + member_exp + else + (loc, MemberExpression.{ _object = _object'; property = property' }) + + method jsx_identifier (id : ('loc, 'loc) Ast.JSX.Identifier.t) = + let open Ast.JSX.Identifier in + let (loc, { name; comments }) = id in + let comments' = this#syntax_opt comments in + if comments == comments' then + id + else + (loc, { name; comments = comments' }) + + method labeled_statement _loc (stmt : ('loc, 'loc) Ast.Statement.Labeled.t) = + let open Ast.Statement.Labeled in + let { label; body; comments } = stmt in + let label' = this#label_identifier label in + let body' = this#statement body in + let comments' = this#syntax_opt comments in + if label == label' && body == body' && comments == comments' then + stmt + else + { label = label'; body = body'; comments = comments' } + + method literal _loc (expr : 'loc Ast.Literal.t) = + let open Ast.Literal in + let { value; raw; comments } = expr in + let comments' = this#syntax_opt comments in + if comments == comments' then + expr + else + { value; raw; comments = comments' } + + method logical _loc (expr : ('loc, 'loc) Ast.Expression.Logical.t) = + let open Ast.Expression.Logical in + let { operator = _; left; right; comments } = expr in + let left' = this#expression left in + let right' = this#expression right in + let comments' = this#syntax_opt comments in + if left == left' && right == right' && comments == comments' then + expr + else + { expr with left = left'; right = right'; comments = comments' } + + method member _loc (expr : ('loc, 'loc) Ast.Expression.Member.t) = + let open Ast.Expression.Member in + let { _object; property; comments } = expr in + let _object' = this#expression _object in + let property' = this#member_property property in + let comments' = this#syntax_opt comments in + if _object == _object' && property == property' && comments == comments' then + expr + else + { _object = _object'; property = property'; comments = comments' } + + method optional_member loc (expr : ('loc, 'loc) Ast.Expression.OptionalMember.t) = + let open Ast.Expression.OptionalMember in + let { member; optional = _ } = expr in + let member' = this#member loc member in + if member == member' then + expr + else + { expr with member = member' } + + method member_property (expr : ('loc, 'loc) Ast.Expression.Member.property) = + let open Ast.Expression.Member in + match expr with + | PropertyIdentifier ident -> + id this#member_property_identifier ident expr (fun ident -> PropertyIdentifier ident) + | PropertyPrivateName ident -> + id this#member_private_name ident expr (fun ident -> PropertyPrivateName ident) + | PropertyExpression e -> + id this#member_property_expression e expr (fun e -> PropertyExpression e) + + method member_property_identifier (ident : ('loc, 'loc) Ast.Identifier.t) = + this#identifier ident + + method member_private_name (name : 'loc Ast.PrivateName.t) = this#private_name name + + method member_property_expression (expr : ('loc, 'loc) Ast.Expression.t) = this#expression expr + + method meta_property _loc (expr : 'loc Ast.Expression.MetaProperty.t) = + let open Ast.Expression.MetaProperty in + let { meta; property; comments } = expr in + let meta' = this#identifier meta in + let property' = this#identifier property in + let comments' = this#syntax_opt comments in + if meta == meta' && property == property' && comments == comments' then + expr + else + { meta = meta'; property = property'; comments = comments' } + + method new_ _loc (expr : ('loc, 'loc) Ast.Expression.New.t) = + let open Ast.Expression.New in + let { callee; targs; arguments; comments } = expr in + let callee' = this#expression callee in + let targs' = map_opt this#call_type_args targs in + let arguments' = map_opt this#call_arguments arguments in + let comments' = this#syntax_opt comments in + if callee == callee' && targs == targs' && arguments == arguments' && comments == comments' + then + expr + else + { callee = callee'; targs = targs'; arguments = arguments'; comments = comments' } + + method object_ _loc (expr : ('loc, 'loc) Ast.Expression.Object.t) = + let open Ast.Expression.Object in + let { properties; comments } = expr in + let properties' = + map_list + (fun prop -> + match prop with + | Property p -> + let p' = this#object_property p in + if p == p' then + prop + else + Property p' + | SpreadProperty s -> + let s' = this#spread_property s in + if s == s' then + prop + else + SpreadProperty s') + properties + in + let comments' = this#syntax_opt comments in + if properties == properties' && comments == comments' then + expr + else + { properties = properties'; comments = comments' } + + method object_property (prop : ('loc, 'loc) Ast.Expression.Object.Property.t) = + let open Ast.Expression.Object.Property in + match prop with + | (loc, Init { key; value; shorthand }) -> + let key' = this#object_key key in + let value' = this#expression value in + if key == key' && value == value' then + prop + else + (loc, Init { key = key'; value = value'; shorthand }) + | (loc, Method { key; value = fn }) -> + let key' = this#object_key key in + let fn' = map_loc this#function_expression fn in + if key == key' && fn == fn' then + prop + else + (loc, Method { key = key'; value = fn' }) + | (loc, Get { key; value = fn; comments }) -> + let key' = this#object_key key in + let fn' = map_loc this#function_expression fn in + let comments' = this#syntax_opt comments in + if key == key' && fn == fn' && comments == comments' then + prop + else + (loc, Get { key = key'; value = fn'; comments = comments' }) + | (loc, Set { key; value = fn; comments }) -> + let key' = this#object_key key in + let fn' = map_loc this#function_expression fn in + let comments' = this#syntax_opt comments in + if key == key' && fn == fn' && comments == comments' then + prop + else + (loc, Set { key = key'; value = fn'; comments = comments' }) + + method object_key (key : ('loc, 'loc) Ast.Expression.Object.Property.key) = + let open Ast.Expression.Object.Property in + match key with + | Literal (loc, lit) -> id_loc this#literal loc lit key (fun lit -> Literal (loc, lit)) + | Identifier ident -> id this#object_key_identifier ident key (fun ident -> Identifier ident) + | PrivateName ident -> id this#private_name ident key (fun ident -> PrivateName ident) + | Computed computed -> id this#object_key_computed computed key (fun expr -> Computed expr) + + method object_key_identifier (ident : ('loc, 'loc) Ast.Identifier.t) = this#identifier ident + + method object_key_computed (key : ('loc, 'loc) Ast.ComputedKey.t) = this#computed_key key + + method opaque_type _loc (otype : ('loc, 'loc) Ast.Statement.OpaqueType.t) = + let open Ast.Statement.OpaqueType in + let { id; tparams; impltype; supertype; comments } = otype in + let id' = this#identifier id in + let tparams' = map_opt this#type_params tparams in + let impltype' = map_opt this#type_ impltype in + let supertype' = map_opt this#type_ supertype in + let comments' = this#syntax_opt comments in + if + id == id' + && impltype == impltype' + && tparams == tparams' + && impltype == impltype' + && supertype == supertype' + && comments == comments' + then + otype + else + { + id = id'; + tparams = tparams'; + impltype = impltype'; + supertype = supertype'; + comments = comments'; + } + + method function_param_pattern (expr : ('loc, 'loc) Ast.Pattern.t) = this#binding_pattern expr + + method variable_declarator_pattern ~kind (expr : ('loc, 'loc) Ast.Pattern.t) = + this#binding_pattern ~kind expr + + method catch_clause_pattern (expr : ('loc, 'loc) Ast.Pattern.t) = + this#binding_pattern ~kind:Ast.Statement.VariableDeclaration.Let expr + + method for_in_assignment_pattern (expr : ('loc, 'loc) Ast.Pattern.t) = + this#assignment_pattern expr + + method for_of_assignment_pattern (expr : ('loc, 'loc) Ast.Pattern.t) = + this#assignment_pattern expr + + method binding_pattern + ?(kind = Ast.Statement.VariableDeclaration.Var) (expr : ('loc, 'loc) Ast.Pattern.t) = + this#pattern ~kind expr + + method assignment_pattern (expr : ('loc, 'loc) Ast.Pattern.t) = this#pattern expr + + (* NOTE: Patterns are highly overloaded. A pattern can be a binding pattern, + which has a kind (Var/Let/Const, with Var being the default for all pre-ES5 + bindings), or an assignment pattern, which has no kind. Subterms that are + patterns inherit the kind (or lack thereof). *) + method pattern ?kind (expr : ('loc, 'loc) Ast.Pattern.t) = + let open Ast.Pattern in + let (loc, patt) = expr in + let patt' = + match patt with + | Object { Object.properties; annot; comments } -> + let properties' = map_list (this#pattern_object_p ?kind) properties in + let annot' = this#type_annotation_hint annot in + let comments' = this#syntax_opt comments in + if properties' == properties && annot' == annot && comments' == comments then + patt + else + Object { Object.properties = properties'; annot = annot'; comments = comments' } + | Array { Array.elements; annot; comments } -> + let elements' = map_list (this#pattern_array_e ?kind) elements in + let annot' = this#type_annotation_hint annot in + let comments' = this#syntax_opt comments in + if comments == comments' && elements' == elements && annot' == annot then + patt + else + Array { Array.elements = elements'; annot = annot'; comments = comments' } + | Identifier { Identifier.name; annot; optional } -> + let name' = this#pattern_identifier ?kind name in + let annot' = this#type_annotation_hint annot in + if name == name' && annot == annot' then + patt + else + Identifier { Identifier.name = name'; annot = annot'; optional } + | Expression e -> id this#pattern_expression e patt (fun e -> Expression e) + in + if patt == patt' then + expr + else + (loc, patt') + + method pattern_identifier ?kind (ident : ('loc, 'loc) Ast.Identifier.t) = + ignore kind; + this#identifier ident + + method pattern_literal ?kind loc (expr : 'loc Ast.Literal.t) = + ignore kind; + this#literal loc expr + + method pattern_object_p ?kind (p : ('loc, 'loc) Ast.Pattern.Object.property) = + let open Ast.Pattern.Object in + match p with + | Property (loc, prop) -> + id (this#pattern_object_property ?kind) prop p (fun prop -> Property (loc, prop)) + | RestElement (loc, prop) -> + id (this#pattern_object_rest_property ?kind) prop p (fun prop -> RestElement (loc, prop)) + + method pattern_object_property ?kind (prop : ('loc, 'loc) Ast.Pattern.Object.Property.t') = + let open Ast.Pattern.Object.Property in + let { key; pattern; default; shorthand = _ } = prop in + let key' = this#pattern_object_property_key ?kind key in + let pattern' = this#pattern_object_property_pattern ?kind pattern in + let default' = map_opt this#expression default in + if key' == key && pattern' == pattern && default' == default then + prop + else + { key = key'; pattern = pattern'; default = default'; shorthand = false } + + method pattern_object_property_key ?kind (key : ('loc, 'loc) Ast.Pattern.Object.Property.key) = + let open Ast.Pattern.Object.Property in + match key with + | Literal (loc, lit) -> + id_loc (this#pattern_object_property_literal_key ?kind) loc lit key (fun lit' -> + Literal (loc, lit')) + | Identifier identifier -> + id (this#pattern_object_property_identifier_key ?kind) identifier key (fun id' -> + Identifier id') + | Computed expr -> + id (this#pattern_object_property_computed_key ?kind) expr key (fun expr' -> Computed expr') + + method pattern_object_property_literal_key ?kind loc (key : 'loc Ast.Literal.t) = + this#pattern_literal ?kind loc key + + method pattern_object_property_identifier_key ?kind (key : ('loc, 'loc) Ast.Identifier.t) = + this#pattern_identifier ?kind key + + method pattern_object_property_computed_key ?kind (key : ('loc, 'loc) Ast.ComputedKey.t) = + ignore kind; + this#computed_key key + + method pattern_object_rest_property ?kind (prop : ('loc, 'loc) Ast.Pattern.RestElement.t') = + let open Ast.Pattern.RestElement in + let { argument; comments } = prop in + let argument' = this#pattern_object_rest_property_pattern ?kind argument in + let comments' = this#syntax_opt comments in + if argument' == argument && comments == comments' then + prop + else + { argument = argument'; comments = comments' } + + method pattern_object_property_pattern ?kind (expr : ('loc, 'loc) Ast.Pattern.t) = + this#pattern ?kind expr + + method pattern_object_rest_property_pattern ?kind (expr : ('loc, 'loc) Ast.Pattern.t) = + this#pattern ?kind expr + + method pattern_array_e ?kind (e : ('loc, 'loc) Ast.Pattern.Array.element) = + let open Ast.Pattern.Array in + match e with + | Hole _ -> e + | Element (loc, elem) -> + id (this#pattern_array_element ?kind) elem e (fun elem -> Element (loc, elem)) + | RestElement (loc, elem) -> + id (this#pattern_array_rest_element ?kind) elem e (fun elem -> RestElement (loc, elem)) + + method pattern_array_element ?kind (elem : ('loc, 'loc) Ast.Pattern.Array.Element.t') = + let open Ast.Pattern.Array.Element in + let { argument; default } = elem in + let argument' = this#pattern_array_element_pattern ?kind argument in + let default' = map_opt this#expression default in + if argument == argument' && default == default' then + elem + else + { argument = argument'; default = default' } + + method pattern_array_element_pattern ?kind (patt : ('loc, 'loc) Ast.Pattern.t) = + this#pattern ?kind patt + + method pattern_array_rest_element ?kind (elem : ('loc, 'loc) Ast.Pattern.RestElement.t') = + let open Ast.Pattern.RestElement in + let { argument; comments } = elem in + let argument' = this#pattern_array_rest_element_pattern ?kind argument in + let comments' = this#syntax_opt comments in + if argument' == argument && comments == comments' then + elem + else + { argument = argument'; comments = comments' } + + method pattern_array_rest_element_pattern ?kind (expr : ('loc, 'loc) Ast.Pattern.t) = + this#pattern ?kind expr + + method pattern_assignment_pattern ?kind (expr : ('loc, 'loc) Ast.Pattern.t) = + this#pattern ?kind expr + + method pattern_expression (expr : ('loc, 'loc) Ast.Expression.t) = this#expression expr + + method predicate (pred : ('loc, 'loc) Ast.Type.Predicate.t) = + let open Ast.Type.Predicate in + let (loc, { kind; comments }) = pred in + let kind' = + match kind with + | Inferred -> kind + | Declared expr -> id this#expression expr kind (fun expr' -> Declared expr') + in + let comments' = this#syntax_opt comments in + if kind == kind' && comments == comments' then + pred + else + (loc, { kind = kind'; comments = comments' }) + + method predicate_expression (expr : ('loc, 'loc) Ast.Expression.t) = this#expression expr + + method function_rest_param (expr : ('loc, 'loc) Ast.Function.RestParam.t) = + let open Ast.Function.RestParam in + let (loc, { argument; comments }) = expr in + let argument' = this#binding_pattern argument in + let comments' = this#syntax_opt comments in + if argument == argument' && comments == comments' then + expr + else + (loc, { argument = argument'; comments = comments' }) + + method return _loc (stmt : ('loc, 'loc) Ast.Statement.Return.t) = + let open Ast.Statement.Return in + let { argument; comments } = stmt in + let argument' = map_opt this#expression argument in + let comments' = this#syntax_opt comments in + if argument == argument' && comments == comments' then + stmt + else + { argument = argument'; comments = comments' } + + method sequence _loc (expr : ('loc, 'loc) Ast.Expression.Sequence.t) = + let open Ast.Expression.Sequence in + let { expressions; comments } = expr in + let expressions' = map_list this#expression expressions in + let comments' = this#syntax_opt comments in + if expressions == expressions' && comments == comments' then + expr + else + { expressions = expressions'; comments = comments' } + + method toplevel_statement_list (stmts : ('loc, 'loc) Ast.Statement.t list) = + this#statement_list stmts + + method statement_list (stmts : ('loc, 'loc) Ast.Statement.t list) = + map_list_multiple this#statement_fork_point stmts + + method statement_fork_point (stmt : ('loc, 'loc) Ast.Statement.t) = [this#statement stmt] + + method spread_element (expr : ('loc, 'loc) Ast.Expression.SpreadElement.t) = + let open Ast.Expression.SpreadElement in + let (loc, { argument; comments }) = expr in + let argument' = this#expression argument in + let comments' = this#syntax_opt comments in + if argument == argument' && comments == comments' then + expr + else + (loc, { argument = argument'; comments = comments' }) + + method spread_property (expr : ('loc, 'loc) Ast.Expression.Object.SpreadProperty.t) = + let open Ast.Expression.Object.SpreadProperty in + let (loc, { argument; comments }) = expr in + let argument' = this#expression argument in + let comments' = this#syntax_opt comments in + if argument == argument' && comments == comments' then + expr + else + (loc, { argument = argument'; comments = comments' }) + + method super_expression _loc (expr : 'loc Ast.Expression.Super.t) = + let open Ast.Expression.Super in + let { comments } = expr in + let comments' = this#syntax_opt comments in + if comments == comments' then + expr + else + { comments = comments' } + + method switch _loc (switch : ('loc, 'loc) Ast.Statement.Switch.t) = + let open Ast.Statement.Switch in + let { discriminant; cases; comments } = switch in + let discriminant' = this#expression discriminant in + let cases' = map_list (map_loc this#switch_case) cases in + let comments' = this#syntax_opt comments in + if discriminant == discriminant' && cases == cases' && comments == comments' then + switch + else + { discriminant = discriminant'; cases = cases'; comments = comments' } + + method switch_case _loc (case : ('loc, 'loc) Ast.Statement.Switch.Case.t') = + let open Ast.Statement.Switch.Case in + let { test; consequent; comments } = case in + let test' = map_opt this#expression test in + let consequent' = this#statement_list consequent in + let comments' = this#syntax_opt comments in + if test == test' && consequent == consequent' && comments == comments' then + case + else + { test = test'; consequent = consequent'; comments = comments' } + + method tagged_template _loc (expr : ('loc, 'loc) Ast.Expression.TaggedTemplate.t) = + let open Ast.Expression.TaggedTemplate in + let { tag; quasi; comments } = expr in + let tag' = this#expression tag in + let quasi' = map_loc this#template_literal quasi in + let comments' = this#syntax_opt comments in + if tag == tag' && quasi == quasi' && comments == comments' then + expr + else + { tag = tag'; quasi = quasi'; comments = comments' } + + method template_literal _loc (expr : ('loc, 'loc) Ast.Expression.TemplateLiteral.t) = + let open Ast.Expression.TemplateLiteral in + let { quasis; expressions; comments } = expr in + let quasis' = map_list this#template_literal_element quasis in + let expressions' = map_list this#expression expressions in + let comments' = this#syntax_opt comments in + if quasis == quasis' && expressions == expressions' && comments == comments' then + expr + else + { quasis = quasis'; expressions = expressions'; comments = comments' } + + (* TODO *) + method template_literal_element (elem : 'loc Ast.Expression.TemplateLiteral.Element.t) = elem + + method this_expression _loc (expr : 'loc Ast.Expression.This.t) = + let open Ast.Expression.This in + let { comments } = expr in + let comments' = this#syntax_opt comments in + if comments == comments' then + expr + else + { comments = comments' } + + method throw _loc (stmt : ('loc, 'loc) Ast.Statement.Throw.t) = + let open Ast.Statement.Throw in + let { argument; comments } = stmt in + let argument' = this#expression argument in + let comments' = this#syntax_opt comments in + if argument == argument' && comments == comments' then + stmt + else + { argument = argument'; comments = comments' } + + method try_catch _loc (stmt : ('loc, 'loc) Ast.Statement.Try.t) = + let open Ast.Statement.Try in + let { block; handler; finalizer; comments } = stmt in + let block' = map_loc this#block block in + let handler' = + match handler with + | Some (loc, clause) -> + id_loc this#catch_clause loc clause handler (fun clause -> Some (loc, clause)) + | None -> handler + in + let finalizer' = + match finalizer with + | Some (finalizer_loc, block) -> + id_loc this#block finalizer_loc block finalizer (fun block -> Some (finalizer_loc, block)) + | None -> finalizer + in + let comments' = this#syntax_opt comments in + if block == block' && handler == handler' && finalizer == finalizer' && comments == comments' + then + stmt + else + { block = block'; handler = handler'; finalizer = finalizer'; comments = comments' } + + method type_cast _loc (expr : ('loc, 'loc) Ast.Expression.TypeCast.t) = + let open Ast.Expression.TypeCast in + let { expression; annot; comments } = expr in + let expression' = this#expression expression in + let annot' = this#type_annotation annot in + let comments' = this#syntax_opt comments in + if expression' == expression && annot' == annot && comments' == comments then + expr + else + { expression = expression'; annot = annot'; comments = comments' } + + method unary_expression _loc (expr : ('loc, 'loc) Flow_ast.Expression.Unary.t) = + let open Flow_ast.Expression.Unary in + let { argument; operator = _; comments } = expr in + let argument' = this#expression argument in + let comments' = this#syntax_opt comments in + if argument == argument' && comments == comments' then + expr + else + { expr with argument = argument'; comments = comments' } + + method update_expression _loc (expr : ('loc, 'loc) Ast.Expression.Update.t) = + let open Ast.Expression.Update in + let { argument; operator = _; prefix = _; comments } = expr in + let argument' = this#expression argument in + let comments' = this#syntax_opt comments in + if argument == argument' && comments == comments' then + expr + else + { expr with argument = argument'; comments = comments' } + + method variable_declaration _loc (decl : ('loc, 'loc) Ast.Statement.VariableDeclaration.t) = + let open Ast.Statement.VariableDeclaration in + let { declarations; kind; comments } = decl in + let decls' = map_list (this#variable_declarator ~kind) declarations in + let comments' = this#syntax_opt comments in + if declarations == decls' && comments = comments' then + decl + else + { declarations = decls'; kind; comments = comments' } + + method variable_declarator + ~kind (decl : ('loc, 'loc) Ast.Statement.VariableDeclaration.Declarator.t) = + let open Ast.Statement.VariableDeclaration.Declarator in + let (loc, { id; init }) = decl in + let id' = this#variable_declarator_pattern ~kind id in + let init' = map_opt this#expression init in + if id == id' && init == init' then + decl + else + (loc, { id = id'; init = init' }) + + method while_ _loc (stuff : ('loc, 'loc) Ast.Statement.While.t) = + let open Ast.Statement.While in + let { test; body; comments } = stuff in + let test' = this#predicate_expression test in + let body' = this#statement body in + let comments' = this#syntax_opt comments in + if test == test' && body == body' && comments == comments' then + stuff + else + { test = test'; body = body'; comments = comments' } + + method with_ _loc (stuff : ('loc, 'loc) Ast.Statement.With.t) = + let open Ast.Statement.With in + let { _object; body; comments } = stuff in + let _object' = this#expression _object in + let body' = this#statement body in + let comments' = this#syntax_opt comments in + if _object == _object' && body == body' && comments == comments' then + stuff + else + { _object = _object'; body = body'; comments = comments' } + + method type_alias _loc (stuff : ('loc, 'loc) Ast.Statement.TypeAlias.t) = + let open Ast.Statement.TypeAlias in + let { id; tparams; right; comments } = stuff in + let id' = this#identifier id in + let tparams' = map_opt this#type_params tparams in + let right' = this#type_ right in + let comments' = this#syntax_opt comments in + if id == id' && right == right' && tparams == tparams' && comments == comments' then + stuff + else + { id = id'; tparams = tparams'; right = right'; comments = comments' } + + method yield _loc (expr : ('loc, 'loc) Ast.Expression.Yield.t) = + let open Ast.Expression.Yield in + let { argument; delegate; comments } = expr in + let argument' = map_opt this#expression argument in + let comments' = this#syntax_opt comments in + if comments = comments' && argument == argument' then + expr + else + { argument = argument'; delegate; comments = comments' } + end + +let fold_program (mappers : 'a mapper list) ast = + List.fold_left (fun ast (m : 'a mapper) -> m#program ast) ast mappers diff --git a/lib/flow_ast_utils.ml b/lib/flow_ast_utils.ml new file mode 100644 index 0000000..f1ff1ac --- /dev/null +++ b/lib/flow_ast_utils.ml @@ -0,0 +1,232 @@ +(* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + *) + +open Flow_ast + +type 'loc binding = 'loc * string + +type 'loc ident = 'loc * string [@@deriving show] + +type 'loc source = 'loc * string [@@deriving show] + +let rec fold_bindings_of_pattern = + Pattern.( + let property f acc = + Object.( + function + | Property (_, { Property.pattern = p; _ }) + | RestElement (_, { RestElement.argument = p; comments = _ }) -> + fold_bindings_of_pattern f acc p) + in + let element f acc = + Array.( + function + | Hole _ -> acc + | Element (_, { Element.argument = p; default = _ }) + | RestElement (_, { RestElement.argument = p; comments = _ }) -> + fold_bindings_of_pattern f acc p) + in + fun f acc -> function + | (_, Identifier { Identifier.name; annot; _ }) -> f acc name annot + | (_, Object { Object.properties; _ }) -> List.fold_left (property f) acc properties + | (_, Array { Array.elements; _ }) -> List.fold_left (element f) acc elements + (* This is for assignment and default param destructuring `[a.b=1]=c`, ignore these for now. *) + | (_, Expression _) -> acc) + +let fold_bindings_of_variable_declarations f acc declarations = + let open Flow_ast.Statement.VariableDeclaration in + List.fold_left + (fun acc -> function + | (_, { Declarator.id = pattern; _ }) -> fold_bindings_of_pattern f acc pattern) + acc + declarations + +let partition_directives statements = + let open Flow_ast.Statement in + let rec helper directives = function + | ((_, Expression { Expression.directive = Some _; _ }) as directive) :: rest -> + helper (directive :: directives) rest + | rest -> (List.rev directives, rest) + in + helper [] statements + +let negate_number_literal (value, raw) = + let raw_len = String.length raw in + let raw = + if raw_len > 0 && raw.[0] = '-' then + String.sub raw 1 (raw_len - 1) + else + "-" ^ raw + in + (~-.value, raw) + +let loc_of_statement = fst + +let loc_of_expression = fst + +let loc_of_pattern = fst + +let loc_of_ident = fst + +let name_of_ident (_, { Identifier.name; comments = _ }) = name + +let source_of_ident (loc, { Identifier.name; comments = _ }) = (loc, name) + +let ident_of_source ?comments (loc, name) = (loc, { Identifier.name; comments }) + +let mk_comments ?(leading = []) ?(trailing = []) a = { Syntax.leading; trailing; internal = a } + +let mk_comments_opt ?(leading = []) ?(trailing = []) () = + match (leading, trailing) with + | ([], []) -> None + | (_, _) -> Some (mk_comments ~leading ~trailing ()) + +let mk_comments_with_internal_opt ?(leading = []) ?(trailing = []) ~internal = + match (leading, trailing, internal) with + | ([], [], []) -> None + | _ -> Some (mk_comments ~leading ~trailing internal) + +let merge_comments ~inner ~outer = + let open Syntax in + match (inner, outer) with + | (None, c) + | (c, None) -> + c + | (Some inner, Some outer) -> + mk_comments_opt + ~leading:(outer.leading @ inner.leading) + ~trailing:(inner.trailing @ outer.trailing) + () + +let merge_comments_with_internal ~inner ~outer = + match (inner, outer) with + | (inner, None) -> inner + | (None, Some { Syntax.leading; trailing; _ }) -> + mk_comments_with_internal_opt ~leading ~trailing ~internal:[] + | ( Some { Syntax.leading = inner_leading; trailing = inner_trailing; internal }, + Some { Syntax.leading = outer_leading; trailing = outer_trailing; _ } ) -> + mk_comments_with_internal_opt + ~leading:(outer_leading @ inner_leading) + ~trailing:(inner_trailing @ outer_trailing) + ~internal + +let split_comments comments = + match comments with + | None -> (None, None) + | Some { Syntax.leading; trailing; _ } -> + (mk_comments_opt ~leading (), mk_comments_opt ~trailing ()) + +let string_of_assignment_operator op = + let open Flow_ast.Expression.Assignment in + match op with + | PlusAssign -> "+=" + | MinusAssign -> "-=" + | MultAssign -> "*=" + | ExpAssign -> "**=" + | DivAssign -> "/=" + | ModAssign -> "%=" + | LShiftAssign -> "<<=" + | RShiftAssign -> ">>=" + | RShift3Assign -> ">>>=" + | BitOrAssign -> "|=" + | BitXorAssign -> "^=" + | BitAndAssign -> "&=" + +let string_of_binary_operator op = + let open Flow_ast.Expression.Binary in + match op with + | Equal -> "==" + | NotEqual -> "!=" + | StrictEqual -> "===" + | StrictNotEqual -> "!==" + | LessThan -> "<" + | LessThanEqual -> "<=" + | GreaterThan -> ">" + | GreaterThanEqual -> ">=" + | LShift -> "<<" + | RShift -> ">>" + | RShift3 -> ">>>" + | Plus -> "+" + | Minus -> "-" + | Mult -> "*" + | Exp -> "**" + | Div -> "/" + | Mod -> "%" + | BitOr -> "|" + | Xor -> "^" + | BitAnd -> "&" + | In -> "in" + | Instanceof -> "instanceof" + +module ExpressionSort = struct + type t = + | Array + | ArrowFunction + | Assignment + | Binary + | Call + | Class + | Comprehension + | Conditional + | Function + | Generator + | Identifier + | Import + | JSXElement + | JSXFragment + | Literal + | Logical + | Member + | MetaProperty + | New + | Object + | OptionalCall + | OptionalMember + | Sequence + | Super + | TaggedTemplate + | TemplateLiteral + | This + | TypeCast + | Unary + | Update + | Yield + [@@deriving show] + + let to_string = function + | Array -> "array" + | ArrowFunction -> "arrow function" + | Assignment -> "assignment expression" + | Binary -> "binary expression" + | Call -> "call expression" + | Class -> "class" + | Comprehension -> "comprehension expression" + | Conditional -> "conditional expression" + | Function -> "function" + | Generator -> "generator" + | Identifier -> "identifier" + | Import -> "import expression" + | JSXElement -> "JSX element" + | JSXFragment -> "JSX fragment" + | Literal -> "literal" + | Logical -> "logical expression" + | Member -> "member expression" + | MetaProperty -> "metaproperty expression" + | New -> "new expression" + | Object -> "object" + | OptionalCall -> "optional call expression" + | OptionalMember -> "optional member expression" + | Sequence -> "sequence" + | Super -> "`super` reference" + | TaggedTemplate -> "tagged template expression" + | TemplateLiteral -> "template literal" + | This -> "`this` reference" + | TypeCast -> "type cast" + | Unary -> "unary expression" + | Update -> "update expression" + | Yield -> "yield expression" +end diff --git a/lib/flow_ast_utils.mli b/lib/flow_ast_utils.mli new file mode 100644 index 0000000..57fc15b --- /dev/null +++ b/lib/flow_ast_utils.mli @@ -0,0 +1,119 @@ +(* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + *) + +type 'loc binding = 'loc * string + +type 'loc ident = 'loc * string [@@deriving show] + +type 'loc source = 'loc * string [@@deriving show] + +val fold_bindings_of_pattern : + ('a -> ('loc, 'loc) Flow_ast.Identifier.t -> ('loc, 'loc) Flow_ast.Type.annotation_or_hint -> 'a) -> + 'a -> + ('loc, 'loc) Flow_ast.Pattern.t -> + 'a + +val fold_bindings_of_variable_declarations : + ('a -> ('loc, 'loc) Flow_ast.Identifier.t -> ('loc, 'loc) Flow_ast.Type.annotation_or_hint -> 'a) -> + 'a -> + ('loc, 'loc) Flow_ast.Statement.VariableDeclaration.Declarator.t list -> + 'a + +val partition_directives : + (Loc.t, Loc.t) Flow_ast.Statement.t list -> + (Loc.t, Loc.t) Flow_ast.Statement.t list * (Loc.t, Loc.t) Flow_ast.Statement.t list + +val negate_number_literal : float * string -> float * string + +val loc_of_expression : ('a, 'a) Flow_ast.Expression.t -> 'a + +val loc_of_statement : ('a, 'a) Flow_ast.Statement.t -> 'a + +val loc_of_pattern : ('a, 'a) Flow_ast.Pattern.t -> 'a + +val loc_of_ident : ('a, 'a) Flow_ast.Identifier.t -> 'a + +val name_of_ident : ('loc, 'a) Flow_ast.Identifier.t -> string + +val source_of_ident : ('a, 'a) Flow_ast.Identifier.t -> 'a source + +val ident_of_source : + ?comments:('a, unit) Flow_ast.Syntax.t -> 'a source -> ('a, 'a) Flow_ast.Identifier.t + +val mk_comments : + ?leading:'loc Flow_ast.Comment.t list -> + ?trailing:'loc Flow_ast.Comment.t list -> + 'a -> + ('loc, 'a) Flow_ast.Syntax.t + +val mk_comments_opt : + ?leading:'loc Flow_ast.Comment.t list -> + ?trailing:'loc Flow_ast.Comment.t list -> + unit -> + ('loc, unit) Flow_ast.Syntax.t option + +val mk_comments_with_internal_opt : + ?leading:'loc Flow_ast.Comment.t list -> + ?trailing:'loc Flow_ast.Comment.t list -> + internal:'loc Flow_ast.Comment.t list -> + ('loc, 'loc Flow_ast.Comment.t list) Flow_ast.Syntax.t option + +val merge_comments : + inner:('M, unit) Flow_ast.Syntax.t option -> + outer:('M, unit) Flow_ast.Syntax.t option -> + ('M, unit) Flow_ast.Syntax.t option + +val merge_comments_with_internal : + inner:('M, 'loc Flow_ast.Comment.t list) Flow_ast.Syntax.t option -> + outer:('M, 'a) Flow_ast.Syntax.t option -> + ('M, 'loc Flow_ast.Comment.t list) Flow_ast.Syntax.t option + +val split_comments : + ('loc, unit) Flow_ast.Syntax.t option -> + ('loc, unit) Flow_ast.Syntax.t option * ('loc, unit) Flow_ast.Syntax.t option + +module ExpressionSort : sig + type t = + | Array + | ArrowFunction + | Assignment + | Binary + | Call + | Class + | Comprehension + | Conditional + | Function + | Generator + | Identifier + | Import + | JSXElement + | JSXFragment + | Literal + | Logical + | Member + | MetaProperty + | New + | Object + | OptionalCall + | OptionalMember + | Sequence + | Super + | TaggedTemplate + | TemplateLiteral + | This + | TypeCast + | Unary + | Update + | Yield + [@@deriving show] + + val to_string : t -> string +end + +val string_of_assignment_operator : Flow_ast.Expression.Assignment.operator -> string + +val string_of_binary_operator : Flow_ast.Expression.Binary.operator -> string diff --git a/lib/flow_lexer.ml b/lib/flow_lexer.ml new file mode 100644 index 0000000..37668e2 --- /dev/null +++ b/lib/flow_lexer.ml @@ -0,0 +1,1796 @@ +(* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + *) + +[@@@warning "-39"] (* sedlex inserts some unnecessary `rec`s *) + +open Token +open Lex_env + +let lexeme = Sedlexing.Utf8.lexeme + +let sub_lexeme = Sedlexing.Utf8.sub_lexeme + +let letter = [%sedlex.regexp? 'a' .. 'z' | 'A' .. 'Z' | '$'] + +let id_letter = [%sedlex.regexp? letter | '_'] + +let digit = [%sedlex.regexp? '0' .. '9'] + +let digit_non_zero = [%sedlex.regexp? '1' .. '9'] + +let decintlit = [%sedlex.regexp? '0' | ('1' .. '9', Star digit)] + +(* DecimalIntegerLiteral *) + +let alphanumeric = [%sedlex.regexp? digit | letter] + +let word = [%sedlex.regexp? (letter, Star alphanumeric)] + +let hex_digit = [%sedlex.regexp? digit | 'a' .. 'f' | 'A' .. 'F'] + +let non_hex_letter = [%sedlex.regexp? 'g' .. 'z' | 'G' .. 'Z' | '$'] + +let bin_digit = [%sedlex.regexp? '0' | '1'] + +let oct_digit = [%sedlex.regexp? '0' .. '7'] + +(* This regex could be simplified to (digit Star (digit OR '_' digit)) + * That makes the underscore and failure cases faster, and the base case take x2-3 the steps + * As the codebase contains more base cases than underscored or errors, prefer this version *) +let underscored_bin = + [%sedlex.regexp? Plus bin_digit | (bin_digit, Star (bin_digit | ('_', bin_digit)))] + +let underscored_oct = + [%sedlex.regexp? Plus oct_digit | (oct_digit, Star (oct_digit | ('_', oct_digit)))] + +let underscored_hex = + [%sedlex.regexp? Plus hex_digit | (hex_digit, Star (hex_digit | ('_', hex_digit)))] + +let underscored_digit = [%sedlex.regexp? Plus digit | (digit_non_zero, Star (digit | ('_', digit)))] + +let underscored_decimal = [%sedlex.regexp? Plus digit | (digit, Star (digit | ('_', digit)))] + +(* Different ways you can write a number *) +let binnumber = [%sedlex.regexp? ('0', ('B' | 'b'), underscored_bin)] + +let octnumber = [%sedlex.regexp? ('0', ('O' | 'o'), underscored_oct)] + +let legacyoctnumber = [%sedlex.regexp? ('0', Plus oct_digit)] + +(* no underscores allowed *) + +let legacynonoctnumber = [%sedlex.regexp? ('0', Star oct_digit, '8' .. '9', Star digit)] + +let hexnumber = [%sedlex.regexp? ('0', ('X' | 'x'), underscored_hex)] + +let scinumber = + [%sedlex.regexp? + ( ((decintlit, Opt ('.', Opt underscored_decimal)) | ('.', underscored_decimal)), + ('e' | 'E'), + Opt ('-' | '+'), + underscored_digit )] + +let wholenumber = [%sedlex.regexp? (underscored_digit, Opt '.')] + +let floatnumber = [%sedlex.regexp? (Opt underscored_digit, '.', underscored_decimal)] + +let binbigint = [%sedlex.regexp? (binnumber, 'n')] + +let octbigint = [%sedlex.regexp? (octnumber, 'n')] + +let hexbigint = [%sedlex.regexp? (hexnumber, 'n')] + +let scibigint = [%sedlex.regexp? (scinumber, 'n')] + +let wholebigint = [%sedlex.regexp? (underscored_digit, 'n')] + +let floatbigint = [%sedlex.regexp? ((floatnumber | (underscored_digit, '.')), 'n')] + +(* 2-8 alphanumeric characters. I could match them directly, but this leads to + * ~5k more lines of generated lexer + let htmlentity = "quot" | "amp" | "apos" | "lt" | "gt" | "nbsp" | "iexcl" + | "cent" | "pound" | "curren" | "yen" | "brvbar" | "sect" | "uml" | "copy" + | "ordf" | "laquo" | "not" | "shy" | "reg" | "macr" | "deg" | "plusmn" + | "sup2" | "sup3" | "acute" | "micro" | "para" | "middot" | "cedil" | "sup1" + | "ordm" | "raquo" | "frac14" | "frac12" | "frac34" | "iquest" | "Agrave" + | "Aacute" | "Acirc" | "Atilde" | "Auml" | "Aring" | "AElig" | "Ccedil" + | "Egrave" | "Eacute" | "Ecirc" | "Euml" | "Igrave" | "Iacute" | "Icirc" + | "Iuml" | "ETH" | "Ntilde" | "Ograve" | "Oacute" | "Ocirc" | "Otilde" + | "Ouml" | "times" | "Oslash" | "Ugrave" | "Uacute" | "Ucirc" | "Uuml" + | "Yacute" | "THORN" | "szlig" | "agrave" | "aacute" | "acirc" | "atilde" + | "auml" | "aring" | "aelig" | "ccedil" | "egrave" | "eacute" | "ecirc" + | "euml" | "igrave" | "iacute" | "icirc" | "iuml" | "eth" | "ntilde" + | "ograve" | "oacute" | "ocirc" | "otilde" | "ouml" | "divide" | "oslash" + | "ugrave" | "uacute" | "ucirc" | "uuml" | "yacute" | "thorn" | "yuml" + | "OElig" | "oelig" | "Scaron" | "scaron" | "Yuml" | "fnof" | "circ" | "tilde" + | "Alpha" | "Beta" | "Gamma" | "Delta" | "Epsilon" | "Zeta" | "Eta" | "Theta" + | "Iota" | "Kappa" | "Lambda" | "Mu" | "Nu" | "Xi" | "Omicron" | "Pi" | "Rho" + | "Sigma" | "Tau" | "Upsilon" | "Phi" | "Chi" | "Psi" | "Omega" | "alpha" + | "beta" | "gamma" | "delta" | "epsilon" | "zeta" | "eta" | "theta" | "iota" + | "kappa" | "lambda" | "mu" | "nu" | "xi" | "omicron" | "pi" | "rho" + | "sigmaf" | "sigma" | "tau" | "upsilon" | "phi" | "chi" | "psi" | "omega" + | "thetasym" | "upsih" | "piv" | "ensp" | "emsp" | "thinsp" | "zwnj" | "zwj" + | "lrm" | "rlm" | "ndash" | "mdash" | "lsquo" | "rsquo" | "sbquo" | "ldquo" + | "rdquo" | "bdquo" | "dagger" | "Dagger" | "bull" | "hellip" | "permil" + | "prime" | "Prime" | "lsaquo" | "rsaquo" | "oline" | "frasl" | "euro" + | "image" | "weierp" | "real" | "trade" | "alefsym" | "larr" | "uarr" | "rarr" + | "darr" | "harr" | "crarr" | "lArr" | "uArr" | "rArr" | "dArr" | "hArr" + | "forall" | "part" | "exist" | "empty" | "nabla" | "isin" | "notin" | "ni" + | "prod" | "sum" | "minus" | "lowast" | "radic" | "prop" | "infin" | "ang" + | "and" | "or" | "cap" | "cup" | "'int'" | "there4" | "sim" | "cong" | "asymp" + | "ne" | "equiv" | "le" | "ge" | "sub" | "sup" | "nsub" | "sube" | "supe" + | "oplus" | "otimes" | "perp" | "sdot" | "lceil" | "rceil" | "lfloor" + | "rfloor" | "lang" | "rang" | "loz" | "spades" | "clubs" | "hearts" | "diams" + *) +let htmlentity = + [%sedlex.regexp? + ( alphanumeric, + alphanumeric, + Opt alphanumeric, + Opt alphanumeric, + Opt alphanumeric, + Opt alphanumeric, + Opt alphanumeric, + Opt alphanumeric )] + +(* https://tc39.github.io/ecma262/#sec-white-space *) +let whitespace = + [%sedlex.regexp? + ( 0x0009 | 0x000B | 0x000C | 0x0020 | 0x00A0 | 0xfeff | 0x1680 + | 0x2000 .. 0x200a + | 0x202f | 0x205f | 0x3000 )] + +(* minus sign in front of negative numbers + (only for types! regular numbers use T_MINUS!) *) +let neg = [%sedlex.regexp? ('-', Star whitespace)] + +let line_terminator_sequence = [%sedlex.regexp? '\n' | '\r' | "\r\n" | 0x2028 | 0x2029] + +let line_terminator_sequence_start = [%sedlex.regexp? '\n' | '\r' | 0x2028 | 0x2029] + +let hex_quad = [%sedlex.regexp? (hex_digit, hex_digit, hex_digit, hex_digit)] + +let unicode_escape = [%sedlex.regexp? ("\\u", hex_quad)] + +let codepoint_escape = [%sedlex.regexp? ("\\u{", Plus hex_digit, '}')] + +let js_id_start = [%sedlex.regexp? '$' | '_' | id_start | unicode_escape | codepoint_escape] + +let js_id_continue = + [%sedlex.regexp? '$' | '_' | 0x200C | 0x200D | id_continue | unicode_escape | codepoint_escape] + +let pos_at_offset env offset = + { Loc.line = Lex_env.line env; column = offset - Lex_env.bol_offset env } + +let loc_of_offsets env start_offset end_offset = + { + Loc.source = Lex_env.source env; + start = pos_at_offset env start_offset; + _end = pos_at_offset env end_offset; + } + +let start_pos_of_lexbuf env (lexbuf : Sedlexing.lexbuf) = + let start_offset = Sedlexing.lexeme_start lexbuf in + pos_at_offset env start_offset + +let end_pos_of_lexbuf env (lexbuf : Sedlexing.lexbuf) = + let end_offset = Sedlexing.lexeme_end lexbuf in + pos_at_offset env end_offset + +let loc_of_lexbuf env (lexbuf : Sedlexing.lexbuf) = + let start_offset = Sedlexing.lexeme_start lexbuf in + let end_offset = Sedlexing.lexeme_end lexbuf in + loc_of_offsets env start_offset end_offset + +let loc_of_token env lex_token = + match lex_token with + | T_STRING (loc, _, _, _) -> loc + | T_JSX_TEXT (loc, _, _) -> loc + | T_TEMPLATE_PART (loc, _, _) -> loc + | T_REGEXP (loc, _, _) -> loc + | _ -> loc_of_lexbuf env env.lex_lb + +let get_result_and_clear_state (env, lex_token, lex_loc, lex_comments) = + let (env, { lex_errors_acc }) = get_and_clear_state env in + (env, { Lex_result.lex_token; lex_loc; lex_errors = List.rev lex_errors_acc; lex_comments }) + +let lex_error (env : Lex_env.t) loc err : Lex_env.t = + let lex_errors_acc = (loc, err) :: env.lex_state.lex_errors_acc in + { env with lex_state = { lex_errors_acc } } + +let unexpected_error (env : Lex_env.t) (loc : Loc.t) value = + lex_error env loc (Parse_error.Unexpected (quote_token_value value)) + +let unexpected_error_w_suggest (env : Lex_env.t) (loc : Loc.t) value suggest = + lex_error env loc (Parse_error.UnexpectedTokenWithSuggestion (value, suggest)) + +let illegal (env : Lex_env.t) (loc : Loc.t) = + lex_error env loc (Parse_error.Unexpected "token ILLEGAL") + +let new_line env lexbuf = + let offset = Sedlexing.lexeme_end lexbuf in + let lex_bol = { line = Lex_env.line env + 1; offset } in + { env with Lex_env.lex_bol } + +let bigint_strip_n raw = + let size = String.length raw in + let str = + if size != 0 && raw.[size - 1] == 'n' then + String.sub raw 0 (size - 1) + else + raw + in + str + +let mk_comment + (env : Lex_env.t) + (start : Loc.position) + (_end : Loc.position) + (buf : Buffer.t) + (multiline : bool) : Loc.t Flow_ast.Comment.t = + let open Flow_ast.Comment in + let loc = { Loc.source = Lex_env.source env; start; _end } in + let text = Buffer.contents buf in + let kind = + if multiline then + Block + else + Line + in + let on_newline = Loc.(env.lex_last_loc._end.Loc.line < loc.start.Loc.line) in + let c = { kind; text; on_newline } in + (loc, c) + +let mk_num_singleton number_type raw = + let (neg, num) = + if raw.[0] = '-' then + (true, String.sub raw 1 (String.length raw - 1)) + else + (false, raw) + in + (* convert singleton number type into a float *) + let value = + match number_type with + | LEGACY_OCTAL -> + begin + try Int64.to_float (Int64.of_string ("0o" ^ num)) + with Failure _ -> failwith ("Invalid legacy octal " ^ num) + end + | BINARY + | OCTAL -> + begin + try Int64.to_float (Int64.of_string num) + with Failure _ -> failwith ("Invalid binary/octal " ^ num) + end + | LEGACY_NON_OCTAL + | NORMAL -> + begin + try float_of_string num with Failure _ -> failwith ("Invalid number " ^ num) + end + in + let value = + if neg then + ~-.value + else + value + in + T_NUMBER_SINGLETON_TYPE { kind = number_type; value; raw } + +let mk_bignum_singleton kind raw = + let (neg, num) = + if raw.[0] = '-' then + (true, String.sub raw 1 (String.length raw - 1)) + else + (false, raw) + in + (* convert singleton number type into a float *) + let value = + match kind with + | BIG_BINARY + | BIG_OCTAL -> + let postraw = bigint_strip_n num in + begin + try Int64.to_float (Int64.of_string postraw) + with Failure _ -> failwith ("Invalid (lexer) bigint binary/octal " ^ postraw) + end + | BIG_NORMAL -> + let postraw = bigint_strip_n num in + begin + try float_of_string postraw + with Failure _ -> failwith ("Invalid (lexer) bigint " ^ postraw) + end + in + let approx_value = + if neg then + ~-.value + else + value + in + T_BIGINT_SINGLETON_TYPE { kind; approx_value; raw } + +let decode_identifier = + let assert_valid_unicode_in_identifier env loc code = + let lexbuf = Sedlexing.from_int_array [| code |] in + match%sedlex lexbuf with + | js_id_start -> env + | js_id_continue -> env + | any + | eof -> + lex_error env loc Parse_error.IllegalUnicodeEscape + | _ -> failwith "unreachable" + in + let loc_and_sub_lexeme env offset lexbuf trim_start trim_end = + let start_offset = offset + Sedlexing.lexeme_start lexbuf in + let end_offset = offset + Sedlexing.lexeme_end lexbuf in + let loc = loc_of_offsets env start_offset end_offset in + (loc, sub_lexeme lexbuf trim_start (Sedlexing.lexeme_length lexbuf - trim_start - trim_end)) + in + let rec id_char env offset buf lexbuf = + match%sedlex lexbuf with + | unicode_escape -> + let (loc, hex) = loc_and_sub_lexeme env offset lexbuf 2 0 in + let code = int_of_string ("0x" ^ hex) in + let env = + if not (Uchar.is_valid code) then + lex_error env loc Parse_error.IllegalUnicodeEscape + else + assert_valid_unicode_in_identifier env loc code + in + Wtf8.add_wtf_8 buf code; + id_char env offset buf lexbuf + | codepoint_escape -> + let (loc, hex) = loc_and_sub_lexeme env offset lexbuf 3 1 in + let code = int_of_string ("0x" ^ hex) in + let env = assert_valid_unicode_in_identifier env loc code in + Wtf8.add_wtf_8 buf code; + id_char env offset buf lexbuf + | eof -> (env, Buffer.contents buf) + (* match multi-char substrings that don't contain the start chars of the above patterns *) + | Plus (Compl (eof | "\\")) + | any -> + let x = lexeme lexbuf in + Buffer.add_string buf x; + id_char env offset buf lexbuf + | _ -> failwith "unreachable" + in + fun env raw -> + let offset = Sedlexing.lexeme_start env.lex_lb in + let lexbuf = Sedlexing.Utf8.from_string raw in + let buf = Buffer.create (String.length raw) in + id_char env offset buf lexbuf + +let recover env lexbuf ~f = + let env = illegal env (loc_of_lexbuf env lexbuf) in + Sedlexing.rollback lexbuf; + f env lexbuf + +type jsx_text_mode = + | JSX_SINGLE_QUOTED_TEXT + | JSX_DOUBLE_QUOTED_TEXT + | JSX_CHILD_TEXT + +type result = + | Token of Lex_env.t * Token.t + | Comment of Lex_env.t * Loc.t Flow_ast.Comment.t + | Continue of Lex_env.t + +let rec comment env buf lexbuf = + match%sedlex lexbuf with + | line_terminator_sequence -> + let env = new_line env lexbuf in + Buffer.add_string buf (lexeme lexbuf); + comment env buf lexbuf + | "*/" -> + let env = + if is_in_comment_syntax env then + let loc = loc_of_lexbuf env lexbuf in + unexpected_error_w_suggest env loc "*/" "*-/" + else + env + in + (env, end_pos_of_lexbuf env lexbuf) + | "*-/" -> + if is_in_comment_syntax env then + (env, end_pos_of_lexbuf env lexbuf) + else ( + Buffer.add_string buf "*-/"; + comment env buf lexbuf + ) + (* match multi-char substrings that don't contain the start chars of the above patterns *) + | Plus (Compl (line_terminator_sequence_start | '*')) + | any -> + Buffer.add_string buf (lexeme lexbuf); + comment env buf lexbuf + | _ -> + let env = illegal env (loc_of_lexbuf env lexbuf) in + (env, end_pos_of_lexbuf env lexbuf) + +let rec line_comment env buf lexbuf = + match%sedlex lexbuf with + | eof -> (env, end_pos_of_lexbuf env lexbuf) + | line_terminator_sequence -> + let { Loc.line; column } = end_pos_of_lexbuf env lexbuf in + let env = new_line env lexbuf in + let len = Sedlexing.lexeme_length lexbuf in + let end_pos = { Loc.line; column = column - len } in + (env, end_pos) + (* match multi-char substrings that don't contain the start chars of the above patterns *) + | Plus (Compl (eof | line_terminator_sequence_start)) + | any -> + let str = lexeme lexbuf in + Buffer.add_string buf str; + line_comment env buf lexbuf + | _ -> failwith "unreachable" + +let string_escape env lexbuf = + match%sedlex lexbuf with + | eof + | '\\' -> + let str = lexeme lexbuf in + let codes = Sedlexing.lexeme lexbuf |> Array.map Uchar.to_int in + (env, str, codes, false) + | ('x', hex_digit, hex_digit) -> + let str = lexeme lexbuf in + let code = int_of_string ("0" ^ str) in + (* 0xAB *) + (env, str, [| code |], false) + | ('0' .. '7', '0' .. '7', '0' .. '7') -> + let str = lexeme lexbuf in + let code = int_of_string ("0o" ^ str) in + (* 0o012 *) + (* If the 3 character octal code is larger than 256 + * then it is parsed as a 2 character octal code *) + if code < 256 then + (env, str, [| code |], true) + else + let remainder = code land 7 in + let code = code lsr 3 in + (env, str, [| code; Char.code '0' + remainder |], true) + | ('0' .. '7', '0' .. '7') -> + let str = lexeme lexbuf in + let code = int_of_string ("0o" ^ str) in + (* 0o01 *) + (env, str, [| code |], true) + | '0' -> (env, "0", [| 0x0 |], false) + | 'b' -> (env, "b", [| 0x8 |], false) + | 'f' -> (env, "f", [| 0xC |], false) + | 'n' -> (env, "n", [| 0xA |], false) + | 'r' -> (env, "r", [| 0xD |], false) + | 't' -> (env, "t", [| 0x9 |], false) + | 'v' -> (env, "v", [| 0xB |], false) + | '0' .. '7' -> + let str = lexeme lexbuf in + let code = int_of_string ("0o" ^ str) in + (* 0o1 *) + (env, str, [| code |], true) + | ('u', hex_quad) -> + let str = lexeme lexbuf in + let hex = String.sub str 1 (String.length str - 1) in + let code = int_of_string ("0x" ^ hex) in + (env, str, [| code |], false) + | ("u{", Plus hex_digit, '}') -> + let str = lexeme lexbuf in + let hex = String.sub str 2 (String.length str - 3) in + let code = int_of_string ("0x" ^ hex) in + (* 11.8.4.1 *) + let env = + if code > 0x10FFFF then + illegal env (loc_of_lexbuf env lexbuf) + else + env + in + (env, str, [| code |], false) + | 'u' + | 'x' + | '0' .. '7' -> + let str = lexeme lexbuf in + let codes = Sedlexing.lexeme lexbuf |> Array.map Uchar.to_int in + let env = illegal env (loc_of_lexbuf env lexbuf) in + (env, str, codes, false) + | line_terminator_sequence -> + let str = lexeme lexbuf in + let env = new_line env lexbuf in + (env, str, [||], false) + | any -> + let str = lexeme lexbuf in + let codes = Sedlexing.lexeme lexbuf |> Array.map Uchar.to_int in + (env, str, codes, false) + | _ -> failwith "unreachable" + +(* Really simple version of string lexing. Just try to find beginning and end of + * string. We can inspect the string later to find invalid escapes, etc *) +let rec string_quote env q buf raw octal lexbuf = + match%sedlex lexbuf with + | "'" + | '"' -> + let q' = lexeme lexbuf in + Buffer.add_string raw q'; + if q = q' then + (env, end_pos_of_lexbuf env lexbuf, octal) + else ( + Buffer.add_string buf q'; + string_quote env q buf raw octal lexbuf + ) + | '\\' -> + Buffer.add_string raw "\\"; + let (env, str, codes, octal') = string_escape env lexbuf in + let octal = octal' || octal in + Buffer.add_string raw str; + Array.iter (Wtf8.add_wtf_8 buf) codes; + string_quote env q buf raw octal lexbuf + | '\n' -> + let x = lexeme lexbuf in + Buffer.add_string raw x; + let env = illegal env (loc_of_lexbuf env lexbuf) in + let env = new_line env lexbuf in + Buffer.add_string buf x; + (env, end_pos_of_lexbuf env lexbuf, octal) + | eof -> + let x = lexeme lexbuf in + Buffer.add_string raw x; + let env = illegal env (loc_of_lexbuf env lexbuf) in + Buffer.add_string buf x; + (env, end_pos_of_lexbuf env lexbuf, octal) + (* match multi-char substrings that don't contain the start chars of the above patterns *) + | Plus (Compl ("'" | '"' | '\\' | '\n' | eof)) + | any -> + let x = lexeme lexbuf in + Buffer.add_string raw x; + Buffer.add_string buf x; + string_quote env q buf raw octal lexbuf + | _ -> failwith "unreachable" + +let rec template_part env cooked raw literal lexbuf = + match%sedlex lexbuf with + | eof -> + let env = illegal env (loc_of_lexbuf env lexbuf) in + (env, true) + | '`' -> + Buffer.add_char literal '`'; + (env, true) + | "${" -> + Buffer.add_string literal "${"; + (env, false) + | '\\' -> + Buffer.add_char raw '\\'; + Buffer.add_char literal '\\'; + let (env, str, codes, _) = string_escape env lexbuf in + Buffer.add_string raw str; + Buffer.add_string literal str; + Array.iter (Wtf8.add_wtf_8 cooked) codes; + template_part env cooked raw literal lexbuf + (* ECMAScript 6th Syntax, 11.8.6.1 Static Semantics: TV's and TRV's + * Long story short, is 0xA, is 0xA, and is 0xA + * *) + | "\r\n" -> + Buffer.add_string raw "\r\n"; + Buffer.add_string literal "\r\n"; + Buffer.add_string cooked "\n"; + let env = new_line env lexbuf in + template_part env cooked raw literal lexbuf + | "\n" + | "\r" -> + let lf = lexeme lexbuf in + Buffer.add_string raw lf; + Buffer.add_string literal lf; + Buffer.add_char cooked '\n'; + let env = new_line env lexbuf in + template_part env cooked raw literal lexbuf + (* match multi-char substrings that don't contain the start chars of the above patterns *) + | Plus (Compl (eof | '`' | '$' | '\\' | '\r' | '\n')) + | any -> + let c = lexeme lexbuf in + Buffer.add_string raw c; + Buffer.add_string literal c; + Buffer.add_string cooked c; + template_part env cooked raw literal lexbuf + | _ -> failwith "unreachable" + +let token (env : Lex_env.t) lexbuf : result = + match%sedlex lexbuf with + | line_terminator_sequence -> + let env = new_line env lexbuf in + Continue env + | '\\' -> + let env = illegal env (loc_of_lexbuf env lexbuf) in + Continue env + | Plus whitespace -> Continue env + | "/*" -> + let start_pos = start_pos_of_lexbuf env lexbuf in + let buf = Buffer.create 127 in + let (env, end_pos) = comment env buf lexbuf in + Comment (env, mk_comment env start_pos end_pos buf true) + | ("/*", Star whitespace, (":" | "::" | "flow-include")) -> + let pattern = lexeme lexbuf in + if not (is_comment_syntax_enabled env) then ( + let start_pos = start_pos_of_lexbuf env lexbuf in + let buf = Buffer.create 127 in + Buffer.add_string buf (String.sub pattern 2 (String.length pattern - 2)); + let (env, end_pos) = comment env buf lexbuf in + Comment (env, mk_comment env start_pos end_pos buf true) + ) else + let env = + if is_in_comment_syntax env then + let loc = loc_of_lexbuf env lexbuf in + unexpected_error env loc pattern + else + env + in + let env = in_comment_syntax true env in + let len = Sedlexing.lexeme_length lexbuf in + if + Sedlexing.Utf8.sub_lexeme lexbuf (len - 1) 1 = ":" + && Sedlexing.Utf8.sub_lexeme lexbuf (len - 2) 1 <> ":" + then + Token (env, T_COLON) + else + Continue env + | "*/" -> + if is_in_comment_syntax env then + let env = in_comment_syntax false env in + Continue env + else ( + Sedlexing.rollback lexbuf; + match%sedlex lexbuf with + | "*" -> Token (env, T_MULT) + | _ -> failwith "expected *" + ) + | "//" -> + let start_pos = start_pos_of_lexbuf env lexbuf in + let buf = Buffer.create 127 in + let (env, end_pos) = line_comment env buf lexbuf in + Comment (env, mk_comment env start_pos end_pos buf false) + (* Support for the shebang at the beginning of a file. It is treated like a + * comment at the beginning or an error elsewhere *) + | "#!" -> + if Sedlexing.lexeme_start lexbuf = 0 then + let (env, _) = line_comment env (Buffer.create 127) lexbuf in + Continue env + else + Token (env, T_ERROR "#!") + (* Values *) + | "'" + | '"' -> + let quote = lexeme lexbuf in + let start = start_pos_of_lexbuf env lexbuf in + let buf = Buffer.create 127 in + let raw = Buffer.create 127 in + Buffer.add_string raw quote; + let octal = false in + let (env, _end, octal) = string_quote env quote buf raw octal lexbuf in + let loc = { Loc.source = Lex_env.source env; start; _end } in + Token (env, T_STRING (loc, Buffer.contents buf, Buffer.contents raw, octal)) + | '`' -> + let cooked = Buffer.create 127 in + let raw = Buffer.create 127 in + let literal = Buffer.create 127 in + Buffer.add_string literal (lexeme lexbuf); + + let start = start_pos_of_lexbuf env lexbuf in + let (env, is_tail) = template_part env cooked raw literal lexbuf in + let _end = end_pos_of_lexbuf env lexbuf in + let loc = { Loc.source = Lex_env.source env; start; _end } in + Token + ( env, + T_TEMPLATE_PART + ( loc, + { + cooked = Buffer.contents cooked; + raw = Buffer.contents raw; + literal = Buffer.contents literal; + }, + is_tail ) ) + | (binbigint, word) -> + (* Numbers cannot be immediately followed by words *) + recover env lexbuf ~f:(fun env lexbuf -> + match%sedlex lexbuf with + | binbigint -> Token (env, T_BIGINT { kind = BIG_BINARY; raw = lexeme lexbuf }) + | _ -> failwith "unreachable") + | binbigint -> Token (env, T_BIGINT { kind = BIG_BINARY; raw = lexeme lexbuf }) + | (binnumber, (letter | '2' .. '9'), Star alphanumeric) -> + (* Numbers cannot be immediately followed by words *) + recover env lexbuf ~f:(fun env lexbuf -> + match%sedlex lexbuf with + | binnumber -> Token (env, T_NUMBER { kind = BINARY; raw = lexeme lexbuf }) + | _ -> failwith "unreachable") + | binnumber -> Token (env, T_NUMBER { kind = BINARY; raw = lexeme lexbuf }) + | (octbigint, word) -> + (* Numbers cannot be immediately followed by words *) + recover env lexbuf ~f:(fun env lexbuf -> + match%sedlex lexbuf with + | octbigint -> Token (env, T_BIGINT { kind = BIG_OCTAL; raw = lexeme lexbuf }) + | _ -> failwith "unreachable") + | octbigint -> Token (env, T_BIGINT { kind = BIG_OCTAL; raw = lexeme lexbuf }) + | (octnumber, (letter | '8' .. '9'), Star alphanumeric) -> + (* Numbers cannot be immediately followed by words *) + recover env lexbuf ~f:(fun env lexbuf -> + match%sedlex lexbuf with + | octnumber -> Token (env, T_NUMBER { kind = OCTAL; raw = lexeme lexbuf }) + | _ -> failwith "unreachable") + | octnumber -> Token (env, T_NUMBER { kind = OCTAL; raw = lexeme lexbuf }) + | (legacynonoctnumber, word) -> + (* Numbers cannot be immediately followed by words *) + recover env lexbuf ~f:(fun env lexbuf -> + match%sedlex lexbuf with + | legacynonoctnumber -> + Token (env, T_NUMBER { kind = LEGACY_NON_OCTAL; raw = lexeme lexbuf }) + | _ -> failwith "unreachable") + | legacynonoctnumber -> Token (env, T_NUMBER { kind = LEGACY_NON_OCTAL; raw = lexeme lexbuf }) + | (legacyoctnumber, (letter | '8' .. '9'), Star alphanumeric) -> + (* Numbers cannot be immediately followed by words *) + recover env lexbuf ~f:(fun env lexbuf -> + match%sedlex lexbuf with + | legacyoctnumber -> Token (env, T_NUMBER { kind = LEGACY_OCTAL; raw = lexeme lexbuf }) + | _ -> failwith "unreachable") + | legacyoctnumber -> Token (env, T_NUMBER { kind = LEGACY_OCTAL; raw = lexeme lexbuf }) + | (hexbigint, word) -> + (* Numbers cannot be immediately followed by words *) + recover env lexbuf ~f:(fun env lexbuf -> + match%sedlex lexbuf with + | hexbigint -> Token (env, T_BIGINT { kind = BIG_NORMAL; raw = lexeme lexbuf }) + | _ -> failwith "unreachable") + | hexbigint -> Token (env, T_BIGINT { kind = BIG_NORMAL; raw = lexeme lexbuf }) + | (hexnumber, non_hex_letter, Star alphanumeric) -> + (* Numbers cannot be immediately followed by words *) + recover env lexbuf ~f:(fun env lexbuf -> + match%sedlex lexbuf with + | hexnumber -> Token (env, T_NUMBER { kind = NORMAL; raw = lexeme lexbuf }) + | _ -> failwith "unreachable") + | hexnumber -> Token (env, T_NUMBER { kind = NORMAL; raw = lexeme lexbuf }) + | (scibigint, word) -> + (* Numbers cannot be immediately followed by words *) + recover env lexbuf ~f:(fun env lexbuf -> + match%sedlex lexbuf with + | scibigint -> + let loc = loc_of_lexbuf env lexbuf in + let env = lex_error env loc Parse_error.InvalidSciBigInt in + Token (env, T_BIGINT { kind = BIG_NORMAL; raw = lexeme lexbuf }) + | _ -> failwith "unreachable") + | scibigint -> + let loc = loc_of_lexbuf env lexbuf in + let env = lex_error env loc Parse_error.InvalidSciBigInt in + Token (env, T_BIGINT { kind = BIG_NORMAL; raw = lexeme lexbuf }) + | (scinumber, word) -> + (* Numbers cannot be immediately followed by words *) + recover env lexbuf ~f:(fun env lexbuf -> + match%sedlex lexbuf with + | scinumber -> Token (env, T_NUMBER { kind = NORMAL; raw = lexeme lexbuf }) + | _ -> failwith "unreachable") + | scinumber -> Token (env, T_NUMBER { kind = NORMAL; raw = lexeme lexbuf }) + | (floatbigint, word) -> + (* Numbers cannot be immediately followed by words *) + recover env lexbuf ~f:(fun env lexbuf -> + match%sedlex lexbuf with + | floatbigint -> + let loc = loc_of_lexbuf env lexbuf in + let env = lex_error env loc Parse_error.InvalidFloatBigInt in + Token (env, T_BIGINT { kind = BIG_NORMAL; raw = lexeme lexbuf }) + | _ -> failwith "unreachable") + | (wholebigint, word) -> + (* Numbers cannot be immediately followed by words *) + recover env lexbuf ~f:(fun env lexbuf -> + match%sedlex lexbuf with + | wholebigint -> Token (env, T_BIGINT { kind = BIG_NORMAL; raw = lexeme lexbuf }) + | _ -> failwith "unreachable") + | floatbigint -> + let loc = loc_of_lexbuf env lexbuf in + let env = lex_error env loc Parse_error.InvalidFloatBigInt in + Token (env, T_BIGINT { kind = BIG_NORMAL; raw = lexeme lexbuf }) + | wholebigint -> Token (env, T_BIGINT { kind = BIG_NORMAL; raw = lexeme lexbuf }) + | ((wholenumber | floatnumber), word) -> + (* Numbers cannot be immediately followed by words *) + recover env lexbuf ~f:(fun env lexbuf -> + match%sedlex lexbuf with + | wholenumber + | floatnumber -> + Token (env, T_NUMBER { kind = NORMAL; raw = lexeme lexbuf }) + | _ -> failwith "unreachable") + | wholenumber + | floatnumber -> + Token (env, T_NUMBER { kind = NORMAL; raw = lexeme lexbuf }) + (* Keywords *) + | "async" -> Token (env, T_ASYNC) + | "await" -> Token (env, T_AWAIT) + | "break" -> Token (env, T_BREAK) + | "case" -> Token (env, T_CASE) + | "catch" -> Token (env, T_CATCH) + | "class" -> Token (env, T_CLASS) + | "const" -> Token (env, T_CONST) + | "continue" -> Token (env, T_CONTINUE) + | "debugger" -> Token (env, T_DEBUGGER) + | "declare" -> Token (env, T_DECLARE) + | "default" -> Token (env, T_DEFAULT) + | "delete" -> Token (env, T_DELETE) + | "do" -> Token (env, T_DO) + | "else" -> Token (env, T_ELSE) + | "enum" -> Token (env, T_ENUM) + | "export" -> Token (env, T_EXPORT) + | "extends" -> Token (env, T_EXTENDS) + | "false" -> Token (env, T_FALSE) + | "finally" -> Token (env, T_FINALLY) + | "for" -> Token (env, T_FOR) + | "function" -> Token (env, T_FUNCTION) + | "if" -> Token (env, T_IF) + | "implements" -> Token (env, T_IMPLEMENTS) + | "import" -> Token (env, T_IMPORT) + | "in" -> Token (env, T_IN) + | "instanceof" -> Token (env, T_INSTANCEOF) + | "interface" -> Token (env, T_INTERFACE) + | "let" -> Token (env, T_LET) + | "new" -> Token (env, T_NEW) + | "null" -> Token (env, T_NULL) + | "of" -> Token (env, T_OF) + | "opaque" -> Token (env, T_OPAQUE) + | "package" -> Token (env, T_PACKAGE) + | "private" -> Token (env, T_PRIVATE) + | "protected" -> Token (env, T_PROTECTED) + | "public" -> Token (env, T_PUBLIC) + | "return" -> Token (env, T_RETURN) + | "static" -> Token (env, T_STATIC) + | "super" -> Token (env, T_SUPER) + | "switch" -> Token (env, T_SWITCH) + | "this" -> Token (env, T_THIS) + | "throw" -> Token (env, T_THROW) + | "true" -> Token (env, T_TRUE) + | "try" -> Token (env, T_TRY) + | "type" -> Token (env, T_TYPE) + | "typeof" -> Token (env, T_TYPEOF) + | "var" -> Token (env, T_VAR) + | "void" -> Token (env, T_VOID) + | "while" -> Token (env, T_WHILE) + | "with" -> Token (env, T_WITH) + | "yield" -> Token (env, T_YIELD) + (* Identifiers *) + | (js_id_start, Star js_id_continue) -> + let loc = loc_of_lexbuf env lexbuf in + let raw = lexeme lexbuf in + let (env, value) = decode_identifier env raw in + Token (env, T_IDENTIFIER { loc; value; raw }) + (* TODO: Use [Symbol.iterator] instead of @@iterator. *) + | "@@iterator" + | "@@asyncIterator" -> + let loc = loc_of_lexbuf env lexbuf in + let raw = lexeme lexbuf in + Token (env, T_IDENTIFIER { loc; value = raw; raw }) + (* Syntax *) + | "{" -> Token (env, T_LCURLY) + | "}" -> Token (env, T_RCURLY) + | "(" -> Token (env, T_LPAREN) + | ")" -> Token (env, T_RPAREN) + | "[" -> Token (env, T_LBRACKET) + | "]" -> Token (env, T_RBRACKET) + | "..." -> Token (env, T_ELLIPSIS) + | "." -> Token (env, T_PERIOD) + | ";" -> Token (env, T_SEMICOLON) + | "," -> Token (env, T_COMMA) + | ":" -> Token (env, T_COLON) + | ("?.", digit) -> + Sedlexing.rollback lexbuf; + (match%sedlex lexbuf with + | "?" -> Token (env, T_PLING) + | _ -> failwith "expected ?") + | "?." -> Token (env, T_PLING_PERIOD) + | "??" -> Token (env, T_PLING_PLING) + | "?" -> Token (env, T_PLING) + | "&&" -> Token (env, T_AND) + | "||" -> Token (env, T_OR) + | "===" -> Token (env, T_STRICT_EQUAL) + | "!==" -> Token (env, T_STRICT_NOT_EQUAL) + | "<=" -> Token (env, T_LESS_THAN_EQUAL) + | ">=" -> Token (env, T_GREATER_THAN_EQUAL) + | "==" -> Token (env, T_EQUAL) + | "!=" -> Token (env, T_NOT_EQUAL) + | "++" -> Token (env, T_INCR) + | "--" -> Token (env, T_DECR) + | "<<=" -> Token (env, T_LSHIFT_ASSIGN) + | "<<" -> Token (env, T_LSHIFT) + | ">>=" -> Token (env, T_RSHIFT_ASSIGN) + | ">>>=" -> Token (env, T_RSHIFT3_ASSIGN) + | ">>>" -> Token (env, T_RSHIFT3) + | ">>" -> Token (env, T_RSHIFT) + | "+=" -> Token (env, T_PLUS_ASSIGN) + | "-=" -> Token (env, T_MINUS_ASSIGN) + | "*=" -> Token (env, T_MULT_ASSIGN) + | "**=" -> Token (env, T_EXP_ASSIGN) + | "%=" -> Token (env, T_MOD_ASSIGN) + | "&=" -> Token (env, T_BIT_AND_ASSIGN) + | "|=" -> Token (env, T_BIT_OR_ASSIGN) + | "^=" -> Token (env, T_BIT_XOR_ASSIGN) + | "<" -> Token (env, T_LESS_THAN) + | ">" -> Token (env, T_GREATER_THAN) + | "+" -> Token (env, T_PLUS) + | "-" -> Token (env, T_MINUS) + | "*" -> Token (env, T_MULT) + | "**" -> Token (env, T_EXP) + | "%" -> Token (env, T_MOD) + | "|" -> Token (env, T_BIT_OR) + | "&" -> Token (env, T_BIT_AND) + | "^" -> Token (env, T_BIT_XOR) + | "!" -> Token (env, T_NOT) + | "~" -> Token (env, T_BIT_NOT) + | "=" -> Token (env, T_ASSIGN) + | "=>" -> Token (env, T_ARROW) + | "/=" -> Token (env, T_DIV_ASSIGN) + | "/" -> Token (env, T_DIV) + | "@" -> Token (env, T_AT) + | "#" -> Token (env, T_POUND) + (* Others *) + | eof -> + let env = + if is_in_comment_syntax env then + let loc = loc_of_lexbuf env lexbuf in + lex_error env loc Parse_error.UnexpectedEOS + else + env + in + Token (env, T_EOF) + | any -> + let env = illegal env (loc_of_lexbuf env lexbuf) in + Token (env, T_ERROR (lexeme lexbuf)) + | _ -> failwith "unreachable" + +let rec regexp_class env buf lexbuf = + match%sedlex lexbuf with + | eof -> env + | "\\\\" -> + Buffer.add_string buf "\\\\"; + regexp_class env buf lexbuf + | ('\\', ']') -> + Buffer.add_char buf '\\'; + Buffer.add_char buf ']'; + regexp_class env buf lexbuf + | ']' -> + Buffer.add_char buf ']'; + env + (* match multi-char substrings that don't contain the start chars of the above patterns *) + | Plus (Compl (eof | '\\' | ']')) + | any -> + let str = lexeme lexbuf in + Buffer.add_string buf str; + regexp_class env buf lexbuf + | _ -> failwith "unreachable" + +let rec regexp_body env buf lexbuf = + match%sedlex lexbuf with + | eof -> + let loc = loc_of_lexbuf env lexbuf in + let env = lex_error env loc Parse_error.UnterminatedRegExp in + (env, "") + | ('\\', line_terminator_sequence) -> + let loc = loc_of_lexbuf env lexbuf in + let env = lex_error env loc Parse_error.UnterminatedRegExp in + let env = new_line env lexbuf in + (env, "") + | ('\\', any) -> + let s = lexeme lexbuf in + Buffer.add_string buf s; + regexp_body env buf lexbuf + | ('/', Plus id_letter) -> + let flags = + let str = lexeme lexbuf in + String.sub str 1 (String.length str - 1) + in + (env, flags) + | '/' -> (env, "") + | '[' -> + Buffer.add_char buf '['; + let env = regexp_class env buf lexbuf in + regexp_body env buf lexbuf + | line_terminator_sequence -> + let loc = loc_of_lexbuf env lexbuf in + let env = lex_error env loc Parse_error.UnterminatedRegExp in + let env = new_line env lexbuf in + (env, "") + (* match multi-char substrings that don't contain the start chars of the above patterns *) + | Plus (Compl (eof | '\\' | '/' | '[' | line_terminator_sequence_start)) + | any -> + let str = lexeme lexbuf in + Buffer.add_string buf str; + regexp_body env buf lexbuf + | _ -> failwith "unreachable" + +let regexp env lexbuf = + match%sedlex lexbuf with + | eof -> Token (env, T_EOF) + | line_terminator_sequence -> + let env = new_line env lexbuf in + Continue env + | Plus whitespace -> Continue env + | "//" -> + let start_pos = start_pos_of_lexbuf env lexbuf in + let buf = Buffer.create 127 in + let (env, end_pos) = line_comment env buf lexbuf in + Comment (env, mk_comment env start_pos end_pos buf false) + | "/*" -> + let start_pos = start_pos_of_lexbuf env lexbuf in + let buf = Buffer.create 127 in + let (env, end_pos) = comment env buf lexbuf in + Comment (env, mk_comment env start_pos end_pos buf true) + | '/' -> + let start = start_pos_of_lexbuf env lexbuf in + let buf = Buffer.create 127 in + let (env, flags) = regexp_body env buf lexbuf in + let _end = end_pos_of_lexbuf env lexbuf in + let loc = { Loc.source = Lex_env.source env; start; _end } in + Token (env, T_REGEXP (loc, Buffer.contents buf, flags)) + | any -> + let env = illegal env (loc_of_lexbuf env lexbuf) in + Token (env, T_ERROR (lexeme lexbuf)) + | _ -> failwith "unreachable" + +let rec jsx_text env mode buf raw lexbuf = + match%sedlex lexbuf with + | "'" + | '"' + | '<' + | '>' + | '{' + | '}' -> + let c = lexeme lexbuf in + begin + match (mode, c) with + | (JSX_SINGLE_QUOTED_TEXT, "'") + | (JSX_DOUBLE_QUOTED_TEXT, "\"") -> + env + | (JSX_CHILD_TEXT, ("<" | "{")) -> + (* Don't actually want to consume these guys + * yet...they're not part of the JSX text *) + Sedlexing.rollback lexbuf; + env + | (JSX_CHILD_TEXT, ">") -> + unexpected_error_w_suggest env (loc_of_lexbuf env lexbuf) ">" "{'>'}" + | (JSX_CHILD_TEXT, "}") -> + unexpected_error_w_suggest env (loc_of_lexbuf env lexbuf) "}" "{'}'}" + | _ -> + Buffer.add_string raw c; + Buffer.add_string buf c; + jsx_text env mode buf raw lexbuf + end + | eof -> + let env = illegal env (loc_of_lexbuf env lexbuf) in + env + | line_terminator_sequence -> + let lt = lexeme lexbuf in + Buffer.add_string raw lt; + Buffer.add_string buf lt; + let env = new_line env lexbuf in + jsx_text env mode buf raw lexbuf + | ("&#x", Plus hex_digit, ';') -> + let s = lexeme lexbuf in + let n = String.sub s 3 (String.length s - 4) in + Buffer.add_string raw s; + let code = int_of_string ("0x" ^ n) in + Wtf8.add_wtf_8 buf code; + jsx_text env mode buf raw lexbuf + | ("&#", Plus digit, ';') -> + let s = lexeme lexbuf in + let n = String.sub s 2 (String.length s - 3) in + Buffer.add_string raw s; + let code = int_of_string n in + Wtf8.add_wtf_8 buf code; + jsx_text env mode buf raw lexbuf + | ("&", htmlentity, ';') -> + let s = lexeme lexbuf in + let entity = String.sub s 1 (String.length s - 2) in + Buffer.add_string raw s; + let code = + match entity with + | "quot" -> Some 0x0022 + | "amp" -> Some 0x0026 + | "apos" -> Some 0x0027 + | "lt" -> Some 0x003C + | "gt" -> Some 0x003E + | "nbsp" -> Some 0x00A0 + | "iexcl" -> Some 0x00A1 + | "cent" -> Some 0x00A2 + | "pound" -> Some 0x00A3 + | "curren" -> Some 0x00A4 + | "yen" -> Some 0x00A5 + | "brvbar" -> Some 0x00A6 + | "sect" -> Some 0x00A7 + | "uml" -> Some 0x00A8 + | "copy" -> Some 0x00A9 + | "ordf" -> Some 0x00AA + | "laquo" -> Some 0x00AB + | "not" -> Some 0x00AC + | "shy" -> Some 0x00AD + | "reg" -> Some 0x00AE + | "macr" -> Some 0x00AF + | "deg" -> Some 0x00B0 + | "plusmn" -> Some 0x00B1 + | "sup2" -> Some 0x00B2 + | "sup3" -> Some 0x00B3 + | "acute" -> Some 0x00B4 + | "micro" -> Some 0x00B5 + | "para" -> Some 0x00B6 + | "middot" -> Some 0x00B7 + | "cedil" -> Some 0x00B8 + | "sup1" -> Some 0x00B9 + | "ordm" -> Some 0x00BA + | "raquo" -> Some 0x00BB + | "frac14" -> Some 0x00BC + | "frac12" -> Some 0x00BD + | "frac34" -> Some 0x00BE + | "iquest" -> Some 0x00BF + | "Agrave" -> Some 0x00C0 + | "Aacute" -> Some 0x00C1 + | "Acirc" -> Some 0x00C2 + | "Atilde" -> Some 0x00C3 + | "Auml" -> Some 0x00C4 + | "Aring" -> Some 0x00C5 + | "AElig" -> Some 0x00C6 + | "Ccedil" -> Some 0x00C7 + | "Egrave" -> Some 0x00C8 + | "Eacute" -> Some 0x00C9 + | "Ecirc" -> Some 0x00CA + | "Euml" -> Some 0x00CB + | "Igrave" -> Some 0x00CC + | "Iacute" -> Some 0x00CD + | "Icirc" -> Some 0x00CE + | "Iuml" -> Some 0x00CF + | "ETH" -> Some 0x00D0 + | "Ntilde" -> Some 0x00D1 + | "Ograve" -> Some 0x00D2 + | "Oacute" -> Some 0x00D3 + | "Ocirc" -> Some 0x00D4 + | "Otilde" -> Some 0x00D5 + | "Ouml" -> Some 0x00D6 + | "times" -> Some 0x00D7 + | "Oslash" -> Some 0x00D8 + | "Ugrave" -> Some 0x00D9 + | "Uacute" -> Some 0x00DA + | "Ucirc" -> Some 0x00DB + | "Uuml" -> Some 0x00DC + | "Yacute" -> Some 0x00DD + | "THORN" -> Some 0x00DE + | "szlig" -> Some 0x00DF + | "agrave" -> Some 0x00E0 + | "aacute" -> Some 0x00E1 + | "acirc" -> Some 0x00E2 + | "atilde" -> Some 0x00E3 + | "auml" -> Some 0x00E4 + | "aring" -> Some 0x00E5 + | "aelig" -> Some 0x00E6 + | "ccedil" -> Some 0x00E7 + | "egrave" -> Some 0x00E8 + | "eacute" -> Some 0x00E9 + | "ecirc" -> Some 0x00EA + | "euml" -> Some 0x00EB + | "igrave" -> Some 0x00EC + | "iacute" -> Some 0x00ED + | "icirc" -> Some 0x00EE + | "iuml" -> Some 0x00EF + | "eth" -> Some 0x00F0 + | "ntilde" -> Some 0x00F1 + | "ograve" -> Some 0x00F2 + | "oacute" -> Some 0x00F3 + | "ocirc" -> Some 0x00F4 + | "otilde" -> Some 0x00F5 + | "ouml" -> Some 0x00F6 + | "divide" -> Some 0x00F7 + | "oslash" -> Some 0x00F8 + | "ugrave" -> Some 0x00F9 + | "uacute" -> Some 0x00FA + | "ucirc" -> Some 0x00FB + | "uuml" -> Some 0x00FC + | "yacute" -> Some 0x00FD + | "thorn" -> Some 0x00FE + | "yuml" -> Some 0x00FF + | "OElig" -> Some 0x0152 + | "oelig" -> Some 0x0153 + | "Scaron" -> Some 0x0160 + | "scaron" -> Some 0x0161 + | "Yuml" -> Some 0x0178 + | "fnof" -> Some 0x0192 + | "circ" -> Some 0x02C6 + | "tilde" -> Some 0x02DC + | "Alpha" -> Some 0x0391 + | "Beta" -> Some 0x0392 + | "Gamma" -> Some 0x0393 + | "Delta" -> Some 0x0394 + | "Epsilon" -> Some 0x0395 + | "Zeta" -> Some 0x0396 + | "Eta" -> Some 0x0397 + | "Theta" -> Some 0x0398 + | "Iota" -> Some 0x0399 + | "Kappa" -> Some 0x039A + | "Lambda" -> Some 0x039B + | "Mu" -> Some 0x039C + | "Nu" -> Some 0x039D + | "Xi" -> Some 0x039E + | "Omicron" -> Some 0x039F + | "Pi" -> Some 0x03A0 + | "Rho" -> Some 0x03A1 + | "Sigma" -> Some 0x03A3 + | "Tau" -> Some 0x03A4 + | "Upsilon" -> Some 0x03A5 + | "Phi" -> Some 0x03A6 + | "Chi" -> Some 0x03A7 + | "Psi" -> Some 0x03A8 + | "Omega" -> Some 0x03A9 + | "alpha" -> Some 0x03B1 + | "beta" -> Some 0x03B2 + | "gamma" -> Some 0x03B3 + | "delta" -> Some 0x03B4 + | "epsilon" -> Some 0x03B5 + | "zeta" -> Some 0x03B6 + | "eta" -> Some 0x03B7 + | "theta" -> Some 0x03B8 + | "iota" -> Some 0x03B9 + | "kappa" -> Some 0x03BA + | "lambda" -> Some 0x03BB + | "mu" -> Some 0x03BC + | "nu" -> Some 0x03BD + | "xi" -> Some 0x03BE + | "omicron" -> Some 0x03BF + | "pi" -> Some 0x03C0 + | "rho" -> Some 0x03C1 + | "sigmaf" -> Some 0x03C2 + | "sigma" -> Some 0x03C3 + | "tau" -> Some 0x03C4 + | "upsilon" -> Some 0x03C5 + | "phi" -> Some 0x03C6 + | "chi" -> Some 0x03C7 + | "psi" -> Some 0x03C8 + | "omega" -> Some 0x03C9 + | "thetasym" -> Some 0x03D1 + | "upsih" -> Some 0x03D2 + | "piv" -> Some 0x03D6 + | "ensp" -> Some 0x2002 + | "emsp" -> Some 0x2003 + | "thinsp" -> Some 0x2009 + | "zwnj" -> Some 0x200C + | "zwj" -> Some 0x200D + | "lrm" -> Some 0x200E + | "rlm" -> Some 0x200F + | "ndash" -> Some 0x2013 + | "mdash" -> Some 0x2014 + | "lsquo" -> Some 0x2018 + | "rsquo" -> Some 0x2019 + | "sbquo" -> Some 0x201A + | "ldquo" -> Some 0x201C + | "rdquo" -> Some 0x201D + | "bdquo" -> Some 0x201E + | "dagger" -> Some 0x2020 + | "Dagger" -> Some 0x2021 + | "bull" -> Some 0x2022 + | "hellip" -> Some 0x2026 + | "permil" -> Some 0x2030 + | "prime" -> Some 0x2032 + | "Prime" -> Some 0x2033 + | "lsaquo" -> Some 0x2039 + | "rsaquo" -> Some 0x203A + | "oline" -> Some 0x203E + | "frasl" -> Some 0x2044 + | "euro" -> Some 0x20AC + | "image" -> Some 0x2111 + | "weierp" -> Some 0x2118 + | "real" -> Some 0x211C + | "trade" -> Some 0x2122 + | "alefsym" -> Some 0x2135 + | "larr" -> Some 0x2190 + | "uarr" -> Some 0x2191 + | "rarr" -> Some 0x2192 + | "darr" -> Some 0x2193 + | "harr" -> Some 0x2194 + | "crarr" -> Some 0x21B5 + | "lArr" -> Some 0x21D0 + | "uArr" -> Some 0x21D1 + | "rArr" -> Some 0x21D2 + | "dArr" -> Some 0x21D3 + | "hArr" -> Some 0x21D4 + | "forall" -> Some 0x2200 + | "part" -> Some 0x2202 + | "exist" -> Some 0x2203 + | "empty" -> Some 0x2205 + | "nabla" -> Some 0x2207 + | "isin" -> Some 0x2208 + | "notin" -> Some 0x2209 + | "ni" -> Some 0x220B + | "prod" -> Some 0x220F + | "sum" -> Some 0x2211 + | "minus" -> Some 0x2212 + | "lowast" -> Some 0x2217 + | "radic" -> Some 0x221A + | "prop" -> Some 0x221D + | "infin" -> Some 0x221E + | "ang" -> Some 0x2220 + | "and" -> Some 0x2227 + | "or" -> Some 0x2228 + | "cap" -> Some 0x2229 + | "cup" -> Some 0x222A + | "'int'" -> Some 0x222B + | "there4" -> Some 0x2234 + | "sim" -> Some 0x223C + | "cong" -> Some 0x2245 + | "asymp" -> Some 0x2248 + | "ne" -> Some 0x2260 + | "equiv" -> Some 0x2261 + | "le" -> Some 0x2264 + | "ge" -> Some 0x2265 + | "sub" -> Some 0x2282 + | "sup" -> Some 0x2283 + | "nsub" -> Some 0x2284 + | "sube" -> Some 0x2286 + | "supe" -> Some 0x2287 + | "oplus" -> Some 0x2295 + | "otimes" -> Some 0x2297 + | "perp" -> Some 0x22A5 + | "sdot" -> Some 0x22C5 + | "lceil" -> Some 0x2308 + | "rceil" -> Some 0x2309 + | "lfloor" -> Some 0x230A + | "rfloor" -> Some 0x230B + | "lang" -> Some 0x27E8 (* 0x2329 in HTML4 *) + | "rang" -> Some 0x27E9 (* 0x232A in HTML4 *) + | "loz" -> Some 0x25CA + | "spades" -> Some 0x2660 + | "clubs" -> Some 0x2663 + | "hearts" -> Some 0x2665 + | "diams" -> Some 0x2666 + | _ -> None + in + (match code with + | Some code -> Wtf8.add_wtf_8 buf code + | None -> Buffer.add_string buf ("&" ^ entity ^ ";")); + jsx_text env mode buf raw lexbuf + (* match multi-char substrings that don't contain the start chars of the above patterns *) + | Plus (Compl ("'" | '"' | '<' | '{' | '&' | eof | line_terminator_sequence_start)) + | any -> + let c = lexeme lexbuf in + Buffer.add_string raw c; + Buffer.add_string buf c; + jsx_text env mode buf raw lexbuf + | _ -> failwith "unreachable" + +let jsx_tag env lexbuf = + match%sedlex lexbuf with + | eof -> Token (env, T_EOF) + | line_terminator_sequence -> + let env = new_line env lexbuf in + Continue env + | Plus whitespace -> Continue env + | "//" -> + let start_pos = start_pos_of_lexbuf env lexbuf in + let buf = Buffer.create 127 in + let (env, end_pos) = line_comment env buf lexbuf in + Comment (env, mk_comment env start_pos end_pos buf false) + | "/*" -> + let start_pos = start_pos_of_lexbuf env lexbuf in + let buf = Buffer.create 127 in + let (env, end_pos) = comment env buf lexbuf in + Comment (env, mk_comment env start_pos end_pos buf true) + | '<' -> Token (env, T_LESS_THAN) + | '/' -> Token (env, T_DIV) + | '>' -> Token (env, T_GREATER_THAN) + | '{' -> Token (env, T_LCURLY) + | ':' -> Token (env, T_COLON) + | '.' -> Token (env, T_PERIOD) + | '=' -> Token (env, T_ASSIGN) + | (js_id_start, Star ('-' | js_id_continue)) -> + Token (env, T_JSX_IDENTIFIER { raw = lexeme lexbuf }) + | "'" + | '"' -> + let quote = lexeme lexbuf in + let start = start_pos_of_lexbuf env lexbuf in + let buf = Buffer.create 127 in + let raw = Buffer.create 127 in + Buffer.add_string raw quote; + let mode = + if quote = "'" then + JSX_SINGLE_QUOTED_TEXT + else + JSX_DOUBLE_QUOTED_TEXT + in + let env = jsx_text env mode buf raw lexbuf in + let _end = end_pos_of_lexbuf env lexbuf in + Buffer.add_string raw quote; + let value = Buffer.contents buf in + let raw = Buffer.contents raw in + let loc = { Loc.source = Lex_env.source env; start; _end } in + Token (env, T_JSX_TEXT (loc, value, raw)) + | any -> Token (env, T_ERROR (lexeme lexbuf)) + | _ -> failwith "unreachable" + +let jsx_child env start buf raw lexbuf = + match%sedlex lexbuf with + | line_terminator_sequence -> + let lt = lexeme lexbuf in + Buffer.add_string raw lt; + Buffer.add_string buf lt; + let env = new_line env lexbuf in + let env = jsx_text env JSX_CHILD_TEXT buf raw lexbuf in + let _end = end_pos_of_lexbuf env lexbuf in + let value = Buffer.contents buf in + let raw = Buffer.contents raw in + let loc = { Loc.source = Lex_env.source env; start; _end } in + (env, T_JSX_TEXT (loc, value, raw)) + | eof -> (env, T_EOF) + | '<' -> (env, T_LESS_THAN) + | '{' -> (env, T_LCURLY) + | any -> + Sedlexing.rollback lexbuf; + + (* let jsx_text consume this char *) + let env = jsx_text env JSX_CHILD_TEXT buf raw lexbuf in + let _end = end_pos_of_lexbuf env lexbuf in + let value = Buffer.contents buf in + let raw = Buffer.contents raw in + let loc = { Loc.source = Lex_env.source env; start; _end } in + (env, T_JSX_TEXT (loc, value, raw)) + | _ -> failwith "unreachable" + +let template_tail env lexbuf = + match%sedlex lexbuf with + | line_terminator_sequence -> + let env = new_line env lexbuf in + Continue env + | Plus whitespace -> Continue env + | "//" -> + let start_pos = start_pos_of_lexbuf env lexbuf in + let buf = Buffer.create 127 in + let (env, end_pos) = line_comment env buf lexbuf in + Comment (env, mk_comment env start_pos end_pos buf false) + | "/*" -> + let start_pos = start_pos_of_lexbuf env lexbuf in + let buf = Buffer.create 127 in + let (env, end_pos) = comment env buf lexbuf in + Comment (env, mk_comment env start_pos end_pos buf true) + | '}' -> + let start = start_pos_of_lexbuf env lexbuf in + let cooked = Buffer.create 127 in + let raw = Buffer.create 127 in + let literal = Buffer.create 127 in + Buffer.add_string literal "}"; + let (env, is_tail) = template_part env cooked raw literal lexbuf in + let _end = end_pos_of_lexbuf env lexbuf in + let loc = { Loc.source = Lex_env.source env; start; _end } in + Token + ( env, + T_TEMPLATE_PART + ( loc, + { + cooked = Buffer.contents cooked; + raw = Buffer.contents raw; + literal = Buffer.contents literal; + }, + is_tail ) ) + | any -> + let env = illegal env (loc_of_lexbuf env lexbuf) in + Token + ( env, + T_TEMPLATE_PART (loc_of_lexbuf env lexbuf, { cooked = ""; raw = ""; literal = "" }, true) ) + | _ -> failwith "unreachable" + +(* There are some tokens that never show up in a type and which can cause + * ambiguity. For example, Foo> ends with two angle brackets, not + * with a right shift. + *) +let type_token env lexbuf = + match%sedlex lexbuf with + | line_terminator_sequence -> + let env = new_line env lexbuf in + Continue env + | Plus whitespace -> Continue env + | "/*" -> + let start_pos = start_pos_of_lexbuf env lexbuf in + let buf = Buffer.create 127 in + let (env, end_pos) = comment env buf lexbuf in + Comment (env, mk_comment env start_pos end_pos buf true) + | ("/*", Star whitespace, (":" | "::" | "flow-include")) -> + let pattern = lexeme lexbuf in + if not (is_comment_syntax_enabled env) then ( + let start_pos = start_pos_of_lexbuf env lexbuf in + let buf = Buffer.create 127 in + Buffer.add_string buf pattern; + let (env, end_pos) = comment env buf lexbuf in + Comment (env, mk_comment env start_pos end_pos buf true) + ) else + let env = + if is_in_comment_syntax env then + let loc = loc_of_lexbuf env lexbuf in + unexpected_error env loc pattern + else + env + in + let env = in_comment_syntax true env in + let len = Sedlexing.lexeme_length lexbuf in + if + Sedlexing.Utf8.sub_lexeme lexbuf (len - 1) 1 = ":" + && Sedlexing.Utf8.sub_lexeme lexbuf (len - 2) 1 <> ":" + then + Token (env, T_COLON) + else + Continue env + | "*/" -> + if is_in_comment_syntax env then + let env = in_comment_syntax false env in + Continue env + else ( + Sedlexing.rollback lexbuf; + match%sedlex lexbuf with + | "*" -> Token (env, T_MULT) + | _ -> failwith "expected *" + ) + | "//" -> + let start_pos = start_pos_of_lexbuf env lexbuf in + let buf = Buffer.create 127 in + let (env, end_pos) = line_comment env buf lexbuf in + Comment (env, mk_comment env start_pos end_pos buf false) + | "'" + | '"' -> + let quote = lexeme lexbuf in + let start = start_pos_of_lexbuf env lexbuf in + let buf = Buffer.create 127 in + let raw = Buffer.create 127 in + Buffer.add_string raw quote; + let octal = false in + let (env, _end, octal) = string_quote env quote buf raw octal lexbuf in + let loc = { Loc.source = Lex_env.source env; start; _end } in + Token (env, T_STRING (loc, Buffer.contents buf, Buffer.contents raw, octal)) + (* + * Number literals + *) + | (Opt neg, binbigint, word) -> + (* Numbers cannot be immediately followed by words *) + recover env lexbuf ~f:(fun env lexbuf -> + match%sedlex lexbuf with + | (Opt neg, binbigint) -> + let num = lexeme lexbuf in + Token (env, mk_bignum_singleton BIG_BINARY num) + | _ -> failwith "unreachable") + | (Opt neg, binbigint) -> + let num = lexeme lexbuf in + Token (env, mk_bignum_singleton BIG_BINARY num) + | (Opt neg, binnumber, (letter | '2' .. '9'), Star alphanumeric) -> + (* Numbers cannot be immediately followed by words *) + recover env lexbuf ~f:(fun env lexbuf -> + match%sedlex lexbuf with + | (Opt neg, binnumber) -> + let num = lexeme lexbuf in + Token (env, mk_num_singleton BINARY num) + | _ -> failwith "unreachable") + | (Opt neg, binnumber) -> + let num = lexeme lexbuf in + Token (env, mk_num_singleton BINARY num) + | (Opt neg, octbigint, word) -> + (* Numbers cannot be immediately followed by words *) + recover env lexbuf ~f:(fun env lexbuf -> + match%sedlex lexbuf with + | (Opt neg, octbigint) -> + let num = lexeme lexbuf in + Token (env, mk_bignum_singleton BIG_OCTAL num) + | _ -> failwith "unreachable") + | (Opt neg, octbigint) -> + let num = lexeme lexbuf in + Token (env, mk_bignum_singleton BIG_OCTAL num) + | (Opt neg, octnumber, (letter | '8' .. '9'), Star alphanumeric) -> + (* Numbers cannot be immediately followed by words *) + recover env lexbuf ~f:(fun env lexbuf -> + match%sedlex lexbuf with + | (Opt neg, octnumber) -> + let num = lexeme lexbuf in + Token (env, mk_num_singleton OCTAL num) + | _ -> failwith "unreachable") + | (Opt neg, octnumber) -> + let num = lexeme lexbuf in + Token (env, mk_num_singleton OCTAL num) + | (Opt neg, legacyoctnumber, (letter | '8' .. '9'), Star alphanumeric) -> + (* Numbers cannot be immediately followed by words *) + recover env lexbuf ~f:(fun env lexbuf -> + match%sedlex lexbuf with + | (Opt neg, legacyoctnumber) -> + let num = lexeme lexbuf in + Token (env, mk_num_singleton LEGACY_OCTAL num) + | _ -> failwith "unreachable") + | (Opt neg, legacyoctnumber) -> + let num = lexeme lexbuf in + Token (env, mk_num_singleton LEGACY_OCTAL num) + | (Opt neg, hexbigint, word) -> + (* Numbers cannot be immediately followed by words *) + recover env lexbuf ~f:(fun env lexbuf -> + match%sedlex lexbuf with + | (Opt neg, hexbigint) -> + let num = lexeme lexbuf in + Token (env, mk_bignum_singleton BIG_NORMAL num) + | _ -> failwith "unreachable") + | (Opt neg, hexbigint) -> + let num = lexeme lexbuf in + Token (env, mk_bignum_singleton BIG_NORMAL num) + | (Opt neg, hexnumber, non_hex_letter, Star alphanumeric) -> + (* Numbers cannot be immediately followed by words *) + recover env lexbuf ~f:(fun env lexbuf -> + match%sedlex lexbuf with + | (Opt neg, hexnumber) -> + let num = lexeme lexbuf in + Token (env, mk_num_singleton NORMAL num) + | _ -> failwith "unreachable") + | (Opt neg, hexnumber) -> + let num = lexeme lexbuf in + Token (env, mk_num_singleton NORMAL num) + | (Opt neg, scibigint, word) -> + (* Numbers cannot be immediately followed by words *) + recover env lexbuf ~f:(fun env lexbuf -> + match%sedlex lexbuf with + | (Opt neg, scibigint) -> + let num = lexeme lexbuf in + let loc = loc_of_lexbuf env lexbuf in + let env = lex_error env loc Parse_error.InvalidSciBigInt in + Token (env, mk_bignum_singleton BIG_NORMAL num) + | _ -> failwith "unreachable") + | (Opt neg, scibigint) -> + let num = lexeme lexbuf in + let loc = loc_of_lexbuf env lexbuf in + let env = lex_error env loc Parse_error.InvalidSciBigInt in + Token (env, mk_bignum_singleton BIG_NORMAL num) + | (Opt neg, scinumber, word) -> + (* Numbers cannot be immediately followed by words *) + recover env lexbuf ~f:(fun env lexbuf -> + match%sedlex lexbuf with + | (Opt neg, scinumber) -> + let num = lexeme lexbuf in + Token (env, mk_num_singleton NORMAL num) + | _ -> failwith "unreachable") + | (Opt neg, scinumber) -> + let num = lexeme lexbuf in + Token (env, mk_num_singleton NORMAL num) + | (Opt neg, floatbigint, word) -> + (* Numbers cannot be immediately followed by words *) + recover env lexbuf ~f:(fun env lexbuf -> + match%sedlex lexbuf with + | (Opt neg, floatbigint) -> + let num = lexeme lexbuf in + let loc = loc_of_lexbuf env lexbuf in + let env = lex_error env loc Parse_error.InvalidFloatBigInt in + Token (env, mk_bignum_singleton BIG_NORMAL num) + | _ -> failwith "unreachable") + | (Opt neg, wholebigint, word) -> + (* Numbers cannot be immediately followed by words *) + recover env lexbuf ~f:(fun env lexbuf -> + match%sedlex lexbuf with + | (Opt neg, wholebigint) -> + let num = lexeme lexbuf in + Token (env, mk_bignum_singleton BIG_NORMAL num) + | _ -> failwith "unreachable") + | (Opt neg, floatbigint) -> + let num = lexeme lexbuf in + let loc = loc_of_lexbuf env lexbuf in + let env = lex_error env loc Parse_error.InvalidFloatBigInt in + Token (env, mk_bignum_singleton BIG_NORMAL num) + | (Opt neg, wholebigint) -> + let num = lexeme lexbuf in + Token (env, mk_bignum_singleton BIG_NORMAL num) + | (Opt neg, (wholenumber | floatnumber), word) -> + (* Numbers cannot be immediately followed by words *) + recover env lexbuf ~f:(fun env lexbuf -> + match%sedlex lexbuf with + | (Opt neg, wholenumber) + | floatnumber -> + let num = lexeme lexbuf in + Token (env, mk_num_singleton NORMAL num) + | _ -> failwith "unreachable") + | (Opt neg, (wholenumber | floatnumber)) -> + let num = lexeme lexbuf in + Token (env, mk_num_singleton NORMAL num) + (* Keywords *) + | "any" -> Token (env, T_ANY_TYPE) + | "bool" -> Token (env, T_BOOLEAN_TYPE BOOL) + | "boolean" -> Token (env, T_BOOLEAN_TYPE BOOLEAN) + | "empty" -> Token (env, T_EMPTY_TYPE) + | "extends" -> Token (env, T_EXTENDS) + | "false" -> Token (env, T_FALSE) + | "interface" -> Token (env, T_INTERFACE) + | "mixed" -> Token (env, T_MIXED_TYPE) + | "null" -> Token (env, T_NULL) + | "number" -> Token (env, T_NUMBER_TYPE) + | "bigint" -> Token (env, T_BIGINT_TYPE) + | "static" -> Token (env, T_STATIC) + | "string" -> Token (env, T_STRING_TYPE) + | "true" -> Token (env, T_TRUE) + | "typeof" -> Token (env, T_TYPEOF) + | "void" -> Token (env, T_VOID_TYPE) + | "symbol" -> Token (env, T_SYMBOL_TYPE) + (* Identifiers *) + | (js_id_start, Star js_id_continue) -> + let loc = loc_of_lexbuf env lexbuf in + let raw = lexeme lexbuf in + let (env, value) = decode_identifier env raw in + Token (env, T_IDENTIFIER { loc; value; raw }) + | "%checks" -> Token (env, T_CHECKS) + (* Syntax *) + | "[" -> Token (env, T_LBRACKET) + | "]" -> Token (env, T_RBRACKET) + | "{" -> Token (env, T_LCURLY) + | "}" -> Token (env, T_RCURLY) + | "{|" -> Token (env, T_LCURLYBAR) + | "|}" -> Token (env, T_RCURLYBAR) + | "(" -> Token (env, T_LPAREN) + | ")" -> Token (env, T_RPAREN) + | "..." -> Token (env, T_ELLIPSIS) + | "." -> Token (env, T_PERIOD) + | ";" -> Token (env, T_SEMICOLON) + | "," -> Token (env, T_COMMA) + | ":" -> Token (env, T_COLON) + | "?" -> Token (env, T_PLING) + | "[" -> Token (env, T_LBRACKET) + | "]" -> Token (env, T_RBRACKET) + (* Generics *) + | "<" -> Token (env, T_LESS_THAN) + | ">" -> Token (env, T_GREATER_THAN) + (* Generic default *) + | "=" -> Token (env, T_ASSIGN) + (* Optional or nullable *) + | "?" -> Token (env, T_PLING) + (* Existential *) + | "*" -> Token (env, T_MULT) + (* Annotation or bound *) + | ":" -> Token (env, T_COLON) + (* Union *) + | '|' -> Token (env, T_BIT_OR) + (* Intersection *) + | '&' -> Token (env, T_BIT_AND) + (* typeof *) + | "typeof" -> Token (env, T_TYPEOF) + (* Function type *) + | "=>" -> Token (env, T_ARROW) + (* Type alias *) + | '=' -> Token (env, T_ASSIGN) + (* Variance annotations *) + | '+' -> Token (env, T_PLUS) + | '-' -> Token (env, T_MINUS) + (* Others *) + | eof -> + let env = + if is_in_comment_syntax env then + let loc = loc_of_lexbuf env lexbuf in + lex_error env loc Parse_error.UnexpectedEOS + else + env + in + Token (env, T_EOF) + | any -> Token (env, T_ERROR (lexeme lexbuf)) + | _ -> failwith "unreachable" + +(* Lexing JSX children requires a string buffer to keep track of whitespace + * *) +let jsx_child env = + (* yes, the _start_ of the child is the _end_pos_ of the lexbuf! *) + let start = end_pos_of_lexbuf env env.lex_lb in + let buf = Buffer.create 127 in + let raw = Buffer.create 127 in + let (env, child) = jsx_child env start buf raw env.lex_lb in + let loc = loc_of_token env child in + get_result_and_clear_state (env, child, loc, []) + +let wrap f = + let rec helper comments env = + match f env env.lex_lb with + | Token (env, t) -> + let loc = loc_of_token env t in + let env = { env with lex_last_loc = loc } in + (env, t, loc, List.rev comments) + | Comment (env, ((loc, _) as comment)) -> + let env = { env with lex_last_loc = loc } in + helper (comment :: comments) env + | Continue env -> helper comments env + in + (fun env -> get_result_and_clear_state (helper [] env)) + +let regexp = wrap regexp + +let jsx_tag = wrap jsx_tag + +let template_tail = wrap template_tail + +let type_token = wrap type_token + +let token = wrap token + +let is_valid_identifier_name lexbuf = + match%sedlex lexbuf with + | (js_id_start, Star js_id_continue, eof) -> true + | _ -> false diff --git a/lib/flow_parser_dot_js.ml b/lib/flow_parser_dot_js.ml index 5426e1e..ce1cd2d 100644 --- a/lib/flow_parser_dot_js.ml +++ b/lib/flow_parser_dot_js.ml @@ -1,31 +1,28 @@ -(** - * Copyright (c) 2013-present, Facebook, Inc. +(* + * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. *) +module Js = Js_of_ocaml.Js + let () = let exports = - if (Js.typeof (Js.Unsafe.js_expr "exports") != Js.string "undefined") - then Js.Unsafe.js_expr "exports" - else begin + if Js.typeof (Js.Unsafe.js_expr "exports") != Js.string "undefined" then + Js.Unsafe.js_expr "exports" + else let exports = Js.Unsafe.obj [||] in Js.Unsafe.set Js.Unsafe.global "flow" exports; exports - end in let js_error_of_exn = function - | Js.Error e -> - Js.raise_js_error e + | Js.Error e -> Js.raise_js_error e | exn -> - let msg = "Internal error: "^(Printexc.to_string exn) in - Js.raise_js_error (Js.Unsafe.new_obj Js.error_constr [| - Js.Unsafe.inject (Js.string msg) - |]) + let msg = "Internal error: " ^ Printexc.to_string exn in + Js.raise_js_error (Js.Unsafe.new_obj Js.error_constr [| Js.Unsafe.inject (Js.string msg) |]) in let parse content options = - try Flow_parser_js.parse content options - with exn -> js_error_of_exn exn + (try Flow_parser_js.parse content options with exn -> js_error_of_exn exn) in Js.Unsafe.set exports "parse" (Js.Unsafe.callback parse) diff --git a/lib/flow_parser_js.ml b/lib/flow_parser_js.ml index 1eae675..68546e8 100644 --- a/lib/flow_parser_js.ml +++ b/lib/flow_parser_js.ml @@ -1,12 +1,15 @@ -(** - * Copyright (c) 2013-present, Facebook, Inc. +(* + * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. *) +module Js = Js_of_ocaml.Js + module JsTranslator : sig - val translation_errors: (Loc.t * Parse_error.t) list ref + val translation_errors : (Loc.t * Parse_error.t) list ref + include Translator_intf.S end = struct type t = Js.Unsafe.any @@ -14,91 +17,120 @@ end = struct let translation_errors = ref [] let string x = Js.Unsafe.inject (Js.string x) + let bool x = Js.Unsafe.inject (Js.bool x) + let obj props = Js.Unsafe.inject (Js.Unsafe.obj (Array.of_list props)) + let array arr = Js.Unsafe.inject (Js.array (Array.of_list arr)) + let number x = Js.Unsafe.inject (Js.number_of_float x) + + let int x = number (float x) + let null = Js.Unsafe.inject Js.null + let regexp loc pattern flags = - let regexp = try - Js.Unsafe.new_obj (Js.Unsafe.variable "RegExp") [| - string pattern; - string flags; - |] - with _ -> - translation_errors := (loc, Parse_error.InvalidRegExp)::!translation_errors; - (* Invalid RegExp. We already validated the flags, but we've been - * too lazy to write a JS regexp parser in Ocaml, so we didn't know - * the pattern was invalid. We'll recover with an empty pattern. - *) - Js.Unsafe.new_obj (Js.Unsafe.variable "RegExp") [| - string ""; - string flags; - |] + let regexp = + try Js.Unsafe.new_obj (Js.Unsafe.variable "RegExp") [| string pattern; string flags |] + with _ -> + translation_errors := (loc, Parse_error.InvalidRegExp) :: !translation_errors; + + (* Invalid RegExp. We already validated the flags, but we've been + * too lazy to write a JS regexp parser in Ocaml, so we didn't know + * the pattern was invalid. We'll recover with an empty pattern. + *) + Js.Unsafe.new_obj (Js.Unsafe.variable "RegExp") [| string ""; string flags |] in Js.Unsafe.inject regexp end -module Translate = Estree_translator.Translate (JsTranslator) (struct - let include_comments = true - let include_locs = true -end) - -module Token_translator = Token_translator.Translate (JsTranslator) - -let parse_options jsopts = Parser_env.( - let opts = default_parse_options in - - let decorators = Js.Unsafe.get jsopts "esproposal_decorators" in - let opts = if Js.Optdef.test decorators - then { opts with esproposal_decorators = Js.to_bool decorators; } - else opts in - - let class_instance_fields = Js.Unsafe.get jsopts "esproposal_class_instance_fields" in - let opts = if Js.Optdef.test class_instance_fields - then { opts with esproposal_class_instance_fields = Js.to_bool class_instance_fields; } - else opts in +module Translate = + Estree_translator.Translate + (JsTranslator) + (struct + let include_interned_comments = false - let class_static_fields = Js.Unsafe.get jsopts "esproposal_class_static_fields" in - let opts = if Js.Optdef.test class_static_fields - then { opts with esproposal_class_static_fields = Js.to_bool class_static_fields; } - else opts in + let include_comments = true - let export_star_as = Js.Unsafe.get jsopts "esproposal_export_star_as" in - let opts = if Js.Optdef.test export_star_as - then { opts with esproposal_export_star_as = Js.to_bool export_star_as; } - else opts in + let include_locs = true + end) - let optional_chaining = Js.Unsafe.get jsopts "esproposal_optional_chaining" in - let opts = if Js.Optdef.test optional_chaining - then { opts with esproposal_optional_chaining = Js.to_bool optional_chaining; } - else opts in - - let nullish_coalescing = Js.Unsafe.get jsopts "esproposal_nullish_coalescing" in - let opts = if Js.Optdef.test nullish_coalescing - then { opts with esproposal_nullish_coalescing = Js.to_bool nullish_coalescing; } - else opts in - - let types = Js.Unsafe.get jsopts "types" in - let opts = if Js.Optdef.test types - then { opts with types = Js.to_bool types; } - else opts in +module Token_translator = Token_translator.Translate (JsTranslator) - opts -) +let parse_options jsopts = + Parser_env.( + let opts = default_parse_options in + let enums = Js.Unsafe.get jsopts "enums" in + let opts = + if Js.Optdef.test enums then + { opts with enums = Js.to_bool enums } + else + opts + in + let decorators = Js.Unsafe.get jsopts "esproposal_decorators" in + let opts = + if Js.Optdef.test decorators then + { opts with esproposal_decorators = Js.to_bool decorators } + else + opts + in + let class_instance_fields = Js.Unsafe.get jsopts "esproposal_class_instance_fields" in + let opts = + if Js.Optdef.test class_instance_fields then + { opts with esproposal_class_instance_fields = Js.to_bool class_instance_fields } + else + opts + in + let class_static_fields = Js.Unsafe.get jsopts "esproposal_class_static_fields" in + let opts = + if Js.Optdef.test class_static_fields then + { opts with esproposal_class_static_fields = Js.to_bool class_static_fields } + else + opts + in + let export_star_as = Js.Unsafe.get jsopts "esproposal_export_star_as" in + let opts = + if Js.Optdef.test export_star_as then + { opts with esproposal_export_star_as = Js.to_bool export_star_as } + else + opts + in + let optional_chaining = Js.Unsafe.get jsopts "esproposal_optional_chaining" in + let opts = + if Js.Optdef.test optional_chaining then + { opts with esproposal_optional_chaining = Js.to_bool optional_chaining } + else + opts + in + let nullish_coalescing = Js.Unsafe.get jsopts "esproposal_nullish_coalescing" in + let opts = + if Js.Optdef.test nullish_coalescing then + { opts with esproposal_nullish_coalescing = Js.to_bool nullish_coalescing } + else + opts + in + let types = Js.Unsafe.get jsopts "types" in + let opts = + if Js.Optdef.test types then + { opts with types = Js.to_bool types } + else + opts + in + opts) -let translate_tokens tokens = - JsTranslator.array (List.rev_map Token_translator.token tokens) +let translate_tokens offset_table tokens = + JsTranslator.array (List.rev_map (Token_translator.token offset_table) tokens) let parse content options = let options = - if options = Js.undefined - then Js.Unsafe.obj [||] - else options + if options = Js.undefined then + Js.Unsafe.obj [||] + else + options in let content = Js.to_string content in let parse_options = Some (parse_options options) in - let include_tokens = let tokens = Js.Unsafe.get options "tokens" in Js.Optdef.test tokens && Js.to_bool tokens @@ -106,16 +138,15 @@ let parse content options = let rev_tokens = ref [] in let token_sink = if include_tokens then - Some (fun token_data -> - rev_tokens := token_data::!rev_tokens - ) - else None + Some (fun token_data -> rev_tokens := token_data :: !rev_tokens) + else + None in - let (ocaml_ast, errors) = Parser_flow.program ~fail:false ~parse_options ~token_sink content in JsTranslator.translation_errors := []; - let ret = Translate.program ocaml_ast in + let offset_table = Offset_utils.make ~kind:Offset_utils.JavaScript content in + let ret = Translate.program (Some offset_table) ocaml_ast in let translation_errors = !JsTranslator.translation_errors in Js.Unsafe.set ret "errors" (Translate.errors (errors @ translation_errors)); - if include_tokens then Js.Unsafe.set ret "tokens" (translate_tokens !rev_tokens); + if include_tokens then Js.Unsafe.set ret "tokens" (translate_tokens offset_table !rev_tokens); ret diff --git a/lib/jsx_parser.ml b/lib/jsx_parser.ml index c512ff0..3dc95e1 100644 --- a/lib/jsx_parser.ml +++ b/lib/jsx_parser.ml @@ -1,325 +1,451 @@ -(** - * Copyright (c) 2013-present, Facebook, Inc. +(* + * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. *) +module Ast = Flow_ast open Token +open Parser_common open Parser_env -open Ast -module Error = Parse_error +open Flow_ast + +module JSX (Parse : Parser_common.PARSER) = struct + (* Consumes and returns the trailing comments after the end of a JSX tag name, + attribute, or spread attribute. + + If the component is followed by the end of the JSX tag, then all trailing + comments are returned. If the component is instead followed by another tag + component on another line, only trailing comments on the same line are + returned. If the component is followed by another tag component on the same + line, all trailing comments will instead be leading the next component. *) + let tag_component_trailing_comments env = + match Peek.token env with + | T_EOF + | T_DIV + | T_GREATER_THAN -> + Eat.trailing_comments env + | _ when Peek.is_line_terminator env -> Eat.comments_until_next_line env + | _ -> [] -module JSX (Parse: Parser_common.PARSER) = struct let spread_attribute env = + let leading = Peek.comments env in Eat.push_lex_mode env Lex_mode.NORMAL; - let start_loc = Peek.loc env in - Expect.token env T_LCURLY; - Expect.token env T_ELLIPSIS; - let argument = Parse.assignment env in - let end_loc = Peek.loc env in - Expect.token env T_RCURLY; + let (loc, argument) = + with_loc + (fun env -> + Expect.token env T_LCURLY; + Expect.token env T_ELLIPSIS; + let argument = Parse.assignment env in + Expect.token env T_RCURLY; + argument) + env + in Eat.pop_lex_mode env; - Loc.btwn start_loc end_loc, JSX.SpreadAttribute.({ - argument; - }) + let trailing = tag_component_trailing_comments env in + ( loc, + { + JSX.SpreadAttribute.argument; + comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + } ) - let expression_container' env start_loc = - let expression = if Peek.token env = T_RCURLY - then - let empty_loc = Loc.btwn_exclusive start_loc (Peek.loc env) in - JSX.ExpressionContainer.EmptyExpression empty_loc - else JSX.ExpressionContainer.Expression (Parse.expression env) in - let end_loc = Peek.loc env in - Expect.token env T_RCURLY; - Eat.pop_lex_mode env; - Loc.btwn start_loc end_loc, JSX.ExpressionContainer.({ - expression; - }) + let expression_container_contents env = + if Peek.token env = T_RCURLY then + JSX.ExpressionContainer.EmptyExpression + else + JSX.ExpressionContainer.Expression (Parse.expression env) let expression_container env = + let leading = Peek.comments env in Eat.push_lex_mode env Lex_mode.NORMAL; - let start_loc = Peek.loc env in - Expect.token env T_LCURLY; - expression_container' env start_loc + let (loc, expression) = + with_loc + (fun env -> + Expect.token env T_LCURLY; + let expression = expression_container_contents env in + Expect.token env T_RCURLY; + expression) + env + in + Eat.pop_lex_mode env; + let trailing = tag_component_trailing_comments env in + ( loc, + { + JSX.ExpressionContainer.expression; + comments = Flow_ast_utils.mk_comments_with_internal_opt ~leading ~trailing ~internal:[]; + } ) let expression_container_or_spread_child env = Eat.push_lex_mode env Lex_mode.NORMAL; - let start_loc = Peek.loc env in - Expect.token env T_LCURLY; - match Peek.token env with - | T_ELLIPSIS -> - Expect.token env T_ELLIPSIS; - let expr = Parse.assignment env in - let end_loc = Peek.loc env in - Expect.token env T_RCURLY; - Eat.pop_lex_mode env; - Loc.btwn start_loc end_loc, JSX.SpreadChild expr - | _ -> - let expression_container = expression_container' env start_loc in - fst expression_container, JSX.ExpressionContainer (snd expression_container) + let (loc, result) = + with_loc + (fun env -> + Expect.token env T_LCURLY; + let result = + match Peek.token env with + | T_ELLIPSIS -> + let leading = Peek.comments env in + Expect.token env T_ELLIPSIS; + let expression = Parse.assignment env in + JSX.SpreadChild + { + JSX.SpreadChild.expression; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + } + | _ -> + let expression = expression_container_contents env in + let internal = + match expression with + | JSX.ExpressionContainer.EmptyExpression -> Peek.comments env + | _ -> [] + in + JSX.ExpressionContainer + { + JSX.ExpressionContainer.expression; + comments = Flow_ast_utils.mk_comments_with_internal_opt internal; + } + in + Expect.token env T_RCURLY; + result) + env + in + Eat.pop_lex_mode env; + (loc, result) let identifier env = let loc = Peek.loc env in - let name = match Peek.token env with - | T_JSX_IDENTIFIER { raw } -> raw - | _ -> error_unexpected env; "" + let name = + match Peek.token env with + | T_JSX_IDENTIFIER { raw } -> raw + | _ -> + error_unexpected ~expected:"an identifier" env; + "" in + let leading = Peek.comments env in Eat.token env; - loc, JSX.Identifier.({ name; }) + (* Unless this identifier is the first part of a namespaced name, member + expression, or attribute name, it is the end of a tag component. *) + let trailing = + match Peek.token env with + (* Namespaced name *) + | T_COLON + (* Member expression *) + | T_PERIOD + (* Attribute name *) + | T_ASSIGN -> + Eat.trailing_comments env + | _ -> tag_component_trailing_comments env + in + (loc, JSX.Identifier.{ name; comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () }) let name = let rec member_expression env member = match Peek.token env with | T_PERIOD -> - let _object = JSX.MemberExpression.MemberExpression member in - Expect.token env T_PERIOD; - let property = identifier env in - let loc = Loc.btwn (fst member) (fst property) in - let member = loc, JSX.MemberExpression.({ - _object; - property; - }) in - member_expression env member + let (start_loc, _) = member in + let member = + with_loc + ~start_loc + (fun env -> + Expect.token env T_PERIOD; + let property = identifier env in + { + JSX.MemberExpression._object = JSX.MemberExpression.MemberExpression member; + property; + }) + env + in + member_expression env member | _ -> member - - in fun env -> - let name = identifier env in - match Peek.token env with + in + fun env -> + match Peek.ith_token ~i:1 env with | T_COLON -> - let namespace = name in - Expect.token env T_COLON; - let name = identifier env in - let loc = Loc.btwn (fst namespace) (fst name) in - JSX.NamespacedName (loc, JSX.NamespacedName.({ - namespace; - name; - })) + let namespaced_name = + with_loc + (fun env -> + let namespace = identifier env in + Expect.token env T_COLON; + let name = identifier env in + { JSX.NamespacedName.namespace; name }) + env + in + JSX.NamespacedName namespaced_name | T_PERIOD -> - let _object = JSX.MemberExpression.Identifier name in - Expect.token env T_PERIOD; - let property = identifier env in - let loc = Loc.btwn (fst name) (fst property) in - let member = loc, JSX.MemberExpression.({ - _object; - property; - }) in - JSX.MemberExpression (member_expression env member) - | _ -> JSX.Identifier name - + let member = + with_loc + (fun env -> + let _object = JSX.MemberExpression.Identifier (identifier env) in + Expect.token env T_PERIOD; + let property = identifier env in + { JSX.MemberExpression._object; property }) + env + in + JSX.MemberExpression (member_expression env member) + | _ -> + let name = identifier env in + JSX.Identifier name let attribute env = - let start_loc = Peek.loc env in - let name = identifier env in - let end_loc, name = - if Peek.token env = T_COLON - then begin - Expect.token env T_COLON; - let namespace = name in - let name = identifier env in - let loc = Loc.btwn (fst namespace) (fst name) in - loc, JSX.Attribute.NamespacedName (loc, JSX.NamespacedName.({ - namespace; - name; - })) - end else fst name, JSX.Attribute.Identifier name in - let end_loc, value = - if Peek.token env = T_ASSIGN - then begin - Expect.token env T_ASSIGN; - match Peek.token env with - | T_LCURLY -> - let loc, expression_container = expression_container env in + with_loc + (fun env -> + let name = + match Peek.ith_token ~i:1 env with + | T_COLON -> + let namespaced_name = + with_loc + (fun env -> + let namespace = identifier env in + Expect.token env T_COLON; + let name = identifier env in + { JSX.NamespacedName.namespace; name }) + env + in + JSX.Attribute.NamespacedName namespaced_name + | _ -> + let name = identifier env in + JSX.Attribute.Identifier name + in + let value = + match Peek.token env with + | T_ASSIGN -> + Expect.token env T_ASSIGN; + let leading = Peek.comments env in + let tkn = Peek.token env in begin - let open JSX.ExpressionContainer in - match expression_container.expression with - | EmptyExpression _ -> - error_at env (loc, Error.JSXAttributeValueEmptyExpression); - | _ -> () - end; - loc, Some (JSX.Attribute.ExpressionContainer (loc, expression_container)) - | T_JSX_TEXT (loc, value, raw) as token -> - Expect.token env token; - let value = Ast.Literal.String value in - loc, Some (JSX.Attribute.Literal (loc, { Ast.Literal.value; raw;})) - | _ -> - error env Error.InvalidJSXAttributeValue; - let loc = Peek.loc env in - let raw = "" in - let value = Ast.Literal.String "" in - loc, Some (JSX.Attribute.Literal (loc, { Ast.Literal.value; raw;})) - end else end_loc, None in - Loc.btwn start_loc end_loc, JSX.Attribute.({ - name; - value; - }) + match tkn with + | T_LCURLY -> + let (loc, expression_container) = expression_container env in + JSX.ExpressionContainer.( + match expression_container.expression with + | EmptyExpression -> + error_at env (loc, Parse_error.JSXAttributeValueEmptyExpression) + | _ -> ()); + Some (JSX.Attribute.ExpressionContainer (loc, expression_container)) + | T_JSX_TEXT (loc, value, raw) as token -> + Expect.token env token; + let value = Ast.Literal.String value in + let trailing = tag_component_trailing_comments env in + Some + (JSX.Attribute.Literal + ( loc, + { + Ast.Literal.value; + raw; + comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + } )) + | _ -> + error env Parse_error.InvalidJSXAttributeValue; + let loc = Peek.loc env in + let raw = "" in + let value = Ast.Literal.String "" in + Some (JSX.Attribute.Literal (loc, { Ast.Literal.value; raw; comments = None })) + end + | _ -> None + in + { JSX.Attribute.name; value }) + env - let opening_element_without_lt = - let rec attributes env acc = - match Peek.token env with - | T_EOF - | T_DIV - | T_GREATER_THAN -> List.rev acc - | T_LCURLY -> - let attribute = JSX.Opening.SpreadAttribute (spread_attribute env) in - attributes env (attribute::acc) - | _ -> - let attribute = JSX.Opening.Attribute (attribute env) in - attributes env (attribute::acc) - - in fun env start_loc -> - let (name, attributes, selfClosing) = match Peek.token env with + let opening_element = + let rec attributes env acc = + match Peek.token env with + | T_JSX_IDENTIFIER _ -> + let attribute = JSX.Opening.Attribute (attribute env) in + attributes env (attribute :: acc) + | T_LCURLY -> + let attribute = JSX.Opening.SpreadAttribute (spread_attribute env) in + attributes env (attribute :: acc) + | _ -> List.rev acc + in + fun env -> + with_loc + (fun env -> + Expect.token env T_LESS_THAN; + match Peek.token env with | T_GREATER_THAN -> - (None, [], false) - | _ -> - let name = Some (name env) in + Eat.token env; + Ok `Fragment + | T_JSX_IDENTIFIER _ -> + let name = name env in let attributes = attributes env [] in - let selfClosing = Peek.token env = T_DIV in - (name, attributes, selfClosing) in - if selfClosing then Expect.token env T_DIV; - let end_loc = Peek.loc env in - Expect.token env T_GREATER_THAN; - Eat.pop_lex_mode env; - match name with - | Some name -> - Loc.btwn start_loc end_loc, `Element JSX.Opening.({ - name; - selfClosing; - attributes; - }) - | None -> - Loc.btwn start_loc end_loc, `Fragment - - let closing_element_without_lt env start_loc = - Expect.token env T_DIV; - let name = match Peek.token env with - | T_GREATER_THAN -> None - | _ -> Some (name env) in - let end_loc = Peek.loc env in - Expect.token env T_GREATER_THAN; - (* We double pop to avoid going back to childmode and re-lexing the - * lookahead *) - Eat.double_pop_lex_mode env; - match name with - | Some name -> - Loc.btwn start_loc end_loc, `Element JSX.Closing.({ - name; - }) - | None -> - Loc.btwn start_loc end_loc, `Fragment - - type element_or_closing = - | Closing of Loc.t JSX.Closing.t - | ClosingFragment of Loc.t - | ChildElement of (Loc.t * Loc.t JSX.element) - | ChildFragment of (Loc.t * Loc.t JSX.fragment) - - let rec child env = - match Peek.token env with - | T_LCURLY -> expression_container_or_spread_child env - | T_JSX_TEXT (loc, value, raw) as token -> - Expect.token env token; - loc, JSX.Text { JSX.Text.value; raw; } - | _ -> - (match element_or_fragment env with - | (loc, `Element element) -> loc, JSX.Element element - | (loc, `Fragment fragment) -> loc, JSX.Fragment fragment) + let self_closing = Eat.maybe env T_DIV in + let element = `Element { JSX.Opening.name; self_closing; attributes } in + if Eat.maybe env T_GREATER_THAN then + Ok element + else ( + Expect.error env T_GREATER_THAN; + Error element + ) + | _ -> + (* TODO: also say that we could expect an identifier, or if we're in a JSX child + then suggest escaping the < as `{'<'}` *) + Expect.error env T_GREATER_THAN; + Error `Fragment) + env - and element_without_lt = - let element_or_closing env = - Eat.push_lex_mode env Lex_mode.JSX_TAG; - let start_loc = Peek.loc env in + let closing_element env = + with_loc + (fun env -> Expect.token env T_LESS_THAN; + Expect.token env T_DIV; match Peek.token env with - | T_EOF - | T_DIV -> (match closing_element_without_lt env start_loc with - | (loc, `Element ec) -> Closing (loc, ec) - | (loc, `Fragment) -> ClosingFragment loc) - | _ -> (match element_without_lt env start_loc with - | (loc, `Element e) -> ChildElement (loc, e) - | (loc, `Fragment f) -> ChildFragment (loc, f)) - - in let rec children_and_closing env acc = - match Peek.token env with - | T_LESS_THAN -> ( - match element_or_closing env with - | Closing closingElement -> - List.rev acc, `Element closingElement - | ClosingFragment closingFragment -> - List.rev acc, `Fragment closingFragment - | ChildElement element -> - let element = fst element, JSX.Element (snd element) in - children_and_closing env (element::acc) - | ChildFragment fragment -> - let fragment = fst fragment, JSX.Fragment (snd fragment) in - children_and_closing env (fragment::acc)) - | T_EOF -> - error_unexpected env; - List.rev acc, `None + | T_GREATER_THAN -> + Eat.token env; + `Fragment + | T_JSX_IDENTIFIER _ -> + let name = name env in + Expect.token_opt env T_GREATER_THAN; + `Element { JSX.Closing.name } | _ -> - children_and_closing env ((child env)::acc) + Expect.error env T_GREATER_THAN; + `Fragment) + env - in let rec normalize name = JSX.(match name with - | Identifier (_, { Identifier.name }) -> name - | NamespacedName (_, { NamespacedName.namespace; name; }) -> - (snd namespace).Identifier.name ^ ":" ^ (snd name).Identifier.name - | MemberExpression (_, { MemberExpression._object; property; }) -> - let _object = match _object with - | MemberExpression.Identifier (_, {Identifier.name=id; _;}) -> id - | MemberExpression.MemberExpression e -> - normalize (JSX.MemberExpression e) in - _object ^ "." ^ (snd property).Identifier.name - ) + let rec child env = + match Peek.token env with + | T_LCURLY -> expression_container_or_spread_child env + | T_JSX_TEXT (loc, value, raw) as token -> + Expect.token env token; + (loc, JSX.Text { JSX.Text.value; raw }) + | _ -> + (match element_or_fragment env with + | (loc, `Element element) -> (loc, JSX.Element element) + | (loc, `Fragment fragment) -> (loc, JSX.Fragment fragment)) - in fun env start_loc -> - let openingElement = opening_element_without_lt env start_loc in - let children, closingElement = - let selfClosing = match snd openingElement with - | `Element e -> e.JSX.Opening.selfClosing - | `Fragment -> false in - if selfClosing - then [], `None - else begin - Eat.push_lex_mode env Lex_mode.JSX_CHILD; - let ret = children_and_closing env [] in - ret - end in - let end_loc = match closingElement with - | `Element (loc, { JSX.Closing.name }) -> - (match snd openingElement with - | `Element e -> - let opening_name = normalize e.JSX.Opening.name in - if normalize name <> opening_name - then error env (Error.ExpectedJSXClosingTag opening_name) - | `Fragment -> error env (Error.ExpectedJSXClosingTag "JSX fragment")); - loc - | `Fragment loc -> - (match snd openingElement with - | `Element e -> error env (Error.ExpectedJSXClosingTag (normalize e.JSX.Opening.name)) - | _ -> ()); - loc - | _ -> fst openingElement in - match snd openingElement with - | `Element e -> - Loc.btwn (fst openingElement) end_loc, `Element JSX.({ - openingElement = (fst openingElement, e); - closingElement = (match closingElement with - | `Element e -> Some e - | _ -> None); - children; - }) - | `Fragment -> - Loc.btwn (fst openingElement) end_loc, `Fragment JSX.({ - frag_openingElement = fst openingElement; - frag_closingElement = (match closingElement with - | `Fragment loc -> Some loc - | _ -> None); - frag_children = children; - }) + and element = + let children_and_closing = + let rec children_and_closing env acc = + let previous_loc = last_loc env in + match Peek.token env with + | T_LESS_THAN -> + Eat.push_lex_mode env Lex_mode.JSX_TAG; + begin + match (Peek.token env, Peek.ith_token ~i:1 env) with + | (T_LESS_THAN, T_EOF) + | (T_LESS_THAN, T_DIV) -> + let closing = + match closing_element env with + | (loc, `Element ec) -> `Element (loc, ec) + | (loc, `Fragment) -> `Fragment loc + in + (* We double pop to avoid going back to childmode and re-lexing the + * lookahead *) + Eat.double_pop_lex_mode env; + (List.rev acc, previous_loc, closing) + | _ -> + let child = + match element env with + | (loc, `Element e) -> (loc, JSX.Element e) + | (loc, `Fragment f) -> (loc, JSX.Fragment f) + in + children_and_closing env (child :: acc) + end + | T_EOF -> + error_unexpected env; + (List.rev acc, previous_loc, `None) + | _ -> children_and_closing env (child env :: acc) + in + fun env -> + let start_loc = Peek.loc env in + let (children, last_child_loc, closing) = children_and_closing env [] in + let last_child_loc = + match last_child_loc with + | Some x -> x + | None -> start_loc + in + (* It's a little bit tricky to untangle the parsing of the child elements from the parsing + * of the closing element, so we can't easily use `with_loc` here. Instead, we'll use the + * same logic that `with_loc` uses, but manipulate the locations explicitly. *) + let children_loc = Loc.btwn start_loc last_child_loc in + ((children_loc, children), closing) + in + let rec normalize name = + JSX.( + match name with + | Identifier (_, { Identifier.name; comments = _ }) -> name + | NamespacedName (_, { NamespacedName.namespace; name }) -> + (snd namespace).Identifier.name ^ ":" ^ (snd name).Identifier.name + | MemberExpression (_, { MemberExpression._object; property }) -> + let _object = + match _object with + | MemberExpression.Identifier (_, { Identifier.name = id; _ }) -> id + | MemberExpression.MemberExpression e -> normalize (JSX.MemberExpression e) + in + _object ^ "." ^ (snd property).Identifier.name) + in + let is_self_closing = function + | (_, Ok (`Element e)) -> e.JSX.Opening.self_closing + | (_, Ok `Fragment) -> false + | (_, Error _) -> true + in + fun env -> + let leading = Peek.comments env in + let opening_element = opening_element env in + Eat.pop_lex_mode env; + let (children, closing_element) = + if is_self_closing opening_element then + (with_loc (fun _ -> []) env, `None) + else ( + Eat.push_lex_mode env Lex_mode.JSX_CHILD; + children_and_closing env + ) + in + let trailing = Eat.trailing_comments env in + let end_loc = + match closing_element with + | `Element (loc, { JSX.Closing.name }) -> + (match snd opening_element with + | Ok (`Element { JSX.Opening.name = opening_name; _ }) -> + let opening_name = normalize opening_name in + if normalize name <> opening_name then + error env (Parse_error.ExpectedJSXClosingTag opening_name) + | Ok `Fragment -> error env (Parse_error.ExpectedJSXClosingTag "JSX fragment") + | Error _ -> ()); + loc + | `Fragment loc -> + (match snd opening_element with + | Ok (`Element { JSX.Opening.name = opening_name; _ }) -> + error env (Parse_error.ExpectedJSXClosingTag (normalize opening_name)) + | Ok `Fragment -> () + | Error _ -> ()); + loc + | _ -> fst opening_element + in + let result = + match opening_element with + | (start_loc, Ok (`Element e)) + | (start_loc, Error (`Element e)) -> + `Element + JSX. + { + opening_element = (start_loc, e); + closing_element = + (match closing_element with + | `Element e -> Some e + | _ -> None); + children; + comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + } + | (start_loc, Ok `Fragment) + | (start_loc, Error `Fragment) -> + `Fragment + JSX. + { + frag_opening_element = start_loc; + frag_closing_element = + (match closing_element with + | `Fragment loc -> loc + (* the following are parse erros *) + | `Element (loc, _) -> loc + | _ -> end_loc); + frag_children = children; + frag_comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + } + in + (Loc.btwn (fst opening_element) end_loc, result) - and element_or_fragment env = - let start_loc = Peek.loc env in - Eat.push_lex_mode env Lex_mode.JSX_TAG; - Expect.token env T_LESS_THAN; - element_without_lt env start_loc + and element_or_fragment env = + Eat.push_lex_mode env Lex_mode.JSX_TAG; + element env end diff --git a/lib/lex_env.ml b/lib/lex_env.ml index 5ed05bb..7b7a219 100644 --- a/lib/lex_env.ml +++ b/lib/lex_env.ml @@ -1,19 +1,18 @@ -(** - * Copyright (c) 2013-present, Facebook, Inc. +(* + * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. *) -open Flow_parser_sedlex - type t = { - lex_source : File_key.t option; - lex_lb : Sedlexing.lexbuf; - lex_bol : bol; - lex_in_comment_syntax : bool; + lex_source: File_key.t option; + lex_lb: Sedlexing.lexbuf; + lex_bol: bol; + lex_in_comment_syntax: bool; lex_enable_comment_syntax: bool; - lex_state : lex_state; + lex_state: lex_state; + lex_last_loc: Loc.t; } (* bol = Beginning Of Line *) @@ -22,24 +21,25 @@ and bol = { offset: int; } -and lex_state = { - lex_errors_acc: (Loc.t * Parse_error.t) list; - lex_comments_acc: Loc.t Ast.Comment.t list; -} +and lex_state = { lex_errors_acc: (Loc.t * Parse_error.t) list } -let empty_lex_state = { - lex_errors_acc = []; - lex_comments_acc = []; -} +let empty_lex_state = { lex_errors_acc = [] } -let new_lex_env lex_source lex_lb ~enable_types_in_comments = { - lex_source; - lex_lb; - lex_bol = { line = 1; offset = 0}; - lex_in_comment_syntax = false; - lex_enable_comment_syntax = enable_types_in_comments; - lex_state = empty_lex_state; -} +(* The lex_last_loc should initially be set to the beginning of the first line, so that + comments on the first line are reported as not being on a new line. *) +let initial_last_loc = + { Loc.source = None; start = { Loc.line = 1; column = 0 }; _end = { Loc.line = 1; column = 0 } } + +let new_lex_env lex_source lex_lb ~enable_types_in_comments = + { + lex_source; + lex_lb; + lex_bol = { line = 1; offset = 0 }; + lex_in_comment_syntax = false; + lex_enable_comment_syntax = enable_types_in_comments; + lex_state = empty_lex_state; + lex_last_loc = initial_last_loc; + } (* copy all the mutable things so that we have a distinct lexing environment that does not interfere with ordinary lexer operations *) @@ -49,43 +49,47 @@ let clone env = let get_and_clear_state env = let state = env.lex_state in - let env = if state != empty_lex_state - then { env with lex_state = empty_lex_state } - else env + let env = + if state != empty_lex_state then + { env with lex_state = empty_lex_state } + else + env in - env, state + (env, state) let lexbuf env = env.lex_lb + let source env = env.lex_source + let state env = env.lex_state + let line env = env.lex_bol.line + let bol_offset env = env.lex_bol.offset + let is_in_comment_syntax env = env.lex_in_comment_syntax + let is_comment_syntax_enabled env = env.lex_enable_comment_syntax + let in_comment_syntax is_in env = - if is_in <> env.lex_in_comment_syntax - then { env with lex_in_comment_syntax = is_in } - else env + if is_in <> env.lex_in_comment_syntax then + { env with lex_in_comment_syntax = is_in } + else + env (* TODO *) let debug_string_of_lexbuf _lb = "" -let debug_string_of_lex_env (env: t) = - let source = match (source env) with +let debug_string_of_lex_env (env : t) = + let source = + match source env with | None -> "None" | Some x -> Printf.sprintf "Some %S" (File_key.to_string x) in Printf.sprintf - "{\n \ - lex_source = %s\n \ - lex_lb = %s\n \ - lex_in_comment_syntax = %b\n \ - lex_enable_comment_syntax = %b\n \ - lex_state = {errors = (count = %d); comments = (count = %d)}\n\ - }" + "{\n lex_source = %s\n lex_lb = %s\n lex_in_comment_syntax = %b\n lex_enable_comment_syntax = %b\n lex_state = {errors = (count = %d)}\n}" source (debug_string_of_lexbuf env.lex_lb) (is_in_comment_syntax env) (is_comment_syntax_enabled env) (List.length (state env).lex_errors_acc) - (List.length (state env).lex_comments_acc) diff --git a/lib/lex_result.ml b/lib/lex_result.ml index 17f8809..57b1d4a 100644 --- a/lib/lex_result.ml +++ b/lib/lex_result.ml @@ -1,32 +1,29 @@ -(** - * Copyright (c) 2013-present, Facebook, Inc. +(* + * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. *) - type t = { lex_token: Token.t; lex_loc: Loc.t; lex_errors: (Loc.t * Parse_error.t) list; - lex_comments: Loc.t Ast.Comment.t list; + lex_comments: Loc.t Flow_ast.Comment.t list; } let token result = result.lex_token + let loc result = result.lex_loc + let comments result = result.lex_comments + let errors result = result.lex_errors let debug_string_of_lex_result lex_result = Printf.sprintf - "{\n \ - lex_token = %s\n \ - lex_value = %S\n \ - lex_errors = (length = %d)\n \ - lex_comments = (length = %d)\n\ - }" - (Token.token_to_string lex_result.lex_token) - (Token.value_of_token lex_result.lex_token) - (List.length lex_result.lex_errors) - (List.length lex_result.lex_comments) + "{\n lex_token = %s\n lex_value = %S\n lex_errors = (length = %d)\n lex_comments = (length = %d)\n}" + (Token.token_to_string lex_result.lex_token) + (Token.value_of_token lex_result.lex_token) + (List.length lex_result.lex_errors) + (List.length lex_result.lex_comments) diff --git a/lib/lexer.ml b/lib/lexer.ml deleted file mode 100644 index 7b8e31d..0000000 --- a/lib/lexer.ml +++ /dev/null @@ -1,1794 +0,0 @@ -(** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - *) - - -open Token -open Lex_env -open Flow_parser_sedlex - -let lexeme = Sedlexing.Utf8.lexeme -let sub_lexeme = Sedlexing.Utf8.sub_lexeme - -let letter = [%sedlex.regexp? 'a'..'z' | 'A'..'Z' | '$'] -let id_letter = [%sedlex.regexp? letter | '_'] -let digit = [%sedlex.regexp? '0'..'9'] -let digit_non_zero = [%sedlex.regexp? '1'..'9'] -let decintlit = [%sedlex.regexp? '0' | ('1'..'9', Star digit)] (* DecimalIntegerLiteral *) -let alphanumeric = [%sedlex.regexp? digit | letter] -let word = [%sedlex.regexp? letter, Star alphanumeric] - -let hex_digit = [%sedlex.regexp? digit | 'a'..'f' | 'A'..'F'] -let non_hex_letter = [%sedlex.regexp? 'g'..'z' | 'G'..'Z' | '$'] - -let bin_digit = [%sedlex.regexp? '0' | '1'] -let oct_digit = [%sedlex.regexp? '0'..'7'] - -(* This regex could be simplified to (digit Star (digit OR '_' digit)) - * That makes the underscore and failure cases faster, and the base case take x2-3 the steps - * As the codebase contains more base cases than underscored or errors, prefer this version *) -let underscored_bin = [%sedlex.regexp? - Plus bin_digit | (bin_digit, Star (bin_digit | ('_', bin_digit))) -] -let underscored_oct = [%sedlex.regexp? - Plus oct_digit | (oct_digit, Star (oct_digit | ('_', oct_digit))) -] -let underscored_hex = [%sedlex.regexp? - Plus hex_digit | (hex_digit, Star (hex_digit | ('_', hex_digit))) -] -let underscored_digit = [%sedlex.regexp? - Plus digit | (digit_non_zero, Star (digit | ('_', digit))) -] -let underscored_decimal = [%sedlex.regexp? - Plus digit | (digit, Star (digit | ('_', digit))) -] - -(* Different ways you can write a number *) -let binnumber = [%sedlex.regexp? '0', ('B' | 'b'), underscored_bin] -let octnumber = [%sedlex.regexp? '0', ('O' | 'o'), underscored_oct] -let legacyoctnumber = [%sedlex.regexp? '0', underscored_oct] -let hexnumber = [%sedlex.regexp? '0', ('X' | 'x'), underscored_hex] -let scinumber = [%sedlex.regexp? - ((decintlit, Opt ('.', Opt underscored_decimal)) | ('.', underscored_decimal)), - ('e' | 'E'), Opt ('-' | '+'), underscored_digit -] -let wholenumber = [%sedlex.regexp? underscored_digit, Opt '.'] -let floatnumber = [%sedlex.regexp? Opt underscored_digit, '.', underscored_decimal] - -(* 2-8 alphanumeric characters. I could match them directly, but this leads to - * ~5k more lines of generated lexer -let htmlentity = "quot" | "amp" | "apos" | "lt" | "gt" | "nbsp" | "iexcl" - | "cent" | "pound" | "curren" | "yen" | "brvbar" | "sect" | "uml" | "copy" - | "ordf" | "laquo" | "not" | "shy" | "reg" | "macr" | "deg" | "plusmn" - | "sup2" | "sup3" | "acute" | "micro" | "para" | "middot" | "cedil" | "sup1" - | "ordm" | "raquo" | "frac14" | "frac12" | "frac34" | "iquest" | "Agrave" - | "Aacute" | "Acirc" | "Atilde" | "Auml" | "Aring" | "AElig" | "Ccedil" - | "Egrave" | "Eacute" | "Ecirc" | "Euml" | "Igrave" | "Iacute" | "Icirc" - | "Iuml" | "ETH" | "Ntilde" | "Ograve" | "Oacute" | "Ocirc" | "Otilde" - | "Ouml" | "times" | "Oslash" | "Ugrave" | "Uacute" | "Ucirc" | "Uuml" - | "Yacute" | "THORN" | "szlig" | "agrave" | "aacute" | "acirc" | "atilde" - | "auml" | "aring" | "aelig" | "ccedil" | "egrave" | "eacute" | "ecirc" - | "euml" | "igrave" | "iacute" | "icirc" | "iuml" | "eth" | "ntilde" - | "ograve" | "oacute" | "ocirc" | "otilde" | "ouml" | "divide" | "oslash" - | "ugrave" | "uacute" | "ucirc" | "uuml" | "yacute" | "thorn" | "yuml" - | "OElig" | "oelig" | "Scaron" | "scaron" | "Yuml" | "fnof" | "circ" | "tilde" - | "Alpha" | "Beta" | "Gamma" | "Delta" | "Epsilon" | "Zeta" | "Eta" | "Theta" - | "Iota" | "Kappa" | "Lambda" | "Mu" | "Nu" | "Xi" | "Omicron" | "Pi" | "Rho" - | "Sigma" | "Tau" | "Upsilon" | "Phi" | "Chi" | "Psi" | "Omega" | "alpha" - | "beta" | "gamma" | "delta" | "epsilon" | "zeta" | "eta" | "theta" | "iota" - | "kappa" | "lambda" | "mu" | "nu" | "xi" | "omicron" | "pi" | "rho" - | "sigmaf" | "sigma" | "tau" | "upsilon" | "phi" | "chi" | "psi" | "omega" - | "thetasym" | "upsih" | "piv" | "ensp" | "emsp" | "thinsp" | "zwnj" | "zwj" - | "lrm" | "rlm" | "ndash" | "mdash" | "lsquo" | "rsquo" | "sbquo" | "ldquo" - | "rdquo" | "bdquo" | "dagger" | "Dagger" | "bull" | "hellip" | "permil" - | "prime" | "Prime" | "lsaquo" | "rsaquo" | "oline" | "frasl" | "euro" - | "image" | "weierp" | "real" | "trade" | "alefsym" | "larr" | "uarr" | "rarr" - | "darr" | "harr" | "crarr" | "lArr" | "uArr" | "rArr" | "dArr" | "hArr" - | "forall" | "part" | "exist" | "empty" | "nabla" | "isin" | "notin" | "ni" - | "prod" | "sum" | "minus" | "lowast" | "radic" | "prop" | "infin" | "ang" - | "and" | "or" | "cap" | "cup" | "'int'" | "there4" | "sim" | "cong" | "asymp" - | "ne" | "equiv" | "le" | "ge" | "sub" | "sup" | "nsub" | "sube" | "supe" - | "oplus" | "otimes" | "perp" | "sdot" | "lceil" | "rceil" | "lfloor" - | "rfloor" | "lang" | "rang" | "loz" | "spades" | "clubs" | "hearts" | "diams" -*) -let htmlentity = [%sedlex.regexp? - alphanumeric, alphanumeric, Opt alphanumeric, Opt alphanumeric, - Opt alphanumeric, Opt alphanumeric, Opt alphanumeric, Opt alphanumeric -] - -(* http://www.ecma-international.org/ecma-262/6.0/#table-32 *) -let whitespace = [%sedlex.regexp? - 0x0009 | 0x000B | 0x000C | 0x0020 | 0x00A0 | 0xfeff | - 0x1680 | 0x180e | 0x2000 .. 0x200a | 0x202f | 0x205f | 0x3000 -] - -(* minus sign in front of negative numbers - (only for types! regular numbers use T_MINUS!) *) -let neg = [%sedlex.regexp? '-', Star whitespace] - -let line_terminator_sequence = [%sedlex.regexp? '\n' | '\r' | "\r\n" | 0x2028 | 0x2029] -let line_terminator_sequence_start = [%sedlex.regexp? '\n' | '\r' | 0x2028 | 0x2029] - -let hex_quad = [%sedlex.regexp? hex_digit, hex_digit, hex_digit, hex_digit] -let unicode_escape = [%sedlex.regexp? "\\u", hex_quad] -let codepoint_escape = [%sedlex.regexp? "\\u{", Plus hex_digit, '}'] -let js_id_start = [%sedlex.regexp? '$' | '_' | id_start | unicode_escape | codepoint_escape] -let js_id_continue = [%sedlex.regexp? - '$' | '_' | 0x200C | 0x200D | id_continue | unicode_escape | codepoint_escape -] - -let pos_at_offset env offset = - { Loc. - line = Lex_env.line env; - column = offset - Lex_env.bol_offset env; - offset = offset; - } - -let loc_of_offsets env start_offset end_offset = - { Loc. - source = Lex_env.source env; - start = pos_at_offset env start_offset; - _end = pos_at_offset env end_offset; - } - -let start_pos_of_lexbuf env (lexbuf: Sedlexing.lexbuf) = - let start_offset = Sedlexing.lexeme_start lexbuf in - pos_at_offset env start_offset - -let end_pos_of_lexbuf env (lexbuf: Sedlexing.lexbuf) = - let end_offset = Sedlexing.lexeme_end lexbuf in - pos_at_offset env end_offset - -let loc_of_lexbuf env (lexbuf: Sedlexing.lexbuf) = - let start_offset = Sedlexing.lexeme_start lexbuf in - let end_offset = Sedlexing.lexeme_end lexbuf in - loc_of_offsets env start_offset end_offset - -let get_result_and_clear_state (env, lex_token) = - let env, state = get_and_clear_state env in - let lex_loc = match lex_token with - | T_STRING (loc, _, _, _) -> loc - | T_JSX_TEXT (loc, _, _) -> loc - | T_TEMPLATE_PART (loc, _, _) -> loc - | T_REGEXP (loc, _, _) -> loc - | _ -> loc_of_lexbuf env env.lex_lb - in - env, { - Lex_result.lex_token; - lex_loc; - lex_errors = List.rev state.lex_errors_acc; - lex_comments = List.rev state.lex_comments_acc; - } - -let lex_error (env: Lex_env.t) loc err: Lex_env.t = - let lex_errors_acc = (loc, err)::env.lex_state.lex_errors_acc in - { env with lex_state = { env.lex_state with lex_errors_acc; } } - -let unexpected_error (env: Lex_env.t) (loc: Loc.t) value = - lex_error env loc (Parse_error.UnexpectedToken value) - -let unexpected_error_w_suggest (env: Lex_env.t) (loc: Loc.t) value suggest = - lex_error env loc (Parse_error.UnexpectedTokenWithSuggestion (value, suggest)) - -let illegal (env: Lex_env.t) (loc: Loc.t) = - lex_error env loc (Parse_error.UnexpectedToken "ILLEGAL") - -let new_line env lexbuf = - let offset = Sedlexing.lexeme_end lexbuf in - let lex_bol = { line = Lex_env.line env + 1; offset; } in - { env with Lex_env.lex_bol } - -module FloatOfString : sig - val float_of_string: string -> float -end = struct - type t = { - negative: bool; - mantissa: int; - exponent: int; - decimal_exponent: int option; - todo: char list; - } - - exception No_good - - let eat f = - match f.todo with - | _::todo -> { f with todo; } - | _ -> raise No_good - - let start str = - let todo = ref [] in - String.iter (fun c -> todo := c::(!todo)) str; - { - negative = false; - mantissa = 0; - exponent = 0; - decimal_exponent = None; - todo = List.rev (!todo); - } - - let parse_sign f = - match f.todo with - | '+'::_ -> eat f - | '-'::_ -> { (eat f) with negative = true; } - | _ -> f - - let parse_hex_symbol f = - match f.todo with - | '0'::('x' | 'X')::_ -> f |> eat |> eat - | _ -> raise No_good - - let parse_exponent f = - let todo_str = f.todo - |> List.map Char.escaped - |> String.concat "" in - let exponent = - try int_of_string todo_str - with Failure _ -> raise No_good in - { f with exponent; todo = [] } - - let rec parse_body f = - match f.todo with - | [] -> f - (* _ is just ignored *) - | '_'::_ -> parse_body (eat f) - | '.'::_ -> - if f.decimal_exponent = None - then parse_body { (eat f) with decimal_exponent = Some 0 } - else raise No_good - | ('p' | 'P')::_ -> - parse_exponent (eat f) - | c::_ -> - let ref_char_code = - if c >= '0' && c <= '9' - then Char.code '0' - else if c >= 'A' && c <= 'F' - then Char.code 'A' - 10 - else if c >= 'a' && c <= 'f' - then Char.code 'a' - 10 - else raise No_good in - let value = (Char.code c) - ref_char_code in - let decimal_exponent = match f.decimal_exponent with - | None -> None - | Some e -> Some (e - 4) in - let mantissa = (f.mantissa lsl 4) + value in - parse_body { (eat f) with decimal_exponent; mantissa; } - - let float_of_t f = - assert (f.todo = []); - let ret = float_of_int f.mantissa in - let exponent = match f.decimal_exponent with - | None -> f.exponent - | Some decimal_exponent -> f.exponent + decimal_exponent in - let ret = - if exponent = 0 - then ret - else ret ** (float_of_int exponent) in - if f.negative - then -.ret - else ret - - let float_of_string str = - try Pervasives.float_of_string str - with e when Sys.win32 -> - try - start str - |> parse_sign - |> parse_hex_symbol - |> parse_body - |> float_of_t - with No_good -> raise e -end - -let save_comment - (env: Lex_env.t) - (start: Loc.position) (_end: Loc.position) - (buf: Buffer.t) - (multiline: bool) -: Lex_env.t = - let open Ast.Comment in - let loc = { Loc.source = Lex_env.source env; start; _end } in - let s = Buffer.contents buf in - let c = if multiline then Block s else Line s in - let lex_comments_acc = (loc, c) :: env.lex_state.lex_comments_acc in - { env with lex_state = { env.lex_state with lex_comments_acc; } } - -let mk_num_singleton number_type raw = - let neg, num = if raw.[0] = '-' - then true, String.sub raw 1 (String.length raw - 1) - else false, raw - in - (* convert singleton number type into a float *) - let value = match number_type with - | LEGACY_OCTAL -> - begin try Int64.to_float (Int64.of_string ("0o"^num)) - with Failure _ -> failwith ("Invalid legacy octal "^num) - end - | BINARY - | OCTAL -> - begin try Int64.to_float (Int64.of_string num) - with Failure _ -> failwith ("Invalid binary/octal "^num) - end - | NORMAL -> - begin try FloatOfString.float_of_string num - with Failure _ -> failwith ("Invalid number "^num) - end - in - let value = if neg then ~-.value else value in - T_NUMBER_SINGLETON_TYPE { kind = number_type; value; raw } - -let decode_identifier = - let assert_valid_unicode_in_identifier env loc code = - let lexbuf = Sedlexing.from_int_array [|code|] in - match%sedlex lexbuf with - | js_id_start -> env - | js_id_continue -> env - | any - | eof -> lex_error env loc Parse_error.IllegalUnicodeEscape - | _ -> failwith "unreachable" - in - let loc_and_sub_lexeme env offset lexbuf trim_start trim_end = - let start_offset = offset + Sedlexing.lexeme_start lexbuf in - let end_offset = offset + Sedlexing.lexeme_end lexbuf in - let loc = loc_of_offsets env start_offset end_offset in - loc, sub_lexeme lexbuf trim_start (Sedlexing.lexeme_length lexbuf - trim_start - trim_end) - in - let rec id_char env offset buf lexbuf = - match%sedlex lexbuf with - | unicode_escape -> - let loc, hex = loc_and_sub_lexeme env offset lexbuf 2 0 in - let code = int_of_string ("0x"^hex) in - let env = assert_valid_unicode_in_identifier env loc code in - Wtf8.add_wtf_8 buf code; - id_char env offset buf lexbuf - - | codepoint_escape -> - let loc, hex = loc_and_sub_lexeme env offset lexbuf 3 1 in - let code = int_of_string ("0x"^hex) in - let env = assert_valid_unicode_in_identifier env loc code in - Wtf8.add_wtf_8 buf code; - id_char env offset buf lexbuf - - | eof -> - env, Buffer.contents buf - - (* match multi-char substrings that don't contain the start chars of the above patterns *) - | Plus (Compl (eof | "\\")) - | any -> - let x = lexeme lexbuf in - Buffer.add_string buf x; - id_char env offset buf lexbuf - - | _ -> failwith "unreachable" - in - fun env raw -> - let offset = Sedlexing.lexeme_start env.lex_lb in - let lexbuf = Sedlexing.Utf8.from_string raw in - let buf = Buffer.create (String.length raw) in - id_char env offset buf lexbuf - -let recover env lexbuf ~f = - let env = illegal env (loc_of_lexbuf env lexbuf) in - Sedlexing.rollback lexbuf; - f env lexbuf - -type jsx_text_mode = - | JSX_SINGLE_QUOTED_TEXT - | JSX_DOUBLE_QUOTED_TEXT - | JSX_CHILD_TEXT - -type result = - | Token of Lex_env.t * Token.t - | Continue of Lex_env.t - -let rec comment env buf lexbuf = - match%sedlex lexbuf with - | line_terminator_sequence -> - let env = new_line env lexbuf in - Buffer.add_string buf (lexeme lexbuf); - comment env buf lexbuf - - | "*/" -> - let env = - if is_in_comment_syntax env then - let loc = loc_of_lexbuf env lexbuf in - unexpected_error_w_suggest env loc "*/" "*-/" - else env - in - env, end_pos_of_lexbuf env lexbuf - - | "*-/" -> - if is_in_comment_syntax env - then env, end_pos_of_lexbuf env lexbuf - else ( - Buffer.add_string buf "*-/"; - comment env buf lexbuf - ) - - (* match multi-char substrings that don't contain the start chars of the above patterns *) - | Plus (Compl (line_terminator_sequence_start | '*')) - | any -> - Buffer.add_string buf (lexeme lexbuf); - comment env buf lexbuf - - | _ -> - let env = illegal env (loc_of_lexbuf env lexbuf) in - env, end_pos_of_lexbuf env lexbuf - - -let rec line_comment env buf lexbuf = - match%sedlex lexbuf with - | eof -> - env, end_pos_of_lexbuf env lexbuf - - | line_terminator_sequence -> - let { Loc.line; column; offset } = end_pos_of_lexbuf env lexbuf in - let env = new_line env lexbuf in - let len = Sedlexing.lexeme_length lexbuf in - let end_pos = { Loc. - line; - column = column - len; - offset = offset - len; - } in - env, end_pos - - (* match multi-char substrings that don't contain the start chars of the above patterns *) - | Plus (Compl (eof | line_terminator_sequence_start)) - | any -> - let str = lexeme lexbuf in - Buffer.add_string buf str; - line_comment env buf lexbuf - - | _ -> failwith "unreachable" - - -let string_escape env lexbuf = - match%sedlex lexbuf with - | eof - | '\\' -> - let str = lexeme lexbuf in - let codes = Sedlexing.lexeme lexbuf in - env, str, codes, false - - | 'x', hex_digit, hex_digit -> - let str = lexeme lexbuf in - let code = int_of_string ("0"^str) in (* 0xAB *) - env, str, [|code|], false - - | '0'..'7', '0'..'7', '0'..'7' -> - let str = lexeme lexbuf in - let code = int_of_string ("0o"^str) in (* 0o012 *) - (* If the 3 character octal code is larger than 256 - * then it is parsed as a 2 character octal code *) - if code < 256 then - env, str, [|code|], true - else - let remainder = code land 7 in - let code = code lsr 3 in - env, str, [|code; Char.code '0' + remainder|], true - - | '0'..'7', '0'..'7' -> - let str = lexeme lexbuf in - let code = int_of_string ("0o"^str) in (* 0o01 *) - env, str, [|code|], true - - | '0' -> env, "0", [|0x0|], false - | 'b' -> env, "b", [|0x8|], false - | 'f' -> env, "f", [|0xC|], false - | 'n' -> env, "n", [|0xA|], false - | 'r' -> env, "r", [|0xD|], false - | 't' -> env, "t", [|0x9|], false - | 'v' -> env, "v", [|0xB|], false - | '0'..'7' -> - let str = lexeme lexbuf in - let code = int_of_string ("0o"^str) in (* 0o1 *) - env, str, [|code|], true - - | 'u', hex_quad -> - let str = lexeme lexbuf in - let hex = String.sub str 1 (String.length str - 1) in - let code = int_of_string ("0x"^hex) in - env, str, [|code|], false - - | "u{", Plus hex_digit, '}' -> - let str = lexeme lexbuf in - let hex = String.sub str 2 (String.length str - 3) in - let code = int_of_string ("0x"^hex) in - (* 11.8.4.1 *) - let env = if code > 1114111 - then illegal env (loc_of_lexbuf env lexbuf) - else env - in - env, str, [|code|], false - - | 'u' | 'x' | '0'..'7' -> - let str = lexeme lexbuf in - let codes = Sedlexing.lexeme lexbuf in - let env = illegal env (loc_of_lexbuf env lexbuf) in - env, str, codes, false - - | line_terminator_sequence -> - let str = lexeme lexbuf in - let env = new_line env lexbuf in - env, str, [||], false - - | any -> - let str = lexeme lexbuf in - let codes = Sedlexing.lexeme lexbuf in - env, str, codes, false - - | _ -> failwith "unreachable" - - -(* Really simple version of string lexing. Just try to find beginning and end of - * string. We can inspect the string later to find invalid escapes, etc *) -let rec string_quote env q buf raw octal lexbuf = - match%sedlex lexbuf with - | "'" | '"' -> - let q' = lexeme lexbuf in - Buffer.add_string raw q'; - if q = q' - then env, end_pos_of_lexbuf env lexbuf, octal - else begin - Buffer.add_string buf q'; - string_quote env q buf raw octal lexbuf - end - - | '\\' -> - Buffer.add_string raw "\\"; - let env, str, codes, octal' = string_escape env lexbuf in - let octal = octal' || octal in - Buffer.add_string raw str; - Array.iter (Wtf8.add_wtf_8 buf) codes; - string_quote env q buf raw octal lexbuf - - | '\n' | eof -> - let x = lexeme lexbuf in - Buffer.add_string raw x; - let env = illegal env (loc_of_lexbuf env lexbuf) in - Buffer.add_string buf x; - env, end_pos_of_lexbuf env lexbuf, octal - - (* match multi-char substrings that don't contain the start chars of the above patterns *) - | Plus (Compl ("'" | '"' | '\\' | '\n' | eof)) - | any -> - let x = lexeme lexbuf in - Buffer.add_string raw x; - Buffer.add_string buf x; - string_quote env q buf raw octal lexbuf - - | _ -> failwith "unreachable" - - -let rec template_part env cooked raw literal lexbuf = - match%sedlex lexbuf with - | eof -> - let env = illegal env (loc_of_lexbuf env lexbuf) in - env, true - - | '`' -> - Buffer.add_char literal '`'; - env, true - - | "${" -> - Buffer.add_string literal "${"; - env, false - - | '\\' -> - Buffer.add_char raw '\\'; - Buffer.add_char literal '\\'; - let env, str, codes, _ = string_escape env lexbuf in - Buffer.add_string raw str; - Buffer.add_string literal str; - Array.iter (Wtf8.add_wtf_8 cooked) codes; - template_part env cooked raw literal lexbuf - - (* ECMAScript 6th Syntax, 11.8.6.1 Static Semantics: TV's and TRV's - * Long story short, is 0xA, is 0xA, and is 0xA - * *) - | "\r\n" -> - Buffer.add_string raw "\r\n"; - Buffer.add_string literal "\r\n"; - Buffer.add_string cooked "\n"; - let env = new_line env lexbuf in - template_part env cooked raw literal lexbuf - - | "\n" | "\r" -> - let lf = lexeme lexbuf in - Buffer.add_string raw lf; - Buffer.add_string literal lf; - Buffer.add_char cooked '\n'; - let env = new_line env lexbuf in - template_part env cooked raw literal lexbuf - - (* match multi-char substrings that don't contain the start chars of the above patterns *) - | Plus (Compl (eof | '`' | '$' | '\\' | '\r' | '\n')) - | any -> - let c = lexeme lexbuf in - Buffer.add_string raw c; - Buffer.add_string literal c; - Buffer.add_string cooked c; - template_part env cooked raw literal lexbuf - - | _ -> failwith "unreachable" - - -let token (env: Lex_env.t) lexbuf : result = - match%sedlex lexbuf with - | line_terminator_sequence -> - let env = new_line env lexbuf in - Continue env - - | '\\' -> - let env = illegal env (loc_of_lexbuf env lexbuf) in - Continue env - - | Plus whitespace -> - Continue env - - | "/*" -> - let start_pos = start_pos_of_lexbuf env lexbuf in - let buf = Buffer.create 127 in - let env, end_pos = comment env buf lexbuf in - let env = save_comment env start_pos end_pos buf true in - Continue env - - | "/*", Star whitespace, (":" | "::" | "flow-include") -> - let pattern = lexeme lexbuf in - if not (is_comment_syntax_enabled env) then - let start_pos = start_pos_of_lexbuf env lexbuf in - let buf = Buffer.create 127 in - Buffer.add_string buf (String.sub pattern 2 (String.length pattern - 2)); - let env, end_pos = comment env buf lexbuf in - let env = save_comment env start_pos end_pos buf true in - Continue env - else - let env = - if is_in_comment_syntax env then - let loc = loc_of_lexbuf env lexbuf in - unexpected_error env loc pattern - else env - in - let env = in_comment_syntax true env in - let len = Sedlexing.lexeme_length lexbuf in - if Sedlexing.Utf8.sub_lexeme lexbuf (len - 1) 1 = ":" && - Sedlexing.Utf8.sub_lexeme lexbuf (len - 2) 1 <> ":" then - Token (env, T_COLON) - else - Continue env - - | "*/" -> - if is_in_comment_syntax env then - let env = in_comment_syntax false env in - Continue env - else begin - Sedlexing.rollback lexbuf; - match%sedlex lexbuf with - | "*" -> Token (env, T_MULT) - | _ -> failwith "expected *" - end - - | "//" -> - let start_pos = start_pos_of_lexbuf env lexbuf in - let buf = Buffer.create 127 in - let env, end_pos = line_comment env buf lexbuf in - let env = save_comment env start_pos end_pos buf false in - Continue env - - (* Support for the shebang at the beginning of a file. It is treated like a - * comment at the beginning or an error elsewhere *) - | "#!" -> - if Sedlexing.lexeme_start lexbuf = 0 then - let env, _ = line_comment env (Buffer.create 127) lexbuf in - Continue env - else - Token (env, T_ERROR "#!") - - (* Values *) - | "'" | '"' -> - let quote = lexeme lexbuf in - let start = start_pos_of_lexbuf env lexbuf in - let buf = Buffer.create 127 in - let raw = Buffer.create 127 in - Buffer.add_string raw quote; - let octal = false in - let env, _end, octal = string_quote env quote buf raw octal lexbuf in - let loc = { Loc.source = Lex_env.source env; start; _end } in - Token (env, T_STRING (loc, Buffer.contents buf, Buffer.contents raw, octal)) - - | '`' -> - let cooked = Buffer.create 127 in - let raw = Buffer.create 127 in - let literal = Buffer.create 127 in - Buffer.add_string literal (lexeme lexbuf); - - let start = start_pos_of_lexbuf env lexbuf in - let env, is_tail = template_part env cooked raw literal lexbuf in - let _end = end_pos_of_lexbuf env lexbuf in - let loc = { Loc.source = Lex_env.source env; start; _end } in - Token (env, T_TEMPLATE_PART ( - loc, - { - cooked = Buffer.contents cooked; - raw = Buffer.contents raw; - literal = Buffer.contents literal; - }, - is_tail - )) - - | binnumber, (letter | '2'..'9'), Star alphanumeric -> - (* Numbers cannot be immediately followed by words *) - recover env lexbuf ~f:(fun env lexbuf -> match%sedlex lexbuf with - | binnumber -> - Token (env, T_NUMBER { kind = BINARY; raw = lexeme lexbuf }) - | _ -> failwith "unreachable" - ) - - | binnumber -> - Token (env, T_NUMBER { kind = BINARY; raw = lexeme lexbuf }) - - | octnumber, (letter | '8'..'9'), Star alphanumeric -> - (* Numbers cannot be immediately followed by words *) - recover env lexbuf ~f:(fun env lexbuf -> match%sedlex lexbuf with - | octnumber -> Token (env, T_NUMBER { kind = OCTAL; raw = lexeme lexbuf }) - | _ -> failwith "unreachable" - ) - - | octnumber -> - Token (env, T_NUMBER { kind = OCTAL; raw = lexeme lexbuf }) - - | legacyoctnumber, (letter | '8'..'9'), Star alphanumeric -> - (* Numbers cannot be immediately followed by words *) - recover env lexbuf ~f:(fun env lexbuf -> match%sedlex lexbuf with - | legacyoctnumber -> Token (env, T_NUMBER { kind = LEGACY_OCTAL; raw = lexeme lexbuf }) - | _ -> failwith "unreachable" - ) - - | legacyoctnumber -> - Token (env, T_NUMBER { kind = LEGACY_OCTAL; raw = lexeme lexbuf }) - - | hexnumber, non_hex_letter, Star alphanumeric -> - (* Numbers cannot be immediately followed by words *) - recover env lexbuf ~f:(fun env lexbuf -> match%sedlex lexbuf with - | hexnumber -> Token (env, T_NUMBER { kind = NORMAL; raw = lexeme lexbuf }) - | _ -> failwith "unreachable" - ) - - | hexnumber -> - Token (env, T_NUMBER { kind = NORMAL; raw = lexeme lexbuf }) - - | scinumber, word -> - (* Numbers cannot be immediately followed by words *) - recover env lexbuf ~f:(fun env lexbuf -> match%sedlex lexbuf with - | scinumber -> Token (env, T_NUMBER { kind = NORMAL; raw = lexeme lexbuf }) - | _ -> failwith "unreachable" - ) - - | scinumber -> - Token (env, T_NUMBER { kind = NORMAL; raw = lexeme lexbuf }) - - | (wholenumber | floatnumber), word -> - (* Numbers cannot be immediately followed by words *) - recover env lexbuf ~f:(fun env lexbuf -> match%sedlex lexbuf with - | wholenumber | floatnumber -> - Token (env, T_NUMBER { kind = NORMAL; raw = lexeme lexbuf }) - | _ -> failwith "unreachable" - ) - - | wholenumber | floatnumber -> - Token (env, T_NUMBER { kind = NORMAL; raw = lexeme lexbuf }) - - (* Keywords *) - | "async" -> Token (env, T_ASYNC) - | "await" -> Token (env, T_AWAIT) - | "break" -> Token (env, T_BREAK) - | "case" -> Token (env, T_CASE) - | "catch" -> Token (env, T_CATCH) - | "class" -> Token (env, T_CLASS) - | "const" -> Token (env, T_CONST) - | "continue" -> Token (env, T_CONTINUE) - | "debugger" -> Token (env, T_DEBUGGER) - | "declare" -> Token (env, T_DECLARE) - | "default" -> Token (env, T_DEFAULT) - | "delete" -> Token (env, T_DELETE) - | "do" -> Token (env, T_DO) - | "else" -> Token (env, T_ELSE) - | "enum" -> Token (env, T_ENUM) - | "export" -> Token (env, T_EXPORT) - | "extends" -> Token (env, T_EXTENDS) - | "false" -> Token (env, T_FALSE) - | "finally" -> Token (env, T_FINALLY) - | "for" -> Token (env, T_FOR) - | "function" -> Token (env, T_FUNCTION) - | "if" -> Token (env, T_IF) - | "implements" -> Token (env, T_IMPLEMENTS) - | "import" -> Token (env, T_IMPORT) - | "in" -> Token (env, T_IN) - | "instanceof" -> Token (env, T_INSTANCEOF) - | "interface" -> Token (env, T_INTERFACE) - | "let" -> Token (env, T_LET) - | "new" -> Token (env, T_NEW) - | "null" -> Token (env, T_NULL) - | "of" -> Token (env, T_OF) - | "opaque" -> Token (env, T_OPAQUE) - | "package" -> Token (env, T_PACKAGE) - | "private" -> Token (env, T_PRIVATE) - | "protected" -> Token (env, T_PROTECTED) - | "public" -> Token (env, T_PUBLIC) - | "return" -> Token (env, T_RETURN) - | "static" -> Token (env, T_STATIC) - | "super" -> Token (env, T_SUPER) - | "switch" -> Token (env, T_SWITCH) - | "this" -> Token (env, T_THIS) - | "throw" -> Token (env, T_THROW) - | "true" -> Token (env, T_TRUE) - | "try" -> Token (env, T_TRY) - | "type" -> Token (env, T_TYPE) - | "typeof" -> Token (env, T_TYPEOF) - | "var" -> Token (env, T_VAR) - | "void" -> Token (env, T_VOID) - | "while" -> Token (env, T_WHILE) - | "with" -> Token (env, T_WITH) - | "yield" -> Token (env, T_YIELD) - - (* Identifiers *) - | js_id_start, Star js_id_continue -> - let loc = loc_of_lexbuf env lexbuf in - let raw = lexeme lexbuf in - let env, value = decode_identifier env raw in - Token (env, T_IDENTIFIER { loc; value; raw }) - - (* TODO: Use [Symbol.iterator] instead of @@iterator. *) - | "@@iterator" - | "@@asyncIterator" -> - let loc = loc_of_lexbuf env lexbuf in - let raw = lexeme lexbuf in - Token (env, T_IDENTIFIER { loc; value = raw; raw }) - - (* Syntax *) - | "{" -> Token (env, T_LCURLY) - | "}" -> Token (env, T_RCURLY) - | "(" -> Token (env, T_LPAREN) - | ")" -> Token (env, T_RPAREN) - | "[" -> Token (env, T_LBRACKET) - | "]" -> Token (env, T_RBRACKET) - | "..." -> Token (env, T_ELLIPSIS) - | "." -> Token (env, T_PERIOD) - | ";" -> Token (env, T_SEMICOLON) - | "," -> Token (env, T_COMMA) - | ":" -> Token (env, T_COLON) - - | "?.", digit -> - Sedlexing.rollback lexbuf; - begin match%sedlex lexbuf with - | "?" -> Token (env, T_PLING) - | _ -> failwith "expected ?" - end - - | "?." -> Token (env, T_PLING_PERIOD) - | "??" -> Token (env, T_PLING_PLING) - | "?" -> Token (env, T_PLING) - | "&&" -> Token (env, T_AND) - | "||" -> Token (env, T_OR) - | "===" -> Token (env, T_STRICT_EQUAL) - | "!==" -> Token (env, T_STRICT_NOT_EQUAL) - | "<=" -> Token (env, T_LESS_THAN_EQUAL) - | ">=" -> Token (env, T_GREATER_THAN_EQUAL) - | "==" -> Token (env, T_EQUAL) - | "!=" -> Token (env, T_NOT_EQUAL) - | "++" -> Token (env, T_INCR) - | "--" -> Token (env, T_DECR) - | "<<=" -> Token (env, T_LSHIFT_ASSIGN) - | "<<" -> Token (env, T_LSHIFT) - | ">>=" -> Token (env, T_RSHIFT_ASSIGN) - | ">>>=" -> Token (env, T_RSHIFT3_ASSIGN) - | ">>>" -> Token (env, T_RSHIFT3) - | ">>" -> Token (env, T_RSHIFT) - | "+=" -> Token (env, T_PLUS_ASSIGN) - | "-=" -> Token (env, T_MINUS_ASSIGN) - | "*=" -> Token (env, T_MULT_ASSIGN) - | "**=" -> Token (env, T_EXP_ASSIGN) - | "%=" -> Token (env, T_MOD_ASSIGN) - | "&=" -> Token (env, T_BIT_AND_ASSIGN) - | "|=" -> Token (env, T_BIT_OR_ASSIGN) - | "^=" -> Token (env, T_BIT_XOR_ASSIGN) - | "<" -> Token (env, T_LESS_THAN) - | ">" -> Token (env, T_GREATER_THAN) - | "+" -> Token (env, T_PLUS) - | "-" -> Token (env, T_MINUS) - | "*" -> Token (env, T_MULT) - | "**" -> Token (env, T_EXP) - | "%" -> Token (env, T_MOD) - | "|" -> Token (env, T_BIT_OR) - | "&" -> Token (env, T_BIT_AND) - | "^" -> Token (env, T_BIT_XOR) - | "!" -> Token (env, T_NOT) - | "~" -> Token (env, T_BIT_NOT) - | "=" -> Token (env, T_ASSIGN) - | "=>" -> Token (env, T_ARROW) - | "/=" -> Token (env, T_DIV_ASSIGN) - | "/" -> Token (env, T_DIV) - | "@" -> Token (env, T_AT) - | "#" -> Token (env, T_POUND) - - (* Others *) - | eof -> - let env = - if is_in_comment_syntax env then - let loc = loc_of_lexbuf env lexbuf in - lex_error env loc Parse_error.UnexpectedEOS - else env - in - Token (env, T_EOF) - - | any -> - let env = illegal env (loc_of_lexbuf env lexbuf) in - Token (env, T_ERROR (lexeme lexbuf)) - - | _ -> failwith "unreachable" - - -let rec regexp_class env buf lexbuf = - match%sedlex lexbuf with - | eof -> env - - | "\\\\" -> - Buffer.add_string buf "\\\\"; - regexp_class env buf lexbuf - - | '\\', ']' -> - Buffer.add_char buf '\\'; - Buffer.add_char buf ']'; - regexp_class env buf lexbuf - - | ']' -> - Buffer.add_char buf ']'; - env - - (* match multi-char substrings that don't contain the start chars of the above patterns *) - | Plus (Compl (eof | '\\' | ']')) - | any -> - let str = lexeme lexbuf in - Buffer.add_string buf str; - regexp_class env buf lexbuf - - | _ -> failwith "unreachable" - - -let rec regexp_body env buf lexbuf = - match%sedlex lexbuf with - | eof -> - let loc = loc_of_lexbuf env lexbuf in - let env = lex_error env loc Parse_error.UnterminatedRegExp in - env, "" - - | '\\', line_terminator_sequence -> - let loc = loc_of_lexbuf env lexbuf in - let env = lex_error env loc Parse_error.UnterminatedRegExp in - env, "" - - | '\\', any -> - let s = lexeme lexbuf in - Buffer.add_string buf s; - regexp_body env buf lexbuf - - | '/', Plus id_letter -> - let flags = - let str = lexeme lexbuf in - String.sub str 1 (String.length str - 1) - in - env, flags - - | '/' -> - env, "" - - | '[' -> - Buffer.add_char buf '['; - let env = regexp_class env buf lexbuf in - regexp_body env buf lexbuf - - | line_terminator_sequence -> - let loc = loc_of_lexbuf env lexbuf in - let env = lex_error env loc Parse_error.UnterminatedRegExp in - env, "" - - (* match multi-char substrings that don't contain the start chars of the above patterns *) - | Plus (Compl (eof | '\\' | '/' | '[' | line_terminator_sequence_start)) - | any -> - let str = lexeme lexbuf in - Buffer.add_string buf str; - regexp_body env buf lexbuf - - | _ -> failwith "unreachable" - - -let rec regexp env lexbuf = - match%sedlex lexbuf with - | eof -> env, T_EOF - - | line_terminator_sequence -> - let env = new_line env lexbuf in - regexp env lexbuf - - | Plus whitespace -> - regexp env lexbuf - - | "//" -> - let start_pos = start_pos_of_lexbuf env lexbuf in - let buf = Buffer.create 127 in - let env, end_pos = line_comment env buf lexbuf in - let env = save_comment env start_pos end_pos buf false in - regexp env lexbuf - - | "/*" -> - let start_pos = start_pos_of_lexbuf env lexbuf in - let buf = Buffer.create 127 in - let env, end_pos = comment env buf lexbuf in - let env = save_comment env start_pos end_pos buf true in - regexp env lexbuf - - | '/' -> - let start = start_pos_of_lexbuf env lexbuf in - let buf = Buffer.create 127 in - let env, flags = regexp_body env buf lexbuf in - let _end = end_pos_of_lexbuf env lexbuf in - let loc = { Loc.source = Lex_env.source env; start; _end } in - env, T_REGEXP (loc, Buffer.contents buf, flags) - - | any -> - let env = illegal env (loc_of_lexbuf env lexbuf) in - env, T_ERROR (lexeme lexbuf) - - | _ -> failwith "unreachable" - - -let rec jsx_text env mode buf raw lexbuf = - match%sedlex lexbuf with - | "'" | '"' | '<' | '{' -> - let c = lexeme lexbuf in - begin match mode, c with - | JSX_SINGLE_QUOTED_TEXT, "'" - | JSX_DOUBLE_QUOTED_TEXT, "\"" -> - env - | JSX_CHILD_TEXT, ("<" | "{") -> - (* Don't actually want to consume these guys - * yet...they're not part of the JSX text *) - Sedlexing.rollback lexbuf; - env - | _ -> - Buffer.add_string raw c; - Buffer.add_string buf c; - jsx_text env mode buf raw lexbuf - end - - | eof -> - let env = illegal env (loc_of_lexbuf env lexbuf) in - env - - | line_terminator_sequence -> - let lt = lexeme lexbuf in - Buffer.add_string raw lt; - Buffer.add_string buf lt; - let env = new_line env lexbuf in - jsx_text env mode buf raw lexbuf - - | "&#x", Plus hex_digit, ';' -> - let s = lexeme lexbuf in - let n = String.sub s 3 (String.length s - 4) in - Buffer.add_string raw s; - let code = int_of_string ("0x" ^ n) in - Wtf8.add_wtf_8 buf code; - jsx_text env mode buf raw lexbuf - - | "&#", Plus digit, ';' -> - let s = lexeme lexbuf in - let n = String.sub s 2 (String.length s - 3) in - Buffer.add_string raw s; - let code = int_of_string n in - Wtf8.add_wtf_8 buf code; - jsx_text env mode buf raw lexbuf - - | "&", htmlentity, ';' -> - let s = lexeme lexbuf in - let entity = String.sub s 1 (String.length s - 2) in - Buffer.add_string raw s; - let code = match entity with - | "quot" -> Some 0x0022 - | "amp" -> Some 0x0026 - | "apos" -> Some 0x0027 - | "lt" -> Some 0x003C - | "gt" -> Some 0x003E - | "nbsp" -> Some 0x00A0 - | "iexcl" -> Some 0x00A1 - | "cent" -> Some 0x00A2 - | "pound" -> Some 0x00A3 - | "curren" -> Some 0x00A4 - | "yen" -> Some 0x00A5 - | "brvbar" -> Some 0x00A6 - | "sect" -> Some 0x00A7 - | "uml" -> Some 0x00A8 - | "copy" -> Some 0x00A9 - | "ordf" -> Some 0x00AA - | "laquo" -> Some 0x00AB - | "not" -> Some 0x00AC - | "shy" -> Some 0x00AD - | "reg" -> Some 0x00AE - | "macr" -> Some 0x00AF - | "deg" -> Some 0x00B0 - | "plusmn" -> Some 0x00B1 - | "sup2" -> Some 0x00B2 - | "sup3" -> Some 0x00B3 - | "acute" -> Some 0x00B4 - | "micro" -> Some 0x00B5 - | "para" -> Some 0x00B6 - | "middot" -> Some 0x00B7 - | "cedil" -> Some 0x00B8 - | "sup1" -> Some 0x00B9 - | "ordm" -> Some 0x00BA - | "raquo" -> Some 0x00BB - | "frac14" -> Some 0x00BC - | "frac12" -> Some 0x00BD - | "frac34" -> Some 0x00BE - | "iquest" -> Some 0x00BF - | "Agrave" -> Some 0x00C0 - | "Aacute" -> Some 0x00C1 - | "Acirc" -> Some 0x00C2 - | "Atilde" -> Some 0x00C3 - | "Auml" -> Some 0x00C4 - | "Aring" -> Some 0x00C5 - | "AElig" -> Some 0x00C6 - | "Ccedil" -> Some 0x00C7 - | "Egrave" -> Some 0x00C8 - | "Eacute" -> Some 0x00C9 - | "Ecirc" -> Some 0x00CA - | "Euml" -> Some 0x00CB - | "Igrave" -> Some 0x00CC - | "Iacute" -> Some 0x00CD - | "Icirc" -> Some 0x00CE - | "Iuml" -> Some 0x00CF - | "ETH" -> Some 0x00D0 - | "Ntilde" -> Some 0x00D1 - | "Ograve" -> Some 0x00D2 - | "Oacute" -> Some 0x00D3 - | "Ocirc" -> Some 0x00D4 - | "Otilde" -> Some 0x00D5 - | "Ouml" -> Some 0x00D6 - | "times" -> Some 0x00D7 - | "Oslash" -> Some 0x00D8 - | "Ugrave" -> Some 0x00D9 - | "Uacute" -> Some 0x00DA - | "Ucirc" -> Some 0x00DB - | "Uuml" -> Some 0x00DC - | "Yacute" -> Some 0x00DD - | "THORN" -> Some 0x00DE - | "szlig" -> Some 0x00DF - | "agrave" -> Some 0x00E0 - | "aacute" -> Some 0x00E1 - | "acirc" -> Some 0x00E2 - | "atilde" -> Some 0x00E3 - | "auml" -> Some 0x00E4 - | "aring" -> Some 0x00E5 - | "aelig" -> Some 0x00E6 - | "ccedil" -> Some 0x00E7 - | "egrave" -> Some 0x00E8 - | "eacute" -> Some 0x00E9 - | "ecirc" -> Some 0x00EA - | "euml" -> Some 0x00EB - | "igrave" -> Some 0x00EC - | "iacute" -> Some 0x00ED - | "icirc" -> Some 0x00EE - | "iuml" -> Some 0x00EF - | "eth" -> Some 0x00F0 - | "ntilde" -> Some 0x00F1 - | "ograve" -> Some 0x00F2 - | "oacute" -> Some 0x00F3 - | "ocirc" -> Some 0x00F4 - | "otilde" -> Some 0x00F5 - | "ouml" -> Some 0x00F6 - | "divide" -> Some 0x00F7 - | "oslash" -> Some 0x00F8 - | "ugrave" -> Some 0x00F9 - | "uacute" -> Some 0x00FA - | "ucirc" -> Some 0x00FB - | "uuml" -> Some 0x00FC - | "yacute" -> Some 0x00FD - | "thorn" -> Some 0x00FE - | "yuml" -> Some 0x00FF - | "OElig" -> Some 0x0152 - | "oelig" -> Some 0x0153 - | "Scaron" -> Some 0x0160 - | "scaron" -> Some 0x0161 - | "Yuml" -> Some 0x0178 - | "fnof" -> Some 0x0192 - | "circ" -> Some 0x02C6 - | "tilde" -> Some 0x02DC - | "Alpha" -> Some 0x0391 - | "Beta" -> Some 0x0392 - | "Gamma" -> Some 0x0393 - | "Delta" -> Some 0x0394 - | "Epsilon" -> Some 0x0395 - | "Zeta" -> Some 0x0396 - | "Eta" -> Some 0x0397 - | "Theta" -> Some 0x0398 - | "Iota" -> Some 0x0399 - | "Kappa" -> Some 0x039A - | "Lambda" -> Some 0x039B - | "Mu" -> Some 0x039C - | "Nu" -> Some 0x039D - | "Xi" -> Some 0x039E - | "Omicron" -> Some 0x039F - | "Pi" -> Some 0x03A0 - | "Rho" -> Some 0x03A1 - | "Sigma" -> Some 0x03A3 - | "Tau" -> Some 0x03A4 - | "Upsilon" -> Some 0x03A5 - | "Phi" -> Some 0x03A6 - | "Chi" -> Some 0x03A7 - | "Psi" -> Some 0x03A8 - | "Omega" -> Some 0x03A9 - | "alpha" -> Some 0x03B1 - | "beta" -> Some 0x03B2 - | "gamma" -> Some 0x03B3 - | "delta" -> Some 0x03B4 - | "epsilon" -> Some 0x03B5 - | "zeta" -> Some 0x03B6 - | "eta" -> Some 0x03B7 - | "theta" -> Some 0x03B8 - | "iota" -> Some 0x03B9 - | "kappa" -> Some 0x03BA - | "lambda" -> Some 0x03BB - | "mu" -> Some 0x03BC - | "nu" -> Some 0x03BD - | "xi" -> Some 0x03BE - | "omicron" -> Some 0x03BF - | "pi" -> Some 0x03C0 - | "rho" -> Some 0x03C1 - | "sigmaf" -> Some 0x03C2 - | "sigma" -> Some 0x03C3 - | "tau" -> Some 0x03C4 - | "upsilon" -> Some 0x03C5 - | "phi" -> Some 0x03C6 - | "chi" -> Some 0x03C7 - | "psi" -> Some 0x03C8 - | "omega" -> Some 0x03C9 - | "thetasym" -> Some 0x03D1 - | "upsih" -> Some 0x03D2 - | "piv" -> Some 0x03D6 - | "ensp" -> Some 0x2002 - | "emsp" -> Some 0x2003 - | "thinsp" -> Some 0x2009 - | "zwnj" -> Some 0x200C - | "zwj" -> Some 0x200D - | "lrm" -> Some 0x200E - | "rlm" -> Some 0x200F - | "ndash" -> Some 0x2013 - | "mdash" -> Some 0x2014 - | "lsquo" -> Some 0x2018 - | "rsquo" -> Some 0x2019 - | "sbquo" -> Some 0x201A - | "ldquo" -> Some 0x201C - | "rdquo" -> Some 0x201D - | "bdquo" -> Some 0x201E - | "dagger" -> Some 0x2020 - | "Dagger" -> Some 0x2021 - | "bull" -> Some 0x2022 - | "hellip" -> Some 0x2026 - | "permil" -> Some 0x2030 - | "prime" -> Some 0x2032 - | "Prime" -> Some 0x2033 - | "lsaquo" -> Some 0x2039 - | "rsaquo" -> Some 0x203A - | "oline" -> Some 0x203E - | "frasl" -> Some 0x2044 - | "euro" -> Some 0x20AC - | "image" -> Some 0x2111 - | "weierp" -> Some 0x2118 - | "real" -> Some 0x211C - | "trade" -> Some 0x2122 - | "alefsym" -> Some 0x2135 - | "larr" -> Some 0x2190 - | "uarr" -> Some 0x2191 - | "rarr" -> Some 0x2192 - | "darr" -> Some 0x2193 - | "harr" -> Some 0x2194 - | "crarr" -> Some 0x21B5 - | "lArr" -> Some 0x21D0 - | "uArr" -> Some 0x21D1 - | "rArr" -> Some 0x21D2 - | "dArr" -> Some 0x21D3 - | "hArr" -> Some 0x21D4 - | "forall" -> Some 0x2200 - | "part" -> Some 0x2202 - | "exist" -> Some 0x2203 - | "empty" -> Some 0x2205 - | "nabla" -> Some 0x2207 - | "isin" -> Some 0x2208 - | "notin" -> Some 0x2209 - | "ni" -> Some 0x220B - | "prod" -> Some 0x220F - | "sum" -> Some 0x2211 - | "minus" -> Some 0x2212 - | "lowast" -> Some 0x2217 - | "radic" -> Some 0x221A - | "prop" -> Some 0x221D - | "infin" -> Some 0x221E - | "ang" -> Some 0x2220 - | "and" -> Some 0x2227 - | "or" -> Some 0x2228 - | "cap" -> Some 0x2229 - | "cup" -> Some 0x222A - | "'int'" -> Some 0x222B - | "there4" -> Some 0x2234 - | "sim" -> Some 0x223C - | "cong" -> Some 0x2245 - | "asymp" -> Some 0x2248 - | "ne" -> Some 0x2260 - | "equiv" -> Some 0x2261 - | "le" -> Some 0x2264 - | "ge" -> Some 0x2265 - | "sub" -> Some 0x2282 - | "sup" -> Some 0x2283 - | "nsub" -> Some 0x2284 - | "sube" -> Some 0x2286 - | "supe" -> Some 0x2287 - | "oplus" -> Some 0x2295 - | "otimes" -> Some 0x2297 - | "perp" -> Some 0x22A5 - | "sdot" -> Some 0x22C5 - | "lceil" -> Some 0x2308 - | "rceil" -> Some 0x2309 - | "lfloor" -> Some 0x230A - | "rfloor" -> Some 0x230B - | "lang" -> Some 0x27E8 (* 0x2329 in HTML4 *) - | "rang" -> Some 0x27E9 (* 0x232A in HTML4 *) - | "loz" -> Some 0x25CA - | "spades" -> Some 0x2660 - | "clubs" -> Some 0x2663 - | "hearts" -> Some 0x2665 - | "diams" -> Some 0x2666 - | _ -> None in - (match code with - | Some code -> Wtf8.add_wtf_8 buf code - | None -> Buffer.add_string buf ("&" ^ entity ^";")); - jsx_text env mode buf raw lexbuf - - (* match multi-char substrings that don't contain the start chars of the above patterns *) - | Plus (Compl ("'" | '"' | '<' | '{' | '&' | eof | line_terminator_sequence_start)) - | any -> - let c = lexeme lexbuf in - Buffer.add_string raw c; - Buffer.add_string buf c; - jsx_text env mode buf raw lexbuf - - | _ -> failwith "unreachable" - - -let jsx_tag env lexbuf = - match%sedlex lexbuf with - | eof -> - Token (env, T_EOF) - - | line_terminator_sequence -> - let env = new_line env lexbuf in - Continue env - - | Plus whitespace -> - Continue env - - | "//" -> - let start_pos = start_pos_of_lexbuf env lexbuf in - let buf = Buffer.create 127 in - let env, end_pos = line_comment env buf lexbuf in - let env = save_comment env start_pos end_pos buf false in - Continue env - - | "/*" -> - let start_pos = start_pos_of_lexbuf env lexbuf in - let buf = Buffer.create 127 in - let env, end_pos = comment env buf lexbuf in - let env = save_comment env start_pos end_pos buf true in - Continue env - - | '<' -> Token (env, T_LESS_THAN) - | '/' -> Token (env, T_DIV) - | '>' -> Token (env, T_GREATER_THAN) - | '{' -> Token (env, T_LCURLY) - | ':' -> Token (env, T_COLON) - | '.' -> Token (env, T_PERIOD) - | '=' -> Token (env, T_ASSIGN) - | js_id_start, Star ('-' | js_id_continue) -> - Token (env, T_JSX_IDENTIFIER { raw = lexeme lexbuf }) - - | "'" | '"' -> - let quote = lexeme lexbuf in - let start = start_pos_of_lexbuf env lexbuf in - let buf = Buffer.create 127 in - let raw = Buffer.create 127 in - Buffer.add_string raw quote; - let mode = if quote = "'" - then JSX_SINGLE_QUOTED_TEXT - else JSX_DOUBLE_QUOTED_TEXT in - let env = jsx_text env mode buf raw lexbuf in - let _end = end_pos_of_lexbuf env lexbuf in - Buffer.add_string raw quote; - let value = Buffer.contents buf in - let raw = Buffer.contents raw in - let loc = { Loc.source = Lex_env.source env; start; _end } in - Token (env, T_JSX_TEXT (loc, value, raw)) - - | any -> - Token (env, T_ERROR (lexeme lexbuf)) - - | _ -> failwith "unreachable" - - -let jsx_child env start buf raw lexbuf = - match%sedlex lexbuf with - | line_terminator_sequence -> - let lt = lexeme lexbuf in - Buffer.add_string raw lt; - Buffer.add_string buf lt; - let env = new_line env lexbuf in - let env = jsx_text env JSX_CHILD_TEXT buf raw lexbuf in - let _end = end_pos_of_lexbuf env lexbuf in - let value = Buffer.contents buf in - let raw = Buffer.contents raw in - let loc = { Loc.source = Lex_env.source env; start; _end } in - env, T_JSX_TEXT (loc, value, raw) - - | eof -> env, T_EOF - | '<' -> env, T_LESS_THAN - | '{' -> env, T_LCURLY - - | any -> - let c = lexeme lexbuf in - Buffer.add_string raw c; - Buffer.add_string buf c; - let env = jsx_text env JSX_CHILD_TEXT buf raw lexbuf in - let _end = end_pos_of_lexbuf env lexbuf in - let value = Buffer.contents buf in - let raw = Buffer.contents raw in - let loc = { Loc.source = Lex_env.source env; start; _end } in - env, T_JSX_TEXT (loc, value, raw) - - | _ -> failwith "unreachable" - - -let rec template_tail env lexbuf = - match%sedlex lexbuf with - | line_terminator_sequence -> - let env = new_line env lexbuf in - template_tail env lexbuf - - | Plus whitespace -> - template_tail env lexbuf - - | "//" -> - let start_pos = start_pos_of_lexbuf env lexbuf in - let buf = Buffer.create 127 in - let env, end_pos = line_comment env buf lexbuf in - let env = save_comment env start_pos end_pos buf false in - template_tail env lexbuf - - | "/*" -> - let start_pos = start_pos_of_lexbuf env lexbuf in - let buf = Buffer.create 127 in - let env, end_pos = comment env buf lexbuf in - let env = save_comment env start_pos end_pos buf true in - template_tail env lexbuf - - | '}' -> - let start = start_pos_of_lexbuf env lexbuf in - let cooked = Buffer.create 127 in - let raw = Buffer.create 127 in - let literal = Buffer.create 127 in - Buffer.add_string literal "}"; - let env, is_tail = template_part env cooked raw literal lexbuf in - let _end = end_pos_of_lexbuf env lexbuf in - let loc = { Loc.source = Lex_env.source env; start; _end } in - env, (T_TEMPLATE_PART (loc, { - cooked = Buffer.contents cooked; - raw = Buffer.contents raw; - literal = Buffer.contents literal; - }, is_tail)) - - | any -> - let env = illegal env (loc_of_lexbuf env lexbuf) in - env, (T_TEMPLATE_PART ( - loc_of_lexbuf env lexbuf, - { cooked = ""; raw = ""; literal = ""; }, - true - )) - - | _ -> failwith "unreachable" - - -(* There are some tokens that never show up in a type and which can cause - * ambiguity. For example, Foo> ends with two angle brackets, not - * with a right shift. - *) -let type_token env lexbuf = - match%sedlex lexbuf with - | line_terminator_sequence -> - let env = new_line env lexbuf in - Continue env - - | Plus whitespace -> - Continue env - - | "/*" -> - let start_pos = start_pos_of_lexbuf env lexbuf in - let buf = Buffer.create 127 in - let env, end_pos = comment env buf lexbuf in - let env = save_comment env start_pos end_pos buf true in - Continue env - - | "/*", Star whitespace, (":" | "::" | "flow-include") -> - let pattern = lexeme lexbuf in - if not (is_comment_syntax_enabled env) then - let start_pos = start_pos_of_lexbuf env lexbuf in - let buf = Buffer.create 127 in - Buffer.add_string buf pattern; - let env, end_pos = comment env buf lexbuf in - let env = save_comment env start_pos end_pos buf true in - Continue env - else - let env = - if is_in_comment_syntax env then - let loc = loc_of_lexbuf env lexbuf in - unexpected_error env loc pattern - else env - in - let env = in_comment_syntax true env in - let len = Sedlexing.lexeme_length lexbuf in - if Sedlexing.Utf8.sub_lexeme lexbuf (len - 1) 1 = ":" && - Sedlexing.Utf8.sub_lexeme lexbuf (len - 2) 1 <> ":" then - Token (env, T_COLON) - else - Continue env - - | "*/" -> - if is_in_comment_syntax env then - let env = in_comment_syntax false env in - Continue env - else begin - Sedlexing.rollback lexbuf; - match%sedlex lexbuf with - | "*" -> Token (env, T_MULT) - | _ -> failwith "expected *" - end - - | "//" -> - let start_pos = start_pos_of_lexbuf env lexbuf in - let buf = Buffer.create 127 in - let env, end_pos = line_comment env buf lexbuf in - let env = save_comment env start_pos end_pos buf false in - Continue env - - | "'" | '"' -> - let quote = lexeme lexbuf in - let start = start_pos_of_lexbuf env lexbuf in - let buf = Buffer.create 127 in - let raw = Buffer.create 127 in - Buffer.add_string raw quote; - let octal = false in - let env, _end, octal = string_quote env quote buf raw octal lexbuf in - let loc = { Loc.source = Lex_env.source env; start; _end } in - Token (env, T_STRING (loc, Buffer.contents buf, Buffer.contents raw, octal)) - - (** - * Number literals - *) - - | Opt neg, binnumber, (letter | '2'..'9'), Star alphanumeric -> - (* Numbers cannot be immediately followed by words *) - recover env lexbuf ~f:(fun env lexbuf -> match%sedlex lexbuf with - | Opt neg, binnumber -> - let num = lexeme lexbuf in - Token (env, mk_num_singleton BINARY num) - | _ -> failwith "unreachable" - ) - - | Opt neg, binnumber -> - let num = lexeme lexbuf in - Token (env, mk_num_singleton BINARY num) - - | Opt neg, octnumber, (letter | '8'..'9'), Star alphanumeric -> - (* Numbers cannot be immediately followed by words *) - recover env lexbuf ~f:(fun env lexbuf -> match%sedlex lexbuf with - | Opt neg, octnumber -> - let num = lexeme lexbuf in - Token (env, mk_num_singleton OCTAL num) - | _ -> failwith "unreachable" - ) - - | Opt neg, octnumber -> - let num = lexeme lexbuf in - Token (env, mk_num_singleton OCTAL num) - - | Opt neg, legacyoctnumber, (letter | '8'..'9'), Star alphanumeric -> - (* Numbers cannot be immediately followed by words *) - recover env lexbuf ~f:(fun env lexbuf -> match%sedlex lexbuf with - | Opt neg, legacyoctnumber -> - let num = lexeme lexbuf in - Token (env, mk_num_singleton LEGACY_OCTAL num) - | _ -> failwith "unreachable" - ) - - | Opt neg, legacyoctnumber -> - let num = lexeme lexbuf in - Token (env, mk_num_singleton LEGACY_OCTAL num) - - | Opt neg, hexnumber, non_hex_letter, Star alphanumeric -> - (* Numbers cannot be immediately followed by words *) - recover env lexbuf ~f:(fun env lexbuf -> match%sedlex lexbuf with - | Opt neg, hexnumber -> - let num = lexeme lexbuf in - begin try Token (env, mk_num_singleton NORMAL num) - with _ when Sys.win32 -> - let loc = loc_of_lexbuf env lexbuf in - let env = lex_error env loc Parse_error.WindowsFloatOfString in - Token (env, T_NUMBER_SINGLETON_TYPE { kind = NORMAL; value = 789.0; raw = "789" }) - end - | _ -> failwith "unreachable" - ) - - | Opt neg, hexnumber -> - let num = lexeme lexbuf in - begin try Token (env, mk_num_singleton NORMAL num) - with _ when Sys.win32 -> - let loc = loc_of_lexbuf env lexbuf in - let env = lex_error env loc Parse_error.WindowsFloatOfString in - Token (env, T_NUMBER_SINGLETON_TYPE { kind = NORMAL; value = 789.0; raw = "789" }) - end - - | Opt neg, scinumber, word -> - (* Numbers cannot be immediately followed by words *) - recover env lexbuf ~f:(fun env lexbuf -> match%sedlex lexbuf with - | Opt neg, scinumber -> - let num = lexeme lexbuf in - Token (env, mk_num_singleton NORMAL num) - | _ -> failwith "unreachable" - ) - - | Opt neg, scinumber -> - let num = lexeme lexbuf in - Token (env, mk_num_singleton NORMAL num) - - | Opt neg, (wholenumber | floatnumber), word -> - (* Numbers cannot be immediately followed by words *) - recover env lexbuf ~f:(fun env lexbuf -> match%sedlex lexbuf with - | Opt neg, wholenumber | floatnumber -> - let num = lexeme lexbuf in - Token (env, mk_num_singleton NORMAL num) - | _ -> failwith "unreachable" - ) - - | Opt neg, (wholenumber | floatnumber) -> - let num = lexeme lexbuf in - Token (env, mk_num_singleton NORMAL num) - - (* Keywords *) - | "any" -> Token (env, T_ANY_TYPE) - | "bool" -> Token (env, (T_BOOLEAN_TYPE BOOL)) - | "boolean" -> Token (env, (T_BOOLEAN_TYPE BOOLEAN)) - | "empty" -> Token (env, T_EMPTY_TYPE) - | "extends" -> Token (env, T_EXTENDS) - | "false" -> Token (env, T_FALSE) - | "interface" -> Token (env, T_INTERFACE) - | "mixed" -> Token (env, T_MIXED_TYPE) - | "null" -> Token (env, T_NULL) - | "number" -> Token (env, T_NUMBER_TYPE) - | "static" -> Token (env, T_STATIC) - | "string" -> Token (env, T_STRING_TYPE) - | "true" -> Token (env, T_TRUE) - | "typeof" -> Token (env, T_TYPEOF) - | "void" -> Token (env, T_VOID_TYPE) - - (* Identifiers *) - | js_id_start, Star js_id_continue -> - let loc = loc_of_lexbuf env lexbuf in - let raw = lexeme lexbuf in - let env, value = decode_identifier env raw in - Token (env, T_IDENTIFIER { loc; value; raw }) - - | "%checks" -> Token (env, T_CHECKS) - (* Syntax *) - | "[" -> Token (env, T_LBRACKET) - | "]" -> Token (env, T_RBRACKET) - | "{" -> Token (env, T_LCURLY) - | "}" -> Token (env, T_RCURLY) - | "{|" -> Token (env, T_LCURLYBAR) - | "|}" -> Token (env, T_RCURLYBAR) - | "(" -> Token (env, T_LPAREN) - | ")" -> Token (env, T_RPAREN) - | "..." -> Token (env, T_ELLIPSIS) - | "." -> Token (env, T_PERIOD) - | ";" -> Token (env, T_SEMICOLON) - | "," -> Token (env, T_COMMA) - | ":" -> Token (env, T_COLON) - | "?" -> Token (env, T_PLING) - | "[" -> Token (env, T_LBRACKET) - | "]" -> Token (env, T_RBRACKET) - (* Generics *) - | "<" -> Token (env, T_LESS_THAN) - | ">" -> Token (env, T_GREATER_THAN) - (* Generic default *) - | "=" -> Token (env, T_ASSIGN) - (* Optional or nullable *) - | "?" -> Token (env, T_PLING) - (* Existential *) - | "*" -> Token (env, T_MULT) - (* Annotation or bound *) - | ":" -> Token (env, T_COLON) - (* Union *) - | '|' -> Token (env, T_BIT_OR) - (* Intersection *) - | '&' -> Token (env, T_BIT_AND) - (* typeof *) - | "typeof" -> Token (env, T_TYPEOF) - (* Function type *) - | "=>" -> Token (env, T_ARROW) - (* Type alias *) - | '=' -> Token (env, T_ASSIGN) - (* Variance annotations *) - | '+' -> Token (env, T_PLUS) - | '-' -> Token (env, T_MINUS) - - (* Others *) - | eof -> - let env = - if is_in_comment_syntax env then - let loc = loc_of_lexbuf env lexbuf in - lex_error env loc Parse_error.UnexpectedEOS - else env - in - Token (env, T_EOF) - - | any -> - Token (env, T_ERROR (lexeme lexbuf)) - - | _ -> failwith "unreachable" - -let regexp env = - get_result_and_clear_state (regexp env env.lex_lb) - -(* Lexing JSX children requires a string buffer to keep track of whitespace - * *) -let jsx_child env = - (* yes, the _start_ of the child is the _end_pos_ of the lexbuf! *) - let start = end_pos_of_lexbuf env env.lex_lb in - let buf = Buffer.create 127 in - let raw = Buffer.create 127 in - let env, child = jsx_child env start buf raw env.lex_lb in - get_result_and_clear_state (env, child) - -let jsx_tag env = - let rec helper env = - match jsx_tag env env.lex_lb with - | Token (env, t) -> env, t - | Continue env -> helper env - in - get_result_and_clear_state (helper env) - -let template_tail env = - get_result_and_clear_state (template_tail env env.lex_lb) - -let type_token env = - let rec helper env = - match type_token env env.lex_lb with - | Token (env, t) -> env, t - | Continue env -> helper env - in - get_result_and_clear_state (helper env) - -let token = - let rec helper env = - match token env env.lex_lb with - | Token (env, t) -> env, t - | Continue env -> helper env - in - fun env -> get_result_and_clear_state (helper env) diff --git a/lib/libflowparser.h b/lib/libflowparser.h index 9e9a3c4..2e9d204 100644 --- a/lib/libflowparser.h +++ b/lib/libflowparser.h @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2013-present, Facebook, Inc. +/* + * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -50,6 +50,7 @@ value cons(value hd, value tl) { template class AbstractTranslator { public: + virtual ~AbstractTranslator() = default; virtual T convert_string(char *str) = 0; virtual T convert_number(double n) = 0; virtual T convert_bool(long b) = 0; diff --git a/lib/libflowparser.ml b/lib/libflowparser.ml index 0391f6b..e9f8f49 100644 --- a/lib/libflowparser.ml +++ b/lib/libflowparser.ml @@ -1,5 +1,5 @@ -(** - * Copyright (c) 2013-present, Facebook, Inc. +(* + * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -15,74 +15,88 @@ type json = | JBool of bool | JNull -module AbstractTranslator : ( - Translator_intf.S with type t = json -) = struct +module AbstractTranslator : Translator_intf.S with type t = json = struct type t = json + let string x = JString x + let bool x = JBool x + let obj props = JObject props + let array arr = JArray arr + let number x = JNumber x + + let int x = number (float x) (* TODO: this is inefficient, push ints to C *) + let null = JNull + let regexp _loc _pattern _flags = JNull end -module Translate = Estree_translator.Translate (AbstractTranslator) (struct - (* TODO: make these configurable via CLI flags *) - let include_comments = true - let include_locs = true -end) +module Translate = + Estree_translator.Translate + (AbstractTranslator) + (struct + (* TODO: make these configurable via CLI flags *) + + let include_interned_comments = false + + let include_comments = true + + let include_locs = true + end) module Token_translator = Token_translator.Translate (AbstractTranslator) -let translate_tokens tokens = - AbstractTranslator.array (List.rev_map Token_translator.token tokens) +let translate_tokens offset_table tokens = + AbstractTranslator.array (List.rev_map (Token_translator.token offset_table) tokens) let convert_options opts = - let open Parser_env in - List.fold_left (fun (opts, tokens) (k, v) -> - match k with - | "esproposal_class_instance_fields" -> - { opts with esproposal_class_instance_fields = v }, tokens - | "esproposal_class_static_fields" -> - { opts with esproposal_class_static_fields = v }, tokens - | "esproposal_decorators" -> - { opts with esproposal_decorators = v }, tokens - | "esproposal_export_star_as" -> - { opts with esproposal_export_star_as = v }, tokens - | "esproposal_optional_chaining" -> - { opts with esproposal_optional_chaining = v }, tokens - | "types" -> - { opts with types = v }, tokens - | "use_strict" -> - { opts with use_strict = v }, tokens - | "tokens" -> - opts, v - | _ -> - opts, tokens (* ignore unknown stuff for future-compatibility *) - ) (Parser_env.default_parse_options, false) opts + Parser_env.( + List.fold_left + (fun (opts, tokens) (k, v) -> + match k with + | "enums" -> ({ opts with enums = v }, tokens) + | "esproposal_class_instance_fields" -> + ({ opts with esproposal_class_instance_fields = v }, tokens) + | "esproposal_class_static_fields" -> + ({ opts with esproposal_class_static_fields = v }, tokens) + | "esproposal_decorators" -> ({ opts with esproposal_decorators = v }, tokens) + | "esproposal_export_star_as" -> ({ opts with esproposal_export_star_as = v }, tokens) + | "esproposal_optional_chaining" -> ({ opts with esproposal_optional_chaining = v }, tokens) + | "esproposal_nullish_coalescing" -> + ({ opts with esproposal_nullish_coalescing = v }, tokens) + | "types" -> ({ opts with types = v }, tokens) + | "use_strict" -> ({ opts with use_strict = v }, tokens) + | "tokens" -> (opts, v) + | _ -> (opts, tokens)) + (* ignore unknown stuff for future-compatibility *) + (Parser_env.default_parse_options, false) + opts) let parse content options = - let parse_options, include_tokens = convert_options options in - + let (parse_options, include_tokens) = convert_options options in let rev_tokens = ref [] in let token_sink = - if include_tokens then Some (fun token_data -> rev_tokens := token_data::!rev_tokens) - else None + if include_tokens then + Some (fun token_data -> rev_tokens := token_data :: !rev_tokens) + else + None in - - let (ast, errors) = Parser_flow.program - ~fail:false ~parse_options:(Some parse_options) ~token_sink - content + let (ast, errors) = + Parser_flow.program ~fail:false ~parse_options:(Some parse_options) ~token_sink content in - - match Translate.program ast with + let offset_table = Offset_utils.make ~kind:Offset_utils.Utf8 content in + match Translate.program (Some offset_table) ast with | JObject params -> - let params = ("errors", Translate.errors errors)::params in + let params = ("errors", Translate.errors errors) :: params in let params = - if include_tokens then ("tokens", translate_tokens !rev_tokens)::params - else params + if include_tokens then + ("tokens", translate_tokens offset_table !rev_tokens) :: params + else + params in JObject params | _ -> assert false diff --git a/lib/loc.ml b/lib/loc.ml index 9b30103..8f376b3 100644 --- a/lib/loc.ml +++ b/lib/loc.ml @@ -1,50 +1,44 @@ -(** - * Copyright (c) 2013-present, Facebook, Inc. +(* + * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. *) +(* line numbers are 1-indexed; column numbers are 0-indexed *) type position = { line: int; column: int; - offset: int; } +[@@deriving show] +(* start is inclusive; end is exclusive *) +(* If you are modifying this record, go look at ALoc.ml and make sure you understand the + * representation there. *) type t = { source: File_key.t option; start: position; _end: position; } +[@@deriving show] -let none = { - source = None; - start = { line = 0; column = 0; offset = 0; }; - _end = { line = 0; column = 0; offset = 0; }; -} +let none = { source = None; start = { line = 0; column = 0 }; _end = { line = 0; column = 0 } } -let btwn loc1 loc2 = { - source = loc1.source; - start = loc1.start; - _end = loc2._end; -} - -let btwn_exclusive loc1 loc2 = { - source = loc1.source; - start = loc1._end; - _end = loc2.start; -} +let btwn loc1 loc2 = { source = loc1.source; start = loc1.start; _end = loc2._end } (* Returns the position immediately before the start of the given loc. If the given loc is at the beginning of a line, return the position of the first char on the same line. *) let char_before loc = let start = - let { line; column; offset } = loc.start in - let column, offset = if column > 0 - then column - 1, offset - 1 - else column, offset in - { line; column; offset } + let { line; column } = loc.start in + let column = + if column > 0 then + column - 1 + else + column + in + { line; column } in let _end = loc.start in { loc with start; _end } @@ -53,11 +47,15 @@ let char_before loc = * first line is a newline character, but is still consistent with loc orderings. *) let first_char loc = let start = loc.start in - let _end = {start with column = start.column + 1; offset = start.offset + 1} in - {loc with _end} + let _end = { start with column = start.column + 1 } in + { loc with _end } let pos_cmp a b = - let k = a.line - b.line in if k = 0 then a.column - b.column else k + let k = a.line - b.line in + if k = 0 then + a.column - b.column + else + k (** * If `a` spans (completely contains) `b`, then returns 0. @@ -70,27 +68,33 @@ let span_compare a b = let k = pos_cmp a.start b.start in if k <= 0 then let k = pos_cmp a._end b._end in - if k >= 0 then 0 else -1 - else 1 - else k - -(* Returns true if loc1 entirely overlaps loc2 *) + if k >= 0 then + 0 + else + -1 + else + 1 + else + k + +(** [contains loc1 loc2] returns true if [loc1] entirely overlaps [loc2] *) let contains loc1 loc2 = span_compare loc1 loc2 = 0 -(* Returns true if loc1 intersects loc2 at all *) +(** [lines_intersect loc1 loc2] returns true if [loc1] intersects [loc2] at all *) let lines_intersect loc1 loc2 = - File_key.compare_opt loc1.source loc2.source = 0 && not ( - (loc1._end.line < loc2.start.line) || - (loc1.start.line > loc2._end.line) - ) + File_key.compare_opt loc1.source loc2.source = 0 + && not (loc1._end.line < loc2.start.line || loc1.start.line > loc2._end.line) let compare loc1 loc2 = let k = File_key.compare_opt loc1.source loc2.source in if k = 0 then let k = pos_cmp loc1.start loc2.start in - if k = 0 then pos_cmp loc1._end loc2._end - else k - else k + if k = 0 then + pos_cmp loc1._end loc2._end + else + k + else + k let equal loc1 loc2 = compare loc1 loc2 = 0 @@ -98,28 +102,45 @@ let equal loc1 loc2 = compare loc1 loc2 = 0 * This is mostly useful for debugging purposes. * Please don't dead-code delete this! *) -let to_string ?(include_source=false) loc = +let debug_to_string ?(include_source = false) loc = let source = - if include_source - then Printf.sprintf "%S: " ( - match loc.source with - | Some src -> File_key.to_string src - | None -> "" - ) else "" + if include_source then + Printf.sprintf + "%S: " + (match loc.source with + | Some src -> File_key.to_string src + | None -> "") + else + "" in - let pos = Printf.sprintf "(%d, %d) to (%d, %d)" - loc.start.line - loc.start.column - loc._end.line - loc._end.column + let pos = + Printf.sprintf + "(%d, %d) to (%d, %d)" + loc.start.line + loc.start.column + loc._end.line + loc._end.column in source ^ pos +let to_string_no_source loc = + let line = loc.start.line in + let start = loc.start.column + 1 in + let end_ = loc._end.column in + if line <= 0 then + "0:0" + else if line = loc._end.line && start = end_ then + Printf.sprintf "%d:%d" line start + else if line != loc._end.line then + Printf.sprintf "%d:%d,%d:%d" line start loc._end.line end_ + else + Printf.sprintf "%d:%d-%d" line start end_ + let source loc = loc.source -let make file line col = - { - source = Some file; - start = { line; column = col; offset = 0; }; - _end = { line; column = col + 1; offset = 0; }; - } +(** Produces a zero-width Loc.t, where start = end *) +let cursor source line column = { source; start = { line; column }; _end = { line; column } } + +let start_loc loc = { loc with _end = loc.start } + +let end_loc loc = { loc with start = loc._end } diff --git a/lib/loc.mli b/lib/loc.mli index 8da5202..d4cf1d2 100644 --- a/lib/loc.mli +++ b/lib/loc.mli @@ -1,24 +1,57 @@ -(** - * Copyright (c) 2013-present, Facebook, Inc. +(* + * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. *) -type position = { line : int; column : int; offset : int; } -type t = { source : File_key.t option; start : position; _end : position; } +type position = { + line: int; + column: int; +} +[@@deriving show] + +type t = { + source: File_key.t option; + start: position; + _end: position; +} +[@@deriving show] + val none : t + val btwn : t -> t -> t -val btwn_exclusive : t -> t -> t + val char_before : t -> t -val first_char: t -> t + +val first_char : t -> t + val contains : t -> t -> bool +(** [contains loc1 loc2] returns true if [loc1] entirely overlaps [loc2] *) + val lines_intersect : t -> t -> bool +(** [lines_intersect loc1 loc2] returns true if [loc1] intersects [loc2] at all *) + val pos_cmp : position -> position -> int + val span_compare : t -> t -> int + val compare : t -> t -> int + val equal : t -> t -> bool -val to_string : ?include_source:bool -> t -> string + +val debug_to_string : ?include_source:bool -> t -> string + +(* Relatively compact; suitable for use as a unique string identifier *) +val to_string_no_source : t -> string + val source : t -> File_key.t option -(* filename, line, column. produces a Loc.t at the given location, with stubbed out offsets *) -val make: File_key.t -> int -> int -> t + +val cursor : File_key.t option -> int -> int -> t +(** Produces a zero-width Loc.t, where start = end *) + +(* Produces a location at the start of the input location *) +val start_loc : t -> t + +(* Produces a location at the end of the input location *) +val end_loc : t -> t diff --git a/lib/object_parser.ml b/lib/object_parser.ml index d0b309a..dccd39d 100644 --- a/lib/object_parser.ml +++ b/lib/object_parser.ml @@ -1,683 +1,1030 @@ -(** - * Copyright (c) 2013-present, Facebook, Inc. +(* + * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. *) +module Ast = Flow_ast open Token open Parser_env -open Ast -module Error = Parse_error -module SSet = Set.Make(String) - +open Flow_ast +module SMap = Map.Make (String) open Parser_common +open Comment_attachment (* A module for parsing various object related things, like object literals * and classes *) module type OBJECT = sig - val key : ?class_body: bool -> env -> Loc.t * Loc.t Ast.Expression.Object.Property.key - val _initializer : env -> Loc.t * Loc.t Ast.Expression.Object.t * pattern_errors - val class_declaration : env -> Loc.t Ast.Class.Decorator.t list -> Loc.t Ast.Statement.t - val class_expression : env -> Loc.t Ast.Expression.t - val class_implements : env -> Loc.t Ast.Class.Implements.t list -> Loc.t Ast.Class.Implements.t list - val decorator_list : env -> Loc.t Ast.Class.Decorator.t list + val key : ?class_body:bool -> env -> Loc.t * (Loc.t, Loc.t) Ast.Expression.Object.Property.key + + val _initializer : env -> Loc.t * (Loc.t, Loc.t) Ast.Expression.Object.t * pattern_errors + + val class_declaration : + env -> (Loc.t, Loc.t) Ast.Class.Decorator.t list -> (Loc.t, Loc.t) Ast.Statement.t + + val class_expression : env -> (Loc.t, Loc.t) Ast.Expression.t + + val class_implements : env -> attach_leading:bool -> (Loc.t, Loc.t) Ast.Class.Implements.t + + val decorator_list : env -> (Loc.t, Loc.t) Ast.Class.Decorator.t list end module Object - (Parse: Parser_common.PARSER) - (Type: Type_parser.TYPE) - (Declaration: Declaration_parser.DECLARATION) - (Expression: Expression_parser.EXPRESSION) - (Pattern_cover: Pattern_cover.COVER) -: OBJECT = struct + (Parse : Parser_common.PARSER) + (Type : Type_parser.TYPE) + (Declaration : Declaration_parser.DECLARATION) + (Expression : Expression_parser.EXPRESSION) + (Pattern_cover : Pattern_cover.COVER) : OBJECT = struct let decorator_list = + let expression env = + let expression = Expression.left_hand_side env in + let { remove_trailing; _ } = + if Peek.is_line_terminator env then + trailing_and_remover_after_last_line env + else + trailing_and_remover_after_last_loc env + in + remove_trailing expression (fun remover expression -> remover#expression expression) + in let decorator env = + let leading = Peek.comments env in Eat.token env; - { Ast.Class.Decorator.expression = Expression.left_hand_side env } + { + Ast.Class.Decorator.expression = expression env; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + } in let rec decorator_list_helper env decorators = match Peek.token env with - | T_AT -> decorator_list_helper env ((with_loc decorator env)::decorators) + | T_AT -> decorator_list_helper env (with_loc decorator env :: decorators) | _ -> decorators in fun env -> - if (parse_options env).esproposal_decorators - then List.rev (decorator_list_helper env []) - else [] + if (parse_options env).esproposal_decorators then + List.rev (decorator_list_helper env []) + else + [] - let key ?(class_body=false) env = + let key ?(class_body = false) env = let open Ast.Expression.Object.Property in - match Peek.token env with + let leading = Peek.comments env in + let tkn = Peek.token env in + match tkn with | T_STRING (loc, value, raw, octal) -> - if octal then strict_error env Error.StrictOctalLiteral; - Expect.token env (T_STRING (loc, value, raw, octal)); - let value = Literal.String value in - loc, Literal (loc, { Literal.value; raw; }) + if octal then strict_error env Parse_error.StrictOctalLiteral; + Expect.token env (T_STRING (loc, value, raw, octal)); + let value = Literal.String value in + let trailing = Eat.trailing_comments env in + ( loc, + Literal + ( loc, + { Literal.value; raw; comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () } + ) ) | T_NUMBER { kind; raw } -> - let loc = Peek.loc env in - let value = Expression.number env kind raw in - let value = Literal.Number value in - loc, Literal (loc, { Literal.value; raw; }) + let loc = Peek.loc env in + let value = Expression.number env kind raw in + let value = Literal.Number value in + let trailing = Eat.trailing_comments env in + ( loc, + Literal + ( loc, + { Literal.value; raw; comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () } + ) ) | T_LBRACKET -> - let start_loc = Peek.loc env in - Expect.token env T_LBRACKET; - let expr = Parse.assignment (env |> with_no_in false) in - let end_loc = Peek.loc env in - Expect.token env T_RBRACKET; - Loc.btwn start_loc end_loc, Ast.Expression.Object.Property.Computed expr + let (loc, key) = + with_loc + (fun env -> + let leading = Peek.comments env in + Expect.token env T_LBRACKET; + let expr = Parse.assignment (env |> with_no_in false) in + Expect.token env T_RBRACKET; + let trailing = Eat.trailing_comments env in + { + ComputedKey.expression = expr; + comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + }) + env + in + (loc, Ast.Expression.Object.Property.Computed (loc, key)) | T_POUND when class_body -> - let loc, id, _is_private = Expression.property_name_include_private env in - add_declared_private env (snd id); - loc, PrivateName (loc, id) + let (loc, id, _is_private, leading) = Expression.property_name_include_private env in + add_declared_private env (Flow_ast_utils.name_of_ident id); + ( loc, + PrivateName (loc, { PrivateName.id; comments = Flow_ast_utils.mk_comments_opt ~leading () }) + ) | _ -> - let loc, id, is_private = Expression.property_name_include_private env in - if is_private then error_at env (loc, Parse_error.PrivateNotInClass); - loc, Identifier id + let (loc, id, is_private, _) = Expression.property_name_include_private env in + if is_private then error_at env (loc, Parse_error.PrivateNotInClass); + (loc, Identifier id) - let getter_or_setter env is_getter = + let getter_or_setter env ~in_class_body is_getter = (* this is a getter or setter, it cannot be async *) let async = false in - let generator = Declaration.generator env in - let key_loc, key = key env in - let start_loc = Peek.loc env in - - (* #sec-function-definitions-static-semantics-early-errors *) - let env = env |> with_allow_super Super_prop in - - (* It's not clear how type params on getters & setters would make sense - * in Flow's type system. Since this is a Flow syntax extension, we might - * as well disallow it until we need it *) - let tparams = None in - let params = Declaration.function_params ~await:false ~yield:false env in - begin match is_getter, params with - | true, (_, { Ast.Function.Params.params = []; rest = None }) -> () - | false, (_, { Ast.Function.Params.rest = Some _; _ }) -> - (* rest params don't make sense on a setter *) - error_at env (key_loc, Error.SetterArity) - | false, (_, { Ast.Function.Params.params = [_]; _ }) -> () - | true, _ -> error_at env (key_loc, Error.GetterArity) - | false, _ -> error_at env (key_loc, Error.SetterArity) - end; - let return = Type.annotation_opt env in - let _, body, strict = Declaration.function_body env ~async ~generator in - let simple = Declaration.is_simple_function_params params in - Declaration.strict_post_check env ~strict ~simple None params; - let end_loc, expression = Function.( - match body with - | BodyBlock (loc, _) -> loc, false - | BodyExpression (loc, _) -> loc, true) in - let loc = Loc.btwn start_loc end_loc in - let value = loc, Function.({ - id = None; - params; - body; - generator; - async; - predicate = None; (* setters/getter are not predicates *) - expression; - return; - tparams; - }) in - key, value + let (generator, leading) = Declaration.generator env in + let (key_loc, key) = key ~class_body:in_class_body env in + let key = object_key_remove_trailing env key in + let value = + with_loc + (fun env -> + (* #sec-function-definitions-static-semantics-early-errors *) + let env = env |> with_allow_super Super_prop in + let (sig_loc, (tparams, params, return)) = + with_loc + (fun env -> + (* It's not clear how type params on getters & setters would make sense + * in Flow's type system. Since this is a Flow syntax extension, we might + * as well disallow it until we need it *) + let tparams = None in + let params = + let params = Declaration.function_params ~await:false ~yield:false env in + if Peek.token env = T_COLON then + params + else + function_params_remove_trailing env params + in + begin + match (is_getter, params) with + | (true, (_, { Ast.Function.Params.this_ = Some _; _ })) -> + error_at env (key_loc, Parse_error.GetterMayNotHaveThisParam) + | (false, (_, { Ast.Function.Params.this_ = Some _; _ })) -> + error_at env (key_loc, Parse_error.SetterMayNotHaveThisParam) + | ( true, + ( _, + { Ast.Function.Params.params = []; rest = None; this_ = None; comments = _ } + ) ) -> + () + | (false, (_, { Ast.Function.Params.rest = Some _; _ })) -> + (* rest params don't make sense on a setter *) + error_at env (key_loc, Parse_error.SetterArity) + | ( false, + ( _, + { + Ast.Function.Params.params = [_]; + rest = None; + this_ = None; + comments = _; + } ) ) -> + () + | (true, _) -> error_at env (key_loc, Parse_error.GetterArity) + | (false, _) -> error_at env (key_loc, Parse_error.SetterArity) + end; + let return = type_annotation_hint_remove_trailing env (Type.annotation_opt env) in + (tparams, params, return)) + env + in + let (body, strict) = Declaration.function_body env ~async ~generator ~expression:false in + let simple = Declaration.is_simple_function_params params in + Declaration.strict_post_check env ~strict ~simple None params; + { + Function.id = None; + params; + body; + generator; + async; + predicate = None; + (* setters/getter are not predicates *) + return; + tparams; + sig_loc; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + }) + env + in + (key, value) let _initializer = let parse_assignment_cover env = match Expression.assignment_cover env with - | Cover_expr expr -> expr, Pattern_cover.empty_errors - | Cover_patt (expr, errs) -> expr, errs + | Cover_expr expr -> (expr, Pattern_cover.empty_errors) + | Cover_patt (expr, errs) -> (expr, errs) in - let rec property env = + let get env start_loc leading = + let (loc, (key, value)) = + with_loc ~start_loc (fun env -> getter_or_setter env ~in_class_body:false true) env + in let open Ast.Expression.Object in - let start_loc = Peek.loc env in - if Peek.token env = T_ELLIPSIS - then begin - (* Spread property *) - Expect.token env T_ELLIPSIS; - let argument, errs = parse_assignment_cover env in - SpreadProperty (Loc.btwn start_loc (fst argument), SpreadProperty.({ - argument; - })), errs - end else begin - let async = match Peek.ith_token ~i:1 env with - | T_ASSIGN (* { async = true } (destructuring) *) - | T_COLON (* { async: true } *) - | T_LESS_THAN (* { async() {} } *) - | T_LPAREN (* { async() {} } *) - | T_COMMA (* { async, other, shorthand } *) - | T_RCURLY (* { async } *) - -> false - | _ - -> Declaration.async env - in - let generator = Declaration.generator env in - match async, generator, Peek.token env with - | false, false, T_IDENTIFIER { raw = "get"; _ } -> - let _, key = key env in - begin match Peek.token env with - | T_ASSIGN - | T_COLON - | T_LESS_THAN - | T_LPAREN - | T_COMMA - | T_RCURLY -> init env start_loc key false false - | _ -> get env start_loc, Pattern_cover.empty_errors - end - | false, false, T_IDENTIFIER { raw = "set"; _ } -> - let _, key = key env in - begin match Peek.token env with - | T_ASSIGN - | T_COLON - | T_LESS_THAN - | T_LPAREN - | T_COMMA - | T_RCURLY -> init env start_loc key false false - | _ -> set env start_loc, Pattern_cover.empty_errors - end - | async, generator, _ -> - let _, key = key env in - init env start_loc key async generator - end - - and get env start_loc = - let key, (end_loc, fn) = getter_or_setter env true in - let loc = Loc.btwn start_loc end_loc in - Ast.Expression.Object.(Property (loc, Property.Get { - key; - value = (end_loc, fn); - })) - - and set env start_loc = - let key, (end_loc, fn) = getter_or_setter env false in - let loc = Loc.btwn start_loc end_loc in - Ast.Expression.Object.(Property (loc, Property.Set { - key; - value = (end_loc, fn); - })) - + Property + (loc, Property.Get { key; value; comments = Flow_ast_utils.mk_comments_opt ~leading () }) + in + let set env start_loc leading = + let (loc, (key, value)) = + with_loc ~start_loc (fun env -> getter_or_setter env ~in_class_body:false false) env + in + let open Ast.Expression.Object in + Property + (loc, Property.Set { key; value; comments = Flow_ast_utils.mk_comments_opt ~leading () }) + in (* #prod-PropertyDefinition *) - and init = + let init = let open Ast.Expression.Object.Property in - (* #prod-IdentifierReference *) - let parse_shorthand env key = match key with + let parse_shorthand env key = + match key with | Literal (loc, lit) -> - error_at env (loc, Parse_error.LiteralShorthandProperty); - loc, Ast.Expression.Literal lit - | Identifier ((loc, name) as id) -> - (* #sec-identifiers-static-semantics-early-errors *) - begin - if is_reserved name && name <> "yield" && name <> "await" then - (* it is a syntax error if `name` is a reserved word other than await or yield *) - error_at env (loc, Parse_error.UnexpectedReserved) - else if is_strict_reserved name then - (* it is a syntax error if `name` is a strict reserved word, in strict mode *) - strict_error_at env (loc, Parse_error.StrictReservedWord) - end; - loc, Ast.Expression.Identifier id + error_at env (loc, Parse_error.LiteralShorthandProperty); + (loc, Ast.Expression.Literal lit) + | Identifier ((loc, { Identifier.name; comments = _ }) as id) -> + (* #sec-identifiers-static-semantics-early-errors *) + if is_reserved name && name <> "yield" && name <> "await" then + (* it is a syntax error if `name` is a reserved word other than await or yield *) + error_at env (loc, Parse_error.UnexpectedReserved) + else if is_strict_reserved name then + (* it is a syntax error if `name` is a strict reserved word, in strict mode *) + strict_error_at env (loc, Parse_error.StrictReservedWord); + (loc, Ast.Expression.Identifier id) | PrivateName _ -> failwith "Internal Error: private name found in object props" - | Computed expr -> - error_at env (fst expr, Parse_error.ComputedShorthandProperty); - expr + | Computed (_, { ComputedKey.expression = expr; comments = _ }) -> + error_at env (fst expr, Parse_error.ComputedShorthandProperty); + expr in - (* #prod-MethodDefinition *) - let parse_method env ~async ~generator = - let start_loc = Peek.loc env in - - (* #sec-function-definitions-static-semantics-early-errors *) - let env = env |> with_allow_super Super_prop in - - let tparams = Type.type_parameter_declaration env in - let params = - let yield, await = match async, generator with - | true, true -> true, true (* proposal-async-iteration/#prod-AsyncGeneratorMethod *) - | true, false -> false, allow_await env (* #prod-AsyncMethod *) - | false, true -> true, false (* #prod-GeneratorMethod *) - | false, false -> false, false (* #prod-MethodDefinition *) - in - Declaration.function_params ~await ~yield env - in - let return = Type.annotation_opt env in - let _, body, strict = - Declaration.function_body env ~async ~generator in - let simple = Declaration.is_simple_function_params params in - Declaration.strict_post_check env ~strict ~simple None params; - let end_loc, expression = match body with - | Function.BodyBlock (loc, _) -> loc, false - | Function.BodyExpression (loc, _) -> loc, true - in - let loc = Loc.btwn start_loc end_loc in - loc, Function.({ - id = None; - params; - body; - generator; - async; - (* TODO: add support for object method predicates *) - predicate = None; - expression; - return; - tparams; - }) + let parse_method ~async ~generator ~leading = + with_loc (fun env -> + (* #sec-function-definitions-static-semantics-early-errors *) + let env = env |> with_allow_super Super_prop in + let (sig_loc, (tparams, params, return)) = + with_loc + (fun env -> + let tparams = type_params_remove_trailing env (Type.type_params env) in + let params = + let (yield, await) = + match (async, generator) with + | (true, true) -> + (true, true) (* proposal-async-iteration/#prod-AsyncGeneratorMethod *) + | (true, false) -> (false, allow_await env) (* #prod-AsyncMethod *) + | (false, true) -> (true, false) (* #prod-GeneratorMethod *) + | (false, false) -> (false, false) + (* #prod-MethodDefinition *) + in + let params = Declaration.function_params ~await ~yield env in + if Peek.token env = T_COLON then + params + else + function_params_remove_trailing env params + in + let return = type_annotation_hint_remove_trailing env (Type.annotation_opt env) in + (tparams, params, return)) + env + in + let (body, strict) = + Declaration.function_body env ~async ~generator ~expression:false + in + let simple = Declaration.is_simple_function_params params in + Declaration.strict_post_check env ~strict ~simple None params; + { + Function.id = None; + params; + body; + generator; + async; + (* TODO: add support for object method predicates *) + predicate = None; + return; + tparams; + sig_loc; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + }) in - (* PropertyName `:` AssignmentExpression *) let parse_value env = Expect.token env T_COLON; parse_assignment_cover env in - (* #prod-CoverInitializedName *) let parse_assignment_pattern ~key env = let open Ast.Expression.Object in match key with | Property.Identifier id -> let assignment_loc = Peek.loc env in - Expect.token env T_ASSIGN; - let left = Parse.pattern_from_expr env (fst id, Ast.Expression.Identifier id) in - let right = Parse.assignment env in - let loc = Loc.btwn (fst left) (fst right) in - (loc, Ast.Expression.(Assignment Assignment.({ - operator = Assign; - left; - right; - }))), { - if_expr = [assignment_loc, Parse_error.UnexpectedToken "="]; - if_patt = []; - } - + let ast = + with_loc + ~start_loc:(fst id) + (fun env -> + let leading = Peek.comments env in + Expect.token env T_ASSIGN; + let trailing = Eat.trailing_comments env in + let left = Parse.pattern_from_expr env (fst id, Ast.Expression.Identifier id) in + let right = Parse.assignment env in + let comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () in + Ast.Expression.Assignment + { Ast.Expression.Assignment.operator = None; left; right; comments }) + env + in + let errs = + { + if_expr = [(assignment_loc, Parse_error.Unexpected (Token.quote_token_value "="))]; + if_patt = []; + } + in + (ast, errs) | Property.Literal _ | Property.PrivateName _ | Property.Computed _ -> parse_value env in - - let parse_init ~key ~async ~generator env = + let parse_init ~key ~async ~generator ~leading env = if async || generator then + let key = object_key_remove_trailing env key in (* the `async` and `*` modifiers are only valid on methods *) - let value = parse_method env ~async ~generator in + let value = parse_method env ~async ~generator ~leading in let prop = Method { key; value } in - prop, Pattern_cover.empty_errors - else match Peek.token env with - | T_RCURLY - | T_COMMA -> - let value = parse_shorthand env key in - let prop = Init { key; value; shorthand = true } in - prop, Pattern_cover.empty_errors - | T_LESS_THAN - | T_LPAREN -> - let value = parse_method env ~async ~generator in - let prop = Method { key; value } in - prop, Pattern_cover.empty_errors - | T_ASSIGN -> - let value, errs = parse_assignment_pattern ~key env in - let prop = Init { key; value; shorthand = true } in - prop, errs - | _ -> - let value, errs = parse_value env in - let prop = Init { key; value; shorthand = false } in - prop, errs + (prop, Pattern_cover.empty_errors) + else + match Peek.token env with + | T_RCURLY + | T_COMMA -> + let value = parse_shorthand env key in + let prop = Init { key; value; shorthand = true } in + (prop, Pattern_cover.empty_errors) + | T_LESS_THAN + | T_LPAREN -> + let key = object_key_remove_trailing env key in + let value = parse_method env ~async ~generator ~leading in + let prop = Method { key; value } in + (prop, Pattern_cover.empty_errors) + | T_ASSIGN -> + let (value, errs) = parse_assignment_pattern ~key env in + let prop = Init { key; value; shorthand = true } in + (prop, errs) + | _ -> + let (value, errs) = parse_value env in + let prop = Init { key; value; shorthand = false } in + (prop, errs) in - fun env start_loc key async generator -> - let end_loc, (prop, errs) = with_loc ( - parse_init ~key ~async ~generator - ) env in - Ast.Expression.Object.Property (Loc.btwn start_loc end_loc, prop), errs - - and properties env ~rest_trailing_comma (props, errs) = + fun env start_loc key async generator leading -> + let (loc, (prop, errs)) = + with_loc ~start_loc (parse_init ~key ~async ~generator ~leading) env + in + (Ast.Expression.Object.Property (loc, prop), errs) + in + let property env = + let open Ast.Expression.Object in + if Peek.token env = T_ELLIPSIS then + (* Spread property *) + let leading = Peek.comments env in + let (loc, (argument, errs)) = + with_loc + (fun env -> + Expect.token env T_ELLIPSIS; + parse_assignment_cover env) + env + in + ( SpreadProperty + (loc, { SpreadProperty.argument; comments = Flow_ast_utils.mk_comments_opt ~leading () }), + errs ) + else + let start_loc = Peek.loc env in + let (async, leading_async) = + match Peek.ith_token ~i:1 env with + | T_ASSIGN + (* { async = true } (destructuring) *) + | T_COLON + (* { async: true } *) + | T_LESS_THAN + (* { async() {} } *) + | T_LPAREN + (* { async() {} } *) + | T_COMMA + (* { async, other, shorthand } *) + | T_RCURLY (* { async } *) -> + (false, []) + | _ -> Declaration.async env + in + let (generator, leading_generator) = Declaration.generator env in + let leading = leading_async @ leading_generator in + match (async, generator, Peek.token env) with + | (false, false, T_IDENTIFIER { raw = "get"; _ }) -> + let leading = Peek.comments env in + let (_, key) = key env in + begin + match Peek.token env with + | T_ASSIGN + | T_COLON + | T_LESS_THAN + | T_LPAREN + | T_COMMA + | T_RCURLY -> + init env start_loc key false false [] + | _ -> + ignore (Comment_attachment.object_key_remove_trailing env key); + (get env start_loc leading, Pattern_cover.empty_errors) + end + | (false, false, T_IDENTIFIER { raw = "set"; _ }) -> + let leading = Peek.comments env in + let (_, key) = key env in + begin + match Peek.token env with + | T_ASSIGN + | T_COLON + | T_LESS_THAN + | T_LPAREN + | T_COMMA + | T_RCURLY -> + init env start_loc key false false [] + | _ -> + ignore (Comment_attachment.object_key_remove_trailing env key); + (set env start_loc leading, Pattern_cover.empty_errors) + end + | (async, generator, _) -> + let (_, key) = key env in + init env start_loc key async generator leading + in + let rec properties env ~rest_trailing_comma (props, errs) = match Peek.token env with | T_EOF | T_RCURLY -> - let errs = match rest_trailing_comma with - | Some loc -> - { errs with if_patt = (loc, Parse_error.TrailingCommaAfterRestElement)::errs.if_patt } - | None -> errs in - List.rev props, Pattern_cover.rev_errors errs + let errs = + match rest_trailing_comma with + | Some loc -> + { errs with if_patt = (loc, Parse_error.TrailingCommaAfterRestElement) :: errs.if_patt } + | None -> errs + in + (List.rev props, Pattern_cover.rev_errors errs) | _ -> - let prop, new_errs = property env in - let rest_trailing_comma = match prop with + let (prop, new_errs) = property env in + let rest_trailing_comma = + match prop with | Ast.Expression.Object.SpreadProperty _ when Peek.token env = T_COMMA -> Some (Peek.loc env) - | _ -> None in - if Peek.token env <> T_RCURLY then Expect.token env T_COMMA; - let errs = Pattern_cover.rev_append_errors new_errs errs in - properties env ~rest_trailing_comma (prop::props, errs) + | _ -> None + in + (match Peek.token env with + | T_RCURLY + | T_EOF -> + () + | _ -> Expect.token env T_COMMA); + let errs = Pattern_cover.rev_append_errors new_errs errs in + properties env ~rest_trailing_comma (prop :: props, errs) + in + fun env -> + let (loc, (expr, errs)) = + with_loc + (fun env -> + let leading = Peek.comments env in + Expect.token env T_LCURLY; + let (props, errs) = + properties env ~rest_trailing_comma:None ([], Pattern_cover.empty_errors) + in + let internal = Peek.comments env in + Expect.token env T_RCURLY; + let trailing = Eat.trailing_comments env in + ( { + Ast.Expression.Object.properties = props; + comments = Flow_ast_utils.mk_comments_with_internal_opt ~leading ~trailing ~internal; + }, + errs )) + env + in + (loc, expr, errs) - in fun env -> - let loc, (expr, errs) = with_loc (fun env -> - Expect.token env T_LCURLY; - let props, errs = - properties env ~rest_trailing_comma:None ([], Pattern_cover.empty_errors) in - Expect.token env T_RCURLY; - { Ast.Expression.Object.properties = props; }, errs - ) env in - loc, expr, errs + let check_property_name env loc name static = + if String.equal name "constructor" || (String.equal name "prototype" && static) then + error_at env (loc, Parse_error.InvalidFieldName { name; static; private_ = false }) - let rec class_implements env acc = - let id = Type.type_identifier env in - let targs = Type.type_parameter_instantiation env in - let loc = match targs with - | None -> fst id - | Some (loc, _) -> Loc.btwn (fst id) loc in - let implement = loc, Ast.Class.Implements.({ - id; - targs; - }) in - let acc = implement::acc in - match Peek.token env with - | T_COMMA -> - Expect.token env T_COMMA; - class_implements env acc - | _ -> List.rev acc + let check_private_names env seen_names private_name (kind : [ `Field | `Getter | `Setter ]) = + let (loc, { PrivateName.id = (_, { Identifier.name; comments = _ }); comments = _ }) = + private_name + in + if String.equal name "constructor" then + let () = + error_at env (loc, Parse_error.InvalidFieldName { name; static = false; private_ = true }) + in + seen_names + else + match SMap.find_opt name seen_names with + | Some seen -> + begin + match (kind, seen) with + | (`Getter, `Setter) + | (`Setter, `Getter) -> + (* one getter and one setter are allowed as long as it's not used as a field *) + () + | _ -> error_at env (loc, Parse_error.DuplicatePrivateFields name) + end; + SMap.add name `Field seen_names + | None -> SMap.add name kind seen_names - let rec _class env = - let super, super_targs = - if Peek.token env = T_EXTENDS - then begin - Expect.token env T_EXTENDS; - let super = - Expression.left_hand_side (env |> with_allow_yield false) in - let super_targs = Type.type_parameter_instantiation env in - Some super, super_targs - end else None, None in - let implements = - if Peek.token env = T_IMPLEMENTS - then begin - if not (should_parse_types env) - then error env Error.UnexpectedTypeInterface; + let class_implements env ~attach_leading = + let rec interfaces env acc = + let interface = + with_loc + (fun env -> + let id = + let id = Type.type_identifier env in + if Peek.token env <> T_LESS_THAN then + id + else + let { remove_trailing; _ } = trailing_and_remover env in + remove_trailing id (fun remover id -> remover#identifier id) + in + let targs = Type.type_args env in + { Ast.Class.Implements.Interface.id; targs }) + env + in + let acc = interface :: acc in + match Peek.token env with + | T_COMMA -> + Expect.token env T_COMMA; + interfaces env acc + | _ -> List.rev acc + in + with_loc + (fun env -> + let leading = + if attach_leading then + Peek.comments env + else + [] + in Expect.token env T_IMPLEMENTS; - class_implements env [] - end else [] in - let body = class_body env in - body, super, super_targs, implements + let interfaces = interfaces env [] in + { Ast.Class.Implements.interfaces; comments = Flow_ast_utils.mk_comments_opt ~leading () }) + env - and class_body = - let rec elements env seen_constructor private_names acc = - match Peek.token env with - | T_EOF - | T_RCURLY -> List.rev acc - | T_SEMICOLON -> - (* Skip empty elements *) - Expect.token env T_SEMICOLON; - elements env seen_constructor private_names acc - | _ -> - let element = class_element env in - let seen_constructor', private_names' = begin match element with - | Ast.Class.Body.Method (loc, m) -> - let open Ast.Class.Method in - begin match m.kind with - | Constructor when not m.static -> - if seen_constructor then - error_at env (loc, Error.DuplicateConstructor); - (true, private_names) - | Method -> - (seen_constructor, begin match m.key with - | Ast.Expression.Object.Property.PrivateName _ -> - error_at env (loc, Error.PrivateMethod); - private_names - | _ -> private_names - end) - | _ -> (seen_constructor, private_names) - end - | Ast.Class.Body.Property (loc, p) -> - let open Ast.Expression.Object.Property in - (seen_constructor, begin match p.Ast.Class.Property.key with - | Identifier (_, x) when String.equal x "constructor" || - (String.equal x "prototype" && p.Ast.Class.Property.static) -> - error_at env (loc, Error.InvalidFieldName (x, String.equal x "prototype", false)); - private_names - | _ -> private_names - end) - | Ast.Class.Body.PrivateField (_, {Ast.Class.PrivateField.key = (loc, (_, name)); _}) - when String.equal name "#constructor" -> - error_at env (loc, Error.InvalidFieldName (name, false, true)); - (seen_constructor, private_names) - | Ast.Class.Body.PrivateField (_, {Ast.Class.PrivateField.key = (loc, (_, name)); _}) -> - if SSet.mem name private_names then - error_at env (loc, Error.DuplicatePrivateFields name); - (seen_constructor, SSet.add name private_names) - end in - elements env seen_constructor' private_names' (element::acc) + let class_extends ~leading = + with_loc (fun env -> + let expr = + let expr = Expression.left_hand_side (env |> with_allow_yield false) in + if Peek.token env <> T_LESS_THAN then + expr + else + let { remove_trailing; _ } = trailing_and_remover env in + remove_trailing expr (fun remover expr -> remover#expression expr) + in + let targs = Type.type_args env in + { Class.Extends.expr; targs; comments = Flow_ast_utils.mk_comments_opt ~leading () }) - in fun env -> - let start_loc = Peek.loc env in - Expect.token env T_LCURLY; - enter_class env; - let body = elements env false SSet.empty [] in - exit_class env; - let end_loc = Peek.loc env in - Expect.token env T_RCURLY; - Loc.btwn start_loc end_loc, Ast.Class.Body.({ - body; - }) + (* https://tc39.es/ecma262/#prod-ClassHeritage *) + let class_heritage env = + let extends = + let leading = Peek.comments env in + if Eat.maybe env T_EXTENDS then + let (loc, extends) = class_extends ~leading env in + let { remove_trailing; _ } = trailing_and_remover env in + Some + (loc, remove_trailing extends (fun remover extends -> remover#class_extends loc extends)) + else + None + in + let implements = + if Peek.token env = T_IMPLEMENTS then ( + if not (should_parse_types env) then error env Parse_error.UnexpectedTypeInterface; + Some (class_implements_remove_trailing env (class_implements env ~attach_leading:true)) + ) else + None + in + (extends, implements) (* In the ES6 draft, all elements are methods. No properties (though there * are getter and setters allowed *) - and class_element = - let get env start_loc decorators static = - let key, (end_loc, _ as value) = - getter_or_setter env true in - Ast.Class.(Body.Method (Loc.btwn start_loc end_loc, Method.({ - key; - value; - kind = Get; - static; - decorators; - }))) - - in let set env start_loc decorators static = - let key, (end_loc, _ as value) = - getter_or_setter env false in - Ast.Class.(Body.Method (Loc.btwn start_loc end_loc, Method.({ - key; - value; - kind = Set; - static; - decorators; - }))) - - in let error_unsupported_variance env = function - | Some (loc, _) -> error_at env (loc, Error.UnexpectedVariance) - | None -> () - - in let rec init env start_loc decorators key async generator static variance = - match Peek.token env with - | T_COLON - | T_ASSIGN - | T_SEMICOLON when not async && not generator -> - (* Class property with annotation *) - let end_loc, (annot, value) = with_loc (fun env -> - let annot = Type.annotation_opt env in - let options = parse_options env in - let value = - if Peek.token env = T_ASSIGN then ( - if static && options.esproposal_class_static_fields - || (not static) && options.esproposal_class_instance_fields - then begin - Expect.token env T_ASSIGN; - Some (Parse.expression (env |> with_allow_super Super_prop)) - end else None - ) else None - in - begin if Expect.maybe env T_SEMICOLON then - () - else if Peek.token env == T_LBRACKET || Peek.token env == T_LPAREN then - error_unexpected env - end; - annot, value - ) env in - let loc = Loc.btwn start_loc end_loc in - begin match key with - | Ast.Expression.Object.Property.PrivateName private_name -> - Ast.Class.(Body.PrivateField (loc, PrivateField.({ - key = private_name; + let class_element = + let get env start_loc decorators static leading = + let (loc, (key, value)) = + with_loc ~start_loc (fun env -> getter_or_setter env ~in_class_body:true true) env + in + let open Ast.Class in + Body.Method + ( loc, + { + Method.key; value; - annot; + kind = Method.Get; static; - variance; - }))) - | _ -> Ast.Class.(Body.Property (loc, Property.({ - key; + decorators; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + } ) + in + let set env start_loc decorators static leading = + let (loc, (key, value)) = + with_loc ~start_loc (fun env -> getter_or_setter env ~in_class_body:true false) env + in + let open Ast.Class in + Body.Method + ( loc, + { + Method.key; value; - annot; + kind = Method.Set; static; - variance; - }))) end + decorators; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + } ) + in + let error_unsupported_variance env = function + | Some (loc, _) -> error_at env (loc, Parse_error.UnexpectedVariance) + | None -> () + (* Class property with annotation *) + in + let error_unsupported_declare env = function + | Some loc -> error_at env (loc, Parse_error.DeclareClassElement) + | None -> () + in + let property_end_and_semicolon env key annot value = + match Peek.token env with + | T_LBRACKET + | T_LPAREN -> + error_unexpected env; + (key, annot, value, []) + | T_SEMICOLON -> + Eat.token env; + let trailing = + match Peek.token env with + | T_EOF + | T_RCURLY -> + Eat.trailing_comments env + | _ when Peek.is_line_terminator env -> Eat.comments_until_next_line env + | _ -> [] + in + (key, annot, value, trailing) + | _ -> + let remover = + match Peek.token env with + | T_EOF + | T_RCURLY -> + { trailing = []; remove_trailing = (fun x _ -> x) } + | _ when Peek.is_line_terminator env -> + Comment_attachment.trailing_and_remover_after_last_line env + | _ -> Comment_attachment.trailing_and_remover_after_last_loc env + in + (* Remove trailing comments from the last node in this property *) + let (key, annot, value) = + match (annot, value) with + (* prop = init *) + | (_, Class.Property.Initialized expr) -> + ( key, + annot, + Class.Property.Initialized + (remover.remove_trailing expr (fun remover expr -> remover#expression expr)) ) + (* prop: annot *) + | (Ast.Type.Available annot, _) -> + ( key, + Ast.Type.Available + (remover.remove_trailing annot (fun remover annot -> remover#type_annotation annot)), + value ) + (* prop *) + | _ -> + (remover.remove_trailing key (fun remover key -> remover#object_key key), annot, value) + in + (key, annot, value, []) + in + let property env start_loc key static declare variance leading = + let (loc, (key, annot, value, comments)) = + with_loc + ~start_loc + (fun env -> + let annot = Type.annotation_opt env in + let options = parse_options env in + let value = + match (declare, Peek.token env) with + | (None, T_ASSIGN) -> + if + (static && options.esproposal_class_static_fields) + || ((not static) && options.esproposal_class_instance_fields) + then ( + Expect.token env T_ASSIGN; + Ast.Class.Property.Initialized + (Parse.expression (env |> with_allow_super Super_prop)) + ) else + Ast.Class.Property.Uninitialized + | (Some _, T_ASSIGN) -> + error env Parse_error.DeclareClassFieldInitializer; + Eat.token env; + Ast.Class.Property.Declared + | (None, _) -> Ast.Class.Property.Uninitialized + | (Some _, _) -> Ast.Class.Property.Declared + in + let (key, annot, value, trailing) = property_end_and_semicolon env key annot value in + (key, annot, value, Flow_ast_utils.mk_comments_opt ~leading ~trailing ())) + env + in + match key with + | Ast.Expression.Object.Property.PrivateName private_name -> + let open Ast.Class in + Body.PrivateField + (loc, { PrivateField.key = private_name; value; annot; static; variance; comments }) + | _ -> + Ast.Class.(Body.Property (loc, { Property.key; value; annot; static; variance; comments })) + in + let rec init env start_loc decorators key ~async ~generator ~static ~declare variance leading = + match Peek.token env with + | T_COLON + | T_ASSIGN + | T_SEMICOLON + | T_RCURLY + when (not async) && not generator -> + property env start_loc key static declare variance leading | T_PLING -> (* TODO: add support for optional class properties *) error_unexpected env; Eat.token env; - init env start_loc decorators key async generator static variance + init env start_loc decorators key ~async ~generator ~static ~declare variance leading + | _ when Peek.is_implicit_semicolon env -> + (* an uninitialized, unannotated property *) + property env start_loc key static declare variance leading | _ -> + error_unsupported_declare env declare; error_unsupported_variance env variance; - let kind, env = match static, key with - | false, Ast.Expression.Object.Property.Identifier (_, "constructor") - | false, Ast.Expression.Object.Property.Literal (_, { - Literal.value = Literal.String "constructor"; - _; - }) -> - Ast.Class.Method.Constructor, - env |> with_allow_super Super_prop_or_call - | _ -> - Ast.Class.Method.Method, - env |> with_allow_super Super_prop + let (kind, env) = + match (static, key) with + | ( false, + Ast.Expression.Object.Property.Identifier + (_, { Identifier.name = "constructor"; comments = _ }) ) + | ( false, + Ast.Expression.Object.Property.Literal + (_, { Literal.value = Literal.String "constructor"; _ }) ) -> + (Ast.Class.Method.Constructor, env |> with_allow_super Super_prop_or_call) + | _ -> (Ast.Class.Method.Method, env |> with_allow_super Super_prop) in - let func_loc = Peek.loc env in - let tparams = Type.type_parameter_declaration env in - let params = - let yield, await = match async, generator with - | true, true -> true, true (* proposal-async-iteration/#prod-AsyncGeneratorMethod *) - | true, false -> false, allow_await env (* #prod-AsyncMethod *) - | false, true -> true, false (* #prod-GeneratorMethod *) - | false, false -> false, false (* #prod-MethodDefinition *) - in - Declaration.function_params ~await ~yield env + let key = object_key_remove_trailing env key in + let value = + with_loc + (fun env -> + let (sig_loc, (tparams, params, return)) = + with_loc + (fun env -> + let tparams = type_params_remove_trailing env (Type.type_params env) in + let params = + let (yield, await) = + match (async, generator) with + | (true, true) -> + (true, true) (* proposal-async-iteration/#prod-AsyncGeneratorMethod *) + | (true, false) -> (false, allow_await env) (* #prod-AsyncMethod *) + | (false, true) -> (true, false) (* #prod-GeneratorMethod *) + | (false, false) -> (false, false) + (* #prod-MethodDefinition *) + in + let params = Declaration.function_params ~await ~yield env in + let params = + if Peek.token env = T_COLON then + params + else + function_params_remove_trailing env params + in + Ast.Function.Params.( + match params with + | (loc, ({ this_ = Some (this_loc, _); _ } as params)) + when kind = Ast.Class.Method.Constructor -> + (* Disallow this param annotations for constructors *) + error_at env (this_loc, Parse_error.ThisParamBannedInConstructor); + (loc, { params with this_ = None }) + | params -> params) + in + let return = + type_annotation_hint_remove_trailing env (Type.annotation_opt env) + in + (tparams, params, return)) + env + in + let (body, strict) = + Declaration.function_body env ~async ~generator ~expression:false + in + let simple = Declaration.is_simple_function_params params in + Declaration.strict_post_check env ~strict ~simple None params; + { + Function.id = None; + params; + body; + generator; + async; + (* TODO: add support for method predicates *) + predicate = None; + return; + tparams; + sig_loc; + comments = None; + }) + env in - let return = Type.annotation_opt env in - let _, body, strict = - Declaration.function_body env ~async ~generator in - let simple = Declaration.is_simple_function_params params in - Declaration.strict_post_check env ~strict ~simple None params; - let end_loc, expression = Function.( - match body with - | BodyBlock (loc, _) -> loc, false - | BodyExpression (loc, _) -> loc, true) in - let loc = Loc.btwn func_loc end_loc in - let value = loc, Function.({ - id = None; - params; - body; - generator; - async; - (* TODO: add support for method predicates *) - predicate = None; - expression; - return; - tparams; - }) in - Ast.Class.(Body.Method (Loc.btwn start_loc end_loc, Method.({ - key; - value; - kind; - static; - decorators; - }))) - - in fun env -> + let open Ast.Class in + Body.Method + ( Loc.btwn start_loc (fst value), + { + Method.key; + value; + kind; + static; + decorators; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + } ) + in + let ith_implies_identifier ~i env = + match Peek.ith_token ~i env with + | T_LESS_THAN + | T_COLON + | T_ASSIGN + | T_SEMICOLON + | T_LPAREN + | T_RCURLY -> + true + | _ -> false + in + let implies_identifier = ith_implies_identifier ~i:0 in + fun env -> let start_loc = Peek.loc env in let decorators = decorator_list env in + let (declare, leading_declare) = + match Peek.token env with + | T_DECLARE when not (ith_implies_identifier ~i:1 env) -> + let ret = Some (Peek.loc env) in + let leading = Peek.comments env in + Eat.token env; + (ret, leading) + | _ -> (None, []) + in let static = - Peek.ith_token ~i:1 env <> T_LPAREN && - Peek.ith_token ~i:1 env <> T_LESS_THAN && - Expect.maybe env T_STATIC in + Peek.ith_token ~i:1 env <> T_LPAREN + && Peek.ith_token ~i:1 env <> T_LESS_THAN + && Peek.token env = T_STATIC + in + let leading_static = + if static then ( + let leading = Peek.comments env in + Eat.token env; + leading + ) else + [] + in let async = - Peek.ith_token ~i:1 env <> T_LPAREN && - Peek.ith_token ~i:1 env <> T_COLON && - Declaration.async env in - let generator = Declaration.generator env in + Peek.token env = T_ASYNC + && (not (ith_implies_identifier ~i:1 env)) + && not (Peek.ith_is_line_terminator ~i:1 env) + in + (* consume `async` *) + let leading_async = + if async then ( + let leading = Peek.comments env in + Eat.token env; + leading + ) else + [] + in + let (generator, leading_generator) = Declaration.generator env in let variance = Declaration.variance env async generator in - let generator = match generator, variance with - | false, Some _ -> Declaration.generator env - | _ -> generator + let (generator, leading_generator) = + match (generator, variance) with + | (false, Some _) -> Declaration.generator env + | _ -> (generator, leading_generator) in - match async, generator, Peek.token env with - | false, false, T_IDENTIFIER { raw = "get"; _ } -> - let _, key = key ~class_body:true env in - (match Peek.token env with - | T_LESS_THAN - | T_COLON - | T_ASSIGN - | T_SEMICOLON - | T_LPAREN -> - init env start_loc decorators key async generator static variance - | _ -> - error_unsupported_variance env variance; - get env start_loc decorators static) - | false, false, T_IDENTIFIER { raw = "set"; _ } -> - let _, key = key ~class_body:true env in - (match Peek.token env with - | T_LESS_THAN - | T_COLON - | T_ASSIGN - | T_SEMICOLON - | T_LPAREN -> - init env start_loc decorators key async generator static variance - | _ -> - error_unsupported_variance env variance; - set env start_loc decorators static) - | _, _, _ -> - let _, key = key ~class_body:true env in - init env start_loc decorators key async generator static variance + let leading = + List.concat [leading_declare; leading_static; leading_async; leading_generator] + in + match (async, generator, Peek.token env) with + | (false, false, T_IDENTIFIER { raw = "get"; _ }) -> + let leading_get = Peek.comments env in + let (_, key) = key ~class_body:true env in + if implies_identifier env then + init env start_loc decorators key ~async ~generator ~static ~declare variance leading + else ( + error_unsupported_declare env declare; + error_unsupported_variance env variance; + ignore (object_key_remove_trailing env key); + get env start_loc decorators static (leading @ leading_get) + ) + | (false, false, T_IDENTIFIER { raw = "set"; _ }) -> + let leading_set = Peek.comments env in + let (_, key) = key ~class_body:true env in + if implies_identifier env then + init env start_loc decorators key ~async ~generator ~static ~declare variance leading + else ( + error_unsupported_declare env declare; + error_unsupported_variance env variance; + ignore (object_key_remove_trailing env key); + set env start_loc decorators static (leading @ leading_set) + ) + | (_, _, _) -> + let (_, key) = key ~class_body:true env in + init env start_loc decorators key ~async ~generator ~static ~declare variance leading - let class_declaration env decorators = - (* 10.2.1 says all parts of a class definition are strict *) - let env = env |> with_strict true in - let start_loc = Peek.loc env in - let decorators = decorators @ (decorator_list env) in - Expect.token env T_CLASS; - let tmp_env = env |> with_no_let true in - let id = ( - match in_export env, Peek.is_identifier tmp_env with - | true, false -> None - | _ -> Some(Parse.identifier tmp_env) - ) in - let tparams = Type.type_parameter_declaration_with_defaults env in - let body, super, super_targs, implements = _class env in - let loc = Loc.btwn start_loc (fst body) in - loc, Ast.Statement.(ClassDeclaration Class.({ - id; - body; - tparams; - super; - super_targs; - implements; - classDecorators=decorators; - })) + let class_body = + let rec elements env seen_constructor private_names acc = + match Peek.token env with + | T_EOF + | T_RCURLY -> + List.rev acc + | T_SEMICOLON -> + (* Skip empty elements *) + Expect.token env T_SEMICOLON; + elements env seen_constructor private_names acc + | _ -> + let element = class_element env in + let (seen_constructor', private_names') = + match element with + | Ast.Class.Body.Method (loc, m) -> + let open Ast.Class.Method in + (match m.kind with + | Constructor -> + if m.static then + (seen_constructor, private_names) + else ( + if seen_constructor then error_at env (loc, Parse_error.DuplicateConstructor); + (true, private_names) + ) + | Method -> + ( seen_constructor, + begin + match m.key with + | Ast.Expression.Object.Property.PrivateName _ -> + error_at env (loc, Parse_error.PrivateMethod); + private_names + | _ -> private_names + end ) + | Get -> + let open Ast.Expression.Object.Property in + let private_names = + match m.key with + | PrivateName name -> check_private_names env private_names name `Getter + | _ -> private_names + in + (seen_constructor, private_names) + | Set -> + let open Ast.Expression.Object.Property in + let private_names = + match m.key with + | PrivateName name -> check_private_names env private_names name `Setter + | _ -> private_names + in + (seen_constructor, private_names)) + | Ast.Class.Body.Property (_, { Ast.Class.Property.key; static; _ }) -> + let open Ast.Expression.Object.Property in + begin + match key with + | Identifier (loc, { Identifier.name; comments = _ }) + | Literal (loc, { Literal.value = Literal.String name; _ }) -> + check_property_name env loc name static + | Literal _ + | Computed _ -> + () + | PrivateName _ -> + failwith "unexpected PrivateName in Property, expected a PrivateField" + end; + (seen_constructor, private_names) + | Ast.Class.Body.PrivateField (_, { Ast.Class.PrivateField.key; _ }) -> + let private_names = check_private_names env private_names key `Field in + (seen_constructor, private_names) + in + elements env seen_constructor' private_names' (element :: acc) + in + fun ~expression env -> + with_loc + (fun env -> + let leading = Peek.comments env in + if Eat.maybe env T_LCURLY then ( + enter_class env; + let body = elements env false SMap.empty [] in + exit_class env; + Expect.token env T_RCURLY; + let trailing = + match (expression, Peek.token env) with + | (true, _) + | (_, (T_RCURLY | T_EOF)) -> + Eat.trailing_comments env + | _ when Peek.is_line_terminator env -> Eat.comments_until_next_line env + | _ -> [] + in + { Ast.Class.Body.body; comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () } + ) else ( + Expect.error env T_LCURLY; + { Ast.Class.Body.body = []; comments = None } + )) + env - let class_expression = with_loc (fun env -> - (* 10.2.1 says all parts of a class expression are strict *) + let _class ?(decorators = []) env ~optional_id ~expression = + (* 10.2.1 says all parts of a class definition are strict *) let env = env |> with_strict true in - let decorators = decorator_list env in + let decorators = decorators @ decorator_list env in + let leading = Peek.comments env in Expect.token env T_CLASS; - let id, tparams = match Peek.token env with - | T_EXTENDS - | T_LESS_THAN - | T_LCURLY -> None, None + let id = + let tmp_env = env |> with_no_let true in + match (optional_id, Peek.token tmp_env) with + | (true, (T_EXTENDS | T_IMPLEMENTS | T_LESS_THAN | T_LCURLY)) -> None | _ -> - let id = Some (Parse.identifier env) in - let tparams = Type.type_parameter_declaration_with_defaults env in - id, tparams in - let body, super, super_targs, implements = _class env in - Ast.Expression.Class { Class. - id; - body; - tparams; - super; - super_targs; - implements; - classDecorators=decorators; - } - ) + let id = Parse.identifier tmp_env in + let { remove_trailing; _ } = trailing_and_remover env in + let id = remove_trailing id (fun remover id -> remover#identifier id) in + Some id + in + let tparams = + match Type.type_params env with + | None -> None + | Some tparams -> + let { remove_trailing; _ } = trailing_and_remover env in + Some (remove_trailing tparams (fun remover tparams -> remover#type_params tparams)) + in + let (extends, implements) = class_heritage env in + let body = class_body env ~expression in + let comments = Flow_ast_utils.mk_comments_opt ~leading () in + { Class.id; body; tparams; extends; implements; class_decorators = decorators; comments } + + let class_declaration env decorators = + with_loc + (fun env -> + let optional_id = in_export env in + Ast.Statement.ClassDeclaration (_class env ~decorators ~optional_id ~expression:false)) + env + + let class_expression = + with_loc (fun env -> Ast.Expression.Class (_class env ~optional_id:true ~expression:true)) end diff --git a/lib/offset_utils.ml b/lib/offset_utils.ml new file mode 100644 index 0000000..db39427 --- /dev/null +++ b/lib/offset_utils.ml @@ -0,0 +1,145 @@ +(* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + *) + +(* table from 0-based line number and 0-based column number to the offset at that point *) +type t = int array array + +type offset_kind = + | Utf8 + | JavaScript + +(* Classify each codepoint. We care about how many bytes each codepoint takes, in order to + compute offsets in terms of bytes instead of codepoints. We also care about various kinds of + newlines. To reduce memory, it is important that this is a basic variant with no parameters + (so, don't make it `Chars of int`). *) +type kind = + (* Char has a codepoint greater than or equal to 0x0 but less than 0x80 *) + | Chars_0x0 + (* Char has a codepoint greater than or equal to 0x80 but less than 0x800 *) + | Chars_0x80 + | Chars_0x800 + | Chars_0x10000 + | Malformed + | Cr + | Nl + | Ls + +(* Gives the size in bytes of the character's UTF-8 encoding *) +let utf8_size_of_kind = function + | Chars_0x0 -> 1 + | Chars_0x80 -> 2 + | Chars_0x800 -> 3 + | Chars_0x10000 -> 4 + | Malformed -> 1 + | Cr -> 1 + | Nl -> 1 + | Ls -> 3 + +(* Gives the size in code units (16-bit blocks) of the character's UTF-16 encoding *) +let js_size_of_kind = function + | Chars_0x0 + | Chars_0x80 + | Chars_0x800 -> + 1 + | Chars_0x10000 -> 2 + | Malformed -> 1 + | Cr -> 1 + | Nl -> 1 + | Ls -> 1 + +let make = + (* Using Wtf8 allows us to properly track multi-byte characters, so that we increment the column + * by 1 for a multi-byte character, but increment the offset by the number of bytes in the + * character. It also keeps us from incrementing the line number if a multi-byte character happens + * to include e.g. the codepoint for '\n' as a second-fourth byte. *) + let fold_codepoints acc _offset chr = + let kind = + match chr with + | Wtf8.Point code -> + if code == 0x2028 || code == 0x2029 then + Ls + else if code == 0xA then + Nl + else if code == 0xD then + Cr + else if code >= 0x10000 then + Chars_0x10000 + else if code >= 0x800 then + Chars_0x800 + else if code >= 0x80 then + Chars_0x80 + else + Chars_0x0 + | Wtf8.Malformed -> Malformed + in + kind :: acc + in + (* Traverses a `kind list`, breaking it up into an `int array array`, where each `int array` + contains the offsets at each character (aka codepoint) of a line. *) + let rec build_table size_of_kind (offset, rev_line, acc) = function + | [] -> Array.of_list (List.rev acc) + | Cr :: Nl :: rest -> + (* https://www.ecma-international.org/ecma-262/5.1/#sec-7.3 says that "\r\n" should be treated + like a single line terminator, even though both '\r' and '\n' are line terminators in their + own right. *) + let line = Array.of_list (List.rev (offset :: rev_line)) in + build_table size_of_kind (offset + 2, [], line :: acc) rest + | ((Cr | Nl | Ls) as kind) :: rest -> + let line = Array.of_list (List.rev (offset :: rev_line)) in + build_table size_of_kind (offset + size_of_kind kind, [], line :: acc) rest + | ((Chars_0x0 | Chars_0x80 | Chars_0x800 | Chars_0x10000 | Malformed) as kind) :: rest -> + build_table size_of_kind (offset + size_of_kind kind, offset :: rev_line, acc) rest + in + fun ~kind text -> + let rev_kinds = Wtf8.fold_wtf_8 fold_codepoints [] text in + (* Add a phantom line at the end of the file. Since end positions are reported exclusively, it + * is possible for the lexer to output an end position with a line number one higher than the + * last line, to indicate something such as "the entire last line." For this purpose, we can + * return the offset that is one higher than the last legitimate offset, since it could only be + * correctly used as an exclusive index. *) + let rev_kinds = Nl :: rev_kinds in + let size_of_kind = + match kind with + | Utf8 -> utf8_size_of_kind + | JavaScript -> js_size_of_kind + in + build_table size_of_kind (0, [], []) (List.rev rev_kinds) + +exception Offset_lookup_failed of Loc.position * string + +let lookup arr i pos context_string = + try arr.(i) + with Invalid_argument _ -> + let msg = + Printf.sprintf + "Failure while looking up %s. Index: %d. Length: %d." + context_string + i + (Array.length arr) + in + raise (Offset_lookup_failed (pos, msg)) + +let offset table pos = + Loc.( + (* Special-case `Loc.none` so we don't try to look up line -1. *) + if pos.line = 0 && pos.column = 0 then + (* Loc.none sets the offset as 0, so that's what we'll return here. *) + 0 + else + (* lines are 1-indexed, columns are zero-indexed *) + let line_table = lookup table (pos.line - 1) pos "line" in + lookup line_table pos.column pos "column") + +let debug_string table = + let buf = Buffer.create 4096 in + Array.iteri + (fun line_num line -> + Printf.bprintf buf "%6d: " line_num; + Array.iter (fun offset -> Printf.bprintf buf "%8d " offset) line; + Buffer.add_char buf '\n') + table; + Buffer.contents buf diff --git a/lib/offset_utils.mli b/lib/offset_utils.mli new file mode 100644 index 0000000..3602eab --- /dev/null +++ b/lib/offset_utils.mli @@ -0,0 +1,52 @@ +(* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + *) + +(* Note on character encodings: + * + * Throughout Flow, we assume that program text uses a UTF-8 encoding. OCaml strings are just a + * sequence of bytes, so any handling of multi-byte characters needs to be done explicitly. + * + * Column numbers in `Loc.position`s are based on the number of characters into a line the position + * appears, not the number of bytes. Single-byte and multi-byte characters are treated the same for + * the purposes of counting columns. + * + * However, offsets are most useful (at least when working with OCaml's string representation) when + * they represent the number of bytes into the text a given position is. + * + * In contrast, JavaScript strings must behave as if they have a UTF-16 encoding, and each element + * is a single 16-bit entry. So, each character occupies either one or two elements of a JavaScript + * string. Esprima, for example, returns ranges based on index into a JS string. + * + * Clients can choose between byte offsets and UTF-16 code unit offsets when building the offset + * table. + * + * For example, with the Utf8 offset kind selected, this utility would consider the smiley emoji + * (code point 0x1f603) to have width 4 (because its UTF-8 encoding is 4 8-bit elements), but with + * the JavaScript offset kind selected, it (and Esprima) would consider it to have width 2 (because + * its UTF-16 encoding is 2 16-bit elements). + *) + +(* A structure that allows for quick computation of offsets when given a Loc.position *) +type t + +type offset_kind = + | Utf8 + | JavaScript + +(* Create a table for offsets in the given file. Takes O(n) time and returns an object that takes + * O(n) space, where `n` is the size of the given program text. *) +val make : kind:offset_kind -> string (* program text *) -> t + +exception Offset_lookup_failed of Loc.position * string + +(* Returns the offset for the given location. This is the offset in bytes (not characters!) into the + * file where the given position can be found. Constant time operation. Raises + * `Offset_lookup_failed` if the given position does not exist in the file contents which were used + * to construct the table. *) +val offset : t -> Loc.position -> int + +val debug_string : t -> string diff --git a/lib/parse_error.ml b/lib/parse_error.ml index 19679b8..72699d6 100644 --- a/lib/parse_error.ml +++ b/lib/parse_error.ml @@ -1,5 +1,5 @@ -(** - * Copyright (c) 2013-present, Facebook, Inc. +(* + * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,11 +7,40 @@ type t = | Assertion of string - | UnexpectedToken of string + | EnumBooleanMemberNotInitialized of { + enum_name: string; + member_name: string; + } + | EnumDuplicateMemberName of { + enum_name: string; + member_name: string; + } + | EnumInconsistentMemberValues of { enum_name: string } + | EnumInvalidExplicitType of { + enum_name: string; + supplied_type: string option; + } + | EnumInvalidExport + | EnumInvalidInitializerSeparator of { member_name: string } + | EnumInvalidMemberInitializer of { + enum_name: string; + explicit_type: Enum_common.explicit_type option; + member_name: string; + } + | EnumInvalidMemberName of { + enum_name: string; + member_name: string; + } + | EnumInvalidMemberSeparator + | EnumInvalidEllipsis of { trailing_comma: bool } + | EnumNumberMemberNotInitialized of { + enum_name: string; + member_name: string; + } + | EnumStringMemberInconsistentlyInitailized of { enum_name: string } + | Unexpected of string + | UnexpectedWithExpected of string * string | UnexpectedTokenWithSuggestion of string * string - | UnexpectedNumber - | UnexpectedString - | UnexpectedIdentifier | UnexpectedReserved | UnexpectedReservedType | UnexpectedSuper @@ -27,7 +56,13 @@ type t = | UnexpectedTypeImport | UnexpectedTypeExport | UnexpectedTypeInterface + | UnexpectedSpreadType + | UnexpectedExplicitInexactInObject + | InexactInsideExact + | InexactInsideNonObject | NewlineAfterThrow + | InvalidFloatBigInt + | InvalidSciBigInt | InvalidRegExp | InvalidRegExpFlags of string | UnterminatedRegExp @@ -51,6 +86,7 @@ type t = | StrictParamDupe | StrictFunctionName | StrictOctalLiteral + | StrictNonOctalLiteral | StrictDelete | StrictDuplicateProperty | AccessorDataProperty @@ -71,8 +107,11 @@ type t = | AdjacentJSXElements | ParameterAfterRestParameter | ElementAfterRestElement - | PropertyAfterRestProperty + | PropertyAfterRestElement | DeclareAsync + | DeclareClassElement + | DeclareClassFieldInitializer + | DeclareOpaqueTypeInitializer | DeclareExportLet | DeclareExportConst | DeclareExportType @@ -83,7 +122,6 @@ type t = | ExportNamelessFunction | UnsupportedDecorator | MissingTypeParamDefault - | WindowsFloatOfString | DuplicateDeclareModuleExports | AmbiguousDeclareModuleKind | GetterArity @@ -95,7 +133,11 @@ type t = | MalformedUnicode | DuplicateConstructor | DuplicatePrivateFields of string - | InvalidFieldName of string * bool * bool + | InvalidFieldName of { + name: string; + static: bool; + private_: bool; + } | PrivateMethod | PrivateDelete | UnboundPrivate of string @@ -113,179 +155,285 @@ type t = | OptionalChainNew | OptionalChainTemplate | NullishCoalescingDisabled + | NullishCoalescingUnexpectedLogical of string + | WhitespaceInPrivateName + | ThisParamAnnotationRequired + | ThisParamMustBeFirst + | ThisParamMayNotBeOptional + | GetterMayNotHaveThisParam + | SetterMayNotHaveThisParam + | ThisParamBannedInArrowFunctions + | ThisParamBannedInConstructor +[@@deriving ord] exception Error of (Loc.t * t) list -let error loc e = - raise (Error [loc, e]) +let error loc e = raise (Error [(loc, e)]) -module PP = - struct - let error = function - | Assertion str -> "Unexpected parser state: "^str - | UnexpectedToken token-> "Unexpected token "^token - | UnexpectedTokenWithSuggestion (token, suggestion) -> - Printf.sprintf "Unexpected token `%s`. Did you mean `%s`?" - token - suggestion - | UnexpectedNumber -> "Unexpected number" - | UnexpectedString -> "Unexpected string" - | UnexpectedIdentifier -> "Unexpected identifier" - | UnexpectedReserved -> "Unexpected reserved word" - | UnexpectedReservedType -> "Unexpected reserved type" - | UnexpectedSuper -> "Unexpected `super` outside of a class method" - | UnexpectedSuperCall -> "`super()` is only valid in a class constructor" - | UnexpectedEOS -> "Unexpected end of input" - | UnexpectedVariance -> "Unexpected variance sigil" - | UnexpectedStatic -> "Unexpected static modifier" - | UnexpectedProto -> "Unexpected proto modifier" - | UnexpectedTypeAlias -> "Type aliases are not allowed in untyped mode" - | UnexpectedOpaqueTypeAlias -> "Opaque type aliases are not allowed in untyped mode" - | UnexpectedTypeAnnotation -> "Type annotations are not allowed in untyped mode" - | UnexpectedTypeDeclaration -> "Type declarations are not allowed in untyped mode" - | UnexpectedTypeImport -> "Type imports are not allowed in untyped mode" - | UnexpectedTypeExport -> "Type exports are not allowed in untyped mode" - | UnexpectedTypeInterface -> "Interfaces are not allowed in untyped mode" - | NewlineAfterThrow -> "Illegal newline after throw" - | InvalidRegExp -> "Invalid regular expression" - | InvalidRegExpFlags flags -> "Invalid flags supplied to RegExp constructor '"^flags^"'" - | UnterminatedRegExp -> "Invalid regular expression: missing /" - | InvalidLHSInAssignment -> "Invalid left-hand side in assignment" - | InvalidLHSInExponentiation -> "Invalid left-hand side in exponentiation expression" - | InvalidLHSInForIn -> "Invalid left-hand side in for-in" - | InvalidLHSInForOf -> "Invalid left-hand side in for-of" - | ExpectedPatternFoundExpression -> ( - "Expected an object pattern, array pattern, or an identifier but " ^ - "found an expression instead" - ) - | MultipleDefaultsInSwitch -> "More than one default clause in switch statement" - | NoCatchOrFinally -> "Missing catch or finally after try" - | UnknownLabel label -> "Undefined label '"^label^"'" - | Redeclaration (what, name)-> what^" '"^name^"' has already been declared" - | IllegalContinue -> "Illegal continue statement" - | IllegalBreak -> "Illegal break statement" - | IllegalReturn -> "Illegal return statement" - | IllegalUnicodeEscape -> "Illegal Unicode escape" - | StrictModeWith -> "Strict mode code may not include a with statement" - | StrictCatchVariable -> "Catch variable may not be eval or arguments in strict mode" - | StrictVarName -> "Variable name may not be eval or arguments in strict mode" - | StrictParamName -> "Parameter name eval or arguments is not allowed in strict mode" - | StrictParamDupe -> "Strict mode function may not have duplicate parameter names" - | StrictFunctionName -> "Function name may not be eval or arguments in strict mode" - | StrictOctalLiteral -> "Octal literals are not allowed in strict mode." - | StrictDelete -> "Delete of an unqualified identifier in strict mode." - | StrictDuplicateProperty -> "Duplicate data property in object literal not allowed in strict mode" - | AccessorDataProperty -> "Object literal may not have data and accessor property with the same name" - | AccessorGetSet -> "Object literal may not have multiple get/set accessors with the same name" - | StrictLHSAssignment -> "Assignment to eval or arguments is not allowed in strict mode" - | StrictLHSPostfix -> "Postfix increment/decrement may not have eval or arguments operand in strict mode" - | StrictLHSPrefix -> "Prefix increment/decrement may not have eval or arguments operand in strict mode" - | StrictReservedWord -> "Use of future reserved word in strict mode" - | JSXAttributeValueEmptyExpression -> "JSX attributes must only be assigned a non-empty expression" - | InvalidJSXAttributeValue -> "JSX value should be either an expression or a quoted JSX text" - | ExpectedJSXClosingTag name -> "Expected corresponding JSX closing tag for "^name - | NoUninitializedConst -> "Const must be initialized" - | NoUninitializedDestructuring -> "Destructuring assignment must be initialized" - | NewlineBeforeArrow -> "Illegal newline before arrow" - | FunctionAsStatement { in_strict_mode } -> - if in_strict_mode then - "In strict mode code, functions can only be declared at top level or "^ - "immediately within another function." - else - "In non-strict mode code, functions can only be declared at top level, "^ - "inside a block, or as the body of an if statement." - | AsyncFunctionAsStatement -> "Async functions can only be declared at top level or "^ - "immediately within another function." - | GeneratorFunctionAsStatement -> "Generators can only be declared at top level or "^ - "immediately within another function." - | AdjacentJSXElements -> "Unexpected token <. Remember, adjacent JSX "^ - "elements must be wrapped in an enclosing parent tag" - | ParameterAfterRestParameter -> - "Rest parameter must be final parameter of an argument list" - | ElementAfterRestElement -> - "Rest element must be final element of an array pattern" - | PropertyAfterRestProperty -> - "Rest property must be final property of an object pattern" - | DeclareAsync -> "async is an implementation detail and isn't necessary for your declare function statement. It is sufficient for your declare function to just have a Promise return type." - | DeclareExportLet -> "`declare export let` is not supported. Use \ - `declare export var` instead." - | DeclareExportConst -> "`declare export const` is not supported. Use \ - `declare export var` instead." - | DeclareExportType -> "`declare export type` is not supported. Use \ - `export type` instead." - | DeclareExportInterface -> "`declare export interface` is not supported. Use \ - `export interface` instead." - | UnexpectedExportStarAs -> "`export * as` is an early-stage proposal \ - and is not enabled by default. To enable support in the parser, use \ - the `esproposal_export_star_as` option" - | DuplicateExport export -> (Printf.sprintf "Duplicate export for `%s`" export) - | ExportNamelessClass -> "When exporting a class as a named export, \ - you must specify a class name. Did you mean \ - `export default class ...`?" - | ExportNamelessFunction -> "When exporting a function as a named export, \ - you must specify a function name. Did you mean \ - `export default function ...`?" - | UnsupportedDecorator -> "Found a decorator in an unsupported position." - | MissingTypeParamDefault -> "Type parameter declaration needs a default, \ - since a preceding type parameter declaration has a default." - | WindowsFloatOfString -> "The Windows version of OCaml has a bug in how \ - it parses hexadecimal numbers. It is fixed in OCaml 4.03.0. Until we \ - can switch to 4.03.0, please avoid either hexadecimal notation or \ - Windows." - | DuplicateDeclareModuleExports -> "Duplicate `declare module.exports` \ - statement!" - | AmbiguousDeclareModuleKind -> "Found both `declare module.exports` and \ - `declare export` in the same module. Modules can only have 1 since \ - they are either an ES module xor they are a CommonJS module." - | GetterArity -> "Getter should have zero parameters" - | SetterArity -> "Setter should have exactly one parameter" - | InvalidNonTypeImportInDeclareModule -> - "Imports within a `declare module` body must always be " ^ - "`import type` or `import typeof`!" - | ImportTypeShorthandOnlyInPureImport -> - "The `type` and `typeof` keywords on named imports can only be used on \ - regular `import` statements. It cannot be used with `import type` or \ - `import typeof` statements" - | ImportSpecifierMissingComma -> - "Missing comma between import specifiers" - | ExportSpecifierMissingComma -> - "Missing comma between export specifiers" - | MalformedUnicode -> - "Malformed unicode" - | DuplicateConstructor -> - "Classes may only have one constructor" - | DuplicatePrivateFields name -> - "Private fields may only be declared once. `#" ^ name ^ "` is declared more than once." - | InvalidFieldName (name, static, private_) -> - let static_modifier = if static then "static " else "" in - let name = if private_ then "#" ^ name else name in - "Classes may not have " ^ static_modifier ^ "fields named `" ^ name ^ "`." - | PrivateMethod -> - "Classes may not have private methods." - | PrivateDelete -> - "Private fields may not be deleted." - | UnboundPrivate name -> - "Private fields must be declared before they can be referenced. `#" ^ name - ^ "` has not been declared." - | PrivateNotInClass -> "Private fields can only be referenced from within a class." - | SuperPrivate -> "You may not access a private field through the `super` keyword." - | YieldInFormalParameters -> "Yield expression not allowed in formal parameter" - | AwaitAsIdentifierReference -> "`await` is an invalid identifier in async functions" - | YieldAsIdentifierReference -> "`yield` is an invalid identifier in generators" - | AmbiguousLetBracket -> "`let [` is ambiguous in this position because it is "^ - "either a `let` binding pattern, or a member expression." - | LiteralShorthandProperty -> "Literals cannot be used as shorthand properties." - | ComputedShorthandProperty -> "Computed properties must have a value." - | MethodInDestructuring -> "Object pattern can't contain methods" - | TrailingCommaAfterRestElement -> "A trailing comma is not permitted after the rest element" - | OptionalChainingDisabled -> "The optional chaining plugin must be enabled in order to \ - use the optional chaining operator (`?.`). Optional chaining is an active early-stage \ - feature proposal which may change and is not enabled by default. To enable support in \ - the parser, use the `esproposal_optional_chaining` option." - | OptionalChainNew -> "An optional chain may not be used in a `new` expression." - | OptionalChainTemplate -> "Template literals may not be used in an optional chain." - | NullishCoalescingDisabled -> "The nullish coalescing plugin must be enabled in order to \ - use the nullish coalescing operator (`??`). Nullish coalescing is an active early-stage \ - feature proposal which may change and is not enabled by default. To enable support in \ - the parser, use the `esproposal_nullish_coalescing` option." - end +module PP = struct + let error = function + | Assertion str -> "Unexpected parser state: " ^ str + | EnumBooleanMemberNotInitialized { enum_name; member_name } -> + Printf.sprintf + "Boolean enum members need to be initialized. Use either `%s = true,` or `%s = false,` in enum `%s`." + member_name + member_name + enum_name + | EnumDuplicateMemberName { enum_name; member_name } -> + Printf.sprintf + "Enum member names need to be unique, but the name `%s` has already been used before in enum `%s`." + member_name + enum_name + | EnumInconsistentMemberValues { enum_name } -> + Printf.sprintf + "Enum `%s` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers." + enum_name + | EnumInvalidExplicitType { enum_name; supplied_type } -> + let suggestion = + Printf.sprintf + "Use one of `boolean`, `number`, `string`, or `symbol` in enum `%s`." + enum_name + in + begin + match supplied_type with + | Some supplied_type -> + Printf.sprintf "Enum type `%s` is not valid. %s" supplied_type suggestion + | None -> Printf.sprintf "Supplied enum type is not valid. %s" suggestion + end + | EnumInvalidExport -> + "Cannot export an enum with `export type`, try `export enum E {}` or `module.exports = E;` instead." + | EnumInvalidInitializerSeparator { member_name } -> + Printf.sprintf + "Enum member names and initializers are separated with `=`. Replace `%s:` with `%s =`." + member_name + member_name + | EnumInvalidMemberInitializer { enum_name; explicit_type; member_name } -> + begin + match explicit_type with + | Some (Enum_common.Boolean as explicit_type) + | Some (Enum_common.Number as explicit_type) + | Some (Enum_common.String as explicit_type) -> + let explicit_type_str = Enum_common.string_of_explicit_type explicit_type in + Printf.sprintf + "Enum `%s` has type `%s`, so the initializer of `%s` needs to be a %s literal." + enum_name + explicit_type_str + member_name + explicit_type_str + | Some Enum_common.Symbol -> + Printf.sprintf + "Symbol enum members cannot be initialized. Use `%s,` in enum `%s`." + member_name + enum_name + | None -> + Printf.sprintf + "The enum member initializer for `%s` needs to be a literal (either a boolean, number, or string) in enum `%s`." + member_name + enum_name + end + | EnumInvalidMemberName { enum_name; member_name } -> + (* Based on the error condition, we will only receive member names starting with [a-z] *) + let suggestion = String.capitalize_ascii member_name in + Printf.sprintf + "Enum member names cannot start with lowercase 'a' through 'z'. Instead of using `%s`, consider using `%s`, in enum `%s`." + member_name + suggestion + enum_name + | EnumInvalidMemberSeparator -> "Enum members are separated with `,`. Replace `;` with `,`." + | EnumInvalidEllipsis { trailing_comma } -> + if trailing_comma then + "The `...` must come at the end of the enum body. Remove the trailing comma." + else + "The `...` must come after all enum members. Move it to the end of the enum body." + | EnumNumberMemberNotInitialized { enum_name; member_name } -> + Printf.sprintf + "Number enum members need to be initialized, e.g. `%s = 1,` in enum `%s`." + member_name + enum_name + | EnumStringMemberInconsistentlyInitailized { enum_name } -> + Printf.sprintf + "String enum members need to consistently either all use initializers, or use no initializers, in enum %s." + enum_name + | Unexpected unexpected -> Printf.sprintf "Unexpected %s" unexpected + | UnexpectedWithExpected (unexpected, expected) -> + Printf.sprintf "Unexpected %s, expected %s" unexpected expected + | UnexpectedTokenWithSuggestion (token, suggestion) -> + Printf.sprintf "Unexpected token `%s`. Did you mean `%s`?" token suggestion + | UnexpectedReserved -> "Unexpected reserved word" + | UnexpectedReservedType -> "Unexpected reserved type" + | UnexpectedSuper -> "Unexpected `super` outside of a class method" + | UnexpectedSuperCall -> "`super()` is only valid in a class constructor" + | UnexpectedEOS -> "Unexpected end of input" + | UnexpectedVariance -> "Unexpected variance sigil" + | UnexpectedStatic -> "Unexpected static modifier" + | UnexpectedProto -> "Unexpected proto modifier" + | UnexpectedTypeAlias -> "Type aliases are not allowed in untyped mode" + | UnexpectedOpaqueTypeAlias -> "Opaque type aliases are not allowed in untyped mode" + | UnexpectedTypeAnnotation -> "Type annotations are not allowed in untyped mode" + | UnexpectedTypeDeclaration -> "Type declarations are not allowed in untyped mode" + | UnexpectedTypeImport -> "Type imports are not allowed in untyped mode" + | UnexpectedTypeExport -> "Type exports are not allowed in untyped mode" + | UnexpectedTypeInterface -> "Interfaces are not allowed in untyped mode" + | UnexpectedSpreadType -> "Spreading a type is only allowed inside an object type" + | UnexpectedExplicitInexactInObject -> + "Explicit inexact syntax must come at the end of an object type" + | InexactInsideExact -> + "Explicit inexact syntax cannot appear inside an explicit exact object type" + | InexactInsideNonObject -> "Explicit inexact syntax can only appear inside an object type" + | NewlineAfterThrow -> "Illegal newline after throw" + | InvalidFloatBigInt -> "A bigint literal must be an integer" + | InvalidSciBigInt -> "A bigint literal cannot use exponential notation" + | InvalidRegExp -> "Invalid regular expression" + | InvalidRegExpFlags flags -> "Invalid flags supplied to RegExp constructor '" ^ flags ^ "'" + | UnterminatedRegExp -> "Invalid regular expression: missing /" + | InvalidLHSInAssignment -> "Invalid left-hand side in assignment" + | InvalidLHSInExponentiation -> "Invalid left-hand side in exponentiation expression" + | InvalidLHSInForIn -> "Invalid left-hand side in for-in" + | InvalidLHSInForOf -> "Invalid left-hand side in for-of" + | ExpectedPatternFoundExpression -> + "Expected an object pattern, array pattern, or an identifier but " + ^ "found an expression instead" + | MultipleDefaultsInSwitch -> "More than one default clause in switch statement" + | NoCatchOrFinally -> "Missing catch or finally after try" + | UnknownLabel label -> "Undefined label '" ^ label ^ "'" + | Redeclaration (what, name) -> what ^ " '" ^ name ^ "' has already been declared" + | IllegalContinue -> "Illegal continue statement" + | IllegalBreak -> "Illegal break statement" + | IllegalReturn -> "Illegal return statement" + | IllegalUnicodeEscape -> "Illegal Unicode escape" + | StrictModeWith -> "Strict mode code may not include a with statement" + | StrictCatchVariable -> "Catch variable may not be eval or arguments in strict mode" + | StrictVarName -> "Variable name may not be eval or arguments in strict mode" + | StrictParamName -> "Parameter name eval or arguments is not allowed in strict mode" + | StrictParamDupe -> "Strict mode function may not have duplicate parameter names" + | StrictFunctionName -> "Function name may not be eval or arguments in strict mode" + | StrictOctalLiteral -> "Octal literals are not allowed in strict mode." + | StrictNonOctalLiteral -> "Number literals with leading zeros are not allowed in strict mode." + | StrictDelete -> "Delete of an unqualified identifier in strict mode." + | StrictDuplicateProperty -> + "Duplicate data property in object literal not allowed in strict mode" + | AccessorDataProperty -> + "Object literal may not have data and accessor property with the same name" + | AccessorGetSet -> "Object literal may not have multiple get/set accessors with the same name" + | StrictLHSAssignment -> "Assignment to eval or arguments is not allowed in strict mode" + | StrictLHSPostfix -> + "Postfix increment/decrement may not have eval or arguments operand in strict mode" + | StrictLHSPrefix -> + "Prefix increment/decrement may not have eval or arguments operand in strict mode" + | StrictReservedWord -> "Use of future reserved word in strict mode" + | JSXAttributeValueEmptyExpression -> + "JSX attributes must only be assigned a non-empty expression" + | InvalidJSXAttributeValue -> "JSX value should be either an expression or a quoted JSX text" + | ExpectedJSXClosingTag name -> "Expected corresponding JSX closing tag for " ^ name + | NoUninitializedConst -> "Const must be initialized" + | NoUninitializedDestructuring -> "Destructuring assignment must be initialized" + | NewlineBeforeArrow -> "Illegal newline before arrow" + | FunctionAsStatement { in_strict_mode } -> + if in_strict_mode then + "In strict mode code, functions can only be declared at top level or " + ^ "immediately within another function." + else + "In non-strict mode code, functions can only be declared at top level, " + ^ "inside a block, or as the body of an if statement." + | AsyncFunctionAsStatement -> + "Async functions can only be declared at top level or " + ^ "immediately within another function." + | GeneratorFunctionAsStatement -> + "Generators can only be declared at top level or " ^ "immediately within another function." + | AdjacentJSXElements -> + "Unexpected token <. Remember, adjacent JSX " + ^ "elements must be wrapped in an enclosing parent tag" + | ParameterAfterRestParameter -> "Rest parameter must be final parameter of an argument list" + | ElementAfterRestElement -> "Rest element must be final element of an array pattern" + | PropertyAfterRestElement -> "Rest property must be final property of an object pattern" + | DeclareAsync -> + "async is an implementation detail and isn't necessary for your declare function statement. It is sufficient for your declare function to just have a Promise return type." + | DeclareClassElement -> "`declare` modifier can only appear on class fields." + | DeclareClassFieldInitializer -> + "Unexpected token `=`. Initializers are not allowed in a `declare`." + | DeclareOpaqueTypeInitializer -> + "Unexpected token `=`. Initializers are not allowed in a `declare opaque type`." + | DeclareExportLet -> "`declare export let` is not supported. Use `declare export var` instead." + | DeclareExportConst -> + "`declare export const` is not supported. Use `declare export var` instead." + | DeclareExportType -> "`declare export type` is not supported. Use `export type` instead." + | DeclareExportInterface -> + "`declare export interface` is not supported. Use `export interface` instead." + | UnexpectedExportStarAs -> + "`export * as` is an early-stage proposal and is not enabled by default. To enable support in the parser, use the `esproposal_export_star_as` option" + | DuplicateExport export -> Printf.sprintf "Duplicate export for `%s`" export + | ExportNamelessClass -> + "When exporting a class as a named export, you must specify a class name. Did you mean `export default class ...`?" + | ExportNamelessFunction -> + "When exporting a function as a named export, you must specify a function name. Did you mean `export default function ...`?" + | UnsupportedDecorator -> "Found a decorator in an unsupported position." + | MissingTypeParamDefault -> + "Type parameter declaration needs a default, since a preceding type parameter declaration has a default." + | DuplicateDeclareModuleExports -> "Duplicate `declare module.exports` statement!" + | AmbiguousDeclareModuleKind -> + "Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module xor they are a CommonJS module." + | GetterArity -> "Getter should have zero parameters" + | SetterArity -> "Setter should have exactly one parameter" + | InvalidNonTypeImportInDeclareModule -> + "Imports within a `declare module` body must always be " ^ "`import type` or `import typeof`!" + | ImportTypeShorthandOnlyInPureImport -> + "The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements" + | ImportSpecifierMissingComma -> "Missing comma between import specifiers" + | ExportSpecifierMissingComma -> "Missing comma between export specifiers" + | MalformedUnicode -> "Malformed unicode" + | DuplicateConstructor -> "Classes may only have one constructor" + | DuplicatePrivateFields name -> + "Private fields may only be declared once. `#" ^ name ^ "` is declared more than once." + | InvalidFieldName { name; static; private_ } -> + let static_modifier = + if static then + "static " + else + "" + in + let name = + if private_ then + "#" ^ name + else + name + in + "Classes may not have " ^ static_modifier ^ "fields named `" ^ name ^ "`." + | PrivateMethod -> "Classes may not have private methods." + | PrivateDelete -> "Private fields may not be deleted." + | UnboundPrivate name -> + "Private fields must be declared before they can be referenced. `#" + ^ name + ^ "` has not been declared." + | PrivateNotInClass -> "Private fields can only be referenced from within a class." + | SuperPrivate -> "You may not access a private field through the `super` keyword." + | YieldInFormalParameters -> "Yield expression not allowed in formal parameter" + | AwaitAsIdentifierReference -> "`await` is an invalid identifier in async functions" + | YieldAsIdentifierReference -> "`yield` is an invalid identifier in generators" + | AmbiguousLetBracket -> + "`let [` is ambiguous in this position because it is " + ^ "either a `let` binding pattern, or a member expression." + | LiteralShorthandProperty -> "Literals cannot be used as shorthand properties." + | ComputedShorthandProperty -> "Computed properties must have a value." + | MethodInDestructuring -> "Object pattern can't contain methods" + | TrailingCommaAfterRestElement -> "A trailing comma is not permitted after the rest element" + | OptionalChainingDisabled -> + "The optional chaining plugin must be enabled in order to use the optional chaining operator (`?.`). Optional chaining is an active early-stage feature proposal which may change and is not enabled by default. To enable support in the parser, use the `esproposal_optional_chaining` option." + | OptionalChainNew -> "An optional chain may not be used in a `new` expression." + | OptionalChainTemplate -> "Template literals may not be used in an optional chain." + | NullishCoalescingDisabled -> + "The nullish coalescing plugin must be enabled in order to use the nullish coalescing operator (`??`). Nullish coalescing is an active early-stage feature proposal which may change and is not enabled by default. To enable support in the parser, use the `esproposal_nullish_coalescing` option." + | NullishCoalescingUnexpectedLogical operator -> + Printf.sprintf + "Unexpected token `%s`. Parentheses are required to combine `??` with `&&` or `||` expressions." + operator + | WhitespaceInPrivateName -> "Unexpected whitespace between `#` and identifier" + | ThisParamAnnotationRequired -> "A type annotation is required for the `this` parameter." + | ThisParamMustBeFirst -> "The `this` parameter must be the first function parameter." + | ThisParamMayNotBeOptional -> "The `this` parameter cannot be optional." + | GetterMayNotHaveThisParam -> "A getter cannot have a `this` parameter." + | SetterMayNotHaveThisParam -> "A setter cannot have a `this` parameter." + | ThisParamBannedInArrowFunctions -> + "Arrow functions cannot have a `this` parameter; arrow functions automatically bind `this` when declared." + | ThisParamBannedInConstructor -> + "Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions." +end diff --git a/lib/parser_common.ml b/lib/parser_common.ml index e82f475..c0bd3d8 100644 --- a/lib/parser_common.ml +++ b/lib/parser_common.ml @@ -1,13 +1,12 @@ -(** - * Copyright (c) 2013-present, Facebook, Inc. +(* + * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. *) open Parser_env -open Ast -module Error = Parse_error +open Flow_ast type pattern_errors = { if_expr: (Loc.t * Parse_error.t) list; @@ -15,115 +14,150 @@ type pattern_errors = { } type pattern_cover = - | Cover_expr of Loc.t Expression.t - | Cover_patt of Loc.t Expression.t * pattern_errors + | Cover_expr of (Loc.t, Loc.t) Expression.t + | Cover_patt of (Loc.t, Loc.t) Expression.t * pattern_errors module type PARSER = sig - val program : env -> Loc.t program - val statement : env -> Loc.t Statement.t - val statement_list_item : ?decorators:Loc.t Class.Decorator.t list -> env -> Loc.t Statement.t - val statement_list : term_fn:(Token.t -> bool) -> env -> Loc.t Statement.t list - val statement_list_with_directives : term_fn:(Token.t -> bool) -> env -> Loc.t Statement.t list * bool - val module_body : term_fn:(Token.t -> bool) -> env -> Loc.t Statement.t list - val expression : env -> Loc.t Expression.t + val program : env -> (Loc.t, Loc.t) Program.t + + val statement : env -> (Loc.t, Loc.t) Statement.t + + val statement_list_item : + ?decorators:(Loc.t, Loc.t) Class.Decorator.t list -> env -> (Loc.t, Loc.t) Statement.t + + val statement_list : term_fn:(Token.t -> bool) -> env -> (Loc.t, Loc.t) Statement.t list + + val statement_list_with_directives : + term_fn:(Token.t -> bool) -> env -> (Loc.t, Loc.t) Statement.t list * bool + + val module_body : term_fn:(Token.t -> bool) -> env -> (Loc.t, Loc.t) Statement.t list + + val expression : env -> (Loc.t, Loc.t) Expression.t + val expression_or_pattern : env -> pattern_cover - val conditional : env -> Loc.t Expression.t - val assignment : env -> Loc.t Expression.t - val left_hand_side : env -> Loc.t Expression.t - val object_initializer : env -> Loc.t * Loc.t Expression.Object.t * pattern_errors - val identifier : ?restricted_error:Error.t -> env -> Loc.t Identifier.t - val identifier_with_type : env -> ?no_optional:bool -> Error.t -> Loc.t * Loc.t Pattern.Identifier.t - val assert_identifier_name_is_identifier : - ?restricted_error:Error.t -> env -> Loc.t * string -> unit - val block_body : env -> Loc.t * Loc.t Statement.Block.t - val function_block_body : env -> Loc.t * Loc.t Statement.Block.t * bool + + val conditional : env -> (Loc.t, Loc.t) Expression.t + + val assignment : env -> (Loc.t, Loc.t) Expression.t + + val left_hand_side : env -> (Loc.t, Loc.t) Expression.t + + val object_initializer : env -> Loc.t * (Loc.t, Loc.t) Expression.Object.t * pattern_errors + + val identifier : ?restricted_error:Parse_error.t -> env -> (Loc.t, Loc.t) Identifier.t + + val identifier_with_type : + env -> ?no_optional:bool -> Parse_error.t -> Loc.t * (Loc.t, Loc.t) Pattern.Identifier.t + + val block_body : env -> Loc.t * (Loc.t, Loc.t) Statement.Block.t + + val function_block_body : + expression:bool -> env -> Loc.t * (Loc.t, Loc.t) Statement.Block.t * bool + val jsx_element_or_fragment : - env -> Loc.t * [`Element of Loc.t JSX.element | `Fragment of Loc.t JSX.fragment] - val pattern : env -> Error.t -> Loc.t Pattern.t - val pattern_from_expr : env -> Loc.t Expression.t -> Loc.t Pattern.t - val object_key : ?class_body: bool -> env -> Loc.t * Loc.t Expression.Object.Property.key - val class_declaration : env -> Loc.t Class.Decorator.t list -> Loc.t Statement.t - val class_expression : env -> Loc.t Expression.t - val is_assignable_lhs : Loc.t Expression.t -> bool + env -> + Loc.t * [ `Element of (Loc.t, Loc.t) JSX.element | `Fragment of (Loc.t, Loc.t) JSX.fragment ] + + val pattern : env -> Parse_error.t -> (Loc.t, Loc.t) Pattern.t + + val pattern_from_expr : env -> (Loc.t, Loc.t) Expression.t -> (Loc.t, Loc.t) Pattern.t + + val object_key : ?class_body:bool -> env -> Loc.t * (Loc.t, Loc.t) Expression.Object.Property.key + + val class_declaration : env -> (Loc.t, Loc.t) Class.Decorator.t list -> (Loc.t, Loc.t) Statement.t + + val class_expression : env -> (Loc.t, Loc.t) Expression.t + + val is_assignable_lhs : (Loc.t, Loc.t) Expression.t -> bool + + val number : env -> Token.number_type -> string -> float end (* IdentifierName - https://tc39.github.io/ecma262/#prod-IdentifierName *) let identifier_name env = - let open Token in - let loc = Peek.loc env in - let name = match Peek.token env with - (* obviously, Identifier is a valid IdentifierName *) - | T_IDENTIFIER { value; _ } -> value - (* keywords are also IdentifierNames *) - | T_AWAIT -> "await" - | T_BREAK -> "break" - | T_CASE -> "case" - | T_CATCH -> "catch" - | T_CLASS -> "class" - | T_CONST -> "const" - | T_CONTINUE -> "continue" - | T_DEBUGGER -> "debugger" - | T_DEFAULT -> "default" - | T_DELETE -> "delete" - | T_DO -> "do" - | T_ELSE -> "else" - | T_EXPORT -> "export" - | T_EXTENDS -> "extends" - | T_FINALLY -> "finally" - | T_FOR -> "for" - | T_FUNCTION -> "function" - | T_IF -> "if" - | T_IMPORT -> "import" - | T_IN -> "in" - | T_INSTANCEOF -> "instanceof" - | T_NEW -> "new" - | T_RETURN -> "return" - | T_SUPER -> "super" - | T_SWITCH -> "switch" - | T_THIS -> "this" - | T_THROW -> "throw" - | T_TRY -> "try" - | T_TYPEOF -> "typeof" - | T_VAR -> "var" - | T_VOID -> "void" - | T_WHILE -> "while" - | T_WITH -> "with" - | T_YIELD -> "yield" - (* FutureReservedWord *) - | T_ENUM -> "enum" - | T_LET -> "let" - | T_STATIC -> "static" - | T_INTERFACE -> "interface" - | T_IMPLEMENTS -> "implements" - | T_PACKAGE -> "package" - | T_PRIVATE -> "private" - | T_PROTECTED -> "protected" - | T_PUBLIC -> "public" - (* NullLiteral *) - | T_NULL -> "null" - (* BooleanLiteral *) - | T_TRUE -> "true" - | T_FALSE -> "false" - (* Flow-specific stuff *) - | T_DECLARE -> "declare" - | T_TYPE -> "type" - | T_OPAQUE -> "opaque" - | T_ANY_TYPE -> "any" - | T_MIXED_TYPE -> "mixed" - | T_EMPTY_TYPE -> "empty" - | T_BOOLEAN_TYPE BOOL -> "bool" - | T_BOOLEAN_TYPE BOOLEAN -> "boolean" - | T_NUMBER_TYPE -> "number" - | T_STRING_TYPE -> "string" - | T_VOID_TYPE -> "void" - (* Contextual stuff *) - | T_OF -> "of" - | T_ASYNC -> "async" - (* punctuators, types, literals, etc are not identifiers *) - | _ -> error_unexpected env; "" - in - Eat.token env; - loc, name + Token.( + let loc = Peek.loc env in + let leading = Peek.comments env in + let name = + match Peek.token env with + (* obviously, Identifier is a valid IdentifierName *) + | T_IDENTIFIER { value; _ } -> value + (* keywords are also IdentifierNames *) + | T_AWAIT -> "await" + | T_BREAK -> "break" + | T_CASE -> "case" + | T_CATCH -> "catch" + | T_CLASS -> "class" + | T_CONST -> "const" + | T_CONTINUE -> "continue" + | T_DEBUGGER -> "debugger" + | T_DEFAULT -> "default" + | T_DELETE -> "delete" + | T_DO -> "do" + | T_ELSE -> "else" + | T_EXPORT -> "export" + | T_EXTENDS -> "extends" + | T_FINALLY -> "finally" + | T_FOR -> "for" + | T_FUNCTION -> "function" + | T_IF -> "if" + | T_IMPORT -> "import" + | T_IN -> "in" + | T_INSTANCEOF -> "instanceof" + | T_NEW -> "new" + | T_RETURN -> "return" + | T_SUPER -> "super" + | T_SWITCH -> "switch" + | T_THIS -> "this" + | T_THROW -> "throw" + | T_TRY -> "try" + | T_TYPEOF -> "typeof" + | T_VAR -> "var" + | T_VOID -> "void" + | T_WHILE -> "while" + | T_WITH -> "with" + | T_YIELD -> "yield" + (* FutureReservedWord *) + | T_ENUM -> "enum" + | T_LET -> "let" + | T_STATIC -> "static" + | T_INTERFACE -> "interface" + | T_IMPLEMENTS -> "implements" + | T_PACKAGE -> "package" + | T_PRIVATE -> "private" + | T_PROTECTED -> "protected" + | T_PUBLIC -> "public" + (* NullLiteral *) + | T_NULL -> "null" + (* BooleanLiteral *) + | T_TRUE -> "true" + | T_FALSE -> "false" + (* Flow-specific stuff *) + | T_DECLARE -> "declare" + | T_TYPE -> "type" + | T_OPAQUE -> "opaque" + | T_ANY_TYPE -> "any" + | T_MIXED_TYPE -> "mixed" + | T_EMPTY_TYPE -> "empty" + | T_BOOLEAN_TYPE BOOL -> "bool" + | T_BOOLEAN_TYPE BOOLEAN -> "boolean" + | T_NUMBER_TYPE -> "number" + | T_BIGINT_TYPE -> "bigint" + | T_STRING_TYPE -> "string" + | T_VOID_TYPE -> "void" + | T_SYMBOL_TYPE -> "symbol" + (* Contextual stuff *) + | T_OF -> "of" + | T_ASYNC -> "async" + (* punctuators, types, literals, etc are not identifiers *) + | _ -> + error_unexpected ~expected:"an identifier" env; + "" + in + Eat.token env; + let trailing = Eat.trailing_comments env in + let comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () in + (loc, { Identifier.name; comments })) (** * The abstract operation IsLabelledFunction @@ -131,22 +165,29 @@ let identifier_name env = * https://tc39.github.io/ecma262/#sec-islabelledfunction *) let rec is_labelled_function = function - | _, Ast.Statement.Labeled { Ast.Statement.Labeled.body; _ } -> - begin match body with - | _, Ast.Statement.FunctionDeclaration _ -> true - | _ -> is_labelled_function body + | (_, Flow_ast.Statement.Labeled { Flow_ast.Statement.Labeled.body; _ }) -> + begin + match body with + | (_, Flow_ast.Statement.FunctionDeclaration _) -> true + | _ -> is_labelled_function body end - | _ -> - false + | _ -> false let with_loc ?start_loc fn env = - let start_loc = match start_loc with - | Some x -> x - | None -> Peek.loc env + let start_loc = + match start_loc with + | Some x -> x + | None -> Peek.loc env in let result = fn env in - let loc = match last_loc env with - | Some end_loc -> Loc.btwn start_loc end_loc - | None -> start_loc + let loc = + match last_loc env with + | Some end_loc -> Loc.btwn start_loc end_loc + | None -> start_loc in - loc, result + (loc, result) + +let with_loc_opt ?start_loc fn env = + match with_loc ?start_loc fn env with + | (loc, Some x) -> Some (loc, x) + | (_, None) -> None diff --git a/lib/parser_env.ml b/lib/parser_env.ml index fd424c0..2650953 100644 --- a/lib/parser_env.ml +++ b/lib/parser_env.ml @@ -1,14 +1,12 @@ -(** - * Copyright (c) 2013-present, Facebook, Inc. +(* + * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. *) -open Ast -open Flow_parser_sedlex -module Error = Parse_error -module SSet = Set.Make(String) +open Flow_ast +module SSet = Set.Make (String) module Lex_mode = struct type t = @@ -19,7 +17,7 @@ module Lex_mode = struct | TEMPLATE | REGEXP - let debug_string_of_lex_mode (mode: t) = + let debug_string_of_lex_mode (mode : t) = match mode with | NORMAL -> "NORMAL" | TYPE -> "TYPE" @@ -44,59 +42,59 @@ let maximum_lookahead = 2 module Lookahead : sig type t + val create : Lex_env.t -> Lex_mode.t -> t + val peek : t -> int -> Lex_result.t + val lex_env : t -> int -> Lex_env.t + val junk : t -> unit end = struct type t = { - mutable la_results : (Lex_env.t * Lex_result.t) option array; - mutable la_num_lexed : int; - la_lex_mode : Lex_mode.t; - mutable la_lex_env : Lex_env.t; + mutable la_results: (Lex_env.t * Lex_result.t) option array; + mutable la_num_lexed: int; + la_lex_mode: Lex_mode.t; + mutable la_lex_env: Lex_env.t; } let create lex_env mode = let lex_env = Lex_env.clone lex_env in - { - la_results = [||]; - la_num_lexed = 0; - la_lex_mode = mode; - la_lex_env = lex_env; - } + { la_results = [||]; la_num_lexed = 0; la_lex_mode = mode; la_lex_env = lex_env } let next_power_of_two n = let rec f i = if i >= n then i else - f (i * 2) in + f (i * 2) + in f 1 (* resize the tokens array to have at least n elements *) let grow t n = - if Array.length t.la_results < n then begin + if Array.length t.la_results < n then let new_size = next_power_of_two n in let filler i = if i < Array.length t.la_results then t.la_results.(i) else - None in + None + in let new_arr = Array.init new_size filler in t.la_results <- new_arr - end (* precondition: there is enough room in t.la_results for the result *) let lex t = let lex_env = t.la_lex_env in - let lex_env, lex_result = + let (lex_env, lex_result) = match t.la_lex_mode with - | Lex_mode.NORMAL -> Lexer.token lex_env - | Lex_mode.TYPE -> Lexer.type_token lex_env - | Lex_mode.JSX_TAG -> Lexer.jsx_tag lex_env - | Lex_mode.JSX_CHILD -> Lexer.jsx_child lex_env - | Lex_mode.TEMPLATE -> Lexer.template_tail lex_env - | Lex_mode.REGEXP -> Lexer.regexp lex_env + | Lex_mode.NORMAL -> Flow_lexer.token lex_env + | Lex_mode.TYPE -> Flow_lexer.type_token lex_env + | Lex_mode.JSX_TAG -> Flow_lexer.jsx_tag lex_env + | Lex_mode.JSX_CHILD -> Flow_lexer.jsx_child lex_env + | Lex_mode.TEMPLATE -> Flow_lexer.template_tail lex_env + | Lex_mode.REGEXP -> Flow_lexer.regexp lex_env in let cloned_env = Lex_env.clone lex_env in t.la_lex_env <- lex_env; @@ -112,24 +110,23 @@ end = struct let peek t i = lex_until t i; match t.la_results.(i) with - | Some (_, result) -> result - (* only happens if there is a defect in the lookahead module *) - | None -> failwith "Lookahead.peek failed" + | Some (_, result) -> result + (* only happens if there is a defect in the lookahead module *) + | None -> failwith "Lookahead.peek failed" let lex_env t i = lex_until t i; match t.la_results.(i) with - | Some (lex_env, _) -> lex_env - (* only happens if there is a defect in the lookahead module *) - | None -> failwith "Lookahead.peek failed" + | Some (lex_env, _) -> lex_env + (* only happens if there is a defect in the lookahead module *) + | None -> failwith "Lookahead.peek failed" (* Throws away the first peeked-at token, shifting any subsequent tokens up *) let junk t = lex_until t 0; - if t.la_num_lexed > 1 then - Array.blit t.la_results 1 t.la_results 0 (t.la_num_lexed - 1); + if t.la_num_lexed > 1 then Array.blit t.la_results 1 t.la_results 0 (t.la_num_lexed - 1); t.la_results.(t.la_num_lexed - 1) <- None; - t.la_num_lexed <- t.la_num_lexed - 1; + t.la_num_lexed <- t.la_num_lexed - 1 end type token_sink_result = { @@ -139,6 +136,7 @@ type token_sink_result = { } type parse_options = { + enums: bool; esproposal_class_instance_fields: bool; esproposal_class_static_fields: bool; esproposal_decorators: bool; @@ -148,16 +146,19 @@ type parse_options = { types: bool; use_strict: bool; } -let default_parse_options = { - esproposal_class_instance_fields = false; - esproposal_class_static_fields = false; - esproposal_decorators = false; - esproposal_export_star_as = false; - esproposal_optional_chaining = false; - esproposal_nullish_coalescing = false; - types = true; - use_strict = false; -} + +let default_parse_options = + { + enums = false; + esproposal_class_instance_fields = false; + esproposal_class_static_fields = false; + esproposal_decorators = false; + esproposal_export_star_as = false; + esproposal_optional_chaining = false; + esproposal_nullish_coalescing = false; + types = true; + use_strict = false; + } type allowed_super = | No_super @@ -165,50 +166,51 @@ type allowed_super = | Super_prop_or_call type env = { - errors : (Loc.t * Error.t) list ref; - comments : Loc.t Comment.t list ref; - labels : SSet.t; - exports : SSet.t ref; - last_lex_result : Lex_result.t option ref; - in_strict_mode : bool; - in_export : bool; - in_loop : bool; - in_switch : bool; - in_formal_parameters : bool; - in_function : bool; - no_in : bool; - no_call : bool; - no_let : bool; - no_anon_function_type : bool; - no_new : bool; - allow_yield : bool; - allow_await : bool; - allow_directive : bool; - allow_super : allowed_super; - error_callback : (env -> Error.t -> unit) option; - lex_mode_stack : Lex_mode.t list ref; + errors: (Loc.t * Parse_error.t) list ref; + comments: Loc.t Comment.t list ref; + labels: SSet.t; + exports: SSet.t ref; + last_lex_result: Lex_result.t option ref; + in_strict_mode: bool; + in_export: bool; + in_loop: bool; + in_switch: bool; + in_formal_parameters: bool; + in_function: bool; + no_in: bool; + no_call: bool; + no_let: bool; + no_anon_function_type: bool; + no_new: bool; + allow_yield: bool; + allow_await: bool; + allow_directive: bool; + allow_super: allowed_super; + error_callback: (env -> Parse_error.t -> unit) option; + lex_mode_stack: Lex_mode.t list ref; (* lex_env is the lex_env after the single lookahead has been lexed *) - lex_env : Lex_env.t ref; + lex_env: Lex_env.t ref; (* This needs to be cleared whenever we advance. *) - lookahead : Lookahead.t ref; - token_sink : (token_sink_result -> unit) option ref; - parse_options : parse_options; - source : File_key.t option; + lookahead: Lookahead.t ref; + token_sink: (token_sink_result -> unit) option ref; + parse_options: parse_options; + source: File_key.t option; (* It is a syntax error to reference private fields not in scope. In order to enforce this, * we keep track of the privates we've seen declared and used. *) - privates : (SSet.t * ((string * Loc.t) list)) list ref; + privates: (SSet.t * (string * Loc.t) list) list ref; + (* The position up to which comments have been consumed, exclusive. *) + consumed_comments_pos: Loc.position ref; } (* constructor *) -let init_env ?(token_sink=None) ?(parse_options=None) source content = +let init_env ?(token_sink = None) ?(parse_options = None) source content = (* let lb = Sedlexing.Utf16.from_string - content (Some Sedlexing.Utf16.Little_endian) in *) - let lb, errors = try Sedlexing.Utf8.from_string content, [] - with Sedlexing.MalFormed -> - Sedlexing.Utf8.from_string "", - [ { Loc.none with Loc.source; }, Parse_error.MalformedUnicode ] + content (Some Sedlexing.Utf16.Little_endian) in *) + let (lb, errors) = + try (Sedlexing.Utf8.from_string content, []) + with Sedlexing.MalFormed -> + (Sedlexing.Utf8.from_string "", [({ Loc.none with Loc.source }, Parse_error.MalformedUnicode)]) in - let parse_options = match parse_options with | Some opts -> opts @@ -245,30 +247,52 @@ let init_env ?(token_sink=None) ?(parse_options=None) source content = parse_options; source; privates = ref []; + consumed_comments_pos = ref { Loc.line = 0; column = 0 }; } (* getters: *) let in_strict_mode env = env.in_strict_mode + let lex_mode env = List.hd !(env.lex_mode_stack) + let in_export env = env.in_export + let comments env = !(env.comments) + let labels env = env.labels + let in_loop env = env.in_loop + let in_switch env = env.in_switch + let in_formal_parameters env = env.in_formal_parameters + let in_function env = env.in_function + let allow_yield env = env.allow_yield + let allow_await env = env.allow_await + let allow_directive env = env.allow_directive + let allow_super env = env.allow_super + let no_in env = env.no_in + let no_call env = env.no_call + let no_let env = env.no_let + let no_anon_function_type env = env.no_anon_function_type + let no_new env = env.no_new + let errors env = !(env.errors) + let parse_options env = env.parse_options + let source env = env.source + let should_parse_types env = env.parse_options.types (* mutators: *) @@ -277,14 +301,17 @@ let error_at env (loc, e) = match env.error_callback with | None -> () | Some callback -> callback env e -let comment_list env = - List.iter (fun c -> env.comments := c :: !(env.comments)) -let record_export env (loc, export_name) = - if export_name = "" then () else (* empty identifiers signify an error, don't export it *) - let exports = !(env.exports) in - if SSet.mem export_name exports - then error_at env (loc, Error.DuplicateExport export_name) - else env.exports := SSet.add export_name !(env.exports) + +let record_export env (loc, { Identifier.name = export_name; comments = _ }) = + if export_name = "" then + () + else + (* empty identifiers signify an error, don't export it *) + let exports = !(env.exports) in + if SSet.mem export_name exports then + error_at env (loc, Parse_error.DuplicateExport export_name) + else + env.exports := SSet.add export_name !(env.exports) (* Since private fields out of scope are a parse error, we keep track of the declared and used * private fields. @@ -301,30 +328,33 @@ let record_export env (loc, export_name) = let enter_class env = env.privates := (SSet.empty, []) :: !(env.privates) let exit_class env = - let get_unbound_privates declared_privates used_privates = - List.filter (fun x -> not (SSet.mem (fst x) declared_privates)) used_privates in - + List.filter (fun x -> not (SSet.mem (fst x) declared_privates)) used_privates + in match !(env.privates) with - | [declared_privates, used_privates] -> - let unbound_privates = get_unbound_privates declared_privates used_privates in - List.iter (fun (name, loc) -> error_at env (loc, Error.UnboundPrivate name)) unbound_privates; - env.privates := [] + | [(declared_privates, used_privates)] -> + let unbound_privates = get_unbound_privates declared_privates used_privates in + List.iter + (fun (name, loc) -> error_at env (loc, Parse_error.UnboundPrivate name)) + unbound_privates; + env.privates := [] | (loc_declared_privates, loc_used_privates) :: privates -> - let unbound_privates = get_unbound_privates loc_declared_privates loc_used_privates in - let decl_head, used_head = List.hd privates in - env.privates := (decl_head, used_head @ unbound_privates) :: (List.tl privates) + let unbound_privates = get_unbound_privates loc_declared_privates loc_used_privates in + let (decl_head, used_head) = List.hd privates in + env.privates := (decl_head, used_head @ unbound_privates) :: List.tl privates | _ -> failwith "Internal Error: `exit_class` called before a matching `enter_class`" let add_declared_private env name = match !(env.privates) with | [] -> failwith "Internal Error: Tried to add_declared_private with outside of class scope." - | (declared, used)::xs -> env.privates := ((SSet.add name declared, used) :: xs) + | (declared, used) :: xs -> env.privates := (SSet.add name declared, used) :: xs let add_used_private env name loc = match !(env.privates) with - | [] -> error_at env (loc, Error.PrivateNotInClass) - | (declared, used)::xs -> env.privates := ((declared, (name, loc) :: used) :: xs) + | [] -> error_at env (loc, Parse_error.PrivateNotInClass) + | (declared, used) :: xs -> env.privates := (declared, (name, loc) :: used) :: xs + +let consume_comments_until env pos = env.consumed_comments_pos := pos (* lookahead: *) let lookahead ~i env = @@ -333,38 +363,57 @@ let lookahead ~i env = (* functional operations: *) let with_strict in_strict_mode env = { env with in_strict_mode } + let with_in_formal_parameters in_formal_parameters env = { env with in_formal_parameters } + let with_in_function in_function env = { env with in_function } + let with_allow_yield allow_yield env = { env with allow_yield } + let with_allow_await allow_await env = { env with allow_await } + let with_allow_directive allow_directive env = { env with allow_directive } + let with_allow_super allow_super env = { env with allow_super } + let with_no_let no_let env = { env with no_let } + let with_in_loop in_loop env = { env with in_loop } + let with_no_in no_in env = { env with no_in } -let with_no_anon_function_type no_anon_function_type env = - { env with no_anon_function_type } + +let with_no_anon_function_type no_anon_function_type env = { env with no_anon_function_type } + let with_no_new no_new env = { env with no_new } + let with_in_switch in_switch env = { env with in_switch } + let with_in_export in_export env = { env with in_export } + let with_no_call no_call env = { env with no_call } -let with_error_callback error_callback env = - { env with error_callback = Some error_callback } + +let with_error_callback error_callback env = { env with error_callback = Some error_callback } (* other helper functions: *) let error_list env = List.iter (error_at env) -let last_loc env = match !(env.last_lex_result) with -| Some lex_result -> Some (Lex_result.loc lex_result) -| None -> None -let last_token env = match !(env.last_lex_result) with -| Some lex_result -> Some (Lex_result.token lex_result) -| None -> None +let last_loc env = + match !(env.last_lex_result) with + | Some lex_result -> Some (Lex_result.loc lex_result) + | None -> None + +let last_token env = + match !(env.last_lex_result) with + | Some lex_result -> Some (Lex_result.token lex_result) + | None -> None let without_error_callback env = { env with error_callback = None } let add_label env label = { env with labels = SSet.add label env.labels } -let enter_function env ~async ~generator = { env with + +let enter_function env ~async ~generator = + { + env with in_formal_parameters = false; in_function = true; in_loop = false; @@ -376,23 +425,95 @@ let enter_function env ~async ~generator = { env with (* #sec-keywords *) let is_keyword = function - | "await" | "break" | "case" | "catch" | "class" | "const" | "continue" - | "debugger" | "default" | "delete" | "do" | "else" | "export" | "extends" - | "finally" | "for" | "function" | "if" | "import" | "in" | "instanceof" - | "new" | "return" | "super" | "switch" | "this" | "throw" | "try" - | "typeof" | "var" | "void" | "while" | "with" | "yield" -> true + | "await" + | "break" + | "case" + | "catch" + | "class" + | "const" + | "continue" + | "debugger" + | "default" + | "delete" + | "do" + | "else" + | "export" + | "extends" + | "finally" + | "for" + | "function" + | "if" + | "import" + | "in" + | "instanceof" + | "new" + | "return" + | "super" + | "switch" + | "this" + | "throw" + | "try" + | "typeof" + | "var" + | "void" + | "while" + | "with" + | "yield" -> + true | _ -> false +let token_is_keyword = + Token.( + function + | T_IDENTIFIER { raw; _ } when is_keyword raw -> true + | T_AWAIT + | T_BREAK + | T_CASE + | T_CATCH + | T_CLASS + | T_CONST + | T_CONTINUE + | T_DEBUGGER + | T_DEFAULT + | T_DELETE + | T_DO + | T_ELSE + | T_EXPORT + | T_EXTENDS + | T_FINALLY + | T_FOR + | T_FUNCTION + | T_IF + | T_IMPORT + | T_IN + | T_INSTANCEOF + | T_NEW + | T_RETURN + | T_SUPER + | T_SWITCH + | T_THIS + | T_THROW + | T_TRY + | T_TYPEOF + | T_VAR + | T_VOID + | T_WHILE + | T_WITH + | T_YIELD -> + true + | _ -> false) + (* #sec-future-reserved-words *) let is_future_reserved = function | "enum" -> true | _ -> false -let token_is_future_reserved = Token.(function - | T_IDENTIFIER { raw; _ } when is_future_reserved raw -> true - | T_ENUM -> true - | _ -> false -) +let token_is_future_reserved = + Token.( + function + | T_IDENTIFIER { raw; _ } when is_future_reserved raw -> true + | T_ENUM -> true + | _ -> false) (* #sec-strict-mode-of-ecmascript *) let is_strict_reserved = function @@ -403,48 +524,82 @@ let is_strict_reserved = function | "protected" | "public" | "static" - | "yield" -> true + | "yield" -> + true | _ -> false -let token_is_strict_reserved = Token.(function - | T_IDENTIFIER { raw; _ } when is_strict_reserved raw -> true - | T_INTERFACE - | T_IMPLEMENTS - | T_PACKAGE - | T_PRIVATE - | T_PROTECTED - | T_PUBLIC - | T_STATIC - | T_YIELD - -> true - | _ - -> false -) +let token_is_strict_reserved = + Token.( + function + | T_IDENTIFIER { raw; _ } when is_strict_reserved raw -> true + | T_INTERFACE + | T_IMPLEMENTS + | T_PACKAGE + | T_PRIVATE + | T_PROTECTED + | T_PUBLIC + | T_STATIC + | T_YIELD -> + true + | _ -> false) (* #sec-strict-mode-of-ecmascript *) let is_restricted = function | "eval" - | "arguments" -> true + | "arguments" -> + true | _ -> false -let token_is_restricted = Token.(function - | T_IDENTIFIER { raw; _ } when is_restricted raw -> true - | _ -> false -) +let token_is_restricted = + Token.( + function + | T_IDENTIFIER { raw; _ } when is_restricted raw -> true + | _ -> false) (* #sec-reserved-words *) let is_reserved str_val = - is_keyword str_val || - is_future_reserved str_val || + is_keyword str_val + || is_future_reserved str_val + || match str_val with - | "null" | "true" | "false" -> true + | "null" + | "true" + | "false" -> + true + | _ -> false + +let token_is_reserved t = + token_is_keyword t + || token_is_future_reserved t + || + match t with + | Token.T_IDENTIFIER { raw = "null" | "true" | "false"; _ } + | Token.T_NULL + | Token.T_TRUE + | Token.T_FALSE -> + true | _ -> false let is_reserved_type str_val = match str_val with - | "any" | "bool" | "boolean" | "empty" | "false" | "mixed" | "null" | "number" - | "static" | "string" | "true" | "typeof" | "void" | "interface" | "extends" - -> true + | "any" + | "bool" + | "boolean" + | "empty" + | "false" + | "mixed" + | "null" + | "number" + | "bigint" + | "static" + | "string" + | "true" + | "typeof" + | "void" + | "interface" + | "extends" + | "_" -> + true | _ -> false (* Answer questions about what comes next *) @@ -453,29 +608,67 @@ module Peek = struct open Token let ith_token ~i env = Lex_result.token (lookahead ~i env) + let ith_loc ~i env = Lex_result.loc (lookahead ~i env) + let ith_errors ~i env = Lex_result.errors (lookahead ~i env) - let ith_comments ~i env = Lex_result.comments (lookahead ~i env) + + let ith_comments ~i env = + let comments = Lex_result.comments (lookahead ~i env) in + List.filter + (fun ({ Loc.start; _ }, _) -> Loc.pos_cmp !(env.consumed_comments_pos) start <= 0) + comments + let ith_lex_env ~i env = Lookahead.lex_env !(env.lookahead) i let token env = ith_token ~i:0 env + let loc env = ith_loc ~i:0 env + + (* loc_skip_lookahead is used to give a loc hint to optional tokens such as type annotations *) + let loc_skip_lookahead env = + let loc = + match last_loc env with + | Some loc -> loc + | None -> failwith "Peeking current location when not available" + in + Loc.{ loc with start = loc._end } + let errors env = ith_errors ~i:0 env + let comments env = ith_comments ~i:0 env + + let has_eaten_comments env = + let comments = Lex_result.comments (lookahead ~i:0 env) in + List.exists + (fun ({ Loc.start; _ }, _) -> Loc.pos_cmp start !(env.consumed_comments_pos) < 0) + comments + let lex_env env = ith_lex_env ~i:0 env (* True if there is a line terminator before the next token *) - let is_line_terminator env = - match last_loc env with - | None -> false - | Some loc' -> - (loc env).start.line > loc'.start.line + let ith_is_line_terminator ~i env = + let loc = + if i > 0 then + Some (ith_loc ~i:(i - 1) env) + else + last_loc env + in + match loc with + | None -> false + | Some loc' -> (ith_loc ~i env).start.line > loc'.start.line - let is_implicit_semicolon env = - match token env with - | T_EOF | T_RCURLY -> true + let is_line_terminator env = ith_is_line_terminator ~i:0 env + + let ith_is_implicit_semicolon ~i env = + match ith_token ~i env with + | T_EOF + | T_RCURLY -> + true | T_SEMICOLON -> false - | _ -> is_line_terminator env + | _ -> ith_is_line_terminator ~i env + + let is_implicit_semicolon env = ith_is_implicit_semicolon ~i:0 env let ith_is_identifier ~i env = match ith_token ~i env with @@ -490,173 +683,175 @@ module Peek = struct | T_ASYNC | T_AWAIT | T_POUND - | T_IDENTIFIER _ -> true + | T_IDENTIFIER _ -> + true | _ -> false let ith_is_type_identifier ~i env = match lex_mode env with | Lex_mode.TYPE -> - begin match ith_token ~i env with - | T_IDENTIFIER _ -> true - | _ -> false + begin + match ith_token ~i env with + | T_IDENTIFIER _ -> true + | _ -> false end | Lex_mode.NORMAL -> (* Sometimes we peek at type identifiers while in normal lex mode. For example, when deciding whether a `type` token is an identifier or the start of a type declaration, based on whether the following token `is_type_identifier`. *) - begin match ith_token ~i env with - | T_IDENTIFIER { raw; _ } when is_reserved_type raw -> false - - (* reserved type identifiers, but these don't appear in NORMAL mode *) - | T_ANY_TYPE - | T_MIXED_TYPE - | T_EMPTY_TYPE - | T_NUMBER_TYPE - | T_STRING_TYPE - | T_VOID_TYPE - | T_BOOLEAN_TYPE _ - | T_NUMBER_SINGLETON_TYPE _ - - (* identifier-ish *) - | T_ASYNC - | T_AWAIT - | T_BREAK - | T_CASE - | T_CATCH - | T_CLASS - | T_CONST - | T_CONTINUE - | T_DEBUGGER - | T_DECLARE - | T_DEFAULT - | T_DELETE - | T_DO - | T_ELSE - | T_ENUM - | T_EXPORT - | T_EXTENDS - | T_FALSE - | T_FINALLY - | T_FOR - | T_FUNCTION - | T_IDENTIFIER _ - | T_IF - | T_IMPLEMENTS - | T_IMPORT - | T_IN - | T_INSTANCEOF - | T_INTERFACE - | T_LET - | T_NEW - | T_NULL - | T_OF - | T_OPAQUE - | T_PACKAGE - | T_PRIVATE - | T_PROTECTED - | T_PUBLIC - | T_RETURN - | T_SUPER - | T_SWITCH - | T_THIS - | T_THROW - | T_TRUE - | T_TRY - | T_TYPE - | T_VAR - | T_WHILE - | T_WITH - | T_YIELD -> true - - (* identifier-ish, but not valid types *) - | T_STATIC - | T_TYPEOF - | T_VOID - -> false - - (* syntax *) - | T_LCURLY - | T_RCURLY - | T_LCURLYBAR - | T_RCURLYBAR - | T_LPAREN - | T_RPAREN - | T_LBRACKET - | T_RBRACKET - | T_SEMICOLON - | T_COMMA - | T_PERIOD - | T_ARROW - | T_ELLIPSIS - | T_AT - | T_POUND - | T_CHECKS - | T_RSHIFT3_ASSIGN - | T_RSHIFT_ASSIGN - | T_LSHIFT_ASSIGN - | T_BIT_XOR_ASSIGN - | T_BIT_OR_ASSIGN - | T_BIT_AND_ASSIGN - | T_MOD_ASSIGN - | T_DIV_ASSIGN - | T_MULT_ASSIGN - | T_EXP_ASSIGN - | T_MINUS_ASSIGN - | T_PLUS_ASSIGN - | T_ASSIGN - | T_PLING_PERIOD - | T_PLING_PLING - | T_PLING - | T_COLON - | T_OR - | T_AND - | T_BIT_OR - | T_BIT_XOR - | T_BIT_AND - | T_EQUAL - | T_NOT_EQUAL - | T_STRICT_EQUAL - | T_STRICT_NOT_EQUAL - | T_LESS_THAN_EQUAL - | T_GREATER_THAN_EQUAL - | T_LESS_THAN - | T_GREATER_THAN - | T_LSHIFT - | T_RSHIFT - | T_RSHIFT3 - | T_PLUS - | T_MINUS - | T_DIV - | T_MULT - | T_EXP - | T_MOD - | T_NOT - | T_BIT_NOT - | T_INCR - | T_DECR - | T_EOF - -> false - - (* literals *) - | T_NUMBER _ - | T_STRING _ - | T_TEMPLATE_PART _ - | T_REGEXP _ - - (* misc that shouldn't appear in NORMAL mode *) - | T_JSX_IDENTIFIER _ - | T_JSX_TEXT _ - | T_ERROR _ - -> false + begin + match ith_token ~i env with + | T_IDENTIFIER { raw; _ } when is_reserved_type raw -> false + (* reserved type identifiers, but these don't appear in NORMAL mode *) + | T_ANY_TYPE + | T_MIXED_TYPE + | T_EMPTY_TYPE + | T_NUMBER_TYPE + | T_BIGINT_TYPE + | T_STRING_TYPE + | T_VOID_TYPE + | T_SYMBOL_TYPE + | T_BOOLEAN_TYPE _ + | T_NUMBER_SINGLETON_TYPE _ + | T_BIGINT_SINGLETON_TYPE _ + (* identifier-ish *) + | T_ASYNC + | T_AWAIT + | T_BREAK + | T_CASE + | T_CATCH + | T_CLASS + | T_CONST + | T_CONTINUE + | T_DEBUGGER + | T_DECLARE + | T_DEFAULT + | T_DELETE + | T_DO + | T_ELSE + | T_ENUM + | T_EXPORT + | T_EXTENDS + | T_FALSE + | T_FINALLY + | T_FOR + | T_FUNCTION + | T_IDENTIFIER _ + | T_IF + | T_IMPLEMENTS + | T_IMPORT + | T_IN + | T_INSTANCEOF + | T_INTERFACE + | T_LET + | T_NEW + | T_NULL + | T_OF + | T_OPAQUE + | T_PACKAGE + | T_PRIVATE + | T_PROTECTED + | T_PUBLIC + | T_RETURN + | T_SUPER + | T_SWITCH + | T_THIS + | T_THROW + | T_TRUE + | T_TRY + | T_TYPE + | T_VAR + | T_WHILE + | T_WITH + | T_YIELD -> + true + (* identifier-ish, but not valid types *) + | T_STATIC + | T_TYPEOF + | T_VOID -> + false + (* syntax *) + | T_LCURLY + | T_RCURLY + | T_LCURLYBAR + | T_RCURLYBAR + | T_LPAREN + | T_RPAREN + | T_LBRACKET + | T_RBRACKET + | T_SEMICOLON + | T_COMMA + | T_PERIOD + | T_ARROW + | T_ELLIPSIS + | T_AT + | T_POUND + | T_CHECKS + | T_RSHIFT3_ASSIGN + | T_RSHIFT_ASSIGN + | T_LSHIFT_ASSIGN + | T_BIT_XOR_ASSIGN + | T_BIT_OR_ASSIGN + | T_BIT_AND_ASSIGN + | T_MOD_ASSIGN + | T_DIV_ASSIGN + | T_MULT_ASSIGN + | T_EXP_ASSIGN + | T_MINUS_ASSIGN + | T_PLUS_ASSIGN + | T_ASSIGN + | T_PLING_PERIOD + | T_PLING_PLING + | T_PLING + | T_COLON + | T_OR + | T_AND + | T_BIT_OR + | T_BIT_XOR + | T_BIT_AND + | T_EQUAL + | T_NOT_EQUAL + | T_STRICT_EQUAL + | T_STRICT_NOT_EQUAL + | T_LESS_THAN_EQUAL + | T_GREATER_THAN_EQUAL + | T_LESS_THAN + | T_GREATER_THAN + | T_LSHIFT + | T_RSHIFT + | T_RSHIFT3 + | T_PLUS + | T_MINUS + | T_DIV + | T_MULT + | T_EXP + | T_MOD + | T_NOT + | T_BIT_NOT + | T_INCR + | T_DECR + | T_EOF -> + false + (* literals *) + | T_NUMBER _ + | T_BIGINT _ + | T_STRING _ + | T_TEMPLATE_PART _ + | T_REGEXP _ + (* misc that shouldn't appear in NORMAL mode *) + | T_JSX_IDENTIFIER _ + | T_JSX_TEXT _ + | T_ERROR _ -> + false end | Lex_mode.JSX_TAG | Lex_mode.JSX_CHILD | Lex_mode.TEMPLATE - | Lex_mode.REGEXP -> false + | Lex_mode.REGEXP -> + false - let ith_is_identifier_name ~i env = - ith_is_identifier ~i env || ith_is_type_identifier ~i env + let ith_is_identifier_name ~i env = ith_is_identifier ~i env || ith_is_type_identifier ~i env (* This returns true if the next token is identifier-ish (even if it is an error) *) @@ -667,17 +862,19 @@ module Peek = struct let is_type_identifier env = ith_is_type_identifier ~i:0 env let is_function env = - token env = T_FUNCTION || - (token env = T_ASYNC && ith_token ~i:1 env = T_FUNCTION) + token env = T_FUNCTION + || token env = T_ASYNC + && ith_token ~i:1 env = T_FUNCTION + && (loc env)._end.line = (ith_loc ~i:1 env).start.line let is_class env = match token env with | T_CLASS - | T_AT -> true + | T_AT -> + true | _ -> false end - (*****************************************************************************) (* Errors *) (*****************************************************************************) @@ -687,38 +884,35 @@ let error env e = let loc = Peek.loc env in error_at env (loc, e) -let get_unexpected_error token = - let open Token in - match token with - | T_EOF -> Error.UnexpectedEOS - | T_NUMBER _ -> Error.UnexpectedNumber - | T_JSX_TEXT _ - | T_STRING _ -> Error.UnexpectedString - | T_IDENTIFIER _ -> Error.UnexpectedIdentifier - | t when token_is_future_reserved t -> Error.UnexpectedReserved - | t when token_is_strict_reserved t -> Error.StrictReservedWord - | _ -> Error.UnexpectedToken (value_of_token token) - -let error_unexpected env = +let get_unexpected_error ?expected token = + if token_is_future_reserved token then + Parse_error.UnexpectedReserved + else if token_is_strict_reserved token then + Parse_error.StrictReservedWord + else + let unexpected = Token.explanation_of_token token in + match expected with + | Some expected_msg -> Parse_error.UnexpectedWithExpected (unexpected, expected_msg) + | None -> Parse_error.Unexpected unexpected + +let error_unexpected ?expected env = (* So normally we consume the lookahead lex result when Eat.token calls * Parser_env.advance, which will add any lexing errors to our list of errors. * However, raising an unexpected error for a lookahead is kind of like * consuming that token, so we should process any lexing errors before * complaining about the unexpected token *) error_list env (Peek.errors env); - error env (get_unexpected_error (Peek.token env)) + error env (get_unexpected_error ?expected (Peek.token env)) -let error_on_decorators env = List.iter - (fun decorator -> error_at env ((fst decorator), Error.UnsupportedDecorator)) +let error_on_decorators env = + List.iter (fun decorator -> error_at env (fst decorator, Parse_error.UnsupportedDecorator)) let strict_error env e = if in_strict_mode env then error env e -let strict_error_at env (loc, e) = - if in_strict_mode env then error_at env (loc, e) + +let strict_error_at env (loc, e) = if in_strict_mode env then error_at env (loc, e) let function_as_statement_error_at env loc = - error_at env (loc, Error.FunctionAsStatement { - in_strict_mode = in_strict_mode env - }) + error_at env (loc, Parse_error.FunctionAsStatement { in_strict_mode = in_strict_mode env }) (* Consume zero or more tokens *) module Eat = struct @@ -726,83 +920,164 @@ module Eat = struct let token env = (* If there's a token_sink, emit the lexed token before moving forward *) (match !(env.token_sink) with - | None -> () - | Some token_sink -> - token_sink { - token_loc = Peek.loc env; - token = Peek.token env; - (** - * The lex mode is useful because it gives context to some - * context-sensitive tokens. - * - * Some examples of such tokens include: - * - * `=>` - Part of an arrow function? or part of a type annotation? - * `<` - A less-than? Or an opening to a JSX element? - * ...etc... - *) - token_context=(lex_mode env); - } - ); + | None -> () + | Some token_sink -> + token_sink + { + token_loc = Peek.loc env; + token = Peek.token env; + (* + * The lex mode is useful because it gives context to some + * context-sensitive tokens. + * + * Some examples of such tokens include: + * + * `=>` - Part of an arrow function? or part of a type annotation? + * `<` - A less-than? Or an opening to a JSX element? + * ...etc... + *) + token_context = lex_mode env; + }); env.lex_env := Peek.lex_env env; error_list env (Peek.errors env); - comment_list env (Peek.comments env); + env.comments := List.rev_append (Lex_result.comments (lookahead ~i:0 env)) !(env.comments); env.last_lex_result := Some (lookahead ~i:0 env); Lookahead.junk !(env.lookahead) + (** [maybe env t] eats the next token and returns [true] if it is [t], else return [false] *) + let maybe env t = + if Peek.token env = t then ( + token env; + true + ) else + false + let push_lex_mode env mode = env.lex_mode_stack := mode :: !(env.lex_mode_stack); env.lookahead := Lookahead.create !(env.lex_env) (lex_mode env) let pop_lex_mode env = - let new_stack = match !(env.lex_mode_stack) with - | _mode::stack -> stack - | _ -> failwith "Popping lex mode from empty stack" in + let new_stack = + match !(env.lex_mode_stack) with + | _mode :: stack -> stack + | _ -> failwith "Popping lex mode from empty stack" + in env.lex_mode_stack := new_stack; env.lookahead := Lookahead.create !(env.lex_env) (lex_mode env) let double_pop_lex_mode env = - let new_stack = match !(env.lex_mode_stack) with - | _::_::stack -> stack - | _ -> failwith "Popping lex mode from empty stack" in + let new_stack = + match !(env.lex_mode_stack) with + | _ :: _ :: stack -> stack + | _ -> failwith "Popping lex mode from empty stack" + in env.lex_mode_stack := new_stack; env.lookahead := Lookahead.create !(env.lex_env) (lex_mode env) - (* Semicolon insertion is handled here :(. There seem to be 2 cases where - * semicolons are inserted. First, if we reach the EOF. Second, if the next - * token is } or is separated by a LineTerminator. - *) - let semicolon env = - if not (Peek.is_implicit_semicolon env) - then - if Peek.token env = Token.T_SEMICOLON - then token env - else error_unexpected env + let trailing_comments env = + let open Loc in + let loc = Peek.loc env in + if Peek.token env = Token.T_COMMA && Peek.ith_is_line_terminator ~i:1 env then ( + let trailing_before_comma = Peek.comments env in + let trailing_after_comma = + List.filter + (fun (comment_loc, _) -> comment_loc.start.line <= loc._end.line) + (Lex_result.comments (lookahead ~i:1 env)) + in + let trailing = trailing_before_comma @ trailing_after_comma in + consume_comments_until env { Loc.line = loc._end.line + 1; column = 0 }; + trailing + ) else + let trailing = Peek.comments env in + consume_comments_until env loc._end; + trailing + + let comments_until_next_line env = + let open Loc in + match !(env.last_lex_result) with + | None -> [] + | Some { Lex_result.lex_loc = last_loc; _ } -> + let comments = Peek.comments env in + let comments = List.filter (fun (loc, _) -> loc.start.line <= last_loc._end.line) comments in + consume_comments_until env { line = last_loc._end.line + 1; column = 0 }; + comments + + let program_comments env = + let open Flow_ast.Comment in + let comments = Peek.comments env in + let flow_directive = "@flow" in + let flow_directive_length = String.length flow_directive in + let contains_flow_directive { text; _ } = + let text_length = String.length text in + let rec contains_flow_directive_after_offset off = + if off + flow_directive_length > text_length then + false + else + String.sub text off flow_directive_length = flow_directive + || contains_flow_directive_after_offset (off + 1) + in + contains_flow_directive_after_offset 0 + in + (* Comments up through the last comment with an @flow directive are considered program comments *) + let rec flow_directive_comments comments = + match comments with + | [] -> [] + | (loc, comment) :: rest -> + if contains_flow_directive comment then ( + (env.consumed_comments_pos := Loc.(loc._end)); + List.rev ((loc, comment) :: rest) + ) else + flow_directive_comments rest + in + let program_comments = flow_directive_comments (List.rev comments) in + let program_comments = + if program_comments <> [] then + program_comments + else + (* If there is no @flow directive, consider the first block comment a program comment if + it starts with "/**" *) + match comments with + | ((loc, { kind = Block; text; _ }) as first_comment) :: _ + when String.length text >= 1 && text.[0] = '*' -> + (env.consumed_comments_pos := Loc.(loc._end)); + [first_comment] + | _ -> [] + in + program_comments end module Expect = struct + let error env t = + let expected = Token.explanation_of_token ~use_article:true t in + error_unexpected ~expected env + let token env t = - if Peek.token env <> t then error_unexpected env; + if Peek.token env <> t then error env t; Eat.token env + (** [token_opt env T_FOO] eats a token if it is [T_FOO], and errors without consuming if not. + This differs from [token], which always consumes. Only use [token_opt] when it's ok for + the parser to not advance, like if you are guaranteed that something else has eaten a + token. *) + let token_opt env t = + if Peek.token env <> t then + error env t + else + Eat.token env + let identifier env name = - begin match Peek.token env with - | Token.T_IDENTIFIER { raw; _ } when raw = name -> () - | _ -> error_unexpected env + let t = Peek.token env in + begin + match t with + | Token.T_IDENTIFIER { raw; _ } when raw = name -> () + | _ -> + let expected = Printf.sprintf "the identifier `%s`" name in + error_unexpected ~expected env end; Eat.token env - - (* If the next token is t, then eat it and return true - * else return false *) - let maybe env t = - if Peek.token env = t - then begin - Eat.token env; - true - end else false end (* This module allows you to try parsing and rollback if you need. This is not @@ -815,12 +1090,13 @@ module Try = struct exception Rollback type saved_state = { - saved_errors : (Loc.t * Error.t) list; - saved_comments : Loc.t Ast.Comment.t list; - saved_last_lex_result : Lex_result.t option; - saved_lex_mode_stack : Lex_mode.t list; - saved_lex_env : Lex_env.t; - token_buffer : ((token_sink_result -> unit) * token_sink_result Queue.t) option; + saved_errors: (Loc.t * Parse_error.t) list; + saved_comments: Loc.t Flow_ast.Comment.t list; + saved_last_lex_result: Lex_result.t option; + saved_lex_mode_stack: Lex_mode.t list; + saved_lex_env: Lex_env.t; + saved_consumed_comments_pos: Loc.position; + token_buffer: ((token_sink_result -> unit) * token_sink_result Queue.t) option; } let save_state env = @@ -828,27 +1104,26 @@ module Try = struct match !(env.token_sink) with | None -> None | Some orig_token_sink -> - let buffer = Queue.create () in - env.token_sink := Some(fun token_data -> - Queue.add token_data buffer - ); - Some(orig_token_sink, buffer) + let buffer = Queue.create () in + env.token_sink := Some (fun token_data -> Queue.add token_data buffer); + Some (orig_token_sink, buffer) in { - saved_errors = !(env.errors); - saved_comments = !(env.comments); + saved_errors = !(env.errors); + saved_comments = !(env.comments); saved_last_lex_result = !(env.last_lex_result); - saved_lex_mode_stack = !(env.lex_mode_stack); - saved_lex_env = !(env.lex_env); + saved_lex_mode_stack = !(env.lex_mode_stack); + saved_lex_env = !(env.lex_env); + saved_consumed_comments_pos = !(env.consumed_comments_pos); token_buffer; } let reset_token_sink ~flush env token_buffer_info = match token_buffer_info with | None -> () - | Some(orig_token_sink, token_buffer) -> - env.token_sink := Some orig_token_sink; - if flush then Queue.iter orig_token_sink token_buffer + | Some (orig_token_sink, token_buffer) -> + env.token_sink := Some orig_token_sink; + if flush then Queue.iter orig_token_sink token_buffer let rollback_state env saved_state = reset_token_sink ~flush:false env saved_state.token_buffer; @@ -857,6 +1132,7 @@ module Try = struct env.last_lex_result := saved_state.saved_last_lex_result; env.lex_mode_stack := saved_state.saved_lex_mode_stack; env.lex_env := saved_state.saved_lex_env; + env.consumed_comments_pos := saved_state.saved_consumed_comments_pos; env.lookahead := Lookahead.create !(env.lex_env) (lex_mode env); FailedToParse @@ -867,8 +1143,7 @@ module Try = struct let to_parse env parse = let saved_state = save_state env in - try success env saved_state (parse env) - with Rollback -> rollback_state env saved_state + (try success env saved_state (parse env) with Rollback -> rollback_state env saved_state) let or_else env ~fallback parse = match to_parse env parse with diff --git a/lib/parser_env.mli b/lib/parser_env.mli index 4637651..da155c1 100644 --- a/lib/parser_env.mli +++ b/lib/parser_env.mli @@ -1,5 +1,5 @@ -(** - * Copyright (c) 2013-present, Facebook, Inc. +(* + * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -18,7 +18,8 @@ module Lex_mode : sig | JSX_CHILD | TEMPLATE | REGEXP - val debug_string_of_lex_mode: t -> string + + val debug_string_of_lex_mode : t -> string end type token_sink_result = { @@ -28,6 +29,7 @@ type token_sink_result = { } type parse_options = { + enums: bool; esproposal_class_instance_fields: bool; esproposal_class_static_fields: bool; esproposal_decorators: bool; @@ -37,6 +39,7 @@ type parse_options = { types: bool; use_strict: bool; } + val default_parse_options : parse_options type env @@ -48,119 +51,216 @@ type allowed_super = (* constructor: *) val init_env : - ?token_sink:(token_sink_result -> unit) option - -> ?parse_options:parse_options option - -> File_key.t option - -> string - -> env + ?token_sink:(token_sink_result -> unit) option -> + ?parse_options:parse_options option -> + File_key.t option -> + string -> + env (* getters: *) val in_strict_mode : env -> bool + val last_loc : env -> Loc.t option + val last_token : env -> Token.t option + val in_export : env -> bool + val labels : env -> SSet.t -val comments : env -> Loc.t Ast.Comment.t list + +val comments : env -> Loc.t Flow_ast.Comment.t list + val in_loop : env -> bool + val in_switch : env -> bool + val in_formal_parameters : env -> bool + val in_function : env -> bool + val allow_yield : env -> bool -val allow_await: env -> bool + +val allow_await : env -> bool + val allow_directive : env -> bool + val allow_super : env -> allowed_super + val no_in : env -> bool + val no_call : env -> bool + val no_let : env -> bool + val no_anon_function_type : env -> bool + val no_new : env -> bool + val errors : env -> (Loc.t * Parse_error.t) list + val parse_options : env -> parse_options + val source : env -> File_key.t option + val should_parse_types : env -> bool (* mutators: *) val error_at : env -> Loc.t * Parse_error.t -> unit + val error : env -> Parse_error.t -> unit -val error_unexpected : env -> unit + +val error_unexpected : ?expected:string -> env -> unit + val error_on_decorators : env -> (Loc.t * 'a) list -> unit + val strict_error : env -> Parse_error.t -> unit + val strict_error_at : env -> Loc.t * Parse_error.t -> unit + val function_as_statement_error_at : env -> Loc.t -> unit -val comment_list : env -> Loc.t Ast.Comment.t list -> unit + val error_list : env -> (Loc.t * Parse_error.t) list -> unit -val record_export: env -> Loc.t * string -> unit + +val record_export : env -> (Loc.t, Loc.t) Flow_ast.Identifier.t -> unit + val enter_class : env -> unit + val exit_class : env -> unit + val add_declared_private : env -> string -> unit + val add_used_private : env -> string -> Loc.t -> unit +val consume_comments_until : env -> Loc.position -> unit + (* functional operations -- these return shallow copies, so future mutations to * the returned env will also affect the original: *) val with_strict : bool -> env -> env + val with_in_formal_parameters : bool -> env -> env + val with_in_function : bool -> env -> env + val with_allow_yield : bool -> env -> env + val with_allow_await : bool -> env -> env + val with_allow_directive : bool -> env -> env + val with_allow_super : allowed_super -> env -> env + val with_no_let : bool -> env -> env + val with_in_loop : bool -> env -> env + val with_no_in : bool -> env -> env + val with_no_anon_function_type : bool -> env -> env + val with_no_new : bool -> env -> env + val with_in_switch : bool -> env -> env + val with_in_export : bool -> env -> env + val with_no_call : bool -> env -> env + val with_error_callback : (env -> Parse_error.t -> unit) -> env -> env val without_error_callback : env -> env val add_label : env -> string -> env + val enter_function : env -> async:bool -> generator:bool -> env val is_reserved : string -> bool + +val token_is_reserved : Token.t -> bool + val is_future_reserved : string -> bool + val is_strict_reserved : string -> bool + val token_is_strict_reserved : Token.t -> bool + val is_restricted : string -> bool + val is_reserved_type : string -> bool + val token_is_restricted : Token.t -> bool module Peek : sig val token : env -> Token.t + val loc : env -> Loc.t + + val loc_skip_lookahead : env -> Loc.t + val errors : env -> (Loc.t * Parse_error.t) list - val comments : env -> Loc.t Ast.Comment.t list + + val comments : env -> Loc.t Flow_ast.Comment.t list + + val has_eaten_comments : env -> bool + val is_line_terminator : env -> bool + val is_implicit_semicolon : env -> bool + val is_identifier : env -> bool + val is_type_identifier : env -> bool + val is_identifier_name : env -> bool + val is_function : env -> bool + val is_class : env -> bool val ith_token : i:int -> env -> Token.t + val ith_loc : i:int -> env -> Loc.t + val ith_errors : i:int -> env -> (Loc.t * Parse_error.t) list - val ith_comments : i:int -> env -> Loc.t Ast.Comment.t list + + val ith_comments : i:int -> env -> Loc.t Flow_ast.Comment.t list + + val ith_is_line_terminator : i:int -> env -> bool + + val ith_is_implicit_semicolon : i:int -> env -> bool + val ith_is_identifier : i:int -> env -> bool + val ith_is_identifier_name : i:int -> env -> bool + val ith_is_type_identifier : i:int -> env -> bool end module Eat : sig val token : env -> unit + + val maybe : env -> Token.t -> bool + val push_lex_mode : env -> Lex_mode.t -> unit + val pop_lex_mode : env -> unit + val double_pop_lex_mode : env -> unit - val semicolon : env -> unit + + val trailing_comments : env -> Loc.t Flow_ast.Comment.t list + + val comments_until_next_line : env -> Loc.t Flow_ast.Comment.t list + + val program_comments : env -> Loc.t Flow_ast.Comment.t list end module Expect : sig + val error : env -> Token.t -> unit + val token : env -> Token.t -> unit + + val token_opt : env -> Token.t -> unit + val identifier : env -> string -> unit - val maybe : env -> Token.t -> bool end module Try : sig @@ -170,6 +270,7 @@ module Try : sig exception Rollback - val to_parse: env -> (env -> 'a) -> 'a parse_result - val or_else: env -> fallback:'a -> (env -> 'a) -> 'a + val to_parse : env -> (env -> 'a) -> 'a parse_result + + val or_else : env -> fallback:'a -> (env -> 'a) -> 'a end diff --git a/lib/parser_flow.ml b/lib/parser_flow.ml index 85e77d1..d1f053b 100644 --- a/lib/parser_flow.ml +++ b/lib/parser_flow.ml @@ -1,13 +1,13 @@ -(** - * Copyright (c) 2013-present, Facebook, Inc. +(* + * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. *) +module Ast = Flow_ast open Token open Parser_env -module Error = Parse_error open Parser_common (* Sometimes we add the same error for multiple different reasons. This is hard @@ -15,20 +15,28 @@ open Parser_common a reversed list of errors and returns the list in forward order with dupes removed. This differs from a set because the original order is preserved. *) let filter_duplicate_errors = - let module ErrorSet = Set.Make(struct - type t = Loc.t * Error.t + let module PrintableErrorSet = Set.Make (struct + type t = Loc.t * Parse_error.t + let compare (a_loc, a_error) (b_loc, b_error) = let loc = Loc.compare a_loc b_loc in - if loc = 0 - then Pervasives.compare a_error b_error - else loc + if loc = 0 then + Parse_error.compare a_error b_error + else + loc end) in fun errs -> let errs = List.rev errs in - let _, deduped = List.fold_left (fun (set, deduped) err -> - if ErrorSet.mem err set then (set, deduped) - else (ErrorSet.add err set, err::deduped) - ) (ErrorSet.empty, []) errs in + let (_, deduped) = + List.fold_left + (fun (set, deduped) err -> + if PrintableErrorSet.mem err set then + (set, deduped) + else + (PrintableErrorSet.add err set, err :: deduped)) + (PrintableErrorSet.empty, []) + errs + in List.rev deduped module rec Parse : PARSER = struct @@ -37,58 +45,85 @@ module rec Parse : PARSER = struct module Pattern_cover = Pattern_cover.Cover (Parse) module Expression = Expression_parser.Expression (Parse) (Type) (Declaration) (Pattern_cover) module Object = Object_parser.Object (Parse) (Type) (Declaration) (Expression) (Pattern_cover) - module Statement = Statement_parser.Statement (Parse) (Type) (Declaration) (Object) (Pattern_cover) + module Statement = + Statement_parser.Statement (Parse) (Type) (Declaration) (Object) (Pattern_cover) module Pattern = Pattern_parser.Pattern (Parse) (Type) module JSX = Jsx_parser.JSX (Parse) + let identifier ?restricted_error env = + (match Peek.token env with + (* "let" is disallowed as an identifier in a few situations. 11.6.2.1 + lists them out. It is always disallowed in strict mode *) + | T_LET when in_strict_mode env -> error env Parse_error.StrictReservedWord + | T_LET when no_let env -> error_unexpected env + | T_LET -> () + (* `allow_await` means that `await` is allowed to be a keyword, + which makes it illegal to use as an identifier. + https://tc39.github.io/ecma262/#sec-identifiers-static-semantics-early-errors *) + | T_AWAIT when allow_await env -> error env Parse_error.UnexpectedReserved + | T_AWAIT -> () + (* `allow_yield` means that `yield` is allowed to be a keyword, + which makes it illegal to use as an identifier. + https://tc39.github.io/ecma262/#sec-identifiers-static-semantics-early-errors *) + | T_YIELD when allow_yield env -> error env Parse_error.UnexpectedReserved + | T_YIELD when in_strict_mode env -> error env Parse_error.StrictReservedWord + | T_YIELD -> () + | t when token_is_strict_reserved t -> strict_error env Parse_error.StrictReservedWord + | t when token_is_reserved t -> error_unexpected env + | t -> + (match restricted_error with + | Some err when token_is_restricted t -> strict_error env err + | _ -> ())); + identifier_name env + let rec program env = + let leading = Eat.program_comments env in let stmts = module_body_with_directives env (fun _ -> false) in let end_loc = Peek.loc env in Expect.token env T_EOF; - let loc = match stmts with - | [] -> end_loc - | _ -> Loc.btwn (fst (List.hd stmts)) (fst (List.hd (List.rev stmts))) in - let comments = List.rev (comments env) in - loc, stmts, comments + let loc = + match stmts with + | [] -> end_loc + | _ -> Loc.btwn (fst (List.hd stmts)) (fst (List.hd (List.rev stmts))) + in + let all_comments = List.rev (comments env) in + ( loc, + { + Ast.Program.statements = stmts; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + all_comments; + } ) and directives = - let check env token = - match token with - | T_STRING (loc, _, _, octal) -> - if octal then strict_error_at env (loc, Error.StrictOctalLiteral) - | _ -> failwith ("Nooo: "^(token_to_string token)^"\n") - - in let rec statement_list env term_fn item_fn (string_tokens, stmts) = - match Peek.token env with - | T_EOF -> env, string_tokens, stmts - | t when term_fn t -> env, string_tokens, stmts - | T_STRING _ as string_token -> - let possible_directive = item_fn env in - let stmts = possible_directive::stmts in - (match possible_directive with - | _, Ast.Statement.Expression { - Ast.Statement.Expression.directive = Some raw; _ - } -> - (* 14.1.1 says that it has to be "use strict" without any - escapes, so "use\x20strict" is disallowed. *) - let strict = (in_strict_mode env) || (raw = "use strict") in - let string_tokens = string_token::string_tokens in - statement_list - (env |> with_strict strict) - term_fn - item_fn - (string_tokens, stmts) - | _ -> - env, string_tokens, stmts) - | _ -> - env, string_tokens, stmts - - in fun env term_fn item_fn -> - let env = with_allow_directive true env in - let env, string_tokens, stmts = statement_list env term_fn item_fn ([], []) in - let env = with_allow_directive false env in - List.iter (check env) (List.rev string_tokens); - env, stmts + let check env token = + match token with + | T_STRING (loc, _, _, octal) -> + if octal then strict_error_at env (loc, Parse_error.StrictOctalLiteral) + | _ -> failwith ("Nooo: " ^ token_to_string token ^ "\n") + in + let rec statement_list env term_fn item_fn (string_tokens, stmts) = + match Peek.token env with + | T_EOF -> (env, string_tokens, stmts) + | t when term_fn t -> (env, string_tokens, stmts) + | T_STRING _ as string_token -> + let possible_directive = item_fn env in + let stmts = possible_directive :: stmts in + (match possible_directive with + | (_, Ast.Statement.Expression { Ast.Statement.Expression.directive = Some raw; _ }) -> + (* 14.1.1 says that it has to be "use strict" without any + escapes, so "use\x20strict" is disallowed. *) + let strict = in_strict_mode env || raw = "use strict" in + let string_tokens = string_token :: string_tokens in + statement_list (env |> with_strict strict) term_fn item_fn (string_tokens, stmts) + | _ -> (env, string_tokens, stmts)) + | _ -> (env, string_tokens, stmts) + in + fun env term_fn item_fn -> + let env = with_allow_directive true env in + let (env, string_tokens, stmts) = statement_list env term_fn item_fn ([], []) in + let env = with_allow_directive false env in + List.iter (check env) (List.rev string_tokens); + (env, stmts) (* 15.2 *) and module_item env = @@ -96,73 +131,75 @@ module rec Parse : PARSER = struct match Peek.token env with | T_EXPORT -> Statement.export_declaration ~decorators env | T_IMPORT -> - error_on_decorators env decorators; - let statement = match Peek.ith_token ~i:1 env with - | T_LPAREN -> Statement.expression env - | _ -> Statement.import_declaration env in - statement + error_on_decorators env decorators; + let statement = + match Peek.ith_token ~i:1 env with + | T_LPAREN -> Statement.expression env + | _ -> Statement.import_declaration env + in + statement | T_DECLARE when Peek.ith_token ~i:1 env = T_EXPORT -> - error_on_decorators env decorators; - Statement.declare_export_declaration env + error_on_decorators env decorators; + Statement.declare_export_declaration env | _ -> statement_list_item env ~decorators and module_body_with_directives env term_fn = - let env, directives = directives env term_fn module_item in + let (env, directives) = directives env term_fn module_item in let stmts = module_body ~term_fn env in (* Prepend the directives *) - List.fold_left (fun acc stmt -> stmt::acc) stmts directives + List.fold_left (fun acc stmt -> stmt :: acc) stmts directives and module_body = let rec module_item_list env term_fn acc = match Peek.token env with | T_EOF -> List.rev acc | t when term_fn t -> List.rev acc - | _ -> module_item_list env term_fn (module_item env::acc) - - in fun ~term_fn env -> - module_item_list env term_fn [] + | _ -> module_item_list env term_fn (module_item env :: acc) + in + (fun ~term_fn env -> module_item_list env term_fn []) and statement_list_with_directives ~term_fn env = - let env, directives = directives env term_fn statement_list_item in + let (env, directives) = directives env term_fn statement_list_item in let stmts = statement_list ~term_fn env in (* Prepend the directives *) - let stmts = List.fold_left (fun acc stmt -> stmt::acc) stmts directives in - stmts, (in_strict_mode env) + let stmts = List.fold_left (fun acc stmt -> stmt :: acc) stmts directives in + (stmts, in_strict_mode env) and statement_list = let rec statements env term_fn acc = match Peek.token env with | T_EOF -> List.rev acc | t when term_fn t -> List.rev acc - | _ -> statements env term_fn ((statement_list_item env)::acc) - - in fun ~term_fn env -> statements env term_fn [] + | _ -> statements env term_fn (statement_list_item env :: acc) + in + (fun ~term_fn env -> statements env term_fn []) - - and statement_list_item ?(decorators=[]) env = - if not (Peek.is_class env) - then error_on_decorators env decorators; - Statement.(match Peek.token env with + and statement_list_item ?(decorators = []) env = + if not (Peek.is_class env) then error_on_decorators env decorators; + let open Statement in + match Peek.token env with (* Remember kids, these look like statements but they're not * statements... (see section 13) *) | T_LET -> let_ env - | T_CONST -> var_or_const env + | T_CONST -> const env | _ when Peek.is_function env -> Declaration._function env | _ when Peek.is_class env -> class_declaration env decorators | T_INTERFACE -> interface env | T_DECLARE -> declare env | T_TYPE -> type_alias env | T_OPAQUE -> opaque_type env - | _ -> statement env) + | T_ENUM when (parse_options env).enums -> Declaration.enum_declaration env + | _ -> statement env and statement env = - Statement.(match Peek.token env with + let open Statement in + match Peek.token env with | T_EOF -> - error_unexpected env; - Peek.loc env, Ast.Statement.Empty + error_unexpected ~expected:"the start of a statement" env; + (Peek.loc env, Ast.Statement.Empty { Ast.Statement.Empty.comments = None }) | T_SEMICOLON -> empty env | T_LCURLY -> block env - | T_VAR -> var_or_const env + | T_VAR -> var env | T_BREAK -> break env | T_CONTINUE -> continue env | T_DEBUGGER -> debugger env @@ -197,140 +234,136 @@ module rec Parse : PARSER = struct | T_DEFAULT | T_EXTENDS | T_STATIC - | T_EXPORT (* TODO *) + | T_EXPORT + (* TODO *) | T_ELLIPSIS -> - error_unexpected env; - Eat.token env; - statement env - + error_unexpected ~expected:"the start of a statement" env; + Eat.token env; + statement env (* The rest of these patterns handle ExpressionStatement and its negative lookaheads, which prevent ambiguities. See https://tc39.github.io/ecma262/#sec-expression-statement *) - | _ when Peek.is_function env -> - let func = Declaration._function env in - function_as_statement_error_at env (fst func); - func + let func = Declaration._function env in + function_as_statement_error_at env (fst func); + func | T_LET when Peek.ith_token ~i:1 env = T_LBRACKET -> - (* `let [foo]` is ambiguous: either a let binding pattern, or a - member expression, so it is banned. *) - let loc = Loc.btwn (Peek.loc env) (Peek.ith_loc ~i:1 env) in - error_at env (loc, Parse_error.AmbiguousLetBracket); - Statement.expression env (* recover as a member expression *) + (* `let [foo]` is ambiguous: either a let binding pattern, or a + member expression, so it is banned. *) + let loc = Loc.btwn (Peek.loc env) (Peek.ith_loc ~i:1 env) in + error_at env (loc, Parse_error.AmbiguousLetBracket); + Statement.expression env + (* recover as a member expression *) | _ when Peek.is_identifier env -> maybe_labeled env | _ when Peek.is_class env -> - error_unexpected env; - Eat.token env; - Statement.expression env - | _ -> - Statement.expression env - ) + error_unexpected env; + Eat.token env; + Statement.expression env + | _ -> Statement.expression env and expression env = + let start_loc = Peek.loc env in let expr = Expression.assignment env in match Peek.token env with - | T_COMMA -> Expression.sequence env [expr] - | _ -> - expr + | T_COMMA -> Expression.sequence env ~start_loc [expr] + | _ -> expr and expression_or_pattern env = + let start_loc = Peek.loc env in let expr_or_pattern = Expression.assignment_cover env in match Peek.token env with | T_COMMA -> let expr = Pattern_cover.as_expression env expr_or_pattern in - let seq = Expression.sequence env [expr] in + let seq = Expression.sequence env ~start_loc [expr] in Cover_expr seq - | _ -> - expr_or_pattern + | _ -> expr_or_pattern and conditional = Expression.conditional + and assignment = Expression.assignment + and left_hand_side = Expression.left_hand_side + and object_initializer = Object._initializer + and object_key = Object.key + and class_declaration = Object.class_declaration + and class_expression = Object.class_expression and is_assignable_lhs = Expression.is_assignable_lhs - and assert_identifier_name_is_identifier ?restricted_error env (loc, name) = - match name with - | "let" -> - (* "let" is disallowed as an identifier in a few situations. 11.6.2.1 - * lists them out. It is always disallowed in strict mode *) - if in_strict_mode env then - strict_error_at env (loc, Error.StrictReservedWord) - else if no_let env then - error_at env (loc, Error.UnexpectedToken name) - | "await" -> - (* `allow_await` means that `await` is allowed to be a keyword, - which makes it illegal to use as an identifier. - https://tc39.github.io/ecma262/#sec-identifiers-static-semantics-early-errors *) - if allow_await env then error_at env (loc, Error.UnexpectedReserved) - | "yield" -> - (* `allow_yield` means that `yield` is allowed to be a keyword, - which makes it illegal to use as an identifier. - https://tc39.github.io/ecma262/#sec-identifiers-static-semantics-early-errors *) - if allow_yield env then error_at env (loc, Error.UnexpectedReserved) - else strict_error_at env (loc, Error.StrictReservedWord) - | _ when is_strict_reserved name -> - strict_error_at env (loc, Error.StrictReservedWord) - | _ when is_reserved name -> - error_at env (loc, Error.UnexpectedToken name) - | _ -> - begin match restricted_error with - | Some err when is_restricted name -> strict_error_at env (loc, err) - | _ -> () - end - - and identifier ?restricted_error env = - let id = identifier_name env in - assert_identifier_name_is_identifier ?restricted_error env id; - id + and number = Expression.number and identifier_with_type = let with_loc_helper no_optional restricted_error env = let name = identifier ~restricted_error env in - let optional = not no_optional && Peek.token env = T_PLING in - if optional then begin - if not (should_parse_types env) - then error env Error.UnexpectedTypeAnnotation; + let optional = (not no_optional) && Peek.token env = T_PLING in + if optional then ( + if not (should_parse_types env) then error env Parse_error.UnexpectedTypeAnnotation; Expect.token env T_PLING - end; - let annot = - if Peek.token env = T_COLON - then Some (Type.annotation env) - else None in - Ast.Pattern.Identifier.({ - name; - optional; - annot; - }) - - in fun env ?(no_optional=false) restricted_error -> + ); + let annot = Type.annotation_opt env in + Ast.Pattern.Identifier.{ name; optional; annot } + in + fun env ?(no_optional = false) restricted_error -> with_loc (with_loc_helper no_optional restricted_error) env and block_body env = let start_loc = Peek.loc env in + let leading = Peek.comments env in Expect.token env T_LCURLY; - let term_fn = fun t -> t = T_RCURLY in + let term_fn t = t = T_RCURLY in let body = statement_list ~term_fn env in let end_loc = Peek.loc env in + let internal = + if body = [] then + Peek.comments env + else + [] + in Expect.token env T_RCURLY; - Loc.btwn start_loc end_loc, { Ast.Statement.Block.body; } - - and function_block_body env = + let trailing = Eat.trailing_comments env in + ( Loc.btwn start_loc end_loc, + { + Ast.Statement.Block.body; + comments = Flow_ast_utils.mk_comments_with_internal_opt ~leading ~trailing ~internal; + } ) + + and function_block_body ~expression env = let start_loc = Peek.loc env in + let leading = Peek.comments env in Expect.token env T_LCURLY; - let term_fn = fun t -> t = T_RCURLY in - let body, strict = statement_list_with_directives ~term_fn env in + let term_fn t = t = T_RCURLY in + let (body, strict) = statement_list_with_directives ~term_fn env in let end_loc = Peek.loc env in + let internal = + if body = [] then + Peek.comments env + else + [] + in Expect.token env T_RCURLY; - Loc.btwn start_loc end_loc, { Ast.Statement.Block.body; }, strict + let trailing = + match (expression, Peek.token env) with + | (true, _) + | (_, (T_RCURLY | T_EOF)) -> + Eat.trailing_comments env + | _ when Peek.is_line_terminator env -> Eat.comments_until_next_line env + | _ -> [] + in + ( Loc.btwn start_loc end_loc, + { + Ast.Statement.Block.body; + comments = Flow_ast_utils.mk_comments_with_internal_opt ~leading ~trailing ~internal; + }, + strict ) and jsx_element_or_fragment = JSX.element_or_fragment and pattern = Pattern.pattern + and pattern_from_expr = Pattern.from_expr end @@ -340,23 +373,33 @@ end let do_parse env parser fail = let ast = parser env in let error_list = filter_duplicate_errors (errors env) in - if fail && error_list <> [] - then raise (Error.Error error_list); - ast, error_list + if fail && error_list <> [] then raise (Parse_error.Error error_list); + (ast, error_list) + +(* Makes the input parser expect EOF at the end. Use this to error on trailing + * junk when parsing non-Program nodes. *) +let with_eof parser env = + let ast = parser env in + Expect.token env T_EOF; + ast + +let parse_statement env fail = do_parse env (with_eof Parse.statement_list_item) fail -let parse_program fail ?(token_sink=None) ?(parse_options=None) filename content = +let parse_expression env fail = do_parse env (with_eof Parse.expression) fail + +let parse_program fail ?(token_sink = None) ?(parse_options = None) filename content = let env = init_env ~token_sink ~parse_options filename content in do_parse env Parse.program fail -let program ?(fail=true) ?(token_sink=None) ?(parse_options=None) content = +let program ?(fail = true) ?(token_sink = None) ?(parse_options = None) content = parse_program fail ~token_sink ~parse_options None content -let program_file ?(fail=true) ?(token_sink=None) ?(parse_options=None) content filename = +let program_file ?(fail = true) ?(token_sink = None) ?(parse_options = None) content filename = parse_program fail ~token_sink ~parse_options filename content (* even if fail=false, still raises an error on a totally invalid token, since there's no legitimate fallback. *) -let json_file ?(fail=true) ?(token_sink=None) ?(parse_options=None) content filename = +let json_file ?(fail = true) ?(token_sink = None) ?(parse_options = None) content filename = let env = init_env ~token_sink ~parse_options filename content in match Peek.token env with | T_LBRACKET @@ -369,21 +412,30 @@ let json_file ?(fail=true) ?(token_sink=None) ?(parse_options=None) content file do_parse env Parse.expression fail | T_MINUS -> (match Peek.ith_token ~i:1 env with - | T_NUMBER _ -> - do_parse env Parse.expression fail + | T_NUMBER _ -> do_parse env Parse.expression fail | _ -> - error_unexpected env; - raise (Error.Error (errors env))) + error_unexpected ~expected:"a number" env; + raise (Parse_error.Error (errors env))) | _ -> - error_unexpected env; - raise (Error.Error (errors env)) + let errs = + match errors env with + | [] -> + error_unexpected ~expected:"a valid JSON value" env; + errors env + | errs -> errs + in + raise (Parse_error.Error errs) let jsx_pragma_expression = let left_hand_side env = let ast = Parse.left_hand_side (with_no_new true env) in Expect.token env T_EOF; ast - - in fun content filename -> + in + fun content filename -> let env = init_env ~token_sink:None ~parse_options:None filename content in do_parse env left_hand_side true + +let string_is_valid_identifier_name str = + let lexbuf = Sedlexing.Utf8.from_string str in + Flow_lexer.is_valid_identifier_name lexbuf diff --git a/lib/pattern_cover.ml b/lib/pattern_cover.ml index 8aa482d..43a2d5b 100644 --- a/lib/pattern_cover.ml +++ b/lib/pattern_cover.ml @@ -1,54 +1,55 @@ -(** - * Copyright (c) 2013-present, Facebook, Inc. +(* + * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. *) -open Ast +open Flow_ast open Parser_common open Parser_env module type COVER = sig - val as_expression : env -> pattern_cover -> Loc.t Expression.t - val as_pattern : ?err:Parse_error.t -> env -> pattern_cover -> Loc.t Pattern.t + val as_expression : env -> pattern_cover -> (Loc.t, Loc.t) Expression.t + + val as_pattern : ?err:Parse_error.t -> env -> pattern_cover -> (Loc.t, Loc.t) Pattern.t + val empty_errors : pattern_errors + val rev_append_errors : pattern_errors -> pattern_errors -> pattern_errors + val rev_errors : pattern_errors -> pattern_errors end -module Cover - (Parse: PARSER) -: COVER = struct +module Cover (Parse : PARSER) : COVER = struct let as_expression env = function | Cover_expr expr -> expr | Cover_patt (expr, { if_expr; if_patt = _ }) -> - List.iter (error_at env) if_expr; - expr + List.iter (error_at env) if_expr; + expr let as_pattern ?(err = Parse_error.InvalidLHSInAssignment) env cover = - let expr = match cover with - | Cover_expr expr -> expr - | Cover_patt (expr, { if_expr = _; if_patt }) -> + let expr = + match cover with + | Cover_expr expr -> expr + | Cover_patt (expr, { if_expr = _; if_patt }) -> List.iter (error_at env) if_patt; expr in - - if not (Parse.is_assignable_lhs expr) - then error_at env (fst expr, err); + if not (Parse.is_assignable_lhs expr) then error_at env (fst expr, err); (match expr with - | loc, Ast.Expression.Identifier (_, name) + | (loc, Flow_ast.Expression.Identifier (_, { Flow_ast.Identifier.name; comments = _ })) when is_restricted name -> - strict_error_at env (loc, Error.StrictLHSAssignment) + strict_error_at env (loc, Parse_error.StrictLHSAssignment) | _ -> ()); Parse.pattern_from_expr env expr let empty_errors = { if_patt = []; if_expr = [] } + let rev_append_errors a b = - { if_patt = List.rev_append a.if_patt b.if_patt; - if_expr = List.rev_append a.if_expr b.if_expr; } - let rev_errors a = - { if_patt = List.rev a.if_patt; if_expr = List.rev a.if_expr } + { if_patt = List.rev_append a.if_patt b.if_patt; if_expr = List.rev_append a.if_expr b.if_expr } + + let rev_errors a = { if_patt = List.rev a.if_patt; if_expr = List.rev a.if_expr } end diff --git a/lib/pattern_parser.ml b/lib/pattern_parser.ml index b65c012..f1063e4 100644 --- a/lib/pattern_parser.ml +++ b/lib/pattern_parser.ml @@ -1,66 +1,75 @@ -(** - * Copyright (c) 2013-present, Facebook, Inc. +(* + * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. *) +module Ast = Flow_ast open Token open Parser_common open Parser_env -open Ast +open Flow_ast -module Pattern - (Parse: Parser_common.PARSER) - (Type: Type_parser.TYPE) - = struct +let missing_annot env = Ast.Type.Missing (Peek.loc_skip_lookahead env) + +module Pattern (Parse : Parser_common.PARSER) (Type : Type_parser.TYPE) = struct (* Reinterpret various expressions as patterns. * This is not the correct thing to do and is only used for assignment * expressions. This should be removed and replaced ASAP. *) let rec object_from_expr = - let rec properties env acc = Ast.Expression.Object.(function + let rec properties env acc = + let open Ast.Expression.Object in + function | [] -> List.rev acc - | Property (loc, prop)::remaining -> - let key, pattern, shorthand = match prop with + | Property (loc, prop) :: remaining -> + let acc = + match prop with | Property.Init { key; value; shorthand } -> - key, from_expr env value, shorthand - | Property.Method { key; value = (loc, f) } -> + let open Ast.Expression in + let key = + match key with + | Property.Literal lit -> Pattern.Object.Property.Literal lit + | Property.Identifier id -> Pattern.Object.Property.Identifier id + | Property.PrivateName _ -> failwith "Internal Error: Found object private prop" + | Property.Computed key -> Pattern.Object.Property.Computed key + in + let (pattern, default) = + match value with + | (_loc, Assignment { Assignment.operator = None; left; right; comments = _ }) -> + (left, Some right) + | _ -> (from_expr env value, None) + in + Pattern.Object.Property + (loc, { Pattern.Object.Property.key; pattern; default; shorthand }) + :: acc + | Property.Method { key = _; value = (loc, _) } -> error_at env (loc, Parse_error.MethodInDestructuring); - key, (loc, Pattern.Expression (loc, Ast.Expression.Function f)), false - | Property.Get { key; value = (loc, f) } - | Property.Set { key; value = (loc, f) } -> + acc + | Property.Get { key = _; value = (loc, _); comments = _ } + | Property.Set { key = _; value = (loc, _); comments = _ } -> (* these should never happen *) - error_at env (loc, Parse_error.UnexpectedIdentifier); - key, (loc, Pattern.Expression (loc, Ast.Expression.Function f)), false - in - let key = match key with - | Property.Literal lit -> Pattern.Object.Property.Literal lit - | Property.Identifier id -> Pattern.Object.Property.Identifier id - | Property.PrivateName _ -> failwith "Internal Error: Found object private prop" - | Property.Computed expr -> Pattern.Object.Property.Computed expr - in - let acc = Pattern.(Object.Property (loc, { Object.Property. - key; - pattern; - shorthand; - })) :: acc in - properties env acc remaining - | SpreadProperty (loc, { SpreadProperty.argument; })::[] -> - let acc = Pattern.Object.(RestProperty (loc, { RestProperty. - argument = from_expr env argument; - })) :: acc in - properties env acc [] - | SpreadProperty (loc, _)::remaining -> - error_at env (loc, Parse_error.PropertyAfterRestProperty); - properties env acc remaining - ) in - - fun env (loc, { Ast.Expression.Object.properties = props }) -> - loc, Pattern.(Object { Object. - properties = properties env [] props; - annot = None; - }) + error_at env (loc, Parse_error.Unexpected "identifier"); + acc + in + properties env acc remaining + | [SpreadProperty (loc, { SpreadProperty.argument; comments })] -> + let acc = + Pattern.Object.RestElement + (loc, { Pattern.RestElement.argument = from_expr env argument; comments }) + :: acc + in + properties env acc [] + | SpreadProperty (loc, _) :: remaining -> + error_at env (loc, Parse_error.PropertyAfterRestElement); + properties env acc remaining + in + fun env (loc, { Ast.Expression.Object.properties = props; comments }) -> + ( loc, + Pattern.( + Object + { Object.properties = properties env [] props; annot = missing_annot env; comments }) ) and array_from_expr = (* Convert an Expression to a Pattern if it is a valid @@ -70,173 +79,172 @@ module Pattern let assignment_target env ((loc, _) as expr) = if Parse.is_assignable_lhs expr then Some (from_expr env expr) - else begin + else ( error_at env (loc, Parse_error.InvalidLHSInAssignment); None - end + ) in - - let rec elements env acc = Ast.Expression.(function + let rec elements env acc = + let open Ast.Expression in + function | [] -> List.rev acc - | Some (Spread (loc, { SpreadElement.argument }))::[] -> - (* AssignmentRestElement is a DestructuringAssignmentTarget, see - #prod-AssignmentRestElement *) - let acc = match assignment_target env argument with + | [Array.Spread (loc, { SpreadElement.argument; comments })] -> + (* AssignmentRestElement is a DestructuringAssignmentTarget, see + #prod-AssignmentRestElement *) + let acc = + match assignment_target env argument with | Some argument -> - (Some Pattern.Array.(RestElement (loc, { RestElement.argument; }))) :: acc - | None -> - acc - in - elements env acc [] - | Some (Spread (loc, _))::remaining -> - error_at env (loc, Parse_error.ElementAfterRestElement); - elements env acc remaining - | Some (Expression (_, Assignment { Assignment. - operator = Assignment.Assign; _ - } as expr))::remaining -> - (* AssignmentElement is a `DestructuringAssignmentTarget Initializer`, see - #prod-AssignmentElement *) - let acc = Some (Pattern.Array.Element (from_expr env expr)) :: acc in - elements env acc remaining - | Some (Expression expr)::remaining -> - (* AssignmentElement is a DestructuringAssignmentTarget, see - #prod-AssignmentElement *) - let acc = match assignment_target env expr with - | Some expr -> (Some (Pattern.Array.Element expr)) :: acc + Pattern.Array.RestElement (loc, { Pattern.RestElement.argument; comments }) :: acc | None -> acc - in - elements env acc remaining - | None::remaining -> - elements env (None::acc) remaining - ) + in + elements env acc [] + | Array.Spread (loc, _) :: remaining -> + error_at env (loc, Parse_error.ElementAfterRestElement); + elements env acc remaining + | Array.Expression (loc, Assignment { Assignment.operator = None; left; right; comments = _ }) + :: remaining -> + (* AssignmentElement is a `DestructuringAssignmentTarget Initializer`, see + #prod-AssignmentElement *) + let acc = + Pattern.Array.Element + (loc, { Pattern.Array.Element.argument = left; default = Some right }) + :: acc + in + elements env acc remaining + | Array.Expression expr :: remaining -> + (* AssignmentElement is a DestructuringAssignmentTarget, see + #prod-AssignmentElement *) + let acc = + match assignment_target env expr with + | Some ((loc, _) as expr) -> + let element = + Pattern.Array.Element (loc, { Pattern.Array.Element.argument = expr; default = None }) + in + element :: acc + | None -> acc + in + elements env acc remaining + | Array.Hole loc :: remaining -> elements env (Pattern.Array.Hole loc :: acc) remaining in - - fun env (loc, { Ast.Expression.Array.elements = elems }) -> - loc, Pattern.Array { Pattern.Array. - elements = elements env [] elems; - annot = None; - } + fun env (loc, { Ast.Expression.Array.elements = elems; comments }) -> + ( loc, + Pattern.Array + { Pattern.Array.elements = elements env [] elems; annot = missing_annot env; comments } ) and from_expr env (loc, expr) = - Ast.Expression.(match expr with + let open Ast.Expression in + match expr with | Object obj -> object_from_expr env (loc, obj) - | Array arr -> array_from_expr env (loc, arr) - | Identifier ((id_loc, string_val) as name) -> - (* per #sec-destructuring-assignment-static-semantics-early-errors, - it is a syntax error if IsValidSimpleAssignmentTarget of this - IdentifierReference is false. That happens when `string_val` is - "eval" or "arguments" in strict mode. *) - if in_strict_mode env && is_restricted string_val then - error_at env (id_loc, Parse_error.StrictLHSAssignment) - (* per #prod-IdentifierReference, yield is only a valid - IdentifierReference when [~Yield], and await is only valid - when [~Await]. but per #sec-identifiers-static-semantics-early-errors, - they are already invalid in strict mode, which we should have - already errored about when parsing the expression that we're now - converting into a pattern. *) - else if not (in_strict_mode env) then begin - if allow_yield env && string_val = "yield" then - error_at env (id_loc, Parse_error.YieldAsIdentifierReference) - else if allow_await env && string_val = "await" then - error_at env (id_loc, Parse_error.AwaitAsIdentifierReference) - end; - loc, Pattern.Identifier { Pattern.Identifier. - name; - annot = None; - optional = false; - } - | Assignment { Assignment.operator = Assignment.Assign; left; right } -> - loc, Pattern.Assignment { Pattern.Assignment.left; right } - | expr -> loc, Pattern.Expression (loc, expr)) + | Array arr -> array_from_expr env (loc, arr) + | Identifier ((id_loc, { Identifier.name = string_val; comments = _ }) as name) -> + (* per #sec-destructuring-assignment-static-semantics-early-errors, + it is a syntax error if IsValidSimpleAssignmentTarget of this + IdentifierReference is false. That happens when `string_val` is + "eval" or "arguments" in strict mode. *) + if in_strict_mode env && is_restricted string_val then + error_at env (id_loc, Parse_error.StrictLHSAssignment) + (* per #prod-IdentifierReference, yield is only a valid + IdentifierReference when [~Yield], and await is only valid + when [~Await]. but per #sec-identifiers-static-semantics-early-errors, + they are already invalid in strict mode, which we should have + already errored about when parsing the expression that we're now + converting into a pattern. *) + else if not (in_strict_mode env) then + if allow_yield env && string_val = "yield" then + error_at env (id_loc, Parse_error.YieldAsIdentifierReference) + else if allow_await env && string_val = "await" then + error_at env (id_loc, Parse_error.AwaitAsIdentifierReference); + ( loc, + Pattern.Identifier { Pattern.Identifier.name; annot = missing_annot env; optional = false } + ) + | expr -> (loc, Pattern.Expression (loc, expr)) (* Parse object destructuring pattern *) let rec object_ restricted_error = let rest_property env = - let loc, argument = with_loc (fun env -> - Expect.token env T_ELLIPSIS; - pattern env restricted_error - ) env in - Pattern.Object.(RestProperty (loc, { RestProperty. - argument - })) + let leading = Peek.comments env in + let (loc, argument) = + with_loc + (fun env -> + Expect.token env T_ELLIPSIS; + pattern env restricted_error) + env + in + Pattern.Object.RestElement + ( loc, + { Pattern.RestElement.argument; comments = Flow_ast_utils.mk_comments_opt ~leading () } ) in - let property_default env = match Peek.token env with | T_ASSIGN -> Expect.token env T_ASSIGN; Some (Parse.assignment env) - | _ -> - None - in - - let property_with_default env prop = - match property_default env with - | Some default -> - let loc = Loc.btwn (fst prop) (fst default) in - loc, Pattern.(Assignment Assignment.({ - left = prop; - right = default; - })); - | None -> prop + | _ -> None in - let rec property env = - if Peek.token env = T_ELLIPSIS then begin + if Peek.token env = T_ELLIPSIS then Some (rest_property env) - end else begin + else let start_loc = Peek.loc env in let raw_key = Parse.object_key env in match Peek.token env with | T_COLON -> Expect.token env T_COLON; - let pattern = pattern env restricted_error in - let pattern = property_with_default env pattern in - let loc = Loc.btwn start_loc (fst pattern) in - let key = Ast.Expression.Object.Property.( + let (loc, (pattern, default)) = + with_loc + ~start_loc + (fun env -> + let pattern = pattern env restricted_error in + let default = property_default env in + (pattern, default)) + env + in + let key = + let open Ast.Expression.Object.Property in match raw_key with - | _, Literal lit -> Pattern.Object.Property.Literal lit - | _, Identifier id -> Pattern.Object.Property.Identifier id - | _, PrivateName _ -> failwith "Internal Error: Found object private prop" - | _, Computed expr -> Pattern.Object.Property.Computed expr - ) in - Some Pattern.Object.(Property (loc, Property.({ - key; - pattern; - shorthand = false; - }))) - + | (_, Literal lit) -> Pattern.Object.Property.Literal lit + | (_, Identifier id) -> Pattern.Object.Property.Identifier id + | (_, PrivateName _) -> failwith "Internal Error: Found object private prop" + | (_, Computed key) -> Pattern.Object.Property.Computed key + in + Some + Pattern.Object.(Property (loc, Property.{ key; pattern; default; shorthand = false })) | _ -> (match raw_key with - | _, Ast.Expression.Object.Property.Identifier ((id_loc, string_val) as name) -> + | ( _, + Ast.Expression.Object.Property.Identifier + ((id_loc, { Identifier.name = string_val; comments = _ }) as name) ) -> (* #sec-identifiers-static-semantics-early-errors *) - begin - if is_reserved string_val && string_val <> "yield" && string_val <> "await" then - (* it is a syntax error if `name` is a reserved word other than await or yield *) - error_at env (id_loc, Parse_error.UnexpectedReserved) - else if is_strict_reserved string_val then - (* it is a syntax error if `name` is a strict reserved word, in strict mode *) - strict_error_at env (id_loc, Parse_error.StrictReservedWord) - end; - let pattern = (id_loc, Pattern.Identifier { Pattern.Identifier. - name; - annot = None; - optional = false; - }) in - let pattern = property_with_default env pattern in - let loc = Loc.btwn start_loc (fst pattern) in - Some Pattern.Object.(Property (loc, { Property. - key = Property.Identifier name; - pattern; - shorthand = true; - })) - + if is_reserved string_val && string_val <> "yield" && string_val <> "await" then + (* it is a syntax error if `name` is a reserved word other than await or yield *) + error_at env (id_loc, Parse_error.UnexpectedReserved) + else if is_strict_reserved string_val then + (* it is a syntax error if `name` is a strict reserved word, in strict mode *) + strict_error_at env (id_loc, Parse_error.StrictReservedWord); + let (loc, (pattern, default)) = + with_loc + ~start_loc + (fun env -> + let pattern = + ( id_loc, + Pattern.Identifier + { Pattern.Identifier.name; annot = missing_annot env; optional = false } ) + in + let default = property_default env in + (pattern, default)) + env + in + Some + Pattern.Object.( + Property + ( loc, + { Property.key = Property.Identifier name; pattern; default; shorthand = true } + )) | _ -> - error_unexpected env; (* invalid shorthand destructuring *) - None - ) - end + error_unexpected ~expected:"an identifier" env; + (* invalid shorthand destructuring *) + None) (* seen_rest is true when we've seen a rest element. rest_trailing_comma is the location of * the rest element's trailing command * Trailing comma: `let { ...rest, } = obj` @@ -245,102 +253,132 @@ module Pattern match Peek.token env with | T_EOF | T_RCURLY -> - begin match rest_trailing_comma with - | Some loc -> error_at env (loc, Parse_error.TrailingCommaAfterRestElement) - | None -> () + begin + match rest_trailing_comma with + | Some loc -> error_at env (loc, Parse_error.TrailingCommaAfterRestElement) + | None -> () end; List.rev acc | _ -> (match property env with - | Some (Pattern.Object.Property (loc, _) | Pattern.Object.RestProperty (loc, _) as prop) -> + | Some ((Pattern.Object.Property (loc, _) | Pattern.Object.RestElement (loc, _)) as prop) -> let rest_trailing_comma = - if seen_rest - then begin - error_at env (loc, Parse_error.PropertyAfterRestProperty); + if seen_rest then ( + error_at env (loc, Parse_error.PropertyAfterRestElement); None - end - else rest_trailing_comma + ) else + rest_trailing_comma + in + let (seen_rest, rest_trailing_comma) = + match prop with + | Pattern.Object.RestElement _ -> + ( true, + if Peek.token env = T_COMMA then + Some (Peek.loc env) + else + None ) + | _ -> (seen_rest, rest_trailing_comma) in - let seen_rest, rest_trailing_comma = begin match prop with - | Pattern.Object.RestProperty _ -> - true, if Peek.token env = T_COMMA then Some (Peek.loc env) else None - | _ -> seen_rest, rest_trailing_comma end in - if Peek.token env <> T_RCURLY - then Expect.token env T_COMMA; - properties env ~seen_rest ~rest_trailing_comma (prop::acc) + if Peek.token env <> T_RCURLY then Expect.token env T_COMMA; + properties env ~seen_rest ~rest_trailing_comma (prop :: acc) | None -> properties env ~seen_rest ~rest_trailing_comma acc) in with_loc (fun env -> - Expect.token env T_LCURLY; - let properties = properties env ~seen_rest:false ~rest_trailing_comma:None [] in - Expect.token env T_RCURLY; - let annot = - if Peek.token env = T_COLON then Some (Type.annotation env) - else None - in - Pattern.Object { Pattern.Object.properties; annot; } - ) + let leading = Peek.comments env in + Expect.token env T_LCURLY; + let properties = properties env ~seen_rest:false ~rest_trailing_comma:None [] in + let internal = Peek.comments env in + Expect.token env T_RCURLY; + let trailing = Eat.trailing_comments env in + let annot = + if Peek.token env = T_COLON then + Ast.Type.Available (Type.annotation env) + else + missing_annot env + in + Pattern.Object + { + Pattern.Object.properties; + annot; + comments = Flow_ast_utils.mk_comments_with_internal_opt ~leading ~trailing ~internal; + }) (* Parse array destructuring pattern *) and array_ restricted_error = let rec elements env acc = match Peek.token env with | T_EOF - | T_RBRACKET -> List.rev acc + | T_RBRACKET -> + List.rev acc | T_COMMA -> + let loc = Peek.loc env in Expect.token env T_COMMA; - elements env (None::acc) + elements env (Pattern.Array.Hole loc :: acc) | T_ELLIPSIS -> - let loc, argument = with_loc (fun env -> - Expect.token env T_ELLIPSIS; - pattern env restricted_error - ) env in - let element = Pattern.Array.(RestElement (loc, { RestElement. - argument; - })) in + let leading = Peek.comments env in + let (loc, argument) = + with_loc + (fun env -> + Expect.token env T_ELLIPSIS; + pattern env restricted_error) + env + in + let element = + Pattern.Array.RestElement + ( loc, + { + Pattern.RestElement.argument; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + } ) + in (* rest elements are always last, the closing ] should be next. but if not, error and keep going so we recover gracefully by parsing the rest of the elements. *) - if Peek.token env <> T_RBRACKET then begin + if Peek.token env <> T_RBRACKET then ( error_at env (loc, Parse_error.ElementAfterRestElement); if Peek.token env = T_COMMA then Eat.token env - end; - elements env ((Some element)::acc) + ); + elements env (element :: acc) | _ -> - let pattern = pattern env restricted_error in - let pattern = match Peek.token env with - | T_ASSIGN -> - Expect.token env T_ASSIGN; - let default = Parse.assignment env in - let loc = Loc.btwn (fst pattern) (fst default) in - loc, Pattern.(Assignment Assignment.({ - left = pattern; - right = default; - })) - | _ -> pattern + let (loc, (pattern, default)) = + with_loc + (fun env -> + let pattern = pattern env restricted_error in + let default = + match Peek.token env with + | T_ASSIGN -> + Expect.token env T_ASSIGN; + Some (Parse.assignment env) + | _ -> None + in + (pattern, default)) + env in - let element = Pattern.Array.(Element pattern) in + let element = Pattern.Array.(Element (loc, { Element.argument = pattern; default })) in if Peek.token env <> T_RBRACKET then Expect.token env T_COMMA; - elements env ((Some element)::acc) + elements env (element :: acc) in with_loc (fun env -> - Expect.token env T_LBRACKET; - let elements = elements env [] in - Expect.token env T_RBRACKET; - let annot = - if Peek.token env = T_COLON then Some (Type.annotation env) - else None - in - Pattern.Array { Pattern.Array.elements; annot; } - ) + let leading = Peek.comments env in + Expect.token env T_LBRACKET; + let elements = elements env [] in + let internal = Peek.comments env in + Expect.token env T_RBRACKET; + let annot = + if Peek.token env = T_COLON then + Ast.Type.Available (Type.annotation env) + else + missing_annot env + in + let trailing = Eat.trailing_comments env in + let comments = Flow_ast_utils.mk_comments_with_internal_opt ~leading ~trailing ~internal in + Pattern.Array { Pattern.Array.elements; annot; comments }) and pattern env restricted_error = match Peek.token env with - | T_LCURLY -> - object_ restricted_error env - | T_LBRACKET -> - array_ restricted_error env + | T_LCURLY -> object_ restricted_error env + | T_LBRACKET -> array_ restricted_error env | _ -> - let loc, id = Parse.identifier_with_type env restricted_error in - loc, Pattern.Identifier id + let (loc, id) = Parse.identifier_with_type env restricted_error in + (loc, Pattern.Identifier id) end diff --git a/lib/relativeLoc.ml b/lib/relativeLoc.ml new file mode 100644 index 0000000..4cd183b --- /dev/null +++ b/lib/relativeLoc.ml @@ -0,0 +1,48 @@ +(* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + *) + +type relative_position = { + line_offset: int; + (* If line_offset is 0, this is the column offset. If line_offset is nonzero, this is the absolute + * column. *) + column_or_offset: int; +} + +type t = { + start: Loc.position; + end_: relative_position; +} + +let relative_position_of_position base_pos pos = + Loc.( + let line_offset = pos.line - base_pos.line in + let column_or_offset = + if line_offset = 0 then + pos.column - base_pos.column + else + pos.column + in + { line_offset; column_or_offset }) + +let position_of_relative_position base_pos relative_pos = + Loc.( + let line = base_pos.line + relative_pos.line_offset in + let column = + if relative_pos.line_offset = 0 then + base_pos.column + relative_pos.column_or_offset + else + relative_pos.column_or_offset + in + { line; column }) + +let of_loc loc = + let end_ = relative_position_of_position loc.Loc.start loc.Loc._end in + { start = loc.Loc.start; end_ } + +let to_loc relative_loc source = + let end_ = position_of_relative_position relative_loc.start relative_loc.end_ in + { Loc.source; start = relative_loc.start; _end = end_ } diff --git a/lib/relativeLoc.mli b/lib/relativeLoc.mli new file mode 100644 index 0000000..49466eb --- /dev/null +++ b/lib/relativeLoc.mli @@ -0,0 +1,27 @@ +(* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + *) + +(* + * When we store data to the shared heap, we first marshal it using OCaml's marshaller, then we + * compress it. OCaml's marshaling algorithm uses a more compact representation for smaller + * integers, so it is advantageous to use small integers rather than large ones when serializing to + * the shared heap. + * + * To that end, this utility converts locations so that the end position is stored relative to the + * start position, rather than storing it in absolute terms. The intuition is that the end location + * will always be closer to (or as close as) the start position than to the start of the file, so + * the numbers stored will be smaller and therefore have a more compact representation, on average. + * + * This does not change the in-memory size of the location. It does, however make it smaller to + * serialize. + * *) + +type t + +val of_loc : Loc.t -> t + +val to_loc : t -> File_key.t option -> Loc.t diff --git a/lib/statement_parser.ml b/lib/statement_parser.ml index 09e7e5d..bfa3aae 100644 --- a/lib/statement_parser.ml +++ b/lib/statement_parser.ml @@ -1,57 +1,88 @@ -(** - * Copyright (c) 2013-present, Facebook, Inc. +(* + * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. *) +module Ast = Flow_ast open Token open Parser_env -open Ast -module Error = Parse_error -module SSet = Set.Make(String) - +open Flow_ast +module SSet = Set.Make (String) open Parser_common +open Comment_attachment module type STATEMENT = sig - val for_: env -> Loc.t Statement.t - val if_: env -> Loc.t Statement.t - val let_: env -> Loc.t Statement.t - val try_: env -> Loc.t Statement.t - val while_: env -> Loc.t Statement.t - val with_: env -> Loc.t Statement.t - val block: env -> Loc.t Statement.t - val break: env -> Loc.t Statement.t - val continue: env -> Loc.t Statement.t - val debugger: env -> Loc.t Statement.t - val declare: ?in_module:bool -> env -> Loc.t Statement.t - val declare_export_declaration: ?allow_export_type:bool -> env -> Loc.t Statement.t - val declare_opaque_type : env -> Loc.t Statement.t - val do_while: env -> Loc.t Statement.t - val empty: env -> Loc.t Statement.t - val export_declaration: decorators:Loc.t Class.Decorator.t list -> env -> Loc.t Statement.t - val expression: env -> Loc.t Statement.t - val import_declaration: env -> Loc.t Statement.t - val interface: env -> Loc.t Statement.t - val maybe_labeled: env -> Loc.t Statement.t - val opaque_type : env -> Loc.t Statement.t - val return: env -> Loc.t Statement.t - val switch: env -> Loc.t Statement.t - val throw: env -> Loc.t Statement.t - val type_alias: env -> Loc.t Statement.t - val var_or_const: env -> Loc.t Statement.t + val for_ : env -> (Loc.t, Loc.t) Statement.t + + val if_ : env -> (Loc.t, Loc.t) Statement.t + + val let_ : env -> (Loc.t, Loc.t) Statement.t + + val try_ : env -> (Loc.t, Loc.t) Statement.t + + val while_ : env -> (Loc.t, Loc.t) Statement.t + + val with_ : env -> (Loc.t, Loc.t) Statement.t + + val block : env -> (Loc.t, Loc.t) Statement.t + + val break : env -> (Loc.t, Loc.t) Statement.t + + val continue : env -> (Loc.t, Loc.t) Statement.t + + val debugger : env -> (Loc.t, Loc.t) Statement.t + + val declare : ?in_module:bool -> env -> (Loc.t, Loc.t) Statement.t + + val declare_export_declaration : ?allow_export_type:bool -> env -> (Loc.t, Loc.t) Statement.t + + val declare_opaque_type : env -> (Loc.t, Loc.t) Statement.t + + val do_while : env -> (Loc.t, Loc.t) Statement.t + + val empty : env -> (Loc.t, Loc.t) Statement.t + + val export_declaration : + decorators:(Loc.t, Loc.t) Class.Decorator.t list -> env -> (Loc.t, Loc.t) Statement.t + + val expression : env -> (Loc.t, Loc.t) Statement.t + + val import_declaration : env -> (Loc.t, Loc.t) Statement.t + + val interface : env -> (Loc.t, Loc.t) Statement.t + + val maybe_labeled : env -> (Loc.t, Loc.t) Statement.t + + val opaque_type : env -> (Loc.t, Loc.t) Statement.t + + val return : env -> (Loc.t, Loc.t) Statement.t + + val switch : env -> (Loc.t, Loc.t) Statement.t + + val throw : env -> (Loc.t, Loc.t) Statement.t + + val type_alias : env -> (Loc.t, Loc.t) Statement.t + + val var : env -> (Loc.t, Loc.t) Statement.t + + val const : env -> (Loc.t, Loc.t) Statement.t end module Statement - (Parse: PARSER) - (Type: Type_parser.TYPE) - (Declaration: Declaration_parser.DECLARATION) - (Object: Object_parser.OBJECT) - (Pattern_cover : Pattern_cover.COVER) -: STATEMENT = struct + (Parse : PARSER) + (Type : Type_parser.TYPE) + (Declaration : Declaration_parser.DECLARATION) + (Object : Object_parser.OBJECT) + (Pattern_cover : Pattern_cover.COVER) : STATEMENT = struct type for_lhs = | For_expression of pattern_cover - | For_declaration of (Loc.t * Loc.t Ast.Statement.VariableDeclaration.t) + | For_declaration of (Loc.t * (Loc.t, Loc.t) Ast.Statement.VariableDeclaration.t) + + type semicolon_type = + | Explicit of Loc.t Comment.t list + | Implicit of Comment_attachment.trailing_and_remover_result (* FunctionDeclaration is not a valid Statement, but Annex B sometimes allows it. However, AsyncFunctionDeclaration and GeneratorFunctionDeclaration are never @@ -59,218 +90,389 @@ module Statement recover gracefully. *) let function_as_statement env = let func = Declaration._function env in - if in_strict_mode env then + ( if in_strict_mode env then function_as_statement_error_at env (fst func) - else begin match func with - | _, Ast.Statement.FunctionDeclaration { Ast.Function.async = true; _ } -> - error_at env (fst func, Parse_error.AsyncFunctionAsStatement) - | _, Ast.Statement.FunctionDeclaration { Ast.Function.generator = true; _ } -> - error_at env (fst func, Parse_error.GeneratorFunctionAsStatement) - | _ -> () - end; + else + let open Ast.Statement in + match func with + | (loc, FunctionDeclaration { Ast.Function.async = true; _ }) -> + error_at env (loc, Parse_error.AsyncFunctionAsStatement) + | (loc, FunctionDeclaration { Ast.Function.generator = true; _ }) -> + error_at env (loc, Parse_error.GeneratorFunctionAsStatement) + | _ -> () ); func + (* https://tc39.es/ecma262/#sec-exports-static-semantics-early-errors *) + let assert_identifier_name_is_identifier + ?restricted_error env (loc, { Ast.Identifier.name; comments = _ }) = + match name with + | "let" -> + (* "let" is disallowed as an identifier in a few situations. 11.6.2.1 + lists them out. It is always disallowed in strict mode *) + if in_strict_mode env then + strict_error_at env (loc, Parse_error.StrictReservedWord) + else if no_let env then + error_at env (loc, Parse_error.Unexpected (Token.quote_token_value name)) + | "await" -> + (* `allow_await` means that `await` is allowed to be a keyword, + which makes it illegal to use as an identifier. + https://tc39.github.io/ecma262/#sec-identifiers-static-semantics-early-errors *) + if allow_await env then error_at env (loc, Parse_error.UnexpectedReserved) + | "yield" -> + (* `allow_yield` means that `yield` is allowed to be a keyword, + which makes it illegal to use as an identifier. + https://tc39.github.io/ecma262/#sec-identifiers-static-semantics-early-errors *) + if allow_yield env then + error_at env (loc, Parse_error.UnexpectedReserved) + else + strict_error_at env (loc, Parse_error.StrictReservedWord) + | _ when is_strict_reserved name -> strict_error_at env (loc, Parse_error.StrictReservedWord) + | _ when is_reserved name -> + error_at env (loc, Parse_error.Unexpected (Token.quote_token_value name)) + | _ -> + begin + match restricted_error with + | Some err when is_restricted name -> strict_error_at env (loc, err) + | _ -> () + end + + let string_literal env (loc, value, raw, octal) = + if octal then strict_error env Parse_error.StrictOctalLiteral; + let leading = Peek.comments env in + Expect.token env (T_STRING (loc, value, raw, octal)); + let trailing = Eat.trailing_comments env in + ( loc, + { StringLiteral.value; raw; comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () } + ) + + (* Semicolon insertion is handled here :(. There seem to be 2 cases where + * semicolons are inserted. First, if we reach the EOF. Second, if the next + * token is } or is separated by a LineTerminator. + *) + let semicolon ?(expected = "the token `;`") ?(required = true) env = + match Peek.token env with + | T_EOF + | T_RCURLY -> + Implicit { trailing = Eat.trailing_comments env; remove_trailing = (fun x _ -> x) } + | T_SEMICOLON -> + Eat.token env; + (match Peek.token env with + | T_EOF + | T_RCURLY -> + Explicit (Eat.trailing_comments env) + | _ when Peek.is_line_terminator env -> Explicit (Eat.comments_until_next_line env) + | _ -> Explicit []) + | _ when Peek.is_line_terminator env -> + Implicit (Comment_attachment.trailing_and_remover_after_last_line env) + | _ -> + if required then error_unexpected ~expected env; + Explicit [] + + (* Consumes and returns the trailing comments after the end of a statement. Also returns + a remover that can remove all comments that are not trailing the previous token. + + If a statement is the end of a block or file, all comments are trailing. + Otherwise, if a statement is followed by a new line, only comments on the current + line are trailing. If a statement is not followed by a new line, it does not have + trailing comments as they are instead leading comments for the next statement. *) + let statement_end_trailing_comments env = + match Peek.token env with + | T_EOF + | T_RCURLY -> + { trailing = Eat.trailing_comments env; remove_trailing = (fun x _ -> x) } + | _ when Peek.is_line_terminator env -> + Comment_attachment.trailing_and_remover_after_last_line env + | _ -> Comment_attachment.trailing_and_remover_after_last_loc env + + let variable_declaration_end ~kind env declarations = + match semicolon env with + | Explicit comments -> (comments, declarations) + | Implicit { remove_trailing; _ } -> + (* Remove trailing comments from the last declarator *) + let declarations = + match List.rev declarations with + | [] -> [] + | decl :: decls -> + let decl' = + remove_trailing decl (fun remover decl -> remover#variable_declarator ~kind decl) + in + List.rev (decl' :: decls) + in + ([], declarations) + let rec empty env = let loc = Peek.loc env in + let leading = Peek.comments env in Expect.token env T_SEMICOLON; - loc, Statement.Empty + let { trailing; _ } = statement_end_trailing_comments env in + ( loc, + Statement.Empty + { Statement.Empty.comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () } ) and break env = - let loc, label = with_loc (fun env -> - Expect.token env T_BREAK; - let label = - if Peek.token env = T_SEMICOLON || Peek.is_implicit_semicolon env - then None - else begin - let (_, name) as label = - Parse.identifier env in - if not (SSet.mem name (labels env)) - then error env (Error.UnknownLabel name); - Some label - end - in - Eat.semicolon env; - label - ) env in - if label = None && not (in_loop env || in_switch env) - then error_at env (loc, Error.IllegalBreak); - loc, Statement.Break { Statement.Break.label } + let leading = Peek.comments env in + let (loc, (label, trailing)) = + with_loc + (fun env -> + Expect.token env T_BREAK; + let label = + if Peek.token env = T_SEMICOLON || Peek.is_implicit_semicolon env then + None + else + let ((_, { Identifier.name; comments = _ }) as label) = Parse.identifier env in + if not (SSet.mem name (labels env)) then error env (Parse_error.UnknownLabel name); + Some label + in + let (trailing, label) = + match (semicolon env, label) with + | (Explicit trailing, _) + | (Implicit { trailing; _ }, None) -> + (trailing, label) + | (Implicit { remove_trailing; _ }, Some label) -> + ([], Some (remove_trailing label (fun remover label -> remover#identifier label))) + in + (label, trailing)) + env + in + if label = None && not (in_loop env || in_switch env) then + error_at env (loc, Parse_error.IllegalBreak); + let comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () in + (loc, Statement.Break { Statement.Break.label; comments }) and continue env = - let loc, label = with_loc (fun env -> - Expect.token env T_CONTINUE; - let label = - if Peek.token env = T_SEMICOLON || Peek.is_implicit_semicolon env - then None - else begin - let (_, name) as label = - Parse.identifier env in - if not (SSet.mem name (labels env)) - then error env (Error.UnknownLabel name); - Some label - end in - Eat.semicolon env; - label - ) env in - if not (in_loop env) then error_at env (loc, Error.IllegalContinue); - loc, Statement.Continue { Statement.Continue.label } - - and debugger = with_loc (fun env -> - Expect.token env T_DEBUGGER; - Eat.semicolon env; - Statement.Debugger - ) - - and do_while = with_loc (fun env -> - Expect.token env T_DO; - let body = Parse.statement (env |> with_in_loop true) in + let leading = Peek.comments env in + let (loc, (label, trailing)) = + with_loc + (fun env -> + Expect.token env T_CONTINUE; + let label = + if Peek.token env = T_SEMICOLON || Peek.is_implicit_semicolon env then + None + else + let ((_, { Identifier.name; comments = _ }) as label) = Parse.identifier env in + if not (SSet.mem name (labels env)) then error env (Parse_error.UnknownLabel name); + Some label + in + let (trailing, label) = + match (semicolon env, label) with + | (Explicit trailing, _) + | (Implicit { trailing; _ }, None) -> + (trailing, label) + | (Implicit { remove_trailing; _ }, Some label) -> + ([], Some (remove_trailing label (fun remover label -> remover#identifier label))) + in + (label, trailing)) + env + in + if not (in_loop env) then error_at env (loc, Parse_error.IllegalContinue); + ( loc, + Statement.Continue + { + Statement.Continue.label; + comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + } ) + + and debugger = + with_loc (fun env -> + let leading = Peek.comments env in + Expect.token env T_DEBUGGER; + let pre_semicolon_trailing = + if Peek.token env = T_SEMICOLON then + Eat.trailing_comments env + else + [] + in + let trailing = + match semicolon env with + | Explicit trailing + | Implicit { trailing; _ } -> + pre_semicolon_trailing @ trailing + in + Statement.Debugger + { Statement.Debugger.comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () }) - (* Annex B allows labelled FunctionDeclarations (see - sec-labelled-function-declarations), but not in IterationStatement - (see sec-semantics-static-semantics-early-errors). *) - if not (in_strict_mode env) && is_labelled_function body - then function_as_statement_error_at env (fst body); - - Expect.token env T_WHILE; - Expect.token env T_LPAREN; - let test = Parse.expression env in - Expect.token env T_RPAREN; - (* The rules of automatic semicolon insertion in ES5 don't mention this, - * but the semicolon after a do-while loop is optional. This is properly - * specified in ES6 *) - if Peek.token env = T_SEMICOLON - then Eat.semicolon env; - Statement.DoWhile { Statement.DoWhile. - body; - test; - } - ) + and do_while = + with_loc (fun env -> + let leading = Peek.comments env in + Expect.token env T_DO; + let body = Parse.statement (env |> with_in_loop true) in + (* Annex B allows labelled FunctionDeclarations (see + sec-labelled-function-declarations), but not in IterationStatement + (see sec-semantics-static-semantics-early-errors). *) + if (not (in_strict_mode env)) && is_labelled_function body then + function_as_statement_error_at env (fst body); + let pre_keyword_trailing = Eat.trailing_comments env in + Expect.token env T_WHILE; + let pre_cond_trailing = Eat.trailing_comments env in + Expect.token env T_LPAREN; + let test = Parse.expression env in + Expect.token env T_RPAREN; + let past_cond_trailing = + if Peek.token env = T_SEMICOLON then + Eat.trailing_comments env + else + [] + in + (* The rules of automatic semicolon insertion in ES5 don't mention this, + * but the semicolon after a do-while loop is optional. This is properly + * specified in ES6 *) + let past_cond_trailing = + match semicolon ~required:false env with + | Explicit trailing -> past_cond_trailing @ trailing + | Implicit { trailing; _ } -> trailing + in + let trailing = pre_keyword_trailing @ pre_cond_trailing @ past_cond_trailing in + Statement.DoWhile + { + Statement.DoWhile.body; + test; + comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + }) and for_ = let assert_can_be_forin_or_forof env err = function - | loc, { Statement.VariableDeclaration.declarations; _; } -> - (* Only a single declarator is allowed, without an init. So - * something like - * - * for (var x in y) {} - * - * is allowed, but we disallow - * - * for (var x, y in z) {} - * for (var x = 42 in y) {} - *) - (match declarations with - | [ (_, { Statement.VariableDeclaration.Declarator.init = None; _; }) ] -> () - | _ -> error_at env (loc, err)) + | (loc, { Statement.VariableDeclaration.declarations; _ }) -> + (* Only a single declarator is allowed, without an init. So + * something like + * + * for (var x in y) {} + * + * is allowed, but we disallow + * + * for (var x, y in z) {} + * for (var x = 42 in y) {} + *) + (match declarations with + | [(_, { Statement.VariableDeclaration.Declarator.init = None; _ })] -> () + | _ -> error_at env (loc, err)) in - (* Annex B allows labelled FunctionDeclarations (see sec-labelled-function-declarations), but not in IterationStatement (see sec-semantics-static-semantics-early-errors). *) let assert_not_labelled_function env body = - if not (in_strict_mode env) && is_labelled_function body - then function_as_statement_error_at env (fst body) - else () + if (not (in_strict_mode env)) && is_labelled_function body then + function_as_statement_error_at env (fst body) + else + () in - with_loc (fun env -> - Expect.token env T_FOR; - let async = allow_await env && Expect.maybe env T_AWAIT in - Expect.token env T_LPAREN; - - let init, errs = - let env = env |> with_no_in true in - match Peek.token env with - | T_SEMICOLON -> None, [] - | T_LET -> - let loc, (decl, errs) = with_loc Declaration.let_ env in - Some (For_declaration (loc, decl)), errs - | T_CONST -> - let loc, (decl, errs) = with_loc Declaration.const env in - Some (For_declaration (loc, decl)), errs - | T_VAR -> - let loc, (decl, errs) = with_loc Declaration.var env in - Some (For_declaration (loc, decl)), errs - | _ -> + let leading = Peek.comments env in + Expect.token env T_FOR; + let async = allow_await env && Eat.maybe env T_AWAIT in + let leading = leading @ Peek.comments env in + Expect.token env T_LPAREN; + let comments = Flow_ast_utils.mk_comments_opt ~leading () in + let (init, errs) = + let env = env |> with_no_in true in + match Peek.token env with + | T_SEMICOLON -> (None, []) + | T_LET -> + let (loc, (declarations, leading, errs)) = with_loc Declaration.let_ env in + ( Some + (For_declaration + ( loc, + { + Statement.VariableDeclaration.kind = Statement.VariableDeclaration.Let; + declarations; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + } )), + errs ) + | T_CONST -> + let (loc, (declarations, leading, errs)) = with_loc Declaration.const env in + ( Some + (For_declaration + ( loc, + { + Statement.VariableDeclaration.kind = Statement.VariableDeclaration.Const; + declarations; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + } )), + errs ) + | T_VAR -> + let (loc, (declarations, leading, errs)) = with_loc Declaration.var env in + ( Some + (For_declaration + ( loc, + { + Statement.VariableDeclaration.kind = Statement.VariableDeclaration.Var; + declarations; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + } )), + errs ) + | _ -> let expr = Parse.expression_or_pattern (env |> with_no_let true) in - Some (For_expression expr), [] - in - - match Peek.token env with - (* If `async` is true, this must be a for-await-of loop. *) - | t when t = T_OF || async -> - let left = Statement.(match init with - | Some (For_declaration decl) -> - assert_can_be_forin_or_forof env Error.InvalidLHSInForOf decl; - ForOf.LeftDeclaration decl - | Some (For_expression expr) -> - (* #sec-for-in-and-for-of-statements-static-semantics-early-errors *) - let patt = Pattern_cover.as_pattern ~err:Error.InvalidLHSInForOf env expr in - ForOf.LeftPattern patt - | None -> assert false) in + (Some (For_expression expr), []) + in + match Peek.token env with + (* If `async` is true, this must be a for-await-of loop. *) + | t when t = T_OF || async -> + let left = + let open Statement in + match init with + | Some (For_declaration decl) -> + assert_can_be_forin_or_forof env Parse_error.InvalidLHSInForOf decl; + ForOf.LeftDeclaration decl + | Some (For_expression expr) -> + (* #sec-for-in-and-for-of-statements-static-semantics-early-errors *) + let patt = Pattern_cover.as_pattern ~err:Parse_error.InvalidLHSInForOf env expr in + ForOf.LeftPattern patt + | None -> assert false + in (* This is a for of loop *) Expect.token env T_OF; let right = Parse.assignment env in Expect.token env T_RPAREN; let body = Parse.statement (env |> with_in_loop true) in assert_not_labelled_function env body; - Statement.ForOf { Statement.ForOf. - left; - right; - body; - async; - } - | T_IN -> - let left = match init with - | Some (For_declaration decl) -> - assert_can_be_forin_or_forof env Error.InvalidLHSInForIn decl; - Statement.ForIn.LeftDeclaration decl - | Some (For_expression expr) -> - (* #sec-for-in-and-for-of-statements-static-semantics-early-errors *) - let patt = Pattern_cover.as_pattern ~err:Error.InvalidLHSInForIn env expr in - Statement.ForIn.LeftPattern patt - | None -> assert false in + Statement.ForOf { Statement.ForOf.left; right; body; await = async; comments } + | T_IN -> + let left = + match init with + | Some (For_declaration decl) -> + assert_can_be_forin_or_forof env Parse_error.InvalidLHSInForIn decl; + Statement.ForIn.LeftDeclaration decl + | Some (For_expression expr) -> + (* #sec-for-in-and-for-of-statements-static-semantics-early-errors *) + let patt = Pattern_cover.as_pattern ~err:Parse_error.InvalidLHSInForIn env expr in + Statement.ForIn.LeftPattern patt + | None -> assert false + in (* This is a for in loop *) Expect.token env T_IN; let right = Parse.expression env in Expect.token env T_RPAREN; let body = Parse.statement (env |> with_in_loop true) in assert_not_labelled_function env body; - Statement.ForIn { Statement.ForIn. - left; - right; - body; - each = false; - } - | _ -> + Statement.ForIn { Statement.ForIn.left; right; body; each = false; comments } + | _ -> (* This is a for loop *) errs |> List.iter (error_at env); Expect.token env T_SEMICOLON; - let init = match init with - | Some (For_declaration decl) -> Some (Statement.For.InitDeclaration decl) - | Some (For_expression expr) -> - Some (Statement.For.InitExpression (Pattern_cover.as_expression env expr)) - | None -> None in - let test = match Peek.token env with - | T_SEMICOLON -> None - | _ -> Some (Parse.expression env) in + let init = + match init with + | Some (For_declaration decl) -> Some (Statement.For.InitDeclaration decl) + | Some (For_expression expr) -> + Some (Statement.For.InitExpression (Pattern_cover.as_expression env expr)) + | None -> None + in + let test = + match Peek.token env with + | T_SEMICOLON -> None + | _ -> Some (Parse.expression env) + in Expect.token env T_SEMICOLON; - let update = match Peek.token env with - | T_RPAREN -> None - | _ -> Some (Parse.expression env) in + let update = + match Peek.token env with + | T_RPAREN -> None + | _ -> Some (Parse.expression env) + in Expect.token env T_RPAREN; let body = Parse.statement (env |> with_in_loop true) in assert_not_labelled_function env body; - Statement.For { Statement.For. - init; - test; - update; - body; - } - ) + Statement.For { Statement.For.init; test; update; body; comments }) and if_ = - (** + (* * Either the consequent or alternate of an if statement *) let if_branch env = @@ -283,452 +485,722 @@ module Statement else Parse.statement env in - (* Annex B allows labelled FunctionDeclarations in non-strict mode (see sec-labelled-function-declarations), but not in IfStatement (see sec-if-statement-static-semantics-early-errors). *) - if not (in_strict_mode env) && is_labelled_function stmt - then function_as_statement_error_at env (fst stmt); + if (not (in_strict_mode env)) && is_labelled_function stmt then + function_as_statement_error_at env (fst stmt); stmt in - + let alternate env = + let leading = Peek.comments env in + Expect.token env T_ELSE; + let body = if_branch env in + { Statement.If.Alternate.body; comments = Flow_ast_utils.mk_comments_opt ~leading () } + in with_loc (fun env -> - Expect.token env T_IF; - Expect.token env T_LPAREN; - let test = Parse.expression env in - Expect.token env T_RPAREN; - let consequent = if_branch env in - let alternate = if Peek.token env = T_ELSE - then begin - Expect.token env T_ELSE; - Some (if_branch env) - end else None in - Statement.If { Statement.If. - test; - consequent; - alternate; - } - ) - - and return = with_loc (fun env -> - if not (in_function env) - then error env Error.IllegalReturn; - Expect.token env T_RETURN; - let argument = - if Peek.token env = T_SEMICOLON || Peek.is_implicit_semicolon env - then None - else Some (Parse.expression env) in - Eat.semicolon env; - Statement.Return { Statement.Return. - argument; - } - ) + let pre_if_leading = Peek.comments env in + Expect.token env T_IF; + let pre_cond_leading = Peek.comments env in + let leading = pre_if_leading @ pre_cond_leading in + Expect.token env T_LPAREN; + let test = Parse.expression env in + Expect.token env T_RPAREN; + let consequent = if_branch env in + let alternate = + if Peek.token env = T_ELSE then + Some (with_loc alternate env) + else + None + in + Statement.If + { + Statement.If.test; + consequent; + alternate; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + }) + + and return = + with_loc (fun env -> + if not (in_function env) then error env Parse_error.IllegalReturn; + let leading = Peek.comments env in + Expect.token env T_RETURN; + let trailing = + if Peek.token env = T_SEMICOLON then + Eat.trailing_comments env + else + [] + in + let argument = + if Peek.token env = T_SEMICOLON || Peek.is_implicit_semicolon env then + None + else + Some (Parse.expression env) + in + let (trailing, argument) = + match (semicolon env, argument) with + | (Explicit comments, _) + | (Implicit { trailing = comments; _ }, None) -> + (trailing @ comments, argument) + | (Implicit { remove_trailing; _ }, Some arg) -> + (trailing, Some (remove_trailing arg (fun remover arg -> remover#expression arg))) + in + Statement.Return + { + Statement.Return.argument; + comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + }) and switch = let rec case_list env (seen_default, acc) = match Peek.token env with | T_EOF - | T_RCURLY -> List.rev acc + | T_RCURLY -> + List.rev acc | _ -> let start_loc = Peek.loc env in - let test = match Peek.token env with - | T_DEFAULT -> - if seen_default - then error env Error.MultipleDefaultsInSwitch; - Expect.token env T_DEFAULT; None - | _ -> + let leading = Peek.comments env in + let (test, trailing) = + match Peek.token env with + | T_DEFAULT -> + if seen_default then error env Parse_error.MultipleDefaultsInSwitch; + Expect.token env T_DEFAULT; + (None, Eat.trailing_comments env) + | _ -> Expect.token env T_CASE; - Some (Parse.expression env) in + (Some (Parse.expression env), []) + in let seen_default = seen_default || test = None in let end_loc = Peek.loc env in Expect.token env T_COLON; + let { trailing = line_end_trailing; _ } = statement_end_trailing_comments env in + let trailing = trailing @ line_end_trailing in let term_fn = function - | T_RCURLY | T_DEFAULT | T_CASE -> true - | _ -> false in - let consequent = - Parse.statement_list ~term_fn (env |> with_in_switch true) in - let end_loc = match List.rev consequent with - | last_stmt::_ -> fst last_stmt - | _ -> end_loc in - let acc = (Loc.btwn start_loc end_loc, Statement.Switch.Case.({ - test; - consequent; - }))::acc in + | T_RCURLY + | T_DEFAULT + | T_CASE -> + true + | _ -> false + in + let consequent = Parse.statement_list ~term_fn (env |> with_in_switch true) in + let end_loc = + match List.rev consequent with + | last_stmt :: _ -> fst last_stmt + | _ -> end_loc + in + let acc = + ( Loc.btwn start_loc end_loc, + Statement.Switch.Case. + { test; consequent; comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () } + ) + :: acc + in case_list env (seen_default, acc) + in + with_loc (fun env -> + let leading = Peek.comments env in + Expect.token env T_SWITCH; + Expect.token env T_LPAREN; + let discriminant = Parse.expression env in + Expect.token env T_RPAREN; + Expect.token env T_LCURLY; + let cases = case_list env (false, []) in + Expect.token env T_RCURLY; + let { trailing; _ } = statement_end_trailing_comments env in + Statement.Switch + { + Statement.Switch.discriminant; + cases; + comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + }) + + and throw = + with_loc (fun env -> + let leading = Peek.comments env in + let start_loc = Peek.loc env in + Expect.token env T_THROW; + if Peek.is_line_terminator env then error_at env (start_loc, Parse_error.NewlineAfterThrow); + let argument = Parse.expression env in + let (trailing, argument) = + match semicolon env with + | Explicit trailing -> (trailing, argument) + | Implicit { remove_trailing; _ } -> + ([], remove_trailing argument (fun remover arg -> remover#expression arg)) + in + let open Statement in + Throw { Throw.argument; comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () }) - in with_loc (fun env -> - Expect.token env T_SWITCH; - Expect.token env T_LPAREN; - let discriminant = Parse.expression env in - Expect.token env T_RPAREN; - Expect.token env T_LCURLY; - let cases = case_list env (false, []) in - Expect.token env T_RCURLY; - Statement.Switch { Statement.Switch. - discriminant; - cases; - } - ) - - and throw = with_loc (fun env -> - let start_loc = Peek.loc env in - Expect.token env T_THROW; - if Peek.is_line_terminator env - then error_at env (start_loc, Error.NewlineAfterThrow); - let argument = Parse.expression env in - Eat.semicolon env; - Statement.(Throw { Throw.argument; }) - ) - - and try_ = with_loc (fun env -> - Expect.token env T_TRY; - let block = Parse.block_body env in - let handler = match Peek.token env with - | T_CATCH -> - let catch = with_loc (fun env -> - Expect.token env T_CATCH; - let param = if Peek.token env = T_LPAREN - then begin - Expect.token env T_LPAREN; - let p = Some (Parse.pattern env Error.StrictCatchVariable) in - Expect.token env T_RPAREN; - p - end else - None - in - let body = Parse.block_body env in - { Ast.Statement.Try.CatchClause. - param; - body; - } - ) env in - Some catch - | _ -> None in - let finalizer = match Peek.token env with - | T_FINALLY -> - Expect.token env T_FINALLY; - Some (Parse.block_body env) - | _ -> None in - - (* No catch or finally? That's an error! *) - if handler = None && finalizer = None then - error_at env (fst block, Error.NoCatchOrFinally); - - Statement.Try { Statement.Try. - block; - handler; - finalizer; - } - ) - - and var_or_const = with_loc (fun env -> - let (_loc, declaration), errs = Declaration.variable env in - Eat.semicolon env; - errs |> List.iter (error_at env); - declaration - ) - - and let_ = with_loc (fun env -> - Expect.token env T_LET; - (* Let declaration *) - let declarations, errs = Declaration.variable_declaration_list (env |> with_no_let true) in - let declaration = - Ast.(Statement.VariableDeclaration Statement.VariableDeclaration.({ - declarations; - kind = Let; - })) in - Eat.semicolon env; - errs |> List.iter (error_at env); - declaration - ) - - and while_ = with_loc (fun env -> - Expect.token env T_WHILE; - Expect.token env T_LPAREN; - let test = Parse.expression env in - Expect.token env T_RPAREN; - let body = Parse.statement (env |> with_in_loop true) in - - (* Annex B allows labelled FunctionDeclarations in non-strict mode - (see sec-labelled-function-declarations), but not in IterationStatement - (see sec-semantics-static-semantics-early-errors). *) - if not (in_strict_mode env) && is_labelled_function body - then function_as_statement_error_at env (fst body); - - Statement.While { Statement.While. - test; - body; - } - ) + and try_ = + with_loc (fun env -> + let leading = Peek.comments env in + Expect.token env T_TRY; + let block = + let block = Parse.block_body env in + if Peek.token env = T_CATCH then + block_remove_trailing env block + else + block + in + let handler = + match Peek.token env with + | T_CATCH -> + let catch = + with_loc + (fun env -> + let leading = Peek.comments env in + Expect.token env T_CATCH; + let trailing = Eat.trailing_comments env in + let param = + if Peek.token env = T_LPAREN then ( + Expect.token env T_LPAREN; + let p = Some (Parse.pattern env Parse_error.StrictCatchVariable) in + Expect.token env T_RPAREN; + p + ) else + None + in + let body = Parse.block_body env in + (* Fix trailing comment attachment if catch block is end of statement *) + let body = + if Peek.token env <> T_FINALLY then + let { remove_trailing; _ } = statement_end_trailing_comments env in + remove_trailing body (fun remover (loc, body) -> + (loc, remover#block loc body)) + else + body + in + { + Ast.Statement.Try.CatchClause.param; + body; + comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + }) + env + in + Some catch + | _ -> None + in + let finalizer = + match Peek.token env with + | T_FINALLY -> + Expect.token env T_FINALLY; + let (loc, body) = Parse.block_body env in + let { remove_trailing; _ } = statement_end_trailing_comments env in + let body = remove_trailing body (fun remover body -> remover#block loc body) in + Some (loc, body) + | _ -> None + in + (* No catch or finally? That's an error! *) + if handler = None && finalizer = None then + error_at env (fst block, Parse_error.NoCatchOrFinally); + + Statement.Try + { + Statement.Try.block; + handler; + finalizer; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + }) + + and var = + with_loc (fun env -> + let kind = Statement.VariableDeclaration.Var in + let (declarations, leading, errs) = Declaration.var env in + let (trailing, declarations) = variable_declaration_end ~kind env declarations in + errs |> List.iter (error_at env); + Statement.VariableDeclaration + { + Statement.VariableDeclaration.kind; + declarations; + comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + }) + + and const = + with_loc (fun env -> + let kind = Statement.VariableDeclaration.Const in + let (declarations, leading, errs) = Declaration.const env in + let (trailing, declarations) = variable_declaration_end ~kind env declarations in + errs |> List.iter (error_at env); + Statement.VariableDeclaration + { + Statement.VariableDeclaration.kind; + declarations; + comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + }) + + and let_ = + with_loc (fun env -> + let kind = Statement.VariableDeclaration.Let in + let (declarations, leading, errs) = Declaration.let_ env in + let (trailing, declarations) = variable_declaration_end ~kind env declarations in + errs |> List.iter (error_at env); + Statement.VariableDeclaration + { + Statement.VariableDeclaration.kind; + declarations; + comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + }) + + and while_ = + with_loc (fun env -> + let leading = Peek.comments env in + Expect.token env T_WHILE; + let leading = leading @ Peek.comments env in + Expect.token env T_LPAREN; + let test = Parse.expression env in + Expect.token env T_RPAREN; + let body = Parse.statement (env |> with_in_loop true) in + (* Annex B allows labelled FunctionDeclarations in non-strict mode + (see sec-labelled-function-declarations), but not in IterationStatement + (see sec-semantics-static-semantics-early-errors). *) + if (not (in_strict_mode env)) && is_labelled_function body then + function_as_statement_error_at env (fst body); + Statement.While + { Statement.While.test; body; comments = Flow_ast_utils.mk_comments_opt ~leading () }) and with_ env = - let loc, stmt = with_loc (fun env -> - Expect.token env T_WITH; - Expect.token env T_LPAREN; - let _object = Parse.expression env in - Expect.token env T_RPAREN; - let body = Parse.statement env in - - (* Annex B allows labelled FunctionDeclarations in non-strict mode - (see sec-labelled-function-declarations), but not in WithStatement - (see sec-with-statement-static-semantics-early-errors). *) - if not (in_strict_mode env) && is_labelled_function body - then function_as_statement_error_at env (fst body); - - Statement.With { Statement.With. - _object; - body; - } - ) env in - strict_error_at env (loc, Error.StrictModeWith); - loc, stmt + let (loc, stmt) = + with_loc + (fun env -> + let leading = Peek.comments env in + Expect.token env T_WITH; + let leading = leading @ Peek.comments env in + Expect.token env T_LPAREN; + let _object = Parse.expression env in + Expect.token env T_RPAREN; + let body = Parse.statement env in + (* Annex B allows labelled FunctionDeclarations in non-strict mode + (see sec-labelled-function-declarations), but not in WithStatement + (see sec-with-statement-static-semantics-early-errors). *) + if (not (in_strict_mode env)) && is_labelled_function body then + function_as_statement_error_at env (fst body); + Statement.With + { Statement.With._object; body; comments = Flow_ast_utils.mk_comments_opt ~leading () }) + env + in + strict_error_at env (loc, Parse_error.StrictModeWith); + (loc, stmt) and block env = - let loc, block = Parse.block_body env in - loc, Statement.Block block + let (loc, block) = Parse.block_body env in + let { remove_trailing; _ } = statement_end_trailing_comments env in + let block = remove_trailing block (fun remover block -> remover#block loc block) in + (loc, Statement.Block block) - and maybe_labeled = with_loc (fun env -> - match (Parse.expression env, Peek.token env) with - | ((loc, Ast.Expression.Identifier label), T_COLON) -> - let _, name = label in - Expect.token env T_COLON; - if SSet.mem name (labels env) - then error_at env (loc, Error.Redeclaration ("Label", name)); - let env = add_label env name in - let body = - (* labelled FunctionDeclarations are allowed in non-strict mode - (see #sec-labelled-function-declarations) *) - if Peek.is_function env then function_as_statement env - else Parse.statement env + and maybe_labeled = + with_loc (fun env -> + let leading = Peek.comments env in + match (Parse.expression env, Peek.token env) with + | ((loc, Ast.Expression.Identifier label), T_COLON) -> + let (_, { Identifier.name; comments = _ }) = label in + Expect.token env T_COLON; + if SSet.mem name (labels env) then + error_at env (loc, Parse_error.Redeclaration ("Label", name)); + let env = add_label env name in + let body = + (* labelled FunctionDeclarations are allowed in non-strict mode + (see #sec-labelled-function-declarations) *) + if Peek.is_function env then + function_as_statement env + else + Parse.statement env + in + Statement.Labeled + { Statement.Labeled.label; body; comments = Flow_ast_utils.mk_comments_opt ~leading () } + | (expression, _) -> + let (trailing, expression) = + match semicolon ~expected:"the end of an expression statement (`;`)" env with + | Explicit comments -> (comments, expression) + | Implicit { remove_trailing; _ } -> + ([], remove_trailing expression (fun remover expr -> remover#expression expr)) + in + let open Statement in + Expression + { + Expression.expression; + directive = None; + comments = Flow_ast_utils.mk_comments_opt ~trailing (); + }) + + and expression = + with_loc (fun env -> + let expression = Parse.expression env in + let (trailing, expression) = + match semicolon ~expected:"the end of an expression statement (`;`)" env with + | Explicit comments -> (comments, expression) + | Implicit { remove_trailing; _ } -> + ([], remove_trailing expression (fun remover expr -> remover#expression expr)) in - Statement.Labeled { Statement.Labeled.label; body; } - | expression, _ -> - Eat.semicolon env; - Statement.(Expression { Expression.expression; directive = None; }) - ) - - and expression = with_loc (fun env -> - let expression = Parse.expression env in - Eat.semicolon env; - let directive = if allow_directive env - then match expression with - | _, Ast.Expression.Literal { Ast.Literal. - value = Ast.Literal.String _; - raw; - _ - } -> Some (String.sub raw 1 (String.length raw - 2)) - | _ -> None - else None - in - Statement.Expression { Statement.Expression. - expression; - directive; - } - ) - - and type_alias_helper env = - if not (should_parse_types env) - then error env Error.UnexpectedTypeAlias; + let directive = + if allow_directive env then + match expression with + | (_, Ast.Expression.Literal { Ast.Literal.value = Ast.Literal.String _; raw; _ }) -> + Some (String.sub raw 1 (String.length raw - 2)) + | _ -> None + else + None + in + Statement.Expression + { + Statement.Expression.expression; + directive; + comments = Flow_ast_utils.mk_comments_opt ~trailing (); + }) + + and type_alias_helper ~leading env = + if not (should_parse_types env) then error env Parse_error.UnexpectedTypeAlias; + let leading = leading @ Peek.comments env in Expect.token env T_TYPE; Eat.push_lex_mode env Lex_mode.TYPE; - let id = Type.type_identifier env in - let tparams = Type.type_parameter_declaration_with_defaults env in + let id = + let id = Type.type_identifier env in + if Peek.token env = T_LESS_THAN then + id_remove_trailing env id + else + id + in + let tparams = Type.type_params env in Expect.token env T_ASSIGN; let right = Type._type env in - Eat.semicolon env; Eat.pop_lex_mode env; - Statement.TypeAlias.({ - id; - tparams; - right; - }) - - and declare_type_alias env = with_loc (fun env -> - Expect.token env T_DECLARE; - let type_alias = type_alias_helper env in - Statement.DeclareTypeAlias type_alias - ) env - + let (trailing, right) = + match semicolon env with + | Explicit comments -> (comments, right) + | Implicit { remove_trailing; _ } -> + ([], remove_trailing right (fun remover right -> remover#type_ right)) + in + Statement.TypeAlias. + { id; tparams; right; comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () } + + and declare_type_alias env = + with_loc + (fun env -> + let leading = Peek.comments env in + Expect.token env T_DECLARE; + let type_alias = type_alias_helper ~leading env in + Statement.DeclareTypeAlias type_alias) + env + + (** Type aliases squeeze into an unambiguous unused portion of the grammar: `type` is not a + reserved word, so `type T` is otherwise two identifiers in a row and that's never valid JS. + However, if there's a line separator between the two, ASI makes it valid JS, so line + separators are disallowed. *) and type_alias env = - if Peek.ith_is_identifier ~i:1 env - then - let loc, type_alias = with_loc type_alias_helper env in - loc, Statement.TypeAlias type_alias + if Peek.ith_is_identifier ~i:1 env && not (Peek.ith_is_implicit_semicolon ~i:1 env) then + let (loc, type_alias) = with_loc (type_alias_helper ~leading:[]) env in + (loc, Statement.TypeAlias type_alias) else Parse.statement env - and opaque_type_helper ?(declare=false) env = - if not (should_parse_types env) - then error env Error.UnexpectedOpaqueTypeAlias; + and opaque_type_helper ?(declare = false) ~leading env = + if not (should_parse_types env) then error env Parse_error.UnexpectedOpaqueTypeAlias; + let leading_opaque = leading @ Peek.comments env in Expect.token env T_OPAQUE; + let leading_type = Peek.comments env in Expect.token env T_TYPE; + let leading = leading_opaque @ leading_type in Eat.push_lex_mode env Lex_mode.TYPE; - let id = Type.type_identifier env in - let tparams = Type.type_parameter_declaration_with_defaults env in - let supertype = match Peek.token env with - | T_COLON -> + let id = + let id = Type.type_identifier env in + if Peek.token env = T_LESS_THAN then + id_remove_trailing env id + else + id + in + let tparams = Type.type_params env in + let supertype = + match Peek.token env with + | T_COLON -> Expect.token env T_COLON; Some (Type._type env) - | _ -> None in + | _ -> None + in let impltype = - if not declare then - (Expect.token env T_ASSIGN; - Some (Type._type env)) - else None in - Eat.semicolon env; + if declare then + match Peek.token env with + | T_ASSIGN -> + error env Parse_error.DeclareOpaqueTypeInitializer; + Eat.token env; + if Peek.token env = T_SEMICOLON || Peek.is_implicit_semicolon env then + None + else + Some (Type._type env) + | _ -> None + else ( + Expect.token env T_ASSIGN; + Some (Type._type env) + ) + in Eat.pop_lex_mode env; - Statement.OpaqueType.({ - id; - tparams; - impltype; - supertype; - }) - - and declare_opaque_type env = with_loc (fun env -> - Expect.token env T_DECLARE; - let opaque_t = opaque_type_helper ~declare:true env in - Statement.DeclareOpaqueType opaque_t - ) env + let (trailing, id, tparams, supertype, impltype) = + match (semicolon env, tparams, supertype, impltype) with + (* opaque type Foo = Bar; *) + | (Explicit comments, _, _, _) -> (comments, id, tparams, supertype, impltype) + (* opaque type Foo = Bar *) + | (Implicit { remove_trailing; _ }, _, _, Some impl) -> + ( [], + id, + tparams, + supertype, + Some (remove_trailing impl (fun remover impl -> remover#type_ impl)) ) + (* opaque type Foo: Super *) + | (Implicit { remove_trailing; _ }, _, Some super, None) -> + ( [], + id, + tparams, + Some (remove_trailing super (fun remover super -> remover#type_ super)), + None ) + (* opaque type Foo *) + | (Implicit { remove_trailing; _ }, Some tparams, None, None) -> + ( [], + id, + Some (remove_trailing tparams (fun remover tparams -> remover#type_params tparams)), + None, + None ) + (* declare opaque type Foo *) + | (Implicit { remove_trailing; _ }, None, None, None) -> + ([], remove_trailing id (fun remover id -> remover#identifier id), None, None, None) + in + Statement.OpaqueType. + { + id; + tparams; + impltype; + supertype; + comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + } + + and declare_opaque_type env = + with_loc + (fun env -> + let leading = Peek.comments env in + Expect.token env T_DECLARE; + let opaque_t = opaque_type_helper ~declare:true ~leading env in + Statement.DeclareOpaqueType opaque_t) + env and opaque_type env = match Peek.ith_token ~i:1 env with - T_TYPE -> - let loc, opaque_t = with_loc (opaque_type_helper ~declare:false) env in - loc, Statement.OpaqueType opaque_t + | T_TYPE -> + let (loc, opaque_t) = with_loc (opaque_type_helper ~declare:false ~leading:[]) env in + (loc, Statement.OpaqueType opaque_t) | _ -> Parse.statement env - and interface_helper env = - if not (should_parse_types env) - then error env Error.UnexpectedTypeInterface; + and interface_helper ~leading env = + if not (should_parse_types env) then error env Parse_error.UnexpectedTypeInterface; + let leading = leading @ Peek.comments env in Expect.token env T_INTERFACE; - let id = Type.type_identifier env in - let tparams = Type.type_parameter_declaration_with_defaults env in - let { Ast.Type.Interface.extends; body } = Type.interface_helper env in - Statement.Interface.({ - id; - tparams; - body; - extends; - }) - - and declare_interface env = with_loc (fun env -> - Expect.token env T_DECLARE; - let iface = interface_helper env in - Statement.DeclareInterface iface - ) env + let id = + let id = Type.type_identifier env in + if Peek.token env = T_EXTENDS then + id + else + id_remove_trailing env id + in + let tparams = + let tparams = Type.type_params env in + if Peek.token env = T_EXTENDS then + tparams + else + type_params_remove_trailing env tparams + in + let (extends, body) = Type.interface_helper env in + let { remove_trailing; _ } = statement_end_trailing_comments env in + let body = + remove_trailing body (fun remover (loc, body) -> (loc, remover#object_type loc body)) + in + Statement.Interface. + { id; tparams; body; extends; comments = Flow_ast_utils.mk_comments_opt ~leading () } + + and declare_interface env = + with_loc + (fun env -> + let leading = Peek.comments env in + Expect.token env T_DECLARE; + let iface = interface_helper ~leading env in + Statement.DeclareInterface iface) + env and interface env = (* disambiguate between a value named `interface`, like `var interface = 1; interface++`, and an interface declaration like `interface Foo {}`.` *) - if Peek.ith_is_identifier_name ~i:1 env - then - let loc, iface = with_loc interface_helper env in - loc, Statement.InterfaceDeclaration iface - else expression env + if Peek.ith_is_identifier_name ~i:1 env then + let (loc, iface) = with_loc (interface_helper ~leading:[]) env in + (loc, Statement.InterfaceDeclaration iface) + else + expression env and declare_class = let rec mixins env acc = let super = Type.generic env in - let acc = super::acc in + let acc = super :: acc in match Peek.token env with | T_COMMA -> Expect.token env T_COMMA; mixins env acc | _ -> List.rev acc - - (* This is identical to `interface`, except that mixins are allowed *) - in fun env -> + (* This is identical to `interface`, except that mixins are allowed *) + in + fun ~leading env -> let env = env |> with_strict true in + let leading = leading @ Peek.comments env in Expect.token env T_CLASS; - let id = Parse.identifier env in - let tparams = Type.type_parameter_declaration_with_defaults env in - let extends = if Expect.maybe env T_EXTENDS then Some (Type.generic env) else None in - let mixins = match Peek.token env with - | T_IDENTIFIER { raw = "mixins"; _ } -> Eat.token env; mixins env [] - | _ -> [] + let id = + let id = Parse.identifier env in + match Peek.token env with + | T_LESS_THAN + | T_LCURLY -> + id_remove_trailing env id + | _ -> id + in + let tparams = + let tparams = Type.type_params env in + match Peek.token env with + | T_LCURLY -> type_params_remove_trailing env tparams + | _ -> tparams in - let implements = match Peek.token env with - | T_IMPLEMENTS -> Eat.token env; Object.class_implements env [] - | _ -> [] + let extends = + if Eat.maybe env T_EXTENDS then + let extends = Type.generic env in + match Peek.token env with + | T_LCURLY -> Some (generic_type_remove_trailing env extends) + | _ -> Some extends + else + None in - let body = Type._object ~allow_static:true ~allow_proto:true env in - Statement.DeclareClass.({ - id; - tparams; - body; - extends; - mixins; - implements; - }) - - and declare_class_statement env = with_loc (fun env -> - Expect.token env T_DECLARE; - let fn = declare_class env in - Statement.DeclareClass fn - ) env - - and declare_function env = + let mixins = + match Peek.token env with + | T_IDENTIFIER { raw = "mixins"; _ } -> + Eat.token env; + let mixins = mixins env [] in + (match Peek.token env with + | T_LCURLY -> generic_type_list_remove_trailing env mixins + | _ -> mixins) + | _ -> [] + in + let implements = + match Peek.token env with + | T_IMPLEMENTS -> + let implements = Object.class_implements env ~attach_leading:false in + (match Peek.token env with + | T_LCURLY -> Some (class_implements_remove_trailing env implements) + | _ -> Some implements) + | _ -> None + in + let body = Type._object ~is_class:true env in + let { remove_trailing; _ } = statement_end_trailing_comments env in + let body = + remove_trailing body (fun remover (loc, body) -> (loc, remover#object_type loc body)) + in + let comments = Flow_ast_utils.mk_comments_opt ~leading () in + Statement.DeclareClass.{ id; tparams; body; extends; mixins; implements; comments } + + and declare_class_statement env = + with_loc + (fun env -> + let leading = Peek.comments env in + Expect.token env T_DECLARE; + let fn = declare_class ~leading env in + Statement.DeclareClass fn) + env + + and declare_function ?(leading = []) env = + let leading = leading @ Peek.comments env in Expect.token env T_FUNCTION; - let id = Parse.identifier env in + let id = id_remove_trailing env (Parse.identifier env) in let start_sig_loc = Peek.loc env in - let tparams = Type.type_parameter_declaration env in + let tparams = type_params_remove_trailing env (Type.type_params env) in let params = Type.function_param_list env in Expect.token env T_COLON; - let return = Type._type env in + let return = + let return = Type._type env in + let has_predicate = + Eat.push_lex_mode env Lex_mode.TYPE; + let type_token = Peek.token env in + Eat.pop_lex_mode env; + type_token = T_CHECKS + in + if has_predicate then + type_remove_trailing env return + else + return + in let end_loc = fst return in let loc = Loc.btwn start_sig_loc end_loc in - let annot = loc, Ast.Type.(Function {Function. - params; - return; - tparams; - }) in - let annot = fst annot, annot in + let annot = (loc, Ast.Type.(Function { Function.params; return; tparams; comments = None })) in let predicate = Type.predicate_opt env in - Eat.semicolon env; - Statement.DeclareFunction.({ - id; - annot; - predicate; - }) - - and declare_function_statement env = with_loc (fun env -> - Expect.token env T_DECLARE; - begin match Peek.token env with - | T_ASYNC -> - error env Error.DeclareAsync; - Expect.token env T_ASYNC - | _ -> () - end; - let fn = declare_function env in - Statement.DeclareFunction fn - ) env - - and declare_var env = - Expect.token env T_VAR; - let _loc, { Pattern.Identifier.name; annot; _; } = - Parse.identifier_with_type env ~no_optional:true Error.StrictVarName in - Eat.semicolon env; - Statement.DeclareVariable.({ id=name; annot; }) + let (trailing, annot, predicate) = + match (semicolon env, predicate) with + | (Explicit comments, _) -> (comments, annot, predicate) + | (Implicit { remove_trailing; _ }, None) -> + ([], remove_trailing annot (fun remover annot -> remover#type_ annot), None) + | (Implicit { remove_trailing; _ }, Some pred) -> + ([], annot, Some (remove_trailing pred (fun remover pred -> remover#predicate pred))) + in + let annot = (loc, annot) in + Statement.DeclareFunction. + { id; annot; predicate; comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () } + + and declare_function_statement env = + with_loc + (fun env -> + let leading = Peek.comments env in + Expect.token env T_DECLARE; + begin + match Peek.token env with + | T_ASYNC -> + error env Parse_error.DeclareAsync; + Expect.token env T_ASYNC + | _ -> () + end; + let fn = declare_function ~leading env in + Statement.DeclareFunction fn) + env - and declare_var_statement env = with_loc (fun env -> - Expect.token env T_DECLARE; - let var = declare_var env in - Statement.DeclareVariable var - ) env + and declare_var env leading = + let leading = leading @ Peek.comments env in + Expect.token env T_VAR; + let (_loc, { Pattern.Identifier.name; annot; _ }) = + Parse.identifier_with_type env ~no_optional:true Parse_error.StrictVarName + in + let (trailing, name, annot) = + match (semicolon env, annot) with + (* declare var x; *) + | (Explicit trailing, _) -> (trailing, name, annot) + (* declare var x *) + | (Implicit { remove_trailing; _ }, Ast.Type.Missing _) -> + ([], remove_trailing name (fun remover name -> remover#identifier name), annot) + (* declare var x: mixed *) + | (Implicit { remove_trailing; _ }, Ast.Type.Available _) -> + ([], name, remove_trailing annot (fun remover annot -> remover#type_annotation_hint annot)) + in + Statement.DeclareVariable. + { id = name; annot; comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () } + + and declare_var_statement env = + with_loc + (fun env -> + let leading = Peek.comments env in + Expect.token env T_DECLARE; + let var = declare_var env leading in + Statement.DeclareVariable var) + env and declare_module = let rec module_items env ~module_kind acc = match Peek.token env with | T_EOF - | T_RCURLY -> (module_kind, List.rev acc) + | T_RCURLY -> + (module_kind, List.rev acc) | _ -> let stmt = declare ~in_module:true env in (* TODO: This is a semantic analysis and shouldn't be in the parser *) - let module_kind = Statement.( + let module_kind = + let open Statement in let (loc, stmt) = stmt in match (module_kind, stmt) with - (** + (* * The first time we see either a `declare export` or a * `declare module.exports`, we lock in the kind of the module. * @@ -736,26 +1208,20 @@ module Statement * exceptions to this rule because they are valid in both CommonJS * and ES modules (and thus do not indicate an intent for either). *) - | None, DeclareModuleExports _ -> Some (DeclareModule.CommonJS loc) - | None, DeclareExportDeclaration { - DeclareExportDeclaration.declaration; - _; - } -> + | (None, DeclareModuleExports _) -> Some (DeclareModule.CommonJS loc) + | (None, DeclareExportDeclaration { DeclareExportDeclaration.declaration; _ }) -> (match declaration with - | Some (DeclareExportDeclaration.NamedType _) - | Some (DeclareExportDeclaration.Interface _) - -> module_kind - | _ -> Some (DeclareModule.ES loc) - ) - - (** + | Some (DeclareExportDeclaration.NamedType _) + | Some (DeclareExportDeclaration.Interface _) -> + module_kind + | _ -> Some (DeclareModule.ES loc)) + (* * There should never be more than one `declare module.exports` * statement *) - | Some (DeclareModule.CommonJS _), DeclareModuleExports _ -> + | (Some (DeclareModule.CommonJS _), DeclareModuleExports _) -> error env Parse_error.DuplicateDeclareModuleExports; module_kind - - (** + (* * It's never ok to mix and match `declare export` and * `declare module.exports` in the same module because it leaves the * kind of the module (CommonJS vs ES) ambiguous. @@ -763,781 +1229,912 @@ module Statement * The 1 exception to this rule is that `export type/interface` are * both ok in CommonJS modules. *) - | Some (DeclareModule.ES _), DeclareModuleExports _ -> + | (Some (DeclareModule.ES _), DeclareModuleExports _) -> error env Parse_error.AmbiguousDeclareModuleKind; module_kind - | Some (DeclareModule.CommonJS _), DeclareExportDeclaration { - DeclareExportDeclaration.declaration; - _; - } -> - (match declaration with - | Some (DeclareExportDeclaration.NamedType _) - | Some (DeclareExportDeclaration.Interface _) - -> () - | _ -> error env Parse_error.AmbiguousDeclareModuleKind - ); - module_kind - + | ( Some (DeclareModule.CommonJS _), + DeclareExportDeclaration { DeclareExportDeclaration.declaration; _ } ) -> + (match declaration with + | Some (DeclareExportDeclaration.NamedType _) + | Some (DeclareExportDeclaration.Interface _) -> + () + | _ -> error env Parse_error.AmbiguousDeclareModuleKind); + module_kind | _ -> module_kind - ) in - module_items env ~module_kind (stmt::acc) + in + module_items env ~module_kind (stmt :: acc) in - - let declare_module_ env start_loc = - let id = match Peek.token env with - | T_STRING (loc, value, raw, octal) -> - if octal then strict_error env Error.StrictOctalLiteral; - Expect.token env (T_STRING (loc, value, raw, octal)); - Statement.DeclareModule.Literal (loc, { StringLiteral.value; raw; }) - | _ -> - Statement.DeclareModule.Identifier (Parse.identifier env) in - let body_loc, (module_kind, body) = with_loc (fun env -> - Expect.token env T_LCURLY; - let res = module_items env ~module_kind:None [] in - Expect.token env T_RCURLY; - res - ) env in - let body = body_loc, { Statement.Block.body; } in + let declare_module_ env start_loc leading = + let id = + match Peek.token env with + | T_STRING str -> + Statement.DeclareModule.Literal + (string_literal_remove_trailing env (string_literal env str)) + | _ -> Statement.DeclareModule.Identifier (id_remove_trailing env (Parse.identifier env)) + in + let (body_loc, ((module_kind, body), comments)) = + with_loc + (fun env -> + let leading = Peek.comments env in + Expect.token env T_LCURLY; + let (module_kind, body) = module_items env ~module_kind:None [] in + let internal = + if body = [] then + Peek.comments env + else + [] + in + Expect.token env T_RCURLY; + let { trailing; _ } = statement_end_trailing_comments env in + ( (module_kind, body), + Flow_ast_utils.mk_comments_with_internal_opt ~leading ~trailing ~internal )) + env + in + let body = (body_loc, { Statement.Block.body; comments }) in let loc = Loc.btwn start_loc body_loc in let kind = match module_kind with | Some k -> k | None -> Statement.DeclareModule.CommonJS loc in - loc, - Statement.(DeclareModule DeclareModule.({ id; body; kind; })) + let comments = Flow_ast_utils.mk_comments_opt ~leading () in + (loc, Statement.(DeclareModule DeclareModule.{ id; body; kind; comments })) in - fun ?(in_module=false) env -> + fun ?(in_module = false) env -> let start_loc = Peek.loc env in + let leading = Peek.comments env in Expect.token env T_DECLARE; + let leading = leading @ Peek.comments env in Expect.identifier env "module"; - if in_module || Peek.token env = T_PERIOD - then - let loc, exports = with_loc declare_module_exports env in - Loc.btwn start_loc loc, exports + if in_module || Peek.token env = T_PERIOD then + let (loc, exports) = with_loc (declare_module_exports ~leading) env in + (Loc.btwn start_loc loc, exports) else - declare_module_ env start_loc + declare_module_ env start_loc leading - and declare_module_exports env = + and declare_module_exports ~leading env = + let leading_period = Peek.comments env in Expect.token env T_PERIOD; + let leading_exports = Peek.comments env in Expect.identifier env "exports"; - let type_annot = Type.annotation env in - Eat.semicolon env; - Statement.DeclareModuleExports type_annot + let leading_annot = Peek.comments env in + let leading = List.concat [leading; leading_period; leading_exports; leading_annot] in + let annot = Type.annotation env in + let (annot, trailing) = + match semicolon env with + | Explicit trailing -> (annot, trailing) + | Implicit { remove_trailing; _ } -> + (remove_trailing annot (fun remover annot -> remover#type_annotation annot), []) + in + let comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () in + Statement.DeclareModuleExports { Statement.DeclareModuleExports.annot; comments } + + and declare ?(in_module = false) env = + if not (should_parse_types env) then error env Parse_error.UnexpectedTypeDeclaration; - and declare ?(in_module=false) env = - if not (should_parse_types env) - then error env Error.UnexpectedTypeDeclaration; (* eventually, just emit a wrapper AST node *) - (match Peek.ith_token ~i:1 env with - | T_CLASS -> - declare_class_statement env - | T_INTERFACE -> - declare_interface env - | T_TYPE -> ( - match Peek.token env with - | T_IMPORT when in_module -> - import_declaration env - | _ -> - declare_type_alias env - ) - | T_OPAQUE -> - declare_opaque_type env - | T_TYPEOF when (Peek.token env) = T_IMPORT -> - import_declaration env - | T_FUNCTION - | T_ASYNC -> - declare_function_statement env - | T_VAR -> - declare_var_statement env - | T_EXPORT when in_module -> - declare_export_declaration ~allow_export_type:in_module env - | T_IDENTIFIER { raw = "module"; _ } -> - declare_module ~in_module env - | _ when in_module -> ( - match Peek.token env with - | T_IMPORT -> - error env Error.InvalidNonTypeImportInDeclareModule; - Parse.statement env - | _ -> - (* Oh boy, found some bad stuff in a declare module. Let's just - * pretend it's a declare var (arbitrary choice) *) - declare_var_statement env - ) + match Peek.ith_token ~i:1 env with + | T_CLASS -> declare_class_statement env + | T_INTERFACE -> declare_interface env + | T_TYPE -> + (match Peek.token env with + | T_IMPORT when in_module -> import_declaration env + | _ -> declare_type_alias env) + | T_OPAQUE -> declare_opaque_type env + | T_TYPEOF when Peek.token env = T_IMPORT -> import_declaration env + | T_FUNCTION + | T_ASYNC -> + declare_function_statement env + | T_VAR -> declare_var_statement env + | T_EXPORT when in_module -> declare_export_declaration ~allow_export_type:in_module env + | T_IDENTIFIER { raw = "module"; _ } -> declare_module ~in_module env + | _ when in_module -> + (match Peek.token env with + | T_IMPORT -> + error env Parse_error.InvalidNonTypeImportInDeclareModule; + Parse.statement env | _ -> - Parse.statement env - ) + (* Oh boy, found some bad stuff in a declare module. Let's just + * pretend it's a declare var (arbitrary choice) *) + declare_var_statement env) + | _ -> Parse.statement env and export_source env = Expect.identifier env "from"; match Peek.token env with - | T_STRING (loc, value, raw, octal) -> - if octal then strict_error env Error.StrictOctalLiteral; - Expect.token env (T_STRING (loc, value, raw, octal)); - loc, { StringLiteral.value; raw; } + | T_STRING str -> string_literal env str | _ -> - (* Just make up a string for the error case *) - let ret = Peek.loc env, { StringLiteral.value = ""; raw = ""; } in - error_unexpected env; - ret + (* Just make up a string for the error case *) + let ret = (Peek.loc env, { StringLiteral.value = ""; raw = ""; comments = None }) in + error_unexpected ~expected:"a string" env; + ret + + and export_source_and_semicolon env = + let (source_loc, source) = export_source env in + match semicolon env with + | Explicit trailing -> ((source_loc, source), trailing) + | Implicit { remove_trailing; _ } -> + ( ( source_loc, + remove_trailing source (fun remover source -> + remover#string_literal_type source_loc source) ), + [] ) and extract_pattern_binding_names = - let rec fold acc = Pattern.(function - | (_, Object {Object.properties; _;}) -> - List.fold_left (fun acc prop -> - match prop with - | Object.Property (_, {Object.Property.pattern; _;}) - | Object.RestProperty (_, {Object.RestProperty.argument = pattern;}) - -> fold acc pattern - ) acc properties - | (_, Array {Array.elements; _;}) -> - List.fold_left Array.(fun acc elem -> - match elem with - | Some (Element pattern) - | Some (RestElement (_, {RestElement.argument = pattern;})) - -> fold acc pattern - | None -> acc - ) acc elements - | (_, Assignment {Assignment.left;_;}) -> fold acc left - | (_, Identifier {Pattern.Identifier.name; _; }) -> - name::acc - | (_, Expression _) -> - failwith "Parser error: No such thing as an expression pattern!" - ) in + let rec fold acc = + let open Pattern in + function + | (_, Object { Object.properties; _ }) -> + List.fold_left + (fun acc prop -> + match prop with + | Object.Property (_, { Object.Property.pattern; _ }) + | Object.RestElement (_, { RestElement.argument = pattern; comments = _ }) -> + fold acc pattern) + acc + properties + | (_, Array { Array.elements; _ }) -> + List.fold_left + (fun acc elem -> + match elem with + | Array.Element (_, { Array.Element.argument = pattern; default = _ }) + | Array.RestElement (_, { RestElement.argument = pattern; comments = _ }) -> + fold acc pattern + | Array.Hole _ -> acc) + acc + elements + | (_, Identifier { Pattern.Identifier.name; _ }) -> name :: acc + | (_, Expression _) -> failwith "Parser error: No such thing as an expression pattern!" + in List.fold_left fold - and extract_ident_name (_, name) = name + and extract_ident_name (_, { Identifier.name; comments = _ }) = name - and export_specifiers ?(preceding_comma=true) env specifiers = + and export_specifiers ?(preceding_comma = true) env specifiers = match Peek.token env with | T_EOF | T_RCURLY -> - List.rev specifiers + List.rev specifiers | _ -> - if not preceding_comma then error env Error.ExportSpecifierMissingComma; - let specifier = with_loc (fun env -> - let local = identifier_name env in - let exported = - match Peek.token env with - | T_IDENTIFIER { raw = "as"; _ } -> - Eat.token env; - let exported = identifier_name env in - record_export env exported; - Some exported - | _ -> - record_export env local; - None - in - { Statement.ExportNamedDeclaration.ExportSpecifier.local; exported; } - ) env in - let preceding_comma = Expect.maybe env T_COMMA in - export_specifiers ~preceding_comma env (specifier::specifiers) + if not preceding_comma then error env Parse_error.ExportSpecifierMissingComma; + let specifier = + with_loc + (fun env -> + let local = identifier_name env in + let exported = + match Peek.token env with + | T_IDENTIFIER { raw = "as"; _ } -> + Eat.token env; + let exported = identifier_name env in + record_export env exported; + Some exported + | _ -> + record_export env local; + None + in + { Statement.ExportNamedDeclaration.ExportSpecifier.local; exported }) + env + in + let preceding_comma = Eat.maybe env T_COMMA in + export_specifiers ~preceding_comma env (specifier :: specifiers) and assert_export_specifier_identifiers env specifiers = - let open Statement.ExportNamedDeclaration.ExportSpecifier in - List.iter (function - | _, { local = id; exported = None; } -> - Parse.assert_identifier_name_is_identifier - ~restricted_error:Parse_error.StrictVarName env id - | _ -> - () - ) specifiers - - and export_declaration ~decorators = with_loc (fun env -> - let env = env |> with_strict true |> with_in_export true in - let start_loc = Peek.loc env in - Expect.token env T_EXPORT; - match Peek.token env with - | T_DEFAULT -> - (* export default ... *) - let open Statement.ExportDefaultDeclaration in - let default, () = with_loc (fun env -> - Expect.token env T_DEFAULT - ) env in - record_export env (Loc.btwn start_loc (Peek.loc env), "default"); - let declaration = match Peek.token env with - | T_FUNCTION -> - (* export default function foo (...) { ... } *) - let fn = Declaration._function env in - Declaration fn - | _ when Peek.is_class env -> - (* export default class foo { ... } *) - let _class = Object.class_declaration env decorators in - Declaration _class - | _ -> - (* export default [assignment expression]; *) - let expr = Parse.assignment env in - Eat.semicolon env; - Expression expr - in - Statement.ExportDefaultDeclaration { - default; - declaration; - } - | T_TYPE when (Peek.ith_token ~i:1 env) <> T_LCURLY -> - (* export type ... *) - let open Statement.ExportNamedDeclaration in - if not (should_parse_types env) - then error env Error.UnexpectedTypeExport; - (match Peek.ith_token ~i:1 env with + Statement.ExportNamedDeclaration.ExportSpecifier.( + List.iter + (function + | (_, { local = id; exported = None }) -> + assert_identifier_name_is_identifier ~restricted_error:Parse_error.StrictVarName env id + | _ -> ()) + specifiers) + + and export_declaration ~decorators = + with_loc (fun env -> + let env = env |> with_strict true |> with_in_export true in + let start_loc = Peek.loc env in + let leading = Peek.comments env in + Expect.token env T_EXPORT; + match Peek.token env with + | T_DEFAULT -> + (* export default ... *) + Statement.ExportDefaultDeclaration.( + let leading = leading @ Peek.comments env in + let (default, ()) = with_loc (fun env -> Expect.token env T_DEFAULT) env in + record_export + env + (Flow_ast_utils.ident_of_source (Loc.btwn start_loc (Peek.loc env), "default")); + let (declaration, trailing) = + if Peek.is_function env then + (* export default [async] function [foo] (...) { ... } *) + let fn = Declaration._function env in + (Declaration fn, []) + else if Peek.is_class env then + (* export default class foo { ... } *) + let _class = Object.class_declaration env decorators in + (Declaration _class, []) + else if Peek.token env = T_ENUM then + (* export default enum foo { ... } *) + (Declaration (Declaration.enum_declaration env), []) + else + (* export default [assignment expression]; *) + let expr = Parse.assignment env in + let (expr, trailing) = + match semicolon env with + | Explicit trailing -> (expr, trailing) + | Implicit { remove_trailing; _ } -> + (remove_trailing expr (fun remover expr -> remover#expression expr), []) + in + (Expression expr, trailing) + in + Statement.ExportDefaultDeclaration + { + default; + declaration; + comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + }) + | T_TYPE when Peek.ith_token ~i:1 env <> T_LCURLY -> + (* export type ... *) + Statement.ExportNamedDeclaration.( + if not (should_parse_types env) then error env Parse_error.UnexpectedTypeExport; + (match Peek.ith_token ~i:1 env with + | T_MULT -> + Expect.token env T_TYPE; + let specifier_loc = Peek.loc env in + Expect.token env T_MULT; + let (source, trailing) = export_source_and_semicolon env in + Statement.ExportNamedDeclaration + { + declaration = None; + specifiers = Some (ExportBatchSpecifier (specifier_loc, None)); + source = Some source; + export_kind = Statement.ExportType; + comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + } + | T_ENUM -> + error env Parse_error.EnumInvalidExport; + Expect.token env T_TYPE; + Statement.ExportNamedDeclaration + { + declaration = None; + specifiers = None; + source = None; + export_kind = Statement.ExportType; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + } + | _ -> + let (loc, type_alias) = with_loc (type_alias_helper ~leading:[]) env in + record_export + env + (Flow_ast_utils.ident_of_source + (loc, extract_ident_name type_alias.Statement.TypeAlias.id)); + let type_alias = (loc, Statement.TypeAlias type_alias) in + Statement.ExportNamedDeclaration + { + declaration = Some type_alias; + specifiers = None; + source = None; + export_kind = Statement.ExportType; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + })) + | T_OPAQUE -> + (* export opaque type ... *) + Statement.ExportNamedDeclaration.( + let (loc, opaque_t) = with_loc (opaque_type_helper ~leading:[]) env in + record_export + env + (Flow_ast_utils.ident_of_source + (loc, extract_ident_name opaque_t.Statement.OpaqueType.id)); + let opaque_t = (loc, Statement.OpaqueType opaque_t) in + Statement.ExportNamedDeclaration + { + declaration = Some opaque_t; + specifiers = None; + source = None; + export_kind = Statement.ExportType; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + }) + | T_INTERFACE -> + (* export interface I { ... } *) + Statement.ExportNamedDeclaration.( + if not (should_parse_types env) then error env Parse_error.UnexpectedTypeExport; + let interface = interface env in + (match interface with + | (loc, Statement.InterfaceDeclaration { Statement.Interface.id; _ }) -> + record_export env (Flow_ast_utils.ident_of_source (loc, extract_ident_name id)) + | _ -> + failwith + ( "Internal Flow Error! Parsed `export interface` into something " + ^ "other than an interface declaration!" )); + Statement.ExportNamedDeclaration + { + declaration = Some interface; + specifiers = None; + source = None; + export_kind = Statement.ExportType; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + }) + | T_LET + | T_CONST + | T_VAR + (* not using Peek.is_class here because it would guard all of the + * cases *) + | T_AT + | T_CLASS + (* not using Peek.is_function here because it would guard all of the + * cases *) + | T_ASYNC + | T_FUNCTION + | T_ENUM -> + Statement.ExportNamedDeclaration.( + let stmt = Parse.statement_list_item env ~decorators in + let names = + let open Statement in + match stmt with + | (_, VariableDeclaration { VariableDeclaration.declarations; _ }) -> + List.fold_left + (fun names (_, declaration) -> + let id = declaration.VariableDeclaration.Declarator.id in + extract_pattern_binding_names names [id]) + [] + declarations + | (loc, ClassDeclaration { Class.id = Some id; _ }) + | (loc, FunctionDeclaration { Function.id = Some id; _ }) + | (loc, EnumDeclaration { EnumDeclaration.id; _ }) -> + [Flow_ast_utils.ident_of_source (loc, extract_ident_name id)] + | (loc, ClassDeclaration { Class.id = None; _ }) -> + error_at env (loc, Parse_error.ExportNamelessClass); + [] + | (loc, FunctionDeclaration { Function.id = None; _ }) -> + error_at env (loc, Parse_error.ExportNamelessFunction); + [] + | _ -> failwith "Internal Flow Error! Unexpected export statement declaration!" + in + List.iter (record_export env) names; + Statement.ExportNamedDeclaration + { + declaration = Some stmt; + specifiers = None; + source = None; + export_kind = Statement.ExportValue; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + }) | T_MULT -> - Expect.token env T_TYPE; - let specifier_loc = Peek.loc env in - Expect.token env T_MULT; - let source = export_source env in - Eat.semicolon env; - Statement.ExportNamedDeclaration { - declaration = None; - specifiers = Some (ExportBatchSpecifier (specifier_loc, None)); - source = Some source; - exportKind = Statement.ExportType; - } + Statement.ExportNamedDeclaration.( + let loc = Peek.loc env in + Expect.token env T_MULT; + let local_name = + let parse_export_star_as = (parse_options env).esproposal_export_star_as in + match Peek.token env with + | T_IDENTIFIER { raw = "as"; _ } -> + Eat.token env; + if parse_export_star_as then + Some (Parse.identifier env) + else ( + error env Parse_error.UnexpectedTypeDeclaration; + None + ) + | _ -> None + in + let specifiers = Some (ExportBatchSpecifier (loc, local_name)) in + let (source, trailing) = export_source_and_semicolon env in + Statement.ExportNamedDeclaration + { + declaration = None; + specifiers; + source = Some source; + export_kind = Statement.ExportValue; + comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + }) | _ -> - let loc, type_alias = with_loc type_alias_helper env in - record_export env (loc, extract_ident_name type_alias.Statement.TypeAlias.id); - let type_alias = (loc, Statement.TypeAlias type_alias) in - Statement.ExportNamedDeclaration { - declaration = Some type_alias; - specifiers = None; - source = None; - exportKind = Statement.ExportType; - } - ) - | T_OPAQUE -> - (* export opaque type ... *) - let open Statement.ExportNamedDeclaration in - let loc, opaque_t = with_loc opaque_type_helper env in - record_export env (loc, extract_ident_name opaque_t.Statement.OpaqueType.id); - let opaque_t = (loc, Statement.OpaqueType opaque_t) in - Statement.ExportNamedDeclaration { - declaration = Some opaque_t; - specifiers = None; - source = None; - exportKind = Statement.ExportType; - } - | T_INTERFACE -> - (* export interface I { ... } *) - let open Statement.ExportNamedDeclaration in - if not (should_parse_types env) - then error env Error.UnexpectedTypeExport; - let interface = interface env in - (match interface with - | (loc, Statement.InterfaceDeclaration {Statement.Interface.id; _;}) -> - record_export env (loc, extract_ident_name id) - | _ -> failwith ( - "Internal Flow Error! Parsed `export interface` into something " ^ - "other than an interface declaration!" - ) - ); - Statement.ExportNamedDeclaration { - declaration = Some interface; - specifiers = None; - source = None; - exportKind = Statement.ExportType; - } - | T_LET - | T_CONST - | T_VAR - (* not using Peek.is_class here because it would guard all of the - * cases *) - | T_AT - | T_CLASS - (* not using Peek.is_function here because it would guard all of the - * cases *) - | T_ASYNC - | T_FUNCTION -> - let open Statement.ExportNamedDeclaration in - let stmt = Parse.statement_list_item env ~decorators:decorators in - let names = Statement.( - match stmt with - | (_, VariableDeclaration { VariableDeclaration.declarations; _; }) -> - List.fold_left (fun names (_, declaration) -> - let id = declaration.VariableDeclaration.Declarator.id in - extract_pattern_binding_names names [id] - ) [] declarations - | (loc, ClassDeclaration { Class.id = Some id; _; }) - | (loc, FunctionDeclaration { Function.id = Some id; _; }) - -> [(loc, extract_ident_name id)] - | (loc, ClassDeclaration { Class.id = None; _; }) -> - error_at env (loc, Error.ExportNamelessClass); - [] - | (loc, FunctionDeclaration { Function.id = None; _; }) -> - error_at env (loc, Error.ExportNamelessFunction); - [] - | _ -> failwith "Internal Flow Error! Unexpected export statement declaration!" - ) in - List.iter (record_export env) names; - Statement.ExportNamedDeclaration { - declaration = Some stmt; - specifiers = None; - source = None; - exportKind = Statement.ExportValue; - } - | T_MULT -> - let open Statement.ExportNamedDeclaration in - let loc = Peek.loc env in - Expect.token env T_MULT; - let local_name = - let parse_export_star_as = - (parse_options env).esproposal_export_star_as - in - match Peek.token env with - | T_IDENTIFIER { raw = "as"; _ } -> - Eat.token env; - if parse_export_star_as - then Some (Parse.identifier env) - else (error env Error.UnexpectedTypeDeclaration; None) - | _ -> - None - in - let specifiers = - Some (ExportBatchSpecifier (loc, local_name)) - in - let source = export_source env in - let source = Some source in - Eat.semicolon env; - Statement.ExportNamedDeclaration { - declaration = None; - specifiers; - source; - exportKind = Statement.ExportValue; - } - | _ -> - let open Statement.ExportNamedDeclaration in - let exportKind = ( - match Peek.token env with - | T_TYPE -> Eat.token env; Statement.ExportType - | _ -> Statement.ExportValue - ) in - Expect.token env T_LCURLY; - let specifiers = export_specifiers env [] in - Expect.token env T_RCURLY; - let source = + Statement.ExportNamedDeclaration.( + let export_kind = + match Peek.token env with + | T_TYPE -> + Eat.token env; + Statement.ExportType + | _ -> Statement.ExportValue + in + Expect.token env T_LCURLY; + let specifiers = export_specifiers env [] in + Expect.token env T_RCURLY; + let (source, trailing) = + match Peek.token env with + | T_IDENTIFIER { raw = "from"; _ } -> + let (source, trailing) = export_source_and_semicolon env in + (Some source, trailing) + | _ -> + assert_export_specifier_identifiers env specifiers; + let trailing = + match semicolon env with + | Explicit trailing -> trailing + | Implicit { trailing; _ } -> trailing + in + (None, trailing) + in + Statement.ExportNamedDeclaration + { + declaration = None; + specifiers = Some (ExportSpecifiers specifiers); + source; + export_kind; + comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + })) + + and declare_export_declaration ?(allow_export_type = false) = + with_loc (fun env -> + if not (should_parse_types env) then error env Parse_error.UnexpectedTypeDeclaration; + let leading = Peek.comments env in + Expect.token env T_DECLARE; + let env = env |> with_strict true |> with_in_export true in + let leading = leading @ Peek.comments env in + Expect.token env T_EXPORT; + Statement.DeclareExportDeclaration.( match Peek.token env with - | T_IDENTIFIER { raw = "from"; _ } -> - Some (export_source env) + | T_DEFAULT -> + (* declare export default ... *) + let leading = leading @ Peek.comments env in + let (default, ()) = with_loc (fun env -> Expect.token env T_DEFAULT) env in + let (declaration, trailing) = + match Peek.token env with + | T_FUNCTION -> + (* declare export default function foo (...): ... *) + let fn = with_loc declare_function env in + (Some (Function fn), []) + | T_CLASS -> + (* declare export default class foo { ... } *) + let class_ = with_loc (declare_class ~leading:[]) env in + (Some (Class class_), []) + | _ -> + (* declare export default [type]; *) + let type_ = Type._type env in + let (type_, trailing) = + match semicolon env with + | Explicit trailing -> (type_, trailing) + | Implicit { remove_trailing; _ } -> + (remove_trailing type_ (fun remover type_ -> remover#type_ type_), []) + in + (Some (DefaultType type_), trailing) + in + let comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () in + Statement.DeclareExportDeclaration + { default = Some default; declaration; specifiers = None; source = None; comments } + | T_LET + | T_CONST + | T_VAR + | T_CLASS + | T_FUNCTION -> + let declaration = + match Peek.token env with + | T_FUNCTION -> + (* declare export function foo (...): ... *) + let fn = with_loc declare_function env in + Some (Function fn) + | T_CLASS -> + (* declare export class foo { ... } *) + let class_ = with_loc (declare_class ~leading:[]) env in + Some (Class class_) + | (T_LET | T_CONST | T_VAR) as token -> + (match token with + | T_LET -> error env Parse_error.DeclareExportLet + | T_CONST -> error env Parse_error.DeclareExportConst + | _ -> ()); + + (* declare export var foo: ... *) + let var = with_loc (fun env -> declare_var env []) env in + Some (Variable var) + | _ -> assert false + in + let comments = Flow_ast_utils.mk_comments_opt ~leading () in + Statement.DeclareExportDeclaration + { default = None; declaration; specifiers = None; source = None; comments } + | T_MULT -> + (* declare export * from 'foo' *) + let loc = Peek.loc env in + Expect.token env T_MULT; + let parse_export_star_as = (parse_options env).esproposal_export_star_as in + let local_name = + match Peek.token env with + | T_IDENTIFIER { raw = "as"; _ } -> + Eat.token env; + if parse_export_star_as then + Some (Parse.identifier env) + else ( + error env Parse_error.UnexpectedTypeDeclaration; + None + ) + | _ -> None + in + let specifiers = + Statement.ExportNamedDeclaration.(Some (ExportBatchSpecifier (loc, local_name))) + in + let (source, trailing) = export_source_and_semicolon env in + let comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () in + Statement.DeclareExportDeclaration + { default = None; declaration = None; specifiers; source = Some source; comments } + | T_TYPE when allow_export_type -> + (* declare export type = ... *) + let alias = with_loc (type_alias_helper ~leading:[]) env in + let comments = Flow_ast_utils.mk_comments_opt ~leading () in + Statement.DeclareExportDeclaration + { + default = None; + declaration = Some (NamedType alias); + specifiers = None; + source = None; + comments; + } + | T_OPAQUE -> + (* declare export opaque type = ... *) + let opaque = with_loc (opaque_type_helper ~declare:true ~leading:[]) env in + let comments = Flow_ast_utils.mk_comments_opt ~leading () in + Statement.DeclareExportDeclaration + { + default = None; + declaration = Some (NamedOpaqueType opaque); + specifiers = None; + source = None; + comments; + } + | T_INTERFACE when allow_export_type -> + (* declare export interface ... *) + let iface = with_loc (interface_helper ~leading:[]) env in + let comments = Flow_ast_utils.mk_comments_opt ~leading () in + Statement.DeclareExportDeclaration + { + default = None; + declaration = Some (Interface iface); + specifiers = None; + source = None; + comments; + } | _ -> - assert_export_specifier_identifiers env specifiers; - None - in - Eat.semicolon env; - Statement.ExportNamedDeclaration { - declaration = None; - specifiers = Some (ExportSpecifiers specifiers); - source; - exportKind; - } - ) - - and declare_export_declaration ?(allow_export_type=false) = with_loc (fun env -> - if not (should_parse_types env) - then error env Error.UnexpectedTypeDeclaration; - Expect.token env T_DECLARE; - - let env = env |> with_strict true |> with_in_export true in - Expect.token env T_EXPORT; - Statement.DeclareExportDeclaration.(match Peek.token env with - | T_DEFAULT -> - (* declare export default ... *) - let default, () = with_loc (fun env -> - Expect.token env T_DEFAULT - ) env in - let declaration = match Peek.token env with - | T_FUNCTION -> - (* declare export default function foo (...): ... *) - let fn = with_loc declare_function env in - Some (Function fn) - | T_CLASS -> - (* declare export default class foo { ... } *) - let class_ = with_loc declare_class env in - Some (Class class_) - | _ -> - (* declare export default [type]; *) - let type_ = Type._type env in - Eat.semicolon env; - Some (DefaultType type_) - in - Statement.DeclareExportDeclaration { - default = Some default; - declaration; - specifiers = None; - source = None; - } - | T_LET - | T_CONST - | T_VAR - | T_CLASS - | T_FUNCTION -> - let declaration = match Peek.token env with - | T_FUNCTION -> - (* declare export function foo (...): ... *) - let fn = with_loc declare_function env in - Some (Function fn) - | T_CLASS -> - (* declare export class foo { ... } *) - let class_ = with_loc declare_class env in - Some (Class class_) - | T_LET - | T_CONST - | T_VAR as token -> - (match token with - | T_LET -> error env Error.DeclareExportLet - | T_CONST -> error env Error.DeclareExportConst + (match Peek.token env with + | T_TYPE -> error env Parse_error.DeclareExportType + | T_INTERFACE -> error env Parse_error.DeclareExportInterface | _ -> ()); - (* declare export var foo: ... *) - let var = with_loc declare_var env in - Some (Variable var) - | _ -> assert false in - Statement.DeclareExportDeclaration { - default = None; - declaration; - specifiers = None; - source = None; - } - | T_MULT -> - (* declare export * from 'foo' *) - let loc = Peek.loc env in - Expect.token env T_MULT; - let parse_export_star_as = - (parse_options env).esproposal_export_star_as - in - let local_name = - match Peek.token env with - | T_IDENTIFIER { raw = "as"; _ } -> - Eat.token env; - if parse_export_star_as - then Some (Parse.identifier env) - else (error env Error.UnexpectedTypeDeclaration; None) - | _ -> - None - in - let specifiers = Statement.ExportNamedDeclaration.( - Some (ExportBatchSpecifier (loc, local_name)) - ) in - let source = export_source env in - Eat.semicolon env; - Statement.DeclareExportDeclaration { - default = None; - declaration = None; - specifiers; - source = Some source; - } - | T_TYPE when allow_export_type -> - (* declare export type = ... *) - let alias = with_loc type_alias_helper env in - Statement.DeclareExportDeclaration { - default = None; - declaration = Some (NamedType alias); - specifiers = None; - source = None; - } - | T_OPAQUE -> - (* declare export opaque type = ... *) - let opaque = with_loc (opaque_type_helper ~declare:true) env in - Statement.DeclareExportDeclaration { - default = None; - declaration = Some (NamedOpaqueType opaque); - specifiers = None; - source = None; - } - | T_INTERFACE when allow_export_type -> - (* declare export interface ... *) - let iface = with_loc interface_helper env in - Statement.DeclareExportDeclaration { - default = None; - declaration = Some (Interface iface); - specifiers = None; - source = None; - } - | _ -> - (match Peek.token env with - | T_TYPE -> error env Error.DeclareExportType - | T_INTERFACE -> error env Error.DeclareExportInterface - | _ -> () - ); - Expect.token env T_LCURLY; - let specifiers = export_specifiers env [] in - Expect.token env T_RCURLY; - let source = - match Peek.token env with - | T_IDENTIFIER { raw = "from"; _ } -> - Some (export_source env) - | _ -> - assert_export_specifier_identifiers env specifiers; - None - in - Eat.semicolon env; - Statement.DeclareExportDeclaration { - default = None; - declaration = None; - specifiers = Some (Statement.ExportNamedDeclaration.ExportSpecifiers specifiers); - source; - } - ) - ) + Expect.token env T_LCURLY; + let specifiers = export_specifiers env [] in + Expect.token env T_RCURLY; + let (source, trailing) = + match Peek.token env with + | T_IDENTIFIER { raw = "from"; _ } -> + let (source, trailing) = export_source_and_semicolon env in + (Some source, trailing) + | _ -> + assert_export_specifier_identifiers env specifiers; + let trailing = + match semicolon env with + | Explicit trailing -> trailing + | Implicit { trailing; _ } -> trailing + in + (None, trailing) + in + let comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () in + Statement.DeclareExportDeclaration + { + default = None; + declaration = None; + specifiers = Some (Statement.ExportNamedDeclaration.ExportSpecifiers specifiers); + source; + comments; + })) and import_declaration = - let open Statement.ImportDeclaration in - - let source env = - Expect.identifier env "from"; - match Peek.token env with - | T_STRING (loc, value, raw, octal) -> - if octal then strict_error env Error.StrictOctalLiteral; - Expect.token env (T_STRING (loc, value, raw, octal)); - loc, { StringLiteral.value; raw; } - | _ -> - (* Just make up a string for the error case *) - let ret = Peek.loc env, { StringLiteral.value = ""; raw = ""; } in - error_unexpected env; - ret - - in let is_type_import = function - | T_TYPE - | T_TYPEOF -> true - | _ -> false - - (* `x` or `x as y` in a specifier *) - in let with_maybe_as ~for_type ?error_if_type env = - let identifier env = - if for_type then Type.type_identifier env else Parse.identifier env + Statement.ImportDeclaration.( + let missing_source env = + (* Just make up a string for the error case *) + let loc = Peek.loc_skip_lookahead env in + (loc, { StringLiteral.value = ""; raw = ""; comments = None }) in - match Peek.ith_token ~i:1 env with - | T_IDENTIFIER { raw = "as"; _ } -> - let remote = identifier_name env in - Eat.token env; (* as *) - let local = Some (identifier env) in - remote, local - | T_EOF - | T_COMMA - | T_RCURLY -> - identifier env, None - | _ -> - begin match error_if_type, Peek.token env with - | Some error_if_type, T_TYPE - | Some error_if_type, T_TYPEOF -> - error env error_if_type; - Eat.token env; (* consume `type` or `typeof` *) - Type.type_identifier env, None + let source env = + match Peek.token env with + | T_IDENTIFIER { raw = "from"; _ } -> + Eat.token env; + (match Peek.token env with + | T_STRING str -> string_literal env str + | _ -> + error_unexpected ~expected:"a string" env; + missing_source env) | _ -> - identifier env, None - end - - (* - ImportSpecifier[Type]: - [~Type] ImportedBinding - [~Type] IdentifierName ImportedTypeBinding - [~Type] IdentifierName IdentifierName ImportedBinding - [~Type] IdentifierName IdentifierName IdentifierName ImportedTypeBinding - [+Type] ImportedTypeBinding - [+Type] IdentifierName IdentifierName ImportedTypeBinding - - Static Semantics: - - `IdentifierName ImportedTypeBinding`: - - It is a Syntax Error if IdentifierName's StringValue is not "type" or "typeof" - - `IdentifierName IdentifierName ImportedBinding`: - - It is a Syntax Error if the second IdentifierName's StringValue is not "as" - - `IdentifierName IdentifierName IdentifierName ImportedTypeBinding`: - - It is a Syntax Error if the first IdentifierName's StringValue is not "type" - or "typeof", and the third IdentifierName's StringValue is not "as" - *) - in let specifier env = - let kind = match Peek.token env with - | T_TYPE -> Some ImportType - | T_TYPEOF -> Some ImportTypeof - | _ -> None + error_unexpected ~expected:"the keyword `from`" env; + missing_source env + in + let is_type_import = function + | T_TYPE + | T_TYPEOF -> + true + | _ -> false + (* `x` or `x as y` in a specifier *) in + let with_maybe_as ~for_type ?error_if_type env = + let identifier env = + if for_type then + Type.type_identifier env + else + Parse.identifier env + in + match Peek.ith_token ~i:1 env with + | T_IDENTIFIER { raw = "as"; _ } -> + let remote = identifier_name env in + Eat.token env; - if is_type_import (Peek.token env) then begin - (* consume `type`, but we don't know yet whether this is `type foo` or - `type as foo`. *) - let type_keyword_or_remote = identifier_name env in - match Peek.token env with - (* `type` (a value) *) + (* as *) + let local = Some (identifier env) in + (remote, local) | T_EOF - | T_RCURLY - | T_COMMA -> - let remote = type_keyword_or_remote in (* `type` becomes a value *) - Parse.assert_identifier_name_is_identifier env remote; - { remote; local = None; kind = None } + | T_COMMA + | T_RCURLY -> + (identifier env, None) + | _ -> + begin + match (error_if_type, Peek.token env) with + | (Some error_if_type, T_TYPE) + | (Some error_if_type, T_TYPEOF) -> + error env error_if_type; + Eat.token env; - (* `type as foo` (value named `type`) or `type as,` (type named `as`) *) - | T_IDENTIFIER { raw = "as"; _ } -> - begin match Peek.ith_token ~i:1 env with + (* consume `type` or `typeof` *) + (Type.type_identifier env, None) + | _ -> (identifier env, None) + end + (* + ImportSpecifier[Type]: + [~Type] ImportedBinding + [~Type] IdentifierName ImportedTypeBinding + [~Type] IdentifierName IdentifierName ImportedBinding + [~Type] IdentifierName IdentifierName IdentifierName ImportedTypeBinding + [+Type] ImportedTypeBinding + [+Type] IdentifierName IdentifierName ImportedTypeBinding + + Static Semantics: + + `IdentifierName ImportedTypeBinding`: + - It is a Syntax Error if IdentifierName's StringValue is not "type" or "typeof" + + `IdentifierName IdentifierName ImportedBinding`: + - It is a Syntax Error if the second IdentifierName's StringValue is not "as" + + `IdentifierName IdentifierName IdentifierName ImportedTypeBinding`: + - It is a Syntax Error if the first IdentifierName's StringValue is not "type" + or "typeof", and the third IdentifierName's StringValue is not "as" + *) + in + + let specifier env = + let kind = + match Peek.token env with + | T_TYPE -> Some ImportType + | T_TYPEOF -> Some ImportTypeof + | _ -> None + in + if is_type_import (Peek.token env) then + (* consume `type`, but we don't know yet whether this is `type foo` or + `type as foo`. *) + let type_keyword_or_remote = identifier_name env in + match Peek.token env with + (* `type` (a value) *) | T_EOF | T_RCURLY | T_COMMA -> - (* `type as` *) - { remote = Type.type_identifier env; local = None; kind } + let remote = type_keyword_or_remote in + (* `type` becomes a value *) + assert_identifier_name_is_identifier env remote; + { remote; local = None; kind = None } + (* `type as foo` (value named `type`) or `type as,` (type named `as`) *) | T_IDENTIFIER { raw = "as"; _ } -> - (* `type as as foo` *) - let remote = identifier_name env in (* first `as` *) - Eat.token env; (* second `as` *) - let local = Some (Type.type_identifier env) in (* `foo` *) - { remote; local; kind } + begin + match Peek.ith_token ~i:1 env with + | T_EOF + | T_RCURLY + | T_COMMA -> + (* `type as` *) + { remote = Type.type_identifier env; local = None; kind } + | T_IDENTIFIER { raw = "as"; _ } -> + (* `type as as foo` *) + let remote = identifier_name env in + (* first `as` *) + Eat.token env; + + (* second `as` *) + let local = Some (Type.type_identifier env) in + (* `foo` *) + { remote; local; kind } + | _ -> + (* `type as foo` *) + let remote = type_keyword_or_remote in + (* `type` becomes a value *) + assert_identifier_name_is_identifier env remote; + Eat.token env; + + (* `as` *) + let local = Some (Parse.identifier env) in + { remote; local; kind = None } + end + (* `type x`, or `type x as y` *) | _ -> - (* `type as foo` *) - let remote = type_keyword_or_remote in (* `type` becomes a value *) - Parse.assert_identifier_name_is_identifier env remote; - Eat.token env; (* `as` *) - let local = Some (Parse.identifier env) in - { remote; local; kind = None } - end - - (* `type x`, or `type x as y` *) - | _ -> - let remote, local = with_maybe_as ~for_type:true env in - { remote; local; kind } - end else - (* standard `x` or `x as y` *) - let remote, local = with_maybe_as ~for_type:false env in - { remote; local; kind = None } - - (* specifier in an `import type { ... }` *) - in let type_specifier env = - let remote, local = with_maybe_as env - ~for_type:true - ~error_if_type:Error.ImportTypeShorthandOnlyInPureImport + let (remote, local) = with_maybe_as ~for_type:true env in + { remote; local; kind } + else + (* standard `x` or `x as y` *) + let (remote, local) = with_maybe_as ~for_type:false env in + { remote; local; kind = None } + (* specifier in an `import type { ... }` *) in - { remote; local; kind = None } - - (* specifier in an `import typeof { ... }` *) - in let typeof_specifier env = - let remote, local = with_maybe_as env - ~for_type:true - ~error_if_type:Error.ImportTypeShorthandOnlyInPureImport + let type_specifier env = + let (remote, local) = + with_maybe_as + env + ~for_type:true + ~error_if_type:Parse_error.ImportTypeShorthandOnlyInPureImport + in + { remote; local; kind = None } + (* specifier in an `import typeof { ... }` *) in - { remote; local; kind = None } - - in let rec specifier_list ?(preceding_comma=true) env statement_kind acc = - match Peek.token env with - | T_EOF - | T_RCURLY -> List.rev acc - | _ -> - if not preceding_comma then error env Error.ImportSpecifierMissingComma; - let specifier = match statement_kind with - | ImportType -> type_specifier env - | ImportTypeof -> typeof_specifier env - | ImportValue -> specifier env + let typeof_specifier env = + let (remote, local) = + with_maybe_as + env + ~for_type:true + ~error_if_type:Parse_error.ImportTypeShorthandOnlyInPureImport in - let preceding_comma = Expect.maybe env T_COMMA in - specifier_list ~preceding_comma env statement_kind (specifier::acc) - - in let named_or_namespace_specifier env import_kind = - let start_loc = Peek.loc env in - match Peek.token env with - | T_MULT -> - Expect.token env T_MULT; - Expect.identifier env "as"; - let id = match import_kind with - | ImportType - | ImportTypeof -> Type.type_identifier env - | ImportValue -> Parse.identifier env + { remote; local; kind = None } + in + let rec specifier_list ?(preceding_comma = true) env statement_kind acc = + match Peek.token env with + | T_EOF + | T_RCURLY -> + List.rev acc + | _ -> + if not preceding_comma then error env Parse_error.ImportSpecifierMissingComma; + let specifier = + match statement_kind with + | ImportType -> type_specifier env + | ImportTypeof -> typeof_specifier env + | ImportValue -> specifier env in - ImportNamespaceSpecifier (Loc.btwn start_loc (fst id), id) - | _ -> + let preceding_comma = Eat.maybe env T_COMMA in + specifier_list ~preceding_comma env statement_kind (specifier :: acc) + in + let named_or_namespace_specifier env import_kind = + match Peek.token env with + | T_MULT -> + let id = + with_loc_opt + (fun env -> + (* consume T_MULT *) + Eat.token env; + match Peek.token env with + | T_IDENTIFIER { raw = "as"; _ } -> + (* consume "as" *) + Eat.token env; + (match import_kind with + | ImportType + | ImportTypeof -> + Some (Type.type_identifier env) + | ImportValue -> Some (Parse.identifier env)) + | _ -> + error_unexpected ~expected:"the keyword `as`" env; + None) + env + in + (match id with + | Some id -> Some (ImportNamespaceSpecifier id) + | None -> None) + | _ -> Expect.token env T_LCURLY; let specifiers = specifier_list env import_kind [] in Expect.token env T_RCURLY; - ImportNamedSpecifiers specifiers - - in let with_specifiers importKind env = - let specifiers = Some (named_or_namespace_specifier env importKind) in - let source = source env in - Eat.semicolon env; - Statement.ImportDeclaration { - importKind; - source; - specifiers; - default = None; - } - - in let with_default importKind env = - let default_specifier = match importKind with - | ImportType - | ImportTypeof -> Type.type_identifier env - | ImportValue -> Parse.identifier env + Some (ImportNamedSpecifiers specifiers) in - - let additional_specifiers = - match Peek.token env with - | T_COMMA -> (* `import Foo, ...` *) + let semicolon_and_trailing env source = + match semicolon env with + | Explicit trailing -> (trailing, source) + | Implicit { remove_trailing; _ } -> + ( [], + remove_trailing source (fun remover (loc, source) -> + (loc, remover#string_literal_type loc source)) ) + in + let with_specifiers import_kind env leading = + let specifiers = named_or_namespace_specifier env import_kind in + let source = source env in + let (trailing, source) = semicolon_and_trailing env source in + Statement.ImportDeclaration + { + import_kind; + source; + specifiers; + default = None; + comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + } + in + let with_default import_kind env leading = + let default_specifier = + match import_kind with + | ImportType + | ImportTypeof -> + Type.type_identifier env + | ImportValue -> Parse.identifier env + in + let additional_specifiers = + match Peek.token env with + | T_COMMA -> + (* `import Foo, ...` *) Expect.token env T_COMMA; - Some (named_or_namespace_specifier env importKind) - | _ -> None + named_or_namespace_specifier env import_kind + | _ -> None + in + let source = source env in + let (trailing, source) = semicolon_and_trailing env source in + Statement.ImportDeclaration + { + import_kind; + source; + specifiers = additional_specifiers; + default = Some default_specifier; + comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + } in + with_loc (fun env -> + let env = env |> with_strict true in + let leading = Peek.comments env in + Expect.token env T_IMPORT; - let source = source env in - Eat.semicolon env; - Statement.ImportDeclaration { - importKind; - source; - specifiers = additional_specifiers; - default = Some default_specifier; - } - - in with_loc (fun env -> - let env = env |> with_strict true in - Expect.token env T_IMPORT; - - match Peek.token env with - (* `import * as ns from "ModuleName";` *) - | T_MULT -> - with_specifiers ImportValue env - - (* `import { ... } from "ModuleName";` *) - | T_LCURLY -> - with_specifiers ImportValue env - - (* `import "ModuleName";` *) - | T_STRING (str_loc, value, raw, octal) -> - if octal then strict_error env Error.StrictOctalLiteral; - Expect.token env (T_STRING (str_loc, value, raw, octal)); - let source = (str_loc, { StringLiteral.value; raw; }) in - Eat.semicolon env; - Statement.ImportDeclaration { - importKind = ImportValue; - source; - specifiers = None; - default = None; - } - - (* `import type [...] from "ModuleName";` - note that if [...] is missing, we're importing a value named `type`! *) - | T_TYPE when should_parse_types env -> - begin match Peek.ith_token ~i:1 env with - (* `import type, { other, names } from "ModuleName";` *) - | T_COMMA - (* `import type from "ModuleName";` *) - | T_IDENTIFIER { raw = "from"; _ } -> - with_default ImportValue env - | T_MULT -> - (* `import type *` is invalid, since the namespace can't be a type *) - Eat.token env; (* consume `type` *) - error_unexpected env; (* unexpected `*` *) - with_specifiers ImportType env - | T_LCURLY -> - Eat.token env; (* consume `type` *) - with_specifiers ImportType env - | _ -> - Eat.token env; (* consume `type` *) - with_default ImportType env - end - - (* `import typeof ... from "ModuleName";` *) - | T_TYPEOF when should_parse_types env -> - Expect.token env T_TYPEOF; - begin match Peek.token env with - | T_MULT - | T_LCURLY -> with_specifiers ImportTypeof env - | _ -> with_default ImportTypeof env - end - - (* import Foo from "ModuleName"; *) - | _ -> - with_default ImportValue env - ) + match Peek.token env with + (* `import * as ns from "ModuleName";` *) + | T_MULT -> with_specifiers ImportValue env leading + (* `import { ... } from "ModuleName";` *) + | T_LCURLY -> with_specifiers ImportValue env leading + (* `import "ModuleName";` *) + | T_STRING str -> + let source = string_literal env str in + let (trailing, source) = semicolon_and_trailing env source in + Statement.ImportDeclaration + { + import_kind = ImportValue; + source; + specifiers = None; + default = None; + comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + } + (* `import type [...] from "ModuleName";` + note that if [...] is missing, we're importing a value named `type`! *) + | T_TYPE when should_parse_types env -> + begin + match Peek.ith_token ~i:1 env with + (* `import type, { other, names } from "ModuleName";` *) + | T_COMMA + (* `import type from "ModuleName";` *) + | T_IDENTIFIER { raw = "from"; _ } -> + (* Importing the exported value named "type". This is not a type-import.*) + with_default ImportValue env leading + (* `import type *` is invalid, since the namespace can't be a type *) + | T_MULT -> + (* consume `type` *) + Eat.token env; + + (* unexpected `*` *) + error_unexpected env; + + with_specifiers ImportType env leading + | T_LCURLY -> + (* consume `type` *) + Eat.token env; + + with_specifiers ImportType env leading + | _ -> + (* consume `type` *) + Eat.token env; + + with_default ImportType env leading + end + (* `import typeof ... from "ModuleName";` *) + | T_TYPEOF when should_parse_types env -> + Expect.token env T_TYPEOF; + begin + match Peek.token env with + | T_MULT + | T_LCURLY -> + with_specifiers ImportTypeof env leading + | _ -> with_default ImportTypeof env leading + end + (* import Foo from "ModuleName"; *) + | _ -> with_default ImportValue env leading)) end diff --git a/lib/test/esprima/ES2016/exponent/exp_assign.js b/lib/test/esprima/ES2016/exponent/exp_assign.js new file mode 100644 index 0000000..d5fc642 --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/exp_assign.js @@ -0,0 +1 @@ +x **= y; diff --git a/lib/test/esprima/ES2016/exponent/exp_assign.tree.json b/lib/test/esprima/ES2016/exponent/exp_assign.tree.json new file mode 100644 index 0000000..0cbf3f3 --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/exp_assign.tree.json @@ -0,0 +1,165 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "**=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "**=", + "range": [ + 2, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/ES2016/exponent/exp_bitnot.js b/lib/test/esprima/ES2016/exponent/exp_bitnot.js new file mode 100644 index 0000000..f00704c --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/exp_bitnot.js @@ -0,0 +1 @@ +x ** ~y diff --git a/lib/test/esprima/ES2016/exponent/exp_bitnot.tree.json b/lib/test/esprima/ES2016/exponent/exp_bitnot.tree.json new file mode 100644 index 0000000..29af108 --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/exp_bitnot.tree.json @@ -0,0 +1,184 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "**", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "UnaryExpression", + "operator": "~", + "argument": { + "type": "Identifier", + "name": "y", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "prefix": true, + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "**", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "~", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/ES2016/exponent/exp_delete.js b/lib/test/esprima/ES2016/exponent/exp_delete.js new file mode 100644 index 0000000..286d9e2 --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/exp_delete.js @@ -0,0 +1 @@ +x ** delete y diff --git a/lib/test/esprima/ES2016/exponent/exp_delete.tree.json b/lib/test/esprima/ES2016/exponent/exp_delete.tree.json new file mode 100644 index 0000000..f597b22 --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/exp_delete.tree.json @@ -0,0 +1,184 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "**", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "UnaryExpression", + "operator": "delete", + "argument": { + "type": "Identifier", + "name": "y", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "prefix": true, + "range": [ + 5, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "**", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Keyword", + "value": "delete", + "range": [ + 5, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/ES2016/exponent/exp_minus.js b/lib/test/esprima/ES2016/exponent/exp_minus.js new file mode 100644 index 0000000..52aa1e3 --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/exp_minus.js @@ -0,0 +1 @@ +x ** -y diff --git a/lib/test/esprima/ES2016/exponent/exp_minus.tree.json b/lib/test/esprima/ES2016/exponent/exp_minus.tree.json new file mode 100644 index 0000000..8420576 --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/exp_minus.tree.json @@ -0,0 +1,184 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "**", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "UnaryExpression", + "operator": "-", + "argument": { + "type": "Identifier", + "name": "y", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "prefix": true, + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "**", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "-", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/ES2016/exponent/exp_minusminus.js b/lib/test/esprima/ES2016/exponent/exp_minusminus.js new file mode 100644 index 0000000..8b1d481 --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/exp_minusminus.js @@ -0,0 +1 @@ +x ** --y diff --git a/lib/test/esprima/ES2016/exponent/exp_minusminus.tree.json b/lib/test/esprima/ES2016/exponent/exp_minusminus.tree.json new file mode 100644 index 0000000..341dea1 --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/exp_minusminus.tree.json @@ -0,0 +1,184 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "**", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "UpdateExpression", + "operator": "--", + "argument": { + "type": "Identifier", + "name": "y", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "prefix": true, + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "**", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "--", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/ES2016/exponent/exp_not.js b/lib/test/esprima/ES2016/exponent/exp_not.js new file mode 100644 index 0000000..73ab0d9 --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/exp_not.js @@ -0,0 +1 @@ +x ** !y diff --git a/lib/test/esprima/ES2016/exponent/exp_not.tree.json b/lib/test/esprima/ES2016/exponent/exp_not.tree.json new file mode 100644 index 0000000..e63a5af --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/exp_not.tree.json @@ -0,0 +1,184 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "**", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "UnaryExpression", + "operator": "!", + "argument": { + "type": "Identifier", + "name": "y", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "prefix": true, + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "**", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "!", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/ES2016/exponent/exp_operator.js b/lib/test/esprima/ES2016/exponent/exp_operator.js new file mode 100644 index 0000000..361b0f1 --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/exp_operator.js @@ -0,0 +1 @@ +x ** y diff --git a/lib/test/esprima/ES2016/exponent/exp_operator.tree.json b/lib/test/esprima/ES2016/exponent/exp_operator.tree.json new file mode 100644 index 0000000..3886dc3 --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/exp_operator.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "**", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "**", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/ES2016/exponent/exp_plus.js b/lib/test/esprima/ES2016/exponent/exp_plus.js new file mode 100644 index 0000000..c9f4668 --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/exp_plus.js @@ -0,0 +1 @@ +x ** +y diff --git a/lib/test/esprima/ES2016/exponent/exp_plus.tree.json b/lib/test/esprima/ES2016/exponent/exp_plus.tree.json new file mode 100644 index 0000000..386d367 --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/exp_plus.tree.json @@ -0,0 +1,184 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "**", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "UnaryExpression", + "operator": "+", + "argument": { + "type": "Identifier", + "name": "y", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "prefix": true, + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "**", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/ES2016/exponent/exp_plusplus.js b/lib/test/esprima/ES2016/exponent/exp_plusplus.js new file mode 100644 index 0000000..4ea8216 --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/exp_plusplus.js @@ -0,0 +1 @@ +x ** ++y diff --git a/lib/test/esprima/ES2016/exponent/exp_plusplus.tree.json b/lib/test/esprima/ES2016/exponent/exp_plusplus.tree.json new file mode 100644 index 0000000..b38e906 --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/exp_plusplus.tree.json @@ -0,0 +1,184 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "**", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "UpdateExpression", + "operator": "++", + "argument": { + "type": "Identifier", + "name": "y", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "prefix": true, + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "**", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "++", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/ES2016/exponent/exp_precedence.js b/lib/test/esprima/ES2016/exponent/exp_precedence.js new file mode 100644 index 0000000..73dc30b --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/exp_precedence.js @@ -0,0 +1 @@ +x * y ** -z diff --git a/lib/test/esprima/ES2016/exponent/exp_precedence.tree.json b/lib/test/esprima/ES2016/exponent/exp_precedence.tree.json new file mode 100644 index 0000000..db0a65b --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/exp_precedence.tree.json @@ -0,0 +1,256 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "*", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "**", + "left": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "UnaryExpression", + "operator": "-", + "argument": { + "type": "Identifier", + "name": "z", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "prefix": true, + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "**", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "-", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/ES2016/exponent/exp_typeof.js b/lib/test/esprima/ES2016/exponent/exp_typeof.js new file mode 100644 index 0000000..a625cc1 --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/exp_typeof.js @@ -0,0 +1 @@ +x ** typeof y diff --git a/lib/test/esprima/ES2016/exponent/exp_typeof.tree.json b/lib/test/esprima/ES2016/exponent/exp_typeof.tree.json new file mode 100644 index 0000000..ff8c5fe --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/exp_typeof.tree.json @@ -0,0 +1,184 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "**", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "UnaryExpression", + "operator": "typeof", + "argument": { + "type": "Identifier", + "name": "y", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "prefix": true, + "range": [ + 5, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "**", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Keyword", + "value": "typeof", + "range": [ + 5, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/ES2016/exponent/exp_void.js b/lib/test/esprima/ES2016/exponent/exp_void.js new file mode 100644 index 0000000..b8d27b8 --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/exp_void.js @@ -0,0 +1 @@ +x ** void y diff --git a/lib/test/esprima/ES2016/exponent/exp_void.tree.json b/lib/test/esprima/ES2016/exponent/exp_void.tree.json new file mode 100644 index 0000000..e6ad297 --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/exp_void.tree.json @@ -0,0 +1,184 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "**", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "UnaryExpression", + "operator": "void", + "argument": { + "type": "Identifier", + "name": "y", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "prefix": true, + "range": [ + 5, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "**", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Keyword", + "value": "void", + "range": [ + 5, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/ES2016/exponent/invalid_bitnot_exp.failure.json b/lib/test/esprima/ES2016/exponent/invalid_bitnot_exp.failure.json new file mode 100644 index 0000000..c3792fe --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/invalid_bitnot_exp.failure.json @@ -0,0 +1 @@ +{"index":3,"lineNumber":1,"column":4,"message":"Error: Line 1: Unexpected token **","description":"Unexpected token **"} \ No newline at end of file diff --git a/lib/test/esprima/ES2016/exponent/invalid_bitnot_exp.js b/lib/test/esprima/ES2016/exponent/invalid_bitnot_exp.js new file mode 100644 index 0000000..300ad3a --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/invalid_bitnot_exp.js @@ -0,0 +1 @@ +~x ** y diff --git a/lib/test/esprima/ES2016/exponent/invalid_delete_exp.failure.json b/lib/test/esprima/ES2016/exponent/invalid_delete_exp.failure.json new file mode 100644 index 0000000..f7d966e --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/invalid_delete_exp.failure.json @@ -0,0 +1 @@ +{"index":9,"lineNumber":1,"column":10,"message":"Error: Line 1: Unexpected token **","description":"Unexpected token **"} \ No newline at end of file diff --git a/lib/test/esprima/ES2016/exponent/invalid_delete_exp.js b/lib/test/esprima/ES2016/exponent/invalid_delete_exp.js new file mode 100644 index 0000000..46779ba --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/invalid_delete_exp.js @@ -0,0 +1 @@ +delete x ** y diff --git a/lib/test/esprima/ES2016/exponent/invalid_minus_exp.failure.json b/lib/test/esprima/ES2016/exponent/invalid_minus_exp.failure.json new file mode 100644 index 0000000..c3792fe --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/invalid_minus_exp.failure.json @@ -0,0 +1 @@ +{"index":3,"lineNumber":1,"column":4,"message":"Error: Line 1: Unexpected token **","description":"Unexpected token **"} \ No newline at end of file diff --git a/lib/test/esprima/ES2016/exponent/invalid_minus_exp.js b/lib/test/esprima/ES2016/exponent/invalid_minus_exp.js new file mode 100644 index 0000000..562ad1d --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/invalid_minus_exp.js @@ -0,0 +1 @@ +-x ** y diff --git a/lib/test/esprima/ES2016/exponent/invalid_not_exp.failure.json b/lib/test/esprima/ES2016/exponent/invalid_not_exp.failure.json new file mode 100644 index 0000000..c3792fe --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/invalid_not_exp.failure.json @@ -0,0 +1 @@ +{"index":3,"lineNumber":1,"column":4,"message":"Error: Line 1: Unexpected token **","description":"Unexpected token **"} \ No newline at end of file diff --git a/lib/test/esprima/ES2016/exponent/invalid_not_exp.js b/lib/test/esprima/ES2016/exponent/invalid_not_exp.js new file mode 100644 index 0000000..e3198ab --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/invalid_not_exp.js @@ -0,0 +1 @@ +!x ** y diff --git a/lib/test/esprima/ES2016/exponent/invalid_plus_exp.failure.json b/lib/test/esprima/ES2016/exponent/invalid_plus_exp.failure.json new file mode 100644 index 0000000..c3792fe --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/invalid_plus_exp.failure.json @@ -0,0 +1 @@ +{"index":3,"lineNumber":1,"column":4,"message":"Error: Line 1: Unexpected token **","description":"Unexpected token **"} \ No newline at end of file diff --git a/lib/test/esprima/ES2016/exponent/invalid_plus_exp.js b/lib/test/esprima/ES2016/exponent/invalid_plus_exp.js new file mode 100644 index 0000000..0eab885 --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/invalid_plus_exp.js @@ -0,0 +1 @@ ++x ** y diff --git a/lib/test/esprima/ES2016/exponent/invalid_typeof_exp.failure.json b/lib/test/esprima/ES2016/exponent/invalid_typeof_exp.failure.json new file mode 100644 index 0000000..f7d966e --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/invalid_typeof_exp.failure.json @@ -0,0 +1 @@ +{"index":9,"lineNumber":1,"column":10,"message":"Error: Line 1: Unexpected token **","description":"Unexpected token **"} \ No newline at end of file diff --git a/lib/test/esprima/ES2016/exponent/invalid_typeof_exp.js b/lib/test/esprima/ES2016/exponent/invalid_typeof_exp.js new file mode 100644 index 0000000..ad4e825 --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/invalid_typeof_exp.js @@ -0,0 +1 @@ +typeof x ** y diff --git a/lib/test/esprima/ES2016/exponent/invalid_update.js b/lib/test/esprima/ES2016/exponent/invalid_update.js new file mode 100644 index 0000000..602ec5e --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/invalid_update.js @@ -0,0 +1 @@ +(++x ** y) + (--p ** q) diff --git a/lib/test/esprima/ES2016/exponent/invalid_update.tree.json b/lib/test/esprima/ES2016/exponent/invalid_update.tree.json new file mode 100644 index 0000000..4c2fcfd --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/invalid_update.tree.json @@ -0,0 +1,437 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "BinaryExpression", + "operator": "**", + "left": { + "type": "UpdateExpression", + "operator": "++", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "prefix": true, + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "**", + "left": { + "type": "UpdateExpression", + "operator": "--", + "argument": { + "type": "Identifier", + "name": "p", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "prefix": true, + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "right": { + "type": "Identifier", + "name": "q", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 14, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "++", + "range": [ + 1, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "**", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "--", + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "p", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "**", + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "q", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/ES2016/exponent/invalid_void_exp.failure.json b/lib/test/esprima/ES2016/exponent/invalid_void_exp.failure.json new file mode 100644 index 0000000..1a77298 --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/invalid_void_exp.failure.json @@ -0,0 +1 @@ +{"index":7,"lineNumber":1,"column":8,"message":"Error: Line 1: Unexpected token **","description":"Unexpected token **"} \ No newline at end of file diff --git a/lib/test/esprima/ES2016/exponent/invalid_void_exp.js b/lib/test/esprima/ES2016/exponent/invalid_void_exp.js new file mode 100644 index 0000000..0e3bd21 --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/invalid_void_exp.js @@ -0,0 +1 @@ +void x ** y diff --git a/lib/test/esprima/ES2016/exponent/update_exp.js b/lib/test/esprima/ES2016/exponent/update_exp.js new file mode 100644 index 0000000..57aca15 --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/update_exp.js @@ -0,0 +1 @@ +(++x ** y) - (--p ** q) diff --git a/lib/test/esprima/ES2016/exponent/update_exp.tree.json b/lib/test/esprima/ES2016/exponent/update_exp.tree.json new file mode 100644 index 0000000..b2c7b60 --- /dev/null +++ b/lib/test/esprima/ES2016/exponent/update_exp.tree.json @@ -0,0 +1,437 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "-", + "left": { + "type": "BinaryExpression", + "operator": "**", + "left": { + "type": "UpdateExpression", + "operator": "++", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "prefix": true, + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "**", + "left": { + "type": "UpdateExpression", + "operator": "--", + "argument": { + "type": "Identifier", + "name": "p", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "prefix": true, + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "right": { + "type": "Identifier", + "name": "q", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 14, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "++", + "range": [ + 1, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "**", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "-", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "--", + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "p", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "**", + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "q", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/ES2016/identifier/gujarati_zha.js b/lib/test/esprima/ES2016/identifier/gujarati_zha.js new file mode 100644 index 0000000..14c74c4 --- /dev/null +++ b/lib/test/esprima/ES2016/identifier/gujarati_zha.js @@ -0,0 +1,2 @@ +ૹ + diff --git a/lib/test/esprima/ES2016/identifier/gujarati_zha.tree.json b/lib/test/esprima/ES2016/identifier/gujarati_zha.tree.json new file mode 100644 index 0000000..5af35ae --- /dev/null +++ b/lib/test/esprima/ES2016/identifier/gujarati_zha.tree.json @@ -0,0 +1,75 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "ૹ", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "tokens": [ + { + "type": "Identifier", + "value": "ૹ", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/array-binding-pattern/array-binding-pattern-01.js b/lib/test/esprima/ES6/arrow-function/array-binding-pattern/array-binding-pattern-01.js new file mode 100644 index 0000000..1767877 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/array-binding-pattern/array-binding-pattern-01.js @@ -0,0 +1 @@ +([a]) => [0]; diff --git a/lib/test/esprima/ES6/arrow-function/array-binding-pattern/array-binding-pattern-01.tree.json b/lib/test/esprima/ES6/arrow-function/array-binding-pattern/array-binding-pattern-01.tree.json new file mode 100644 index 0000000..c35a221 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/array-binding-pattern/array-binding-pattern-01.tree.json @@ -0,0 +1,316 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "type": "Identifier", + "name": "a" + } + ] + } + ], + "body": { + "range": [ + 9, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "ArrayExpression", + "elements": [ + { + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + ] + }, + "generator": false, + "expression": true + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } +} diff --git a/lib/test/esprima/ES6/arrow-function/array-binding-pattern/array-binding-pattern-02.js b/lib/test/esprima/ES6/arrow-function/array-binding-pattern/array-binding-pattern-02.js new file mode 100644 index 0000000..0fe9b0c --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/array-binding-pattern/array-binding-pattern-02.js @@ -0,0 +1 @@ +([a,b])=>0; diff --git a/lib/test/esprima/ES6/arrow-function/array-binding-pattern/array-binding-pattern-02.tree.json b/lib/test/esprima/ES6/arrow-function/array-binding-pattern/array-binding-pattern-02.tree.json new file mode 100644 index 0000000..8e3ff2a --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/array-binding-pattern/array-binding-pattern-02.tree.json @@ -0,0 +1,315 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "range": [ + 1, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "type": "Identifier", + "name": "a" + }, + { + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "type": "Identifier", + "name": "b" + } + ] + } + ], + "body": { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + }, + "generator": false, + "expression": true + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } +} diff --git a/lib/test/esprima/ES6/arrow-function/array-binding-pattern/array-binding-pattern-03.js b/lib/test/esprima/ES6/arrow-function/array-binding-pattern/array-binding-pattern-03.js new file mode 100644 index 0000000..05fb549 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/array-binding-pattern/array-binding-pattern-03.js @@ -0,0 +1 @@ +([a,...b])=>0; diff --git a/lib/test/esprima/ES6/arrow-function/array-binding-pattern/array-binding-pattern-03.tree.json b/lib/test/esprima/ES6/arrow-function/array-binding-pattern/array-binding-pattern-03.tree.json new file mode 100644 index 0000000..c2294d8 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/array-binding-pattern/array-binding-pattern-03.tree.json @@ -0,0 +1,350 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "type": "Identifier", + "name": "a" + }, + { + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "RestElement", + "argument": { + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "Identifier", + "name": "b" + } + } + ] + } + ], + "body": { + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + }, + "generator": false, + "expression": true + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } +} diff --git a/lib/test/esprima/ES6/arrow-function/array-binding-pattern/array-binding-pattern-empty.js b/lib/test/esprima/ES6/arrow-function/array-binding-pattern/array-binding-pattern-empty.js new file mode 100644 index 0000000..49f16d5 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/array-binding-pattern/array-binding-pattern-empty.js @@ -0,0 +1 @@ +([])=>0; diff --git a/lib/test/esprima/ES6/arrow-function/array-binding-pattern/array-binding-pattern-empty.tree.json b/lib/test/esprima/ES6/arrow-function/array-binding-pattern/array-binding-pattern-empty.tree.json new file mode 100644 index 0000000..35f37ef --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/array-binding-pattern/array-binding-pattern-empty.tree.json @@ -0,0 +1,224 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "range": [ + 1, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "type": "ArrayPattern", + "elements": [] + } + ], + "body": { + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + }, + "generator": false, + "expression": true + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } +} diff --git a/lib/test/esprima/ES6/arrow-function/array-binding-pattern/elision.js b/lib/test/esprima/ES6/arrow-function/array-binding-pattern/elision.js new file mode 100644 index 0000000..f5e9538 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/array-binding-pattern/elision.js @@ -0,0 +1 @@ +([,,])=>0 diff --git a/lib/test/esprima/ES6/arrow-function/array-binding-pattern/elision.tree.json b/lib/test/esprima/ES6/arrow-function/array-binding-pattern/elision.tree.json new file mode 100644 index 0000000..13d0cc1 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/array-binding-pattern/elision.tree.json @@ -0,0 +1,245 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "type": "ArrayPattern", + "elements": [ + null, + null + ] + } + ], + "body": { + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + }, + "generator": false, + "expression": true + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } +} diff --git a/lib/test/esprima/ES6/arrow-function/array-binding-pattern/invalid-dup-param.failure.json b/lib/test/esprima/ES6/arrow-function/array-binding-pattern/invalid-dup-param.failure.json new file mode 100644 index 0000000..308e25b --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/array-binding-pattern/invalid-dup-param.failure.json @@ -0,0 +1 @@ +{"index":14,"lineNumber":1,"column":15,"message":"Error: Line 1: Strict mode function may not have duplicate parameter names","description":"Strict mode function may not have duplicate parameter names"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/array-binding-pattern/invalid-dup-param.js b/lib/test/esprima/ES6/arrow-function/array-binding-pattern/invalid-dup-param.js new file mode 100644 index 0000000..1bd2fde --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/array-binding-pattern/invalid-dup-param.js @@ -0,0 +1 @@ +([a,[b],...b])=>0; diff --git a/lib/test/esprima/ES6/arrow-function/array-binding-pattern/invalid-elision-after-rest.failure.json b/lib/test/esprima/ES6/arrow-function/array-binding-pattern/invalid-elision-after-rest.failure.json new file mode 100644 index 0000000..5efbe18 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/array-binding-pattern/invalid-elision-after-rest.failure.json @@ -0,0 +1 @@ +{"index":11,"lineNumber":1,"column":12,"message":"Error: Line 1: Unexpected token =>","description":"Unexpected token =>"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/array-binding-pattern/invalid-elision-after-rest.js b/lib/test/esprima/ES6/arrow-function/array-binding-pattern/invalid-elision-after-rest.js new file mode 100644 index 0000000..6042292 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/array-binding-pattern/invalid-elision-after-rest.js @@ -0,0 +1 @@ +([a,...b,])=>0; diff --git a/lib/test/esprima/ES6/arrow-function/arrow-rest-forgetting-comma.failure.json b/lib/test/esprima/ES6/arrow-function/arrow-rest-forgetting-comma.failure.json new file mode 100644 index 0000000..ccef97e --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/arrow-rest-forgetting-comma.failure.json @@ -0,0 +1 @@ +{"index":3,"lineNumber":1,"column":4,"message":"Error: Line 1: Unexpected token ...","description":"Unexpected token ..."} \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/arrow-rest-forgetting-comma.js b/lib/test/esprima/ES6/arrow-function/arrow-rest-forgetting-comma.js new file mode 100644 index 0000000..de12082 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/arrow-rest-forgetting-comma.js @@ -0,0 +1 @@ +(a ...b) => 0 diff --git a/lib/test/esprima/ES6/arrow-function/arrow-with-multiple-arg-and-rest.js b/lib/test/esprima/ES6/arrow-function/arrow-with-multiple-arg-and-rest.js new file mode 100644 index 0000000..61d7f20 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/arrow-with-multiple-arg-and-rest.js @@ -0,0 +1 @@ +(a,b,...c) => 0; diff --git a/lib/test/esprima/ES6/arrow-function/arrow-with-multiple-arg-and-rest.tree.json b/lib/test/esprima/ES6/arrow-function/arrow-with-multiple-arg-and-rest.tree.json new file mode 100644 index 0000000..c464bf7 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/arrow-with-multiple-arg-and-rest.tree.json @@ -0,0 +1,349 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "type": "Identifier", + "name": "a" + }, + { + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "type": "Identifier", + "name": "b" + }, + { + "range": [ + 5, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "RestElement", + "argument": { + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "Identifier", + "name": "c" + } + } + ], + "body": { + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + }, + "generator": false, + "expression": true + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } +} diff --git a/lib/test/esprima/ES6/arrow-function/arrow-with-multiple-rest.failure.json b/lib/test/esprima/ES6/arrow-function/arrow-with-multiple-rest.failure.json new file mode 100644 index 0000000..a415581 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/arrow-with-multiple-rest.failure.json @@ -0,0 +1 @@ +{"index":5,"lineNumber":1,"column":6,"message":"Error: Line 1: Rest parameter must be last formal parameter","description":"Rest parameter must be last formal parameter"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/arrow-with-multiple-rest.js b/lib/test/esprima/ES6/arrow-function/arrow-with-multiple-rest.js new file mode 100644 index 0000000..7d8f773 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/arrow-with-multiple-rest.js @@ -0,0 +1 @@ +(...a, ...b) => 0 diff --git a/lib/test/esprima/ES6/arrow-function/arrow-with-only-rest.js b/lib/test/esprima/ES6/arrow-function/arrow-with-only-rest.js new file mode 100644 index 0000000..db6e46e --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/arrow-with-only-rest.js @@ -0,0 +1 @@ +(...a) => 0 diff --git a/lib/test/esprima/ES6/arrow-function/arrow-with-only-rest.tree.json b/lib/test/esprima/ES6/arrow-function/arrow-with-only-rest.tree.json new file mode 100644 index 0000000..1cd50a3 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/arrow-with-only-rest.tree.json @@ -0,0 +1,223 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "type": "RestElement", + "argument": { + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "type": "Identifier", + "name": "a" + } + } + ], + "body": { + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + }, + "generator": false, + "expression": true + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } +} diff --git a/lib/test/esprima/ES6/arrow-function/complex-rest-in-arrow-not-allowed.failure.json b/lib/test/esprima/ES6/arrow-function/complex-rest-in-arrow-not-allowed.failure.json new file mode 100644 index 0000000..300fb60 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/complex-rest-in-arrow-not-allowed.failure.json @@ -0,0 +1 @@ +{"index":6,"lineNumber":1,"column":7,"message":"Error: Line 1: Unexpected token [","description":"Unexpected token ["} \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/complex-rest-in-arrow-not-allowed.js b/lib/test/esprima/ES6/arrow-function/complex-rest-in-arrow-not-allowed.js new file mode 100644 index 0000000..ed8b57e --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/complex-rest-in-arrow-not-allowed.js @@ -0,0 +1 @@ +(a,...[a]) => 0; diff --git a/lib/test/esprima/ES6/arrow-function/invalid-duplicated-params.failure.json b/lib/test/esprima/ES6/arrow-function/invalid-duplicated-params.failure.json new file mode 100644 index 0000000..0509c17 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/invalid-duplicated-params.failure.json @@ -0,0 +1 @@ +{"index":6,"lineNumber":1,"column":7,"message":"Error: Line 1: Strict mode function may not have duplicate parameter names","description":"Strict mode function may not have duplicate parameter names"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/invalid-duplicated-params.js b/lib/test/esprima/ES6/arrow-function/invalid-duplicated-params.js new file mode 100644 index 0000000..edd030d --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/invalid-duplicated-params.js @@ -0,0 +1 @@ +(x, x) => y; diff --git a/lib/test/esprima/ES6/arrow-function/invalid-line-terminator-arrow.failure.json b/lib/test/esprima/ES6/arrow-function/invalid-line-terminator-arrow.failure.json new file mode 100644 index 0000000..c143544 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/invalid-line-terminator-arrow.failure.json @@ -0,0 +1 @@ +{"index":3,"lineNumber":2,"column":4,"message":"Error: Line 2: Unexpected token =>","description":"Unexpected token =>"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/invalid-line-terminator-arrow.js b/lib/test/esprima/ES6/arrow-function/invalid-line-terminator-arrow.js new file mode 100644 index 0000000..efc10aa --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/invalid-line-terminator-arrow.js @@ -0,0 +1,2 @@ +() +=> 42 diff --git a/lib/test/esprima/ES6/arrow-function/invalid-param-strict-mode.failure.json b/lib/test/esprima/ES6/arrow-function/invalid-param-strict-mode.failure.json new file mode 100644 index 0000000..af42170 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/invalid-param-strict-mode.failure.json @@ -0,0 +1 @@ +{"index":22,"lineNumber":1,"column":23,"message":"Error: Line 1: Parameter name eval or arguments is not allowed in strict mode","description":"Parameter name eval or arguments is not allowed in strict mode"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/invalid-param-strict-mode.js b/lib/test/esprima/ES6/arrow-function/invalid-param-strict-mode.js new file mode 100644 index 0000000..5087dd1 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/invalid-param-strict-mode.js @@ -0,0 +1 @@ +eval => {"use strict"}; diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0000.js b/lib/test/esprima/ES6/arrow-function/migrated_0000.js new file mode 100644 index 0000000..b3d35f9 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0000.js @@ -0,0 +1 @@ +() => "test" \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0000.tree.json b/lib/test/esprima/ES6/arrow-function/migrated_0000.tree.json new file mode 100644 index 0000000..a81a74f --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0000.tree.json @@ -0,0 +1,151 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [], + "body": { + "type": "Literal", + "value": "test", + "raw": "\"test\"", + "range": [ + 6, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 3, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "String", + "value": "\"test\"", + "range": [ + 6, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } +} diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0001.js b/lib/test/esprima/ES6/arrow-function/migrated_0001.js new file mode 100644 index 0000000..8831c09 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0001.js @@ -0,0 +1 @@ +e => "test" \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0001.tree.json b/lib/test/esprima/ES6/arrow-function/migrated_0001.tree.json new file mode 100644 index 0000000..3213f1d --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0001.tree.json @@ -0,0 +1,152 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "e", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "body": { + "type": "Literal", + "value": "test", + "raw": "\"test\"", + "range": [ + 5, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "e", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "String", + "value": "\"test\"", + "range": [ + 5, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } +} diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0002.js b/lib/test/esprima/ES6/arrow-function/migrated_0002.js new file mode 100644 index 0000000..9252bdb --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0002.js @@ -0,0 +1 @@ +(e) => "test" \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0002.tree.json b/lib/test/esprima/ES6/arrow-function/migrated_0002.tree.json new file mode 100644 index 0000000..8a1f1fc --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0002.tree.json @@ -0,0 +1,188 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "e", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ], + "body": { + "type": "Literal", + "value": "test", + "raw": "\"test\"", + "range": [ + 7, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "e", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "String", + "value": "\"test\"", + "range": [ + 7, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } +} diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0003.js b/lib/test/esprima/ES6/arrow-function/migrated_0003.js new file mode 100644 index 0000000..82fd804 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0003.js @@ -0,0 +1 @@ +(a, b) => "test" \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0003.tree.json b/lib/test/esprima/ES6/arrow-function/migrated_0003.tree.json new file mode 100644 index 0000000..75733dd --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0003.tree.json @@ -0,0 +1,242 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "name": "b", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "body": { + "type": "Literal", + "value": "test", + "raw": "\"test\"", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "String", + "value": "\"test\"", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } +} diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0004.js b/lib/test/esprima/ES6/arrow-function/migrated_0004.js new file mode 100644 index 0000000..59caa38 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0004.js @@ -0,0 +1 @@ +e => { 42; } \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0004.tree.json b/lib/test/esprima/ES6/arrow-function/migrated_0004.tree.json new file mode 100644 index 0000000..76ecf91 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0004.tree.json @@ -0,0 +1,242 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "e", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 7, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "range": [ + 5, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "e", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } +} diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0005.js b/lib/test/esprima/ES6/arrow-function/migrated_0005.js new file mode 100644 index 0000000..11aaefd --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0005.js @@ -0,0 +1 @@ +e => ({ property: 42 }) \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0005.tree.json b/lib/test/esprima/ES6/arrow-function/migrated_0005.tree.json new file mode 100644 index 0000000..3ef04cb --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0005.tree.json @@ -0,0 +1,318 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "e", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "body": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "property", + "range": [ + 8, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "computed": false, + "value": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 8, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "range": [ + 6, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "e", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "property", + "range": [ + 8, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } +} diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0006.diff b/lib/test/esprima/ES6/arrow-function/migrated_0006.diff new file mode 100644 index 0000000..d3f90cd --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0006.diff @@ -0,0 +1,20 @@ +{ + 'body': { + '0': { + 'expression': { + 'body': { + 'body': { + '0': { + 'range': { '1': 16 }, + 'loc': { 'end': { 'column': 16 }}, + 'body': { + 'range': { '1': 16 }, + 'loc': { 'end': { 'column': 16 }}, + } + } + } + } + } + } + } +} diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0006.js b/lib/test/esprima/ES6/arrow-function/migrated_0006.js new file mode 100644 index 0000000..aad6207 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0006.js @@ -0,0 +1 @@ +e => { label: 42 } \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0006.tree.json b/lib/test/esprima/ES6/arrow-function/migrated_0006.tree.json new file mode 100644 index 0000000..707f013 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0006.tree.json @@ -0,0 +1,295 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "e", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "LabeledStatement", + "label": { + "type": "Identifier", + "name": "label", + "range": [ + 7, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 7, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "range": [ + 5, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "e", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "label", + "range": [ + 7, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } +} diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0007.js b/lib/test/esprima/ES6/arrow-function/migrated_0007.js new file mode 100644 index 0000000..35c8a46 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0007.js @@ -0,0 +1 @@ +(a, b) => { 42; } \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0007.tree.json b/lib/test/esprima/ES6/arrow-function/migrated_0007.tree.json new file mode 100644 index 0000000..016c067 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0007.tree.json @@ -0,0 +1,332 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "name": "b", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 12, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 10, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } +} diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0008.diff b/lib/test/esprima/ES6/arrow-function/migrated_0008.diff new file mode 100644 index 0000000..24f60d7 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0008.diff @@ -0,0 +1,13 @@ +{ + "body": { + "0": { + "expression": { + "params": { + "0": { + "operator": undefined + } + } + } + } + } +} diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0008.js b/lib/test/esprima/ES6/arrow-function/migrated_0008.js new file mode 100644 index 0000000..e7c95a3 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0008.js @@ -0,0 +1 @@ +(x=1) => x * x \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0008.tree.json b/lib/test/esprima/ES6/arrow-function/migrated_0008.tree.json new file mode 100644 index 0000000..bb438eb --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0008.tree.json @@ -0,0 +1,332 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "AssignmentPattern", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "right": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "body": { + "type": "BinaryExpression", + "operator": "*", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "right": { + "type": "Identifier", + "name": "x", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0009.js b/lib/test/esprima/ES6/arrow-function/migrated_0009.js new file mode 100644 index 0000000..62ea586 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0009.js @@ -0,0 +1 @@ +eval => 42 \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0009.tree.json b/lib/test/esprima/ES6/arrow-function/migrated_0009.tree.json new file mode 100644 index 0000000..133b8c8 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0009.tree.json @@ -0,0 +1,152 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "eval", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "body": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "eval", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } +} diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0010.js b/lib/test/esprima/ES6/arrow-function/migrated_0010.js new file mode 100644 index 0000000..945a56c --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0010.js @@ -0,0 +1 @@ +arguments => 42 \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0010.tree.json b/lib/test/esprima/ES6/arrow-function/migrated_0010.tree.json new file mode 100644 index 0000000..5e57de3 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0010.tree.json @@ -0,0 +1,152 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "arguments", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "body": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 13, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "arguments", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 13, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } +} diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0011.js b/lib/test/esprima/ES6/arrow-function/migrated_0011.js new file mode 100644 index 0000000..4c35828 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0011.js @@ -0,0 +1 @@ +(a) => 00 \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0011.tree.json b/lib/test/esprima/ES6/arrow-function/migrated_0011.tree.json new file mode 100644 index 0000000..75d26bd --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0011.tree.json @@ -0,0 +1,188 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ], + "body": { + "type": "Literal", + "value": 0, + "raw": "00", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Numeric", + "value": "00", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } +} diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0012.js b/lib/test/esprima/ES6/arrow-function/migrated_0012.js new file mode 100644 index 0000000..0c97ac9 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0012.js @@ -0,0 +1 @@ +(eval, a) => 42 \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0012.tree.json b/lib/test/esprima/ES6/arrow-function/migrated_0012.tree.json new file mode 100644 index 0000000..cde6fac --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0012.tree.json @@ -0,0 +1,242 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "eval", + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "name": "a", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "body": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 13, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "eval", + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 13, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } +} diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0013.diff b/lib/test/esprima/ES6/arrow-function/migrated_0013.diff new file mode 100644 index 0000000..24f60d7 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0013.diff @@ -0,0 +1,13 @@ +{ + "body": { + "0": { + "expression": { + "params": { + "0": { + "operator": undefined + } + } + } + } + } +} diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0013.js b/lib/test/esprima/ES6/arrow-function/migrated_0013.js new file mode 100644 index 0000000..4b1ac05 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0013.js @@ -0,0 +1 @@ +(eval = 10) => 42 \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0013.tree.json b/lib/test/esprima/ES6/arrow-function/migrated_0013.tree.json new file mode 100644 index 0000000..614b73e --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0013.tree.json @@ -0,0 +1,261 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "AssignmentPattern", + "operator": "=", + "left": { + "type": "Identifier", + "name": "eval", + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Literal", + "value": 10, + "raw": "10", + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 1, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "body": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "eval", + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Numeric", + "value": "10", + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0014.diff b/lib/test/esprima/ES6/arrow-function/migrated_0014.diff new file mode 100644 index 0000000..a243e9b --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0014.diff @@ -0,0 +1,13 @@ +{ + "body": { + "0": { + "expression": { + "params": { + "1": { + "operator": undefined + } + } + } + } + } +} diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0014.js b/lib/test/esprima/ES6/arrow-function/migrated_0014.js new file mode 100644 index 0000000..354d4c6 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0014.js @@ -0,0 +1 @@ +(eval, a = 10) => 42 \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0014.tree.json b/lib/test/esprima/ES6/arrow-function/migrated_0014.tree.json new file mode 100644 index 0000000..0887497 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0014.tree.json @@ -0,0 +1,315 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "eval", + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "AssignmentPattern", + "operator": "=", + "left": { + "type": "Identifier", + "name": "a", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "right": { + "type": "Literal", + "value": 10, + "raw": "10", + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 7, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "body": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "eval", + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Numeric", + "value": "10", + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0015.js b/lib/test/esprima/ES6/arrow-function/migrated_0015.js new file mode 100644 index 0000000..70290ba --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0015.js @@ -0,0 +1 @@ +(x => x) \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0015.tree.json b/lib/test/esprima/ES6/arrow-function/migrated_0015.tree.json new file mode 100644 index 0000000..330bc49 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0015.tree.json @@ -0,0 +1,187 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ], + "body": { + "type": "Identifier", + "name": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 3, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } +} diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0016.js b/lib/test/esprima/ES6/arrow-function/migrated_0016.js new file mode 100644 index 0000000..48b1498 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0016.js @@ -0,0 +1 @@ +x => y => 42 \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0016.tree.json b/lib/test/esprima/ES6/arrow-function/migrated_0016.tree.json new file mode 100644 index 0000000..95bd458 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0016.tree.json @@ -0,0 +1,228 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "body": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "body": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 5, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } +} diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0017.js b/lib/test/esprima/ES6/arrow-function/migrated_0017.js new file mode 100644 index 0000000..7cb6567 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0017.js @@ -0,0 +1 @@ +(x) => ((y, z) => (x, y, z)) \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0017.tree.json b/lib/test/esprima/ES6/arrow-function/migrated_0017.tree.json new file mode 100644 index 0000000..98a9c52 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0017.tree.json @@ -0,0 +1,552 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ], + "body": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "y", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "name": "z", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "body": { + "type": "SequenceExpression", + "expressions": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Identifier", + "name": "y", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Identifier", + "name": "z", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "range": [ + 19, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 8, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + } +} diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0018.js b/lib/test/esprima/ES6/arrow-function/migrated_0018.js new file mode 100644 index 0000000..0434063 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0018.js @@ -0,0 +1 @@ +foo(() => {}) \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0018.tree.json b/lib/test/esprima/ES6/arrow-function/migrated_0018.tree.json new file mode 100644 index 0000000..63101bc --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0018.tree.json @@ -0,0 +1,259 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "foo", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 4, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "foo", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } +} diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0019.js b/lib/test/esprima/ES6/arrow-function/migrated_0019.js new file mode 100644 index 0000000..56c8bc0 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0019.js @@ -0,0 +1 @@ +foo((x, y) => {}) \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0019.tree.json b/lib/test/esprima/ES6/arrow-function/migrated_0019.tree.json new file mode 100644 index 0000000..ca66629 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0019.tree.json @@ -0,0 +1,350 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "foo", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "name": "y", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 4, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "foo", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } +} diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0020.js b/lib/test/esprima/ES6/arrow-function/migrated_0020.js new file mode 100644 index 0000000..4599cbc --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0020.js @@ -0,0 +1 @@ +(sun) => earth \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/migrated_0020.tree.json b/lib/test/esprima/ES6/arrow-function/migrated_0020.tree.json new file mode 100644 index 0000000..10d0f0d --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/migrated_0020.tree.json @@ -0,0 +1,187 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "sun", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "body": { + "type": "Identifier", + "name": "earth", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "sun", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "earth", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } +} diff --git a/lib/test/esprima/ES6/arrow-function/non-arrow-param-followed-by-arrow.failure.json b/lib/test/esprima/ES6/arrow-function/non-arrow-param-followed-by-arrow.failure.json new file mode 100644 index 0000000..477e3a5 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/non-arrow-param-followed-by-arrow.failure.json @@ -0,0 +1 @@ +{"index":6,"lineNumber":1,"column":7,"message":"Error: Line 1: Unexpected token =>","description":"Unexpected token =>"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/non-arrow-param-followed-by-arrow.js b/lib/test/esprima/ES6/arrow-function/non-arrow-param-followed-by-arrow.js new file mode 100644 index 0000000..487bb99 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/non-arrow-param-followed-by-arrow.js @@ -0,0 +1 @@ +((a)) => 0 diff --git a/lib/test/esprima/ES6/arrow-function/non-arrow-param-followed-by-rest.failure.json b/lib/test/esprima/ES6/arrow-function/non-arrow-param-followed-by-rest.failure.json new file mode 100644 index 0000000..b65118c --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/non-arrow-param-followed-by-rest.failure.json @@ -0,0 +1 @@ +{"index":5,"lineNumber":1,"column":6,"message":"Error: Line 1: Unexpected token ...","description":"Unexpected token ..."} \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/non-arrow-param-followed-by-rest.js b/lib/test/esprima/ES6/arrow-function/non-arrow-param-followed-by-rest.js new file mode 100644 index 0000000..df151fb --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/non-arrow-param-followed-by-rest.js @@ -0,0 +1 @@ +((a),...b) => 0; diff --git a/lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-member-expr.failure.json b/lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-member-expr.failure.json new file mode 100644 index 0000000..8245542 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-member-expr.failure.json @@ -0,0 +1 @@ +{"index":10,"lineNumber":1,"column":11,"message":"Error: Line 1: Unexpected token =>","description":"Unexpected token =>"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-member-expr.js b/lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-member-expr.js new file mode 100644 index 0000000..a5f4a07 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-member-expr.js @@ -0,0 +1 @@ +({a:b[0]})=>0 diff --git a/lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-method-in-pattern.failure.json b/lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-method-in-pattern.failure.json new file mode 100644 index 0000000..030f8f3 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-method-in-pattern.failure.json @@ -0,0 +1 @@ +{"index":14,"lineNumber":1,"column":15,"message":"Error: Line 1: Unexpected token =>","description":"Unexpected token =>"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-method-in-pattern.js b/lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-method-in-pattern.js new file mode 100644 index 0000000..79ff928 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-method-in-pattern.js @@ -0,0 +1 @@ +({get a(){}}) => 0; diff --git a/lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-nested-param.failure.json b/lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-nested-param.failure.json new file mode 100644 index 0000000..08ba5ac --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-nested-param.failure.json @@ -0,0 +1 @@ +{"index":50,"lineNumber":1,"column":51,"message":"Error: Line 1: Unexpected token =>","description":"Unexpected token =>"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-nested-param.js b/lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-nested-param.js new file mode 100644 index 0000000..a0f03b9 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-nested-param.js @@ -0,0 +1 @@ +([[[[[[[[[[[[[[[[[[[[{a:b[0]}]]]]]]]]]]]]]]]]]]]])=>0; diff --git a/lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-pattern-without-parenthesis.failure.json b/lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-pattern-without-parenthesis.failure.json new file mode 100644 index 0000000..b0c1b45 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-pattern-without-parenthesis.failure.json @@ -0,0 +1 @@ +{"index":3,"lineNumber":1,"column":4,"message":"Error: Line 1: Unexpected token =>","description":"Unexpected token =>"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-pattern-without-parenthesis.js b/lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-pattern-without-parenthesis.js new file mode 100644 index 0000000..76fa79d --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-pattern-without-parenthesis.js @@ -0,0 +1 @@ +({}=>0) diff --git a/lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-rest-in-object-pattern.failure.json b/lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-rest-in-object-pattern.failure.json new file mode 100644 index 0000000..6551a47 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-rest-in-object-pattern.failure.json @@ -0,0 +1 @@ +{"index":4,"lineNumber":1,"column":5,"message":"Error: Line 1: Unexpected token ...","description":"Unexpected token ..."} \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-rest-in-object-pattern.js b/lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-rest-in-object-pattern.js new file mode 100644 index 0000000..77352f8 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/object-binding-pattern/invalid-rest-in-object-pattern.js @@ -0,0 +1 @@ +({a,...b}) => 0; diff --git a/lib/test/esprima/ES6/arrow-function/object-binding-pattern/nested-cover-grammar.js b/lib/test/esprima/ES6/arrow-function/object-binding-pattern/nested-cover-grammar.js new file mode 100644 index 0000000..3481b6c --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/object-binding-pattern/nested-cover-grammar.js @@ -0,0 +1 @@ +([[[[[[[[[[[[[[[[[[[[{a=b}]]]]]]]]]]]]]]]]]]]])=>0; diff --git a/lib/test/esprima/ES6/arrow-function/object-binding-pattern/nested-cover-grammar.tree.json b/lib/test/esprima/ES6/arrow-function/object-binding-pattern/nested-cover-grammar.tree.json new file mode 100644 index 0000000..5da4957 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/object-binding-pattern/nested-cover-grammar.tree.json @@ -0,0 +1,1471 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "range": [ + 1, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 2, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 3, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 4, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 5, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 6, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 7, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 8, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 9, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 10, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 11, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 12, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 13, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 14, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 15, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 16, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 17, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 18, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 19, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 20, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 21, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "type": "ObjectPattern", + "properties": [ + { + "range": [ + 22, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "Property", + "key": { + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "type": "Identifier", + "name": "a" + }, + "computed": false, + "value": { + "range": [ + 22, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "AssignmentPattern", + "left": { + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "type": "Identifier", + "name": "a" + }, + "right": { + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "Identifier", + "name": "b" + } + }, + "kind": "init", + "method": false, + "shorthand": true + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ], + "body": { + "range": [ + 49, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + }, + "generator": false, + "expression": true + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 47 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 47, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 49 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 49, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 50 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 50 + }, + "end": { + "line": 1, + "column": 51 + } + } + } + ], + "range": [ + 0, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 51 + } + } +} diff --git a/lib/test/esprima/ES6/arrow-function/object-binding-pattern/object-binding-pattern-01.js b/lib/test/esprima/ES6/arrow-function/object-binding-pattern/object-binding-pattern-01.js new file mode 100644 index 0000000..c50a2a7 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/object-binding-pattern/object-binding-pattern-01.js @@ -0,0 +1 @@ +({a,b=b,a:c,[a]:[d]})=>0; diff --git a/lib/test/esprima/ES6/arrow-function/object-binding-pattern/object-binding-pattern-01.tree.json b/lib/test/esprima/ES6/arrow-function/object-binding-pattern/object-binding-pattern-01.tree.json new file mode 100644 index 0000000..b0a4c23 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/object-binding-pattern/object-binding-pattern-01.tree.json @@ -0,0 +1,813 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "range": [ + 1, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "ObjectPattern", + "properties": [ + { + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "type": "Property", + "key": { + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "type": "Identifier", + "name": "a" + }, + "computed": false, + "value": { + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "type": "Identifier", + "name": "a" + }, + "kind": "init", + "method": false, + "shorthand": true + }, + { + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Property", + "key": { + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "type": "Identifier", + "name": "b" + }, + "computed": false, + "value": { + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "AssignmentPattern", + "left": { + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "type": "Identifier", + "name": "b" + }, + "right": { + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Identifier", + "name": "b" + } + }, + "kind": "init", + "method": false, + "shorthand": true + }, + { + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Property", + "key": { + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "Identifier", + "name": "a" + }, + "computed": false, + "value": { + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Identifier", + "name": "c" + }, + "kind": "init", + "method": false, + "shorthand": false + }, + { + "range": [ + 12, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "type": "Property", + "key": { + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Identifier", + "name": "a" + }, + "computed": true, + "value": { + "range": [ + 16, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "Identifier", + "name": "d" + } + ] + }, + "kind": "init", + "method": false, + "shorthand": false + } + ] + } + ], + "body": { + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + }, + "generator": false, + "expression": true + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 21, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } +} diff --git a/lib/test/esprima/ES6/arrow-function/object-binding-pattern/object-binding-pattern-empty.js b/lib/test/esprima/ES6/arrow-function/object-binding-pattern/object-binding-pattern-empty.js new file mode 100644 index 0000000..acfe224 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/object-binding-pattern/object-binding-pattern-empty.js @@ -0,0 +1 @@ +({})=>0; diff --git a/lib/test/esprima/ES6/arrow-function/object-binding-pattern/object-binding-pattern-empty.tree.json b/lib/test/esprima/ES6/arrow-function/object-binding-pattern/object-binding-pattern-empty.tree.json new file mode 100644 index 0000000..c84d750 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/object-binding-pattern/object-binding-pattern-empty.tree.json @@ -0,0 +1,224 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "range": [ + 1, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "type": "ObjectPattern", + "properties": [] + } + ], + "body": { + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + }, + "generator": false, + "expression": true + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } +} diff --git a/lib/test/esprima/ES6/arrow-function/param-with-rest-without-arrow.failure.json b/lib/test/esprima/ES6/arrow-function/param-with-rest-without-arrow.failure.json new file mode 100644 index 0000000..963e4b5 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/param-with-rest-without-arrow.failure.json @@ -0,0 +1 @@ +{"index":10,"lineNumber":1,"column":11,"message":"Error: Line 1: Unexpected token +","description":"Unexpected token +"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/param-with-rest-without-arrow.js b/lib/test/esprima/ES6/arrow-function/param-with-rest-without-arrow.js new file mode 100644 index 0000000..65116d4 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/param-with-rest-without-arrow.js @@ -0,0 +1 @@ +(b, ...a) + 1 diff --git a/lib/test/esprima/ES6/arrow-function/rest-without-arrow.failure.json b/lib/test/esprima/ES6/arrow-function/rest-without-arrow.failure.json new file mode 100644 index 0000000..0ee73a1 --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/rest-without-arrow.failure.json @@ -0,0 +1 @@ +{"index":7,"lineNumber":1,"column":8,"message":"Error: Line 1: Unexpected token +","description":"Unexpected token +"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/arrow-function/rest-without-arrow.js b/lib/test/esprima/ES6/arrow-function/rest-without-arrow.js new file mode 100644 index 0000000..13d242d --- /dev/null +++ b/lib/test/esprima/ES6/arrow-function/rest-without-arrow.js @@ -0,0 +1 @@ +(...a) + 1 diff --git a/lib/test/esprima/ES6/binary-integer-literal/migrated_0000.js b/lib/test/esprima/ES6/binary-integer-literal/migrated_0000.js new file mode 100644 index 0000000..b06a298 --- /dev/null +++ b/lib/test/esprima/ES6/binary-integer-literal/migrated_0000.js @@ -0,0 +1 @@ +0b0 \ No newline at end of file diff --git a/lib/test/esprima/ES6/binary-integer-literal/migrated_0000.tree.json b/lib/test/esprima/ES6/binary-integer-literal/migrated_0000.tree.json new file mode 100644 index 0000000..f6bf992 --- /dev/null +++ b/lib/test/esprima/ES6/binary-integer-literal/migrated_0000.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 0, + "raw": "0b0", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "0b0", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } +} diff --git a/lib/test/esprima/ES6/binary-integer-literal/migrated_0001.js b/lib/test/esprima/ES6/binary-integer-literal/migrated_0001.js new file mode 100644 index 0000000..414f2ce --- /dev/null +++ b/lib/test/esprima/ES6/binary-integer-literal/migrated_0001.js @@ -0,0 +1 @@ +0b1 \ No newline at end of file diff --git a/lib/test/esprima/ES6/binary-integer-literal/migrated_0001.tree.json b/lib/test/esprima/ES6/binary-integer-literal/migrated_0001.tree.json new file mode 100644 index 0000000..2f7fa90 --- /dev/null +++ b/lib/test/esprima/ES6/binary-integer-literal/migrated_0001.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 1, + "raw": "0b1", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "0b1", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } +} diff --git a/lib/test/esprima/ES6/binary-integer-literal/migrated_0002.js b/lib/test/esprima/ES6/binary-integer-literal/migrated_0002.js new file mode 100644 index 0000000..43ed937 --- /dev/null +++ b/lib/test/esprima/ES6/binary-integer-literal/migrated_0002.js @@ -0,0 +1 @@ +0b10 \ No newline at end of file diff --git a/lib/test/esprima/ES6/binary-integer-literal/migrated_0002.tree.json b/lib/test/esprima/ES6/binary-integer-literal/migrated_0002.tree.json new file mode 100644 index 0000000..a0bf049 --- /dev/null +++ b/lib/test/esprima/ES6/binary-integer-literal/migrated_0002.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 2, + "raw": "0b10", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "0b10", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } +} diff --git a/lib/test/esprima/ES6/binary-integer-literal/migrated_0003.js b/lib/test/esprima/ES6/binary-integer-literal/migrated_0003.js new file mode 100644 index 0000000..e7c3f37 --- /dev/null +++ b/lib/test/esprima/ES6/binary-integer-literal/migrated_0003.js @@ -0,0 +1 @@ +0B0 \ No newline at end of file diff --git a/lib/test/esprima/ES6/binary-integer-literal/migrated_0003.tree.json b/lib/test/esprima/ES6/binary-integer-literal/migrated_0003.tree.json new file mode 100644 index 0000000..45b6352 --- /dev/null +++ b/lib/test/esprima/ES6/binary-integer-literal/migrated_0003.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 0, + "raw": "0B0", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "0B0", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } +} diff --git a/lib/test/esprima/ES6/binary-integer-literal/migrated_0004.js b/lib/test/esprima/ES6/binary-integer-literal/migrated_0004.js new file mode 100644 index 0000000..1dc8b28 --- /dev/null +++ b/lib/test/esprima/ES6/binary-integer-literal/migrated_0004.js @@ -0,0 +1 @@ +0B1 \ No newline at end of file diff --git a/lib/test/esprima/ES6/binary-integer-literal/migrated_0004.tree.json b/lib/test/esprima/ES6/binary-integer-literal/migrated_0004.tree.json new file mode 100644 index 0000000..059c10f --- /dev/null +++ b/lib/test/esprima/ES6/binary-integer-literal/migrated_0004.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 1, + "raw": "0B1", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "0B1", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } +} diff --git a/lib/test/esprima/ES6/binary-integer-literal/migrated_0005.js b/lib/test/esprima/ES6/binary-integer-literal/migrated_0005.js new file mode 100644 index 0000000..15cc797 --- /dev/null +++ b/lib/test/esprima/ES6/binary-integer-literal/migrated_0005.js @@ -0,0 +1 @@ +0B10 \ No newline at end of file diff --git a/lib/test/esprima/ES6/binary-integer-literal/migrated_0005.tree.json b/lib/test/esprima/ES6/binary-integer-literal/migrated_0005.tree.json new file mode 100644 index 0000000..3a5488a --- /dev/null +++ b/lib/test/esprima/ES6/binary-integer-literal/migrated_0005.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 2, + "raw": "0B10", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "0B10", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } +} diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/dupe-param.diff b/lib/test/esprima/ES6/binding-pattern/array-pattern/dupe-param.diff new file mode 100644 index 0000000..e93b9e2 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/dupe-param.diff @@ -0,0 +1,31 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 2, "column": 14 }, + "end": { "line": 2, "column": 15 } + } + }, + "1": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 3, "column": 17 }, + "end": { "line": 3, "column": 18 } + } + }, + "2": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 4, "column": 19 }, + "end": { "line": 4, "column": 20 } + } + } + } +} diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/dupe-param.js b/lib/test/esprima/ES6/binding-pattern/array-pattern/dupe-param.js new file mode 100644 index 0000000..7b475a3 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/dupe-param.js @@ -0,0 +1,4 @@ +"use strict"; +function a([a,a]){ } +function a([a,...a]){ } +function a([{a},...a]){ } \ No newline at end of file diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/dupe-param.tree.json b/lib/test/esprima/ES6/binding-pattern/array-pattern/dupe-param.tree.json new file mode 100644 index 0000000..d7c0553 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/dupe-param.tree.json @@ -0,0 +1,1209 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"" + }, + "directive": "use strict" + }, + { + "range": [ + 14, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "type": "Identifier", + "name": "a" + }, + "params": [ + { + "range": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "type": "Identifier", + "name": "a" + }, + { + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "type": "Identifier", + "name": "a" + } + ] + } + ], + "body": { + "range": [ + 31, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false + }, + { + "range": [ + 35, + 58 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 23 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "type": "Identifier", + "name": "a" + }, + "params": [ + { + "range": [ + 46, + 54 + ], + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 19 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "type": "Identifier", + "name": "a" + }, + { + "range": [ + 49, + 53 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 18 + } + }, + "type": "RestElement", + "argument": { + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 18 + } + }, + "type": "Identifier", + "name": "a" + } + } + ] + } + ], + "body": { + "range": [ + 55, + 58 + ], + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 23 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false + }, + { + "range": [ + 59, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 25 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 68, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 10 + } + }, + "type": "Identifier", + "name": "a" + }, + "params": [ + { + "range": [ + 70, + 80 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 21 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 71, + 74 + ], + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 15 + } + }, + "type": "ObjectPattern", + "properties": [ + { + "range": [ + 72, + 73 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 14 + } + }, + "type": "Property", + "key": { + "range": [ + 72, + 73 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 14 + } + }, + "type": "Identifier", + "name": "a" + }, + "computed": false, + "value": { + "range": [ + 72, + 73 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 14 + } + }, + "type": "Identifier", + "name": "a" + }, + "kind": "init", + "method": false, + "shorthand": true + } + ] + }, + { + "range": [ + 75, + 79 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 20 + } + }, + "type": "RestElement", + "argument": { + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 4, + "column": 19 + }, + "end": { + "line": 4, + "column": 20 + } + }, + "type": "Identifier", + "name": "a" + } + } + ] + } + ], + "body": { + "range": [ + 81, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 4, + "column": 25 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 14, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 35, + 43 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 49, + 52 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 57, + 58 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 23 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 59, + 67 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 68, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 69, + 70 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 71, + 72 + ], + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 72, + 73 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 73, + 74 + ], + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 74, + 75 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 75, + 78 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 4, + "column": 19 + }, + "end": { + "line": 4, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 79, + 80 + ], + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 80, + 81 + ], + "loc": { + "start": { + "line": 4, + "column": 21 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 81, + 82 + ], + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 83, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 24 + }, + "end": { + "line": 4, + "column": 25 + } + } + } + ], + "errors": [ + { + "index": 28, + "lineNumber": 2, + "column": 15, + "message": "Error: Line 2: Strict mode function may not have duplicate parameter names" + }, + { + "index": 52, + "lineNumber": 3, + "column": 18, + "message": "Error: Line 3: Strict mode function may not have duplicate parameter names" + }, + { + "index": 78, + "lineNumber": 4, + "column": 20, + "message": "Error: Line 4: Strict mode function may not have duplicate parameter names" + } + ], + "range": [ + 0, + 84 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 25 + } + } +} diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/elision.js b/lib/test/esprima/ES6/binding-pattern/array-pattern/elision.js new file mode 100644 index 0000000..d8bb636 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/elision.js @@ -0,0 +1 @@ +let [a,] = 0; diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/elision.tree.json b/lib/test/esprima/ES6/binding-pattern/array-pattern/elision.tree.json new file mode 100644 index 0000000..25c7648 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/elision.tree.json @@ -0,0 +1,259 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "Identifier", + "name": "a" + } + ] + }, + "init": { + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + } + ], + "kind": "let" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "let", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } +} diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/empty-pattern-catch-param.js b/lib/test/esprima/ES6/binding-pattern/array-pattern/empty-pattern-catch-param.js new file mode 100644 index 0000000..5d4f5dd --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/empty-pattern-catch-param.js @@ -0,0 +1 @@ +try { } catch ([]) {} diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/empty-pattern-catch-param.tree.json b/lib/test/esprima/ES6/binding-pattern/array-pattern/empty-pattern-catch-param.tree.json new file mode 100644 index 0000000..5647932 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/empty-pattern-catch-param.tree.json @@ -0,0 +1,291 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "type": "TryStatement", + "block": { + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "BlockStatement", + "body": [] + }, + "handler": { + "range": [ + 8, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "type": "CatchClause", + "param": { + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "ArrayPattern", + "elements": [] + }, + "body": { + "range": [ + 19, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "type": "BlockStatement", + "body": [] + } + }, + "finalizer": null + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "try", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Keyword", + "value": "catch", + "range": [ + 8, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } +} diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/empty-pattern-fn.js b/lib/test/esprima/ES6/binding-pattern/array-pattern/empty-pattern-fn.js new file mode 100644 index 0000000..61b45b9 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/empty-pattern-fn.js @@ -0,0 +1 @@ +function a([]) {} diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/empty-pattern-fn.tree.json b/lib/test/esprima/ES6/binding-pattern/array-pattern/empty-pattern-fn.tree.json new file mode 100644 index 0000000..a2938c7 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/empty-pattern-fn.tree.json @@ -0,0 +1,241 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Identifier", + "name": "a" + }, + "params": [ + { + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "ArrayPattern", + "elements": [] + } + ], + "body": { + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } +} diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/empty-pattern-lexical.js b/lib/test/esprima/ES6/binding-pattern/array-pattern/empty-pattern-lexical.js new file mode 100644 index 0000000..62ca189 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/empty-pattern-lexical.js @@ -0,0 +1 @@ +let [] = []; diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/empty-pattern-lexical.tree.json b/lib/test/esprima/ES6/binding-pattern/array-pattern/empty-pattern-lexical.tree.json new file mode 100644 index 0000000..4eb6fe4 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/empty-pattern-lexical.tree.json @@ -0,0 +1,221 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "ArrayPattern", + "elements": [] + }, + "init": { + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "ArrayExpression", + "elements": [] + } + } + ], + "kind": "let" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "let", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } +} diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/empty-pattern-var.js b/lib/test/esprima/ES6/binding-pattern/array-pattern/empty-pattern-var.js new file mode 100644 index 0000000..256529b --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/empty-pattern-var.js @@ -0,0 +1 @@ +var [] = 0; diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/empty-pattern-var.tree.json b/lib/test/esprima/ES6/binding-pattern/array-pattern/empty-pattern-var.tree.json new file mode 100644 index 0000000..662703d --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/empty-pattern-var.tree.json @@ -0,0 +1,204 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "ArrayPattern", + "elements": [] + }, + "init": { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } +} diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/for-let-let.js b/lib/test/esprima/ES6/binding-pattern/array-pattern/for-let-let.js new file mode 100644 index 0000000..a3a4722 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/for-let-let.js @@ -0,0 +1 @@ +for (let [x = let];;) {} diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/for-let-let.skip b/lib/test/esprima/ES6/binding-pattern/array-pattern/for-let-let.skip new file mode 100644 index 0000000..ed7bd50 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/for-let-let.skip @@ -0,0 +1 @@ +TODO: parse errors diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/for-let-let.tree.json b/lib/test/esprima/ES6/binding-pattern/array-pattern/for-let-let.tree.json new file mode 100644 index 0000000..76c0ff5 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/for-let-let.tree.json @@ -0,0 +1,403 @@ +{ + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "type": "Program", + "body": [ + { + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "type": "ForStatement", + "init": { + "range": [ + 5, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 9, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 9, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 10, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "AssignmentPattern", + "left": { + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Identifier", + "name": "x" + }, + "right": { + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "Identifier", + "name": "let" + } + } + ] + }, + "init": null + } + ], + "kind": "let" + }, + "test": null, + "update": null, + "body": { + "range": [ + 22, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "type": "BlockStatement", + "body": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ] +} diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/hole.js b/lib/test/esprima/ES6/binding-pattern/array-pattern/hole.js new file mode 100644 index 0000000..76fe814 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/hole.js @@ -0,0 +1 @@ +let [a,,b]=0 diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/hole.tree.json b/lib/test/esprima/ES6/binding-pattern/array-pattern/hole.tree.json new file mode 100644 index 0000000..87de449 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/hole.tree.json @@ -0,0 +1,296 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "Identifier", + "name": "a" + }, + null, + { + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "Identifier", + "name": "b" + } + ] + }, + "init": { + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + } + ], + "kind": "let" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "let", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } +} diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/invalid-strict-for-let-let.failure.json b/lib/test/esprima/ES6/binding-pattern/array-pattern/invalid-strict-for-let-let.failure.json new file mode 100644 index 0000000..693a054 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/invalid-strict-for-let-let.failure.json @@ -0,0 +1 @@ +{"index":28,"lineNumber":1,"column":29,"message":"Error: Line 1: Use of future reserved word in strict mode","description":"Use of future reserved word in strict mode"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/invalid-strict-for-let-let.js b/lib/test/esprima/ES6/binding-pattern/array-pattern/invalid-strict-for-let-let.js new file mode 100644 index 0000000..1192676 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/invalid-strict-for-let-let.js @@ -0,0 +1 @@ +"use strict"; for (let [x = let];;) {} diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/nested-pattern.js b/lib/test/esprima/ES6/binding-pattern/array-pattern/nested-pattern.js new file mode 100644 index 0000000..88a3177 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/nested-pattern.js @@ -0,0 +1 @@ +let [[]]=0 diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/nested-pattern.tree.json b/lib/test/esprima/ES6/binding-pattern/array-pattern/nested-pattern.tree.json new file mode 100644 index 0000000..a3834ab --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/nested-pattern.tree.json @@ -0,0 +1,241 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "ArrayPattern", + "elements": [] + } + ] + }, + "init": { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + } + ], + "kind": "let" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "let", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } +} diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/patterned-catch-dupe.failure.json b/lib/test/esprima/ES6/binding-pattern/array-pattern/patterned-catch-dupe.failure.json new file mode 100644 index 0000000..8ad3f57 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/patterned-catch-dupe.failure.json @@ -0,0 +1,7 @@ +{ + "index": 19, + "lineNumber": 1, + "column": 20, + "message": "Error: Line 1: Duplicate binding a", + "description": "Duplicate binding a" +} diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/patterned-catch-dupe.js b/lib/test/esprima/ES6/binding-pattern/array-pattern/patterned-catch-dupe.js new file mode 100644 index 0000000..417d6fc --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/patterned-catch-dupe.js @@ -0,0 +1 @@ +try {} catch ([a,a]) {} diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/patterned-catch.js b/lib/test/esprima/ES6/binding-pattern/array-pattern/patterned-catch.js new file mode 100644 index 0000000..4197eb4 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/patterned-catch.js @@ -0,0 +1 @@ +try {} catch ([a,b, {c, d:e=0, [f]:g=0, h=i}]) {} diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/patterned-catch.tree.json b/lib/test/esprima/ES6/binding-pattern/array-pattern/patterned-catch.tree.json new file mode 100644 index 0000000..b91e9f0 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/patterned-catch.tree.json @@ -0,0 +1,1132 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "type": "TryStatement", + "block": { + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "BlockStatement", + "body": [] + }, + "handler": { + "range": [ + 7, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "type": "CatchClause", + "param": { + "range": [ + 14, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "Identifier", + "name": "a" + }, + { + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "Identifier", + "name": "b" + }, + { + "range": [ + 20, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "type": "ObjectPattern", + "properties": [ + { + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "Property", + "key": { + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "Identifier", + "name": "c" + }, + "computed": false, + "value": { + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "Identifier", + "name": "c" + }, + "kind": "init", + "method": false, + "shorthand": true + }, + { + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "type": "Property", + "key": { + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "Identifier", + "name": "d" + }, + "computed": false, + "value": { + "range": [ + 26, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "type": "AssignmentPattern", + "left": { + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "type": "Identifier", + "name": "e" + }, + "right": { + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + }, + "kind": "init", + "method": false, + "shorthand": false + }, + { + "range": [ + 31, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "type": "Property", + "key": { + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "type": "Identifier", + "name": "f" + }, + "computed": true, + "value": { + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "type": "AssignmentPattern", + "left": { + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "type": "Identifier", + "name": "g" + }, + "right": { + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + }, + "kind": "init", + "method": false, + "shorthand": false + }, + { + "range": [ + 40, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "type": "Property", + "key": { + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "type": "Identifier", + "name": "h" + }, + "computed": false, + "value": { + "range": [ + 40, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "type": "AssignmentPattern", + "left": { + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "type": "Identifier", + "name": "h" + }, + "right": { + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "type": "Identifier", + "name": "i" + } + }, + "kind": "init", + "method": false, + "shorthand": true + } + ] + } + ] + }, + "body": { + "range": [ + 47, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "type": "BlockStatement", + "body": [] + } + }, + "finalizer": null + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "try", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "catch", + "range": [ + 7, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "e", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Identifier", + "value": "g", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Identifier", + "value": "h", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + { + "type": "Identifier", + "value": "i", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 49 + } + } + } + ], + "range": [ + 0, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + } +} diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/rest.elision.failure.json b/lib/test/esprima/ES6/binding-pattern/array-pattern/rest.elision.failure.json new file mode 100644 index 0000000..70f97f2 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/rest.elision.failure.json @@ -0,0 +1,7 @@ +{ + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Unexpected token ,", + "description": "Unexpected token ," +} diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/rest.elision.js b/lib/test/esprima/ES6/binding-pattern/array-pattern/rest.elision.js new file mode 100644 index 0000000..bbf5aaa --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/rest.elision.js @@ -0,0 +1 @@ +let [...a,] = 0 diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/rest.js b/lib/test/esprima/ES6/binding-pattern/array-pattern/rest.js new file mode 100644 index 0000000..3fd6f16 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/rest.js @@ -0,0 +1 @@ +let [...a] = 0; diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/rest.tree.json b/lib/test/esprima/ES6/binding-pattern/array-pattern/rest.tree.json new file mode 100644 index 0000000..2af556c --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/rest.tree.json @@ -0,0 +1,276 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 5, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "RestElement", + "argument": { + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "Identifier", + "name": "a" + } + } + ] + }, + "init": { + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + } + ], + "kind": "let" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "let", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } +} diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/tailing-hold.js b/lib/test/esprima/ES6/binding-pattern/array-pattern/tailing-hold.js new file mode 100644 index 0000000..7e1ac75 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/tailing-hold.js @@ -0,0 +1 @@ +let [a,,]=0 diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/tailing-hold.tree.json b/lib/test/esprima/ES6/binding-pattern/array-pattern/tailing-hold.tree.json new file mode 100644 index 0000000..00bb64f --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/tailing-hold.tree.json @@ -0,0 +1,260 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "Identifier", + "name": "a" + }, + null + ] + }, + "init": { + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + } + ], + "kind": "let" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "let", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } +} diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/var-for-in.js b/lib/test/esprima/ES6/binding-pattern/array-pattern/var-for-in.js new file mode 100644 index 0000000..fc5b4fd --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/var-for-in.js @@ -0,0 +1 @@ +for (var [x, y] in z); diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/var-for-in.tree.json b/lib/test/esprima/ES6/binding-pattern/array-pattern/var-for-in.tree.json new file mode 100644 index 0000000..6a9fde0 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/var-for-in.tree.json @@ -0,0 +1,384 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "ForInStatement", + "left": { + "range": [ + 5, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 9, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 9, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Identifier", + "name": "x" + }, + { + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Identifier", + "name": "y" + } + ] + }, + "init": null + } + ], + "kind": "var" + }, + "right": { + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "Identifier", + "name": "z" + }, + "body": { + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "EmptyStatement" + }, + "each": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Keyword", + "value": "in", + "range": [ + 16, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } +} diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/var_let_array.js b/lib/test/esprima/ES6/binding-pattern/array-pattern/var_let_array.js new file mode 100644 index 0000000..04c9530 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/var_let_array.js @@ -0,0 +1 @@ +var [let] = answer; diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/var_let_array.tree.json b/lib/test/esprima/ES6/binding-pattern/array-pattern/var_let_array.tree.json new file mode 100644 index 0000000..404d64b --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/var_let_array.tree.json @@ -0,0 +1,240 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "Identifier", + "name": "let" + } + ] + }, + "init": { + "range": [ + 12, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "Identifier", + "name": "answer" + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "answer", + "range": [ + 12, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } +} diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/with-default-catch-param-fail.failure.json b/lib/test/esprima/ES6/binding-pattern/array-pattern/with-default-catch-param-fail.failure.json new file mode 100644 index 0000000..58c518e --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/with-default-catch-param-fail.failure.json @@ -0,0 +1,7 @@ +{ + "index": 19, + "lineNumber": 1, + "column": 20, + "message": "Error: Line 1: Unexpected token =", + "description": "Unexpected token =" +} diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/with-default-catch-param-fail.js b/lib/test/esprima/ES6/binding-pattern/array-pattern/with-default-catch-param-fail.js new file mode 100644 index 0000000..ff120cf --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/with-default-catch-param-fail.js @@ -0,0 +1 @@ +try { } catch ([a] = []) { } diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/with-default-catch-param.js b/lib/test/esprima/ES6/binding-pattern/array-pattern/with-default-catch-param.js new file mode 100644 index 0000000..0b02d2f --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/with-default-catch-param.js @@ -0,0 +1 @@ +try { } catch ([a = 0]) { } diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/with-default-catch-param.tree.json b/lib/test/esprima/ES6/binding-pattern/array-pattern/with-default-catch-param.tree.json new file mode 100644 index 0000000..1a12f2a --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/with-default-catch-param.tree.json @@ -0,0 +1,400 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "type": "TryStatement", + "block": { + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "BlockStatement", + "body": [] + }, + "handler": { + "range": [ + 8, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "type": "CatchClause", + "param": { + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "type": "AssignmentPattern", + "left": { + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "Identifier", + "name": "a" + }, + "right": { + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + } + ] + }, + "body": { + "range": [ + 24, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "type": "BlockStatement", + "body": [] + } + }, + "finalizer": null + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "try", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Keyword", + "value": "catch", + "range": [ + 8, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + } +} diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/with-default-fn.js b/lib/test/esprima/ES6/binding-pattern/array-pattern/with-default-fn.js new file mode 100644 index 0000000..e74ff47 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/with-default-fn.js @@ -0,0 +1 @@ +function a([a=0]) {} diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/with-default-fn.tree.json b/lib/test/esprima/ES6/binding-pattern/array-pattern/with-default-fn.tree.json new file mode 100644 index 0000000..026c103 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/with-default-fn.tree.json @@ -0,0 +1,350 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Identifier", + "name": "a" + }, + "params": [ + { + "range": [ + 11, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 12, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "AssignmentPattern", + "left": { + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "Identifier", + "name": "a" + }, + "right": { + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + } + ] + } + ], + "body": { + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } +} diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/with-object-pattern.js b/lib/test/esprima/ES6/binding-pattern/array-pattern/with-object-pattern.js new file mode 100644 index 0000000..c20b838 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/with-object-pattern.js @@ -0,0 +1 @@ +let [{a}] = 0 diff --git a/lib/test/esprima/ES6/binding-pattern/array-pattern/with-object-pattern.tree.json b/lib/test/esprima/ES6/binding-pattern/array-pattern/with-object-pattern.tree.json new file mode 100644 index 0000000..0ec07be --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/array-pattern/with-object-pattern.tree.json @@ -0,0 +1,317 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "ObjectPattern", + "properties": [ + { + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Property", + "key": { + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Identifier", + "name": "a" + }, + "computed": false, + "value": { + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Identifier", + "name": "a" + }, + "kind": "init", + "method": false, + "shorthand": true + } + ] + } + ] + }, + "init": { + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + } + ], + "kind": "let" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "let", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } +} diff --git a/lib/test/esprima/ES6/binding-pattern/object-pattern/elision.js b/lib/test/esprima/ES6/binding-pattern/object-pattern/elision.js new file mode 100644 index 0000000..458d638 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/object-pattern/elision.js @@ -0,0 +1 @@ +let {a,} = 0 diff --git a/lib/test/esprima/ES6/binding-pattern/object-pattern/elision.tree.json b/lib/test/esprima/ES6/binding-pattern/object-pattern/elision.tree.json new file mode 100644 index 0000000..17360e3 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/object-pattern/elision.tree.json @@ -0,0 +1,280 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "ObjectPattern", + "properties": [ + { + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "Property", + "key": { + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "Identifier", + "name": "a" + }, + "computed": false, + "value": { + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "Identifier", + "name": "a" + }, + "kind": "init", + "method": false, + "shorthand": true + } + ] + }, + "init": { + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + } + ], + "kind": "let" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "let", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } +} diff --git a/lib/test/esprima/ES6/binding-pattern/object-pattern/empty-catch-param.js b/lib/test/esprima/ES6/binding-pattern/object-pattern/empty-catch-param.js new file mode 100644 index 0000000..14d2f32 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/object-pattern/empty-catch-param.js @@ -0,0 +1 @@ +try { } catch ({}) {} diff --git a/lib/test/esprima/ES6/binding-pattern/object-pattern/empty-catch-param.tree.json b/lib/test/esprima/ES6/binding-pattern/object-pattern/empty-catch-param.tree.json new file mode 100644 index 0000000..6e2421c --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/object-pattern/empty-catch-param.tree.json @@ -0,0 +1,291 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "type": "TryStatement", + "block": { + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "BlockStatement", + "body": [] + }, + "handler": { + "range": [ + 8, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "type": "CatchClause", + "param": { + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "ObjectPattern", + "properties": [] + }, + "body": { + "range": [ + 19, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "type": "BlockStatement", + "body": [] + } + }, + "finalizer": null + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "try", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Keyword", + "value": "catch", + "range": [ + 8, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } +} diff --git a/lib/test/esprima/ES6/binding-pattern/object-pattern/empty-fn.js b/lib/test/esprima/ES6/binding-pattern/object-pattern/empty-fn.js new file mode 100644 index 0000000..5b57677 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/object-pattern/empty-fn.js @@ -0,0 +1 @@ +function a({}) {} diff --git a/lib/test/esprima/ES6/binding-pattern/object-pattern/empty-fn.tree.json b/lib/test/esprima/ES6/binding-pattern/object-pattern/empty-fn.tree.json new file mode 100644 index 0000000..e06ef47 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/object-pattern/empty-fn.tree.json @@ -0,0 +1,241 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Identifier", + "name": "a" + }, + "params": [ + { + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "ObjectPattern", + "properties": [] + } + ], + "body": { + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } +} diff --git a/lib/test/esprima/ES6/binding-pattern/object-pattern/empty-for-lex.js b/lib/test/esprima/ES6/binding-pattern/object-pattern/empty-for-lex.js new file mode 100644 index 0000000..2303312 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/object-pattern/empty-for-lex.js @@ -0,0 +1 @@ +for (let {} in 0); diff --git a/lib/test/esprima/ES6/binding-pattern/object-pattern/empty-for-lex.tree.json b/lib/test/esprima/ES6/binding-pattern/object-pattern/empty-for-lex.tree.json new file mode 100644 index 0000000..201e2af --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/object-pattern/empty-for-lex.tree.json @@ -0,0 +1,294 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "ForInStatement", + "left": { + "range": [ + 5, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "ObjectPattern", + "properties": [] + }, + "init": null + } + ], + "kind": "let" + }, + "right": { + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + }, + "body": { + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "EmptyStatement" + }, + "each": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Keyword", + "value": "in", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } +} diff --git a/lib/test/esprima/ES6/binding-pattern/object-pattern/empty-lexical.js b/lib/test/esprima/ES6/binding-pattern/object-pattern/empty-lexical.js new file mode 100644 index 0000000..fe8923e --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/object-pattern/empty-lexical.js @@ -0,0 +1 @@ +let {} = 0 diff --git a/lib/test/esprima/ES6/binding-pattern/object-pattern/empty-lexical.tree.json b/lib/test/esprima/ES6/binding-pattern/object-pattern/empty-lexical.tree.json new file mode 100644 index 0000000..1ca198e --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/object-pattern/empty-lexical.tree.json @@ -0,0 +1,186 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "ObjectPattern", + "properties": [] + }, + "init": { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + } + ], + "kind": "let" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "let", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } +} diff --git a/lib/test/esprima/ES6/binding-pattern/object-pattern/empty-var.js b/lib/test/esprima/ES6/binding-pattern/object-pattern/empty-var.js new file mode 100644 index 0000000..8e5b5da --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/object-pattern/empty-var.js @@ -0,0 +1 @@ +var {} = 0 diff --git a/lib/test/esprima/ES6/binding-pattern/object-pattern/empty-var.tree.json b/lib/test/esprima/ES6/binding-pattern/object-pattern/empty-var.tree.json new file mode 100644 index 0000000..75c426b --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/object-pattern/empty-var.tree.json @@ -0,0 +1,186 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "ObjectPattern", + "properties": [] + }, + "init": { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } +} diff --git a/lib/test/esprima/ES6/binding-pattern/object-pattern/for-let-let.js b/lib/test/esprima/ES6/binding-pattern/object-pattern/for-let-let.js new file mode 100644 index 0000000..1cedf32 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/object-pattern/for-let-let.js @@ -0,0 +1 @@ +for (let {x: y = let};;) {} diff --git a/lib/test/esprima/ES6/binding-pattern/object-pattern/for-let-let.skip b/lib/test/esprima/ES6/binding-pattern/object-pattern/for-let-let.skip new file mode 100644 index 0000000..ed7bd50 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/object-pattern/for-let-let.skip @@ -0,0 +1 @@ +TODO: parse errors diff --git a/lib/test/esprima/ES6/binding-pattern/object-pattern/for-let-let.tree.json b/lib/test/esprima/ES6/binding-pattern/object-pattern/for-let-let.tree.json new file mode 100644 index 0000000..fdc321b --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/object-pattern/for-let-let.tree.json @@ -0,0 +1,478 @@ +{ + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "type": "Program", + "body": [ + { + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "type": "ForStatement", + "init": { + "range": [ + 5, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 9, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 9, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "type": "ObjectPattern", + "properties": [ + { + "range": [ + 10, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "Property", + "key": { + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Identifier", + "name": "x" + }, + "computed": false, + "value": { + "range": [ + 13, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "AssignmentPattern", + "left": { + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Identifier", + "name": "y" + }, + "right": { + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "Identifier", + "name": "let" + } + }, + "kind": "init", + "method": false, + "shorthand": false + } + ] + }, + "init": null + } + ], + "kind": "let" + }, + "test": null, + "update": null, + "body": { + "range": [ + 25, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "type": "BlockStatement", + "body": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ] +} diff --git a/lib/test/esprima/ES6/binding-pattern/object-pattern/invalid-strict-for-let-let.failure.json b/lib/test/esprima/ES6/binding-pattern/object-pattern/invalid-strict-for-let-let.failure.json new file mode 100644 index 0000000..807f15c --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/object-pattern/invalid-strict-for-let-let.failure.json @@ -0,0 +1 @@ +{"index":31,"lineNumber":1,"column":32,"message":"Error: Line 1: Use of future reserved word in strict mode","description":"Use of future reserved word in strict mode"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/binding-pattern/object-pattern/invalid-strict-for-let-let.js b/lib/test/esprima/ES6/binding-pattern/object-pattern/invalid-strict-for-let-let.js new file mode 100644 index 0000000..690e43d --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/object-pattern/invalid-strict-for-let-let.js @@ -0,0 +1 @@ +"use strict"; for (let {x: y = let};;) {} diff --git a/lib/test/esprima/ES6/binding-pattern/object-pattern/nested.js b/lib/test/esprima/ES6/binding-pattern/object-pattern/nested.js new file mode 100644 index 0000000..82d997c --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/object-pattern/nested.js @@ -0,0 +1 @@ +let {a:{}} = 0 diff --git a/lib/test/esprima/ES6/binding-pattern/object-pattern/nested.tree.json b/lib/test/esprima/ES6/binding-pattern/object-pattern/nested.tree.json new file mode 100644 index 0000000..ae4054e --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/object-pattern/nested.tree.json @@ -0,0 +1,316 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "ObjectPattern", + "properties": [ + { + "range": [ + 5, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "Property", + "key": { + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "Identifier", + "name": "a" + }, + "computed": false, + "value": { + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "ObjectPattern", + "properties": [] + }, + "kind": "init", + "method": false, + "shorthand": false + } + ] + }, + "init": { + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + } + ], + "kind": "let" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "let", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } +} diff --git a/lib/test/esprima/ES6/binding-pattern/object-pattern/properties.js b/lib/test/esprima/ES6/binding-pattern/object-pattern/properties.js new file mode 100644 index 0000000..37e1fb1 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/object-pattern/properties.js @@ -0,0 +1 @@ +let {a,b=0,c:d,e:f=0,[g]:[h]}=0 diff --git a/lib/test/esprima/ES6/binding-pattern/object-pattern/properties.tree.json b/lib/test/esprima/ES6/binding-pattern/object-pattern/properties.tree.json new file mode 100644 index 0000000..abeafcd --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/object-pattern/properties.tree.json @@ -0,0 +1,977 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "type": "ObjectPattern", + "properties": [ + { + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "Property", + "key": { + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "Identifier", + "name": "a" + }, + "computed": false, + "value": { + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "Identifier", + "name": "a" + }, + "kind": "init", + "method": false, + "shorthand": true + }, + { + "range": [ + 7, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Property", + "key": { + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "Identifier", + "name": "b" + }, + "computed": false, + "value": { + "range": [ + 7, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "AssignmentPattern", + "left": { + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "Identifier", + "name": "b" + }, + "right": { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + }, + "kind": "init", + "method": false, + "shorthand": true + }, + { + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Property", + "key": { + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "Identifier", + "name": "c" + }, + "computed": false, + "value": { + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Identifier", + "name": "d" + }, + "kind": "init", + "method": false, + "shorthand": false + }, + { + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "Property", + "key": { + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "Identifier", + "name": "e" + }, + "computed": false, + "value": { + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "AssignmentPattern", + "left": { + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "Identifier", + "name": "f" + }, + "right": { + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + }, + "kind": "init", + "method": false, + "shorthand": false + }, + { + "range": [ + 21, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "type": "Property", + "key": { + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "type": "Identifier", + "name": "g" + }, + "computed": true, + "value": { + "range": [ + 25, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "type": "Identifier", + "name": "h" + } + ] + }, + "kind": "init", + "method": false, + "shorthand": false + } + ] + }, + "init": { + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + } + ], + "kind": "let" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "let", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "e", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "g", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "h", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } +} diff --git a/lib/test/esprima/ES6/binding-pattern/object-pattern/var-for-in.js b/lib/test/esprima/ES6/binding-pattern/object-pattern/var-for-in.js new file mode 100644 index 0000000..c0f54fc --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/object-pattern/var-for-in.js @@ -0,0 +1 @@ +for (var {x, y} in z); diff --git a/lib/test/esprima/ES6/binding-pattern/object-pattern/var-for-in.tree.json b/lib/test/esprima/ES6/binding-pattern/object-pattern/var-for-in.tree.json new file mode 100644 index 0000000..4b70624 --- /dev/null +++ b/lib/test/esprima/ES6/binding-pattern/object-pattern/var-for-in.tree.json @@ -0,0 +1,462 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "ForInStatement", + "left": { + "range": [ + 5, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 9, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 9, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "ObjectPattern", + "properties": [ + { + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Property", + "key": { + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Identifier", + "name": "x" + }, + "computed": false, + "value": { + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Identifier", + "name": "x" + }, + "kind": "init", + "method": false, + "shorthand": true + }, + { + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Property", + "key": { + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Identifier", + "name": "y" + }, + "computed": false, + "value": { + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Identifier", + "name": "y" + }, + "kind": "init", + "method": false, + "shorthand": true + } + ] + }, + "init": null + } + ], + "kind": "var" + }, + "right": { + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "Identifier", + "name": "z" + }, + "body": { + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "EmptyStatement" + }, + "each": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Keyword", + "value": "in", + "range": [ + 16, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } +} diff --git a/lib/test/esprima/ES6/class/migrated_0000.js b/lib/test/esprima/ES6/class/migrated_0000.js new file mode 100644 index 0000000..37bdd22 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0000.js @@ -0,0 +1 @@ +class A {} \ No newline at end of file diff --git a/lib/test/esprima/ES6/class/migrated_0000.tree.json b/lib/test/esprima/ES6/class/migrated_0000.tree.json new file mode 100644 index 0000000..c3c588d --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0000.tree.json @@ -0,0 +1,148 @@ +{ + "type": "Program", + "body": [ + { + "type": "ClassDeclaration", + "id": { + "type": "Identifier", + "name": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } +} diff --git a/lib/test/esprima/ES6/class/migrated_0001.js b/lib/test/esprima/ES6/class/migrated_0001.js new file mode 100644 index 0000000..6956015 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0001.js @@ -0,0 +1 @@ +class A extends 0 {} \ No newline at end of file diff --git a/lib/test/esprima/ES6/class/migrated_0001.tree.json b/lib/test/esprima/ES6/class/migrated_0001.tree.json new file mode 100644 index 0000000..b81df6b --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0001.tree.json @@ -0,0 +1,202 @@ +{ + "type": "Program", + "body": [ + { + "type": "ClassDeclaration", + "id": { + "type": "Identifier", + "name": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "superClass": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } +} diff --git a/lib/test/esprima/ES6/class/migrated_0002.js b/lib/test/esprima/ES6/class/migrated_0002.js new file mode 100644 index 0000000..13c086d --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0002.js @@ -0,0 +1 @@ +class A {;} \ No newline at end of file diff --git a/lib/test/esprima/ES6/class/migrated_0002.tree.json b/lib/test/esprima/ES6/class/migrated_0002.tree.json new file mode 100644 index 0000000..884a5ef --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0002.tree.json @@ -0,0 +1,166 @@ +{ + "type": "Program", + "body": [ + { + "type": "ClassDeclaration", + "id": { + "type": "Identifier", + "name": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } +} diff --git a/lib/test/esprima/ES6/class/migrated_0003.js b/lib/test/esprima/ES6/class/migrated_0003.js new file mode 100644 index 0000000..5333882 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0003.js @@ -0,0 +1 @@ +class A {;;} \ No newline at end of file diff --git a/lib/test/esprima/ES6/class/migrated_0003.tree.json b/lib/test/esprima/ES6/class/migrated_0003.tree.json new file mode 100644 index 0000000..ecd26b8 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0003.tree.json @@ -0,0 +1,184 @@ +{ + "type": "Program", + "body": [ + { + "type": "ClassDeclaration", + "id": { + "type": "Identifier", + "name": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 8, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } +} diff --git a/lib/test/esprima/ES6/class/migrated_0004.js b/lib/test/esprima/ES6/class/migrated_0004.js new file mode 100644 index 0000000..a7f754f --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0004.js @@ -0,0 +1 @@ +class A {a(){}} \ No newline at end of file diff --git a/lib/test/esprima/ES6/class/migrated_0004.tree.json b/lib/test/esprima/ES6/class/migrated_0004.tree.json new file mode 100644 index 0000000..1bdddca --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0004.tree.json @@ -0,0 +1,316 @@ +{ + "type": "Program", + "body": [ + { + "type": "ClassDeclaration", + "id": { + "type": "Identifier", + "name": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "kind": "method", + "static": false, + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } +} diff --git a/lib/test/esprima/ES6/class/migrated_0005.js b/lib/test/esprima/ES6/class/migrated_0005.js new file mode 100644 index 0000000..abecbff --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0005.js @@ -0,0 +1 @@ +class A {a(){}b(){}} \ No newline at end of file diff --git a/lib/test/esprima/ES6/class/migrated_0005.tree.json b/lib/test/esprima/ES6/class/migrated_0005.tree.json new file mode 100644 index 0000000..be5c3c3 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0005.tree.json @@ -0,0 +1,483 @@ +{ + "type": "Program", + "body": [ + { + "type": "ClassDeclaration", + "id": { + "type": "Identifier", + "name": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "kind": "method", + "static": false, + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "b", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 17, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 15, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "kind": "method", + "static": false, + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "range": [ + 8, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } +} diff --git a/lib/test/esprima/ES6/class/migrated_0006.js b/lib/test/esprima/ES6/class/migrated_0006.js new file mode 100644 index 0000000..3f03da7 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0006.js @@ -0,0 +1 @@ +class A {a(){};b(){}} \ No newline at end of file diff --git a/lib/test/esprima/ES6/class/migrated_0006.tree.json b/lib/test/esprima/ES6/class/migrated_0006.tree.json new file mode 100644 index 0000000..4bf9e51 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0006.tree.json @@ -0,0 +1,501 @@ +{ + "type": "Program", + "body": [ + { + "type": "ClassDeclaration", + "id": { + "type": "Identifier", + "name": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "kind": "method", + "static": false, + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "b", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "kind": "method", + "static": false, + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "range": [ + 8, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } +} diff --git a/lib/test/esprima/ES6/class/migrated_0007.js b/lib/test/esprima/ES6/class/migrated_0007.js new file mode 100644 index 0000000..14ae4ca --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0007.js @@ -0,0 +1 @@ +class A {a(){};b(){};} \ No newline at end of file diff --git a/lib/test/esprima/ES6/class/migrated_0007.tree.json b/lib/test/esprima/ES6/class/migrated_0007.tree.json new file mode 100644 index 0000000..fcdb346 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0007.tree.json @@ -0,0 +1,519 @@ +{ + "type": "Program", + "body": [ + { + "type": "ClassDeclaration", + "id": { + "type": "Identifier", + "name": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "kind": "method", + "static": false, + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "b", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "kind": "method", + "static": false, + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "range": [ + 8, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } +} diff --git a/lib/test/esprima/ES6/class/migrated_0008.js b/lib/test/esprima/ES6/class/migrated_0008.js new file mode 100644 index 0000000..0c2666d --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0008.js @@ -0,0 +1 @@ +class A {;a(){};b(){};} \ No newline at end of file diff --git a/lib/test/esprima/ES6/class/migrated_0008.tree.json b/lib/test/esprima/ES6/class/migrated_0008.tree.json new file mode 100644 index 0000000..c3c64d2 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0008.tree.json @@ -0,0 +1,537 @@ +{ + "type": "Program", + "body": [ + { + "type": "ClassDeclaration", + "id": { + "type": "Identifier", + "name": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 13, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 11, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "kind": "method", + "static": false, + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "b", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 19, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 17, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "kind": "method", + "static": false, + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 8, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } +} diff --git a/lib/test/esprima/ES6/class/migrated_0009.js b/lib/test/esprima/ES6/class/migrated_0009.js new file mode 100644 index 0000000..a708f92 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0009.js @@ -0,0 +1 @@ +class A {static(){};} \ No newline at end of file diff --git a/lib/test/esprima/ES6/class/migrated_0009.tree.json b/lib/test/esprima/ES6/class/migrated_0009.tree.json new file mode 100644 index 0000000..13476f5 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0009.tree.json @@ -0,0 +1,334 @@ +{ + "type": "Program", + "body": [ + { + "type": "ClassDeclaration", + "id": { + "type": "Identifier", + "name": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "static", + "range": [ + 9, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 17, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 15, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "kind": "method", + "static": false, + "range": [ + 9, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "range": [ + 8, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Keyword", + "value": "static", + "range": [ + 9, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } +} diff --git a/lib/test/esprima/ES6/class/migrated_0010.js b/lib/test/esprima/ES6/class/migrated_0010.js new file mode 100644 index 0000000..a70d6ac --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0010.js @@ -0,0 +1 @@ +class A {get a(){} set b(c){};} \ No newline at end of file diff --git a/lib/test/esprima/ES6/class/migrated_0010.tree.json b/lib/test/esprima/ES6/class/migrated_0010.tree.json new file mode 100644 index 0000000..b394e21 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0010.tree.json @@ -0,0 +1,574 @@ +{ + "type": "Program", + "body": [ + { + "type": "ClassDeclaration", + "id": { + "type": "Identifier", + "name": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 16, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "kind": "get", + "static": false, + "range": [ + 9, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "b", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "c", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 27, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "kind": "set", + "static": false, + "range": [ + 19, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "range": [ + 8, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "get", + "range": [ + 9, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "set", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } +} diff --git a/lib/test/esprima/ES6/class/migrated_0011.js b/lib/test/esprima/ES6/class/migrated_0011.js new file mode 100644 index 0000000..b0c8d01 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0011.js @@ -0,0 +1 @@ +class A {static a(){} static get a(){} static set a(b){} } \ No newline at end of file diff --git a/lib/test/esprima/ES6/class/migrated_0011.tree.json b/lib/test/esprima/ES6/class/migrated_0011.tree.json new file mode 100644 index 0000000..c31b2d3 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0011.tree.json @@ -0,0 +1,777 @@ +{ + "type": "Program", + "body": [ + { + "type": "ClassDeclaration", + "id": { + "type": "Identifier", + "name": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 19, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 17, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "kind": "method", + "static": true, + "range": [ + 9, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 36, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 34, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "kind": "get", + "static": true, + "range": [ + 22, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 50 + }, + "end": { + "line": 1, + "column": 51 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "b", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 52 + }, + "end": { + "line": 1, + "column": 53 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 54, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 56 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 51, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 1, + "column": 56 + } + } + }, + "kind": "set", + "static": true, + "range": [ + 39, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 56 + } + } + } + ], + "range": [ + 8, + 58 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 58 + } + } + }, + "range": [ + 0, + 58 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Keyword", + "value": "static", + "range": [ + 9, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Keyword", + "value": "static", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "get", + "range": [ + 29, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Keyword", + "value": "static", + "range": [ + 39, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + { + "type": "Identifier", + "value": "set", + "range": [ + 46, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 49 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 50 + }, + "end": { + "line": 1, + "column": 51 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 1, + "column": 52 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 52 + }, + "end": { + "line": 1, + "column": 53 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 54 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 55 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 55 + }, + "end": { + "line": 1, + "column": 56 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 57, + 58 + ], + "loc": { + "start": { + "line": 1, + "column": 57 + }, + "end": { + "line": 1, + "column": 58 + } + } + } + ], + "range": [ + 0, + 58 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + } +} diff --git a/lib/test/esprima/ES6/class/migrated_0012.js b/lib/test/esprima/ES6/class/migrated_0012.js new file mode 100644 index 0000000..c3e331c --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0012.js @@ -0,0 +1 @@ +class A {static a(){};} \ No newline at end of file diff --git a/lib/test/esprima/ES6/class/migrated_0012.tree.json b/lib/test/esprima/ES6/class/migrated_0012.tree.json new file mode 100644 index 0000000..0978dc3 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0012.tree.json @@ -0,0 +1,352 @@ +{ + "type": "Program", + "body": [ + { + "type": "ClassDeclaration", + "id": { + "type": "Identifier", + "name": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 19, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 17, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "kind": "method", + "static": true, + "range": [ + 9, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 8, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Keyword", + "value": "static", + "range": [ + 9, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } +} diff --git a/lib/test/esprima/ES6/class/migrated_0013.js b/lib/test/esprima/ES6/class/migrated_0013.js new file mode 100644 index 0000000..4c36d2b --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0013.js @@ -0,0 +1 @@ +class A {static [a](){};} \ No newline at end of file diff --git a/lib/test/esprima/ES6/class/migrated_0013.tree.json b/lib/test/esprima/ES6/class/migrated_0013.tree.json new file mode 100644 index 0000000..702ced5 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0013.tree.json @@ -0,0 +1,388 @@ +{ + "type": "Program", + "body": [ + { + "type": "ClassDeclaration", + "id": { + "type": "Identifier", + "name": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "computed": true, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 21, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "kind": "method", + "static": true, + "range": [ + 9, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 8, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Keyword", + "value": "static", + "range": [ + 9, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } +} diff --git a/lib/test/esprima/ES6/class/migrated_0014.js b/lib/test/esprima/ES6/class/migrated_0014.js new file mode 100644 index 0000000..de1b600 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0014.js @@ -0,0 +1 @@ +class A {static[a](){}; static[b](){}} \ No newline at end of file diff --git a/lib/test/esprima/ES6/class/migrated_0014.tree.json b/lib/test/esprima/ES6/class/migrated_0014.tree.json new file mode 100644 index 0000000..4d5c20a --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0014.tree.json @@ -0,0 +1,609 @@ +{ + "type": "Program", + "body": [ + { + "type": "ClassDeclaration", + "id": { + "type": "Identifier", + "name": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "computed": true, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 20, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "kind": "method", + "static": true, + "range": [ + 9, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "b", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "computed": true, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 35, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 33, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + "kind": "method", + "static": true, + "range": [ + 24, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + ], + "range": [ + 8, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Keyword", + "value": "static", + "range": [ + 9, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Keyword", + "value": "static", + "range": [ + 24, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + ], + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } +} diff --git a/lib/test/esprima/ES6/class/migrated_0015.js b/lib/test/esprima/ES6/class/migrated_0015.js new file mode 100644 index 0000000..c4f8030 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0015.js @@ -0,0 +1 @@ +class A {static static(){};} \ No newline at end of file diff --git a/lib/test/esprima/ES6/class/migrated_0015.tree.json b/lib/test/esprima/ES6/class/migrated_0015.tree.json new file mode 100644 index 0000000..1115058 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0015.tree.json @@ -0,0 +1,352 @@ +{ + "type": "Program", + "body": [ + { + "type": "ClassDeclaration", + "id": { + "type": "Identifier", + "name": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "static", + "range": [ + 16, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 24, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 22, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "kind": "method", + "static": true, + "range": [ + 9, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "range": [ + 8, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Keyword", + "value": "static", + "range": [ + 9, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Keyword", + "value": "static", + "range": [ + 16, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + } +} diff --git a/lib/test/esprima/ES6/class/migrated_0016.js b/lib/test/esprima/ES6/class/migrated_0016.js new file mode 100644 index 0000000..bd401fe --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0016.js @@ -0,0 +1 @@ +var x = class A extends 0{} \ No newline at end of file diff --git a/lib/test/esprima/ES6/class/migrated_0016.tree.json b/lib/test/esprima/ES6/class/migrated_0016.tree.json new file mode 100644 index 0000000..4c44d54 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0016.tree.json @@ -0,0 +1,311 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "ClassExpression", + "id": { + "type": "Identifier", + "name": "A", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "superClass": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 25, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "range": [ + 8, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "range": [ + 4, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Keyword", + "value": "class", + "range": [ + 8, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 16, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + } +} diff --git a/lib/test/esprima/ES6/class/migrated_0017.js b/lib/test/esprima/ES6/class/migrated_0017.js new file mode 100644 index 0000000..4d339c4 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0017.js @@ -0,0 +1 @@ +class A {prototype(){}} \ No newline at end of file diff --git a/lib/test/esprima/ES6/class/migrated_0017.tree.json b/lib/test/esprima/ES6/class/migrated_0017.tree.json new file mode 100644 index 0000000..c032443 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0017.tree.json @@ -0,0 +1,316 @@ +{ + "type": "Program", + "body": [ + { + "type": "ClassDeclaration", + "id": { + "type": "Identifier", + "name": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "prototype", + "range": [ + 9, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 20, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "kind": "method", + "static": false, + "range": [ + 9, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "range": [ + 8, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "prototype", + "range": [ + 9, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } +} diff --git a/lib/test/esprima/ES6/class/migrated_0018.js b/lib/test/esprima/ES6/class/migrated_0018.js new file mode 100644 index 0000000..a8ac170 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0018.js @@ -0,0 +1 @@ +class A {constructor(){}} \ No newline at end of file diff --git a/lib/test/esprima/ES6/class/migrated_0018.tree.json b/lib/test/esprima/ES6/class/migrated_0018.tree.json new file mode 100644 index 0000000..fc178ba --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0018.tree.json @@ -0,0 +1,316 @@ +{ + "type": "Program", + "body": [ + { + "type": "ClassDeclaration", + "id": { + "type": "Identifier", + "name": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "constructor", + "range": [ + 9, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 22, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 20, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "kind": "constructor", + "static": false, + "range": [ + 9, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "range": [ + 8, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "constructor", + "range": [ + 9, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } +} diff --git a/lib/test/esprima/ES6/class/migrated_0019.js b/lib/test/esprima/ES6/class/migrated_0019.js new file mode 100644 index 0000000..dbca60a --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0019.js @@ -0,0 +1 @@ +class A {"constructor"(){} ["constructor"](){}} \ No newline at end of file diff --git a/lib/test/esprima/ES6/class/migrated_0019.tree.json b/lib/test/esprima/ES6/class/migrated_0019.tree.json new file mode 100644 index 0000000..20e6f85 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0019.tree.json @@ -0,0 +1,521 @@ +{ + "type": "Program", + "body": [ + { + "type": "ClassDeclaration", + "id": { + "type": "Identifier", + "name": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Literal", + "value": "constructor", + "raw": "\"constructor\"", + "range": [ + 9, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 24, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 22, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "kind": "constructor", + "static": false, + "range": [ + 9, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Literal", + "value": "constructor", + "raw": "\"constructor\"", + "range": [ + 28, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "computed": true, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 44, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 42, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "kind": "method", + "static": false, + "range": [ + 27, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 46 + } + } + } + ], + "range": [ + 8, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 47 + } + } + }, + "range": [ + 0, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "String", + "value": "\"constructor\"", + "range": [ + 9, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "String", + "value": "\"constructor\"", + "range": [ + 28, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 47 + } + } + } + ], + "range": [ + 0, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + } +} diff --git a/lib/test/esprima/ES6/class/migrated_0020.js b/lib/test/esprima/ES6/class/migrated_0020.js new file mode 100644 index 0000000..9275d17 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0020.js @@ -0,0 +1 @@ +class A {static constructor(){} static constructor(){}} \ No newline at end of file diff --git a/lib/test/esprima/ES6/class/migrated_0020.tree.json b/lib/test/esprima/ES6/class/migrated_0020.tree.json new file mode 100644 index 0000000..1595be2 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0020.tree.json @@ -0,0 +1,519 @@ +{ + "type": "Program", + "body": [ + { + "type": "ClassDeclaration", + "id": { + "type": "Identifier", + "name": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "constructor", + "range": [ + 16, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 29, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 27, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "kind": "method", + "static": true, + "range": [ + 9, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "constructor", + "range": [ + 39, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 50 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 52, + 54 + ], + "loc": { + "start": { + "line": 1, + "column": 52 + }, + "end": { + "line": 1, + "column": 54 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 50, + 54 + ], + "loc": { + "start": { + "line": 1, + "column": 50 + }, + "end": { + "line": 1, + "column": 54 + } + } + }, + "kind": "method", + "static": true, + "range": [ + 32, + 54 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 54 + } + } + } + ], + "range": [ + 8, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 55 + } + } + }, + "range": [ + 0, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 55 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Keyword", + "value": "static", + "range": [ + 9, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "constructor", + "range": [ + 16, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Keyword", + "value": "static", + "range": [ + 32, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Identifier", + "value": "constructor", + "range": [ + 39, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 50 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 50 + }, + "end": { + "line": 1, + "column": 51 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 1, + "column": 52 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 52 + }, + "end": { + "line": 1, + "column": 53 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 54 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 55 + } + } + } + ], + "range": [ + 0, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 55 + } + } +} diff --git a/lib/test/esprima/ES6/class/migrated_0021.js b/lib/test/esprima/ES6/class/migrated_0021.js new file mode 100644 index 0000000..a6759d5 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0021.js @@ -0,0 +1 @@ +class A {static ["prototype"](){}} \ No newline at end of file diff --git a/lib/test/esprima/ES6/class/migrated_0021.tree.json b/lib/test/esprima/ES6/class/migrated_0021.tree.json new file mode 100644 index 0000000..76642c8 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0021.tree.json @@ -0,0 +1,371 @@ +{ + "type": "Program", + "body": [ + { + "type": "ClassDeclaration", + "id": { + "type": "Identifier", + "name": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Literal", + "value": "prototype", + "raw": "\"prototype\"", + "range": [ + 17, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "computed": true, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 31, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 29, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "kind": "method", + "static": true, + "range": [ + 9, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "range": [ + 8, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Keyword", + "value": "static", + "range": [ + 9, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "String", + "value": "\"prototype\"", + "range": [ + 17, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } +} diff --git a/lib/test/esprima/ES6/class/migrated_0022.js b/lib/test/esprima/ES6/class/migrated_0022.js new file mode 100644 index 0000000..6909140 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0022.js @@ -0,0 +1 @@ +(class {}) \ No newline at end of file diff --git a/lib/test/esprima/ES6/class/migrated_0022.tree.json b/lib/test/esprima/ES6/class/migrated_0022.tree.json new file mode 100644 index 0000000..eca6bb7 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0022.tree.json @@ -0,0 +1,166 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ClassExpression", + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "class", + "range": [ + 1, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } +} diff --git a/lib/test/esprima/ES6/class/migrated_0023.js b/lib/test/esprima/ES6/class/migrated_0023.js new file mode 100644 index 0000000..ae0ee01 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0023.js @@ -0,0 +1 @@ +(class A {}) \ No newline at end of file diff --git a/lib/test/esprima/ES6/class/migrated_0023.tree.json b/lib/test/esprima/ES6/class/migrated_0023.tree.json new file mode 100644 index 0000000..eaf04a2 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0023.tree.json @@ -0,0 +1,201 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ClassExpression", + "id": { + "type": "Identifier", + "name": "A", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 1, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "class", + "range": [ + 1, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } +} diff --git a/lib/test/esprima/ES6/class/migrated_0024.js b/lib/test/esprima/ES6/class/migrated_0024.js new file mode 100644 index 0000000..3a3c683 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0024.js @@ -0,0 +1 @@ +(class extends 0{}) \ No newline at end of file diff --git a/lib/test/esprima/ES6/class/migrated_0024.tree.json b/lib/test/esprima/ES6/class/migrated_0024.tree.json new file mode 100644 index 0000000..ced0c6e --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0024.tree.json @@ -0,0 +1,220 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ClassExpression", + "id": null, + "superClass": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 16, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 1, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "class", + "range": [ + 1, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 7, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } +} diff --git a/lib/test/esprima/ES6/class/migrated_0025.js b/lib/test/esprima/ES6/class/migrated_0025.js new file mode 100644 index 0000000..a80de58 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0025.js @@ -0,0 +1 @@ +(class A extends 0{}) \ No newline at end of file diff --git a/lib/test/esprima/ES6/class/migrated_0025.tree.json b/lib/test/esprima/ES6/class/migrated_0025.tree.json new file mode 100644 index 0000000..a856beb --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0025.tree.json @@ -0,0 +1,255 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ClassExpression", + "id": { + "type": "Identifier", + "name": "A", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "superClass": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 1, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "class", + "range": [ + 1, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 9, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } +} diff --git a/lib/test/esprima/ES6/class/migrated_0026.diff b/lib/test/esprima/ES6/class/migrated_0026.diff new file mode 100644 index 0000000..a1371fd --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0026.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 11 }, + "end": { "line": 1, "column": 15 } + } + } + } +} diff --git a/lib/test/esprima/ES6/class/migrated_0026.js b/lib/test/esprima/ES6/class/migrated_0026.js new file mode 100644 index 0000000..d0ebfe5 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0026.js @@ -0,0 +1 @@ +class A {a(eval){}} \ No newline at end of file diff --git a/lib/test/esprima/ES6/class/migrated_0026.tree.json b/lib/test/esprima/ES6/class/migrated_0026.tree.json new file mode 100644 index 0000000..c57d897 --- /dev/null +++ b/lib/test/esprima/ES6/class/migrated_0026.tree.json @@ -0,0 +1,361 @@ +{ + "type": "Program", + "body": [ + { + "type": "ClassDeclaration", + "id": { + "type": "Identifier", + "name": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "eval", + "range": [ + 11, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 16, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 10, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "kind": "method", + "static": false, + "range": [ + 9, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "range": [ + 8, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "eval", + "range": [ + 11, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "errors": [ + { + "index": 11, + "lineNumber": 1, + "column": 12, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" + } + ], + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } +} diff --git a/lib/test/esprima/ES6/default-parameter-value/migrated_0000.js b/lib/test/esprima/ES6/default-parameter-value/migrated_0000.js new file mode 100644 index 0000000..25993b3 --- /dev/null +++ b/lib/test/esprima/ES6/default-parameter-value/migrated_0000.js @@ -0,0 +1 @@ +x = function(y = 1) {} \ No newline at end of file diff --git a/lib/test/esprima/ES6/default-parameter-value/migrated_0000.tree.json b/lib/test/esprima/ES6/default-parameter-value/migrated_0000.tree.json new file mode 100644 index 0000000..e64c20c --- /dev/null +++ b/lib/test/esprima/ES6/default-parameter-value/migrated_0000.tree.json @@ -0,0 +1,349 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "AssignmentPattern", + "left": { + "type": "Identifier", + "name": "y", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "right": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 13, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 20, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 4, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 4, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/ES6/default-parameter-value/migrated_0001.js b/lib/test/esprima/ES6/default-parameter-value/migrated_0001.js new file mode 100644 index 0000000..7885715 --- /dev/null +++ b/lib/test/esprima/ES6/default-parameter-value/migrated_0001.js @@ -0,0 +1 @@ +function f(a = 1) {} \ No newline at end of file diff --git a/lib/test/esprima/ES6/default-parameter-value/migrated_0001.tree.json b/lib/test/esprima/ES6/default-parameter-value/migrated_0001.tree.json new file mode 100644 index 0000000..2a5293a --- /dev/null +++ b/lib/test/esprima/ES6/default-parameter-value/migrated_0001.tree.json @@ -0,0 +1,295 @@ +{ + "type": "Program", + "body": [ + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "f", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "params": [ + { + "type": "AssignmentPattern", + "left": { + "type": "Identifier", + "name": "a", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "right": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 11, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/ES6/default-parameter-value/migrated_0002.js b/lib/test/esprima/ES6/default-parameter-value/migrated_0002.js new file mode 100644 index 0000000..2537287 --- /dev/null +++ b/lib/test/esprima/ES6/default-parameter-value/migrated_0002.js @@ -0,0 +1 @@ +x = { f: function(a=1) {} } \ No newline at end of file diff --git a/lib/test/esprima/ES6/default-parameter-value/migrated_0002.tree.json b/lib/test/esprima/ES6/default-parameter-value/migrated_0002.tree.json new file mode 100644 index 0000000..cfd49ea --- /dev/null +++ b/lib/test/esprima/ES6/default-parameter-value/migrated_0002.tree.json @@ -0,0 +1,479 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "f", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "AssignmentPattern", + "left": { + "type": "Identifier", + "name": "a", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "right": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 18, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 23, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 9, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 6, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "range": [ + 4, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 9, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/ES6/destructuring-assignment/array-pattern/dup-assignment.js b/lib/test/esprima/ES6/destructuring-assignment/array-pattern/dup-assignment.js new file mode 100644 index 0000000..32ca517 --- /dev/null +++ b/lib/test/esprima/ES6/destructuring-assignment/array-pattern/dup-assignment.js @@ -0,0 +1 @@ +[a,a,,...a]=0; diff --git a/lib/test/esprima/ES6/destructuring-assignment/array-pattern/dup-assignment.tree.json b/lib/test/esprima/ES6/destructuring-assignment/array-pattern/dup-assignment.tree.json new file mode 100644 index 0000000..dd02105 --- /dev/null +++ b/lib/test/esprima/ES6/destructuring-assignment/array-pattern/dup-assignment.tree.json @@ -0,0 +1,383 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "AssignmentExpression", + "operator": "=", + "left": { + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "type": "Identifier", + "name": "a" + }, + { + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "type": "Identifier", + "name": "a" + }, + null, + { + "range": [ + 6, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "RestElement", + "argument": { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Identifier", + "name": "a" + } + } + ] + }, + "right": { + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "[", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } +} diff --git a/lib/test/esprima/ES6/destructuring-assignment/array-pattern/elision.js b/lib/test/esprima/ES6/destructuring-assignment/array-pattern/elision.js new file mode 100644 index 0000000..1819baf --- /dev/null +++ b/lib/test/esprima/ES6/destructuring-assignment/array-pattern/elision.js @@ -0,0 +1 @@ +[,,]=0 diff --git a/lib/test/esprima/ES6/destructuring-assignment/array-pattern/elision.tree.json b/lib/test/esprima/ES6/destructuring-assignment/array-pattern/elision.tree.json new file mode 100644 index 0000000..04a0248 --- /dev/null +++ b/lib/test/esprima/ES6/destructuring-assignment/array-pattern/elision.tree.json @@ -0,0 +1,205 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "AssignmentExpression", + "operator": "=", + "left": { + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "type": "ArrayPattern", + "elements": [ + null, + null + ] + }, + "right": { + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "[", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } +} diff --git a/lib/test/esprima/ES6/destructuring-assignment/array-pattern/member-expr-in-rest.js b/lib/test/esprima/ES6/destructuring-assignment/array-pattern/member-expr-in-rest.js new file mode 100644 index 0000000..f09a194 --- /dev/null +++ b/lib/test/esprima/ES6/destructuring-assignment/array-pattern/member-expr-in-rest.js @@ -0,0 +1 @@ +[...a[0]] = 0; diff --git a/lib/test/esprima/ES6/destructuring-assignment/array-pattern/member-expr-in-rest.tree.json b/lib/test/esprima/ES6/destructuring-assignment/array-pattern/member-expr-in-rest.tree.json new file mode 100644 index 0000000..ef23e8a --- /dev/null +++ b/lib/test/esprima/ES6/destructuring-assignment/array-pattern/member-expr-in-rest.tree.json @@ -0,0 +1,347 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "AssignmentExpression", + "operator": "=", + "left": { + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 1, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "RestElement", + "argument": { + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "MemberExpression", + "computed": true, + "object": { + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "type": "Identifier", + "name": "a" + }, + "property": { + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + } + } + ] + }, + "right": { + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "[", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } +} diff --git a/lib/test/esprima/ES6/destructuring-assignment/array-pattern/nested-assignment.diff b/lib/test/esprima/ES6/destructuring-assignment/array-pattern/nested-assignment.diff new file mode 100644 index 0000000..ca02216 --- /dev/null +++ b/lib/test/esprima/ES6/destructuring-assignment/array-pattern/nested-assignment.diff @@ -0,0 +1,18 @@ +{ + "body": { + "0": { + "expression": { + "left": { + "elements": { + "1": { + "operator": undefined + }, + "2": { + "operator": undefined + } + } + } + } + } + } +} diff --git a/lib/test/esprima/ES6/destructuring-assignment/array-pattern/nested-assignment.js b/lib/test/esprima/ES6/destructuring-assignment/array-pattern/nested-assignment.js new file mode 100644 index 0000000..4bb7333 --- /dev/null +++ b/lib/test/esprima/ES6/destructuring-assignment/array-pattern/nested-assignment.js @@ -0,0 +1 @@ +[a,b=0,[c,...a[0]]={}]=0; diff --git a/lib/test/esprima/ES6/destructuring-assignment/array-pattern/nested-assignment.tree.json b/lib/test/esprima/ES6/destructuring-assignment/array-pattern/nested-assignment.tree.json new file mode 100644 index 0000000..da89763 --- /dev/null +++ b/lib/test/esprima/ES6/destructuring-assignment/array-pattern/nested-assignment.tree.json @@ -0,0 +1,727 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "type": "AssignmentExpression", + "operator": "=", + "left": { + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "type": "Identifier", + "name": "a" + }, + { + "range": [ + 3, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "AssignmentPattern", + "operator": "=", + "left": { + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "type": "Identifier", + "name": "b" + }, + "right": { + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + }, + { + "range": [ + 7, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "type": "AssignmentPattern", + "operator": "=", + "left": { + "range": [ + 7, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "Identifier", + "name": "c" + }, + { + "range": [ + 10, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "RestElement", + "argument": { + "range": [ + 13, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "MemberExpression", + "computed": true, + "object": { + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Identifier", + "name": "a" + }, + "property": { + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + } + } + ] + }, + "right": { + "range": [ + 19, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "type": "ObjectExpression", + "properties": [] + } + } + ] + }, + "right": { + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "[", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } +} diff --git a/lib/test/esprima/ES6/destructuring-assignment/array-pattern/nested-cover-grammar.js b/lib/test/esprima/ES6/destructuring-assignment/array-pattern/nested-cover-grammar.js new file mode 100644 index 0000000..4b9a5e3 --- /dev/null +++ b/lib/test/esprima/ES6/destructuring-assignment/array-pattern/nested-cover-grammar.js @@ -0,0 +1 @@ +[{a=b}=0] diff --git a/lib/test/esprima/ES6/destructuring-assignment/array-pattern/nested-cover-grammar.tree.json b/lib/test/esprima/ES6/destructuring-assignment/array-pattern/nested-cover-grammar.tree.json new file mode 100644 index 0000000..91c334c --- /dev/null +++ b/lib/test/esprima/ES6/destructuring-assignment/array-pattern/nested-cover-grammar.tree.json @@ -0,0 +1,368 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "ArrayExpression", + "elements": [ + { + "range": [ + 1, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "AssignmentExpression", + "operator": "=", + "left": { + "range": [ + 1, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "ObjectPattern", + "properties": [ + { + "range": [ + 2, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "type": "Property", + "key": { + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "type": "Identifier", + "name": "a" + }, + "computed": false, + "value": { + "range": [ + 2, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "type": "AssignmentPattern", + "left": { + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "type": "Identifier", + "name": "a" + }, + "right": { + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "type": "Identifier", + "name": "b" + } + }, + "kind": "init", + "method": false, + "shorthand": true + } + ] + }, + "right": { + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "[", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } +} diff --git a/lib/test/esprima/ES6/destructuring-assignment/array-pattern/simple-assignment.js b/lib/test/esprima/ES6/destructuring-assignment/array-pattern/simple-assignment.js new file mode 100644 index 0000000..7cfd69b --- /dev/null +++ b/lib/test/esprima/ES6/destructuring-assignment/array-pattern/simple-assignment.js @@ -0,0 +1 @@ +[a] = 0; diff --git a/lib/test/esprima/ES6/destructuring-assignment/array-pattern/simple-assignment.tree.json b/lib/test/esprima/ES6/destructuring-assignment/array-pattern/simple-assignment.tree.json new file mode 100644 index 0000000..b2eb9e7 --- /dev/null +++ b/lib/test/esprima/ES6/destructuring-assignment/array-pattern/simple-assignment.tree.json @@ -0,0 +1,221 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "AssignmentExpression", + "operator": "=", + "left": { + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "type": "Identifier", + "name": "a" + } + ] + }, + "right": { + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "[", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } +} diff --git a/lib/test/esprima/ES6/destructuring-assignment/invalid-cover-grammar.failure.json b/lib/test/esprima/ES6/destructuring-assignment/invalid-cover-grammar.failure.json new file mode 100644 index 0000000..da34856 --- /dev/null +++ b/lib/test/esprima/ES6/destructuring-assignment/invalid-cover-grammar.failure.json @@ -0,0 +1 @@ +{"index":22,"lineNumber":1,"column":23,"message":"Error: Line 1: Unexpected token =","description":"Unexpected token ="} \ No newline at end of file diff --git a/lib/test/esprima/ES6/destructuring-assignment/invalid-cover-grammar.js b/lib/test/esprima/ES6/destructuring-assignment/invalid-cover-grammar.js new file mode 100644 index 0000000..0b41490 --- /dev/null +++ b/lib/test/esprima/ES6/destructuring-assignment/invalid-cover-grammar.js @@ -0,0 +1 @@ +[[[[[[[[[[[[[[[[[[[[{a=b}]]]]]]]]]]]]]]]]]]]] diff --git a/lib/test/esprima/ES6/destructuring-assignment/invalid-group-assignment.failure.json b/lib/test/esprima/ES6/destructuring-assignment/invalid-group-assignment.failure.json new file mode 100644 index 0000000..de037ce --- /dev/null +++ b/lib/test/esprima/ES6/destructuring-assignment/invalid-group-assignment.failure.json @@ -0,0 +1 @@ +{"index":5,"lineNumber":1,"column":6,"message":"Error: Line 1: Invalid left-hand side in assignment","description":"Invalid left-hand side in assignment"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/destructuring-assignment/invalid-group-assignment.js b/lib/test/esprima/ES6/destructuring-assignment/invalid-group-assignment.js new file mode 100644 index 0000000..edb5ea6 --- /dev/null +++ b/lib/test/esprima/ES6/destructuring-assignment/invalid-group-assignment.js @@ -0,0 +1 @@ +(a,b)=(c,d); diff --git a/lib/test/esprima/ES6/destructuring-assignment/object-pattern/empty-object-pattern-assignment.js b/lib/test/esprima/ES6/destructuring-assignment/object-pattern/empty-object-pattern-assignment.js new file mode 100644 index 0000000..90c7f79 --- /dev/null +++ b/lib/test/esprima/ES6/destructuring-assignment/object-pattern/empty-object-pattern-assignment.js @@ -0,0 +1 @@ +({} = 0); diff --git a/lib/test/esprima/ES6/destructuring-assignment/object-pattern/empty-object-pattern-assignment.tree.json b/lib/test/esprima/ES6/destructuring-assignment/object-pattern/empty-object-pattern-assignment.tree.json new file mode 100644 index 0000000..3801b8d --- /dev/null +++ b/lib/test/esprima/ES6/destructuring-assignment/object-pattern/empty-object-pattern-assignment.tree.json @@ -0,0 +1,220 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "AssignmentExpression", + "operator": "=", + "left": { + "range": [ + 1, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "type": "ObjectPattern", + "properties": [] + }, + "right": { + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } +} diff --git a/lib/test/esprima/ES6/destructuring-assignment/object-pattern/invalid-lhs-01.failure.json b/lib/test/esprima/ES6/destructuring-assignment/object-pattern/invalid-lhs-01.failure.json new file mode 100644 index 0000000..4fa1362 --- /dev/null +++ b/lib/test/esprima/ES6/destructuring-assignment/object-pattern/invalid-lhs-01.failure.json @@ -0,0 +1 @@ +{"index":9,"lineNumber":1,"column":10,"message":"Error: Line 1: Invalid left-hand side in assignment","description":"Invalid left-hand side in assignment"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/destructuring-assignment/object-pattern/invalid-lhs-01.js b/lib/test/esprima/ES6/destructuring-assignment/object-pattern/invalid-lhs-01.js new file mode 100644 index 0000000..e4587fb --- /dev/null +++ b/lib/test/esprima/ES6/destructuring-assignment/object-pattern/invalid-lhs-01.js @@ -0,0 +1 @@ +({a:this}=0) diff --git a/lib/test/esprima/ES6/destructuring-assignment/object-pattern/invalid-lhs-02.failure.json b/lib/test/esprima/ES6/destructuring-assignment/object-pattern/invalid-lhs-02.failure.json new file mode 100644 index 0000000..42ae8eb --- /dev/null +++ b/lib/test/esprima/ES6/destructuring-assignment/object-pattern/invalid-lhs-02.failure.json @@ -0,0 +1 @@ +{"index":10,"lineNumber":1,"column":11,"message":"Error: Line 1: Invalid left-hand side in assignment","description":"Invalid left-hand side in assignment"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/destructuring-assignment/object-pattern/invalid-lhs-02.js b/lib/test/esprima/ES6/destructuring-assignment/object-pattern/invalid-lhs-02.js new file mode 100644 index 0000000..d616934 --- /dev/null +++ b/lib/test/esprima/ES6/destructuring-assignment/object-pattern/invalid-lhs-02.js @@ -0,0 +1 @@ +({a: this} = 0); diff --git a/lib/test/esprima/ES6/destructuring-assignment/object-pattern/invalid-pattern-with-method.failure.json b/lib/test/esprima/ES6/destructuring-assignment/object-pattern/invalid-pattern-with-method.failure.json new file mode 100644 index 0000000..96062aa --- /dev/null +++ b/lib/test/esprima/ES6/destructuring-assignment/object-pattern/invalid-pattern-with-method.failure.json @@ -0,0 +1 @@ +{"index":13,"lineNumber":1,"column":14,"message":"Error: Line 1: Invalid left-hand side in assignment","description":"Invalid left-hand side in assignment"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/destructuring-assignment/object-pattern/invalid-pattern-with-method.js b/lib/test/esprima/ES6/destructuring-assignment/object-pattern/invalid-pattern-with-method.js new file mode 100644 index 0000000..4dc400f --- /dev/null +++ b/lib/test/esprima/ES6/destructuring-assignment/object-pattern/invalid-pattern-with-method.js @@ -0,0 +1 @@ +({get a(){}})=0 diff --git a/lib/test/esprima/ES6/destructuring-assignment/object-pattern/nested-cover-grammar.js b/lib/test/esprima/ES6/destructuring-assignment/object-pattern/nested-cover-grammar.js new file mode 100644 index 0000000..eafafc8 --- /dev/null +++ b/lib/test/esprima/ES6/destructuring-assignment/object-pattern/nested-cover-grammar.js @@ -0,0 +1 @@ +[[[[[[[[[[[[[[[[[[[[{a=b[0]}]]]]]]]]]]]]]]]]]]]]=0; diff --git a/lib/test/esprima/ES6/destructuring-assignment/object-pattern/nested-cover-grammar.tree.json b/lib/test/esprima/ES6/destructuring-assignment/object-pattern/nested-cover-grammar.tree.json new file mode 100644 index 0000000..810f6c5 --- /dev/null +++ b/lib/test/esprima/ES6/destructuring-assignment/object-pattern/nested-cover-grammar.tree.json @@ -0,0 +1,1522 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "type": "AssignmentExpression", + "operator": "=", + "left": { + "range": [ + 0, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 1, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 2, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 3, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 4, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 5, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 6, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 7, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 8, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 9, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 10, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 11, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 12, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 13, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 14, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 15, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 16, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 17, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 18, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 19, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 20, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "type": "ObjectPattern", + "properties": [ + { + "range": [ + 21, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "type": "Property", + "key": { + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "Identifier", + "name": "a" + }, + "computed": false, + "value": { + "range": [ + 21, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "type": "AssignmentPattern", + "left": { + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "Identifier", + "name": "a" + }, + "right": { + "range": [ + 23, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "type": "MemberExpression", + "computed": true, + "object": { + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "type": "Identifier", + "name": "b" + }, + "property": { + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + } + }, + "kind": "init", + "method": false, + "shorthand": true + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + }, + "right": { + "range": [ + 49, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "[", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 47 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 49 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 49, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 50 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 50 + }, + "end": { + "line": 1, + "column": 51 + } + } + } + ], + "range": [ + 0, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 51 + } + } +} diff --git a/lib/test/esprima/ES6/destructuring-assignment/object-pattern/object-pattern-assignment.diff b/lib/test/esprima/ES6/destructuring-assignment/object-pattern/object-pattern-assignment.diff new file mode 100644 index 0000000..4aa8a62 --- /dev/null +++ b/lib/test/esprima/ES6/destructuring-assignment/object-pattern/object-pattern-assignment.diff @@ -0,0 +1,17 @@ +{ + "body": { + "0": { + "expression": { + "left": { + "properties": { + "2": { + "value": { + "operator": undefined + } + } + } + } + } + } + } +} diff --git a/lib/test/esprima/ES6/destructuring-assignment/object-pattern/object-pattern-assignment.js b/lib/test/esprima/ES6/destructuring-assignment/object-pattern/object-pattern-assignment.js new file mode 100644 index 0000000..c244589 --- /dev/null +++ b/lib/test/esprima/ES6/destructuring-assignment/object-pattern/object-pattern-assignment.js @@ -0,0 +1,8 @@ +({ + a, + a:a, + a:a=a, + [a]:{a}, + a:some_call()[a], + a:this.a +} = 0); diff --git a/lib/test/esprima/ES6/destructuring-assignment/object-pattern/object-pattern-assignment.tree.json b/lib/test/esprima/ES6/destructuring-assignment/object-pattern/object-pattern-assignment.tree.json new file mode 100644 index 0000000..7eaee82 --- /dev/null +++ b/lib/test/esprima/ES6/destructuring-assignment/object-pattern/object-pattern-assignment.tree.json @@ -0,0 +1,1358 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 85 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 8, + "column": 7 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 1, + 83 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 8, + "column": 5 + } + }, + "type": "AssignmentExpression", + "operator": "=", + "left": { + "range": [ + 1, + 79 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 8, + "column": 1 + } + }, + "type": "ObjectPattern", + "properties": [ + { + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "type": "Property", + "key": { + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "type": "Identifier", + "name": "a" + }, + "computed": false, + "value": { + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "type": "Identifier", + "name": "a" + }, + "kind": "init", + "method": false, + "shorthand": true + }, + { + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "type": "Property", + "key": { + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "type": "Identifier", + "name": "a" + }, + "computed": false, + "value": { + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "type": "Identifier", + "name": "a" + }, + "kind": "init", + "method": false, + "shorthand": false + }, + { + "range": [ + 23, + 28 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "type": "Property", + "key": { + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "type": "Identifier", + "name": "a" + }, + "computed": false, + "value": { + "range": [ + 25, + 28 + ], + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "type": "AssignmentPattern", + "operator": "=", + "left": { + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 7 + } + }, + "type": "Identifier", + "name": "a" + }, + "right": { + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "type": "Identifier", + "name": "a" + } + }, + "kind": "init", + "method": false, + "shorthand": false + }, + { + "range": [ + 34, + 41 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 11 + } + }, + "type": "Property", + "key": { + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 6 + } + }, + "type": "Identifier", + "name": "a" + }, + "computed": true, + "value": { + "range": [ + 38, + 41 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 11 + } + }, + "type": "ObjectPattern", + "properties": [ + { + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 10 + } + }, + "type": "Property", + "key": { + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 10 + } + }, + "type": "Identifier", + "name": "a" + }, + "computed": false, + "value": { + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 10 + } + }, + "type": "Identifier", + "name": "a" + }, + "kind": "init", + "method": false, + "shorthand": true + } + ] + }, + "kind": "init", + "method": false, + "shorthand": false + }, + { + "range": [ + 47, + 63 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 20 + } + }, + "type": "Property", + "key": { + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 5 + } + }, + "type": "Identifier", + "name": "a" + }, + "computed": false, + "value": { + "range": [ + 49, + 63 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 20 + } + }, + "type": "MemberExpression", + "computed": true, + "object": { + "range": [ + 49, + 60 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 17 + } + }, + "type": "CallExpression", + "callee": { + "range": [ + 49, + 58 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 15 + } + }, + "type": "Identifier", + "name": "some_call" + }, + "arguments": [] + }, + "property": { + "range": [ + 61, + 62 + ], + "loc": { + "start": { + "line": 6, + "column": 18 + }, + "end": { + "line": 6, + "column": 19 + } + }, + "type": "Identifier", + "name": "a" + } + }, + "kind": "init", + "method": false, + "shorthand": false + }, + { + "range": [ + 69, + 77 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 12 + } + }, + "type": "Property", + "key": { + "range": [ + 69, + 70 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 5 + } + }, + "type": "Identifier", + "name": "a" + }, + "computed": false, + "value": { + "range": [ + 71, + 77 + ], + "loc": { + "start": { + "line": 7, + "column": 6 + }, + "end": { + "line": 7, + "column": 12 + } + }, + "type": "MemberExpression", + "computed": false, + "object": { + "range": [ + 71, + 75 + ], + "loc": { + "start": { + "line": 7, + "column": 6 + }, + "end": { + "line": 7, + "column": 10 + } + }, + "type": "ThisExpression" + }, + "property": { + "range": [ + 76, + 77 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 12 + } + }, + "type": "Identifier", + "name": "a" + } + }, + "kind": "init", + "method": false, + "shorthand": false + } + ] + }, + "right": { + "range": [ + 82, + 83 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 5 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "some_call", + "range": [ + 49, + 58 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 59, + 60 + ], + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 6, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 60, + 61 + ], + "loc": { + "start": { + "line": 6, + "column": 17 + }, + "end": { + "line": 6, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 61, + 62 + ], + "loc": { + "start": { + "line": 6, + "column": 18 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 6, + "column": 19 + }, + "end": { + "line": 6, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 63, + 64 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 69, + 70 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "this", + "range": [ + 71, + 75 + ], + "loc": { + "start": { + "line": 7, + "column": 6 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 75, + 76 + ], + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 76, + 77 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 80, + 81 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 3 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 82, + 83 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 83, + 84 + ], + "loc": { + "start": { + "line": 8, + "column": 5 + }, + "end": { + "line": 8, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 84, + 85 + ], + "loc": { + "start": { + "line": 8, + "column": 6 + }, + "end": { + "line": 8, + "column": 7 + } + } + } + ], + "range": [ + 0, + 85 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 8, + "column": 7 + } + } +} diff --git a/lib/test/esprima/ES6/export-declaration/export-const-number.js b/lib/test/esprima/ES6/export-declaration/export-const-number.js new file mode 100644 index 0000000..bb1843d --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-const-number.js @@ -0,0 +1 @@ +export const foo = 1; diff --git a/lib/test/esprima/ES6/export-declaration/export-const-number.tree.json b/lib/test/esprima/ES6/export-declaration/export-const-number.tree.json new file mode 100644 index 0000000..9b58d3e --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-const-number.tree.json @@ -0,0 +1,223 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "type": "ExportNamedDeclaration", + "declaration": { + "range": [ + 7, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 13, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "Identifier", + "name": "foo" + }, + "init": { + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "Literal", + "value": 1, + "raw": "1" + } + } + ], + "kind": "const" + }, + "specifiers": [], + "source": null + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "const", + "range": [ + 7, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } +} diff --git a/lib/test/esprima/ES6/export-declaration/export-default-array.js b/lib/test/esprima/ES6/export-declaration/export-default-array.js new file mode 100644 index 0000000..d6d1738 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-default-array.js @@ -0,0 +1 @@ +export default []; diff --git a/lib/test/esprima/ES6/export-declaration/export-default-array.tree.json b/lib/test/esprima/ES6/export-declaration/export-default-array.tree.json new file mode 100644 index 0000000..267d841 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-default-array.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportDefaultDeclaration", + "declaration": { + "type": "ArrayExpression", + "elements": [], + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "default", + "range": [ + 7, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } +} diff --git a/lib/test/esprima/ES6/export-declaration/export-default-class.js b/lib/test/esprima/ES6/export-declaration/export-default-class.js new file mode 100644 index 0000000..a6e68e9 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-default-class.js @@ -0,0 +1 @@ +export default class {} diff --git a/lib/test/esprima/ES6/export-declaration/export-default-class.tree.json b/lib/test/esprima/ES6/export-declaration/export-default-class.tree.json new file mode 100644 index 0000000..d5dc3f9 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-default-class.tree.json @@ -0,0 +1,166 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "type": "ExportDefaultDeclaration", + "declaration": { + "range": [ + 15, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "type": "ClassDeclaration", + "id": null, + "superClass": null, + "body": { + "range": [ + 21, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "type": "ClassBody", + "body": [] + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "default", + "range": [ + 7, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "class", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } +} diff --git a/lib/test/esprima/ES6/export-declaration/export-default-expression.js b/lib/test/esprima/ES6/export-declaration/export-default-expression.js new file mode 100644 index 0000000..f30c184 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-default-expression.js @@ -0,0 +1 @@ +export default (1 + 2); diff --git a/lib/test/esprima/ES6/export-declaration/export-default-expression.tree.json b/lib/test/esprima/ES6/export-declaration/export-default-expression.tree.json new file mode 100644 index 0000000..89285fa --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-default-expression.tree.json @@ -0,0 +1,239 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportDefaultDeclaration", + "declaration": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "right": { + "type": "Literal", + "value": 2, + "raw": "2", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "default", + "range": [ + 7, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } +} diff --git a/lib/test/esprima/ES6/export-declaration/export-default-function.js b/lib/test/esprima/ES6/export-declaration/export-default-function.js new file mode 100644 index 0000000..ea9b101 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-default-function.js @@ -0,0 +1 @@ +export default function () {} diff --git a/lib/test/esprima/ES6/export-declaration/export-default-function.tree.json b/lib/test/esprima/ES6/export-declaration/export-default-function.tree.json new file mode 100644 index 0000000..10dd986 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-default-function.tree.json @@ -0,0 +1,204 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportDefaultDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 27, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 15, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "default", + "range": [ + 7, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 15, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } +} diff --git a/lib/test/esprima/ES6/export-declaration/export-default-named-function.js b/lib/test/esprima/ES6/export-declaration/export-default-named-function.js new file mode 100644 index 0000000..386baca --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-default-named-function.js @@ -0,0 +1 @@ +export default function foo() {} diff --git a/lib/test/esprima/ES6/export-declaration/export-default-named-function.tree.json b/lib/test/esprima/ES6/export-declaration/export-default-named-function.tree.json new file mode 100644 index 0000000..023d17e --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-default-named-function.tree.json @@ -0,0 +1,239 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportDefaultDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "foo", + "range": [ + 24, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 30, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 15, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "default", + "range": [ + 7, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 15, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 24, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ], + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + } +} diff --git a/lib/test/esprima/ES6/export-declaration/export-default-number.js b/lib/test/esprima/ES6/export-declaration/export-default-number.js new file mode 100644 index 0000000..7a4e8a7 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-default-number.js @@ -0,0 +1 @@ +export default 42; diff --git a/lib/test/esprima/ES6/export-declaration/export-default-number.tree.json b/lib/test/esprima/ES6/export-declaration/export-default-number.tree.json new file mode 100644 index 0000000..77dc814 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-default-number.tree.json @@ -0,0 +1,130 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportDefaultDeclaration", + "declaration": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "default", + "range": [ + 7, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } +} diff --git a/lib/test/esprima/ES6/export-declaration/export-default-object.js b/lib/test/esprima/ES6/export-declaration/export-default-object.js new file mode 100644 index 0000000..f8266ca --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-default-object.js @@ -0,0 +1 @@ +export default { foo: 1 }; diff --git a/lib/test/esprima/ES6/export-declaration/export-default-object.tree.json b/lib/test/esprima/ES6/export-declaration/export-default-object.tree.json new file mode 100644 index 0000000..050d730 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-default-object.tree.json @@ -0,0 +1,260 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "type": "ExportDefaultDeclaration", + "declaration": { + "range": [ + 15, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "ObjectExpression", + "properties": [ + { + "range": [ + 17, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "type": "Property", + "key": { + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "Identifier", + "name": "foo" + }, + "computed": false, + "value": { + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "type": "Literal", + "value": 1, + "raw": "1" + }, + "kind": "init", + "method": false, + "shorthand": false + } + ] + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "default", + "range": [ + 7, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + } +} diff --git a/lib/test/esprima/ES6/export-declaration/export-default-value.js b/lib/test/esprima/ES6/export-declaration/export-default-value.js new file mode 100644 index 0000000..f7b318b --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-default-value.js @@ -0,0 +1 @@ +export default foo; diff --git a/lib/test/esprima/ES6/export-declaration/export-default-value.tree.json b/lib/test/esprima/ES6/export-declaration/export-default-value.tree.json new file mode 100644 index 0000000..7946d8d --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-default-value.tree.json @@ -0,0 +1,129 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportDefaultDeclaration", + "declaration": { + "type": "Identifier", + "name": "foo", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "default", + "range": [ + 7, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } +} diff --git a/lib/test/esprima/ES6/export-declaration/export-from-batch.js b/lib/test/esprima/ES6/export-declaration/export-from-batch.js new file mode 100644 index 0000000..9ec8f63 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-from-batch.js @@ -0,0 +1 @@ +export * from "foo"; diff --git a/lib/test/esprima/ES6/export-declaration/export-from-batch.tree.json b/lib/test/esprima/ES6/export-declaration/export-from-batch.tree.json new file mode 100644 index 0000000..9b835d7 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-from-batch.tree.json @@ -0,0 +1,148 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "foo", + "raw": "\"foo\"", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "String", + "value": "\"foo\"", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } +} diff --git a/lib/test/esprima/ES6/export-declaration/export-from-default.js b/lib/test/esprima/ES6/export-declaration/export-from-default.js new file mode 100644 index 0000000..2c7930d --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-from-default.js @@ -0,0 +1 @@ +export {default} from "foo"; diff --git a/lib/test/esprima/ES6/export-declaration/export-from-default.tree.json b/lib/test/esprima/ES6/export-declaration/export-from-default.tree.json new file mode 100644 index 0000000..47c4ce1 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-from-default.tree.json @@ -0,0 +1,240 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "exported": { + "type": "Identifier", + "name": "default", + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "local": { + "type": "Identifier", + "name": "default", + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "source": { + "type": "Literal", + "value": "foo", + "raw": "\"foo\"", + "range": [ + 22, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "default", + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 17, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "String", + "value": "\"foo\"", + "range": [ + 22, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + } +} diff --git a/lib/test/esprima/ES6/export-declaration/export-from-named-as-default.js b/lib/test/esprima/ES6/export-declaration/export-from-named-as-default.js new file mode 100644 index 0000000..5be9a68 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-from-named-as-default.js @@ -0,0 +1 @@ +export {foo as default} from "foo"; diff --git a/lib/test/esprima/ES6/export-declaration/export-from-named-as-default.tree.json b/lib/test/esprima/ES6/export-declaration/export-from-named-as-default.tree.json new file mode 100644 index 0000000..7991955 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-from-named-as-default.tree.json @@ -0,0 +1,276 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "exported": { + "type": "Identifier", + "name": "default", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "local": { + "type": "Identifier", + "name": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 8, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "source": { + "type": "Literal", + "value": "foo", + "raw": "\"foo\"", + "range": [ + 29, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "as", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "default", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 24, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "String", + "value": "\"foo\"", + "range": [ + 29, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + } +} diff --git a/lib/test/esprima/ES6/export-declaration/export-from-named-as-specifier.js b/lib/test/esprima/ES6/export-declaration/export-from-named-as-specifier.js new file mode 100644 index 0000000..9fff903 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-from-named-as-specifier.js @@ -0,0 +1 @@ +export {foo as bar} from "foo"; diff --git a/lib/test/esprima/ES6/export-declaration/export-from-named-as-specifier.tree.json b/lib/test/esprima/ES6/export-declaration/export-from-named-as-specifier.tree.json new file mode 100644 index 0000000..44f3b58 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-from-named-as-specifier.tree.json @@ -0,0 +1,276 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "exported": { + "type": "Identifier", + "name": "bar", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "local": { + "type": "Identifier", + "name": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 8, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "source": { + "type": "Literal", + "value": "foo", + "raw": "\"foo\"", + "range": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "as", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 20, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "String", + "value": "\"foo\"", + "range": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } +} diff --git a/lib/test/esprima/ES6/export-declaration/export-from-named-as-specifiers.js b/lib/test/esprima/ES6/export-declaration/export-from-named-as-specifiers.js new file mode 100644 index 0000000..4461d79 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-from-named-as-specifiers.js @@ -0,0 +1 @@ +export {foo as default, bar} from "foo"; diff --git a/lib/test/esprima/ES6/export-declaration/export-from-named-as-specifiers.tree.json b/lib/test/esprima/ES6/export-declaration/export-from-named-as-specifiers.tree.json new file mode 100644 index 0000000..39be3b8 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-from-named-as-specifiers.tree.json @@ -0,0 +1,365 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "exported": { + "type": "Identifier", + "name": "default", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "local": { + "type": "Identifier", + "name": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 8, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "ExportSpecifier", + "exported": { + "type": "Identifier", + "name": "bar", + "range": [ + 24, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "local": { + "type": "Identifier", + "name": "bar", + "range": [ + 24, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "range": [ + 24, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "source": { + "type": "Literal", + "value": "foo", + "raw": "\"foo\"", + "range": [ + 34, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + "range": [ + 0, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "as", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "default", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 24, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 29, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "String", + "value": "\"foo\"", + "range": [ + 34, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + } + ], + "range": [ + 0, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + } +} diff --git a/lib/test/esprima/ES6/export-declaration/export-from-specifier.js b/lib/test/esprima/ES6/export-declaration/export-from-specifier.js new file mode 100644 index 0000000..83b7b67 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-from-specifier.js @@ -0,0 +1 @@ +export {foo} from "foo"; diff --git a/lib/test/esprima/ES6/export-declaration/export-from-specifier.tree.json b/lib/test/esprima/ES6/export-declaration/export-from-specifier.tree.json new file mode 100644 index 0000000..3cf0cec --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-from-specifier.tree.json @@ -0,0 +1,240 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "exported": { + "type": "Identifier", + "name": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "local": { + "type": "Identifier", + "name": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "source": { + "type": "Literal", + "value": "foo", + "raw": "\"foo\"", + "range": [ + 18, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 13, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "String", + "value": "\"foo\"", + "range": [ + 18, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } +} diff --git a/lib/test/esprima/ES6/export-declaration/export-from-specifiers.js b/lib/test/esprima/ES6/export-declaration/export-from-specifiers.js new file mode 100644 index 0000000..35c2762 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-from-specifiers.js @@ -0,0 +1 @@ +export {foo, bar} from "foo"; diff --git a/lib/test/esprima/ES6/export-declaration/export-from-specifiers.tree.json b/lib/test/esprima/ES6/export-declaration/export-from-specifiers.tree.json new file mode 100644 index 0000000..ffb8363 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-from-specifiers.tree.json @@ -0,0 +1,329 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "exported": { + "type": "Identifier", + "name": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "local": { + "type": "Identifier", + "name": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "ExportSpecifier", + "exported": { + "type": "Identifier", + "name": "bar", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "local": { + "type": "Identifier", + "name": "bar", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "source": { + "type": "Literal", + "value": "foo", + "raw": "\"foo\"", + "range": [ + 23, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "String", + "value": "\"foo\"", + "range": [ + 23, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } +} diff --git a/lib/test/esprima/ES6/export-declaration/export-function-declaration.js b/lib/test/esprima/ES6/export-declaration/export-function-declaration.js new file mode 100644 index 0000000..003d71f --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-function-declaration.js @@ -0,0 +1 @@ +export function foo () {} false diff --git a/lib/test/esprima/ES6/export-declaration/export-function-declaration.tree.json b/lib/test/esprima/ES6/export-declaration/export-function-declaration.tree.json new file mode 100644 index 0000000..6004881 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-function-declaration.tree.json @@ -0,0 +1,277 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "ExportNamedDeclaration", + "declaration": { + "range": [ + 7, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 16, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "type": "Identifier", + "name": "foo" + }, + "params": [], + "body": { + "range": [ + 23, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false + }, + "specifiers": [], + "source": null + }, + { + "range": [ + 26, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 26, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "type": "Literal", + "value": false, + "raw": "false" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 7, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 16, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Boolean", + "value": "false", + "range": [ + 26, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } +} diff --git a/lib/test/esprima/ES6/export-declaration/export-function.js b/lib/test/esprima/ES6/export-declaration/export-function.js new file mode 100644 index 0000000..768586d --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-function.js @@ -0,0 +1 @@ +export function foo () {} diff --git a/lib/test/esprima/ES6/export-declaration/export-function.tree.json b/lib/test/esprima/ES6/export-declaration/export-function.tree.json new file mode 100644 index 0000000..d66ded8 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-function.tree.json @@ -0,0 +1,223 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "foo", + "range": [ + 16, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 23, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 7, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "specifiers": [], + "source": null, + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 7, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 16, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } +} diff --git a/lib/test/esprima/ES6/export-declaration/export-let-number.js b/lib/test/esprima/ES6/export-declaration/export-let-number.js new file mode 100644 index 0000000..9d2b01c --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-let-number.js @@ -0,0 +1 @@ +export let foo = 1; diff --git a/lib/test/esprima/ES6/export-declaration/export-let-number.tree.json b/lib/test/esprima/ES6/export-declaration/export-let-number.tree.json new file mode 100644 index 0000000..dc8d073 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-let-number.tree.json @@ -0,0 +1,223 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "type": "ExportNamedDeclaration", + "declaration": { + "range": [ + 7, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 11, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Identifier", + "name": "foo" + }, + "init": { + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "Literal", + "value": 1, + "raw": "1" + } + } + ], + "kind": "let" + }, + "specifiers": [], + "source": null + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 7, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } +} diff --git a/lib/test/esprima/ES6/export-declaration/export-named-as-default.js b/lib/test/esprima/ES6/export-declaration/export-named-as-default.js new file mode 100644 index 0000000..5d32a24 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-named-as-default.js @@ -0,0 +1 @@ +export {foo as default}; diff --git a/lib/test/esprima/ES6/export-declaration/export-named-as-default.tree.json b/lib/test/esprima/ES6/export-declaration/export-named-as-default.tree.json new file mode 100644 index 0000000..039c704 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-named-as-default.tree.json @@ -0,0 +1,222 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "exported": { + "type": "Identifier", + "name": "default", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "local": { + "type": "Identifier", + "name": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 8, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "source": null, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "as", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "default", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } +} diff --git a/lib/test/esprima/ES6/export-declaration/export-named-as-specifier.js b/lib/test/esprima/ES6/export-declaration/export-named-as-specifier.js new file mode 100644 index 0000000..e7820a6 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-named-as-specifier.js @@ -0,0 +1 @@ +export {foo as bar}; diff --git a/lib/test/esprima/ES6/export-declaration/export-named-as-specifier.tree.json b/lib/test/esprima/ES6/export-declaration/export-named-as-specifier.tree.json new file mode 100644 index 0000000..1bc02d2 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-named-as-specifier.tree.json @@ -0,0 +1,222 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "exported": { + "type": "Identifier", + "name": "bar", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "local": { + "type": "Identifier", + "name": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 8, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "source": null, + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "as", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } +} diff --git a/lib/test/esprima/ES6/export-declaration/export-named-as-specifiers.js b/lib/test/esprima/ES6/export-declaration/export-named-as-specifiers.js new file mode 100644 index 0000000..ff57927 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-named-as-specifiers.js @@ -0,0 +1 @@ +export {foo as default, bar}; diff --git a/lib/test/esprima/ES6/export-declaration/export-named-as-specifiers.tree.json b/lib/test/esprima/ES6/export-declaration/export-named-as-specifiers.tree.json new file mode 100644 index 0000000..47893e4 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-named-as-specifiers.tree.json @@ -0,0 +1,311 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "exported": { + "type": "Identifier", + "name": "default", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "local": { + "type": "Identifier", + "name": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 8, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "ExportSpecifier", + "exported": { + "type": "Identifier", + "name": "bar", + "range": [ + 24, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "local": { + "type": "Identifier", + "name": "bar", + "range": [ + 24, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "range": [ + 24, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "source": null, + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "as", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "default", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 24, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } +} diff --git a/lib/test/esprima/ES6/export-declaration/export-named-empty.js b/lib/test/esprima/ES6/export-declaration/export-named-empty.js new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-named-empty.js @@ -0,0 +1 @@ +export {}; diff --git a/lib/test/esprima/ES6/export-declaration/export-named-empty.tree.json b/lib/test/esprima/ES6/export-declaration/export-named-empty.tree.json new file mode 100644 index 0000000..3748395 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-named-empty.tree.json @@ -0,0 +1,114 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": null, + "specifiers": [], + "source": null, + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } +} diff --git a/lib/test/esprima/ES6/export-declaration/export-named-specifier.js b/lib/test/esprima/ES6/export-declaration/export-named-specifier.js new file mode 100644 index 0000000..df5f5e6 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-named-specifier.js @@ -0,0 +1 @@ +export {foo}; diff --git a/lib/test/esprima/ES6/export-declaration/export-named-specifier.tree.json b/lib/test/esprima/ES6/export-declaration/export-named-specifier.tree.json new file mode 100644 index 0000000..5fd887d --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-named-specifier.tree.json @@ -0,0 +1,186 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "exported": { + "type": "Identifier", + "name": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "local": { + "type": "Identifier", + "name": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "source": null, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } +} diff --git a/lib/test/esprima/ES6/export-declaration/export-named-specifiers-comma.js b/lib/test/esprima/ES6/export-declaration/export-named-specifiers-comma.js new file mode 100644 index 0000000..61bc40f --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-named-specifiers-comma.js @@ -0,0 +1 @@ +export {foo, bar,}; diff --git a/lib/test/esprima/ES6/export-declaration/export-named-specifiers-comma.tree.json b/lib/test/esprima/ES6/export-declaration/export-named-specifiers-comma.tree.json new file mode 100644 index 0000000..2e94b96 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-named-specifiers-comma.tree.json @@ -0,0 +1,293 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "exported": { + "type": "Identifier", + "name": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "local": { + "type": "Identifier", + "name": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "ExportSpecifier", + "exported": { + "type": "Identifier", + "name": "bar", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "local": { + "type": "Identifier", + "name": "bar", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "source": null, + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } +} diff --git a/lib/test/esprima/ES6/export-declaration/export-named-specifiers.js b/lib/test/esprima/ES6/export-declaration/export-named-specifiers.js new file mode 100644 index 0000000..fdbc942 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-named-specifiers.js @@ -0,0 +1 @@ +export {foo, bar}; diff --git a/lib/test/esprima/ES6/export-declaration/export-named-specifiers.tree.json b/lib/test/esprima/ES6/export-declaration/export-named-specifiers.tree.json new file mode 100644 index 0000000..7154a3b --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-named-specifiers.tree.json @@ -0,0 +1,275 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "exported": { + "type": "Identifier", + "name": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "local": { + "type": "Identifier", + "name": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "ExportSpecifier", + "exported": { + "type": "Identifier", + "name": "bar", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "local": { + "type": "Identifier", + "name": "bar", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "source": null, + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } +} diff --git a/lib/test/esprima/ES6/export-declaration/export-var-anonymous-function.js b/lib/test/esprima/ES6/export-declaration/export-var-anonymous-function.js new file mode 100644 index 0000000..f8af288 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-var-anonymous-function.js @@ -0,0 +1 @@ +export var foo = function () {}; diff --git a/lib/test/esprima/ES6/export-declaration/export-var-anonymous-function.tree.json b/lib/test/esprima/ES6/export-declaration/export-var-anonymous-function.tree.json new file mode 100644 index 0000000..18607e6 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-var-anonymous-function.tree.json @@ -0,0 +1,315 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "foo", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "init": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 29, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 17, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "range": [ + 11, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "kind": "var", + "range": [ + 7, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "specifiers": [], + "source": null, + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 7, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 17, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ], + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + } +} diff --git a/lib/test/esprima/ES6/export-declaration/export-var-number.js b/lib/test/esprima/ES6/export-declaration/export-var-number.js new file mode 100644 index 0000000..e2e71aa --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-var-number.js @@ -0,0 +1 @@ +export var foo = 1; diff --git a/lib/test/esprima/ES6/export-declaration/export-var-number.tree.json b/lib/test/esprima/ES6/export-declaration/export-var-number.tree.json new file mode 100644 index 0000000..d9d755c --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-var-number.tree.json @@ -0,0 +1,223 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "foo", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "init": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 11, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "kind": "var", + "range": [ + 7, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "specifiers": [], + "source": null, + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 7, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } +} diff --git a/lib/test/esprima/ES6/export-declaration/export-var.js b/lib/test/esprima/ES6/export-declaration/export-var.js new file mode 100644 index 0000000..62da3e6 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-var.js @@ -0,0 +1 @@ +export var bar; diff --git a/lib/test/esprima/ES6/export-declaration/export-var.tree.json b/lib/test/esprima/ES6/export-declaration/export-var.tree.json new file mode 100644 index 0000000..19974e2 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/export-var.tree.json @@ -0,0 +1,169 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "bar", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "init": null, + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "kind": "var", + "range": [ + 7, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "specifiers": [], + "source": null, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 7, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } +} diff --git a/lib/test/esprima/ES6/export-declaration/invalid-export-batch-missing-from-clause.js b/lib/test/esprima/ES6/export-declaration/invalid-export-batch-missing-from-clause.js new file mode 100644 index 0000000..3f57688 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/invalid-export-batch-missing-from-clause.js @@ -0,0 +1 @@ +export * diff --git a/lib/test/esprima/ES6/export-declaration/invalid-export-batch-missing-from-clause.module.json b/lib/test/esprima/ES6/export-declaration/invalid-export-batch-missing-from-clause.module.json new file mode 100644 index 0000000..965e5a3 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/invalid-export-batch-missing-from-clause.module.json @@ -0,0 +1,7 @@ +{ + "index": 8, + "lineNumber": 1, + "column": 9, + "message": "Error: Line 1: Unexpected token", + "description": "Unexpected token" +} diff --git a/lib/test/esprima/ES6/export-declaration/invalid-export-batch-token.js b/lib/test/esprima/ES6/export-declaration/invalid-export-batch-token.js new file mode 100644 index 0000000..32cb28e --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/invalid-export-batch-token.js @@ -0,0 +1 @@ +export * + diff --git a/lib/test/esprima/ES6/export-declaration/invalid-export-batch-token.module.json b/lib/test/esprima/ES6/export-declaration/invalid-export-batch-token.module.json new file mode 100644 index 0000000..b1440c0 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/invalid-export-batch-token.module.json @@ -0,0 +1,7 @@ +{ + "index": 8, + "lineNumber": 1, + "column": 9, + "message": "Error: Line 1: Unexpected token +", + "description": "Unexpected token +" +} diff --git a/lib/test/esprima/ES6/export-declaration/invalid-export-default-equal.js b/lib/test/esprima/ES6/export-declaration/invalid-export-default-equal.js new file mode 100644 index 0000000..0dfb038 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/invalid-export-default-equal.js @@ -0,0 +1 @@ +export default = 42 diff --git a/lib/test/esprima/ES6/export-declaration/invalid-export-default-equal.module.json b/lib/test/esprima/ES6/export-declaration/invalid-export-default-equal.module.json new file mode 100644 index 0000000..f6ad707 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/invalid-export-default-equal.module.json @@ -0,0 +1,7 @@ +{ + "index": 15, + "lineNumber": 1, + "column": 16, + "message": "Error: Line 1: Unexpected token =", + "description": "Unexpected token =" +} diff --git a/lib/test/esprima/ES6/export-declaration/invalid-export-default-token.js b/lib/test/esprima/ES6/export-declaration/invalid-export-default-token.js new file mode 100644 index 0000000..a0af03d --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/invalid-export-default-token.js @@ -0,0 +1 @@ +export {default} + diff --git a/lib/test/esprima/ES6/export-declaration/invalid-export-default-token.module.json b/lib/test/esprima/ES6/export-declaration/invalid-export-default-token.module.json new file mode 100644 index 0000000..81146eb --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/invalid-export-default-token.module.json @@ -0,0 +1,7 @@ +{ + "index": 16, + "lineNumber": 1, + "column": 17, + "message": "Error: Line 1: Unexpected token +", + "description": "Unexpected token +" +} diff --git a/lib/test/esprima/ES6/export-declaration/invalid-export-default.js b/lib/test/esprima/ES6/export-declaration/invalid-export-default.js new file mode 100644 index 0000000..8dfa0a1 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/invalid-export-default.js @@ -0,0 +1 @@ +export default from "foo" diff --git a/lib/test/esprima/ES6/export-declaration/invalid-export-default.module.json b/lib/test/esprima/ES6/export-declaration/invalid-export-default.module.json new file mode 100644 index 0000000..1639ece --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/invalid-export-default.module.json @@ -0,0 +1,7 @@ +{ + "index": 14, + "lineNumber": 1, + "column": 15, + "message": "Error: Line 1: Unexpected token from", + "description": "Unexpected token from" +} diff --git a/lib/test/esprima/ES6/export-declaration/invalid-export-named-default.js b/lib/test/esprima/ES6/export-declaration/invalid-export-named-default.js new file mode 100644 index 0000000..8f3cde5 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/invalid-export-named-default.js @@ -0,0 +1 @@ +export {default} diff --git a/lib/test/esprima/ES6/export-declaration/invalid-export-named-default.module.json b/lib/test/esprima/ES6/export-declaration/invalid-export-named-default.module.json new file mode 100644 index 0000000..1536989 --- /dev/null +++ b/lib/test/esprima/ES6/export-declaration/invalid-export-named-default.module.json @@ -0,0 +1,7 @@ +{ + "index": 16, + "lineNumber": 1, + "column": 17, + "message": "Error: Line 1: Unexpected token", + "description": "Unexpected token" +} diff --git a/lib/test/esprima/ES6/for-of/for-of-array-pattern-let.js b/lib/test/esprima/ES6/for-of/for-of-array-pattern-let.js new file mode 100644 index 0000000..a8c67fc --- /dev/null +++ b/lib/test/esprima/ES6/for-of/for-of-array-pattern-let.js @@ -0,0 +1 @@ +for (let [p, q] of r); diff --git a/lib/test/esprima/ES6/for-of/for-of-array-pattern-let.tree.json b/lib/test/esprima/ES6/for-of/for-of-array-pattern-let.tree.json new file mode 100644 index 0000000..419164e --- /dev/null +++ b/lib/test/esprima/ES6/for-of/for-of-array-pattern-let.tree.json @@ -0,0 +1,383 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "ForOfStatement", + "left": { + "range": [ + 5, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 9, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 9, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Identifier", + "name": "p" + }, + { + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Identifier", + "name": "q" + } + ] + }, + "init": null + } + ], + "kind": "let" + }, + "right": { + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "Identifier", + "name": "r" + }, + "body": { + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "EmptyStatement" + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "p", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "q", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "of", + "range": [ + 16, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "r", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } +} diff --git a/lib/test/esprima/ES6/for-of/for-of-array-pattern-var.js b/lib/test/esprima/ES6/for-of/for-of-array-pattern-var.js new file mode 100644 index 0000000..fb2e136 --- /dev/null +++ b/lib/test/esprima/ES6/for-of/for-of-array-pattern-var.js @@ -0,0 +1 @@ +for (var [p, q] of r); diff --git a/lib/test/esprima/ES6/for-of/for-of-array-pattern-var.tree.json b/lib/test/esprima/ES6/for-of/for-of-array-pattern-var.tree.json new file mode 100644 index 0000000..dbb3799 --- /dev/null +++ b/lib/test/esprima/ES6/for-of/for-of-array-pattern-var.tree.json @@ -0,0 +1,383 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "ForOfStatement", + "left": { + "range": [ + 5, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 9, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 9, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Identifier", + "name": "p" + }, + { + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Identifier", + "name": "q" + } + ] + }, + "init": null + } + ], + "kind": "var" + }, + "right": { + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "Identifier", + "name": "r" + }, + "body": { + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "EmptyStatement" + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "p", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "q", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "of", + "range": [ + 16, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "r", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } +} diff --git a/lib/test/esprima/ES6/for-of/for-of-array-pattern.js b/lib/test/esprima/ES6/for-of/for-of-array-pattern.js new file mode 100644 index 0000000..9d98aba --- /dev/null +++ b/lib/test/esprima/ES6/for-of/for-of-array-pattern.js @@ -0,0 +1 @@ +for ([p, q] of r); diff --git a/lib/test/esprima/ES6/for-of/for-of-array-pattern.tree.json b/lib/test/esprima/ES6/for-of/for-of-array-pattern.tree.json new file mode 100644 index 0000000..9a7b8fa --- /dev/null +++ b/lib/test/esprima/ES6/for-of/for-of-array-pattern.tree.json @@ -0,0 +1,327 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "ForOfStatement", + "left": { + "range": [ + 5, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Identifier", + "name": "p" + }, + { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Identifier", + "name": "q" + } + ] + }, + "right": { + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "Identifier", + "name": "r" + }, + "body": { + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "EmptyStatement" + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "p", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "q", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "of", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "r", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } +} diff --git a/lib/test/esprima/ES6/for-of/for-of-let.js b/lib/test/esprima/ES6/for-of/for-of-let.js new file mode 100644 index 0000000..b60a63f --- /dev/null +++ b/lib/test/esprima/ES6/for-of/for-of-let.js @@ -0,0 +1 @@ +for (x of let) {} diff --git a/lib/test/esprima/ES6/for-of/for-of-let.tree.json b/lib/test/esprima/ES6/for-of/for-of-let.tree.json new file mode 100644 index 0000000..797bd0e --- /dev/null +++ b/lib/test/esprima/ES6/for-of/for-of-let.tree.json @@ -0,0 +1,237 @@ +{ + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "Program", + "body": [ + { + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "ForOfStatement", + "left": { + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "Identifier", + "name": "x" + }, + "right": { + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "Identifier", + "name": "let" + }, + "body": { + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "BlockStatement", + "body": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "of", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ] +} diff --git a/lib/test/esprima/ES6/for-of/for-of-object-pattern-const.js b/lib/test/esprima/ES6/for-of/for-of-object-pattern-const.js new file mode 100644 index 0000000..05db80e --- /dev/null +++ b/lib/test/esprima/ES6/for-of/for-of-object-pattern-const.js @@ -0,0 +1 @@ +for (const {x, y} of z); diff --git a/lib/test/esprima/ES6/for-of/for-of-object-pattern-const.tree.json b/lib/test/esprima/ES6/for-of/for-of-object-pattern-const.tree.json new file mode 100644 index 0000000..8cc1ea2 --- /dev/null +++ b/lib/test/esprima/ES6/for-of/for-of-object-pattern-const.tree.json @@ -0,0 +1,461 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "type": "ForOfStatement", + "left": { + "range": [ + 5, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 11, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 11, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "ObjectPattern", + "properties": [ + { + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "Property", + "key": { + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "Identifier", + "name": "x" + }, + "computed": false, + "value": { + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "Identifier", + "name": "x" + }, + "kind": "init", + "method": false, + "shorthand": true + }, + { + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "Property", + "key": { + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "Identifier", + "name": "y" + }, + "computed": false, + "value": { + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "Identifier", + "name": "y" + }, + "kind": "init", + "method": false, + "shorthand": true + } + ] + }, + "init": null + } + ], + "kind": "const" + }, + "right": { + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "Identifier", + "name": "z" + }, + "body": { + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "type": "EmptyStatement" + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "const", + "range": [ + 5, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "of", + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } +} diff --git a/lib/test/esprima/ES6/for-of/for-of-object-pattern-var.js b/lib/test/esprima/ES6/for-of/for-of-object-pattern-var.js new file mode 100644 index 0000000..64a937b --- /dev/null +++ b/lib/test/esprima/ES6/for-of/for-of-object-pattern-var.js @@ -0,0 +1 @@ +for (var {x, y} of z); diff --git a/lib/test/esprima/ES6/for-of/for-of-object-pattern-var.tree.json b/lib/test/esprima/ES6/for-of/for-of-object-pattern-var.tree.json new file mode 100644 index 0000000..5e4d9a4 --- /dev/null +++ b/lib/test/esprima/ES6/for-of/for-of-object-pattern-var.tree.json @@ -0,0 +1,461 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "ForOfStatement", + "left": { + "range": [ + 5, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 9, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 9, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "ObjectPattern", + "properties": [ + { + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Property", + "key": { + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Identifier", + "name": "x" + }, + "computed": false, + "value": { + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Identifier", + "name": "x" + }, + "kind": "init", + "method": false, + "shorthand": true + }, + { + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Property", + "key": { + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Identifier", + "name": "y" + }, + "computed": false, + "value": { + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Identifier", + "name": "y" + }, + "kind": "init", + "method": false, + "shorthand": true + } + ] + }, + "init": null + } + ], + "kind": "var" + }, + "right": { + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "Identifier", + "name": "z" + }, + "body": { + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "EmptyStatement" + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "of", + "range": [ + 16, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } +} diff --git a/lib/test/esprima/ES6/for-of/for-of-object-pattern.js b/lib/test/esprima/ES6/for-of/for-of-object-pattern.js new file mode 100644 index 0000000..a966745 --- /dev/null +++ b/lib/test/esprima/ES6/for-of/for-of-object-pattern.js @@ -0,0 +1 @@ +for ({x, y} of z); diff --git a/lib/test/esprima/ES6/for-of/for-of-object-pattern.tree.json b/lib/test/esprima/ES6/for-of/for-of-object-pattern.tree.json new file mode 100644 index 0000000..5b4fd7a --- /dev/null +++ b/lib/test/esprima/ES6/for-of/for-of-object-pattern.tree.json @@ -0,0 +1,405 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "ForOfStatement", + "left": { + "range": [ + 5, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "ObjectPattern", + "properties": [ + { + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Property", + "key": { + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Identifier", + "name": "x" + }, + "computed": false, + "value": { + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Identifier", + "name": "x" + }, + "kind": "init", + "method": false, + "shorthand": true + }, + { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Property", + "key": { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Identifier", + "name": "y" + }, + "computed": false, + "value": { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Identifier", + "name": "y" + }, + "kind": "init", + "method": false, + "shorthand": true + } + ] + }, + "right": { + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "Identifier", + "name": "z" + }, + "body": { + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "EmptyStatement" + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "of", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } +} diff --git a/lib/test/esprima/ES6/for-of/for-of-with-const.js b/lib/test/esprima/ES6/for-of/for-of-with-const.js new file mode 100644 index 0000000..3cb53e5 --- /dev/null +++ b/lib/test/esprima/ES6/for-of/for-of-with-const.js @@ -0,0 +1 @@ +for (const y of list); diff --git a/lib/test/esprima/ES6/for-of/for-of-with-const.tree.json b/lib/test/esprima/ES6/for-of/for-of-with-const.tree.json new file mode 100644 index 0000000..a0d5ed7 --- /dev/null +++ b/lib/test/esprima/ES6/for-of/for-of-with-const.tree.json @@ -0,0 +1,274 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "ForOfStatement", + "left": { + "range": [ + 5, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "Identifier", + "name": "y" + }, + "init": null + } + ], + "kind": "const" + }, + "right": { + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "Identifier", + "name": "list" + }, + "body": { + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "EmptyStatement" + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "const", + "range": [ + 5, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "of", + "range": [ + 13, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "list", + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } +} diff --git a/lib/test/esprima/ES6/for-of/for-of-with-let.js b/lib/test/esprima/ES6/for-of/for-of-with-let.js new file mode 100644 index 0000000..4596dd4 --- /dev/null +++ b/lib/test/esprima/ES6/for-of/for-of-with-let.js @@ -0,0 +1 @@ +for (let z of list); diff --git a/lib/test/esprima/ES6/for-of/for-of-with-let.tree.json b/lib/test/esprima/ES6/for-of/for-of-with-let.tree.json new file mode 100644 index 0000000..6dc117b --- /dev/null +++ b/lib/test/esprima/ES6/for-of/for-of-with-let.tree.json @@ -0,0 +1,274 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "ForOfStatement", + "left": { + "range": [ + 5, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Identifier", + "name": "z" + }, + "init": null + } + ], + "kind": "let" + }, + "right": { + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "Identifier", + "name": "list" + }, + "body": { + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "EmptyStatement" + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "of", + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "list", + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } +} diff --git a/lib/test/esprima/ES6/for-of/for-of-with-var.js b/lib/test/esprima/ES6/for-of/for-of-with-var.js new file mode 100644 index 0000000..1bd3230 --- /dev/null +++ b/lib/test/esprima/ES6/for-of/for-of-with-var.js @@ -0,0 +1 @@ +for (var x of list); diff --git a/lib/test/esprima/ES6/for-of/for-of-with-var.tree.json b/lib/test/esprima/ES6/for-of/for-of-with-var.tree.json new file mode 100644 index 0000000..a4b4100 --- /dev/null +++ b/lib/test/esprima/ES6/for-of/for-of-with-var.tree.json @@ -0,0 +1,274 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "ForOfStatement", + "left": { + "range": [ + 5, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Identifier", + "name": "x" + }, + "init": null + } + ], + "kind": "var" + }, + "right": { + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "Identifier", + "name": "list" + }, + "body": { + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "EmptyStatement" + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "of", + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "list", + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } +} diff --git a/lib/test/esprima/ES6/for-of/for-of.js b/lib/test/esprima/ES6/for-of/for-of.js new file mode 100644 index 0000000..61d8311 --- /dev/null +++ b/lib/test/esprima/ES6/for-of/for-of.js @@ -0,0 +1 @@ +for (p of q); diff --git a/lib/test/esprima/ES6/for-of/for-of.tree.json b/lib/test/esprima/ES6/for-of/for-of.tree.json new file mode 100644 index 0000000..83dbb37 --- /dev/null +++ b/lib/test/esprima/ES6/for-of/for-of.tree.json @@ -0,0 +1,218 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "ForOfStatement", + "left": { + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "Identifier", + "name": "p" + }, + "right": { + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Identifier", + "name": "q" + }, + "body": { + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "EmptyStatement" + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "p", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "of", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "q", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } +} diff --git a/lib/test/esprima/ES6/for-of/invalid-const-init.failure.json b/lib/test/esprima/ES6/for-of/invalid-const-init.failure.json new file mode 100644 index 0000000..5b8f110 --- /dev/null +++ b/lib/test/esprima/ES6/for-of/invalid-const-init.failure.json @@ -0,0 +1 @@ +{"index":17,"lineNumber":1,"column":18,"message":"Error: Line 1: Unexpected identifier","description":"Unexpected identifier"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/for-of/invalid-const-init.js b/lib/test/esprima/ES6/for-of/invalid-const-init.js new file mode 100644 index 0000000..802142b --- /dev/null +++ b/lib/test/esprima/ES6/for-of/invalid-const-init.js @@ -0,0 +1 @@ +for (const x = 1 of y); diff --git a/lib/test/esprima/ES6/for-of/invalid-for-of-array-pattern.failure.json b/lib/test/esprima/ES6/for-of/invalid-for-of-array-pattern.failure.json new file mode 100644 index 0000000..5407b6e --- /dev/null +++ b/lib/test/esprima/ES6/for-of/invalid-for-of-array-pattern.failure.json @@ -0,0 +1 @@ +{"index":15,"lineNumber":1,"column":16,"message":"Error: Line 1: Unexpected identifier","description":"Unexpected identifier"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/for-of/invalid-for-of-array-pattern.js b/lib/test/esprima/ES6/for-of/invalid-for-of-array-pattern.js new file mode 100644 index 0000000..5b475e3 --- /dev/null +++ b/lib/test/esprima/ES6/for-of/invalid-for-of-array-pattern.js @@ -0,0 +1 @@ +for (var [p]=q of r); diff --git a/lib/test/esprima/ES6/for-of/invalid-for-of-object-pattern.failure.json b/lib/test/esprima/ES6/for-of/invalid-for-of-object-pattern.failure.json new file mode 100644 index 0000000..5b8f110 --- /dev/null +++ b/lib/test/esprima/ES6/for-of/invalid-for-of-object-pattern.failure.json @@ -0,0 +1 @@ +{"index":17,"lineNumber":1,"column":18,"message":"Error: Line 1: Unexpected identifier","description":"Unexpected identifier"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/for-of/invalid-for-of-object-pattern.js b/lib/test/esprima/ES6/for-of/invalid-for-of-object-pattern.js new file mode 100644 index 0000000..7a250e1 --- /dev/null +++ b/lib/test/esprima/ES6/for-of/invalid-for-of-object-pattern.js @@ -0,0 +1 @@ +for (var {x} = y of z); diff --git a/lib/test/esprima/ES6/for-of/invalid-let-init.failure.json b/lib/test/esprima/ES6/for-of/invalid-let-init.failure.json new file mode 100644 index 0000000..5407b6e --- /dev/null +++ b/lib/test/esprima/ES6/for-of/invalid-let-init.failure.json @@ -0,0 +1 @@ +{"index":15,"lineNumber":1,"column":16,"message":"Error: Line 1: Unexpected identifier","description":"Unexpected identifier"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/for-of/invalid-let-init.js b/lib/test/esprima/ES6/for-of/invalid-let-init.js new file mode 100644 index 0000000..16c9d38 --- /dev/null +++ b/lib/test/esprima/ES6/for-of/invalid-let-init.js @@ -0,0 +1 @@ +for (let x = 1 of y); diff --git a/lib/test/esprima/ES6/for-of/invalid-lhs-init.failure.json b/lib/test/esprima/ES6/for-of/invalid-lhs-init.failure.json new file mode 100644 index 0000000..c77a0de --- /dev/null +++ b/lib/test/esprima/ES6/for-of/invalid-lhs-init.failure.json @@ -0,0 +1 @@ +{"index":9,"lineNumber":1,"column":10,"message":"Error: Line 1: Invalid left-hand side in for-loop","description":"Invalid left-hand side in for-loop"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/for-of/invalid-lhs-init.js b/lib/test/esprima/ES6/for-of/invalid-lhs-init.js new file mode 100644 index 0000000..9150592 --- /dev/null +++ b/lib/test/esprima/ES6/for-of/invalid-lhs-init.js @@ -0,0 +1 @@ +for (this of that); diff --git a/lib/test/esprima/ES6/for-of/invalid-strict-for-of-let.failure.json b/lib/test/esprima/ES6/for-of/invalid-strict-for-of-let.failure.json new file mode 100644 index 0000000..5cc7e6f --- /dev/null +++ b/lib/test/esprima/ES6/for-of/invalid-strict-for-of-let.failure.json @@ -0,0 +1 @@ +{"index":24,"lineNumber":1,"column":25,"message":"Error: Line 1: Use of future reserved word in strict mode","description":"Use of future reserved word in strict mode"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/for-of/invalid-strict-for-of-let.js b/lib/test/esprima/ES6/for-of/invalid-strict-for-of-let.js new file mode 100644 index 0000000..b63e43c --- /dev/null +++ b/lib/test/esprima/ES6/for-of/invalid-strict-for-of-let.js @@ -0,0 +1 @@ +"use strict"; for (x of let) {} diff --git a/lib/test/esprima/ES6/for-of/invalid-var-init.failure.json b/lib/test/esprima/ES6/for-of/invalid-var-init.failure.json new file mode 100644 index 0000000..5407b6e --- /dev/null +++ b/lib/test/esprima/ES6/for-of/invalid-var-init.failure.json @@ -0,0 +1 @@ +{"index":15,"lineNumber":1,"column":16,"message":"Error: Line 1: Unexpected identifier","description":"Unexpected identifier"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/for-of/invalid-var-init.js b/lib/test/esprima/ES6/for-of/invalid-var-init.js new file mode 100644 index 0000000..2b5eb5d --- /dev/null +++ b/lib/test/esprima/ES6/for-of/invalid-var-init.js @@ -0,0 +1 @@ +for (var x = 1 of y); diff --git a/lib/test/esprima/ES6/for-of/invalid_const_let.failure.json b/lib/test/esprima/ES6/for-of/invalid_const_let.failure.json new file mode 100644 index 0000000..abfc6d5 --- /dev/null +++ b/lib/test/esprima/ES6/for-of/invalid_const_let.failure.json @@ -0,0 +1 @@ +{"index":11,"lineNumber":1,"column":12,"message":"Error: Line 1: Unexpected token let","description":"Unexpected token let"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/for-of/invalid_const_let.js b/lib/test/esprima/ES6/for-of/invalid_const_let.js new file mode 100644 index 0000000..b9719f9 --- /dev/null +++ b/lib/test/esprima/ES6/for-of/invalid_const_let.js @@ -0,0 +1 @@ +for (const let of y); diff --git a/lib/test/esprima/ES6/for-of/invalid_let_let.failure.json b/lib/test/esprima/ES6/for-of/invalid_let_let.failure.json new file mode 100644 index 0000000..92ab644 --- /dev/null +++ b/lib/test/esprima/ES6/for-of/invalid_let_let.failure.json @@ -0,0 +1 @@ +{"index":9,"lineNumber":1,"column":10,"message":"Error: Line 1: Unexpected token let","description":"Unexpected token let"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/for-of/invalid_let_let.js b/lib/test/esprima/ES6/for-of/invalid_let_let.js new file mode 100644 index 0000000..f43a25d --- /dev/null +++ b/lib/test/esprima/ES6/for-of/invalid_let_let.js @@ -0,0 +1 @@ +for (let let of x); diff --git a/lib/test/esprima/ES6/for-of/let-of-of.js b/lib/test/esprima/ES6/for-of/let-of-of.js new file mode 100644 index 0000000..cbc3509 --- /dev/null +++ b/lib/test/esprima/ES6/for-of/let-of-of.js @@ -0,0 +1 @@ +for (let of of xyz); diff --git a/lib/test/esprima/ES6/for-of/let-of-of.tree.json b/lib/test/esprima/ES6/for-of/let-of-of.tree.json new file mode 100644 index 0000000..7e0abdb --- /dev/null +++ b/lib/test/esprima/ES6/for-of/let-of-of.tree.json @@ -0,0 +1,274 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "ForOfStatement", + "left": { + "range": [ + 5, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Identifier", + "name": "of" + }, + "init": null + } + ], + "kind": "let" + }, + "right": { + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "Identifier", + "name": "xyz" + }, + "body": { + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "EmptyStatement" + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "of", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "of", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "xyz", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } +} diff --git a/lib/test/esprima/ES6/for-of/unexpected-number.failure.json b/lib/test/esprima/ES6/for-of/unexpected-number.failure.json new file mode 100644 index 0000000..9daa174 --- /dev/null +++ b/lib/test/esprima/ES6/for-of/unexpected-number.failure.json @@ -0,0 +1 @@ +{"index":14,"lineNumber":1,"column":15,"message":"Error: Line 1: Unexpected number","description":"Unexpected number"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/for-of/unexpected-number.js b/lib/test/esprima/ES6/for-of/unexpected-number.js new file mode 100644 index 0000000..c2ff917 --- /dev/null +++ b/lib/test/esprima/ES6/for-of/unexpected-number.js @@ -0,0 +1 @@ +for (const of 42); diff --git a/lib/test/esprima/ES6/generator/generator-declaration-with-params.js b/lib/test/esprima/ES6/generator/generator-declaration-with-params.js new file mode 100644 index 0000000..cdbfd3f --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-declaration-with-params.js @@ -0,0 +1 @@ +function *foo(x, y, z) {} diff --git a/lib/test/esprima/ES6/generator/generator-declaration-with-params.tree.json b/lib/test/esprima/ES6/generator/generator-declaration-with-params.tree.json new file mode 100644 index 0000000..d3f902d --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-declaration-with-params.tree.json @@ -0,0 +1,349 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "Identifier", + "name": "foo" + }, + "params": [ + { + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "Identifier", + "name": "x" + }, + { + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "Identifier", + "name": "y" + }, + { + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "type": "Identifier", + "name": "z" + } + ], + "body": { + "range": [ + 23, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": true, + "expression": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } +} diff --git a/lib/test/esprima/ES6/generator/generator-declaration-with-yield-delegate.js b/lib/test/esprima/ES6/generator/generator-declaration-with-yield-delegate.js new file mode 100644 index 0000000..fd4f8e1 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-declaration-with-yield-delegate.js @@ -0,0 +1 @@ +function *foo() { yield* 3; } diff --git a/lib/test/esprima/ES6/generator/generator-declaration-with-yield-delegate.tree.json b/lib/test/esprima/ES6/generator/generator-declaration-with-yield-delegate.tree.json new file mode 100644 index 0000000..e986c43 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-declaration-with-yield-delegate.tree.json @@ -0,0 +1,331 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "Identifier", + "name": "foo" + }, + "params": [], + "body": { + "range": [ + 16, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 18, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 18, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "type": "YieldExpression", + "argument": { + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "type": "Literal", + "value": 3, + "raw": "3" + }, + "delegate": true + } + } + ] + }, + "generator": true, + "expression": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 18, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Numeric", + "value": "3", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } +} diff --git a/lib/test/esprima/ES6/generator/generator-declaration-with-yield.js b/lib/test/esprima/ES6/generator/generator-declaration-with-yield.js new file mode 100644 index 0000000..52ac303 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-declaration-with-yield.js @@ -0,0 +1 @@ +function *foo() { yield 3; } diff --git a/lib/test/esprima/ES6/generator/generator-declaration-with-yield.tree.json b/lib/test/esprima/ES6/generator/generator-declaration-with-yield.tree.json new file mode 100644 index 0000000..df2b3f5 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-declaration-with-yield.tree.json @@ -0,0 +1,313 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "Identifier", + "name": "foo" + }, + "params": [], + "body": { + "range": [ + 16, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 18, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 18, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "YieldExpression", + "argument": { + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "Literal", + "value": 3, + "raw": "3" + }, + "delegate": false + } + } + ] + }, + "generator": true, + "expression": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 18, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Numeric", + "value": "3", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + } +} diff --git a/lib/test/esprima/ES6/generator/generator-declaration.js b/lib/test/esprima/ES6/generator/generator-declaration.js new file mode 100644 index 0000000..7c42189 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-declaration.js @@ -0,0 +1 @@ +function *foo() {} diff --git a/lib/test/esprima/ES6/generator/generator-declaration.tree.json b/lib/test/esprima/ES6/generator/generator-declaration.tree.json new file mode 100644 index 0000000..8b0bc71 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-declaration.tree.json @@ -0,0 +1,204 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "Identifier", + "name": "foo" + }, + "params": [], + "body": { + "range": [ + 16, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": true, + "expression": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } +} diff --git a/lib/test/esprima/ES6/generator/generator-expression-rest-param.js b/lib/test/esprima/ES6/generator/generator-expression-rest-param.js new file mode 100644 index 0000000..855b743 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-expression-rest-param.js @@ -0,0 +1 @@ +(function*(...x) {}) diff --git a/lib/test/esprima/ES6/generator/generator-expression-rest-param.tree.json b/lib/test/esprima/ES6/generator/generator-expression-rest-param.tree.json new file mode 100644 index 0000000..3be5d2a --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-expression-rest-param.tree.json @@ -0,0 +1,294 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 1, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [ + { + "range": [ + 11, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "RestElement", + "argument": { + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "Identifier", + "name": "x" + } + } + ], + "body": { + "range": [ + 17, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": true, + "expression": false + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } +} diff --git a/lib/test/esprima/ES6/generator/generator-expression-with-params.js b/lib/test/esprima/ES6/generator/generator-expression-with-params.js new file mode 100644 index 0000000..49568d6 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-expression-with-params.js @@ -0,0 +1 @@ +(function*(x, y, z) {}) diff --git a/lib/test/esprima/ES6/generator/generator-expression-with-params.tree.json b/lib/test/esprima/ES6/generator/generator-expression-with-params.tree.json new file mode 100644 index 0000000..fb8be88 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-expression-with-params.tree.json @@ -0,0 +1,367 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 1, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [ + { + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "Identifier", + "name": "x" + }, + { + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "Identifier", + "name": "y" + }, + { + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "Identifier", + "name": "z" + } + ], + "body": { + "range": [ + 20, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": true, + "expression": false + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } +} diff --git a/lib/test/esprima/ES6/generator/generator-expression-with-yield-delegate.js b/lib/test/esprima/ES6/generator/generator-expression-with-yield-delegate.js new file mode 100644 index 0000000..7d1d130 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-expression-with-yield-delegate.js @@ -0,0 +1 @@ +(function*(x, y, z) { yield* x; }) diff --git a/lib/test/esprima/ES6/generator/generator-expression-with-yield-delegate.tree.json b/lib/test/esprima/ES6/generator/generator-expression-with-yield-delegate.tree.json new file mode 100644 index 0000000..725210b --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-expression-with-yield-delegate.tree.json @@ -0,0 +1,493 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 1, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [ + { + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "Identifier", + "name": "x" + }, + { + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "Identifier", + "name": "y" + }, + { + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "Identifier", + "name": "z" + } + ], + "body": { + "range": [ + 20, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 22, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "type": "YieldExpression", + "argument": { + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "type": "Identifier", + "name": "x" + }, + "delegate": true + } + } + ] + }, + "generator": true, + "expression": false + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 22, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } +} diff --git a/lib/test/esprima/ES6/generator/generator-expression-with-yield.js b/lib/test/esprima/ES6/generator/generator-expression-with-yield.js new file mode 100644 index 0000000..9fcc58a --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-expression-with-yield.js @@ -0,0 +1 @@ +(function*() { yield 3; }) diff --git a/lib/test/esprima/ES6/generator/generator-expression-with-yield.tree.json b/lib/test/esprima/ES6/generator/generator-expression-with-yield.tree.json new file mode 100644 index 0000000..e5af77c --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-expression-with-yield.tree.json @@ -0,0 +1,331 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 1, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "range": [ + 13, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 15, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "YieldExpression", + "argument": { + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "Literal", + "value": 3, + "raw": "3" + }, + "delegate": false + } + } + ] + }, + "generator": true, + "expression": false + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Numeric", + "value": "3", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + } +} diff --git a/lib/test/esprima/ES6/generator/generator-expression.js b/lib/test/esprima/ES6/generator/generator-expression.js new file mode 100644 index 0000000..daa6bf5 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-expression.js @@ -0,0 +1 @@ +(function*() {}) diff --git a/lib/test/esprima/ES6/generator/generator-expression.tree.json b/lib/test/esprima/ES6/generator/generator-expression.tree.json new file mode 100644 index 0000000..2f578b5 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-expression.tree.json @@ -0,0 +1,222 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 1, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "range": [ + 13, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": true, + "expression": false + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } +} diff --git a/lib/test/esprima/ES6/generator/generator-method-with-computed-name.failure.json b/lib/test/esprima/ES6/generator/generator-method-with-computed-name.failure.json new file mode 100644 index 0000000..43d4c74 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-method-with-computed-name.failure.json @@ -0,0 +1 @@ +{"index":21,"lineNumber":2,"column":7,"message":"Error: Line 2: Unexpected token *","description":"Unexpected token *"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/generator/generator-method-with-computed-name.js b/lib/test/esprima/ES6/generator/generator-method-with-computed-name.js new file mode 100644 index 0000000..0739904 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-method-with-computed-name.js @@ -0,0 +1,3 @@ +(function*() { + { *[yield iter]() {} } +}) diff --git a/lib/test/esprima/ES6/generator/generator-method-with-invalid-computed-name.failure.json b/lib/test/esprima/ES6/generator/generator-method-with-invalid-computed-name.failure.json new file mode 100644 index 0000000..6391807 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-method-with-invalid-computed-name.failure.json @@ -0,0 +1 @@ +{"index":11,"lineNumber":1,"column":12,"message":"Error: Line 1: Unexpected identifier","description":"Unexpected identifier"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/generator/generator-method-with-invalid-computed-name.js b/lib/test/esprima/ES6/generator/generator-method-with-invalid-computed-name.js new file mode 100644 index 0000000..c55ce55 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-method-with-invalid-computed-name.js @@ -0,0 +1 @@ +({ *[yield iter]() {} }) diff --git a/lib/test/esprima/ES6/generator/generator-method-with-params.js b/lib/test/esprima/ES6/generator/generator-method-with-params.js new file mode 100644 index 0000000..5d0406e --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-method-with-params.js @@ -0,0 +1 @@ +({ *foo(x, y, z) {} }) diff --git a/lib/test/esprima/ES6/generator/generator-method-with-params.tree.json b/lib/test/esprima/ES6/generator/generator-method-with-params.tree.json new file mode 100644 index 0000000..017f241 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-method-with-params.tree.json @@ -0,0 +1,461 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 1, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "type": "ObjectExpression", + "properties": [ + { + "range": [ + 3, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "type": "Property", + "key": { + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Identifier", + "name": "foo" + }, + "computed": false, + "value": { + "range": [ + 7, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [ + { + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "Identifier", + "name": "x" + }, + { + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "Identifier", + "name": "y" + }, + { + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "Identifier", + "name": "z" + } + ], + "body": { + "range": [ + 17, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": true, + "expression": false + }, + "kind": "init", + "method": true, + "shorthand": false + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } +} diff --git a/lib/test/esprima/ES6/generator/generator-method-with-yield-delegate.js b/lib/test/esprima/ES6/generator/generator-method-with-yield-delegate.js new file mode 100644 index 0000000..84c3ef4 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-method-with-yield-delegate.js @@ -0,0 +1 @@ +({ *foo() { yield* 3; } }) diff --git a/lib/test/esprima/ES6/generator/generator-method-with-yield-delegate.tree.json b/lib/test/esprima/ES6/generator/generator-method-with-yield-delegate.tree.json new file mode 100644 index 0000000..7c1517d --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-method-with-yield-delegate.tree.json @@ -0,0 +1,443 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 1, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "ObjectExpression", + "properties": [ + { + "range": [ + 3, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "type": "Property", + "key": { + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Identifier", + "name": "foo" + }, + "computed": false, + "value": { + "range": [ + 7, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "range": [ + 10, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 12, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 12, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "YieldExpression", + "argument": { + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "Literal", + "value": 3, + "raw": "3" + }, + "delegate": true + } + } + ] + }, + "generator": true, + "expression": false + }, + "kind": "init", + "method": true, + "shorthand": false + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 12, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Numeric", + "value": "3", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + } +} diff --git a/lib/test/esprima/ES6/generator/generator-method-with-yield-expression.js b/lib/test/esprima/ES6/generator/generator-method-with-yield-expression.js new file mode 100644 index 0000000..e356cfa --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-method-with-yield-expression.js @@ -0,0 +1 @@ +({ *foo() { yield 3; } }) diff --git a/lib/test/esprima/ES6/generator/generator-method-with-yield-expression.tree.json b/lib/test/esprima/ES6/generator/generator-method-with-yield-expression.tree.json new file mode 100644 index 0000000..9fe3865 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-method-with-yield-expression.tree.json @@ -0,0 +1,425 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 1, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "type": "ObjectExpression", + "properties": [ + { + "range": [ + 3, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "Property", + "key": { + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Identifier", + "name": "foo" + }, + "computed": false, + "value": { + "range": [ + 7, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "range": [ + 10, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 12, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 12, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "type": "YieldExpression", + "argument": { + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "type": "Literal", + "value": 3, + "raw": "3" + }, + "delegate": false + } + } + ] + }, + "generator": true, + "expression": false + }, + "kind": "init", + "method": true, + "shorthand": false + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 12, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Numeric", + "value": "3", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } +} diff --git a/lib/test/esprima/ES6/generator/generator-method-with-yield-line-terminator.js b/lib/test/esprima/ES6/generator/generator-method-with-yield-line-terminator.js new file mode 100644 index 0000000..13ebbab --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-method-with-yield-line-terminator.js @@ -0,0 +1,4 @@ +({ *foo() { + yield + 3 +} }) diff --git a/lib/test/esprima/ES6/generator/generator-method-with-yield-line-terminator.tree.json b/lib/test/esprima/ES6/generator/generator-method-with-yield-line-terminator.tree.json new file mode 100644 index 0000000..aeb1ac2 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-method-with-yield-line-terminator.tree.json @@ -0,0 +1,425 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 4 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 1, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "type": "ObjectExpression", + "properties": [ + { + "range": [ + 3, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "type": "Property", + "key": { + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Identifier", + "name": "foo" + }, + "computed": false, + "value": { + "range": [ + 7, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "range": [ + 10, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "type": "YieldExpression", + "argument": null, + "delegate": false + } + }, + { + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + } + }, + "type": "Literal", + "value": 3, + "raw": "3" + } + } + ] + }, + "generator": true, + "expression": false + }, + "kind": "init", + "method": true, + "shorthand": false + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Numeric", + "value": "3", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 4, + "column": 3 + }, + "end": { + "line": 4, + "column": 4 + } + } + } + ], + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 4 + } + } +} diff --git a/lib/test/esprima/ES6/generator/generator-method-with-yield.js b/lib/test/esprima/ES6/generator/generator-method-with-yield.js new file mode 100644 index 0000000..8eea58f --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-method-with-yield.js @@ -0,0 +1 @@ +({ *foo() { yield; } }) diff --git a/lib/test/esprima/ES6/generator/generator-method-with-yield.tree.json b/lib/test/esprima/ES6/generator/generator-method-with-yield.tree.json new file mode 100644 index 0000000..a21c14e --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-method-with-yield.tree.json @@ -0,0 +1,389 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 1, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "ObjectExpression", + "properties": [ + { + "range": [ + 3, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "Property", + "key": { + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Identifier", + "name": "foo" + }, + "computed": false, + "value": { + "range": [ + 7, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "range": [ + 10, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 12, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 12, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "YieldExpression", + "argument": null, + "delegate": false + } + } + ] + }, + "generator": true, + "expression": false + }, + "kind": "init", + "method": true, + "shorthand": false + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 12, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } +} diff --git a/lib/test/esprima/ES6/generator/generator-method.js b/lib/test/esprima/ES6/generator/generator-method.js new file mode 100644 index 0000000..c6a22b0 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-method.js @@ -0,0 +1 @@ +({ *foo() {} }) diff --git a/lib/test/esprima/ES6/generator/generator-method.tree.json b/lib/test/esprima/ES6/generator/generator-method.tree.json new file mode 100644 index 0000000..c2e6ba2 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-method.tree.json @@ -0,0 +1,316 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 1, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "ObjectExpression", + "properties": [ + { + "range": [ + 3, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "Property", + "key": { + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Identifier", + "name": "foo" + }, + "computed": false, + "value": { + "range": [ + 7, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": true, + "expression": false + }, + "kind": "init", + "method": true, + "shorthand": false + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } +} diff --git a/lib/test/esprima/ES6/generator/generator-parameter-binding-element.failure.json b/lib/test/esprima/ES6/generator/generator-parameter-binding-element.failure.json new file mode 100644 index 0000000..9338ab4 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-parameter-binding-element.failure.json @@ -0,0 +1 @@ +{"index":27,"lineNumber":2,"column":13,"message":"Error: Line 2: Unexpected token (","description":"Unexpected token ("} \ No newline at end of file diff --git a/lib/test/esprima/ES6/generator/generator-parameter-binding-element.js b/lib/test/esprima/ES6/generator/generator-parameter-binding-element.js new file mode 100644 index 0000000..c8bbdf1 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-parameter-binding-element.js @@ -0,0 +1,3 @@ +(function*() { + function(x = yield 3) {} +}) diff --git a/lib/test/esprima/ES6/generator/generator-parameter-binding-property-reserved.failure.json b/lib/test/esprima/ES6/generator/generator-parameter-binding-property-reserved.failure.json new file mode 100644 index 0000000..5c985a4 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-parameter-binding-property-reserved.failure.json @@ -0,0 +1 @@ +{"index":17,"lineNumber":1,"column":18,"message":"Error: Line 1: Unexpected token }","description":"Unexpected token }"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/generator/generator-parameter-binding-property-reserved.js b/lib/test/esprima/ES6/generator/generator-parameter-binding-property-reserved.js new file mode 100644 index 0000000..d36f106 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-parameter-binding-property-reserved.js @@ -0,0 +1 @@ +(function*({yield}) {}) diff --git a/lib/test/esprima/ES6/generator/generator-parameter-binding-property.failure.json b/lib/test/esprima/ES6/generator/generator-parameter-binding-property.failure.json new file mode 100644 index 0000000..9338ab4 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-parameter-binding-property.failure.json @@ -0,0 +1 @@ +{"index":27,"lineNumber":2,"column":13,"message":"Error: Line 2: Unexpected token (","description":"Unexpected token ("} \ No newline at end of file diff --git a/lib/test/esprima/ES6/generator/generator-parameter-binding-property.js b/lib/test/esprima/ES6/generator/generator-parameter-binding-property.js new file mode 100644 index 0000000..3de539a --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-parameter-binding-property.js @@ -0,0 +1,3 @@ +(function*() { + function({x: y = yield 3}) {} +}) diff --git a/lib/test/esprima/ES6/generator/generator-parameter-computed-property-name.failure.json b/lib/test/esprima/ES6/generator/generator-parameter-computed-property-name.failure.json new file mode 100644 index 0000000..9338ab4 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-parameter-computed-property-name.failure.json @@ -0,0 +1 @@ +{"index":27,"lineNumber":2,"column":13,"message":"Error: Line 2: Unexpected token (","description":"Unexpected token ("} \ No newline at end of file diff --git a/lib/test/esprima/ES6/generator/generator-parameter-computed-property-name.js b/lib/test/esprima/ES6/generator/generator-parameter-computed-property-name.js new file mode 100644 index 0000000..7bc0064 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-parameter-computed-property-name.js @@ -0,0 +1,3 @@ +(function*() { + function({[yield 3]: y}) {} +}) diff --git a/lib/test/esprima/ES6/generator/generator-parameter-invalid-binding-element.failure.json b/lib/test/esprima/ES6/generator/generator-parameter-invalid-binding-element.failure.json new file mode 100644 index 0000000..35319c3 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-parameter-invalid-binding-element.failure.json @@ -0,0 +1 @@ +{"index":28,"lineNumber":2,"column":14,"message":"Error: Line 2: Unexpected token (","description":"Unexpected token ("} \ No newline at end of file diff --git a/lib/test/esprima/ES6/generator/generator-parameter-invalid-binding-element.js b/lib/test/esprima/ES6/generator/generator-parameter-invalid-binding-element.js new file mode 100644 index 0000000..bc7938c --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-parameter-invalid-binding-element.js @@ -0,0 +1,3 @@ +(function*() { + function*(x = yield 3) {} +}) diff --git a/lib/test/esprima/ES6/generator/generator-parameter-invalid-binding-property.failure.json b/lib/test/esprima/ES6/generator/generator-parameter-invalid-binding-property.failure.json new file mode 100644 index 0000000..35319c3 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-parameter-invalid-binding-property.failure.json @@ -0,0 +1 @@ +{"index":28,"lineNumber":2,"column":14,"message":"Error: Line 2: Unexpected token (","description":"Unexpected token ("} \ No newline at end of file diff --git a/lib/test/esprima/ES6/generator/generator-parameter-invalid-binding-property.js b/lib/test/esprima/ES6/generator/generator-parameter-invalid-binding-property.js new file mode 100644 index 0000000..c219639 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-parameter-invalid-binding-property.js @@ -0,0 +1,3 @@ +(function*() { + function*({x: y = yield 3}) {} +}) diff --git a/lib/test/esprima/ES6/generator/generator-parameter-invalid-computed-property-name.failure.json b/lib/test/esprima/ES6/generator/generator-parameter-invalid-computed-property-name.failure.json new file mode 100644 index 0000000..35319c3 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-parameter-invalid-computed-property-name.failure.json @@ -0,0 +1 @@ +{"index":28,"lineNumber":2,"column":14,"message":"Error: Line 2: Unexpected token (","description":"Unexpected token ("} \ No newline at end of file diff --git a/lib/test/esprima/ES6/generator/generator-parameter-invalid-computed-property-name.js b/lib/test/esprima/ES6/generator/generator-parameter-invalid-computed-property-name.js new file mode 100644 index 0000000..1ca2028 --- /dev/null +++ b/lib/test/esprima/ES6/generator/generator-parameter-invalid-computed-property-name.js @@ -0,0 +1,3 @@ +(function*() { + function*({[yield 3]: y}) {} +}) diff --git a/lib/test/esprima/ES6/generator/incomplete-yield-delegate.failure.json b/lib/test/esprima/ES6/generator/incomplete-yield-delegate.failure.json new file mode 100644 index 0000000..7a48b04 --- /dev/null +++ b/lib/test/esprima/ES6/generator/incomplete-yield-delegate.failure.json @@ -0,0 +1 @@ +{"index":22,"lineNumber":1,"column":23,"message":"Error: Line 1: Unexpected token }","description":"Unexpected token }"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/generator/incomplete-yield-delegate.js b/lib/test/esprima/ES6/generator/incomplete-yield-delegate.js new file mode 100644 index 0000000..f0d07c0 --- /dev/null +++ b/lib/test/esprima/ES6/generator/incomplete-yield-delegate.js @@ -0,0 +1 @@ +(function*() { yield* }) diff --git a/lib/test/esprima/ES6/generator/malformed-generator-method-2.failure.json b/lib/test/esprima/ES6/generator/malformed-generator-method-2.failure.json new file mode 100644 index 0000000..11972c3 --- /dev/null +++ b/lib/test/esprima/ES6/generator/malformed-generator-method-2.failure.json @@ -0,0 +1 @@ +{"index":14,"lineNumber":1,"column":15,"message":"Error: Line 1: Unexpected token }","description":"Unexpected token }"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/generator/malformed-generator-method-2.js b/lib/test/esprima/ES6/generator/malformed-generator-method-2.js new file mode 100644 index 0000000..0273d50 --- /dev/null +++ b/lib/test/esprima/ES6/generator/malformed-generator-method-2.js @@ -0,0 +1 @@ +class Foo { * } diff --git a/lib/test/esprima/ES6/generator/malformed-generator-method.failure.json b/lib/test/esprima/ES6/generator/malformed-generator-method.failure.json new file mode 100644 index 0000000..d10acb0 --- /dev/null +++ b/lib/test/esprima/ES6/generator/malformed-generator-method.failure.json @@ -0,0 +1 @@ +{"index":5,"lineNumber":1,"column":6,"message":"Error: Line 1: Unexpected token }","description":"Unexpected token }"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/generator/malformed-generator-method.js b/lib/test/esprima/ES6/generator/malformed-generator-method.js new file mode 100644 index 0000000..f34ab0f --- /dev/null +++ b/lib/test/esprima/ES6/generator/malformed-generator-method.js @@ -0,0 +1 @@ +({ * }) diff --git a/lib/test/esprima/ES6/generator/static-generator-method-with-computed-name.js b/lib/test/esprima/ES6/generator/static-generator-method-with-computed-name.js new file mode 100644 index 0000000..5252f9a --- /dev/null +++ b/lib/test/esprima/ES6/generator/static-generator-method-with-computed-name.js @@ -0,0 +1 @@ +class Foo { static *[foo]() {} } diff --git a/lib/test/esprima/ES6/generator/static-generator-method-with-computed-name.tree.json b/lib/test/esprima/ES6/generator/static-generator-method-with-computed-name.tree.json new file mode 100644 index 0000000..5e84d5b --- /dev/null +++ b/lib/test/esprima/ES6/generator/static-generator-method-with-computed-name.tree.json @@ -0,0 +1,388 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "type": "ClassDeclaration", + "id": { + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "Identifier", + "name": "Foo" + }, + "superClass": null, + "body": { + "range": [ + 10, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "type": "ClassBody", + "body": [ + { + "range": [ + 12, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "type": "MethodDefinition", + "key": { + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "type": "Identifier", + "name": "foo" + }, + "computed": true, + "value": { + "range": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "range": [ + 28, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": true, + "expression": false + }, + "kind": "method", + "static": true + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Keyword", + "value": "static", + "range": [ + 12, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ], + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + } +} diff --git a/lib/test/esprima/ES6/generator/static-generator-method.js b/lib/test/esprima/ES6/generator/static-generator-method.js new file mode 100644 index 0000000..6644eb1 --- /dev/null +++ b/lib/test/esprima/ES6/generator/static-generator-method.js @@ -0,0 +1 @@ +class Foo { static *foo() {} } diff --git a/lib/test/esprima/ES6/generator/static-generator-method.tree.json b/lib/test/esprima/ES6/generator/static-generator-method.tree.json new file mode 100644 index 0000000..cb5e1b0 --- /dev/null +++ b/lib/test/esprima/ES6/generator/static-generator-method.tree.json @@ -0,0 +1,352 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "type": "ClassDeclaration", + "id": { + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "Identifier", + "name": "Foo" + }, + "superClass": null, + "body": { + "range": [ + 10, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "type": "ClassBody", + "body": [ + { + "range": [ + 12, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "type": "MethodDefinition", + "key": { + "range": [ + 20, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "type": "Identifier", + "name": "foo" + }, + "computed": false, + "value": { + "range": [ + 23, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "range": [ + 26, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": true, + "expression": false + }, + "kind": "method", + "static": true + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Keyword", + "value": "static", + "range": [ + 12, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 20, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + } + ], + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + } +} diff --git a/lib/test/esprima/ES6/identifier/dakuten_handakuten.js b/lib/test/esprima/ES6/identifier/dakuten_handakuten.js new file mode 100644 index 0000000..38d91a5 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/dakuten_handakuten.js @@ -0,0 +1 @@ +゛+ ゜ diff --git a/lib/test/esprima/ES6/identifier/dakuten_handakuten.tree.json b/lib/test/esprima/ES6/identifier/dakuten_handakuten.tree.json new file mode 100644 index 0000000..87b7b7b --- /dev/null +++ b/lib/test/esprima/ES6/identifier/dakuten_handakuten.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "type": "BinaryExpression", + "operator": "+", + "left": { + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "type": "Identifier", + "name": "゛" + }, + "right": { + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "type": "Identifier", + "name": "゜" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "゛", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "゜", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } +} diff --git a/lib/test/esprima/ES6/identifier/escaped_all.js b/lib/test/esprima/ES6/identifier/escaped_all.js new file mode 100644 index 0000000..9185817 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/escaped_all.js @@ -0,0 +1 @@ +var \u{41}\u{42}\u{43}; diff --git a/lib/test/esprima/ES6/identifier/escaped_all.tree.json b/lib/test/esprima/ES6/identifier/escaped_all.tree.json new file mode 100644 index 0000000..cc01d31 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/escaped_all.tree.json @@ -0,0 +1,132 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "Identifier", + "name": "ABC" + }, + "init": null + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "\\u{41}\\u{42}\\u{43}", + "range": [ + 4, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } +} diff --git a/lib/test/esprima/ES6/identifier/escaped_math_alef.js b/lib/test/esprima/ES6/identifier/escaped_math_alef.js new file mode 100644 index 0000000..cfba1a9 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/escaped_math_alef.js @@ -0,0 +1,2 @@ +var \u{1EE00} + diff --git a/lib/test/esprima/ES6/identifier/escaped_math_alef.tree.json b/lib/test/esprima/ES6/identifier/escaped_math_alef.tree.json new file mode 100644 index 0000000..8875ec4 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/escaped_math_alef.tree.json @@ -0,0 +1,114 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "Identifier", + "name": "𞸀" + }, + "init": null + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "\\u{1EE00}", + "range": [ + 4, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } +} diff --git a/lib/test/esprima/ES6/identifier/escaped_math_dal_part.js b/lib/test/esprima/ES6/identifier/escaped_math_dal_part.js new file mode 100644 index 0000000..dfeaf35 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/escaped_math_dal_part.js @@ -0,0 +1 @@ +var _\u{1EE03} diff --git a/lib/test/esprima/ES6/identifier/escaped_math_dal_part.tree.json b/lib/test/esprima/ES6/identifier/escaped_math_dal_part.tree.json new file mode 100644 index 0000000..e3b671f --- /dev/null +++ b/lib/test/esprima/ES6/identifier/escaped_math_dal_part.tree.json @@ -0,0 +1,114 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Identifier", + "name": "_𞸃" + }, + "init": null + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "_\\u{1EE03}", + "range": [ + 4, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } +} diff --git a/lib/test/esprima/ES6/identifier/escaped_math_kaf_lam.js b/lib/test/esprima/ES6/identifier/escaped_math_kaf_lam.js new file mode 100644 index 0000000..84eba34 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/escaped_math_kaf_lam.js @@ -0,0 +1 @@ +var \u{1EE0A}\u{1EE0B} diff --git a/lib/test/esprima/ES6/identifier/escaped_math_kaf_lam.tree.json b/lib/test/esprima/ES6/identifier/escaped_math_kaf_lam.tree.json new file mode 100644 index 0000000..cfad719 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/escaped_math_kaf_lam.tree.json @@ -0,0 +1,114 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "Identifier", + "name": "𞸊𞸋" + }, + "init": null + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "\\u{1EE0A}\\u{1EE0B}", + "range": [ + 4, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } +} diff --git a/lib/test/esprima/ES6/identifier/escaped_math_zain_start.js b/lib/test/esprima/ES6/identifier/escaped_math_zain_start.js new file mode 100644 index 0000000..7b9341c --- /dev/null +++ b/lib/test/esprima/ES6/identifier/escaped_math_zain_start.js @@ -0,0 +1 @@ +var \u{1EE06}_$ diff --git a/lib/test/esprima/ES6/identifier/escaped_math_zain_start.tree.json b/lib/test/esprima/ES6/identifier/escaped_math_zain_start.tree.json new file mode 100644 index 0000000..0147d88 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/escaped_math_zain_start.tree.json @@ -0,0 +1,114 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "Identifier", + "name": "𞸆_$" + }, + "init": null + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "\\u{1EE06}_$", + "range": [ + 4, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } +} diff --git a/lib/test/esprima/ES6/identifier/escaped_part.js b/lib/test/esprima/ES6/identifier/escaped_part.js new file mode 100644 index 0000000..6f2d330 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/escaped_part.js @@ -0,0 +1 @@ +var A\u{42}C; diff --git a/lib/test/esprima/ES6/identifier/escaped_part.tree.json b/lib/test/esprima/ES6/identifier/escaped_part.tree.json new file mode 100644 index 0000000..0a24656 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/escaped_part.tree.json @@ -0,0 +1,132 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "Identifier", + "name": "ABC" + }, + "init": null + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "A\\u{42}C", + "range": [ + 4, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } +} diff --git a/lib/test/esprima/ES6/identifier/escaped_start.js b/lib/test/esprima/ES6/identifier/escaped_start.js new file mode 100644 index 0000000..a5bd705 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/escaped_start.js @@ -0,0 +1 @@ +var \u{41}BC; diff --git a/lib/test/esprima/ES6/identifier/escaped_start.tree.json b/lib/test/esprima/ES6/identifier/escaped_start.tree.json new file mode 100644 index 0000000..87ed2f0 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/escaped_start.tree.json @@ -0,0 +1,132 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "Identifier", + "name": "ABC" + }, + "init": null + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "\\u{41}BC", + "range": [ + 4, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } +} diff --git a/lib/test/esprima/ES6/identifier/estimated.js b/lib/test/esprima/ES6/identifier/estimated.js new file mode 100644 index 0000000..5349d5b --- /dev/null +++ b/lib/test/esprima/ES6/identifier/estimated.js @@ -0,0 +1 @@ +let ℮ diff --git a/lib/test/esprima/ES6/identifier/estimated.tree.json b/lib/test/esprima/ES6/identifier/estimated.tree.json new file mode 100644 index 0000000..fe9f542 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/estimated.tree.json @@ -0,0 +1,114 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "type": "Identifier", + "name": "℮" + }, + "init": null + } + ], + "kind": "let" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "let", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "℮", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } +} diff --git a/lib/test/esprima/ES6/identifier/ethiopic_digits.js b/lib/test/esprima/ES6/identifier/ethiopic_digits.js new file mode 100644 index 0000000..43a8b95 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/ethiopic_digits.js @@ -0,0 +1 @@ +var _፩፪፫፬፭፮፯፰፱ diff --git a/lib/test/esprima/ES6/identifier/ethiopic_digits.tree.json b/lib/test/esprima/ES6/identifier/ethiopic_digits.tree.json new file mode 100644 index 0000000..7a2dcd4 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/ethiopic_digits.tree.json @@ -0,0 +1,114 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Identifier", + "name": "_፩፪፫፬፭፮፯፰፱" + }, + "init": null + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "_፩፪፫፬፭፮፯፰፱", + "range": [ + 4, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } +} diff --git a/lib/test/esprima/ES6/identifier/invalid_escaped_surrogate_pairs.failure.json b/lib/test/esprima/ES6/identifier/invalid_escaped_surrogate_pairs.failure.json new file mode 100644 index 0000000..37a0b76 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/invalid_escaped_surrogate_pairs.failure.json @@ -0,0 +1 @@ +{"index":10,"lineNumber":1,"column":11,"message":"Error: Line 1: Unexpected token ILLEGAL","description":"Unexpected token ILLEGAL"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/identifier/invalid_escaped_surrogate_pairs.js b/lib/test/esprima/ES6/identifier/invalid_escaped_surrogate_pairs.js new file mode 100644 index 0000000..bf6b772 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/invalid_escaped_surrogate_pairs.js @@ -0,0 +1 @@ +var \uD83B\uDE00 diff --git a/lib/test/esprima/ES6/identifier/invalid_expression_await.js b/lib/test/esprima/ES6/identifier/invalid_expression_await.js new file mode 100644 index 0000000..8d5a78d --- /dev/null +++ b/lib/test/esprima/ES6/identifier/invalid_expression_await.js @@ -0,0 +1 @@ +export var answer = await + 1; diff --git a/lib/test/esprima/ES6/identifier/invalid_expression_await.module.json b/lib/test/esprima/ES6/identifier/invalid_expression_await.module.json new file mode 100644 index 0000000..a9dd4bf --- /dev/null +++ b/lib/test/esprima/ES6/identifier/invalid_expression_await.module.json @@ -0,0 +1 @@ +{"index":20,"lineNumber":1,"column":21,"message":"Error: Line 1: Unexpected identifier","description":"Unexpected identifier"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/identifier/invalid_function_wait.js b/lib/test/esprima/ES6/identifier/invalid_function_wait.js new file mode 100644 index 0000000..2526e7e --- /dev/null +++ b/lib/test/esprima/ES6/identifier/invalid_function_wait.js @@ -0,0 +1 @@ +function await() {} diff --git a/lib/test/esprima/ES6/identifier/invalid_function_wait.module.json b/lib/test/esprima/ES6/identifier/invalid_function_wait.module.json new file mode 100644 index 0000000..d656521 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/invalid_function_wait.module.json @@ -0,0 +1 @@ +{"index":9,"lineNumber":1,"column":10,"message":"Error: Line 1: Unexpected identifier","description":"Unexpected identifier"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/identifier/invalid_id_smp.failure.json b/lib/test/esprima/ES6/identifier/invalid_id_smp.failure.json new file mode 100644 index 0000000..49ab9a0 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/invalid_id_smp.failure.json @@ -0,0 +1 @@ +{"index":4,"lineNumber":1,"column":5,"message":"Error: Line 1: Unexpected token ILLEGAL","description":"Unexpected token ILLEGAL"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/identifier/invalid_id_smp.js b/lib/test/esprima/ES6/identifier/invalid_id_smp.js new file mode 100644 index 0000000..9e1a5ea --- /dev/null +++ b/lib/test/esprima/ES6/identifier/invalid_id_smp.js @@ -0,0 +1 @@ +var 🀒 diff --git a/lib/test/esprima/ES6/identifier/invalid_lone_surrogate.failure.json b/lib/test/esprima/ES6/identifier/invalid_lone_surrogate.failure.json new file mode 100644 index 0000000..cca85d0 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/invalid_lone_surrogate.failure.json @@ -0,0 +1 @@ +{"index":0,"lineNumber":1,"column":1,"message":"Error: Line 1: Unexpected token ILLEGAL","description":"Unexpected token ILLEGAL"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/identifier/invalid_lone_surrogate.source.js b/lib/test/esprima/ES6/identifier/invalid_lone_surrogate.source.js new file mode 100644 index 0000000..e66fe19 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/invalid_lone_surrogate.source.js @@ -0,0 +1 @@ +var source = '\uD800!'; diff --git a/lib/test/esprima/ES6/identifier/invalid_var_await.js b/lib/test/esprima/ES6/identifier/invalid_var_await.js new file mode 100644 index 0000000..91cd4f3 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/invalid_var_await.js @@ -0,0 +1 @@ +export var await; diff --git a/lib/test/esprima/ES6/identifier/invalid_var_await.module.json b/lib/test/esprima/ES6/identifier/invalid_var_await.module.json new file mode 100644 index 0000000..6391807 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/invalid_var_await.module.json @@ -0,0 +1 @@ +{"index":11,"lineNumber":1,"column":12,"message":"Error: Line 1: Unexpected identifier","description":"Unexpected identifier"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/identifier/math_alef.js b/lib/test/esprima/ES6/identifier/math_alef.js new file mode 100644 index 0000000..965aec3 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/math_alef.js @@ -0,0 +1 @@ +var 𞸀 diff --git a/lib/test/esprima/ES6/identifier/math_alef.skip b/lib/test/esprima/ES6/identifier/math_alef.skip new file mode 100644 index 0000000..ed7bd50 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/math_alef.skip @@ -0,0 +1 @@ +TODO: parse errors diff --git a/lib/test/esprima/ES6/identifier/math_alef.tree.json b/lib/test/esprima/ES6/identifier/math_alef.tree.json new file mode 100644 index 0000000..1982020 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/math_alef.tree.json @@ -0,0 +1,114 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "Identifier", + "name": "𞸀" + }, + "init": null + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "𞸀", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } +} diff --git a/lib/test/esprima/ES6/identifier/math_dal_part.js b/lib/test/esprima/ES6/identifier/math_dal_part.js new file mode 100644 index 0000000..2291df9 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/math_dal_part.js @@ -0,0 +1 @@ +var _𞸃 diff --git a/lib/test/esprima/ES6/identifier/math_dal_part.skip b/lib/test/esprima/ES6/identifier/math_dal_part.skip new file mode 100644 index 0000000..ed7bd50 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/math_dal_part.skip @@ -0,0 +1 @@ +TODO: parse errors diff --git a/lib/test/esprima/ES6/identifier/math_dal_part.tree.json b/lib/test/esprima/ES6/identifier/math_dal_part.tree.json new file mode 100644 index 0000000..32acebe --- /dev/null +++ b/lib/test/esprima/ES6/identifier/math_dal_part.tree.json @@ -0,0 +1,114 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Identifier", + "name": "_𞸃" + }, + "init": null + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "_𞸃", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } +} diff --git a/lib/test/esprima/ES6/identifier/math_kaf_lam.js b/lib/test/esprima/ES6/identifier/math_kaf_lam.js new file mode 100644 index 0000000..e1ad50f --- /dev/null +++ b/lib/test/esprima/ES6/identifier/math_kaf_lam.js @@ -0,0 +1 @@ +var 𞸊𞸋 diff --git a/lib/test/esprima/ES6/identifier/math_kaf_lam.skip b/lib/test/esprima/ES6/identifier/math_kaf_lam.skip new file mode 100644 index 0000000..ed7bd50 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/math_kaf_lam.skip @@ -0,0 +1 @@ +TODO: parse errors diff --git a/lib/test/esprima/ES6/identifier/math_kaf_lam.tree.json b/lib/test/esprima/ES6/identifier/math_kaf_lam.tree.json new file mode 100644 index 0000000..8470a89 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/math_kaf_lam.tree.json @@ -0,0 +1,114 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "Identifier", + "name": "𞸊𞸋" + }, + "init": null + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "𞸊𞸋", + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } +} diff --git a/lib/test/esprima/ES6/identifier/math_zain_start.js b/lib/test/esprima/ES6/identifier/math_zain_start.js new file mode 100644 index 0000000..98c10c1 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/math_zain_start.js @@ -0,0 +1 @@ +var 𞸆_$ diff --git a/lib/test/esprima/ES6/identifier/math_zain_start.skip b/lib/test/esprima/ES6/identifier/math_zain_start.skip new file mode 100644 index 0000000..ed7bd50 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/math_zain_start.skip @@ -0,0 +1 @@ +TODO: parse errors diff --git a/lib/test/esprima/ES6/identifier/math_zain_start.tree.json b/lib/test/esprima/ES6/identifier/math_zain_start.tree.json new file mode 100644 index 0000000..daff5c4 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/math_zain_start.tree.json @@ -0,0 +1,114 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "Identifier", + "name": "𞸆_$" + }, + "init": null + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "𞸆_$", + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } +} diff --git a/lib/test/esprima/ES6/identifier/module_await.js b/lib/test/esprima/ES6/identifier/module_await.js new file mode 100644 index 0000000..aabfa0d --- /dev/null +++ b/lib/test/esprima/ES6/identifier/module_await.js @@ -0,0 +1 @@ +await = 0; diff --git a/lib/test/esprima/ES6/identifier/module_await.skip b/lib/test/esprima/ES6/identifier/module_await.skip new file mode 100644 index 0000000..ed7bd50 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/module_await.skip @@ -0,0 +1 @@ +TODO: parse errors diff --git a/lib/test/esprima/ES6/identifier/module_await.tree.json b/lib/test/esprima/ES6/identifier/module_await.tree.json new file mode 100644 index 0000000..758c242 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/module_await.tree.json @@ -0,0 +1,174 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "AssignmentExpression", + "operator": "=", + "left": { + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "type": "Identifier", + "name": "await" + }, + "right": { + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Identifier", + "value": "await", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + { + "index": 0, + "lineNumber": 1, + "column": 1, + "message": "Error: Line 1: Unexpected identifier" + } + ] +} diff --git a/lib/test/esprima/ES6/identifier/valid_await.js b/lib/test/esprima/ES6/identifier/valid_await.js new file mode 100644 index 0000000..4b130dd --- /dev/null +++ b/lib/test/esprima/ES6/identifier/valid_await.js @@ -0,0 +1 @@ +var await; (await); diff --git a/lib/test/esprima/ES6/identifier/valid_await.tree.json b/lib/test/esprima/ES6/identifier/valid_await.tree.json new file mode 100644 index 0000000..821f030 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/valid_await.tree.json @@ -0,0 +1,239 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "Identifier", + "name": "await" + }, + "init": null + } + ], + "kind": "var" + }, + { + "range": [ + 11, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 12, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "Identifier", + "name": "await" + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "await", + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "await", + "range": [ + 12, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } +} diff --git a/lib/test/esprima/ES6/identifier/weierstrass.js b/lib/test/esprima/ES6/identifier/weierstrass.js new file mode 100644 index 0000000..23b440e --- /dev/null +++ b/lib/test/esprima/ES6/identifier/weierstrass.js @@ -0,0 +1 @@ +var ℘; diff --git a/lib/test/esprima/ES6/identifier/weierstrass.tree.json b/lib/test/esprima/ES6/identifier/weierstrass.tree.json new file mode 100644 index 0000000..b0f2a86 --- /dev/null +++ b/lib/test/esprima/ES6/identifier/weierstrass.tree.json @@ -0,0 +1,132 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "type": "Identifier", + "name": "℘" + }, + "init": null + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "℘", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } +} diff --git a/lib/test/esprima/ES6/identifier/weierstrass_weierstrass.js b/lib/test/esprima/ES6/identifier/weierstrass_weierstrass.js new file mode 100644 index 0000000..3fc1e2a --- /dev/null +++ b/lib/test/esprima/ES6/identifier/weierstrass_weierstrass.js @@ -0,0 +1 @@ +var ℘\u2118 diff --git a/lib/test/esprima/ES6/identifier/weierstrass_weierstrass.tree.json b/lib/test/esprima/ES6/identifier/weierstrass_weierstrass.tree.json new file mode 100644 index 0000000..32944ac --- /dev/null +++ b/lib/test/esprima/ES6/identifier/weierstrass_weierstrass.tree.json @@ -0,0 +1,114 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Identifier", + "name": "℘℘" + }, + "init": null + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "℘\\u2118", + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } +} diff --git a/lib/test/esprima/ES6/import-declaration/import-default-and-named-specifiers.js b/lib/test/esprima/ES6/import-declaration/import-default-and-named-specifiers.js new file mode 100644 index 0000000..e544977 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/import-default-and-named-specifiers.js @@ -0,0 +1 @@ +import foo, {bar} from "foo"; diff --git a/lib/test/esprima/ES6/import-declaration/import-default-and-named-specifiers.tree.json b/lib/test/esprima/ES6/import-declaration/import-default-and-named-specifiers.tree.json new file mode 100644 index 0000000..076494e --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/import-default-and-named-specifiers.tree.json @@ -0,0 +1,310 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "type": "ImportDeclaration", + "specifiers": [ + { + "range": [ + 7, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "ImportDefaultSpecifier", + "local": { + "range": [ + 7, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Identifier", + "name": "foo" + } + }, + { + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "ImportSpecifier", + "local": { + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "Identifier", + "name": "bar" + }, + "imported": { + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "Identifier", + "name": "bar" + } + } + ], + "source": { + "range": [ + 23, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "type": "Literal", + "value": "foo", + "raw": "\"foo\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "import", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 7, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "String", + "value": "\"foo\"", + "range": [ + 23, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } +} diff --git a/lib/test/esprima/ES6/import-declaration/import-default-and-namespace-specifiers.js b/lib/test/esprima/ES6/import-declaration/import-default-and-namespace-specifiers.js new file mode 100644 index 0000000..084fa0c --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/import-default-and-namespace-specifiers.js @@ -0,0 +1 @@ +import foo, * as bar from "foo"; diff --git a/lib/test/esprima/ES6/import-declaration/import-default-and-namespace-specifiers.tree.json b/lib/test/esprima/ES6/import-declaration/import-default-and-namespace-specifiers.tree.json new file mode 100644 index 0000000..8170d65 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/import-default-and-namespace-specifiers.tree.json @@ -0,0 +1,292 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "type": "ImportDeclaration", + "specifiers": [ + { + "range": [ + 7, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "ImportDefaultSpecifier", + "local": { + "range": [ + 7, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Identifier", + "name": "foo" + } + }, + { + "range": [ + 12, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "ImportNamespaceSpecifier", + "local": { + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "Identifier", + "name": "bar" + } + } + ], + "source": { + "range": [ + 26, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "type": "Literal", + "value": "foo", + "raw": "\"foo\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "import", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 7, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "as", + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 21, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "String", + "value": "\"foo\"", + "range": [ + 26, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ], + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + } +} diff --git a/lib/test/esprima/ES6/import-declaration/import-default-as.js b/lib/test/esprima/ES6/import-declaration/import-default-as.js new file mode 100644 index 0000000..96c936d --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/import-default-as.js @@ -0,0 +1 @@ +import {default as foo} from "foo"; diff --git a/lib/test/esprima/ES6/import-declaration/import-default-as.tree.json b/lib/test/esprima/ES6/import-declaration/import-default-as.tree.json new file mode 100644 index 0000000..c54ffa9 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/import-default-as.tree.json @@ -0,0 +1,275 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "type": "ImportDeclaration", + "specifiers": [ + { + "range": [ + 8, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "ImportSpecifier", + "local": { + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "Identifier", + "name": "foo" + }, + "imported": { + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "Identifier", + "name": "default" + } + } + ], + "source": { + "range": [ + 29, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "type": "Literal", + "value": "foo", + "raw": "\"foo\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "import", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "default", + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "as", + "range": [ + 16, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 24, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "String", + "value": "\"foo\"", + "range": [ + 29, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + } +} diff --git a/lib/test/esprima/ES6/import-declaration/import-default.js b/lib/test/esprima/ES6/import-declaration/import-default.js new file mode 100644 index 0000000..8d14200 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/import-default.js @@ -0,0 +1 @@ +import foo from "foo"; diff --git a/lib/test/esprima/ES6/import-declaration/import-default.tree.json b/lib/test/esprima/ES6/import-declaration/import-default.tree.json new file mode 100644 index 0000000..8dfdf86 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/import-default.tree.json @@ -0,0 +1,185 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "ImportDeclaration", + "specifiers": [ + { + "range": [ + 7, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "ImportDefaultSpecifier", + "local": { + "range": [ + 7, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Identifier", + "name": "foo" + } + } + ], + "source": { + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "type": "Literal", + "value": "foo", + "raw": "\"foo\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "import", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 7, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 11, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "String", + "value": "\"foo\"", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } +} diff --git a/lib/test/esprima/ES6/import-declaration/import-jquery.js b/lib/test/esprima/ES6/import-declaration/import-jquery.js new file mode 100644 index 0000000..ea74241 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/import-jquery.js @@ -0,0 +1 @@ +import $ from "jquery" diff --git a/lib/test/esprima/ES6/import-declaration/import-jquery.tree.json b/lib/test/esprima/ES6/import-declaration/import-jquery.tree.json new file mode 100644 index 0000000..7721021 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/import-jquery.tree.json @@ -0,0 +1,167 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "ImportDeclaration", + "specifiers": [ + { + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "ImportDefaultSpecifier", + "local": { + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "Identifier", + "name": "$" + } + } + ], + "source": { + "range": [ + 14, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "Literal", + "value": "jquery", + "raw": "\"jquery\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "import", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "$", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "String", + "value": "\"jquery\"", + "range": [ + 14, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } +} diff --git a/lib/test/esprima/ES6/import-declaration/import-module.js b/lib/test/esprima/ES6/import-declaration/import-module.js new file mode 100644 index 0000000..c074830 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/import-module.js @@ -0,0 +1 @@ +import "foo"; diff --git a/lib/test/esprima/ES6/import-declaration/import-module.tree.json b/lib/test/esprima/ES6/import-declaration/import-module.tree.json new file mode 100644 index 0000000..4281492 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/import-module.tree.json @@ -0,0 +1,113 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "ImportDeclaration", + "specifiers": [], + "source": { + "range": [ + 7, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "Literal", + "value": "foo", + "raw": "\"foo\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "import", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "String", + "value": "\"foo\"", + "range": [ + 7, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } +} diff --git a/lib/test/esprima/ES6/import-declaration/import-named-as-specifier.js b/lib/test/esprima/ES6/import-declaration/import-named-as-specifier.js new file mode 100644 index 0000000..769f3b3 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/import-named-as-specifier.js @@ -0,0 +1 @@ +import {bar as baz} from "foo"; diff --git a/lib/test/esprima/ES6/import-declaration/import-named-as-specifier.tree.json b/lib/test/esprima/ES6/import-declaration/import-named-as-specifier.tree.json new file mode 100644 index 0000000..9b32611 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/import-named-as-specifier.tree.json @@ -0,0 +1,275 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "type": "ImportDeclaration", + "specifiers": [ + { + "range": [ + 8, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "ImportSpecifier", + "local": { + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "Identifier", + "name": "baz" + }, + "imported": { + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Identifier", + "name": "bar" + } + } + ], + "source": { + "range": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "type": "Literal", + "value": "foo", + "raw": "\"foo\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "import", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "as", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "baz", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 20, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "String", + "value": "\"foo\"", + "range": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } +} diff --git a/lib/test/esprima/ES6/import-declaration/import-named-as-specifiers.js b/lib/test/esprima/ES6/import-declaration/import-named-as-specifiers.js new file mode 100644 index 0000000..5198ead --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/import-named-as-specifiers.js @@ -0,0 +1 @@ +import {bar as baz, xyz} from "foo"; diff --git a/lib/test/esprima/ES6/import-declaration/import-named-as-specifiers.tree.json b/lib/test/esprima/ES6/import-declaration/import-named-as-specifiers.tree.json new file mode 100644 index 0000000..3ee9289 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/import-named-as-specifiers.tree.json @@ -0,0 +1,364 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "type": "ImportDeclaration", + "specifiers": [ + { + "range": [ + 8, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "ImportSpecifier", + "local": { + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "Identifier", + "name": "baz" + }, + "imported": { + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Identifier", + "name": "bar" + } + }, + { + "range": [ + 20, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "type": "ImportSpecifier", + "local": { + "range": [ + 20, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "type": "Identifier", + "name": "xyz" + }, + "imported": { + "range": [ + 20, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "type": "Identifier", + "name": "xyz" + } + } + ], + "source": { + "range": [ + 30, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "type": "Literal", + "value": "foo", + "raw": "\"foo\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "import", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "as", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "baz", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "xyz", + "range": [ + 20, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 25, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "String", + "value": "\"foo\"", + "range": [ + 30, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + } +} diff --git a/lib/test/esprima/ES6/import-declaration/import-named-empty.js b/lib/test/esprima/ES6/import-declaration/import-named-empty.js new file mode 100644 index 0000000..5faab37 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/import-named-empty.js @@ -0,0 +1 @@ +import {} from "foo"; diff --git a/lib/test/esprima/ES6/import-declaration/import-named-empty.tree.json b/lib/test/esprima/ES6/import-declaration/import-named-empty.tree.json new file mode 100644 index 0000000..31d0908 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/import-named-empty.tree.json @@ -0,0 +1,167 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "type": "ImportDeclaration", + "specifiers": [], + "source": { + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "Literal", + "value": "foo", + "raw": "\"foo\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "import", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "String", + "value": "\"foo\"", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } +} diff --git a/lib/test/esprima/ES6/import-declaration/import-named-specifier.js b/lib/test/esprima/ES6/import-declaration/import-named-specifier.js new file mode 100644 index 0000000..fc80c74 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/import-named-specifier.js @@ -0,0 +1 @@ +import {bar} from "foo"; diff --git a/lib/test/esprima/ES6/import-declaration/import-named-specifier.tree.json b/lib/test/esprima/ES6/import-declaration/import-named-specifier.tree.json new file mode 100644 index 0000000..30789f4 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/import-named-specifier.tree.json @@ -0,0 +1,239 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "type": "ImportDeclaration", + "specifiers": [ + { + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "ImportSpecifier", + "local": { + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Identifier", + "name": "bar" + }, + "imported": { + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Identifier", + "name": "bar" + } + } + ], + "source": { + "range": [ + 18, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "type": "Literal", + "value": "foo", + "raw": "\"foo\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "import", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 13, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "String", + "value": "\"foo\"", + "range": [ + 18, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } +} diff --git a/lib/test/esprima/ES6/import-declaration/import-named-specifiers-comma.js b/lib/test/esprima/ES6/import-declaration/import-named-specifiers-comma.js new file mode 100644 index 0000000..c2e9585 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/import-named-specifiers-comma.js @@ -0,0 +1 @@ +import {bar, baz,} from "foo"; diff --git a/lib/test/esprima/ES6/import-declaration/import-named-specifiers-comma.tree.json b/lib/test/esprima/ES6/import-declaration/import-named-specifiers-comma.tree.json new file mode 100644 index 0000000..75472b6 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/import-named-specifiers-comma.tree.json @@ -0,0 +1,346 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "type": "ImportDeclaration", + "specifiers": [ + { + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "ImportSpecifier", + "local": { + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Identifier", + "name": "bar" + }, + "imported": { + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Identifier", + "name": "bar" + } + }, + { + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "ImportSpecifier", + "local": { + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "Identifier", + "name": "baz" + }, + "imported": { + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "Identifier", + "name": "baz" + } + } + ], + "source": { + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "type": "Literal", + "value": "foo", + "raw": "\"foo\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "import", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "baz", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "String", + "value": "\"foo\"", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + } + ], + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + } +} diff --git a/lib/test/esprima/ES6/import-declaration/import-named-specifiers.js b/lib/test/esprima/ES6/import-declaration/import-named-specifiers.js new file mode 100644 index 0000000..2fb83c2 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/import-named-specifiers.js @@ -0,0 +1 @@ +import {bar, baz} from "foo"; diff --git a/lib/test/esprima/ES6/import-declaration/import-named-specifiers.tree.json b/lib/test/esprima/ES6/import-declaration/import-named-specifiers.tree.json new file mode 100644 index 0000000..6d80759 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/import-named-specifiers.tree.json @@ -0,0 +1,328 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "type": "ImportDeclaration", + "specifiers": [ + { + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "ImportSpecifier", + "local": { + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Identifier", + "name": "bar" + }, + "imported": { + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Identifier", + "name": "bar" + } + }, + { + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "ImportSpecifier", + "local": { + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "Identifier", + "name": "baz" + }, + "imported": { + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "Identifier", + "name": "baz" + } + } + ], + "source": { + "range": [ + 23, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "type": "Literal", + "value": "foo", + "raw": "\"foo\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "import", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "baz", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "String", + "value": "\"foo\"", + "range": [ + 23, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } +} diff --git a/lib/test/esprima/ES6/import-declaration/import-namespace-specifier.js b/lib/test/esprima/ES6/import-declaration/import-namespace-specifier.js new file mode 100644 index 0000000..e55c077 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/import-namespace-specifier.js @@ -0,0 +1 @@ +import * as foo from "foo"; diff --git a/lib/test/esprima/ES6/import-declaration/import-namespace-specifier.tree.json b/lib/test/esprima/ES6/import-declaration/import-namespace-specifier.tree.json new file mode 100644 index 0000000..96b0176 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/import-namespace-specifier.tree.json @@ -0,0 +1,221 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "type": "ImportDeclaration", + "specifiers": [ + { + "range": [ + 7, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "ImportNamespaceSpecifier", + "local": { + "range": [ + 12, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "Identifier", + "name": "foo" + } + } + ], + "source": { + "range": [ + 21, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "type": "Literal", + "value": "foo", + "raw": "\"foo\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "import", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "as", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 12, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "String", + "value": "\"foo\"", + "range": [ + 21, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + } +} diff --git a/lib/test/esprima/ES6/import-declaration/import-null-as-nil.js b/lib/test/esprima/ES6/import-declaration/import-null-as-nil.js new file mode 100644 index 0000000..ced8a86 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/import-null-as-nil.js @@ -0,0 +1 @@ +import { null as nil } from "bar" diff --git a/lib/test/esprima/ES6/import-declaration/import-null-as-nil.tree.json b/lib/test/esprima/ES6/import-declaration/import-null-as-nil.tree.json new file mode 100644 index 0000000..8e5b439 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/import-null-as-nil.tree.json @@ -0,0 +1,257 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "type": "ImportDeclaration", + "specifiers": [ + { + "range": [ + 9, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "ImportSpecifier", + "local": { + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "Identifier", + "name": "nil" + }, + "imported": { + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "Identifier", + "name": "null" + } + } + ], + "source": { + "range": [ + 28, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "type": "Literal", + "value": "bar", + "raw": "\"bar\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "import", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Null", + "value": "null", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "as", + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "nil", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 23, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "String", + "value": "\"bar\"", + "range": [ + 28, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "range": [ + 0, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + } +} diff --git a/lib/test/esprima/ES6/import-declaration/invalid-import-default-after-named-after-default.js b/lib/test/esprima/ES6/import-declaration/invalid-import-default-after-named-after-default.js new file mode 100644 index 0000000..69aac7e --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/invalid-import-default-after-named-after-default.js @@ -0,0 +1 @@ +import foo, {bar}, foo from "foo"; diff --git a/lib/test/esprima/ES6/import-declaration/invalid-import-default-after-named-after-default.module.json b/lib/test/esprima/ES6/import-declaration/invalid-import-default-after-named-after-default.module.json new file mode 100644 index 0000000..4d37e79 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/invalid-import-default-after-named-after-default.module.json @@ -0,0 +1,7 @@ +{ + "index": 17, + "lineNumber": 1, + "column": 18, + "message": "Error: Line 1: Unexpected token ,", + "description": "Unexpected token ," +} diff --git a/lib/test/esprima/ES6/import-declaration/invalid-import-default-after-named.js b/lib/test/esprima/ES6/import-declaration/invalid-import-default-after-named.js new file mode 100644 index 0000000..5be12da --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/invalid-import-default-after-named.js @@ -0,0 +1 @@ +import {bar}, foo from "foo" diff --git a/lib/test/esprima/ES6/import-declaration/invalid-import-default-after-named.module.json b/lib/test/esprima/ES6/import-declaration/invalid-import-default-after-named.module.json new file mode 100644 index 0000000..c387b5f --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/invalid-import-default-after-named.module.json @@ -0,0 +1,7 @@ +{ + "index": 12, + "lineNumber": 1, + "column": 13, + "message": "Error: Line 1: Unexpected token ,", + "description": "Unexpected token ," +} diff --git a/lib/test/esprima/ES6/import-declaration/invalid-import-default-missing-module-specifier.js b/lib/test/esprima/ES6/import-declaration/invalid-import-default-missing-module-specifier.js new file mode 100644 index 0000000..ddf5574 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/invalid-import-default-missing-module-specifier.js @@ -0,0 +1 @@ +import foo diff --git a/lib/test/esprima/ES6/import-declaration/invalid-import-default-missing-module-specifier.module.json b/lib/test/esprima/ES6/import-declaration/invalid-import-default-missing-module-specifier.module.json new file mode 100644 index 0000000..f0f84f3 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/invalid-import-default-missing-module-specifier.module.json @@ -0,0 +1,7 @@ +{ + "index": 10, + "lineNumber": 1, + "column": 11, + "message": "Error: Line 1: Unexpected token", + "description": "Unexpected token" +} diff --git a/lib/test/esprima/ES6/import-declaration/invalid-import-default-module-specifier.js b/lib/test/esprima/ES6/import-declaration/invalid-import-default-module-specifier.js new file mode 100644 index 0000000..16e3ea2 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/invalid-import-default-module-specifier.js @@ -0,0 +1 @@ +import foo from bar; diff --git a/lib/test/esprima/ES6/import-declaration/invalid-import-default-module-specifier.module.json b/lib/test/esprima/ES6/import-declaration/invalid-import-default-module-specifier.module.json new file mode 100644 index 0000000..04b8297 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/invalid-import-default-module-specifier.module.json @@ -0,0 +1,7 @@ +{ + "index": 15, + "lineNumber": 1, + "column": 16, + "message": "Error: Line 1: Unexpected token", + "description": "Unexpected token" +} diff --git a/lib/test/esprima/ES6/import-declaration/invalid-import-default.js b/lib/test/esprima/ES6/import-declaration/invalid-import-default.js new file mode 100644 index 0000000..6399a1a --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/invalid-import-default.js @@ -0,0 +1 @@ +import default from "foo" diff --git a/lib/test/esprima/ES6/import-declaration/invalid-import-default.module.json b/lib/test/esprima/ES6/import-declaration/invalid-import-default.module.json new file mode 100644 index 0000000..c7ee5f4 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/invalid-import-default.module.json @@ -0,0 +1,7 @@ +{ + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Error: Line 1: Unexpected token default", + "description": "Unexpected token default" +} diff --git a/lib/test/esprima/ES6/import-declaration/invalid-import-missing-comma.js b/lib/test/esprima/ES6/import-declaration/invalid-import-missing-comma.js new file mode 100644 index 0000000..e54f9c1 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/invalid-import-missing-comma.js @@ -0,0 +1 @@ +import foo { bar } from "bar"; diff --git a/lib/test/esprima/ES6/import-declaration/invalid-import-missing-comma.module.json b/lib/test/esprima/ES6/import-declaration/invalid-import-missing-comma.module.json new file mode 100644 index 0000000..c8cb4cc --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/invalid-import-missing-comma.module.json @@ -0,0 +1,7 @@ +{ + "index": 10, + "lineNumber": 1, + "column": 11, + "message": "Error: Line 1: Unexpected token {", + "description":"Unexpected token {" +} diff --git a/lib/test/esprima/ES6/import-declaration/invalid-import-missing-module-specifier.js b/lib/test/esprima/ES6/import-declaration/invalid-import-missing-module-specifier.js new file mode 100644 index 0000000..338ebc1 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/invalid-import-missing-module-specifier.js @@ -0,0 +1 @@ +import { foo, bar } diff --git a/lib/test/esprima/ES6/import-declaration/invalid-import-missing-module-specifier.module.json b/lib/test/esprima/ES6/import-declaration/invalid-import-missing-module-specifier.module.json new file mode 100644 index 0000000..055d287 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/invalid-import-missing-module-specifier.module.json @@ -0,0 +1,7 @@ +{ + "index": 19, + "lineNumber": 1, + "column": 20, + "message": "Error: Line 1: Unexpected token", + "description": "Unexpected token" +} diff --git a/lib/test/esprima/ES6/import-declaration/invalid-import-module-specifier.js b/lib/test/esprima/ES6/import-declaration/invalid-import-module-specifier.js new file mode 100644 index 0000000..15dda16 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/invalid-import-module-specifier.js @@ -0,0 +1 @@ +export {foo} from bar diff --git a/lib/test/esprima/ES6/import-declaration/invalid-import-module-specifier.module.json b/lib/test/esprima/ES6/import-declaration/invalid-import-module-specifier.module.json new file mode 100644 index 0000000..ea3ff72 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/invalid-import-module-specifier.module.json @@ -0,0 +1,7 @@ +{ + "index": 17, + "lineNumber": 1, + "column": 18, + "message": "Error: Line 1: Unexpected token", + "description": "Unexpected token" +} diff --git a/lib/test/esprima/ES6/import-declaration/invalid-import-named-after-named.js b/lib/test/esprima/ES6/import-declaration/invalid-import-named-after-named.js new file mode 100644 index 0000000..a0557bf --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/invalid-import-named-after-named.js @@ -0,0 +1 @@ +import {bar}, {foo} from "foo"; diff --git a/lib/test/esprima/ES6/import-declaration/invalid-import-named-after-named.module.json b/lib/test/esprima/ES6/import-declaration/invalid-import-named-after-named.module.json new file mode 100644 index 0000000..c387b5f --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/invalid-import-named-after-named.module.json @@ -0,0 +1,7 @@ +{ + "index": 12, + "lineNumber": 1, + "column": 13, + "message": "Error: Line 1: Unexpected token ,", + "description": "Unexpected token ," +} diff --git a/lib/test/esprima/ES6/import-declaration/invalid-import-named-after-namespace.js b/lib/test/esprima/ES6/import-declaration/invalid-import-named-after-namespace.js new file mode 100644 index 0000000..24cede9 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/invalid-import-named-after-namespace.js @@ -0,0 +1 @@ +import * as foo, {bar} from "foo"; diff --git a/lib/test/esprima/ES6/import-declaration/invalid-import-named-after-namespace.module.json b/lib/test/esprima/ES6/import-declaration/invalid-import-named-after-namespace.module.json new file mode 100644 index 0000000..bb941af --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/invalid-import-named-after-namespace.module.json @@ -0,0 +1,7 @@ +{ + "index": 15, + "lineNumber": 1, + "column": 16, + "message": "Error: Line 1: Unexpected token ,", + "description": "Unexpected token ," +} diff --git a/lib/test/esprima/ES6/import-declaration/invalid-import-named-as-missing-from.js b/lib/test/esprima/ES6/import-declaration/invalid-import-named-as-missing-from.js new file mode 100644 index 0000000..5d7daed --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/invalid-import-named-as-missing-from.js @@ -0,0 +1 @@ +import {default as foo} diff --git a/lib/test/esprima/ES6/import-declaration/invalid-import-named-as-missing-from.module.json b/lib/test/esprima/ES6/import-declaration/invalid-import-named-as-missing-from.module.json new file mode 100644 index 0000000..2a8d81b --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/invalid-import-named-as-missing-from.module.json @@ -0,0 +1,7 @@ +{ + "index": 23, + "lineNumber": 1, + "column": 24, + "message": "Error: Line 1: Unexpected token", + "description": "Unexpected token" +} diff --git a/lib/test/esprima/ES6/import-declaration/invalid-import-namespace-after-named.js b/lib/test/esprima/ES6/import-declaration/invalid-import-namespace-after-named.js new file mode 100644 index 0000000..09d0d34 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/invalid-import-namespace-after-named.js @@ -0,0 +1 @@ +import {bar}, * as foo from "foo"; diff --git a/lib/test/esprima/ES6/import-declaration/invalid-import-namespace-after-named.module.json b/lib/test/esprima/ES6/import-declaration/invalid-import-namespace-after-named.module.json new file mode 100644 index 0000000..c387b5f --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/invalid-import-namespace-after-named.module.json @@ -0,0 +1,7 @@ +{ + "index": 12, + "lineNumber": 1, + "column": 13, + "message": "Error: Line 1: Unexpected token ,", + "description": "Unexpected token ," +} diff --git a/lib/test/esprima/ES6/import-declaration/invalid-import-namespace-missing-as.js b/lib/test/esprima/ES6/import-declaration/invalid-import-namespace-missing-as.js new file mode 100644 index 0000000..4382a94 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/invalid-import-namespace-missing-as.js @@ -0,0 +1 @@ +import * from "foo" diff --git a/lib/test/esprima/ES6/import-declaration/invalid-import-namespace-missing-as.module.json b/lib/test/esprima/ES6/import-declaration/invalid-import-namespace-missing-as.module.json new file mode 100644 index 0000000..965e5a3 --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/invalid-import-namespace-missing-as.module.json @@ -0,0 +1,7 @@ +{ + "index": 8, + "lineNumber": 1, + "column": 9, + "message": "Error: Line 1: Unexpected token", + "description": "Unexpected token" +} diff --git a/lib/test/esprima/ES6/import-declaration/invalid-import-specifiers.js b/lib/test/esprima/ES6/import-declaration/invalid-import-specifiers.js new file mode 100644 index 0000000..297310b --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/invalid-import-specifiers.js @@ -0,0 +1 @@ +import foo, from "bar"; diff --git a/lib/test/esprima/ES6/import-declaration/invalid-import-specifiers.module.json b/lib/test/esprima/ES6/import-declaration/invalid-import-specifiers.module.json new file mode 100644 index 0000000..cb4d48e --- /dev/null +++ b/lib/test/esprima/ES6/import-declaration/invalid-import-specifiers.module.json @@ -0,0 +1,7 @@ +{ + "index": 12, + "lineNumber": 1, + "column": 13, + "message": "Error: Line 1: Unexpected identifier", + "description": "Unexpected identifier" +} diff --git a/lib/test/esprima/ES6/lexical-declaration/for_let_in.js b/lib/test/esprima/ES6/lexical-declaration/for_let_in.js new file mode 100644 index 0000000..8551777 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/for_let_in.js @@ -0,0 +1 @@ +for (let in x) {} diff --git a/lib/test/esprima/ES6/lexical-declaration/for_let_in.skip b/lib/test/esprima/ES6/lexical-declaration/for_let_in.skip new file mode 100644 index 0000000..ed7bd50 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/for_let_in.skip @@ -0,0 +1 @@ +TODO: parse errors diff --git a/lib/test/esprima/ES6/lexical-declaration/for_let_in.tree.json b/lib/test/esprima/ES6/lexical-declaration/for_let_in.tree.json new file mode 100644 index 0000000..67bed2c --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/for_let_in.tree.json @@ -0,0 +1,238 @@ +{ + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "Program", + "body": [ + { + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "ForInStatement", + "left": { + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "Identifier", + "name": "let" + }, + "right": { + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "Identifier", + "name": "x" + }, + "body": { + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "BlockStatement", + "body": [] + }, + "each": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "in", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ] +} diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_complex_binding_without_init.failure.json b/lib/test/esprima/ES6/lexical-declaration/invalid_complex_binding_without_init.failure.json new file mode 100644 index 0000000..d2a124b --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_complex_binding_without_init.failure.json @@ -0,0 +1 @@ +{"index":7,"lineNumber":2,"column":1,"message":"Error: Line 2: Unexpected end of input","description":"Unexpected end of input"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_complex_binding_without_init.js b/lib/test/esprima/ES6/lexical-declaration/invalid_complex_binding_without_init.js new file mode 100644 index 0000000..ba39fed --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_complex_binding_without_init.js @@ -0,0 +1 @@ +let [] diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_const_const.failure.json b/lib/test/esprima/ES6/lexical-declaration/invalid_const_const.failure.json new file mode 100644 index 0000000..7134e27 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_const_const.failure.json @@ -0,0 +1 @@ +{"index":6,"lineNumber":1,"column":7,"message":"Error: Line 1: Unexpected token const","description":"Unexpected token const"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_const_const.js b/lib/test/esprima/ES6/lexical-declaration/invalid_const_const.js new file mode 100644 index 0000000..8622768 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_const_const.js @@ -0,0 +1 @@ +const const; diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_const_forin.failure.json b/lib/test/esprima/ES6/lexical-declaration/invalid_const_forin.failure.json new file mode 100644 index 0000000..c505bf8 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_const_forin.failure.json @@ -0,0 +1 @@ +{"index":17,"lineNumber":1,"column":18,"message":"Error: Line 1: Unexpected token in","description":"Unexpected token in"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_const_forin.js b/lib/test/esprima/ES6/lexical-declaration/invalid_const_forin.js new file mode 100644 index 0000000..2c6e10e --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_const_forin.js @@ -0,0 +1 @@ +for (const x = 0 in y){} diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_const_let.failure.json b/lib/test/esprima/ES6/lexical-declaration/invalid_const_let.failure.json new file mode 100644 index 0000000..465668a --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_const_let.failure.json @@ -0,0 +1 @@ +{"index":6,"lineNumber":1,"column":7,"message":"Error: Line 1: Unexpected token let","description":"Unexpected token let"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_const_let.js b/lib/test/esprima/ES6/lexical-declaration/invalid_const_let.js new file mode 100644 index 0000000..184aa44 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_const_let.js @@ -0,0 +1 @@ +const let diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_for_const_declarations.failure.json b/lib/test/esprima/ES6/lexical-declaration/invalid_for_const_declarations.failure.json new file mode 100644 index 0000000..14622f1 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_for_const_declarations.failure.json @@ -0,0 +1 @@ +{"index":32,"lineNumber":1,"column":33,"message":"Error: Line 1: Unexpected token let","description":"Unexpected token let"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_for_const_declarations.js b/lib/test/esprima/ES6/lexical-declaration/invalid_for_const_declarations.js new file mode 100644 index 0000000..2c0141c --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_for_const_declarations.js @@ -0,0 +1 @@ +for (const x = 1, y = 2, z = 3, let = 0;;;) {} diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_for_const_let.failure.json b/lib/test/esprima/ES6/lexical-declaration/invalid_for_const_let.failure.json new file mode 100644 index 0000000..abfc6d5 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_for_const_let.failure.json @@ -0,0 +1 @@ +{"index":11,"lineNumber":1,"column":12,"message":"Error: Line 1: Unexpected token let","description":"Unexpected token let"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_for_const_let.js b/lib/test/esprima/ES6/lexical-declaration/invalid_for_const_let.js new file mode 100644 index 0000000..1f0f3b5 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_for_const_let.js @@ -0,0 +1 @@ +for (const let = 1;;;) {} diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_for_let_declarations.failure.json b/lib/test/esprima/ES6/lexical-declaration/invalid_for_let_declarations.failure.json new file mode 100644 index 0000000..4932f5a --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_for_let_declarations.failure.json @@ -0,0 +1 @@ +{"index":18,"lineNumber":1,"column":19,"message":"Error: Line 1: Unexpected token let","description":"Unexpected token let"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_for_let_declarations.js b/lib/test/esprima/ES6/lexical-declaration/invalid_for_let_declarations.js new file mode 100644 index 0000000..c06a12a --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_for_let_declarations.js @@ -0,0 +1 @@ +for (let x, y, z, let;;;) {} diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_for_let_init.failure.json b/lib/test/esprima/ES6/lexical-declaration/invalid_for_let_init.failure.json new file mode 100644 index 0000000..4932f5a --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_for_let_init.failure.json @@ -0,0 +1 @@ +{"index":18,"lineNumber":1,"column":19,"message":"Error: Line 1: Unexpected token let","description":"Unexpected token let"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_for_let_init.js b/lib/test/esprima/ES6/lexical-declaration/invalid_for_let_init.js new file mode 100644 index 0000000..11e48b4 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_for_let_init.js @@ -0,0 +1 @@ +for (let x, y, z, let = 1;;;) {} diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_for_let_let.failure.json b/lib/test/esprima/ES6/lexical-declaration/invalid_for_let_let.failure.json new file mode 100644 index 0000000..92ab644 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_for_let_let.failure.json @@ -0,0 +1 @@ +{"index":9,"lineNumber":1,"column":10,"message":"Error: Line 1: Unexpected token let","description":"Unexpected token let"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_for_let_let.js b/lib/test/esprima/ES6/lexical-declaration/invalid_for_let_let.js new file mode 100644 index 0000000..9ba53f4 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_for_let_let.js @@ -0,0 +1 @@ +for (let let;;;) {} diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_for_let_pattern.failure.json b/lib/test/esprima/ES6/lexical-declaration/invalid_for_let_pattern.failure.json new file mode 100644 index 0000000..ec17f6e --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_for_let_pattern.failure.json @@ -0,0 +1 @@ +{"index":10,"lineNumber":1,"column":11,"message":"Error: Line 1: Unexpected token let","description":"Unexpected token let"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_for_let_pattern.js b/lib/test/esprima/ES6/lexical-declaration/invalid_for_let_pattern.js new file mode 100644 index 0000000..a44b415 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_for_let_pattern.js @@ -0,0 +1 @@ +for (let [let];;;) {} diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_forin_const_let.failure.json b/lib/test/esprima/ES6/lexical-declaration/invalid_forin_const_let.failure.json new file mode 100644 index 0000000..abfc6d5 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_forin_const_let.failure.json @@ -0,0 +1 @@ +{"index":11,"lineNumber":1,"column":12,"message":"Error: Line 1: Unexpected token let","description":"Unexpected token let"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_forin_const_let.js b/lib/test/esprima/ES6/lexical-declaration/invalid_forin_const_let.js new file mode 100644 index 0000000..dc64716 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_forin_const_let.js @@ -0,0 +1 @@ +for (const let in y); diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_forin_let_let.failure.json b/lib/test/esprima/ES6/lexical-declaration/invalid_forin_let_let.failure.json new file mode 100644 index 0000000..92ab644 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_forin_let_let.failure.json @@ -0,0 +1 @@ +{"index":9,"lineNumber":1,"column":10,"message":"Error: Line 1: Unexpected token let","description":"Unexpected token let"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_forin_let_let.js b/lib/test/esprima/ES6/lexical-declaration/invalid_forin_let_let.js new file mode 100644 index 0000000..31c2eda --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_forin_let_let.js @@ -0,0 +1 @@ +for (let let in x); diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_let_declarations.failure.json b/lib/test/esprima/ES6/lexical-declaration/invalid_let_declarations.failure.json new file mode 100644 index 0000000..8f62810 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_let_declarations.failure.json @@ -0,0 +1 @@ +{"index":13,"lineNumber":1,"column":14,"message":"Error: Line 1: Unexpected token let","description":"Unexpected token let"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_let_declarations.js b/lib/test/esprima/ES6/lexical-declaration/invalid_let_declarations.js new file mode 100644 index 0000000..b446bc1 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_let_declarations.js @@ -0,0 +1 @@ +let x, y, z, let; diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_let_for_in.failure.json b/lib/test/esprima/ES6/lexical-declaration/invalid_let_for_in.failure.json new file mode 100644 index 0000000..26b6d27 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_let_for_in.failure.json @@ -0,0 +1 @@ +{"index":23,"lineNumber":1,"column":24,"message":"Error: Line 1: Unexpected token in","description":"Unexpected token in"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_let_for_in.js b/lib/test/esprima/ES6/lexical-declaration/invalid_let_for_in.js new file mode 100644 index 0000000..dc618f1 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_let_for_in.js @@ -0,0 +1 @@ +'use strict'; for (let in z) {} diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_let_forin.failure.json b/lib/test/esprima/ES6/lexical-declaration/invalid_let_forin.failure.json new file mode 100644 index 0000000..e530311 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_let_forin.failure.json @@ -0,0 +1 @@ +{"index":15,"lineNumber":1,"column":16,"message":"Error: Line 1: Unexpected token in","description":"Unexpected token in"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_let_forin.js b/lib/test/esprima/ES6/lexical-declaration/invalid_let_forin.js new file mode 100644 index 0000000..6686af7 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_let_forin.js @@ -0,0 +1 @@ +for (let x = 0 in y){} diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_let_init.failure.json b/lib/test/esprima/ES6/lexical-declaration/invalid_let_init.failure.json new file mode 100644 index 0000000..8f62810 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_let_init.failure.json @@ -0,0 +1 @@ +{"index":13,"lineNumber":1,"column":14,"message":"Error: Line 1: Unexpected token let","description":"Unexpected token let"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_let_init.js b/lib/test/esprima/ES6/lexical-declaration/invalid_let_init.js new file mode 100644 index 0000000..e648470 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_let_init.js @@ -0,0 +1 @@ +let x, y, z, let = 1; diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_let_let.failure.json b/lib/test/esprima/ES6/lexical-declaration/invalid_let_let.failure.json new file mode 100644 index 0000000..de9d95c --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_let_let.failure.json @@ -0,0 +1 @@ +{"index":4,"lineNumber":1,"column":5,"message":"Error: Line 1: Unexpected token let","description":"Unexpected token let"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_let_let.js b/lib/test/esprima/ES6/lexical-declaration/invalid_let_let.js new file mode 100644 index 0000000..8497876 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_let_let.js @@ -0,0 +1 @@ +let let; diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_strict_const_const.failure.json b/lib/test/esprima/ES6/lexical-declaration/invalid_strict_const_const.failure.json new file mode 100644 index 0000000..1c8ab80 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_strict_const_const.failure.json @@ -0,0 +1 @@ +{"index":20,"lineNumber":1,"column":21,"message":"Error: Line 1: Unexpected token const","description":"Unexpected token const"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_strict_const_const.js b/lib/test/esprima/ES6/lexical-declaration/invalid_strict_const_const.js new file mode 100644 index 0000000..ca7270f --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_strict_const_const.js @@ -0,0 +1 @@ +"use strict"; const const = 1; diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_strict_const_let.failure.json b/lib/test/esprima/ES6/lexical-declaration/invalid_strict_const_let.failure.json new file mode 100644 index 0000000..2d58c07 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_strict_const_let.failure.json @@ -0,0 +1 @@ +{"index":20,"lineNumber":1,"column":21,"message":"Error: Line 1: Unexpected token let","description":"Unexpected token let"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_strict_const_let.js b/lib/test/esprima/ES6/lexical-declaration/invalid_strict_const_let.js new file mode 100644 index 0000000..8a2b800 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_strict_const_let.js @@ -0,0 +1 @@ +"use strict"; const let = 1; diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_1.failure.json b/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_1.failure.json new file mode 100644 index 0000000..d2a124b --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_1.failure.json @@ -0,0 +1 @@ +{"index":7,"lineNumber":2,"column":1,"message":"Error: Line 2: Unexpected end of input","description":"Unexpected end of input"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_1.js b/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_1.js new file mode 100644 index 0000000..306429b --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_1.js @@ -0,0 +1 @@ +let x, diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_2.failure.json b/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_2.failure.json new file mode 100644 index 0000000..3b08351 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_2.failure.json @@ -0,0 +1 @@ +{"index":6,"lineNumber":1,"column":7,"message":"Error: Line 1: Unexpected token ;","description":"Unexpected token ;"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_2.js b/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_2.js new file mode 100644 index 0000000..7b89131 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_2.js @@ -0,0 +1 @@ +let x,; diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_3.failure.json b/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_3.failure.json new file mode 100644 index 0000000..afaccbf --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_3.failure.json @@ -0,0 +1 @@ +{"index":10,"lineNumber":1,"column":11,"message":"Error: Line 1: Unexpected token ;","description":"Unexpected token ;"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_3.js b/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_3.js new file mode 100644 index 0000000..95fe1b0 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_3.js @@ -0,0 +1 @@ +let x, y, ; diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_4.failure.json b/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_4.failure.json new file mode 100644 index 0000000..e75c69d --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_4.failure.json @@ -0,0 +1 @@ +{"index":14,"lineNumber":3,"column":1,"message":"Error: Line 3: Unexpected end of input","description":"Unexpected end of input"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_4.js b/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_4.js new file mode 100644 index 0000000..a9ceda3 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_4.js @@ -0,0 +1,2 @@ +let x, +y = 3, diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_5.failure.json b/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_5.failure.json new file mode 100644 index 0000000..308f17b --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_5.failure.json @@ -0,0 +1 @@ +{"index":13,"lineNumber":2,"column":1,"message":"Error: Line 2: Unexpected end of input","description":"Unexpected end of input"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_5.js b/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_5.js new file mode 100644 index 0000000..518a58b --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_5.js @@ -0,0 +1 @@ +const x = 0, diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_6.failure.json b/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_6.failure.json new file mode 100644 index 0000000..7e49237 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_6.failure.json @@ -0,0 +1 @@ +{"index":19,"lineNumber":1,"column":20,"message":"Error: Line 1: Unexpected token ;","description":"Unexpected token ;"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_6.js b/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_6.js new file mode 100644 index 0000000..43ea550 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_6.js @@ -0,0 +1 @@ +const x = 0, y = 1,; diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_7.failure.json b/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_7.failure.json new file mode 100644 index 0000000..fbdacb5 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_7.failure.json @@ -0,0 +1 @@ +{"index":27,"lineNumber":4,"column":1,"message":"Error: Line 4: Unexpected end of input","description":"Unexpected end of input"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_7.js b/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_7.js new file mode 100644 index 0000000..807a697 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/invalid_trailing_comma_7.js @@ -0,0 +1,3 @@ +const x = 0, + y = 1, + diff --git a/lib/test/esprima/ES6/lexical-declaration/let_assign.js b/lib/test/esprima/ES6/lexical-declaration/let_assign.js new file mode 100644 index 0000000..4f84654 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/let_assign.js @@ -0,0 +1 @@ +let = 42; diff --git a/lib/test/esprima/ES6/lexical-declaration/let_assign.skip b/lib/test/esprima/ES6/lexical-declaration/let_assign.skip new file mode 100644 index 0000000..ed7bd50 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/let_assign.skip @@ -0,0 +1 @@ +TODO: parse errors diff --git a/lib/test/esprima/ES6/lexical-declaration/let_assign.tree.json b/lib/test/esprima/ES6/lexical-declaration/let_assign.tree.json new file mode 100644 index 0000000..cd86135 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/let_assign.tree.json @@ -0,0 +1,166 @@ +{ + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "Program", + "body": [ + { + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "AssignmentExpression", + "operator": "=", + "left": { + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "type": "Identifier", + "name": "let" + }, + "right": { + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "Literal", + "value": 42, + "raw": "42" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "let", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ] +} diff --git a/lib/test/esprima/ES6/lexical-declaration/let_identifier.js b/lib/test/esprima/ES6/lexical-declaration/let_identifier.js new file mode 100644 index 0000000..03912eb --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/let_identifier.js @@ -0,0 +1 @@ +let; diff --git a/lib/test/esprima/ES6/lexical-declaration/let_identifier.skip b/lib/test/esprima/ES6/lexical-declaration/let_identifier.skip new file mode 100644 index 0000000..ed7bd50 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/let_identifier.skip @@ -0,0 +1 @@ +TODO: parse errors diff --git a/lib/test/esprima/ES6/lexical-declaration/let_identifier.tree.json b/lib/test/esprima/ES6/lexical-declaration/let_identifier.tree.json new file mode 100644 index 0000000..e1047d2 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/let_identifier.tree.json @@ -0,0 +1,93 @@ +{ + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "type": "Program", + "body": [ + { + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "type": "Identifier", + "name": "let" + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "let", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ] +} diff --git a/lib/test/esprima/ES6/lexical-declaration/let_member.js b/lib/test/esprima/ES6/lexical-declaration/let_member.js new file mode 100644 index 0000000..4aee8ae --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/let_member.js @@ -0,0 +1 @@ +let.let = foo diff --git a/lib/test/esprima/ES6/lexical-declaration/let_member.skip b/lib/test/esprima/ES6/lexical-declaration/let_member.skip new file mode 100644 index 0000000..ed7bd50 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/let_member.skip @@ -0,0 +1 @@ +TODO: parse errors diff --git a/lib/test/esprima/ES6/lexical-declaration/let_member.tree.json b/lib/test/esprima/ES6/lexical-declaration/let_member.tree.json new file mode 100644 index 0000000..d3ef806 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/let_member.tree.json @@ -0,0 +1,219 @@ +{ + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "Program", + "body": [ + { + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "AssignmentExpression", + "operator": "=", + "left": { + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "MemberExpression", + "computed": false, + "object": { + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "type": "Identifier", + "name": "let" + }, + "property": { + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Identifier", + "name": "let" + } + }, + "right": { + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "Identifier", + "name": "foo" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "let", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ] +} diff --git a/lib/test/esprima/ES6/lexical-declaration/migrated_0000.js b/lib/test/esprima/ES6/lexical-declaration/migrated_0000.js new file mode 100644 index 0000000..6108e42 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/migrated_0000.js @@ -0,0 +1 @@ +switch (answer) { case 42: let t = 42; break; } \ No newline at end of file diff --git a/lib/test/esprima/ES6/lexical-declaration/migrated_0000.tree.json b/lib/test/esprima/ES6/lexical-declaration/migrated_0000.tree.json new file mode 100644 index 0000000..85f0c10 --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/migrated_0000.tree.json @@ -0,0 +1,477 @@ +{ + "type": "Program", + "body": [ + { + "type": "SwitchStatement", + "discriminant": { + "type": "Identifier", + "name": "answer", + "range": [ + 8, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "cases": [ + { + "type": "SwitchCase", + "test": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 23, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "consequent": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "t", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "init": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 35, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + "range": [ + 31, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + ], + "kind": "let", + "range": [ + 27, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "BreakStatement", + "label": null, + "range": [ + 39, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 45 + } + } + } + ], + "range": [ + 18, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 45 + } + } + } + ], + "range": [ + 0, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "switch", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "answer", + "range": [ + 8, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Keyword", + "value": "case", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 23, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Identifier", + "value": "t", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 35, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Keyword", + "value": "break", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 47 + } + } + } + ], + "range": [ + 0, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + } +} diff --git a/lib/test/esprima/ES6/lexical-declaration/module_let.js b/lib/test/esprima/ES6/lexical-declaration/module_let.js new file mode 100644 index 0000000..d29e51d --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/module_let.js @@ -0,0 +1 @@ +let x diff --git a/lib/test/esprima/ES6/lexical-declaration/module_let.tree.json b/lib/test/esprima/ES6/lexical-declaration/module_let.tree.json new file mode 100644 index 0000000..2429deb --- /dev/null +++ b/lib/test/esprima/ES6/lexical-declaration/module_let.tree.json @@ -0,0 +1,114 @@ +{ + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "type": "Program", + "body": [ + { + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "type": "Identifier", + "name": "x" + }, + "init": null + } + ], + "kind": "let" + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "let", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ] +} diff --git a/lib/test/esprima/ES6/meta-property/assign-new-target.js b/lib/test/esprima/ES6/meta-property/assign-new-target.js new file mode 100644 index 0000000..34426e1 --- /dev/null +++ b/lib/test/esprima/ES6/meta-property/assign-new-target.js @@ -0,0 +1,3 @@ +function f() { + let x = new.target; +} diff --git a/lib/test/esprima/ES6/meta-property/assign-new-target.tree.json b/lib/test/esprima/ES6/meta-property/assign-new-target.tree.json new file mode 100644 index 0000000..93427f4 --- /dev/null +++ b/lib/test/esprima/ES6/meta-property/assign-new-target.tree.json @@ -0,0 +1,421 @@ +{ + "range": [ + 0, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "type": "Program", + "body": [ + { + "range": [ + 0, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Identifier", + "name": "f" + }, + "params": [], + "body": { + "range": [ + 13, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 19, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 23, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "type": "Identifier", + "name": "x" + }, + "init": { + "range": [ + 27, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "type": "MetaProperty", + "meta": { + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "type": "Identifier", + "name": "new" + }, + "property": { + "range": [ + 31, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "type": "Identifier", + "name": "target" + } + } + } + ], + "kind": "let" + } + ] + }, + "generator": false, + "expression": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Keyword", + "value": "new", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "target", + "range": [ + 31, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +} diff --git a/lib/test/esprima/ES6/meta-property/invalid-dots.failure.json b/lib/test/esprima/ES6/meta-property/invalid-dots.failure.json new file mode 100644 index 0000000..6bffe36 --- /dev/null +++ b/lib/test/esprima/ES6/meta-property/invalid-dots.failure.json @@ -0,0 +1 @@ +{"index":29,"lineNumber":1,"column":30,"message":"Error: Line 1: Unexpected token .","description":"Unexpected token ."} \ No newline at end of file diff --git a/lib/test/esprima/ES6/meta-property/invalid-dots.js b/lib/test/esprima/ES6/meta-property/invalid-dots.js new file mode 100644 index 0000000..a535e56 --- /dev/null +++ b/lib/test/esprima/ES6/meta-property/invalid-dots.js @@ -0,0 +1 @@ +var x = function() { y = new..target; } diff --git a/lib/test/esprima/ES6/meta-property/invalid-new-target.failure.json b/lib/test/esprima/ES6/meta-property/invalid-new-target.failure.json new file mode 100644 index 0000000..b4a82b9 --- /dev/null +++ b/lib/test/esprima/ES6/meta-property/invalid-new-target.failure.json @@ -0,0 +1 @@ +{"index":12,"lineNumber":1,"column":13,"message":"Error: Line 1: Unexpected identifier","description":"Unexpected identifier"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/meta-property/invalid-new-target.js b/lib/test/esprima/ES6/meta-property/invalid-new-target.js new file mode 100644 index 0000000..46b13d0 --- /dev/null +++ b/lib/test/esprima/ES6/meta-property/invalid-new-target.js @@ -0,0 +1 @@ +var x = new.target; diff --git a/lib/test/esprima/ES6/meta-property/new-new-target.js b/lib/test/esprima/ES6/meta-property/new-new-target.js new file mode 100644 index 0000000..ac74ad9 --- /dev/null +++ b/lib/test/esprima/ES6/meta-property/new-new-target.js @@ -0,0 +1,3 @@ +function f() { + new new.target; +} diff --git a/lib/test/esprima/ES6/meta-property/new-new-target.tree.json b/lib/test/esprima/ES6/meta-property/new-new-target.tree.json new file mode 100644 index 0000000..c79edcb --- /dev/null +++ b/lib/test/esprima/ES6/meta-property/new-new-target.tree.json @@ -0,0 +1,365 @@ +{ + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "type": "Program", + "body": [ + { + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Identifier", + "name": "f" + }, + "params": [], + "body": { + "range": [ + 13, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 19, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 19, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "type": "NewExpression", + "callee": { + "range": [ + 23, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "type": "MetaProperty", + "meta": { + "range": [ + 23, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "type": "Identifier", + "name": "new" + }, + "property": { + "range": [ + 27, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "type": "Identifier", + "name": "target" + } + }, + "arguments": [] + } + } + ] + }, + "generator": false, + "expression": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "new", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Keyword", + "value": "new", + "range": [ + 23, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "target", + "range": [ + 27, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +} diff --git a/lib/test/esprima/ES6/meta-property/new-target-declaration.js b/lib/test/esprima/ES6/meta-property/new-target-declaration.js new file mode 100644 index 0000000..01687a0 --- /dev/null +++ b/lib/test/esprima/ES6/meta-property/new-target-declaration.js @@ -0,0 +1,3 @@ +function f() { + new.target; +} diff --git a/lib/test/esprima/ES6/meta-property/new-target-declaration.tree.json b/lib/test/esprima/ES6/meta-property/new-target-declaration.tree.json new file mode 100644 index 0000000..93c501e --- /dev/null +++ b/lib/test/esprima/ES6/meta-property/new-target-declaration.tree.json @@ -0,0 +1,329 @@ +{ + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "type": "Program", + "body": [ + { + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Identifier", + "name": "f" + }, + "params": [], + "body": { + "range": [ + 13, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 19, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 19, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "type": "MetaProperty", + "meta": { + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "type": "Identifier", + "name": "new" + }, + "property": { + "range": [ + 23, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "type": "Identifier", + "name": "target" + } + } + } + ] + }, + "generator": false, + "expression": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "new", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "target", + "range": [ + 23, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +} diff --git a/lib/test/esprima/ES6/meta-property/new-target-expression.js b/lib/test/esprima/ES6/meta-property/new-target-expression.js new file mode 100644 index 0000000..f8f320a --- /dev/null +++ b/lib/test/esprima/ES6/meta-property/new-target-expression.js @@ -0,0 +1 @@ +var f = function() { new.target; } diff --git a/lib/test/esprima/ES6/meta-property/new-target-expression.tree.json b/lib/test/esprima/ES6/meta-property/new-target-expression.tree.json new file mode 100644 index 0000000..530f169 --- /dev/null +++ b/lib/test/esprima/ES6/meta-property/new-target-expression.tree.json @@ -0,0 +1,403 @@ +{ + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "type": "Program", + "body": [ + { + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "type": "Identifier", + "name": "f" + }, + "init": { + "range": [ + 8, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "range": [ + 19, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 21, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 21, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "type": "MetaProperty", + "meta": { + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "type": "Identifier", + "name": "new" + }, + "property": { + "range": [ + 25, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "type": "Identifier", + "name": "target" + } + } + } + ] + }, + "generator": false, + "expression": false + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 8, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Keyword", + "value": "new", + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "target", + "range": [ + 25, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ] +} diff --git a/lib/test/esprima/ES6/meta-property/new-target-invoke.js b/lib/test/esprima/ES6/meta-property/new-target-invoke.js new file mode 100644 index 0000000..bebd659 --- /dev/null +++ b/lib/test/esprima/ES6/meta-property/new-target-invoke.js @@ -0,0 +1,3 @@ +function f() { + new.target(); +} diff --git a/lib/test/esprima/ES6/meta-property/new-target-invoke.tree.json b/lib/test/esprima/ES6/meta-property/new-target-invoke.tree.json new file mode 100644 index 0000000..10942ab --- /dev/null +++ b/lib/test/esprima/ES6/meta-property/new-target-invoke.tree.json @@ -0,0 +1,383 @@ +{ + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "type": "Program", + "body": [ + { + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Identifier", + "name": "f" + }, + "params": [], + "body": { + "range": [ + 13, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 19, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 19, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "type": "CallExpression", + "callee": { + "range": [ + 19, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "type": "MetaProperty", + "meta": { + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "type": "Identifier", + "name": "new" + }, + "property": { + "range": [ + 23, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "type": "Identifier", + "name": "target" + } + }, + "arguments": [] + } + } + ] + }, + "generator": false, + "expression": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "new", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "target", + "range": [ + 23, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +} diff --git a/lib/test/esprima/ES6/meta-property/new-target-precedence.js b/lib/test/esprima/ES6/meta-property/new-target-precedence.js new file mode 100644 index 0000000..d5dded3 --- /dev/null +++ b/lib/test/esprima/ES6/meta-property/new-target-precedence.js @@ -0,0 +1,3 @@ +function f() { + new new.target()(); +} diff --git a/lib/test/esprima/ES6/meta-property/new-target-precedence.tree.json b/lib/test/esprima/ES6/meta-property/new-target-precedence.tree.json new file mode 100644 index 0000000..758d2e1 --- /dev/null +++ b/lib/test/esprima/ES6/meta-property/new-target-precedence.tree.json @@ -0,0 +1,455 @@ +{ + "range": [ + 0, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "type": "Program", + "body": [ + { + "range": [ + 0, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Identifier", + "name": "f" + }, + "params": [], + "body": { + "range": [ + 13, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 19, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 19, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "type": "CallExpression", + "callee": { + "range": [ + 19, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "type": "NewExpression", + "callee": { + "range": [ + 23, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "type": "MetaProperty", + "meta": { + "range": [ + 23, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "type": "Identifier", + "name": "new" + }, + "property": { + "range": [ + 27, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "type": "Identifier", + "name": "target" + } + }, + "arguments": [] + }, + "arguments": [] + } + } + ] + }, + "generator": false, + "expression": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "new", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Keyword", + "value": "new", + "range": [ + 23, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "target", + "range": [ + 27, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +} diff --git a/lib/test/esprima/ES6/meta-property/unknown-property.failure.json b/lib/test/esprima/ES6/meta-property/unknown-property.failure.json new file mode 100644 index 0000000..156aff6 --- /dev/null +++ b/lib/test/esprima/ES6/meta-property/unknown-property.failure.json @@ -0,0 +1 @@ +{"index":25,"lineNumber":1,"column":26,"message":"Error: Line 1: Unexpected identifier","description":"Unexpected identifier"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/meta-property/unknown-property.js b/lib/test/esprima/ES6/meta-property/unknown-property.js new file mode 100644 index 0000000..dc1b123 --- /dev/null +++ b/lib/test/esprima/ES6/meta-property/unknown-property.js @@ -0,0 +1 @@ +var f = function() { new.unknown_property; } diff --git a/lib/test/esprima/ES6/method-definition/migrated_0000.js b/lib/test/esprima/ES6/method-definition/migrated_0000.js new file mode 100644 index 0000000..8cdb9f6 --- /dev/null +++ b/lib/test/esprima/ES6/method-definition/migrated_0000.js @@ -0,0 +1 @@ +x = { method() { } } \ No newline at end of file diff --git a/lib/test/esprima/ES6/method-definition/migrated_0000.tree.json b/lib/test/esprima/ES6/method-definition/migrated_0000.tree.json new file mode 100644 index 0000000..ba6f190 --- /dev/null +++ b/lib/test/esprima/ES6/method-definition/migrated_0000.tree.json @@ -0,0 +1,334 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "method", + "range": [ + 6, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 12, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "kind": "init", + "method": true, + "shorthand": false, + "range": [ + 6, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "range": [ + 4, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "method", + "range": [ + 6, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } +} diff --git a/lib/test/esprima/ES6/method-definition/migrated_0001.js b/lib/test/esprima/ES6/method-definition/migrated_0001.js new file mode 100644 index 0000000..d9f061e --- /dev/null +++ b/lib/test/esprima/ES6/method-definition/migrated_0001.js @@ -0,0 +1 @@ +x = { method(test) { } } \ No newline at end of file diff --git a/lib/test/esprima/ES6/method-definition/migrated_0001.tree.json b/lib/test/esprima/ES6/method-definition/migrated_0001.tree.json new file mode 100644 index 0000000..39e5f9e --- /dev/null +++ b/lib/test/esprima/ES6/method-definition/migrated_0001.tree.json @@ -0,0 +1,371 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "method", + "range": [ + 6, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "test", + "range": [ + 13, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 12, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "kind": "init", + "method": true, + "shorthand": false, + "range": [ + 6, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "range": [ + 4, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "method", + "range": [ + 6, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "test", + "range": [ + 13, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } +} diff --git a/lib/test/esprima/ES6/method-definition/migrated_0002.js b/lib/test/esprima/ES6/method-definition/migrated_0002.js new file mode 100644 index 0000000..f6f5dad --- /dev/null +++ b/lib/test/esprima/ES6/method-definition/migrated_0002.js @@ -0,0 +1 @@ +x = { 'method'() { } } \ No newline at end of file diff --git a/lib/test/esprima/ES6/method-definition/migrated_0002.tree.json b/lib/test/esprima/ES6/method-definition/migrated_0002.tree.json new file mode 100644 index 0000000..840d131 --- /dev/null +++ b/lib/test/esprima/ES6/method-definition/migrated_0002.tree.json @@ -0,0 +1,335 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Literal", + "value": "method", + "raw": "'method'", + "range": [ + 6, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 14, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "kind": "init", + "method": true, + "shorthand": false, + "range": [ + 6, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "range": [ + 4, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "String", + "value": "'method'", + "range": [ + 6, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } +} diff --git a/lib/test/esprima/ES6/method-definition/migrated_0003.js b/lib/test/esprima/ES6/method-definition/migrated_0003.js new file mode 100644 index 0000000..a9a9124 --- /dev/null +++ b/lib/test/esprima/ES6/method-definition/migrated_0003.js @@ -0,0 +1 @@ +x = { get() { } } \ No newline at end of file diff --git a/lib/test/esprima/ES6/method-definition/migrated_0003.tree.json b/lib/test/esprima/ES6/method-definition/migrated_0003.tree.json new file mode 100644 index 0000000..883806d --- /dev/null +++ b/lib/test/esprima/ES6/method-definition/migrated_0003.tree.json @@ -0,0 +1,334 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "get", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 12, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 9, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "kind": "init", + "method": true, + "shorthand": false, + "range": [ + 6, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 4, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "get", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } +} diff --git a/lib/test/esprima/ES6/method-definition/migrated_0004.js b/lib/test/esprima/ES6/method-definition/migrated_0004.js new file mode 100644 index 0000000..04ca8c7 --- /dev/null +++ b/lib/test/esprima/ES6/method-definition/migrated_0004.js @@ -0,0 +1 @@ +x = { set() { } } \ No newline at end of file diff --git a/lib/test/esprima/ES6/method-definition/migrated_0004.tree.json b/lib/test/esprima/ES6/method-definition/migrated_0004.tree.json new file mode 100644 index 0000000..19b4d92 --- /dev/null +++ b/lib/test/esprima/ES6/method-definition/migrated_0004.tree.json @@ -0,0 +1,334 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "set", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 12, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 9, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "kind": "init", + "method": true, + "shorthand": false, + "range": [ + 6, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 4, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "set", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } +} diff --git a/lib/test/esprima/ES6/object-initialiser/invalid-proto-getter-literal-identifier.failure.json b/lib/test/esprima/ES6/object-initialiser/invalid-proto-getter-literal-identifier.failure.json new file mode 100644 index 0000000..456f3f8 --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/invalid-proto-getter-literal-identifier.failure.json @@ -0,0 +1 @@ +{"index":48,"lineNumber":1,"column":49,"message":"Error: Line 1: Duplicate __proto__ fields are not allowed in object literals","description":"Duplicate __proto__ fields are not allowed in object literals"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/object-initialiser/invalid-proto-getter-literal-identifier.js b/lib/test/esprima/ES6/object-initialiser/invalid-proto-getter-literal-identifier.js new file mode 100644 index 0000000..3f9966f --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/invalid-proto-getter-literal-identifier.js @@ -0,0 +1 @@ +({ get __proto(){}, "__proto__": null, __proto__: null, }) diff --git a/lib/test/esprima/ES6/object-initialiser/invalid-proto-identifier-literal.failure.json b/lib/test/esprima/ES6/object-initialiser/invalid-proto-identifier-literal.failure.json new file mode 100644 index 0000000..364d8fb --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/invalid-proto-identifier-literal.failure.json @@ -0,0 +1 @@ +{"index":31,"lineNumber":1,"column":32,"message":"Error: Line 1: Duplicate __proto__ fields are not allowed in object literals","description":"Duplicate __proto__ fields are not allowed in object literals"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/object-initialiser/invalid-proto-identifier-literal.js b/lib/test/esprima/ES6/object-initialiser/invalid-proto-identifier-literal.js new file mode 100644 index 0000000..e399af6 --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/invalid-proto-identifier-literal.js @@ -0,0 +1 @@ +({ __proto__: null, "__proto__": null }) diff --git a/lib/test/esprima/ES6/object-initialiser/invalid-proto-identifier-shorthand.failure.json b/lib/test/esprima/ES6/object-initialiser/invalid-proto-identifier-shorthand.failure.json new file mode 100644 index 0000000..4c4fec3 --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/invalid-proto-identifier-shorthand.failure.json @@ -0,0 +1 @@ +{"index":29,"lineNumber":1,"column":30,"message":"Error: Line 1: Duplicate __proto__ fields are not allowed in object literals","description":"Duplicate __proto__ fields are not allowed in object literals"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/object-initialiser/invalid-proto-identifier-shorthand.js b/lib/test/esprima/ES6/object-initialiser/invalid-proto-identifier-shorthand.js new file mode 100644 index 0000000..c62a4ce --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/invalid-proto-identifier-shorthand.js @@ -0,0 +1 @@ +({ __proto__: null, __proto__ }) diff --git a/lib/test/esprima/ES6/object-initialiser/invalid-proto-identifiers.failure.json b/lib/test/esprima/ES6/object-initialiser/invalid-proto-identifiers.failure.json new file mode 100644 index 0000000..4c4fec3 --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/invalid-proto-identifiers.failure.json @@ -0,0 +1 @@ +{"index":29,"lineNumber":1,"column":30,"message":"Error: Line 1: Duplicate __proto__ fields are not allowed in object literals","description":"Duplicate __proto__ fields are not allowed in object literals"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/object-initialiser/invalid-proto-identifiers.js b/lib/test/esprima/ES6/object-initialiser/invalid-proto-identifiers.js new file mode 100644 index 0000000..112b5ff --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/invalid-proto-identifiers.js @@ -0,0 +1 @@ +({ __proto__: null, __proto__: null }) diff --git a/lib/test/esprima/ES6/object-initialiser/invalid-proto-literal-identifier.failure.json b/lib/test/esprima/ES6/object-initialiser/invalid-proto-literal-identifier.failure.json new file mode 100644 index 0000000..364d8fb --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/invalid-proto-literal-identifier.failure.json @@ -0,0 +1 @@ +{"index":31,"lineNumber":1,"column":32,"message":"Error: Line 1: Duplicate __proto__ fields are not allowed in object literals","description":"Duplicate __proto__ fields are not allowed in object literals"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/object-initialiser/invalid-proto-literal-identifier.js b/lib/test/esprima/ES6/object-initialiser/invalid-proto-literal-identifier.js new file mode 100644 index 0000000..4e890f9 --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/invalid-proto-literal-identifier.js @@ -0,0 +1 @@ +({ "__proto__": null, __proto__: null }) diff --git a/lib/test/esprima/ES6/object-initialiser/invalid-proto-literal-shorthand.failure.json b/lib/test/esprima/ES6/object-initialiser/invalid-proto-literal-shorthand.failure.json new file mode 100644 index 0000000..364d8fb --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/invalid-proto-literal-shorthand.failure.json @@ -0,0 +1 @@ +{"index":31,"lineNumber":1,"column":32,"message":"Error: Line 1: Duplicate __proto__ fields are not allowed in object literals","description":"Duplicate __proto__ fields are not allowed in object literals"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/object-initialiser/invalid-proto-literal-shorthand.js b/lib/test/esprima/ES6/object-initialiser/invalid-proto-literal-shorthand.js new file mode 100644 index 0000000..2972018 --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/invalid-proto-literal-shorthand.js @@ -0,0 +1 @@ +({ "__proto__": null, __proto__ }) diff --git a/lib/test/esprima/ES6/object-initialiser/invalid-proto-literals.failure.json b/lib/test/esprima/ES6/object-initialiser/invalid-proto-literals.failure.json new file mode 100644 index 0000000..4b5429d --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/invalid-proto-literals.failure.json @@ -0,0 +1 @@ +{"index":33,"lineNumber":1,"column":34,"message":"Error: Line 1: Duplicate __proto__ fields are not allowed in object literals","description":"Duplicate __proto__ fields are not allowed in object literals"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/object-initialiser/invalid-proto-literals.js b/lib/test/esprima/ES6/object-initialiser/invalid-proto-literals.js new file mode 100644 index 0000000..be94b24 --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/invalid-proto-literals.js @@ -0,0 +1 @@ +({ "__proto__": null, '__proto__': null }) diff --git a/lib/test/esprima/ES6/object-initialiser/invalid-proto-setter-literal-identifier.failure.json b/lib/test/esprima/ES6/object-initialiser/invalid-proto-setter-literal-identifier.failure.json new file mode 100644 index 0000000..a56f66b --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/invalid-proto-setter-literal-identifier.failure.json @@ -0,0 +1 @@ +{"index":51,"lineNumber":1,"column":52,"message":"Error: Line 1: Duplicate __proto__ fields are not allowed in object literals","description":"Duplicate __proto__ fields are not allowed in object literals"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/object-initialiser/invalid-proto-setter-literal-identifier.js b/lib/test/esprima/ES6/object-initialiser/invalid-proto-setter-literal-identifier.js new file mode 100644 index 0000000..0d07da8 --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/invalid-proto-setter-literal-identifier.js @@ -0,0 +1 @@ +({ set __proto__(x){}, "__proto__": null, __proto__: null, }) diff --git a/lib/test/esprima/ES6/object-initialiser/invalid-proto-shorthand-identifier.failure.json b/lib/test/esprima/ES6/object-initialiser/invalid-proto-shorthand-identifier.failure.json new file mode 100644 index 0000000..584f92b --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/invalid-proto-shorthand-identifier.failure.json @@ -0,0 +1 @@ +{"index":23,"lineNumber":1,"column":24,"message":"Error: Line 1: Duplicate __proto__ fields are not allowed in object literals","description":"Duplicate __proto__ fields are not allowed in object literals"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/object-initialiser/invalid-proto-shorthand-identifier.js b/lib/test/esprima/ES6/object-initialiser/invalid-proto-shorthand-identifier.js new file mode 100644 index 0000000..9cf6d27 --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/invalid-proto-shorthand-identifier.js @@ -0,0 +1 @@ +({ __proto__, __proto__: null }) diff --git a/lib/test/esprima/ES6/object-initialiser/invalid-proto-shorthand-literal.failure.json b/lib/test/esprima/ES6/object-initialiser/invalid-proto-shorthand-literal.failure.json new file mode 100644 index 0000000..8e61908 --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/invalid-proto-shorthand-literal.failure.json @@ -0,0 +1 @@ +{"index":25,"lineNumber":1,"column":26,"message":"Error: Line 1: Duplicate __proto__ fields are not allowed in object literals","description":"Duplicate __proto__ fields are not allowed in object literals"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/object-initialiser/invalid-proto-shorthand-literal.js b/lib/test/esprima/ES6/object-initialiser/invalid-proto-shorthand-literal.js new file mode 100644 index 0000000..898082c --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/invalid-proto-shorthand-literal.js @@ -0,0 +1 @@ +({ __proto__, "__proto__": null }) diff --git a/lib/test/esprima/ES6/object-initialiser/invalid-proto-shorthands.failure.json b/lib/test/esprima/ES6/object-initialiser/invalid-proto-shorthands.failure.json new file mode 100644 index 0000000..584f92b --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/invalid-proto-shorthands.failure.json @@ -0,0 +1 @@ +{"index":23,"lineNumber":1,"column":24,"message":"Error: Line 1: Duplicate __proto__ fields are not allowed in object literals","description":"Duplicate __proto__ fields are not allowed in object literals"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/object-initialiser/invalid-proto-shorthands.js b/lib/test/esprima/ES6/object-initialiser/invalid-proto-shorthands.js new file mode 100644 index 0000000..785615c --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/invalid-proto-shorthands.js @@ -0,0 +1 @@ +({ __proto__, __proto__ }) diff --git a/lib/test/esprima/ES6/object-initialiser/proto-identifier-getter-setter.js b/lib/test/esprima/ES6/object-initialiser/proto-identifier-getter-setter.js new file mode 100644 index 0000000..a3741bf --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/proto-identifier-getter-setter.js @@ -0,0 +1 @@ +({ __proto__: null, get __proto__(){}, set __proto__(x){} }) diff --git a/lib/test/esprima/ES6/object-initialiser/proto-identifier-getter-setter.tree.json b/lib/test/esprima/ES6/object-initialiser/proto-identifier-getter-setter.tree.json new file mode 100644 index 0000000..606d928 --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/proto-identifier-getter-setter.tree.json @@ -0,0 +1,687 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 60 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 60 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 1, + 59 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "type": "ObjectExpression", + "properties": [ + { + "range": [ + 3, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "Property", + "key": { + "range": [ + 3, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "Identifier", + "name": "__proto__" + }, + "computed": false, + "value": { + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "Literal", + "value": null, + "raw": "null" + }, + "kind": "init", + "method": false, + "shorthand": false + }, + { + "range": [ + 20, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "type": "Property", + "key": { + "range": [ + 24, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "type": "Identifier", + "name": "__proto__" + }, + "computed": false, + "value": { + "range": [ + 33, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "range": [ + 35, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false + }, + "kind": "get", + "method": false, + "shorthand": false + }, + { + "range": [ + 39, + 57 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "type": "Property", + "key": { + "range": [ + 43, + 52 + ], + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "type": "Identifier", + "name": "__proto__" + }, + "computed": false, + "value": { + "range": [ + 52, + 57 + ], + "loc": { + "start": { + "line": 1, + "column": 52 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [ + { + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "type": "Identifier", + "name": "x" + } + ], + "body": { + "range": [ + 55, + 57 + ], + "loc": { + "start": { + "line": 1, + "column": 55 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false + }, + "kind": "set", + "method": false, + "shorthand": false + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "__proto__", + "range": [ + 3, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Null", + "value": "null", + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "get", + "range": [ + 20, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "__proto__", + "range": [ + 24, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Identifier", + "value": "set", + "range": [ + 39, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + { + "type": "Identifier", + "value": "__proto__", + "range": [ + 43, + 52 + ], + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 52 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 52 + }, + "end": { + "line": 1, + "column": 53 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 54 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 55 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 55 + }, + "end": { + "line": 1, + "column": 56 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 1, + "column": 56 + }, + "end": { + "line": 1, + "column": 57 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 1, + "column": 58 + }, + "end": { + "line": 1, + "column": 59 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 59, + 60 + ], + "loc": { + "start": { + "line": 1, + "column": 59 + }, + "end": { + "line": 1, + "column": 60 + } + } + } + ], + "range": [ + 0, + 60 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 60 + } + } +} diff --git a/lib/test/esprima/ES6/object-initialiser/proto-identifier-getter.js b/lib/test/esprima/ES6/object-initialiser/proto-identifier-getter.js new file mode 100644 index 0000000..b98cb5a --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/proto-identifier-getter.js @@ -0,0 +1 @@ +({ __proto__: null, get __proto__(){} }) diff --git a/lib/test/esprima/ES6/object-initialiser/proto-identifier-getter.tree.json b/lib/test/esprima/ES6/object-initialiser/proto-identifier-getter.tree.json new file mode 100644 index 0000000..7ad33ac --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/proto-identifier-getter.tree.json @@ -0,0 +1,446 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 1, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "type": "ObjectExpression", + "properties": [ + { + "range": [ + 3, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "Property", + "key": { + "range": [ + 3, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "Identifier", + "name": "__proto__" + }, + "computed": false, + "value": { + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "Literal", + "value": null, + "raw": "null" + }, + "kind": "init", + "method": false, + "shorthand": false + }, + { + "range": [ + 20, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "type": "Property", + "key": { + "range": [ + 24, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "type": "Identifier", + "name": "__proto__" + }, + "computed": false, + "value": { + "range": [ + 33, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "range": [ + 35, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false + }, + "kind": "get", + "method": false, + "shorthand": false + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "__proto__", + "range": [ + 3, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Null", + "value": "null", + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "get", + "range": [ + 20, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "__proto__", + "range": [ + 24, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + } + ], + "range": [ + 0, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + } +} diff --git a/lib/test/esprima/ES6/object-initialiser/proto-identifier-method.js b/lib/test/esprima/ES6/object-initialiser/proto-identifier-method.js new file mode 100644 index 0000000..b886d6e --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/proto-identifier-method.js @@ -0,0 +1 @@ +({ __proto__: null, __proto__(){}, }) diff --git a/lib/test/esprima/ES6/object-initialiser/proto-identifier-method.tree.json b/lib/test/esprima/ES6/object-initialiser/proto-identifier-method.tree.json new file mode 100644 index 0000000..5af84a6 --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/proto-identifier-method.tree.json @@ -0,0 +1,446 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 1, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "type": "ObjectExpression", + "properties": [ + { + "range": [ + 3, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "Property", + "key": { + "range": [ + 3, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "Identifier", + "name": "__proto__" + }, + "computed": false, + "value": { + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "Literal", + "value": null, + "raw": "null" + }, + "kind": "init", + "method": false, + "shorthand": false + }, + { + "range": [ + 20, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "type": "Property", + "key": { + "range": [ + 20, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "type": "Identifier", + "name": "__proto__" + }, + "computed": false, + "value": { + "range": [ + 29, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "range": [ + 31, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false + }, + "kind": "init", + "method": true, + "shorthand": false + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "__proto__", + "range": [ + 3, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Null", + "value": "null", + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "__proto__", + "range": [ + 20, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + ], + "range": [ + 0, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + } +} diff --git a/lib/test/esprima/ES6/object-initialiser/proto-identifier-setter.js b/lib/test/esprima/ES6/object-initialiser/proto-identifier-setter.js new file mode 100644 index 0000000..4336620 --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/proto-identifier-setter.js @@ -0,0 +1 @@ +({ __proto__: null, set __proto__(x){} }) diff --git a/lib/test/esprima/ES6/object-initialiser/proto-identifier-setter.tree.json b/lib/test/esprima/ES6/object-initialiser/proto-identifier-setter.tree.json new file mode 100644 index 0000000..d5930f1 --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/proto-identifier-setter.tree.json @@ -0,0 +1,483 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 1, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "type": "ObjectExpression", + "properties": [ + { + "range": [ + 3, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "Property", + "key": { + "range": [ + 3, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "Identifier", + "name": "__proto__" + }, + "computed": false, + "value": { + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "Literal", + "value": null, + "raw": "null" + }, + "kind": "init", + "method": false, + "shorthand": false + }, + { + "range": [ + 20, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "type": "Property", + "key": { + "range": [ + 24, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "type": "Identifier", + "name": "__proto__" + }, + "computed": false, + "value": { + "range": [ + 33, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [ + { + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "type": "Identifier", + "name": "x" + } + ], + "body": { + "range": [ + 36, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false + }, + "kind": "set", + "method": false, + "shorthand": false + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "__proto__", + "range": [ + 3, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Null", + "value": "null", + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "set", + "range": [ + 20, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "__proto__", + "range": [ + 24, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + } + ], + "range": [ + 0, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + } +} diff --git a/lib/test/esprima/ES6/object-initialiser/proto-literal-getter-setter.js b/lib/test/esprima/ES6/object-initialiser/proto-literal-getter-setter.js new file mode 100644 index 0000000..08c6ed2 --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/proto-literal-getter-setter.js @@ -0,0 +1 @@ +({ "__proto__": null, get __proto__(){}, set __proto__(x){} }) diff --git a/lib/test/esprima/ES6/object-initialiser/proto-literal-getter-setter.tree.json b/lib/test/esprima/ES6/object-initialiser/proto-literal-getter-setter.tree.json new file mode 100644 index 0000000..b93bd12 --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/proto-literal-getter-setter.tree.json @@ -0,0 +1,688 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 62 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 62 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 1, + 61 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "type": "ObjectExpression", + "properties": [ + { + "range": [ + 3, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "Property", + "key": { + "range": [ + 3, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Literal", + "value": "__proto__", + "raw": "\"__proto__\"" + }, + "computed": false, + "value": { + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "Literal", + "value": null, + "raw": "null" + }, + "kind": "init", + "method": false, + "shorthand": false + }, + { + "range": [ + 22, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "type": "Property", + "key": { + "range": [ + 26, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "type": "Identifier", + "name": "__proto__" + }, + "computed": false, + "value": { + "range": [ + 35, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "range": [ + 37, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false + }, + "kind": "get", + "method": false, + "shorthand": false + }, + { + "range": [ + 41, + 59 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "type": "Property", + "key": { + "range": [ + 45, + 54 + ], + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "type": "Identifier", + "name": "__proto__" + }, + "computed": false, + "value": { + "range": [ + 54, + 59 + ], + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [ + { + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 55 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "type": "Identifier", + "name": "x" + } + ], + "body": { + "range": [ + 57, + 59 + ], + "loc": { + "start": { + "line": 1, + "column": 57 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false + }, + "kind": "set", + "method": false, + "shorthand": false + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "String", + "value": "\"__proto__\"", + "range": [ + 3, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Null", + "value": "null", + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "get", + "range": [ + 22, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "__proto__", + "range": [ + 26, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + { + "type": "Identifier", + "value": "set", + "range": [ + 41, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + { + "type": "Identifier", + "value": "__proto__", + "range": [ + 45, + 54 + ], + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 54 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 55 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 55 + }, + "end": { + "line": 1, + "column": 56 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 1, + "column": 56 + }, + "end": { + "line": 1, + "column": 57 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 57, + 58 + ], + "loc": { + "start": { + "line": 1, + "column": 57 + }, + "end": { + "line": 1, + "column": 58 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 1, + "column": 58 + }, + "end": { + "line": 1, + "column": 59 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 60, + 61 + ], + "loc": { + "start": { + "line": 1, + "column": 60 + }, + "end": { + "line": 1, + "column": 61 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 61, + 62 + ], + "loc": { + "start": { + "line": 1, + "column": 61 + }, + "end": { + "line": 1, + "column": 62 + } + } + } + ], + "range": [ + 0, + 62 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 62 + } + } +} diff --git a/lib/test/esprima/ES6/object-initialiser/proto-literal-getter.js b/lib/test/esprima/ES6/object-initialiser/proto-literal-getter.js new file mode 100644 index 0000000..b0496bd --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/proto-literal-getter.js @@ -0,0 +1 @@ +({ "__proto__": null, get __proto__(){} }) diff --git a/lib/test/esprima/ES6/object-initialiser/proto-literal-getter.tree.json b/lib/test/esprima/ES6/object-initialiser/proto-literal-getter.tree.json new file mode 100644 index 0000000..088a326 --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/proto-literal-getter.tree.json @@ -0,0 +1,447 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 1, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "type": "ObjectExpression", + "properties": [ + { + "range": [ + 3, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "Property", + "key": { + "range": [ + 3, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Literal", + "value": "__proto__", + "raw": "\"__proto__\"" + }, + "computed": false, + "value": { + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "Literal", + "value": null, + "raw": "null" + }, + "kind": "init", + "method": false, + "shorthand": false + }, + { + "range": [ + 22, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "type": "Property", + "key": { + "range": [ + 26, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "type": "Identifier", + "name": "__proto__" + }, + "computed": false, + "value": { + "range": [ + 35, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "range": [ + 37, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false + }, + "kind": "get", + "method": false, + "shorthand": false + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "String", + "value": "\"__proto__\"", + "range": [ + 3, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Null", + "value": "null", + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "get", + "range": [ + 22, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "__proto__", + "range": [ + 26, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + } + ], + "range": [ + 0, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + } +} diff --git a/lib/test/esprima/ES6/object-initialiser/proto-literal-method.js b/lib/test/esprima/ES6/object-initialiser/proto-literal-method.js new file mode 100644 index 0000000..9aaf992 --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/proto-literal-method.js @@ -0,0 +1 @@ +({ "__proto__": null, __proto__(){}, }) diff --git a/lib/test/esprima/ES6/object-initialiser/proto-literal-method.tree.json b/lib/test/esprima/ES6/object-initialiser/proto-literal-method.tree.json new file mode 100644 index 0000000..fff9c09 --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/proto-literal-method.tree.json @@ -0,0 +1,447 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 1, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "type": "ObjectExpression", + "properties": [ + { + "range": [ + 3, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "Property", + "key": { + "range": [ + 3, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Literal", + "value": "__proto__", + "raw": "\"__proto__\"" + }, + "computed": false, + "value": { + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "Literal", + "value": null, + "raw": "null" + }, + "kind": "init", + "method": false, + "shorthand": false + }, + { + "range": [ + 22, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "type": "Property", + "key": { + "range": [ + 22, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "type": "Identifier", + "name": "__proto__" + }, + "computed": false, + "value": { + "range": [ + 31, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "range": [ + 33, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false + }, + "kind": "init", + "method": true, + "shorthand": false + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "String", + "value": "\"__proto__\"", + "range": [ + 3, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Null", + "value": "null", + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "__proto__", + "range": [ + 22, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + } + ], + "range": [ + 0, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + } +} diff --git a/lib/test/esprima/ES6/object-initialiser/proto-literal-setter.js b/lib/test/esprima/ES6/object-initialiser/proto-literal-setter.js new file mode 100644 index 0000000..4481cb5 --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/proto-literal-setter.js @@ -0,0 +1 @@ +({ "__proto__": null, set __proto__(x){} }) diff --git a/lib/test/esprima/ES6/object-initialiser/proto-literal-setter.tree.json b/lib/test/esprima/ES6/object-initialiser/proto-literal-setter.tree.json new file mode 100644 index 0000000..0374202 --- /dev/null +++ b/lib/test/esprima/ES6/object-initialiser/proto-literal-setter.tree.json @@ -0,0 +1,484 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 1, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "type": "ObjectExpression", + "properties": [ + { + "range": [ + 3, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "Property", + "key": { + "range": [ + 3, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Literal", + "value": "__proto__", + "raw": "\"__proto__\"" + }, + "computed": false, + "value": { + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "Literal", + "value": null, + "raw": "null" + }, + "kind": "init", + "method": false, + "shorthand": false + }, + { + "range": [ + 22, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "type": "Property", + "key": { + "range": [ + 26, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "type": "Identifier", + "name": "__proto__" + }, + "computed": false, + "value": { + "range": [ + 35, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [ + { + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "type": "Identifier", + "name": "x" + } + ], + "body": { + "range": [ + 38, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false + }, + "kind": "set", + "method": false, + "shorthand": false + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "String", + "value": "\"__proto__\"", + "range": [ + 3, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Null", + "value": "null", + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "set", + "range": [ + 22, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "__proto__", + "range": [ + 26, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + } + } + } + ], + "range": [ + 0, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + } +} diff --git a/lib/test/esprima/ES6/object-literal-property-value-shorthand/migrated_0000.js b/lib/test/esprima/ES6/object-literal-property-value-shorthand/migrated_0000.js new file mode 100644 index 0000000..fec7eb0 --- /dev/null +++ b/lib/test/esprima/ES6/object-literal-property-value-shorthand/migrated_0000.js @@ -0,0 +1 @@ +x = { y, z } \ No newline at end of file diff --git a/lib/test/esprima/ES6/object-literal-property-value-shorthand/migrated_0000.tree.json b/lib/test/esprima/ES6/object-literal-property-value-shorthand/migrated_0000.tree.json new file mode 100644 index 0000000..d45e1ca --- /dev/null +++ b/lib/test/esprima/ES6/object-literal-property-value-shorthand/migrated_0000.tree.json @@ -0,0 +1,334 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "y", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "computed": false, + "value": { + "type": "Identifier", + "name": "y", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "kind": "init", + "method": false, + "shorthand": true, + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "z", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "computed": false, + "value": { + "type": "Identifier", + "name": "z", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "kind": "init", + "method": false, + "shorthand": true, + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "range": [ + 4, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } +} diff --git a/lib/test/esprima/ES6/octal-integer-literal/migrated_0000.js b/lib/test/esprima/ES6/octal-integer-literal/migrated_0000.js new file mode 100644 index 0000000..857f065 --- /dev/null +++ b/lib/test/esprima/ES6/octal-integer-literal/migrated_0000.js @@ -0,0 +1 @@ +00 \ No newline at end of file diff --git a/lib/test/esprima/ES6/octal-integer-literal/migrated_0000.tree.json b/lib/test/esprima/ES6/octal-integer-literal/migrated_0000.tree.json new file mode 100644 index 0000000..51d4669 --- /dev/null +++ b/lib/test/esprima/ES6/octal-integer-literal/migrated_0000.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 0, + "raw": "00", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "00", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ], + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } +} diff --git a/lib/test/esprima/ES6/octal-integer-literal/migrated_0001.js b/lib/test/esprima/ES6/octal-integer-literal/migrated_0001.js new file mode 100644 index 0000000..e265ec4 --- /dev/null +++ b/lib/test/esprima/ES6/octal-integer-literal/migrated_0001.js @@ -0,0 +1 @@ +0o0 \ No newline at end of file diff --git a/lib/test/esprima/ES6/octal-integer-literal/migrated_0001.tree.json b/lib/test/esprima/ES6/octal-integer-literal/migrated_0001.tree.json new file mode 100644 index 0000000..5ee47fc --- /dev/null +++ b/lib/test/esprima/ES6/octal-integer-literal/migrated_0001.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 0, + "raw": "0o0", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "0o0", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } +} diff --git a/lib/test/esprima/ES6/octal-integer-literal/migrated_0002.js b/lib/test/esprima/ES6/octal-integer-literal/migrated_0002.js new file mode 100644 index 0000000..08dc817 --- /dev/null +++ b/lib/test/esprima/ES6/octal-integer-literal/migrated_0002.js @@ -0,0 +1 @@ +function test() {'use strict'; 0o0; } \ No newline at end of file diff --git a/lib/test/esprima/ES6/octal-integer-literal/migrated_0002.tree.json b/lib/test/esprima/ES6/octal-integer-literal/migrated_0002.tree.json new file mode 100644 index 0000000..65c71f8 --- /dev/null +++ b/lib/test/esprima/ES6/octal-integer-literal/migrated_0002.tree.json @@ -0,0 +1,332 @@ +{ + "type": "Program", + "body": [ + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "test", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "'use strict'", + "range": [ + 17, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "directive": "use strict", + "range": [ + 17, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 0, + "raw": "0o0", + "range": [ + 31, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 31, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "range": [ + 16, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 0, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "test", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "String", + "value": "'use strict'", + "range": [ + 17, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Numeric", + "value": "0o0", + "range": [ + 31, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + ], + "range": [ + 0, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + } +} diff --git a/lib/test/esprima/ES6/octal-integer-literal/migrated_0003.js b/lib/test/esprima/ES6/octal-integer-literal/migrated_0003.js new file mode 100644 index 0000000..82220cf --- /dev/null +++ b/lib/test/esprima/ES6/octal-integer-literal/migrated_0003.js @@ -0,0 +1 @@ +0o2 \ No newline at end of file diff --git a/lib/test/esprima/ES6/octal-integer-literal/migrated_0003.tree.json b/lib/test/esprima/ES6/octal-integer-literal/migrated_0003.tree.json new file mode 100644 index 0000000..89dd74f --- /dev/null +++ b/lib/test/esprima/ES6/octal-integer-literal/migrated_0003.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 2, + "raw": "0o2", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "0o2", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } +} diff --git a/lib/test/esprima/ES6/octal-integer-literal/migrated_0004.js b/lib/test/esprima/ES6/octal-integer-literal/migrated_0004.js new file mode 100644 index 0000000..2453a2c --- /dev/null +++ b/lib/test/esprima/ES6/octal-integer-literal/migrated_0004.js @@ -0,0 +1 @@ +0o12 \ No newline at end of file diff --git a/lib/test/esprima/ES6/octal-integer-literal/migrated_0004.tree.json b/lib/test/esprima/ES6/octal-integer-literal/migrated_0004.tree.json new file mode 100644 index 0000000..c49bee1 --- /dev/null +++ b/lib/test/esprima/ES6/octal-integer-literal/migrated_0004.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 10, + "raw": "0o12", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "0o12", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } +} diff --git a/lib/test/esprima/ES6/octal-integer-literal/migrated_0005.js b/lib/test/esprima/ES6/octal-integer-literal/migrated_0005.js new file mode 100644 index 0000000..4897cb5 --- /dev/null +++ b/lib/test/esprima/ES6/octal-integer-literal/migrated_0005.js @@ -0,0 +1 @@ +0O0 \ No newline at end of file diff --git a/lib/test/esprima/ES6/octal-integer-literal/migrated_0005.tree.json b/lib/test/esprima/ES6/octal-integer-literal/migrated_0005.tree.json new file mode 100644 index 0000000..a5fdb2b --- /dev/null +++ b/lib/test/esprima/ES6/octal-integer-literal/migrated_0005.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 0, + "raw": "0O0", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "0O0", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } +} diff --git a/lib/test/esprima/ES6/octal-integer-literal/migrated_0006.js b/lib/test/esprima/ES6/octal-integer-literal/migrated_0006.js new file mode 100644 index 0000000..1e41acb --- /dev/null +++ b/lib/test/esprima/ES6/octal-integer-literal/migrated_0006.js @@ -0,0 +1 @@ +function test() {'use strict'; 0O0; } \ No newline at end of file diff --git a/lib/test/esprima/ES6/octal-integer-literal/migrated_0006.tree.json b/lib/test/esprima/ES6/octal-integer-literal/migrated_0006.tree.json new file mode 100644 index 0000000..3796e01 --- /dev/null +++ b/lib/test/esprima/ES6/octal-integer-literal/migrated_0006.tree.json @@ -0,0 +1,332 @@ +{ + "type": "Program", + "body": [ + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "test", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "'use strict'", + "range": [ + 17, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "directive": "use strict", + "range": [ + 17, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 0, + "raw": "0O0", + "range": [ + 31, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 31, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "range": [ + 16, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 0, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "test", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "String", + "value": "'use strict'", + "range": [ + 17, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Numeric", + "value": "0O0", + "range": [ + 31, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + ], + "range": [ + 0, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + } +} diff --git a/lib/test/esprima/ES6/rest-parameter/function-declaration.js b/lib/test/esprima/ES6/rest-parameter/function-declaration.js new file mode 100644 index 0000000..acdeb20 --- /dev/null +++ b/lib/test/esprima/ES6/rest-parameter/function-declaration.js @@ -0,0 +1 @@ +function f(a, ...b) {} \ No newline at end of file diff --git a/lib/test/esprima/ES6/rest-parameter/function-declaration.tree.json b/lib/test/esprima/ES6/rest-parameter/function-declaration.tree.json new file mode 100644 index 0000000..70f153a --- /dev/null +++ b/lib/test/esprima/ES6/rest-parameter/function-declaration.tree.json @@ -0,0 +1,312 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Identifier", + "name": "f" + }, + "params": [ + { + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "Identifier", + "name": "a" + }, + { + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "RestElement", + "argument": { + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "Identifier", + "name": "b" + } + } + ], + "body": { + "range": [ + 20, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } +} diff --git a/lib/test/esprima/ES6/rest-parameter/function-expression.js b/lib/test/esprima/ES6/rest-parameter/function-expression.js new file mode 100644 index 0000000..f8ceed4 --- /dev/null +++ b/lib/test/esprima/ES6/rest-parameter/function-expression.js @@ -0,0 +1 @@ +f = function(a, ...b) {} \ No newline at end of file diff --git a/lib/test/esprima/ES6/rest-parameter/function-expression.tree.json b/lib/test/esprima/ES6/rest-parameter/function-expression.tree.json new file mode 100644 index 0000000..a5d1259 --- /dev/null +++ b/lib/test/esprima/ES6/rest-parameter/function-expression.tree.json @@ -0,0 +1,366 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "type": "AssignmentExpression", + "operator": "=", + "left": { + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "type": "Identifier", + "name": "f" + }, + "right": { + "range": [ + 4, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [ + { + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Identifier", + "name": "a" + }, + { + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "RestElement", + "argument": { + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "Identifier", + "name": "b" + } + } + ], + "body": { + "range": [ + 22, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "f", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 4, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 16, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } +} diff --git a/lib/test/esprima/ES6/rest-parameter/object-method.js b/lib/test/esprima/ES6/rest-parameter/object-method.js new file mode 100644 index 0000000..6f9de7d --- /dev/null +++ b/lib/test/esprima/ES6/rest-parameter/object-method.js @@ -0,0 +1 @@ +o = { f: function(a, ...b) {} } \ No newline at end of file diff --git a/lib/test/esprima/ES6/rest-parameter/object-method.tree.json b/lib/test/esprima/ES6/rest-parameter/object-method.tree.json new file mode 100644 index 0000000..e9b4c16 --- /dev/null +++ b/lib/test/esprima/ES6/rest-parameter/object-method.tree.json @@ -0,0 +1,496 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "type": "AssignmentExpression", + "operator": "=", + "left": { + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "type": "Identifier", + "name": "o" + }, + "right": { + "range": [ + 4, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "type": "ObjectExpression", + "properties": [ + { + "range": [ + 6, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "type": "Property", + "key": { + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Identifier", + "name": "f" + }, + "computed": false, + "value": { + "range": [ + 9, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [ + { + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "type": "Identifier", + "name": "a" + }, + { + "range": [ + 21, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "RestElement", + "argument": { + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "Identifier", + "name": "b" + } + } + ], + "body": { + "range": [ + 27, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false + }, + "kind": "init", + "method": false, + "shorthand": false + } + ] + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "o", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 9, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } +} diff --git a/lib/test/esprima/ES6/rest-parameter/object-shorthand-method.js b/lib/test/esprima/ES6/rest-parameter/object-shorthand-method.js new file mode 100644 index 0000000..7b8fc76 --- /dev/null +++ b/lib/test/esprima/ES6/rest-parameter/object-shorthand-method.js @@ -0,0 +1 @@ +x = { method(...test) { } } \ No newline at end of file diff --git a/lib/test/esprima/ES6/rest-parameter/object-shorthand-method.tree.json b/lib/test/esprima/ES6/rest-parameter/object-shorthand-method.tree.json new file mode 100644 index 0000000..1cefefd --- /dev/null +++ b/lib/test/esprima/ES6/rest-parameter/object-shorthand-method.tree.json @@ -0,0 +1,406 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "type": "AssignmentExpression", + "operator": "=", + "left": { + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "type": "Identifier", + "name": "x" + }, + "right": { + "range": [ + 4, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "type": "ObjectExpression", + "properties": [ + { + "range": [ + 6, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "Property", + "key": { + "range": [ + 6, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "Identifier", + "name": "method" + }, + "computed": false, + "value": { + "range": [ + 12, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [ + { + "range": [ + 13, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "RestElement", + "argument": { + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "Identifier", + "name": "test" + } + } + ], + "body": { + "range": [ + 22, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false + }, + "kind": "init", + "method": true, + "shorthand": false + } + ] + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "method", + "range": [ + 6, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "test", + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + } +} diff --git a/lib/test/esprima/ES6/rest-property/assignment-with-trailing.js b/lib/test/esprima/ES6/rest-property/assignment-with-trailing.js new file mode 100644 index 0000000..848335a --- /dev/null +++ b/lib/test/esprima/ES6/rest-property/assignment-with-trailing.js @@ -0,0 +1 @@ +({...rest, p} = obj); diff --git a/lib/test/esprima/ES6/rest-property/assignment-with-trailing.tree.json b/lib/test/esprima/ES6/rest-property/assignment-with-trailing.tree.json new file mode 100644 index 0000000..8a98dbb --- /dev/null +++ b/lib/test/esprima/ES6/rest-property/assignment-with-trailing.tree.json @@ -0,0 +1,67 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":9}}, + "message":"Rest property must be final property of an object pattern" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":19}}, + "range":[1,19], + "operator":"=", + "left":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":13}}, + "range":[1,13], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"p", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"p", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ], + "typeAnnotation":null + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":19}}, + "range":[16,19], + "name":"obj", + "typeAnnotation":null, + "optional":false + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/esprima/ES6/rest-property/assignment.diff b/lib/test/esprima/ES6/rest-property/assignment.diff new file mode 100644 index 0000000..3f3337a --- /dev/null +++ b/lib/test/esprima/ES6/rest-property/assignment.diff @@ -0,0 +1,15 @@ +{ + "body": { + "0": { + "expression": { + "left": { + "properties" : { + "0": { + "type": "RestElement" + } + } + } + } + } + } +} diff --git a/lib/test/esprima/ES6/rest-property/assignment.js b/lib/test/esprima/ES6/rest-property/assignment.js new file mode 100644 index 0000000..94acbd0 --- /dev/null +++ b/lib/test/esprima/ES6/rest-property/assignment.js @@ -0,0 +1 @@ +({...rest} = obj); diff --git a/lib/test/esprima/ES6/rest-property/assignment.tree.json b/lib/test/esprima/ES6/rest-property/assignment.tree.json new file mode 100644 index 0000000..bed9d10 --- /dev/null +++ b/lib/test/esprima/ES6/rest-property/assignment.tree.json @@ -0,0 +1,49 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":16}}, + "range":[1,16], + "operator":"=", + "left":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":10}}, + "range":[1,10], + "properties":[ + { + "type":"RestProperty", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":9}}, + "range":[2,9], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":9}}, + "range":[5,9], + "name":"rest", + "typeAnnotation":null, + "optional":false + } + } + ], + "typeAnnotation":null + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, + "range":[13,16], + "name":"obj", + "typeAnnotation":null, + "optional":false + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/esprima/ES6/rest-property/let-assignment-with-trailing-comma.diff b/lib/test/esprima/ES6/rest-property/let-assignment-with-trailing-comma.diff new file mode 100644 index 0000000..8fc793d --- /dev/null +++ b/lib/test/esprima/ES6/rest-property/let-assignment-with-trailing-comma.diff @@ -0,0 +1,28 @@ +{ + "body": { + "0": { + "declarations": { + "0": { + "id": { + "properties" : { + "0": { + "type": "RestElement" + } + } + } + } + } + }, + "1": { + "expression": { + "left": { + "properties" : { + "0": { + "type": "RestElement" + } + } + } + } + } + } +} diff --git a/lib/test/esprima/ES6/rest-property/let-assignment-with-trailing-comma.js b/lib/test/esprima/ES6/rest-property/let-assignment-with-trailing-comma.js new file mode 100644 index 0000000..975ea3c --- /dev/null +++ b/lib/test/esprima/ES6/rest-property/let-assignment-with-trailing-comma.js @@ -0,0 +1,2 @@ +let {...rest,} = obj; +({...rest,} = obj); diff --git a/lib/test/esprima/ES6/rest-property/let-assignment-with-trailing-comma.tree.json b/lib/test/esprima/ES6/rest-property/let-assignment-with-trailing-comma.tree.json new file mode 100644 index 0000000..2d05dcb --- /dev/null +++ b/lib/test/esprima/ES6/rest-property/let-assignment-with-trailing-comma.tree.json @@ -0,0 +1,101 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "message":"A trailing comma is not permitted after the rest element" + }, + { + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, + "message":"A trailing comma is not permitted after the rest element" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":19}}, + "range":[0,41], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":20}}, + "range":[4,20], + "id":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":14}}, + "range":[4,14], + "properties":[ + { + "type":"RestProperty", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, + "range":[5,12], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":12}}, + "range":[8,12], + "name":"rest", + "typeAnnotation":null, + "optional":false + } + } + ], + "typeAnnotation":null + }, + "init":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "name":"obj", + "typeAnnotation":null, + "optional":false + } + } + ], + "kind":"let" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":19}}, + "range":[22,41], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":2,"column":1},"end":{"line":2,"column":17}}, + "range":[23,39], + "operator":"=", + "left":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":2,"column":1},"end":{"line":2,"column":11}}, + "range":[23,33], + "properties":[ + { + "type":"RestProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "range":[24,31], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":9}}, + "range":[27,31], + "name":"rest", + "typeAnnotation":null, + "optional":false + } + } + ], + "typeAnnotation":null + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":17}}, + "range":[36,39], + "name":"obj", + "typeAnnotation":null, + "optional":false + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/esprima/ES6/rest-property/let-assignment-with-trailing.diff b/lib/test/esprima/ES6/rest-property/let-assignment-with-trailing.diff new file mode 100644 index 0000000..f580569 --- /dev/null +++ b/lib/test/esprima/ES6/rest-property/let-assignment-with-trailing.diff @@ -0,0 +1,17 @@ +{ + "body": { + "0": { + "declarations": { + "0": { + "id": { + "properties" : { + "0": { + "type": "RestElement" + } + } + } + } + } + } + } +} diff --git a/lib/test/esprima/ES6/rest-property/let-assignment-with-trailing.js b/lib/test/esprima/ES6/rest-property/let-assignment-with-trailing.js new file mode 100644 index 0000000..bc4e695 --- /dev/null +++ b/lib/test/esprima/ES6/rest-property/let-assignment-with-trailing.js @@ -0,0 +1,2 @@ +let {...rest, p} = obj; +({...rest, p} = obj); diff --git a/lib/test/esprima/ES6/rest-property/let-assignment-with-trailing.tree.json b/lib/test/esprima/ES6/rest-property/let-assignment-with-trailing.tree.json new file mode 100644 index 0000000..10cb8d9 --- /dev/null +++ b/lib/test/esprima/ES6/rest-property/let-assignment-with-trailing.tree.json @@ -0,0 +1,138 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "message":"Rest property must be final property of an object pattern" + }, + { + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "message":"Rest property must be final property of an object pattern" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":21}}, + "range":[0,45], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":22}}, + "range":[4,22], + "id":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, + "range":[4,16], + "properties":[ + { + "type":"RestProperty", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, + "range":[5,12], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":12}}, + "range":[8,12], + "name":"rest", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"p", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"p", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ], + "typeAnnotation":null + }, + "init":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, + "range":[19,22], + "name":"obj", + "typeAnnotation":null, + "optional":false + } + } + ], + "kind":"let" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":21}}, + "range":[24,45], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":2,"column":1},"end":{"line":2,"column":19}}, + "range":[25,43], + "operator":"=", + "left":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":2,"column":1},"end":{"line":2,"column":13}}, + "range":[25,37], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":12}}, + "range":[35,36], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":12}}, + "range":[35,36], + "name":"p", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":12}}, + "range":[35,36], + "name":"p", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ], + "typeAnnotation":null + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":19}}, + "range":[40,43], + "name":"obj", + "typeAnnotation":null, + "optional":false + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/esprima/ES6/rest-property/let-assignment.diff b/lib/test/esprima/ES6/rest-property/let-assignment.diff new file mode 100644 index 0000000..f580569 --- /dev/null +++ b/lib/test/esprima/ES6/rest-property/let-assignment.diff @@ -0,0 +1,17 @@ +{ + "body": { + "0": { + "declarations": { + "0": { + "id": { + "properties" : { + "0": { + "type": "RestElement" + } + } + } + } + } + } + } +} diff --git a/lib/test/esprima/ES6/rest-property/let-assignment.js b/lib/test/esprima/ES6/rest-property/let-assignment.js new file mode 100644 index 0000000..6398b67 --- /dev/null +++ b/lib/test/esprima/ES6/rest-property/let-assignment.js @@ -0,0 +1 @@ +let {...rest} = obj; diff --git a/lib/test/esprima/ES6/rest-property/let-assignment.tree.json b/lib/test/esprima/ES6/rest-property/let-assignment.tree.json new file mode 100644 index 0000000..d210c8e --- /dev/null +++ b/lib/test/esprima/ES6/rest-property/let-assignment.tree.json @@ -0,0 +1,50 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":19}}, + "range":[4,19], + "id":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, + "range":[4,13], + "properties":[ + { + "type":"RestProperty", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, + "range":[5,12], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":12}}, + "range":[8,12], + "name":"rest", + "typeAnnotation":null, + "optional":false + } + } + ], + "typeAnnotation":null + }, + "init":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":19}}, + "range":[16,19], + "name":"obj", + "typeAnnotation":null, + "optional":false + } + } + ], + "kind":"let" + } + ], + "comments":[] +} diff --git a/lib/test/esprima/ES6/spread-element/call-multi-spread.js b/lib/test/esprima/ES6/spread-element/call-multi-spread.js new file mode 100644 index 0000000..35ce3a2 --- /dev/null +++ b/lib/test/esprima/ES6/spread-element/call-multi-spread.js @@ -0,0 +1 @@ +f(...x, ...y, ...z); diff --git a/lib/test/esprima/ES6/spread-element/call-multi-spread.tree.json b/lib/test/esprima/ES6/spread-element/call-multi-spread.tree.json new file mode 100644 index 0000000..f457462 --- /dev/null +++ b/lib/test/esprima/ES6/spread-element/call-multi-spread.tree.json @@ -0,0 +1,397 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "type": "CallExpression", + "callee": { + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "type": "Identifier", + "name": "f" + }, + "arguments": [ + { + "range": [ + 2, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "SpreadElement", + "argument": { + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "Identifier", + "name": "x" + } + }, + { + "range": [ + 8, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "SpreadElement", + "argument": { + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "Identifier", + "name": "y" + } + }, + { + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "SpreadElement", + "argument": { + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "Identifier", + "name": "z" + } + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "f", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 2, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } +} diff --git a/lib/test/esprima/ES6/spread-element/call-spread-default.js b/lib/test/esprima/ES6/spread-element/call-spread-default.js new file mode 100644 index 0000000..66837c3 --- /dev/null +++ b/lib/test/esprima/ES6/spread-element/call-spread-default.js @@ -0,0 +1 @@ +f(g, ...h = i); diff --git a/lib/test/esprima/ES6/spread-element/call-spread-default.tree.json b/lib/test/esprima/ES6/spread-element/call-spread-default.tree.json new file mode 100644 index 0000000..7d7ae17 --- /dev/null +++ b/lib/test/esprima/ES6/spread-element/call-spread-default.tree.json @@ -0,0 +1,345 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "CallExpression", + "callee": { + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "type": "Identifier", + "name": "f" + }, + "arguments": [ + { + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "type": "Identifier", + "name": "g" + }, + { + "range": [ + 5, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "SpreadElement", + "argument": { + "range": [ + 8, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "AssignmentExpression", + "operator": "=", + "left": { + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "Identifier", + "name": "h" + }, + "right": { + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "Identifier", + "name": "i" + } + } + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "f", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "g", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "h", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "i", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } +} diff --git a/lib/test/esprima/ES6/spread-element/call-spread-first.js b/lib/test/esprima/ES6/spread-element/call-spread-first.js new file mode 100644 index 0000000..c6bb9ce --- /dev/null +++ b/lib/test/esprima/ES6/spread-element/call-spread-first.js @@ -0,0 +1 @@ +f(...x, y, z); diff --git a/lib/test/esprima/ES6/spread-element/call-spread-first.tree.json b/lib/test/esprima/ES6/spread-element/call-spread-first.tree.json new file mode 100644 index 0000000..751e1ad --- /dev/null +++ b/lib/test/esprima/ES6/spread-element/call-spread-first.tree.json @@ -0,0 +1,327 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "CallExpression", + "callee": { + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "type": "Identifier", + "name": "f" + }, + "arguments": [ + { + "range": [ + 2, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "SpreadElement", + "argument": { + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "Identifier", + "name": "x" + } + }, + { + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "Identifier", + "name": "y" + }, + { + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "Identifier", + "name": "z" + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "f", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 2, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } +} diff --git a/lib/test/esprima/ES6/spread-element/call-spread-number.js b/lib/test/esprima/ES6/spread-element/call-spread-number.js new file mode 100644 index 0000000..e97b23f --- /dev/null +++ b/lib/test/esprima/ES6/spread-element/call-spread-number.js @@ -0,0 +1 @@ +f(....5); diff --git a/lib/test/esprima/ES6/spread-element/call-spread-number.tree.json b/lib/test/esprima/ES6/spread-element/call-spread-number.tree.json new file mode 100644 index 0000000..50510e8 --- /dev/null +++ b/lib/test/esprima/ES6/spread-element/call-spread-number.tree.json @@ -0,0 +1,220 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "CallExpression", + "callee": { + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "type": "Identifier", + "name": "f" + }, + "arguments": [ + { + "range": [ + 2, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "SpreadElement", + "argument": { + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Literal", + "value": 0.5, + "raw": ".5" + } + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "f", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 2, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Numeric", + "value": ".5", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } +} diff --git a/lib/test/esprima/ES6/spread-element/call-spread.js b/lib/test/esprima/ES6/spread-element/call-spread.js new file mode 100644 index 0000000..95c689e --- /dev/null +++ b/lib/test/esprima/ES6/spread-element/call-spread.js @@ -0,0 +1 @@ +f(...g); diff --git a/lib/test/esprima/ES6/spread-element/call-spread.tree.json b/lib/test/esprima/ES6/spread-element/call-spread.tree.json new file mode 100644 index 0000000..c8ed3cb --- /dev/null +++ b/lib/test/esprima/ES6/spread-element/call-spread.tree.json @@ -0,0 +1,219 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "CallExpression", + "callee": { + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "type": "Identifier", + "name": "f" + }, + "arguments": [ + { + "range": [ + 2, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "SpreadElement", + "argument": { + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "Identifier", + "name": "g" + } + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "f", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 2, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "g", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } +} diff --git a/lib/test/esprima/ES6/spread-element/invalid-call-dot-dot.failure.json b/lib/test/esprima/ES6/spread-element/invalid-call-dot-dot.failure.json new file mode 100644 index 0000000..1f45ae8 --- /dev/null +++ b/lib/test/esprima/ES6/spread-element/invalid-call-dot-dot.failure.json @@ -0,0 +1 @@ +{"index":2,"lineNumber":1,"column":3,"message":"Error: Line 1: Unexpected token .","description":"Unexpected token ."} \ No newline at end of file diff --git a/lib/test/esprima/ES6/spread-element/invalid-call-dot-dot.js b/lib/test/esprima/ES6/spread-element/invalid-call-dot-dot.js new file mode 100644 index 0000000..893bd18 --- /dev/null +++ b/lib/test/esprima/ES6/spread-element/invalid-call-dot-dot.js @@ -0,0 +1 @@ +f(..g); diff --git a/lib/test/esprima/ES6/spread-element/invalid-call-dots.failure.json b/lib/test/esprima/ES6/spread-element/invalid-call-dots.failure.json new file mode 100644 index 0000000..03cd589 --- /dev/null +++ b/lib/test/esprima/ES6/spread-element/invalid-call-dots.failure.json @@ -0,0 +1 @@ +{"index":5,"lineNumber":1,"column":6,"message":"Error: Line 1: Unexpected token .","description":"Unexpected token ."} \ No newline at end of file diff --git a/lib/test/esprima/ES6/spread-element/invalid-call-dots.js b/lib/test/esprima/ES6/spread-element/invalid-call-dots.js new file mode 100644 index 0000000..70875a2 --- /dev/null +++ b/lib/test/esprima/ES6/spread-element/invalid-call-dots.js @@ -0,0 +1 @@ +f(....g); diff --git a/lib/test/esprima/ES6/spread-element/invalid-call-spreads.failure.json b/lib/test/esprima/ES6/spread-element/invalid-call-spreads.failure.json new file mode 100644 index 0000000..907edc9 --- /dev/null +++ b/lib/test/esprima/ES6/spread-element/invalid-call-spreads.failure.json @@ -0,0 +1 @@ +{"index":6,"lineNumber":1,"column":7,"message":"Error: Line 1: Unexpected token ...","description":"Unexpected token ..."} \ No newline at end of file diff --git a/lib/test/esprima/ES6/spread-element/invalid-call-spreads.js b/lib/test/esprima/ES6/spread-element/invalid-call-spreads.js new file mode 100644 index 0000000..6c046e3 --- /dev/null +++ b/lib/test/esprima/ES6/spread-element/invalid-call-spreads.js @@ -0,0 +1 @@ +f(... ... g); diff --git a/lib/test/esprima/ES6/spread-element/invalid-new-dot-dot.failure.json b/lib/test/esprima/ES6/spread-element/invalid-new-dot-dot.failure.json new file mode 100644 index 0000000..3e421a5 --- /dev/null +++ b/lib/test/esprima/ES6/spread-element/invalid-new-dot-dot.failure.json @@ -0,0 +1 @@ +{"index":6,"lineNumber":1,"column":7,"message":"Error: Line 1: Unexpected token .","description":"Unexpected token ."} \ No newline at end of file diff --git a/lib/test/esprima/ES6/spread-element/invalid-new-dot-dot.js b/lib/test/esprima/ES6/spread-element/invalid-new-dot-dot.js new file mode 100644 index 0000000..94f0771 --- /dev/null +++ b/lib/test/esprima/ES6/spread-element/invalid-new-dot-dot.js @@ -0,0 +1 @@ +new f(..g); diff --git a/lib/test/esprima/ES6/spread-element/invalid-new-dots.failure.json b/lib/test/esprima/ES6/spread-element/invalid-new-dots.failure.json new file mode 100644 index 0000000..331823d --- /dev/null +++ b/lib/test/esprima/ES6/spread-element/invalid-new-dots.failure.json @@ -0,0 +1 @@ +{"index":9,"lineNumber":1,"column":10,"message":"Error: Line 1: Unexpected token .","description":"Unexpected token ."} \ No newline at end of file diff --git a/lib/test/esprima/ES6/spread-element/invalid-new-dots.js b/lib/test/esprima/ES6/spread-element/invalid-new-dots.js new file mode 100644 index 0000000..1078dba --- /dev/null +++ b/lib/test/esprima/ES6/spread-element/invalid-new-dots.js @@ -0,0 +1 @@ +new f(....g); diff --git a/lib/test/esprima/ES6/spread-element/invalid-new-spreads.failure.json b/lib/test/esprima/ES6/spread-element/invalid-new-spreads.failure.json new file mode 100644 index 0000000..6b707e4 --- /dev/null +++ b/lib/test/esprima/ES6/spread-element/invalid-new-spreads.failure.json @@ -0,0 +1 @@ +{"index":10,"lineNumber":1,"column":11,"message":"Error: Line 1: Unexpected token ...","description":"Unexpected token ..."} \ No newline at end of file diff --git a/lib/test/esprima/ES6/spread-element/invalid-new-spreads.js b/lib/test/esprima/ES6/spread-element/invalid-new-spreads.js new file mode 100644 index 0000000..5f6a303 --- /dev/null +++ b/lib/test/esprima/ES6/spread-element/invalid-new-spreads.js @@ -0,0 +1 @@ +new f(... ... g); diff --git a/lib/test/esprima/ES6/spread-element/new-multi-spread.js b/lib/test/esprima/ES6/spread-element/new-multi-spread.js new file mode 100644 index 0000000..afb519a --- /dev/null +++ b/lib/test/esprima/ES6/spread-element/new-multi-spread.js @@ -0,0 +1 @@ +new f(...x, ...y, ...z); diff --git a/lib/test/esprima/ES6/spread-element/new-multi-spread.tree.json b/lib/test/esprima/ES6/spread-element/new-multi-spread.tree.json new file mode 100644 index 0000000..34cbd0a --- /dev/null +++ b/lib/test/esprima/ES6/spread-element/new-multi-spread.tree.json @@ -0,0 +1,415 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "type": "NewExpression", + "callee": { + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "type": "Identifier", + "name": "f" + }, + "arguments": [ + { + "range": [ + 6, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "SpreadElement", + "argument": { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Identifier", + "name": "x" + } + }, + { + "range": [ + 12, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "SpreadElement", + "argument": { + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "Identifier", + "name": "y" + } + }, + { + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "SpreadElement", + "argument": { + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "Identifier", + "name": "z" + } + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "new", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 12, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 18, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } +} diff --git a/lib/test/esprima/ES6/spread-element/new-spread-default.js b/lib/test/esprima/ES6/spread-element/new-spread-default.js new file mode 100644 index 0000000..a379e55 --- /dev/null +++ b/lib/test/esprima/ES6/spread-element/new-spread-default.js @@ -0,0 +1 @@ +new f(g, ...h = i); diff --git a/lib/test/esprima/ES6/spread-element/new-spread-default.tree.json b/lib/test/esprima/ES6/spread-element/new-spread-default.tree.json new file mode 100644 index 0000000..e592b91 --- /dev/null +++ b/lib/test/esprima/ES6/spread-element/new-spread-default.tree.json @@ -0,0 +1,363 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "NewExpression", + "callee": { + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "type": "Identifier", + "name": "f" + }, + "arguments": [ + { + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Identifier", + "name": "g" + }, + { + "range": [ + 9, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "SpreadElement", + "argument": { + "range": [ + 12, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "AssignmentExpression", + "operator": "=", + "left": { + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "Identifier", + "name": "h" + }, + "right": { + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "Identifier", + "name": "i" + } + } + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "new", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "g", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 9, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "h", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "i", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } +} diff --git a/lib/test/esprima/ES6/spread-element/new-spread-first.js b/lib/test/esprima/ES6/spread-element/new-spread-first.js new file mode 100644 index 0000000..359da27 --- /dev/null +++ b/lib/test/esprima/ES6/spread-element/new-spread-first.js @@ -0,0 +1 @@ +new f(...x, y, z); diff --git a/lib/test/esprima/ES6/spread-element/new-spread-first.tree.json b/lib/test/esprima/ES6/spread-element/new-spread-first.tree.json new file mode 100644 index 0000000..8cf0f80 --- /dev/null +++ b/lib/test/esprima/ES6/spread-element/new-spread-first.tree.json @@ -0,0 +1,345 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "NewExpression", + "callee": { + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "type": "Identifier", + "name": "f" + }, + "arguments": [ + { + "range": [ + 6, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "SpreadElement", + "argument": { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Identifier", + "name": "x" + } + }, + { + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "Identifier", + "name": "y" + }, + { + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "Identifier", + "name": "z" + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "new", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } +} diff --git a/lib/test/esprima/ES6/spread-element/new-spread-number.js b/lib/test/esprima/ES6/spread-element/new-spread-number.js new file mode 100644 index 0000000..3c55719 --- /dev/null +++ b/lib/test/esprima/ES6/spread-element/new-spread-number.js @@ -0,0 +1 @@ +new f(....5); diff --git a/lib/test/esprima/ES6/spread-element/new-spread-number.tree.json b/lib/test/esprima/ES6/spread-element/new-spread-number.tree.json new file mode 100644 index 0000000..403b029 --- /dev/null +++ b/lib/test/esprima/ES6/spread-element/new-spread-number.tree.json @@ -0,0 +1,238 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "NewExpression", + "callee": { + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "type": "Identifier", + "name": "f" + }, + "arguments": [ + { + "range": [ + 6, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "SpreadElement", + "argument": { + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Literal", + "value": 0.5, + "raw": ".5" + } + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "new", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Numeric", + "value": ".5", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } +} diff --git a/lib/test/esprima/ES6/spread-element/new-spread.js b/lib/test/esprima/ES6/spread-element/new-spread.js new file mode 100644 index 0000000..316f810 --- /dev/null +++ b/lib/test/esprima/ES6/spread-element/new-spread.js @@ -0,0 +1 @@ +new f(...g); diff --git a/lib/test/esprima/ES6/spread-element/new-spread.tree.json b/lib/test/esprima/ES6/spread-element/new-spread.tree.json new file mode 100644 index 0000000..73d7d88 --- /dev/null +++ b/lib/test/esprima/ES6/spread-element/new-spread.tree.json @@ -0,0 +1,237 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "NewExpression", + "callee": { + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "type": "Identifier", + "name": "f" + }, + "arguments": [ + { + "range": [ + 6, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "SpreadElement", + "argument": { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Identifier", + "name": "g" + } + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "new", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "g", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } +} diff --git a/lib/test/esprima/ES6/super-property/arrow_super.js b/lib/test/esprima/ES6/super-property/arrow_super.js new file mode 100644 index 0000000..016e8d4 --- /dev/null +++ b/lib/test/esprima/ES6/super-property/arrow_super.js @@ -0,0 +1,5 @@ +class A extends B { + constructor() { + () => super() + } +} diff --git a/lib/test/esprima/ES6/super-property/arrow_super.tree.json b/lib/test/esprima/ES6/super-property/arrow_super.tree.json new file mode 100644 index 0000000..34ef039 --- /dev/null +++ b/lib/test/esprima/ES6/super-property/arrow_super.tree.json @@ -0,0 +1,551 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 69 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "type": "ClassDeclaration", + "id": { + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Identifier", + "name": "A" + }, + "superClass": { + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "Identifier", + "name": "B" + }, + "body": { + "range": [ + 18, + 69 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "type": "ClassBody", + "body": [ + { + "range": [ + 24, + 67 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "type": "MethodDefinition", + "key": { + "range": [ + 24, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "type": "Identifier", + "name": "constructor" + }, + "computed": false, + "value": { + "range": [ + 35, + 67 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "range": [ + 38, + 67 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 48, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 48, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "type": "ArrowFunctionExpression", + "id": null, + "params": [], + "body": { + "range": [ + 54, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "type": "CallExpression", + "callee": { + "range": [ + 54, + 59 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 19 + } + }, + "type": "Super" + }, + "arguments": [] + }, + "generator": false, + "expression": true + } + } + ] + }, + "generator": false, + "expression": false + }, + "kind": "constructor", + "static": false + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "B", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "constructor", + "range": [ + 24, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 49, + 50 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 51, + 53 + ], + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "super", + "range": [ + 54, + 59 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 59, + 60 + ], + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 60, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 66, + 67 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 68, + 69 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + } + ], + "range": [ + 0, + 69 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } +} diff --git a/lib/test/esprima/ES6/super-property/constructor_super.js b/lib/test/esprima/ES6/super-property/constructor_super.js new file mode 100644 index 0000000..ed6fbc8 --- /dev/null +++ b/lib/test/esprima/ES6/super-property/constructor_super.js @@ -0,0 +1,5 @@ +class A extends B { + constructor() { + super(); + } +} diff --git a/lib/test/esprima/ES6/super-property/constructor_super.tree.json b/lib/test/esprima/ES6/super-property/constructor_super.tree.json new file mode 100644 index 0000000..a2d8f09 --- /dev/null +++ b/lib/test/esprima/ES6/super-property/constructor_super.tree.json @@ -0,0 +1,494 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 64 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "type": "ClassDeclaration", + "id": { + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Identifier", + "name": "A" + }, + "superClass": { + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "Identifier", + "name": "B" + }, + "body": { + "range": [ + 18, + 64 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "type": "ClassBody", + "body": [ + { + "range": [ + 24, + 62 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "type": "MethodDefinition", + "key": { + "range": [ + 24, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "type": "Identifier", + "name": "constructor" + }, + "computed": false, + "value": { + "range": [ + 35, + 62 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "range": [ + 38, + 62 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 48, + 56 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 48, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "type": "CallExpression", + "callee": { + "range": [ + 48, + 53 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "type": "Super" + }, + "arguments": [] + } + } + ] + }, + "generator": false, + "expression": false + }, + "kind": "constructor", + "static": false + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "B", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "constructor", + "range": [ + 24, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Keyword", + "value": "super", + "range": [ + 48, + 53 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 61, + 62 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 63, + 64 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + } + ], + "range": [ + 0, + 64 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } +} diff --git a/lib/test/esprima/ES6/super-property/invalid_super_access.failure.json b/lib/test/esprima/ES6/super-property/invalid_super_access.failure.json new file mode 100644 index 0000000..8ec7d2d --- /dev/null +++ b/lib/test/esprima/ES6/super-property/invalid_super_access.failure.json @@ -0,0 +1 @@ +{"index":54,"lineNumber":3,"column":15,"message":"Error: Line 3: Unexpected token )","description":"Unexpected token )"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/super-property/invalid_super_access.js b/lib/test/esprima/ES6/super-property/invalid_super_access.js new file mode 100644 index 0000000..ddff2f3 --- /dev/null +++ b/lib/test/esprima/ES6/super-property/invalid_super_access.js @@ -0,0 +1,5 @@ +class A extends B { + constructor() { + (super)(); + } +} diff --git a/lib/test/esprima/ES6/super-property/invalid_super_id.failure.json b/lib/test/esprima/ES6/super-property/invalid_super_id.failure.json new file mode 100644 index 0000000..d5c4662 --- /dev/null +++ b/lib/test/esprima/ES6/super-property/invalid_super_id.failure.json @@ -0,0 +1 @@ +{"index":32,"lineNumber":2,"column":23,"message":"Error: Line 2: Unexpected token +","description":"Unexpected token +"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/super-property/invalid_super_id.js b/lib/test/esprima/ES6/super-property/invalid_super_id.js new file mode 100644 index 0000000..bf4f139 --- /dev/null +++ b/lib/test/esprima/ES6/super-property/invalid_super_id.js @@ -0,0 +1,3 @@ +class A { + foo() { new super + 3 } +} diff --git a/lib/test/esprima/ES6/super-property/invalid_super_not_inside_function.failure.json b/lib/test/esprima/ES6/super-property/invalid_super_not_inside_function.failure.json new file mode 100644 index 0000000..9a4c13d --- /dev/null +++ b/lib/test/esprima/ES6/super-property/invalid_super_not_inside_function.failure.json @@ -0,0 +1 @@ +{"index":8,"lineNumber":1,"column":9,"message":"Error: Line 1: Unexpected reserved word","description":"Unexpected reserved word"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/super-property/invalid_super_not_inside_function.js b/lib/test/esprima/ES6/super-property/invalid_super_not_inside_function.js new file mode 100644 index 0000000..37fcf41 --- /dev/null +++ b/lib/test/esprima/ES6/super-property/invalid_super_not_inside_function.js @@ -0,0 +1 @@ +var x = super(); diff --git a/lib/test/esprima/ES6/super-property/new_super.js b/lib/test/esprima/ES6/super-property/new_super.js new file mode 100644 index 0000000..ec0be4e --- /dev/null +++ b/lib/test/esprima/ES6/super-property/new_super.js @@ -0,0 +1,5 @@ +class A extends B { + foo() { + new super.bar() + } +} diff --git a/lib/test/esprima/ES6/super-property/new_super.tree.json b/lib/test/esprima/ES6/super-property/new_super.tree.json new file mode 100644 index 0000000..fcdabd1 --- /dev/null +++ b/lib/test/esprima/ES6/super-property/new_super.tree.json @@ -0,0 +1,566 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 63 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "type": "ClassDeclaration", + "id": { + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Identifier", + "name": "A" + }, + "superClass": { + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "Identifier", + "name": "B" + }, + "body": { + "range": [ + 18, + 63 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "type": "ClassBody", + "body": [ + { + "range": [ + 24, + 61 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "type": "MethodDefinition", + "key": { + "range": [ + 24, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "type": "Identifier", + "name": "foo" + }, + "computed": false, + "value": { + "range": [ + 27, + 61 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "range": [ + 30, + 61 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 40, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 23 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 40, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 23 + } + }, + "type": "NewExpression", + "callee": { + "range": [ + 44, + 53 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "type": "MemberExpression", + "computed": false, + "object": { + "range": [ + 44, + 49 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "type": "Super" + }, + "property": { + "range": [ + 50, + 53 + ], + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "type": "Identifier", + "name": "bar" + } + }, + "arguments": [] + } + } + ] + }, + "generator": false, + "expression": false + }, + "kind": "method", + "static": false + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "B", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 24, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Keyword", + "value": "new", + "range": [ + 40, + 43 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + { + "type": "Keyword", + "value": "super", + "range": [ + 44, + 49 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 49, + 50 + ], + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 50, + 53 + ], + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 60, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + } + ], + "range": [ + 0, + 63 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } +} diff --git a/lib/test/esprima/ES6/super-property/super_computed.js b/lib/test/esprima/ES6/super-property/super_computed.js new file mode 100644 index 0000000..02b6d22 --- /dev/null +++ b/lib/test/esprima/ES6/super-property/super_computed.js @@ -0,0 +1,5 @@ +class A extends B { + X() { + return super[1] + } +} diff --git a/lib/test/esprima/ES6/super-property/super_computed.tree.json b/lib/test/esprima/ES6/super-property/super_computed.tree.json new file mode 100644 index 0000000..45a49ab --- /dev/null +++ b/lib/test/esprima/ES6/super-property/super_computed.tree.json @@ -0,0 +1,531 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 61 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "type": "ClassDeclaration", + "id": { + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Identifier", + "name": "A" + }, + "superClass": { + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "Identifier", + "name": "B" + }, + "body": { + "range": [ + 18, + 61 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "type": "ClassBody", + "body": [ + { + "range": [ + 24, + 59 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "type": "MethodDefinition", + "key": { + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "type": "Identifier", + "name": "X" + }, + "computed": false, + "value": { + "range": [ + 25, + 59 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "range": [ + 28, + 59 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 38, + 53 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 23 + } + }, + "type": "ReturnStatement", + "argument": { + "range": [ + 45, + 53 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 23 + } + }, + "type": "MemberExpression", + "computed": true, + "object": { + "range": [ + 45, + 50 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 20 + } + }, + "type": "Super" + }, + "property": { + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 22 + } + }, + "type": "Literal", + "value": 1, + "raw": "1" + } + } + } + ] + }, + "generator": false, + "expression": false + }, + "kind": "method", + "static": false + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "B", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "X", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "super", + "range": [ + 45, + 50 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 60, + 61 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + } + ], + "range": [ + 0, + 61 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } +} diff --git a/lib/test/esprima/ES6/super-property/super_member.js b/lib/test/esprima/ES6/super-property/super_member.js new file mode 100644 index 0000000..28e4ea0 --- /dev/null +++ b/lib/test/esprima/ES6/super-property/super_member.js @@ -0,0 +1,5 @@ +class A extends B { + X() { + return super.y + } +} diff --git a/lib/test/esprima/ES6/super-property/super_member.tree.json b/lib/test/esprima/ES6/super-property/super_member.tree.json new file mode 100644 index 0000000..ba743b5 --- /dev/null +++ b/lib/test/esprima/ES6/super-property/super_member.tree.json @@ -0,0 +1,512 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 60 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "type": "ClassDeclaration", + "id": { + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Identifier", + "name": "A" + }, + "superClass": { + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "Identifier", + "name": "B" + }, + "body": { + "range": [ + 18, + 60 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "type": "ClassBody", + "body": [ + { + "range": [ + 24, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "type": "MethodDefinition", + "key": { + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "type": "Identifier", + "name": "X" + }, + "computed": false, + "value": { + "range": [ + 25, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "range": [ + 28, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 38, + 52 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 22 + } + }, + "type": "ReturnStatement", + "argument": { + "range": [ + 45, + 52 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 22 + } + }, + "type": "MemberExpression", + "computed": false, + "object": { + "range": [ + 45, + 50 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 20 + } + }, + "type": "Super" + }, + "property": { + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 22 + } + }, + "type": "Identifier", + "name": "y" + } + } + } + ] + }, + "generator": false, + "expression": false + }, + "kind": "method", + "static": false + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "B", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "X", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "super", + "range": [ + 45, + 50 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 57, + 58 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 59, + 60 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + } + ], + "range": [ + 0, + 60 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } +} diff --git a/lib/test/esprima/ES6/template-literals/after-switch.failure.json b/lib/test/esprima/ES6/template-literals/after-switch.failure.json new file mode 100644 index 0000000..98e2b30 --- /dev/null +++ b/lib/test/esprima/ES6/template-literals/after-switch.failure.json @@ -0,0 +1 @@ +{"index":7,"lineNumber":1,"column":8,"message":"Error: Line 1: Unexpected quasi test","description":"Unexpected quasi test"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/template-literals/after-switch.js b/lib/test/esprima/ES6/template-literals/after-switch.js new file mode 100644 index 0000000..539c7c5 --- /dev/null +++ b/lib/test/esprima/ES6/template-literals/after-switch.js @@ -0,0 +1 @@ +switch `test` \ No newline at end of file diff --git a/lib/test/esprima/ES6/template-literals/dollar-sign.js b/lib/test/esprima/ES6/template-literals/dollar-sign.js new file mode 100644 index 0000000..5b92d50 --- /dev/null +++ b/lib/test/esprima/ES6/template-literals/dollar-sign.js @@ -0,0 +1 @@ +`$` \ No newline at end of file diff --git a/lib/test/esprima/ES6/template-literals/dollar-sign.tree.json b/lib/test/esprima/ES6/template-literals/dollar-sign.tree.json new file mode 100644 index 0000000..5aa1328 --- /dev/null +++ b/lib/test/esprima/ES6/template-literals/dollar-sign.tree.json @@ -0,0 +1,99 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "type": "TemplateLiteral", + "quasis": [ + { + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "type": "TemplateElement", + "value": { + "raw": "$", + "cooked": "$" + }, + "tail": true + } + ], + "expressions": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Template", + "value": "`$`", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } +} diff --git a/lib/test/esprima/ES6/template-literals/escape-sequences.source.js b/lib/test/esprima/ES6/template-literals/escape-sequences.source.js new file mode 100644 index 0000000..935c0ab --- /dev/null +++ b/lib/test/esprima/ES6/template-literals/escape-sequences.source.js @@ -0,0 +1 @@ +var source = '`\\n\\r\\b\\v\\t\\f\\\n\\\r\n`'; \ No newline at end of file diff --git a/lib/test/esprima/ES6/template-literals/escape-sequences.tree.json b/lib/test/esprima/ES6/template-literals/escape-sequences.tree.json new file mode 100644 index 0000000..165f0f3 --- /dev/null +++ b/lib/test/esprima/ES6/template-literals/escape-sequences.tree.json @@ -0,0 +1,99 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "type": "TemplateLiteral", + "quasis": [ + { + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "type": "TemplateElement", + "value": { + "raw": "\\n\\r\\b\\v\\t\\f\\\n\\\r\n", + "cooked": "\n\r\b\u000b\t\f" + }, + "tail": true + } + ], + "expressions": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Template", + "value": "`\\n\\r\\b\\v\\t\\f\\\n\\\r\n`", + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ], + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } +} diff --git a/lib/test/esprima/ES6/template-literals/invalid-escape.failure.json b/lib/test/esprima/ES6/template-literals/invalid-escape.failure.json new file mode 100644 index 0000000..658b44d --- /dev/null +++ b/lib/test/esprima/ES6/template-literals/invalid-escape.failure.json @@ -0,0 +1 @@ +{"index":3,"lineNumber":1,"column":4,"message":"Error: Line 1: Octal literals are not allowed in template strings.","description":"Octal literals are not allowed in template strings."} \ No newline at end of file diff --git a/lib/test/esprima/ES6/template-literals/invalid-escape.js b/lib/test/esprima/ES6/template-literals/invalid-escape.js new file mode 100644 index 0000000..8d9106f --- /dev/null +++ b/lib/test/esprima/ES6/template-literals/invalid-escape.js @@ -0,0 +1 @@ +`\1`; diff --git a/lib/test/esprima/ES6/template-literals/line-terminators.source.js b/lib/test/esprima/ES6/template-literals/line-terminators.source.js new file mode 100644 index 0000000..07e7122 --- /dev/null +++ b/lib/test/esprima/ES6/template-literals/line-terminators.source.js @@ -0,0 +1 @@ +var source = '`\n\r\n`'; \ No newline at end of file diff --git a/lib/test/esprima/ES6/template-literals/line-terminators.tree.json b/lib/test/esprima/ES6/template-literals/line-terminators.tree.json new file mode 100644 index 0000000..e5d498b --- /dev/null +++ b/lib/test/esprima/ES6/template-literals/line-terminators.tree.json @@ -0,0 +1,99 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "type": "TemplateLiteral", + "quasis": [ + { + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "type": "TemplateElement", + "value": { + "raw": "\n\r\n", + "cooked": "\n\n" + }, + "tail": true + } + ], + "expressions": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Template", + "value": "`\n\r\n`", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ], + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } +} diff --git a/lib/test/esprima/ES6/template-literals/literal-escape-sequences.source.js b/lib/test/esprima/ES6/template-literals/literal-escape-sequences.source.js new file mode 100644 index 0000000..67f21b0 --- /dev/null +++ b/lib/test/esprima/ES6/template-literals/literal-escape-sequences.source.js @@ -0,0 +1 @@ +var source = '`\\u{000042}\\u0042\\x42\\u0\\A\\0`'; \ No newline at end of file diff --git a/lib/test/esprima/ES6/template-literals/literal-escape-sequences.tree.json b/lib/test/esprima/ES6/template-literals/literal-escape-sequences.tree.json new file mode 100644 index 0000000..d4059c2 --- /dev/null +++ b/lib/test/esprima/ES6/template-literals/literal-escape-sequences.tree.json @@ -0,0 +1,99 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "type": "TemplateLiteral", + "quasis": [ + { + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "type": "TemplateElement", + "value": { + "raw": "\\u{000042}\\u0042\\x42\\u0\\A\\0", + "cooked": "BBBu0A\u0000" + }, + "tail": true + } + ], + "expressions": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Template", + "value": "`\\u{000042}\\u0042\\x42\\u0\\A\\0`", + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } +} diff --git a/lib/test/esprima/ES6/template-literals/new-expression.js b/lib/test/esprima/ES6/template-literals/new-expression.js new file mode 100644 index 0000000..3b3e830 --- /dev/null +++ b/lib/test/esprima/ES6/template-literals/new-expression.js @@ -0,0 +1 @@ +new raw`42` \ No newline at end of file diff --git a/lib/test/esprima/ES6/template-literals/new-expression.tree.json b/lib/test/esprima/ES6/template-literals/new-expression.tree.json new file mode 100644 index 0000000..de8cfdb --- /dev/null +++ b/lib/test/esprima/ES6/template-literals/new-expression.tree.json @@ -0,0 +1,188 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "NewExpression", + "callee": { + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "TaggedTemplateExpression", + "tag": { + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Identifier", + "name": "raw" + }, + "quasi": { + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "TemplateLiteral", + "quasis": [ + { + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "TemplateElement", + "value": { + "raw": "42", + "cooked": "42" + }, + "tail": true + } + ], + "expressions": [] + } + }, + "arguments": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "new", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "raw", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Template", + "value": "`42`", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } +} diff --git a/lib/test/esprima/ES6/template-literals/octal-literal.failure.json b/lib/test/esprima/ES6/template-literals/octal-literal.failure.json new file mode 100644 index 0000000..658b44d --- /dev/null +++ b/lib/test/esprima/ES6/template-literals/octal-literal.failure.json @@ -0,0 +1 @@ +{"index":3,"lineNumber":1,"column":4,"message":"Error: Line 1: Octal literals are not allowed in template strings.","description":"Octal literals are not allowed in template strings."} \ No newline at end of file diff --git a/lib/test/esprima/ES6/template-literals/octal-literal.js b/lib/test/esprima/ES6/template-literals/octal-literal.js new file mode 100644 index 0000000..b992f18 --- /dev/null +++ b/lib/test/esprima/ES6/template-literals/octal-literal.js @@ -0,0 +1 @@ +`\00`; \ No newline at end of file diff --git a/lib/test/esprima/ES6/template-literals/strict-octal-literal.failure.json b/lib/test/esprima/ES6/template-literals/strict-octal-literal.failure.json new file mode 100644 index 0000000..0809dc2 --- /dev/null +++ b/lib/test/esprima/ES6/template-literals/strict-octal-literal.failure.json @@ -0,0 +1 @@ +{"index":17,"lineNumber":1,"column":18,"message":"Error: Line 1: Octal literals are not allowed in template strings.","description":"Octal literals are not allowed in template strings."} \ No newline at end of file diff --git a/lib/test/esprima/ES6/template-literals/strict-octal-literal.js b/lib/test/esprima/ES6/template-literals/strict-octal-literal.js new file mode 100644 index 0000000..e7d066c --- /dev/null +++ b/lib/test/esprima/ES6/template-literals/strict-octal-literal.js @@ -0,0 +1 @@ +'use strict'; `\00`; \ No newline at end of file diff --git a/lib/test/esprima/ES6/template-literals/tagged-interpolation.js b/lib/test/esprima/ES6/template-literals/tagged-interpolation.js new file mode 100644 index 0000000..f2d1f45 --- /dev/null +++ b/lib/test/esprima/ES6/template-literals/tagged-interpolation.js @@ -0,0 +1 @@ +raw`hello ${name}` \ No newline at end of file diff --git a/lib/test/esprima/ES6/template-literals/tagged-interpolation.tree.json b/lib/test/esprima/ES6/template-literals/tagged-interpolation.tree.json new file mode 100644 index 0000000..bcfe72c --- /dev/null +++ b/lib/test/esprima/ES6/template-literals/tagged-interpolation.tree.json @@ -0,0 +1,229 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "TaggedTemplateExpression", + "tag": { + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "type": "Identifier", + "name": "raw" + }, + "quasi": { + "range": [ + 3, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "TemplateLiteral", + "quasis": [ + { + "range": [ + 3, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "TemplateElement", + "value": { + "raw": "hello ", + "cooked": "hello " + }, + "tail": false + }, + { + "range": [ + 16, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "TemplateElement", + "value": { + "raw": "", + "cooked": "" + }, + "tail": true + } + ], + "expressions": [ + { + "range": [ + 12, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "Identifier", + "name": "name" + } + ] + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "raw", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Template", + "value": "`hello ${", + "range": [ + 3, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "name", + "range": [ + 12, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Template", + "value": "}`", + "range": [ + 16, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } +} diff --git a/lib/test/esprima/ES6/template-literals/tagged-nested-with-object-literal.js b/lib/test/esprima/ES6/template-literals/tagged-nested-with-object-literal.js new file mode 100644 index 0000000..182db10 --- /dev/null +++ b/lib/test/esprima/ES6/template-literals/tagged-nested-with-object-literal.js @@ -0,0 +1 @@ +raw`token ${`nested ${`deeply` + {}} blah`}` \ No newline at end of file diff --git a/lib/test/esprima/ES6/template-literals/tagged-nested-with-object-literal.tree.json b/lib/test/esprima/ES6/template-literals/tagged-nested-with-object-literal.tree.json new file mode 100644 index 0000000..fedca18 --- /dev/null +++ b/lib/test/esprima/ES6/template-literals/tagged-nested-with-object-literal.tree.json @@ -0,0 +1,444 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "type": "TaggedTemplateExpression", + "tag": { + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "type": "Identifier", + "name": "raw" + }, + "quasi": { + "range": [ + 3, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "type": "TemplateLiteral", + "quasis": [ + { + "range": [ + 3, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "TemplateElement", + "value": { + "raw": "token ", + "cooked": "token " + }, + "tail": false + }, + { + "range": [ + 42, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "type": "TemplateElement", + "value": { + "raw": "", + "cooked": "" + }, + "tail": true + } + ], + "expressions": [ + { + "range": [ + 12, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "type": "TemplateLiteral", + "quasis": [ + { + "range": [ + 12, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "TemplateElement", + "value": { + "raw": "nested ", + "cooked": "nested " + }, + "tail": false + }, + { + "range": [ + 35, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "type": "TemplateElement", + "value": { + "raw": " blah", + "cooked": " blah" + }, + "tail": true + } + ], + "expressions": [ + { + "range": [ + 22, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "type": "BinaryExpression", + "operator": "+", + "left": { + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "type": "TemplateLiteral", + "quasis": [ + { + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "type": "TemplateElement", + "value": { + "raw": "deeply", + "cooked": "deeply" + }, + "tail": true + } + ], + "expressions": [] + }, + "right": { + "range": [ + 33, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "type": "ObjectExpression", + "properties": [] + } + } + ] + } + ] + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "raw", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Template", + "value": "`token ${", + "range": [ + 3, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Template", + "value": "`nested ${", + "range": [ + 12, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Template", + "value": "`deeply`", + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Template", + "value": "} blah`", + "range": [ + 35, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + { + "type": "Template", + "value": "}`", + "range": [ + 42, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 44 + } + } + } + ], + "range": [ + 0, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + } +} diff --git a/lib/test/esprima/ES6/template-literals/tagged.js b/lib/test/esprima/ES6/template-literals/tagged.js new file mode 100644 index 0000000..756b976 --- /dev/null +++ b/lib/test/esprima/ES6/template-literals/tagged.js @@ -0,0 +1 @@ +raw`42` diff --git a/lib/test/esprima/ES6/template-literals/tagged.tree.json b/lib/test/esprima/ES6/template-literals/tagged.tree.json new file mode 100644 index 0000000..bc3b391 --- /dev/null +++ b/lib/test/esprima/ES6/template-literals/tagged.tree.json @@ -0,0 +1,152 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "TaggedTemplateExpression", + "tag": { + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "type": "Identifier", + "name": "raw" + }, + "quasi": { + "range": [ + 3, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "TemplateLiteral", + "quasis": [ + { + "range": [ + 3, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "TemplateElement", + "value": { + "raw": "42", + "cooked": "42" + }, + "tail": true + } + ], + "expressions": [] + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "raw", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Template", + "value": "`42`", + "range": [ + 3, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } +} diff --git a/lib/test/esprima/ES6/template-literals/unclosed-interpolation.failure.json b/lib/test/esprima/ES6/template-literals/unclosed-interpolation.failure.json new file mode 100644 index 0000000..f543ef4 --- /dev/null +++ b/lib/test/esprima/ES6/template-literals/unclosed-interpolation.failure.json @@ -0,0 +1 @@ +{"index":11,"lineNumber":1,"column":12,"message":"Error: Line 1: Unexpected token ILLEGAL","description":"Unexpected token ILLEGAL"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/template-literals/unclosed-interpolation.js b/lib/test/esprima/ES6/template-literals/unclosed-interpolation.js new file mode 100644 index 0000000..16c93f9 --- /dev/null +++ b/lib/test/esprima/ES6/template-literals/unclosed-interpolation.js @@ -0,0 +1 @@ +`hello ${10;test` \ No newline at end of file diff --git a/lib/test/esprima/ES6/template-literals/unclosed-nested.failure.json b/lib/test/esprima/ES6/template-literals/unclosed-nested.failure.json new file mode 100644 index 0000000..537cdd4 --- /dev/null +++ b/lib/test/esprima/ES6/template-literals/unclosed-nested.failure.json @@ -0,0 +1 @@ +{"index":18,"lineNumber":1,"column":19,"message":"Error: Line 1: Unexpected token ILLEGAL","description":"Unexpected token ILLEGAL"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/template-literals/unclosed-nested.js b/lib/test/esprima/ES6/template-literals/unclosed-nested.js new file mode 100644 index 0000000..7e96238 --- /dev/null +++ b/lib/test/esprima/ES6/template-literals/unclosed-nested.js @@ -0,0 +1 @@ +`hello ${10 `test` \ No newline at end of file diff --git a/lib/test/esprima/ES6/template-literals/unclosed.failure.json b/lib/test/esprima/ES6/template-literals/unclosed.failure.json new file mode 100644 index 0000000..047f1f9 --- /dev/null +++ b/lib/test/esprima/ES6/template-literals/unclosed.failure.json @@ -0,0 +1 @@ +{"index":5,"lineNumber":1,"column":6,"message":"Error: Line 1: Unexpected token ILLEGAL","description":"Unexpected token ILLEGAL"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/template-literals/unclosed.js b/lib/test/esprima/ES6/template-literals/unclosed.js new file mode 100644 index 0000000..88e1a8a --- /dev/null +++ b/lib/test/esprima/ES6/template-literals/unclosed.js @@ -0,0 +1 @@ +`test \ No newline at end of file diff --git a/lib/test/esprima/ES6/template-literals/untagged.js b/lib/test/esprima/ES6/template-literals/untagged.js new file mode 100644 index 0000000..105816d --- /dev/null +++ b/lib/test/esprima/ES6/template-literals/untagged.js @@ -0,0 +1 @@ +`42` \ No newline at end of file diff --git a/lib/test/esprima/ES6/template-literals/untagged.tree.json b/lib/test/esprima/ES6/template-literals/untagged.tree.json new file mode 100644 index 0000000..d50c246 --- /dev/null +++ b/lib/test/esprima/ES6/template-literals/untagged.tree.json @@ -0,0 +1,99 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "type": "TemplateLiteral", + "quasis": [ + { + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "type": "TemplateElement", + "value": { + "raw": "42", + "cooked": "42" + }, + "tail": true + } + ], + "expressions": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Template", + "value": "`42`", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } +} diff --git a/lib/test/esprima/ES6/unicode-code-point-escape-sequence/migrated_0000.source.js b/lib/test/esprima/ES6/unicode-code-point-escape-sequence/migrated_0000.source.js new file mode 100644 index 0000000..78fabf3 --- /dev/null +++ b/lib/test/esprima/ES6/unicode-code-point-escape-sequence/migrated_0000.source.js @@ -0,0 +1 @@ +var source = '"\\u{714E}\\u{8336}"'; \ No newline at end of file diff --git a/lib/test/esprima/ES6/unicode-code-point-escape-sequence/migrated_0000.tree.json b/lib/test/esprima/ES6/unicode-code-point-escape-sequence/migrated_0000.tree.json new file mode 100644 index 0000000..eda7ece --- /dev/null +++ b/lib/test/esprima/ES6/unicode-code-point-escape-sequence/migrated_0000.tree.json @@ -0,0 +1,77 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "煎茶", + "raw": "\"\\u{714E}\\u{8336}\"", + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "directive": "\\u{714E}\\u{8336}", + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"\\u{714E}\\u{8336}\"", + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } +} diff --git a/lib/test/esprima/ES6/unicode-code-point-escape-sequence/migrated_0001.source.js b/lib/test/esprima/ES6/unicode-code-point-escape-sequence/migrated_0001.source.js new file mode 100644 index 0000000..29af5f7 --- /dev/null +++ b/lib/test/esprima/ES6/unicode-code-point-escape-sequence/migrated_0001.source.js @@ -0,0 +1 @@ +var source = '"\\u{20BB7}\\u{91CE}\\u{5BB6}"'; \ No newline at end of file diff --git a/lib/test/esprima/ES6/unicode-code-point-escape-sequence/migrated_0001.tree.json b/lib/test/esprima/ES6/unicode-code-point-escape-sequence/migrated_0001.tree.json new file mode 100644 index 0000000..71c8c8b --- /dev/null +++ b/lib/test/esprima/ES6/unicode-code-point-escape-sequence/migrated_0001.tree.json @@ -0,0 +1,77 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "𠮷野家", + "raw": "\"\\u{20BB7}\\u{91CE}\\u{5BB6}\"", + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "directive": "\\u{20BB7}\\u{91CE}\\u{5BB6}", + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"\\u{20BB7}\\u{91CE}\\u{5BB6}\"", + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + } +} diff --git a/lib/test/esprima/ES6/unicode-code-point-escape-sequence/migrated_0002.source.js b/lib/test/esprima/ES6/unicode-code-point-escape-sequence/migrated_0002.source.js new file mode 100644 index 0000000..27aa89f --- /dev/null +++ b/lib/test/esprima/ES6/unicode-code-point-escape-sequence/migrated_0002.source.js @@ -0,0 +1 @@ +var source = '"\\u{00000000034}"'; \ No newline at end of file diff --git a/lib/test/esprima/ES6/unicode-code-point-escape-sequence/migrated_0002.tree.json b/lib/test/esprima/ES6/unicode-code-point-escape-sequence/migrated_0002.tree.json new file mode 100644 index 0000000..1291487 --- /dev/null +++ b/lib/test/esprima/ES6/unicode-code-point-escape-sequence/migrated_0002.tree.json @@ -0,0 +1,77 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "4", + "raw": "\"\\u{00000000034}\"", + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "directive": "\\u{00000000034}", + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"\\u{00000000034}\"", + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } +} diff --git a/lib/test/esprima/ES6/yield/invalid-yield-binding-property.failure.json b/lib/test/esprima/ES6/yield/invalid-yield-binding-property.failure.json new file mode 100644 index 0000000..94506ae --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-binding-property.failure.json @@ -0,0 +1 @@ +{"index":18,"lineNumber":1,"column":19,"message":"Error: Line 1: Unexpected number","description":"Unexpected number"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/invalid-yield-binding-property.js b/lib/test/esprima/ES6/yield/invalid-yield-binding-property.js new file mode 100644 index 0000000..e6d7b06 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-binding-property.js @@ -0,0 +1 @@ +var {x: y = yield 3} = z; diff --git a/lib/test/esprima/ES6/yield/invalid-yield-expression.failure.json b/lib/test/esprima/ES6/yield/invalid-yield-expression.failure.json new file mode 100644 index 0000000..e902fe3 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-expression.failure.json @@ -0,0 +1 @@ +{"index":20,"lineNumber":1,"column":21,"message":"Error: Line 1: Unexpected number","description":"Unexpected number"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/invalid-yield-expression.js b/lib/test/esprima/ES6/yield/invalid-yield-expression.js new file mode 100644 index 0000000..e88270d --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-expression.js @@ -0,0 +1 @@ +(function() { yield 3; }) diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-arrow-default.failure.json b/lib/test/esprima/ES6/yield/invalid-yield-generator-arrow-default.failure.json new file mode 100644 index 0000000..f4e99f4 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-arrow-default.failure.json @@ -0,0 +1 @@ +{"index":31,"lineNumber":1,"column":32,"message":"Error: Line 1: Unexpected token =>","description":"Unexpected token =>"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-arrow-default.js b/lib/test/esprima/ES6/yield/invalid-yield-generator-arrow-default.js new file mode 100644 index 0000000..88b9947 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-arrow-default.js @@ -0,0 +1 @@ +function* g() { (x = yield 42) => {} } diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-arrow-parameter.failure.json b/lib/test/esprima/ES6/yield/invalid-yield-generator-arrow-parameter.failure.json new file mode 100644 index 0000000..b7dbeef --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-arrow-parameter.failure.json @@ -0,0 +1 @@ +{"index":23,"lineNumber":1,"column":24,"message":"Error: Line 1: Unexpected token =>","description":"Unexpected token =>"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-arrow-parameter.js b/lib/test/esprima/ES6/yield/invalid-yield-generator-arrow-parameter.js new file mode 100644 index 0000000..974d4e4 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-arrow-parameter.js @@ -0,0 +1 @@ +function *g(){ (yield) => 42 } diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-arrow-parameters.failure.json b/lib/test/esprima/ES6/yield/invalid-yield-generator-arrow-parameters.failure.json new file mode 100644 index 0000000..2352f76 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-arrow-parameters.failure.json @@ -0,0 +1 @@ +{"index":32,"lineNumber":1,"column":33,"message":"Error: Line 1: Unexpected token =>","description":"Unexpected token =>"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-arrow-parameters.js b/lib/test/esprima/ES6/yield/invalid-yield-generator-arrow-parameters.js new file mode 100644 index 0000000..e9aafb3 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-arrow-parameters.js @@ -0,0 +1 @@ +function *g(){ (a, b, c, yield) => 42 } diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-catch.failure.json b/lib/test/esprima/ES6/yield/invalid-yield-generator-catch.failure.json new file mode 100644 index 0000000..d032bd5 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-catch.failure.json @@ -0,0 +1 @@ +{"index":30,"lineNumber":1,"column":31,"message":"Error: Line 1: Unexpected token yield","description":"Unexpected token yield"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-catch.js b/lib/test/esprima/ES6/yield/invalid-yield-generator-catch.js new file mode 100644 index 0000000..f2891b8 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-catch.js @@ -0,0 +1 @@ +function *g() { try {} catch (yield) {} } diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-declaration.failure.json b/lib/test/esprima/ES6/yield/invalid-yield-generator-declaration.failure.json new file mode 100644 index 0000000..7d89b13 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-declaration.failure.json @@ -0,0 +1 @@ +{"index":26,"lineNumber":1,"column":27,"message":"Error: Line 1: Unexpected token yield","description":"Unexpected token yield"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-declaration.js b/lib/test/esprima/ES6/yield/invalid-yield-generator-declaration.js new file mode 100644 index 0000000..8093fc9 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-declaration.js @@ -0,0 +1 @@ +function *g() { function *yield(){} } diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-export-default.js b/lib/test/esprima/ES6/yield/invalid-yield-generator-export-default.js new file mode 100644 index 0000000..e925fcf --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-export-default.js @@ -0,0 +1 @@ +export default function *yield() {} diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-export-default.module.json b/lib/test/esprima/ES6/yield/invalid-yield-generator-export-default.module.json new file mode 100644 index 0000000..85593d8 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-export-default.module.json @@ -0,0 +1 @@ +{"index":25,"lineNumber":1,"column":26,"message":"Error: Line 1: Use of future reserved word in strict mode","description":"Use of future reserved word in strict mode"} diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-expression-name.failure.json b/lib/test/esprima/ES6/yield/invalid-yield-generator-expression-name.failure.json new file mode 100644 index 0000000..8546e25 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-expression-name.failure.json @@ -0,0 +1 @@ +{"index":10,"lineNumber":1,"column":11,"message":"Error: Line 1: Unexpected token yield","description":"Unexpected token yield"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-expression-name.js b/lib/test/esprima/ES6/yield/invalid-yield-generator-expression-name.js new file mode 100644 index 0000000..0fdfd88 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-expression-name.js @@ -0,0 +1 @@ +(function*yield(){}) diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-expression-parameter.failure.json b/lib/test/esprima/ES6/yield/invalid-yield-generator-expression-parameter.failure.json new file mode 100644 index 0000000..f699f8d --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-expression-parameter.failure.json @@ -0,0 +1 @@ +{"index":12,"lineNumber":1,"column":13,"message":"Error: Line 1: Unexpected token yield","description":"Unexpected token yield"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-expression-parameter.js b/lib/test/esprima/ES6/yield/invalid-yield-generator-expression-parameter.js new file mode 100644 index 0000000..d369031 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-expression-parameter.js @@ -0,0 +1 @@ +(function *(yield){}) diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-expression-rest.failure.json b/lib/test/esprima/ES6/yield/invalid-yield-generator-expression-rest.failure.json new file mode 100644 index 0000000..61b6c4e --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-expression-rest.failure.json @@ -0,0 +1 @@ +{"index":18,"lineNumber":1,"column":19,"message":"Error: Line 1: Unexpected token yield","description":"Unexpected token yield"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-expression-rest.js b/lib/test/esprima/ES6/yield/invalid-yield-generator-expression-rest.js new file mode 100644 index 0000000..1982701 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-expression-rest.js @@ -0,0 +1 @@ +(function *(x, ...yield){}) diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-function-declaration.failure.json b/lib/test/esprima/ES6/yield/invalid-yield-generator-function-declaration.failure.json new file mode 100644 index 0000000..ae22e80 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-function-declaration.failure.json @@ -0,0 +1 @@ +{"index":25,"lineNumber":1,"column":26,"message":"Error: Line 1: Unexpected token yield","description":"Unexpected token yield"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-function-declaration.js b/lib/test/esprima/ES6/yield/invalid-yield-generator-function-declaration.js new file mode 100644 index 0000000..45ef943 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-function-declaration.js @@ -0,0 +1 @@ +function *g() { function yield() {} } diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-lexical-declaration.failure.json b/lib/test/esprima/ES6/yield/invalid-yield-generator-lexical-declaration.failure.json new file mode 100644 index 0000000..82be820 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-lexical-declaration.failure.json @@ -0,0 +1 @@ +{"index":20,"lineNumber":1,"column":21,"message":"Error: Line 1: Unexpected token yield","description":"Unexpected token yield"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-lexical-declaration.js b/lib/test/esprima/ES6/yield/invalid-yield-generator-lexical-declaration.js new file mode 100644 index 0000000..c977c7c --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-lexical-declaration.js @@ -0,0 +1 @@ +function *g() { let yield; } diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-member-expression.failure.json b/lib/test/esprima/ES6/yield/invalid-yield-generator-member-expression.failure.json new file mode 100644 index 0000000..4284a4e --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-member-expression.failure.json @@ -0,0 +1 @@ +{"index":28,"lineNumber":1,"column":29,"message":"Error: Line 1: Unexpected token .","description":"Unexpected token ."} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-member-expression.js b/lib/test/esprima/ES6/yield/invalid-yield-generator-member-expression.js new file mode 100644 index 0000000..6d4eb10 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-member-expression.js @@ -0,0 +1 @@ +function *g() { return yield.x; } diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-parameter.failure.json b/lib/test/esprima/ES6/yield/invalid-yield-generator-parameter.failure.json new file mode 100644 index 0000000..f699f8d --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-parameter.failure.json @@ -0,0 +1 @@ +{"index":12,"lineNumber":1,"column":13,"message":"Error: Line 1: Unexpected token yield","description":"Unexpected token yield"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-parameter.js b/lib/test/esprima/ES6/yield/invalid-yield-generator-parameter.js new file mode 100644 index 0000000..572f574 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-parameter.js @@ -0,0 +1 @@ +function *g(yield){} diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-rest.failure.json b/lib/test/esprima/ES6/yield/invalid-yield-generator-rest.failure.json new file mode 100644 index 0000000..590e929 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-rest.failure.json @@ -0,0 +1 @@ +{"index":24,"lineNumber":1,"column":25,"message":"Error: Line 1: Unexpected token yield","description":"Unexpected token yield"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-rest.js b/lib/test/esprima/ES6/yield/invalid-yield-generator-rest.js new file mode 100644 index 0000000..7a23544 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-rest.js @@ -0,0 +1 @@ +function *g(a, b, c, ...yield){} diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-strict-function-expression.failure.json b/lib/test/esprima/ES6/yield/invalid-yield-generator-strict-function-expression.failure.json new file mode 100644 index 0000000..9764458 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-strict-function-expression.failure.json @@ -0,0 +1 @@ +{"index":46,"lineNumber":1,"column":47,"message":"Error: Line 1: Use of future reserved word in strict mode","description":"Use of future reserved word in strict mode"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-strict-function-expression.js b/lib/test/esprima/ES6/yield/invalid-yield-generator-strict-function-expression.js new file mode 100644 index 0000000..980df04 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-strict-function-expression.js @@ -0,0 +1 @@ +"use strict"; function *g(){ var y = function yield(){}; } diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-strict-function-parameter.failure.json b/lib/test/esprima/ES6/yield/invalid-yield-generator-strict-function-parameter.failure.json new file mode 100644 index 0000000..caac5d2 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-strict-function-parameter.failure.json @@ -0,0 +1 @@ +{"index":47,"lineNumber":1,"column":48,"message":"Error: Line 1: Use of future reserved word in strict mode","description":"Use of future reserved word in strict mode"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-strict-function-parameter.js b/lib/test/esprima/ES6/yield/invalid-yield-generator-strict-function-parameter.js new file mode 100644 index 0000000..ed19c76 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-strict-function-parameter.js @@ -0,0 +1 @@ +"use strict"; function *g() { var z = function(yield) {} } diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-variable-declaration.failure.json b/lib/test/esprima/ES6/yield/invalid-yield-generator-variable-declaration.failure.json new file mode 100644 index 0000000..82be820 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-variable-declaration.failure.json @@ -0,0 +1 @@ +{"index":20,"lineNumber":1,"column":21,"message":"Error: Line 1: Unexpected token yield","description":"Unexpected token yield"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/invalid-yield-generator-variable-declaration.js b/lib/test/esprima/ES6/yield/invalid-yield-generator-variable-declaration.js new file mode 100644 index 0000000..786e859 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-generator-variable-declaration.js @@ -0,0 +1 @@ +function *g() { var yield; } diff --git a/lib/test/esprima/ES6/yield/invalid-yield-strict-array-pattern.failure.json b/lib/test/esprima/ES6/yield/invalid-yield-strict-array-pattern.failure.json new file mode 100644 index 0000000..6bd6124 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-strict-array-pattern.failure.json @@ -0,0 +1 @@ +{"index":16,"lineNumber":1,"column":17,"message":"Error: Line 1: Use of future reserved word in strict mode","description":"Use of future reserved word in strict mode"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/invalid-yield-strict-array-pattern.js b/lib/test/esprima/ES6/yield/invalid-yield-strict-array-pattern.js new file mode 100644 index 0000000..71fa5c5 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-strict-array-pattern.js @@ -0,0 +1 @@ +"use strict"; ([yield] = x) diff --git a/lib/test/esprima/ES6/yield/invalid-yield-strict-arrow-parameter-default.failure.json b/lib/test/esprima/ES6/yield/invalid-yield-strict-arrow-parameter-default.failure.json new file mode 100644 index 0000000..1795812 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-strict-arrow-parameter-default.failure.json @@ -0,0 +1 @@ +{"index":19,"lineNumber":1,"column":20,"message":"Error: Line 1: Use of future reserved word in strict mode","description":"Use of future reserved word in strict mode"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/invalid-yield-strict-arrow-parameter-default.js b/lib/test/esprima/ES6/yield/invalid-yield-strict-arrow-parameter-default.js new file mode 100644 index 0000000..f1e4209 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-strict-arrow-parameter-default.js @@ -0,0 +1 @@ +"use strict"; (x = yield) => {} diff --git a/lib/test/esprima/ES6/yield/invalid-yield-strict-arrow-parameter-name.failure.json b/lib/test/esprima/ES6/yield/invalid-yield-strict-arrow-parameter-name.failure.json new file mode 100644 index 0000000..37160f2 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-strict-arrow-parameter-name.failure.json @@ -0,0 +1 @@ +{"index":15,"lineNumber":1,"column":16,"message":"Error: Line 1: Use of future reserved word in strict mode","description":"Use of future reserved word in strict mode"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/invalid-yield-strict-arrow-parameter-name.js b/lib/test/esprima/ES6/yield/invalid-yield-strict-arrow-parameter-name.js new file mode 100644 index 0000000..f24afff --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-strict-arrow-parameter-name.js @@ -0,0 +1 @@ +"use strict"; (yield) => 42 diff --git a/lib/test/esprima/ES6/yield/invalid-yield-strict-binding-element.failure.json b/lib/test/esprima/ES6/yield/invalid-yield-strict-binding-element.failure.json new file mode 100644 index 0000000..9f2e4ce --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-strict-binding-element.failure.json @@ -0,0 +1 @@ +{"index":23,"lineNumber":1,"column":24,"message":"Error: Line 1: Use of future reserved word in strict mode","description":"Use of future reserved word in strict mode"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/invalid-yield-strict-binding-element.js b/lib/test/esprima/ES6/yield/invalid-yield-strict-binding-element.js new file mode 100644 index 0000000..f2d5c1f --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-strict-binding-element.js @@ -0,0 +1 @@ +"use strict"; var { x: yield } = foo; diff --git a/lib/test/esprima/ES6/yield/invalid-yield-strict-catch-parameter.failure.json b/lib/test/esprima/ES6/yield/invalid-yield-strict-catch-parameter.failure.json new file mode 100644 index 0000000..693a054 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-strict-catch-parameter.failure.json @@ -0,0 +1 @@ +{"index":28,"lineNumber":1,"column":29,"message":"Error: Line 1: Use of future reserved word in strict mode","description":"Use of future reserved word in strict mode"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/invalid-yield-strict-catch-parameter.js b/lib/test/esprima/ES6/yield/invalid-yield-strict-catch-parameter.js new file mode 100644 index 0000000..f7734c9 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-strict-catch-parameter.js @@ -0,0 +1 @@ +"use strict"; try {} catch (yield) {} diff --git a/lib/test/esprima/ES6/yield/invalid-yield-strict-formal-parameter.failure.json b/lib/test/esprima/ES6/yield/invalid-yield-strict-formal-parameter.failure.json new file mode 100644 index 0000000..ab4c948 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-strict-formal-parameter.failure.json @@ -0,0 +1 @@ +{"index":25,"lineNumber":1,"column":26,"message":"Error: Line 1: Use of future reserved word in strict mode","description":"Use of future reserved word in strict mode"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/invalid-yield-strict-formal-parameter.js b/lib/test/esprima/ES6/yield/invalid-yield-strict-formal-parameter.js new file mode 100644 index 0000000..333040f --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-strict-formal-parameter.js @@ -0,0 +1 @@ +"use strict"; function f(yield) {} diff --git a/lib/test/esprima/ES6/yield/invalid-yield-strict-function-declaration.failure.json b/lib/test/esprima/ES6/yield/invalid-yield-strict-function-declaration.failure.json new file mode 100644 index 0000000..6cfd8b8 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-strict-function-declaration.failure.json @@ -0,0 +1 @@ +{"index":9,"lineNumber":1,"column":10,"message":"Error: Line 1: Use of future reserved word in strict mode","description":"Use of future reserved word in strict mode"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/invalid-yield-strict-function-declaration.js b/lib/test/esprima/ES6/yield/invalid-yield-strict-function-declaration.js new file mode 100644 index 0000000..01909ba --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-strict-function-declaration.js @@ -0,0 +1 @@ +function yield(){ "use strict"; } diff --git a/lib/test/esprima/ES6/yield/invalid-yield-strict-function-expression.failure.json b/lib/test/esprima/ES6/yield/invalid-yield-strict-function-expression.failure.json new file mode 100644 index 0000000..5a08daf --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-strict-function-expression.failure.json @@ -0,0 +1 @@ +{"index":10,"lineNumber":1,"column":11,"message":"Error: Line 1: Use of future reserved word in strict mode","description":"Use of future reserved word in strict mode"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/invalid-yield-strict-function-expression.js b/lib/test/esprima/ES6/yield/invalid-yield-strict-function-expression.js new file mode 100644 index 0000000..e0b8151 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-strict-function-expression.js @@ -0,0 +1 @@ +(function yield(){ "use strict"; }) diff --git a/lib/test/esprima/ES6/yield/invalid-yield-strict-identifier.failure.json b/lib/test/esprima/ES6/yield/invalid-yield-strict-identifier.failure.json new file mode 100644 index 0000000..ab03f33 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-strict-identifier.failure.json @@ -0,0 +1 @@ +{"index":29,"lineNumber":1,"column":30,"message":"Error: Line 1: Use of future reserved word in strict mode","description":"Use of future reserved word in strict mode"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/invalid-yield-strict-identifier.js b/lib/test/esprima/ES6/yield/invalid-yield-strict-identifier.js new file mode 100644 index 0000000..bba51e2 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-strict-identifier.js @@ -0,0 +1 @@ +"use strict"; function f() { yield } diff --git a/lib/test/esprima/ES6/yield/invalid-yield-strict-lexical-declaration.failure.json b/lib/test/esprima/ES6/yield/invalid-yield-strict-lexical-declaration.failure.json new file mode 100644 index 0000000..403d3be --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-strict-lexical-declaration.failure.json @@ -0,0 +1 @@ +{"index":18,"lineNumber":1,"column":19,"message":"Error: Line 1: Use of future reserved word in strict mode","description":"Use of future reserved word in strict mode"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/invalid-yield-strict-lexical-declaration.js b/lib/test/esprima/ES6/yield/invalid-yield-strict-lexical-declaration.js new file mode 100644 index 0000000..71917f9 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-strict-lexical-declaration.js @@ -0,0 +1 @@ +"use strict"; let yield = 42; diff --git a/lib/test/esprima/ES6/yield/invalid-yield-strict-rest-parameter.failure.json b/lib/test/esprima/ES6/yield/invalid-yield-strict-rest-parameter.failure.json new file mode 100644 index 0000000..693a054 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-strict-rest-parameter.failure.json @@ -0,0 +1 @@ +{"index":28,"lineNumber":1,"column":29,"message":"Error: Line 1: Use of future reserved word in strict mode","description":"Use of future reserved word in strict mode"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/invalid-yield-strict-rest-parameter.js b/lib/test/esprima/ES6/yield/invalid-yield-strict-rest-parameter.js new file mode 100644 index 0000000..d9d6362 --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-strict-rest-parameter.js @@ -0,0 +1 @@ +"use strict"; function f(...yield) {} diff --git a/lib/test/esprima/ES6/yield/invalid-yield-strict-variable-declaration.failure.json b/lib/test/esprima/ES6/yield/invalid-yield-strict-variable-declaration.failure.json new file mode 100644 index 0000000..403d3be --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-strict-variable-declaration.failure.json @@ -0,0 +1 @@ +{"index":18,"lineNumber":1,"column":19,"message":"Error: Line 1: Use of future reserved word in strict mode","description":"Use of future reserved word in strict mode"} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/invalid-yield-strict-variable-declaration.js b/lib/test/esprima/ES6/yield/invalid-yield-strict-variable-declaration.js new file mode 100644 index 0000000..455ea8a --- /dev/null +++ b/lib/test/esprima/ES6/yield/invalid-yield-strict-variable-declaration.js @@ -0,0 +1 @@ +"use strict"; var yield; diff --git a/lib/test/esprima/ES6/yield/yield-array-pattern.js b/lib/test/esprima/ES6/yield/yield-array-pattern.js new file mode 100644 index 0000000..f4a21e5 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-array-pattern.js @@ -0,0 +1 @@ +([yield] = x) diff --git a/lib/test/esprima/ES6/yield/yield-array-pattern.tree.json b/lib/test/esprima/ES6/yield/yield-array-pattern.tree.json new file mode 100644 index 0000000..1f9d172 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-array-pattern.tree.json @@ -0,0 +1,238 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 1, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "AssignmentExpression", + "operator": "=", + "left": { + "range": [ + 1, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 2, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Identifier", + "name": "yield" + } + ] + }, + "right": { + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "Identifier", + "name": "x" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 2, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-arrow-concise-body.js b/lib/test/esprima/ES6/yield/yield-arrow-concise-body.js new file mode 100644 index 0000000..e6844e3 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-arrow-concise-body.js @@ -0,0 +1 @@ +(x) => x * yield; diff --git a/lib/test/esprima/ES6/yield/yield-arrow-concise-body.tree.json b/lib/test/esprima/ES6/yield/yield-arrow-concise-body.tree.json new file mode 100644 index 0000000..4818ec6 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-arrow-concise-body.tree.json @@ -0,0 +1,277 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "type": "Identifier", + "name": "x" + } + ], + "body": { + "range": [ + 7, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "BinaryExpression", + "operator": "*", + "left": { + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "Identifier", + "name": "x" + }, + "right": { + "range": [ + 11, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "Identifier", + "name": "yield" + } + }, + "generator": false, + "expression": true + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 11, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-arrow-function-body.diff b/lib/test/esprima/ES6/yield/yield-arrow-function-body.diff new file mode 100644 index 0000000..37a1096 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-arrow-function-body.diff @@ -0,0 +1,16 @@ +{ + 'body': { + '0': { + 'expression': { + 'body': { + 'body': { + '0': { + 'range': { '1': 18 }, + 'loc': { 'end': { 'column': 18 }}, + } + } + } + } + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-arrow-function-body.js b/lib/test/esprima/ES6/yield/yield-arrow-function-body.js new file mode 100644 index 0000000..b8c73aa --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-arrow-function-body.js @@ -0,0 +1 @@ +(z) => { yield + z }; diff --git a/lib/test/esprima/ES6/yield/yield-arrow-function-body.tree.json b/lib/test/esprima/ES6/yield/yield-arrow-function-body.tree.json new file mode 100644 index 0000000..3a10c00 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-arrow-function-body.tree.json @@ -0,0 +1,349 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "type": "Identifier", + "name": "z" + } + ], + "body": { + "range": [ + 7, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 9, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 9, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "BinaryExpression", + "operator": "+", + "left": { + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Identifier", + "name": "yield" + }, + "right": { + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "Identifier", + "name": "z" + } + } + } + ] + }, + "generator": false, + "expression": false + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-arrow-parameter-default.js b/lib/test/esprima/ES6/yield/yield-arrow-parameter-default.js new file mode 100644 index 0000000..e4bd6e2 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-arrow-parameter-default.js @@ -0,0 +1 @@ +(x = yield) => {} diff --git a/lib/test/esprima/ES6/yield/yield-arrow-parameter-default.skip b/lib/test/esprima/ES6/yield/yield-arrow-parameter-default.skip new file mode 100644 index 0000000..ed7bd50 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-arrow-parameter-default.skip @@ -0,0 +1 @@ +TODO: parse errors diff --git a/lib/test/esprima/ES6/yield/yield-arrow-parameter-default.tree.json b/lib/test/esprima/ES6/yield/yield-arrow-parameter-default.tree.json new file mode 100644 index 0000000..40531d3 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-arrow-parameter-default.tree.json @@ -0,0 +1,277 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "AssignmentPattern", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "right": { + "type": "Identifier", + "name": "yield", + "range": [ + 5, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 1, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 5, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/yield-arrow-parameter-name.js b/lib/test/esprima/ES6/yield/yield-arrow-parameter-name.js new file mode 100644 index 0000000..db130ff --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-arrow-parameter-name.js @@ -0,0 +1 @@ +(yield) => 42; diff --git a/lib/test/esprima/ES6/yield/yield-arrow-parameter-name.tree.json b/lib/test/esprima/ES6/yield/yield-arrow-parameter-name.tree.json new file mode 100644 index 0000000..b7f5d38 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-arrow-parameter-name.tree.json @@ -0,0 +1,206 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "range": [ + 1, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "Identifier", + "name": "yield" + } + ], + "body": { + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "Literal", + "value": 42, + "raw": "42" + }, + "generator": false, + "expression": true + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 1, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-binding-element.js b/lib/test/esprima/ES6/yield/yield-binding-element.js new file mode 100644 index 0000000..4e915ae --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-binding-element.js @@ -0,0 +1 @@ +var { x: yield } = foo; diff --git a/lib/test/esprima/ES6/yield/yield-binding-element.tree.json b/lib/test/esprima/ES6/yield/yield-binding-element.tree.json new file mode 100644 index 0000000..c179760 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-binding-element.tree.json @@ -0,0 +1,315 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "ObjectPattern", + "properties": [ + { + "range": [ + 6, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Property", + "key": { + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Identifier", + "name": "x" + }, + "computed": false, + "value": { + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Identifier", + "name": "yield" + }, + "kind": "init", + "method": false, + "shorthand": false + } + ] + }, + "init": { + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "Identifier", + "name": "foo" + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-binding-property.js b/lib/test/esprima/ES6/yield/yield-binding-property.js new file mode 100644 index 0000000..2387b61 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-binding-property.js @@ -0,0 +1 @@ +var { yield: x } = foo; diff --git a/lib/test/esprima/ES6/yield/yield-binding-property.tree.json b/lib/test/esprima/ES6/yield/yield-binding-property.tree.json new file mode 100644 index 0000000..5c0c5cb --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-binding-property.tree.json @@ -0,0 +1,315 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "ObjectPattern", + "properties": [ + { + "range": [ + 6, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Property", + "key": { + "range": [ + 6, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Identifier", + "name": "yield" + }, + "computed": false, + "value": { + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Identifier", + "name": "x" + }, + "kind": "init", + "method": false, + "shorthand": false + } + ] + }, + "init": { + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "Identifier", + "name": "foo" + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 6, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-call-expression-property.js b/lib/test/esprima/ES6/yield/yield-call-expression-property.js new file mode 100644 index 0000000..3faf414 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-call-expression-property.js @@ -0,0 +1 @@ +function *g() { obj.yield(); } diff --git a/lib/test/esprima/ES6/yield/yield-call-expression-property.tree.json b/lib/test/esprima/ES6/yield/yield-call-expression-property.tree.json new file mode 100644 index 0000000..682a072 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-call-expression-property.tree.json @@ -0,0 +1,402 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Identifier", + "name": "g" + }, + "params": [], + "body": { + "range": [ + 14, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 16, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 16, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "type": "CallExpression", + "callee": { + "range": [ + 16, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "MemberExpression", + "computed": false, + "object": { + "range": [ + 16, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "type": "Identifier", + "name": "obj" + }, + "property": { + "range": [ + 20, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "Identifier", + "name": "yield" + } + }, + "arguments": [] + } + } + ] + }, + "generator": true, + "expression": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "g", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "obj", + "range": [ + 16, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 20, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + } + ], + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-catch-parameter.js b/lib/test/esprima/ES6/yield/yield-catch-parameter.js new file mode 100644 index 0000000..42c9869 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-catch-parameter.js @@ -0,0 +1 @@ +try {} catch (yield) {} diff --git a/lib/test/esprima/ES6/yield/yield-catch-parameter.tree.json b/lib/test/esprima/ES6/yield/yield-catch-parameter.tree.json new file mode 100644 index 0000000..f6b867e --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-catch-parameter.tree.json @@ -0,0 +1,273 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "type": "TryStatement", + "block": { + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "BlockStatement", + "body": [] + }, + "handler": { + "range": [ + 7, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "type": "CatchClause", + "param": { + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "type": "Identifier", + "name": "yield" + }, + "body": { + "range": [ + 21, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "type": "BlockStatement", + "body": [] + } + }, + "finalizer": null + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "try", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "catch", + "range": [ + 7, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-expression-precedence.diff b/lib/test/esprima/ES6/yield/yield-expression-precedence.diff new file mode 100644 index 0000000..347dd90 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-expression-precedence.diff @@ -0,0 +1,14 @@ +{ + 'body': { + '0': { + 'body': { + 'body': { + '0': { + 'range': { '1': 40 }, + 'loc': { 'end': { 'column': 40 }} + } + } + } + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-expression-precedence.js b/lib/test/esprima/ES6/yield/yield-expression-precedence.js new file mode 100644 index 0000000..5dca227 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-expression-precedence.js @@ -0,0 +1 @@ +function *g() { yield a=b, yield* c=d, e } diff --git a/lib/test/esprima/ES6/yield/yield-expression-precedence.tree.json b/lib/test/esprima/ES6/yield/yield-expression-precedence.tree.json new file mode 100644 index 0000000..2ba3ed9 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-expression-precedence.tree.json @@ -0,0 +1,619 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Identifier", + "name": "g" + }, + "params": [], + "body": { + "range": [ + 14, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 16, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 16, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "type": "SequenceExpression", + "expressions": [ + { + "range": [ + 16, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "YieldExpression", + "argument": { + "range": [ + 22, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "AssignmentExpression", + "operator": "=", + "left": { + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "type": "Identifier", + "name": "a" + }, + "right": { + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "Identifier", + "name": "b" + } + }, + "delegate": false + }, + { + "range": [ + 27, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "type": "YieldExpression", + "argument": { + "range": [ + 34, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "type": "AssignmentExpression", + "operator": "=", + "left": { + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "type": "Identifier", + "name": "c" + }, + "right": { + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "type": "Identifier", + "name": "d" + } + }, + "delegate": true + }, + { + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "type": "Identifier", + "name": "e" + } + ] + } + } + ] + }, + "generator": true, + "expression": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "g", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 27, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Identifier", + "value": "e", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + } + ], + "range": [ + 0, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-function-declaration-formal-parameter.js b/lib/test/esprima/ES6/yield/yield-function-declaration-formal-parameter.js new file mode 100644 index 0000000..0f1d08c --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-function-declaration-formal-parameter.js @@ -0,0 +1 @@ +function f(yield) {} diff --git a/lib/test/esprima/ES6/yield/yield-function-declaration-formal-parameter.tree.json b/lib/test/esprima/ES6/yield/yield-function-declaration-formal-parameter.tree.json new file mode 100644 index 0000000..9e44f5b --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-function-declaration-formal-parameter.tree.json @@ -0,0 +1,223 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Identifier", + "name": "f" + }, + "params": [ + { + "range": [ + 11, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "Identifier", + "name": "yield" + } + ], + "body": { + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 11, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-function-declaration.js b/lib/test/esprima/ES6/yield/yield-function-declaration.js new file mode 100644 index 0000000..fe8a313 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-function-declaration.js @@ -0,0 +1 @@ +function yield(){} diff --git a/lib/test/esprima/ES6/yield/yield-function-declaration.tree.json b/lib/test/esprima/ES6/yield/yield-function-declaration.tree.json new file mode 100644 index 0000000..9f3956c --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-function-declaration.tree.json @@ -0,0 +1,186 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Identifier", + "name": "yield" + }, + "params": [], + "body": { + "range": [ + 16, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-function-expression-parameter.js b/lib/test/esprima/ES6/yield/yield-function-expression-parameter.js new file mode 100644 index 0000000..0f2ffa3 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-function-expression-parameter.js @@ -0,0 +1 @@ +(function(yield) {}) diff --git a/lib/test/esprima/ES6/yield/yield-function-expression-parameter.tree.json b/lib/test/esprima/ES6/yield/yield-function-expression-parameter.tree.json new file mode 100644 index 0000000..cd5bf1e --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-function-expression-parameter.tree.json @@ -0,0 +1,241 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 1, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [ + { + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "Identifier", + "name": "yield" + } + ], + "body": { + "range": [ + 17, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-function-expression.js b/lib/test/esprima/ES6/yield/yield-function-expression.js new file mode 100644 index 0000000..d8d03fa --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-function-expression.js @@ -0,0 +1 @@ +(function yield(){}) diff --git a/lib/test/esprima/ES6/yield/yield-function-expression.tree.json b/lib/test/esprima/ES6/yield/yield-function-expression.tree.json new file mode 100644 index 0000000..8eb096f --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-function-expression.tree.json @@ -0,0 +1,239 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 1, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "type": "FunctionExpression", + "id": { + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "Identifier", + "name": "yield" + }, + "params": [], + "body": { + "range": [ + 17, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-generator-arrow-concise-body.js b/lib/test/esprima/ES6/yield/yield-generator-arrow-concise-body.js new file mode 100644 index 0000000..9d1bde8 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-generator-arrow-concise-body.js @@ -0,0 +1 @@ +function *g() { (x) => x * yield; } diff --git a/lib/test/esprima/ES6/yield/yield-generator-arrow-concise-body.tree.json b/lib/test/esprima/ES6/yield/yield-generator-arrow-concise-body.tree.json new file mode 100644 index 0000000..2b0188b --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-generator-arrow-concise-body.tree.json @@ -0,0 +1,460 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Identifier", + "name": "g" + }, + "params": [], + "body": { + "range": [ + 14, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 16, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 16, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "Identifier", + "name": "x" + } + ], + "body": { + "range": [ + 23, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "type": "BinaryExpression", + "operator": "*", + "left": { + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "type": "Identifier", + "name": "x" + }, + "right": { + "range": [ + 27, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "type": "Identifier", + "name": "yield" + } + }, + "generator": false, + "expression": true + } + } + ] + }, + "generator": true, + "expression": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "g", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 20, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 27, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-generator-arrow-default.js b/lib/test/esprima/ES6/yield/yield-generator-arrow-default.js new file mode 100644 index 0000000..fafac7f --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-generator-arrow-default.js @@ -0,0 +1 @@ +function *g() { (x = yield) => {} } diff --git a/lib/test/esprima/ES6/yield/yield-generator-arrow-default.skip b/lib/test/esprima/ES6/yield/yield-generator-arrow-default.skip new file mode 100644 index 0000000..ed7bd50 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-generator-arrow-default.skip @@ -0,0 +1 @@ +TODO: parse errors diff --git a/lib/test/esprima/ES6/yield/yield-generator-arrow-default.tree.json b/lib/test/esprima/ES6/yield/yield-generator-arrow-default.tree.json new file mode 100644 index 0000000..f2f6cf4 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-generator-arrow-default.tree.json @@ -0,0 +1,460 @@ +{ + "type": "Program", + "body": [ + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "g", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "AssignmentPattern", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "right": { + "type": "Identifier", + "range": [ + 21, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "name": "yield" + }, + "range": [ + 17, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 31, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 16, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "range": [ + 16, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "range": [ + 14, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + "generator": true, + "expression": false, + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "g", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 21, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 28, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/yield-generator-arrow-function-body.diff b/lib/test/esprima/ES6/yield/yield-generator-arrow-function-body.diff new file mode 100644 index 0000000..61889d7 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-generator-arrow-function-body.diff @@ -0,0 +1,22 @@ +{ + 'body': { + '0': { + 'body': { + 'body': { + '0': { + 'expression': { + 'body': { + 'body': { + '0': { + 'range': { '1': 34 }, + 'loc': { 'end': { 'column': 34 }} + } + } + } + } + } + } + } + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-generator-arrow-function-body.js b/lib/test/esprima/ES6/yield/yield-generator-arrow-function-body.js new file mode 100644 index 0000000..7f27722 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-generator-arrow-function-body.js @@ -0,0 +1 @@ +function *g() { (z) => { yield + z }; } diff --git a/lib/test/esprima/ES6/yield/yield-generator-arrow-function-body.tree.json b/lib/test/esprima/ES6/yield/yield-generator-arrow-function-body.tree.json new file mode 100644 index 0000000..795a1be --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-generator-arrow-function-body.tree.json @@ -0,0 +1,532 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Identifier", + "name": "g" + }, + "params": [], + "body": { + "range": [ + 14, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 16, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 16, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "Identifier", + "name": "z" + } + ], + "body": { + "range": [ + 23, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 25, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 25, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "type": "BinaryExpression", + "operator": "+", + "left": { + "range": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "type": "Identifier", + "name": "yield" + }, + "right": { + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "type": "Identifier", + "name": "z" + } + } + } + ] + }, + "generator": false, + "expression": false + } + } + ] + }, + "generator": true, + "expression": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "g", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 20, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + } + ], + "range": [ + 0, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-generator-declaration.js b/lib/test/esprima/ES6/yield/yield-generator-declaration.js new file mode 100644 index 0000000..be10f1b --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-generator-declaration.js @@ -0,0 +1 @@ +function *yield(){} diff --git a/lib/test/esprima/ES6/yield/yield-generator-declaration.tree.json b/lib/test/esprima/ES6/yield/yield-generator-declaration.tree.json new file mode 100644 index 0000000..942749c --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-generator-declaration.tree.json @@ -0,0 +1,204 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "Identifier", + "name": "yield" + }, + "params": [], + "body": { + "range": [ + 17, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": true, + "expression": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-generator-default-parameter.diff b/lib/test/esprima/ES6/yield/yield-generator-default-parameter.diff new file mode 100644 index 0000000..355a6aa --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-generator-default-parameter.diff @@ -0,0 +1,21 @@ +{ + 'errors': [ + { + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, + "message":"Yield expression not allowed in formal parameter" + } + ], + 'body': { + '0': { + 'params': { + '0': { + 'right': { + 'name': undefined, + 'type': 'YieldExpression', + 'delegate': false, + } + } + } + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-generator-default-parameter.js b/lib/test/esprima/ES6/yield/yield-generator-default-parameter.js new file mode 100644 index 0000000..98b544c --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-generator-default-parameter.js @@ -0,0 +1 @@ +function *g(x = yield){} diff --git a/lib/test/esprima/ES6/yield/yield-generator-default-parameter.tree.json b/lib/test/esprima/ES6/yield/yield-generator-default-parameter.tree.json new file mode 100644 index 0000000..efe28b0 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-generator-default-parameter.tree.json @@ -0,0 +1,312 @@ +{ + "type": "Program", + "body": [ + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "g", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "params": [ + { + "type": "AssignmentPattern", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "right": { + "type": "Identifier", + "name": "yield", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 12, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 22, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "generator": true, + "expression": false, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "g", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/ES6/yield/yield-generator-function-expression.js b/lib/test/esprima/ES6/yield/yield-generator-function-expression.js new file mode 100644 index 0000000..be9d93e --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-generator-function-expression.js @@ -0,0 +1 @@ +function *g(){ var y = function yield(){}; } diff --git a/lib/test/esprima/ES6/yield/yield-generator-function-expression.tree.json b/lib/test/esprima/ES6/yield/yield-generator-function-expression.tree.json new file mode 100644 index 0000000..d4bc5d7 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-generator-function-expression.tree.json @@ -0,0 +1,496 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Identifier", + "name": "g" + }, + "params": [], + "body": { + "range": [ + 13, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 15, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 19, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "Identifier", + "name": "y" + }, + "init": { + "range": [ + 23, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "type": "FunctionExpression", + "id": { + "range": [ + 32, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "type": "Identifier", + "name": "yield" + }, + "params": [], + "body": { + "range": [ + 39, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false + } + } + ], + "kind": "var" + } + ] + }, + "generator": true, + "expression": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "g", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 23, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 32, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 44 + } + } + } + ], + "range": [ + 0, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-generator-function-parameter.diff b/lib/test/esprima/ES6/yield/yield-generator-function-parameter.diff new file mode 100644 index 0000000..340ad40 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-generator-function-parameter.diff @@ -0,0 +1,14 @@ +{ + 'body': { + '0': { + 'body': { + 'body': { + '0': { + 'range': { '1': 42 }, + 'loc': { 'end': { 'column': 42 }} + } + } + } + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-generator-function-parameter.js b/lib/test/esprima/ES6/yield/yield-generator-function-parameter.js new file mode 100644 index 0000000..95cb17a --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-generator-function-parameter.js @@ -0,0 +1 @@ +function *g() { var z = function(yield) {} } diff --git a/lib/test/esprima/ES6/yield/yield-generator-function-parameter.tree.json b/lib/test/esprima/ES6/yield/yield-generator-function-parameter.tree.json new file mode 100644 index 0000000..1ba44ec --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-generator-function-parameter.tree.json @@ -0,0 +1,480 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Identifier", + "name": "g" + }, + "params": [], + "body": { + "range": [ + 14, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 16, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 20, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "type": "Identifier", + "name": "z" + }, + "init": { + "range": [ + 24, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [ + { + "range": [ + 33, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "type": "Identifier", + "name": "yield" + } + ], + "body": { + "range": [ + 40, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false + } + } + ], + "kind": "var" + } + ] + }, + "generator": true, + "expression": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "g", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 16, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 24, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 33, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 44 + } + } + } + ], + "range": [ + 0, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-generator-method.js b/lib/test/esprima/ES6/yield/yield-generator-method.js new file mode 100644 index 0000000..09dacca --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-generator-method.js @@ -0,0 +1 @@ +({ *yield() {} }) diff --git a/lib/test/esprima/ES6/yield/yield-generator-method.tree.json b/lib/test/esprima/ES6/yield/yield-generator-method.tree.json new file mode 100644 index 0000000..f0e09f4 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-generator-method.tree.json @@ -0,0 +1,316 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 1, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "ObjectExpression", + "properties": [ + { + "range": [ + 3, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Property", + "key": { + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "Identifier", + "name": "yield" + }, + "computed": false, + "value": { + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": true, + "expression": false + }, + "kind": "init", + "method": true, + "shorthand": false + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-generator-parameter-object-pattern.js b/lib/test/esprima/ES6/yield/yield-generator-parameter-object-pattern.js new file mode 100644 index 0000000..a97e637 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-generator-parameter-object-pattern.js @@ -0,0 +1 @@ +function *g({yield: y}){} diff --git a/lib/test/esprima/ES6/yield/yield-generator-parameter-object-pattern.tree.json b/lib/test/esprima/ES6/yield/yield-generator-parameter-object-pattern.tree.json new file mode 100644 index 0000000..98c8ca2 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-generator-parameter-object-pattern.tree.json @@ -0,0 +1,371 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Identifier", + "name": "g" + }, + "params": [ + { + "range": [ + 12, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "ObjectPattern", + "properties": [ + { + "range": [ + 13, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "type": "Property", + "key": { + "range": [ + 13, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "Identifier", + "name": "yield" + }, + "computed": false, + "value": { + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "type": "Identifier", + "name": "y" + }, + "kind": "init", + "method": false, + "shorthand": false + } + ] + } + ], + "body": { + "range": [ + 23, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": true, + "expression": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "g", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 13, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-lexical-declaration.js b/lib/test/esprima/ES6/yield/yield-lexical-declaration.js new file mode 100644 index 0000000..f2faf61 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-lexical-declaration.js @@ -0,0 +1 @@ +let yield = 42; diff --git a/lib/test/esprima/ES6/yield/yield-lexical-declaration.tree.json b/lib/test/esprima/ES6/yield/yield-lexical-declaration.tree.json new file mode 100644 index 0000000..176feef --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-lexical-declaration.tree.json @@ -0,0 +1,186 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "Identifier", + "name": "yield" + }, + "init": { + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Literal", + "value": 42, + "raw": "42" + } + } + ], + "kind": "let" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "let", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-member-expression-property.js b/lib/test/esprima/ES6/yield/yield-member-expression-property.js new file mode 100644 index 0000000..aa6e4c8 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-member-expression-property.js @@ -0,0 +1 @@ +function *g() { yield obj.yield; } diff --git a/lib/test/esprima/ES6/yield/yield-member-expression-property.tree.json b/lib/test/esprima/ES6/yield/yield-member-expression-property.tree.json new file mode 100644 index 0000000..670e7c9 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-member-expression-property.tree.json @@ -0,0 +1,384 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Identifier", + "name": "g" + }, + "params": [], + "body": { + "range": [ + 14, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 16, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 16, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "type": "YieldExpression", + "argument": { + "range": [ + 22, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "type": "MemberExpression", + "computed": false, + "object": { + "range": [ + 22, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "Identifier", + "name": "obj" + }, + "property": { + "range": [ + 26, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "type": "Identifier", + "name": "yield" + } + }, + "delegate": false + } + } + ] + }, + "generator": true, + "expression": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "g", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "obj", + "range": [ + 22, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 26, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-method.js b/lib/test/esprima/ES6/yield/yield-method.js new file mode 100644 index 0000000..fe20708 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-method.js @@ -0,0 +1 @@ +({ yield() {} }) diff --git a/lib/test/esprima/ES6/yield/yield-method.tree.json b/lib/test/esprima/ES6/yield/yield-method.tree.json new file mode 100644 index 0000000..aa2caf7 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-method.tree.json @@ -0,0 +1,298 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 1, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "ObjectExpression", + "properties": [ + { + "range": [ + 3, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "Property", + "key": { + "range": [ + 3, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "Identifier", + "name": "yield" + }, + "computed": false, + "value": { + "range": [ + 8, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false + }, + "kind": "init", + "method": true, + "shorthand": false + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 3, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-parameter-object-pattern.js b/lib/test/esprima/ES6/yield/yield-parameter-object-pattern.js new file mode 100644 index 0000000..fe3cb6d --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-parameter-object-pattern.js @@ -0,0 +1 @@ +function f({yield: y}){} diff --git a/lib/test/esprima/ES6/yield/yield-parameter-object-pattern.tree.json b/lib/test/esprima/ES6/yield/yield-parameter-object-pattern.tree.json new file mode 100644 index 0000000..0ccf28a --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-parameter-object-pattern.tree.json @@ -0,0 +1,353 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Identifier", + "name": "f" + }, + "params": [ + { + "range": [ + 11, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "type": "ObjectPattern", + "properties": [ + { + "range": [ + 12, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "Property", + "key": { + "range": [ + 12, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "Identifier", + "name": "yield" + }, + "computed": false, + "value": { + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "type": "Identifier", + "name": "y" + }, + "kind": "init", + "method": false, + "shorthand": false + } + ] + } + ], + "body": { + "range": [ + 22, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 12, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-rest-parameter.js b/lib/test/esprima/ES6/yield/yield-rest-parameter.js new file mode 100644 index 0000000..0a895a5 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-rest-parameter.js @@ -0,0 +1 @@ +function f(...yield) {} diff --git a/lib/test/esprima/ES6/yield/yield-rest-parameter.tree.json b/lib/test/esprima/ES6/yield/yield-rest-parameter.tree.json new file mode 100644 index 0000000..85ff3c9 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-rest-parameter.tree.json @@ -0,0 +1,258 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Identifier", + "name": "f" + }, + "params": [ + { + "range": [ + 11, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "type": "RestElement", + "argument": { + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "type": "Identifier", + "name": "yield" + } + } + ], + "body": { + "range": [ + 21, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-strict-binding-property.js b/lib/test/esprima/ES6/yield/yield-strict-binding-property.js new file mode 100644 index 0000000..b904976 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-strict-binding-property.js @@ -0,0 +1 @@ +"use strict"; var { yield: x } = foo; diff --git a/lib/test/esprima/ES6/yield/yield-strict-binding-property.tree.json b/lib/test/esprima/ES6/yield/yield-strict-binding-property.tree.json new file mode 100644 index 0000000..76660c9 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-strict-binding-property.tree.json @@ -0,0 +1,388 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"" + }, + "directive": "use strict" + }, + { + "range": [ + 14, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 18, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 18, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "type": "ObjectPattern", + "properties": [ + { + "range": [ + 20, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "type": "Property", + "key": { + "range": [ + 20, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "Identifier", + "name": "yield" + }, + "computed": false, + "value": { + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "type": "Identifier", + "name": "x" + }, + "kind": "init", + "method": false, + "shorthand": false + } + ] + }, + "init": { + "range": [ + 33, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "type": "Identifier", + "name": "foo" + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 20, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 33, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + ], + "range": [ + 0, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-strict-method.js b/lib/test/esprima/ES6/yield/yield-strict-method.js new file mode 100644 index 0000000..a24661b --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-strict-method.js @@ -0,0 +1 @@ +"use strict"; ({ yield() {} }) diff --git a/lib/test/esprima/ES6/yield/yield-strict-method.tree.json b/lib/test/esprima/ES6/yield/yield-strict-method.tree.json new file mode 100644 index 0000000..cc835bc --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-strict-method.tree.json @@ -0,0 +1,371 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"" + }, + "directive": "use strict" + }, + { + "range": [ + 14, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 15, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "type": "ObjectExpression", + "properties": [ + { + "range": [ + 17, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "type": "Property", + "key": { + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "Identifier", + "name": "yield" + }, + "computed": false, + "value": { + "range": [ + 22, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "range": [ + 25, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false + }, + "kind": "init", + "method": true, + "shorthand": false + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + } + ], + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-super-property.diff b/lib/test/esprima/ES6/yield/yield-super-property.diff new file mode 100644 index 0000000..b29bdbf --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-super-property.diff @@ -0,0 +1,22 @@ +{ + 'body': { + '0': { + 'body': { + 'body': { + '0': { + 'value': { + 'body': { + 'body': { + '0': { + 'range': { '1': 37 }, + 'loc': { 'end': { 'column': 37 }} + } + } + } + } + } + } + } + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-super-property.js b/lib/test/esprima/ES6/yield/yield-super-property.js new file mode 100644 index 0000000..d3a2c77 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-super-property.js @@ -0,0 +1 @@ +class A extends B { X() { super.yield } } diff --git a/lib/test/esprima/ES6/yield/yield-super-property.tree.json b/lib/test/esprima/ES6/yield/yield-super-property.tree.json new file mode 100644 index 0000000..86c33a4 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-super-property.tree.json @@ -0,0 +1,494 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "type": "ClassDeclaration", + "id": { + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Identifier", + "name": "A" + }, + "superClass": { + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "Identifier", + "name": "B" + }, + "body": { + "range": [ + 18, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "type": "ClassBody", + "body": [ + { + "range": [ + 20, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "type": "MethodDefinition", + "key": { + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "type": "Identifier", + "name": "X" + }, + "computed": false, + "value": { + "range": [ + 21, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "range": [ + 24, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 26, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 26, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "type": "MemberExpression", + "computed": false, + "object": { + "range": [ + 26, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "type": "Super" + }, + "property": { + "range": [ + 32, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "type": "Identifier", + "name": "yield" + } + } + } + ] + }, + "generator": false, + "expression": false + }, + "kind": "method", + "static": false + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "B", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "X", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Keyword", + "value": "super", + "range": [ + 26, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 32, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + } + ], + "range": [ + 0, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-variable-declaration.js b/lib/test/esprima/ES6/yield/yield-variable-declaration.js new file mode 100644 index 0000000..1d02d76 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-variable-declaration.js @@ -0,0 +1 @@ +var yield; diff --git a/lib/test/esprima/ES6/yield/yield-variable-declaration.tree.json b/lib/test/esprima/ES6/yield/yield-variable-declaration.tree.json new file mode 100644 index 0000000..17bb77d --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-variable-declaration.tree.json @@ -0,0 +1,132 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "Identifier", + "name": "yield" + }, + "init": null + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-yield-expression-delegate.diff b/lib/test/esprima/ES6/yield/yield-yield-expression-delegate.diff new file mode 100644 index 0000000..b5489a0 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-yield-expression-delegate.diff @@ -0,0 +1,14 @@ +{ + 'body': { + '0': { + 'body': { + 'body': { + '0': { + 'range': { '1': 28 }, + 'loc': { 'end': { 'column': 28 }} + } + } + } + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-yield-expression-delegate.js b/lib/test/esprima/ES6/yield/yield-yield-expression-delegate.js new file mode 100644 index 0000000..800c8c7 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-yield-expression-delegate.js @@ -0,0 +1 @@ +function *g() { yield *yield } diff --git a/lib/test/esprima/ES6/yield/yield-yield-expression-delegate.tree.json b/lib/test/esprima/ES6/yield/yield-yield-expression-delegate.tree.json new file mode 100644 index 0000000..1293e80 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-yield-expression-delegate.tree.json @@ -0,0 +1,313 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Identifier", + "name": "g" + }, + "params": [], + "body": { + "range": [ + 14, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 16, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 16, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "type": "YieldExpression", + "argument": { + "range": [ + 23, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "type": "YieldExpression", + "argument": null, + "delegate": false + }, + "delegate": true + } + } + ] + }, + "generator": true, + "expression": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "g", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 23, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + } + ], + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-yield-expression.diff b/lib/test/esprima/ES6/yield/yield-yield-expression.diff new file mode 100644 index 0000000..4096883 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-yield-expression.diff @@ -0,0 +1,14 @@ +{ + 'body': { + '0': { + 'body': { + 'body': { + '0': { + 'range': { '1': 27 }, + 'loc': { 'end': { 'column': 27 }} + } + } + } + } + } +} diff --git a/lib/test/esprima/ES6/yield/yield-yield-expression.js b/lib/test/esprima/ES6/yield/yield-yield-expression.js new file mode 100644 index 0000000..205c792 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-yield-expression.js @@ -0,0 +1 @@ +function *g() { yield yield } diff --git a/lib/test/esprima/ES6/yield/yield-yield-expression.tree.json b/lib/test/esprima/ES6/yield/yield-yield-expression.tree.json new file mode 100644 index 0000000..bcfa0b4 --- /dev/null +++ b/lib/test/esprima/ES6/yield/yield-yield-expression.tree.json @@ -0,0 +1,295 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Identifier", + "name": "g" + }, + "params": [], + "body": { + "range": [ + 14, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 16, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 16, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "type": "YieldExpression", + "argument": { + "range": [ + 22, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "type": "YieldExpression", + "argument": null, + "delegate": false + }, + "delegate": false + } + } + ] + }, + "generator": true, + "expression": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "g", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 22, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } +} diff --git a/lib/test/esprima/JSX/attribute-double-quoted-string.js b/lib/test/esprima/JSX/attribute-double-quoted-string.js new file mode 100644 index 0000000..f569fc3 --- /dev/null +++ b/lib/test/esprima/JSX/attribute-double-quoted-string.js @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/JSX/attribute-double-quoted-string.tree.json b/lib/test/esprima/JSX/attribute-double-quoted-string.tree.json new file mode 100644 index 0000000..00deb1c --- /dev/null +++ b/lib/test/esprima/JSX/attribute-double-quoted-string.tree.json @@ -0,0 +1,276 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "selfClosing": true, + "attributes": [ + { + "type": "JSXAttribute", + "name": { + "type": "JSXIdentifier", + "name": "href", + "range": [ + 3, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "value": { + "type": "Literal", + "value": "/", + "raw": "\"/\"", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 3, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "children": [], + "closingElement": null, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "JSXIdentifier", + "value": "href", + "range": [ + 3, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "String", + "value": "\"/\"", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/attribute-element.js b/lib/test/esprima/JSX/attribute-element.js new file mode 100644 index 0000000..e3b1d21 --- /dev/null +++ b/lib/test/esprima/JSX/attribute-element.js @@ -0,0 +1 @@ + /> diff --git a/lib/test/esprima/JSX/attribute-element.skip b/lib/test/esprima/JSX/attribute-element.skip new file mode 100644 index 0000000..ed7bd50 --- /dev/null +++ b/lib/test/esprima/JSX/attribute-element.skip @@ -0,0 +1 @@ +TODO: parse errors diff --git a/lib/test/esprima/JSX/attribute-element.tree.json b/lib/test/esprima/JSX/attribute-element.tree.json new file mode 100644 index 0000000..16f38b3 --- /dev/null +++ b/lib/test/esprima/JSX/attribute-element.tree.json @@ -0,0 +1,597 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "america", + "range": [ + 1, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "selfClosing": true, + "attributes": [ + { + "type": "JSXAttribute", + "name": { + "type": "JSXIdentifier", + "name": "state", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "value": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXMemberExpression", + "object": { + "type": "JSXIdentifier", + "name": "usa", + "range": [ + 16, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "property": { + "type": "JSXIdentifier", + "name": "california", + "range": [ + 20, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 16, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "selfClosing": false, + "attributes": [], + "range": [ + 15, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "children": [], + "closingElement": { + "type": "JSXClosingElement", + "name": { + "type": "JSXMemberExpression", + "object": { + "type": "JSXIdentifier", + "name": "usa", + "range": [ + 33, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "property": { + "type": "JSXIdentifier", + "name": "california", + "range": [ + 37, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 47 + } + } + }, + "range": [ + 33, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 47 + } + } + }, + "range": [ + 31, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + "range": [ + 15, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + "range": [ + 9, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 48 + } + } + } + ], + "range": [ + 0, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 51 + } + } + }, + "children": [], + "closingElement": null, + "range": [ + 0, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 51 + } + } + }, + "range": [ + 0, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 51 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "america", + "range": [ + 1, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "JSXIdentifier", + "value": "state", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "JSXIdentifier", + "value": "usa", + "range": [ + 16, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "JSXIdentifier", + "value": "california", + "range": [ + 20, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "JSXIdentifier", + "value": "usa", + "range": [ + 33, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "JSXIdentifier", + "value": "california", + "range": [ + 37, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 47 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 49, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 50 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 50 + }, + "end": { + "line": 1, + "column": 51 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/attribute-entity-decimal.js b/lib/test/esprima/JSX/attribute-entity-decimal.js new file mode 100644 index 0000000..10487b0 --- /dev/null +++ b/lib/test/esprima/JSX/attribute-entity-decimal.js @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/JSX/attribute-entity-decimal.tree.json b/lib/test/esprima/JSX/attribute-entity-decimal.tree.json new file mode 100644 index 0000000..eb5eb90 --- /dev/null +++ b/lib/test/esprima/JSX/attribute-entity-decimal.tree.json @@ -0,0 +1,364 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "sample", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "selfClosing": false, + "attributes": [ + { + "type": "JSXAttribute", + "name": { + "type": "JSXIdentifier", + "name": "test", + "range": [ + 8, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "value": { + "type": "Literal", + "value": "This is © by Joe", + "raw": "\"This is © by Joe\"", + "range": [ + 13, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + "range": [ + 8, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + ], + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "children": [], + "closingElement": { + "type": "JSXClosingElement", + "name": { + "type": "JSXIdentifier", + "name": "sample", + "range": [ + 40, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "range": [ + 38, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 47 + } + } + }, + "range": [ + 0, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + } + }, + "range": [ + 0, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "sample", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "JSXIdentifier", + "value": "test", + "range": [ + 8, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "String", + "value": "\"This is © by Joe\"", + "range": [ + 13, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + { + "type": "JSXIdentifier", + "value": "sample", + "range": [ + 40, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 47 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/attribute-entity-hex.js b/lib/test/esprima/JSX/attribute-entity-hex.js new file mode 100644 index 0000000..a9276b6 --- /dev/null +++ b/lib/test/esprima/JSX/attribute-entity-hex.js @@ -0,0 +1 @@ +

diff --git a/lib/test/esprima/JSX/attribute-entity-hex.tree.json b/lib/test/esprima/JSX/attribute-entity-hex.tree.json new file mode 100644 index 0000000..bb7a942 --- /dev/null +++ b/lib/test/esprima/JSX/attribute-entity-hex.tree.json @@ -0,0 +1,276 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "p", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "selfClosing": true, + "attributes": [ + { + "type": "JSXAttribute", + "name": { + "type": "JSXIdentifier", + "name": "q", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "value": { + "type": "Literal", + "value": "Just my ¢2", + "raw": "\"Just my ¢2\"", + "range": [ + 5, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 3, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "children": [], + "closingElement": null, + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "p", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "JSXIdentifier", + "value": "q", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "String", + "value": "\"Just my ¢2\"", + "range": [ + 5, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/attribute-entity.js b/lib/test/esprima/JSX/attribute-entity.js new file mode 100644 index 0000000..e3827fe --- /dev/null +++ b/lib/test/esprima/JSX/attribute-entity.js @@ -0,0 +1 @@ +Tom & Jerry diff --git a/lib/test/esprima/JSX/attribute-entity.tree.json b/lib/test/esprima/JSX/attribute-entity.tree.json new file mode 100644 index 0000000..d6a1831 --- /dev/null +++ b/lib/test/esprima/JSX/attribute-entity.tree.json @@ -0,0 +1,276 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "img", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "selfClosing": true, + "attributes": [ + { + "type": "JSXAttribute", + "name": { + "type": "JSXIdentifier", + "name": "alt", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "value": { + "type": "Literal", + "value": "Tom & Jerry", + "raw": "\"Tom & Jerry\"", + "range": [ + 9, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 5, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "children": [], + "closingElement": null, + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "img", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "JSXIdentifier", + "value": "alt", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "String", + "value": "\"Tom & Jerry\"", + "range": [ + 9, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/attribute-expression.js b/lib/test/esprima/JSX/attribute-expression.js new file mode 100644 index 0000000..992f42f --- /dev/null +++ b/lib/test/esprima/JSX/attribute-expression.js @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/JSX/attribute-expression.tree.json b/lib/test/esprima/JSX/attribute-expression.tree.json new file mode 100644 index 0000000..c133973 --- /dev/null +++ b/lib/test/esprima/JSX/attribute-expression.tree.json @@ -0,0 +1,434 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "selfClosing": false, + "attributes": [ + { + "type": "JSXAttribute", + "name": { + "type": "JSXIdentifier", + "name": "href", + "range": [ + 3, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "value": { + "type": "JSXExpressionContainer", + "expression": { + "type": "Identifier", + "name": "link", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 8, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 3, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "children": [], + "closingElement": { + "type": "JSXClosingElement", + "name": { + "type": "JSXIdentifier", + "name": "a", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 15, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "JSXIdentifier", + "value": "href", + "range": [ + 3, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "link", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "JSXIdentifier", + "value": "a", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/attribute-multi-entities.js b/lib/test/esprima/JSX/attribute-multi-entities.js new file mode 100644 index 0000000..7db545c --- /dev/null +++ b/lib/test/esprima/JSX/attribute-multi-entities.js @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/JSX/attribute-multi-entities.tree.json b/lib/test/esprima/JSX/attribute-multi-entities.tree.json new file mode 100644 index 0000000..25b98a2 --- /dev/null +++ b/lib/test/esprima/JSX/attribute-multi-entities.tree.json @@ -0,0 +1,276 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "selfClosing": true, + "attributes": [ + { + "type": "JSXAttribute", + "name": { + "type": "JSXIdentifier", + "name": "b", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "value": { + "type": "Literal", + "value": "¢ £", + "raw": "\"¢ £\"", + "range": [ + 5, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 3, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "children": [], + "closingElement": null, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "JSXIdentifier", + "value": "b", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "String", + "value": "\"¢ £\"", + "range": [ + 5, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/attribute-null-value.js b/lib/test/esprima/JSX/attribute-null-value.js new file mode 100644 index 0000000..1a1f2b5 --- /dev/null +++ b/lib/test/esprima/JSX/attribute-null-value.js @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/JSX/attribute-null-value.tree.json b/lib/test/esprima/JSX/attribute-null-value.tree.json new file mode 100644 index 0000000..841058b --- /dev/null +++ b/lib/test/esprima/JSX/attribute-null-value.tree.json @@ -0,0 +1,222 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "input", + "range": [ + 1, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "selfClosing": true, + "attributes": [ + { + "type": "JSXAttribute", + "name": { + "type": "JSXIdentifier", + "name": "disabled", + "range": [ + 7, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "value": null, + "range": [ + 7, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "children": [], + "closingElement": null, + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "input", + "range": [ + 1, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "JSXIdentifier", + "value": "disabled", + "range": [ + 7, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/attribute-primary.js b/lib/test/esprima/JSX/attribute-primary.js new file mode 100644 index 0000000..dd6518d --- /dev/null +++ b/lib/test/esprima/JSX/attribute-primary.js @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/JSX/attribute-primary.tree.json b/lib/test/esprima/JSX/attribute-primary.tree.json new file mode 100644 index 0000000..bae7860 --- /dev/null +++ b/lib/test/esprima/JSX/attribute-primary.tree.json @@ -0,0 +1,347 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "img", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "selfClosing": true, + "attributes": [ + { + "type": "JSXAttribute", + "name": { + "type": "JSXIdentifier", + "name": "width", + "range": [ + 5, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "value": { + "type": "JSXExpressionContainer", + "expression": { + "type": "Literal", + "value": 320, + "raw": "320", + "range": [ + 12, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 11, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 5, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "children": [], + "closingElement": null, + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "img", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "JSXIdentifier", + "value": "width", + "range": [ + 5, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Numeric", + "value": "320", + "range": [ + 12, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/attribute-single-quoted-string.js b/lib/test/esprima/JSX/attribute-single-quoted-string.js new file mode 100644 index 0000000..491a967 --- /dev/null +++ b/lib/test/esprima/JSX/attribute-single-quoted-string.js @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/JSX/attribute-single-quoted-string.tree.json b/lib/test/esprima/JSX/attribute-single-quoted-string.tree.json new file mode 100644 index 0000000..4da7448 --- /dev/null +++ b/lib/test/esprima/JSX/attribute-single-quoted-string.tree.json @@ -0,0 +1,276 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "img", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "selfClosing": true, + "attributes": [ + { + "type": "JSXAttribute", + "name": { + "type": "JSXIdentifier", + "name": "src", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "value": { + "type": "Literal", + "value": "logo.png", + "raw": "'logo.png'", + "range": [ + 9, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "range": [ + 5, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "children": [], + "closingElement": null, + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "img", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "JSXIdentifier", + "value": "src", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "String", + "value": "'logo.png'", + "range": [ + 9, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/attribute-spread.js b/lib/test/esprima/JSX/attribute-spread.js new file mode 100644 index 0000000..ae69ee5 --- /dev/null +++ b/lib/test/esprima/JSX/attribute-spread.js @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/JSX/attribute-spread.tree.json b/lib/test/esprima/JSX/attribute-spread.tree.json new file mode 100644 index 0000000..4240a1a --- /dev/null +++ b/lib/test/esprima/JSX/attribute-spread.tree.json @@ -0,0 +1,381 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "span", + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "selfClosing": false, + "attributes": [ + { + "type": "JSXSpreadAttribute", + "argument": { + "type": "Identifier", + "name": "style", + "range": [ + 11, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 6, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "children": [], + "closingElement": { + "type": "JSXClosingElement", + "name": { + "type": "JSXIdentifier", + "name": "span", + "range": [ + 20, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "range": [ + 18, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "span", + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 7, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "style", + "range": [ + 11, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "JSXIdentifier", + "value": "span", + "range": [ + 20, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/attribute-unknown-entity.js b/lib/test/esprima/JSX/attribute-unknown-entity.js new file mode 100644 index 0000000..2d86f7d --- /dev/null +++ b/lib/test/esprima/JSX/attribute-unknown-entity.js @@ -0,0 +1 @@ +&copyr; 2016 diff --git a/lib/test/esprima/JSX/attribute-unknown-entity.tree.json b/lib/test/esprima/JSX/attribute-unknown-entity.tree.json new file mode 100644 index 0000000..dd3f579 --- /dev/null +++ b/lib/test/esprima/JSX/attribute-unknown-entity.tree.json @@ -0,0 +1,276 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "img", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "selfClosing": true, + "attributes": [ + { + "type": "JSXAttribute", + "name": { + "type": "JSXIdentifier", + "name": "alt", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "value": { + "type": "Literal", + "value": "©r; 2016", + "raw": "\"©r; 2016\"", + "range": [ + 9, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "range": [ + 5, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "children": [], + "closingElement": null, + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "img", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "JSXIdentifier", + "value": "alt", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "String", + "value": "\"©r; 2016\"", + "range": [ + 9, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/container-object-expression.js b/lib/test/esprima/JSX/container-object-expression.js new file mode 100644 index 0000000..2def23b --- /dev/null +++ b/lib/test/esprima/JSX/container-object-expression.js @@ -0,0 +1 @@ +{ {caption} } diff --git a/lib/test/esprima/JSX/container-object-expression.tree.json b/lib/test/esprima/JSX/container-object-expression.tree.json new file mode 100644 index 0000000..bc3ef6c --- /dev/null +++ b/lib/test/esprima/JSX/container-object-expression.tree.json @@ -0,0 +1,457 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "title", + "range": [ + 1, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "selfClosing": false, + "attributes": [], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "children": [ + { + "type": "JSXExpressionContainer", + "expression": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "caption", + "range": [ + 10, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "computed": false, + "value": { + "type": "Identifier", + "name": "caption", + "range": [ + 10, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "kind": "init", + "method": false, + "shorthand": true, + "range": [ + 10, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "range": [ + 9, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 7, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "closingElement": { + "type": "JSXClosingElement", + "name": { + "type": "JSXIdentifier", + "name": "title", + "range": [ + 22, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "range": [ + 20, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "title", + "range": [ + 1, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "caption", + "range": [ + 10, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "JSXIdentifier", + "value": "title", + "range": [ + 22, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/container-series.js b/lib/test/esprima/JSX/container-series.js new file mode 100644 index 0000000..bdd6399 --- /dev/null +++ b/lib/test/esprima/JSX/container-series.js @@ -0,0 +1 @@ +{x}{y}{z} diff --git a/lib/test/esprima/JSX/container-series.tree.json b/lib/test/esprima/JSX/container-series.tree.json new file mode 100644 index 0000000..8f6f29c --- /dev/null +++ b/lib/test/esprima/JSX/container-series.tree.json @@ -0,0 +1,577 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "span", + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "selfClosing": false, + "attributes": [], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "children": [ + { + "type": "JSXExpressionContainer", + "expression": { + "type": "Identifier", + "name": "x", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "JSXExpressionContainer", + "expression": { + "type": "Identifier", + "name": "y", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 9, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "JSXExpressionContainer", + "expression": { + "type": "Identifier", + "name": "z", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 12, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "closingElement": { + "type": "JSXClosingElement", + "name": { + "type": "JSXIdentifier", + "name": "span", + "range": [ + 17, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "span", + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "JSXIdentifier", + "value": "span", + "range": [ + 17, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/empty-child-comment.js b/lib/test/esprima/JSX/empty-child-comment.js new file mode 100644 index 0000000..c446541 --- /dev/null +++ b/lib/test/esprima/JSX/empty-child-comment.js @@ -0,0 +1 @@ +{/* Hello from this side */} diff --git a/lib/test/esprima/JSX/empty-child-comment.tree.json b/lib/test/esprima/JSX/empty-child-comment.tree.json new file mode 100644 index 0000000..3cb7c2f --- /dev/null +++ b/lib/test/esprima/JSX/empty-child-comment.tree.json @@ -0,0 +1,326 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "adele", + "range": [ + 1, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "selfClosing": false, + "attributes": [], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "children": [ + { + "type": "JSXExpressionContainer", + "expression": { + "type": "JSXEmptyExpression", + "range": [ + 8, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 7, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "closingElement": { + "type": "JSXClosingElement", + "name": { + "type": "JSXIdentifier", + "name": "adele", + "range": [ + 37, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + "range": [ + 35, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + "range": [ + 0, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + "range": [ + 0, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "adele", + "range": [ + 1, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "JSXIdentifier", + "value": "adele", + "range": [ + 37, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/empty-expression-container.js b/lib/test/esprima/JSX/empty-expression-container.js new file mode 100644 index 0000000..3ea97a8 --- /dev/null +++ b/lib/test/esprima/JSX/empty-expression-container.js @@ -0,0 +1 @@ +{} diff --git a/lib/test/esprima/JSX/empty-expression-container.tree.json b/lib/test/esprima/JSX/empty-expression-container.tree.json new file mode 100644 index 0000000..f381457 --- /dev/null +++ b/lib/test/esprima/JSX/empty-expression-container.tree.json @@ -0,0 +1,326 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "body", + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "selfClosing": false, + "attributes": [], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "children": [ + { + "type": "JSXExpressionContainer", + "expression": { + "type": "JSXEmptyExpression", + "range": [ + 7, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "closingElement": { + "type": "JSXClosingElement", + "name": { + "type": "JSXIdentifier", + "name": "body", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "body", + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "JSXIdentifier", + "value": "body", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/inside-group-expression.js b/lib/test/esprima/JSX/inside-group-expression.js new file mode 100644 index 0000000..465dbe7 --- /dev/null +++ b/lib/test/esprima/JSX/inside-group-expression.js @@ -0,0 +1 @@ +var el = ( ) diff --git a/lib/test/esprima/JSX/inside-group-expression.tree.json b/lib/test/esprima/JSX/inside-group-expression.tree.json new file mode 100644 index 0000000..9a43bd5 --- /dev/null +++ b/lib/test/esprima/JSX/inside-group-expression.tree.json @@ -0,0 +1,295 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "el", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "init": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "span", + "range": [ + 12, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "selfClosing": true, + "attributes": [], + "range": [ + 11, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "children": [], + "closingElement": null, + "range": [ + 11, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "range": [ + 4, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "el", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "JSXIdentifier", + "value": "span", + "range": [ + 12, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/invalid-attribute-value-trail.failure.json b/lib/test/esprima/JSX/invalid-attribute-value-trail.failure.json new file mode 100644 index 0000000..bf2cc02 --- /dev/null +++ b/lib/test/esprima/JSX/invalid-attribute-value-trail.failure.json @@ -0,0 +1 @@ +{"index":5,"lineNumber":1,"column":6,"message":"Error: Line 1: Unexpected token :","description":"Unexpected token :"} \ No newline at end of file diff --git a/lib/test/esprima/JSX/invalid-attribute-value-trail.js b/lib/test/esprima/JSX/invalid-attribute-value-trail.js new file mode 100644 index 0000000..85a8136 --- /dev/null +++ b/lib/test/esprima/JSX/invalid-attribute-value-trail.js @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/JSX/invalid-closing-trail.failure.json b/lib/test/esprima/JSX/invalid-closing-trail.failure.json new file mode 100644 index 0000000..60ab38e --- /dev/null +++ b/lib/test/esprima/JSX/invalid-closing-trail.failure.json @@ -0,0 +1 @@ +{"index":3,"lineNumber":1,"column":4,"message":"Error: Line 1: Unexpected token ILLEGAL","description":"Unexpected token ILLEGAL"} \ No newline at end of file diff --git a/lib/test/esprima/JSX/invalid-closing-trail.js b/lib/test/esprima/JSX/invalid-closing-trail.js new file mode 100644 index 0000000..fbc6343 --- /dev/null +++ b/lib/test/esprima/JSX/invalid-closing-trail.js @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/JSX/invalid-empty-attribute-expression.failure.json b/lib/test/esprima/JSX/invalid-empty-attribute-expression.failure.json new file mode 100644 index 0000000..c95ac33 --- /dev/null +++ b/lib/test/esprima/JSX/invalid-empty-attribute-expression.failure.json @@ -0,0 +1 @@ +{"index":10,"lineNumber":1,"column":11,"message":"Error: Line 1: JSX attributes must only be assigned a non-empty expression","description":"JSX attributes must only be assigned a non-empty expression"} diff --git a/lib/test/esprima/JSX/invalid-empty-attribute-expression.js b/lib/test/esprima/JSX/invalid-empty-attribute-expression.js new file mode 100644 index 0000000..f53e116 --- /dev/null +++ b/lib/test/esprima/JSX/invalid-empty-attribute-expression.js @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/JSX/invalid-empty-selfclosing.failure.json b/lib/test/esprima/JSX/invalid-empty-selfclosing.failure.json new file mode 100644 index 0000000..ee4f816 --- /dev/null +++ b/lib/test/esprima/JSX/invalid-empty-selfclosing.failure.json @@ -0,0 +1 @@ +{"index":1,"lineNumber":1,"column":2,"message":"Error: Line 1: Unexpected token /","description":"Unexpected token /"} \ No newline at end of file diff --git a/lib/test/esprima/JSX/invalid-empty-selfclosing.js b/lib/test/esprima/JSX/invalid-empty-selfclosing.js new file mode 100644 index 0000000..8aa9357 --- /dev/null +++ b/lib/test/esprima/JSX/invalid-empty-selfclosing.js @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/JSX/invalid-incomplete-namespace.failure.json b/lib/test/esprima/JSX/invalid-incomplete-namespace.failure.json new file mode 100644 index 0000000..3674791 --- /dev/null +++ b/lib/test/esprima/JSX/invalid-incomplete-namespace.failure.json @@ -0,0 +1 @@ +{"index":6,"lineNumber":1,"column":7,"message":"Error: Line 1: Unexpected token /","description":"Unexpected token /"} \ No newline at end of file diff --git a/lib/test/esprima/JSX/invalid-incomplete-namespace.js b/lib/test/esprima/JSX/invalid-incomplete-namespace.js new file mode 100644 index 0000000..62a9be0 --- /dev/null +++ b/lib/test/esprima/JSX/invalid-incomplete-namespace.js @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/JSX/invalid-match-member.failure.json b/lib/test/esprima/JSX/invalid-match-member.failure.json new file mode 100644 index 0000000..8e8d834 --- /dev/null +++ b/lib/test/esprima/JSX/invalid-match-member.failure.json @@ -0,0 +1 @@ +{"index":19,"lineNumber":1,"column":20,"message":"Error: Line 1: Expected corresponding JSX closing tag for foo.bar","description":"Expected corresponding JSX closing tag for foo.bar"} \ No newline at end of file diff --git a/lib/test/esprima/JSX/invalid-match-member.js b/lib/test/esprima/JSX/invalid-match-member.js new file mode 100644 index 0000000..af7d819 --- /dev/null +++ b/lib/test/esprima/JSX/invalid-match-member.js @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/JSX/invalid-match-name-namespace.failure.json b/lib/test/esprima/JSX/invalid-match-name-namespace.failure.json new file mode 100644 index 0000000..d172eaf --- /dev/null +++ b/lib/test/esprima/JSX/invalid-match-name-namespace.failure.json @@ -0,0 +1 @@ +{"index":17,"lineNumber":1,"column":18,"message":"Error: Line 1: Expected corresponding JSX closing tag for path","description":"Expected corresponding JSX closing tag for path"} \ No newline at end of file diff --git a/lib/test/esprima/JSX/invalid-match-name-namespace.js b/lib/test/esprima/JSX/invalid-match-name-namespace.js new file mode 100644 index 0000000..3911f65 --- /dev/null +++ b/lib/test/esprima/JSX/invalid-match-name-namespace.js @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/JSX/invalid-match-namespace-name.failure.json b/lib/test/esprima/JSX/invalid-match-namespace-name.failure.json new file mode 100644 index 0000000..66313b2 --- /dev/null +++ b/lib/test/esprima/JSX/invalid-match-namespace-name.failure.json @@ -0,0 +1 @@ +{"index":17,"lineNumber":1,"column":18,"message":"Error: Line 1: Expected corresponding JSX closing tag for svg:path","description":"Expected corresponding JSX closing tag for svg:path"} \ No newline at end of file diff --git a/lib/test/esprima/JSX/invalid-match-namespace-name.js b/lib/test/esprima/JSX/invalid-match-namespace-name.js new file mode 100644 index 0000000..7115f8f --- /dev/null +++ b/lib/test/esprima/JSX/invalid-match-namespace-name.js @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/JSX/invalid-match-namespace.failure.json b/lib/test/esprima/JSX/invalid-match-namespace.failure.json new file mode 100644 index 0000000..2b93212 --- /dev/null +++ b/lib/test/esprima/JSX/invalid-match-namespace.failure.json @@ -0,0 +1 @@ +{"index":23,"lineNumber":1,"column":24,"message":"Error: Line 1: Expected corresponding JSX closing tag for svg:path","description":"Expected corresponding JSX closing tag for svg:path"} \ No newline at end of file diff --git a/lib/test/esprima/JSX/invalid-match-namespace.js b/lib/test/esprima/JSX/invalid-match-namespace.js new file mode 100644 index 0000000..4e5d7c0 --- /dev/null +++ b/lib/test/esprima/JSX/invalid-match-namespace.js @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/JSX/invalid-match.failure.json b/lib/test/esprima/JSX/invalid-match.failure.json new file mode 100644 index 0000000..ea3c5ac --- /dev/null +++ b/lib/test/esprima/JSX/invalid-match.failure.json @@ -0,0 +1 @@ +{"index":20,"lineNumber":1,"column":21,"message":"Error: Line 1: Expected corresponding JSX closing tag for strong","description":"Expected corresponding JSX closing tag for strong"} \ No newline at end of file diff --git a/lib/test/esprima/JSX/invalid-match.js b/lib/test/esprima/JSX/invalid-match.js new file mode 100644 index 0000000..6644cb8 --- /dev/null +++ b/lib/test/esprima/JSX/invalid-match.js @@ -0,0 +1 @@ +node = diff --git a/lib/test/esprima/JSX/invalid-member-incomplete.failure.json b/lib/test/esprima/JSX/invalid-member-incomplete.failure.json new file mode 100644 index 0000000..3674791 --- /dev/null +++ b/lib/test/esprima/JSX/invalid-member-incomplete.failure.json @@ -0,0 +1 @@ +{"index":6,"lineNumber":1,"column":7,"message":"Error: Line 1: Unexpected token /","description":"Unexpected token /"} \ No newline at end of file diff --git a/lib/test/esprima/JSX/invalid-member-incomplete.js b/lib/test/esprima/JSX/invalid-member-incomplete.js new file mode 100644 index 0000000..fde2a2e --- /dev/null +++ b/lib/test/esprima/JSX/invalid-member-incomplete.js @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/JSX/invalid-no-closing.failure.json b/lib/test/esprima/JSX/invalid-no-closing.failure.json new file mode 100644 index 0000000..8c570ae --- /dev/null +++ b/lib/test/esprima/JSX/invalid-no-closing.failure.json @@ -0,0 +1 @@ +{"index":4,"lineNumber":2,"column":1,"message":"Error: Line 2: Unexpected token ILLEGAL","description":"Unexpected token ILLEGAL"} \ No newline at end of file diff --git a/lib/test/esprima/JSX/invalid-no-closing.js b/lib/test/esprima/JSX/invalid-no-closing.js new file mode 100644 index 0000000..ece6108 --- /dev/null +++ b/lib/test/esprima/JSX/invalid-no-closing.js @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/JSX/invalid-self-closing.failure.json b/lib/test/esprima/JSX/invalid-self-closing.failure.json new file mode 100644 index 0000000..cf794db --- /dev/null +++ b/lib/test/esprima/JSX/invalid-self-closing.failure.json @@ -0,0 +1 @@ +{"index":3,"lineNumber":1,"column":4,"message":"Error: Line 1: Unexpected token }","description":"Unexpected token }"} \ No newline at end of file diff --git a/lib/test/esprima/JSX/invalid-self-closing.js b/lib/test/esprima/JSX/invalid-self-closing.js new file mode 100644 index 0000000..766714c --- /dev/null +++ b/lib/test/esprima/JSX/invalid-self-closing.js @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/JSX/invalid-start-namespace.failure.json b/lib/test/esprima/JSX/invalid-start-namespace.failure.json new file mode 100644 index 0000000..6bb0147 --- /dev/null +++ b/lib/test/esprima/JSX/invalid-start-namespace.failure.json @@ -0,0 +1 @@ +{"index":1,"lineNumber":1,"column":2,"message":"Error: Line 1: Unexpected token :","description":"Unexpected token :"} \ No newline at end of file diff --git a/lib/test/esprima/JSX/invalid-start-namespace.js b/lib/test/esprima/JSX/invalid-start-namespace.js new file mode 100644 index 0000000..a5b670b --- /dev/null +++ b/lib/test/esprima/JSX/invalid-start-namespace.js @@ -0,0 +1 @@ +<:path /> diff --git a/lib/test/esprima/JSX/long-member-pair.js b/lib/test/esprima/JSX/long-member-pair.js new file mode 100644 index 0000000..8d2dce6 --- /dev/null +++ b/lib/test/esprima/JSX/long-member-pair.js @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/JSX/long-member-pair.tree.json b/lib/test/esprima/JSX/long-member-pair.tree.json new file mode 100644 index 0000000..b9647c7 --- /dev/null +++ b/lib/test/esprima/JSX/long-member-pair.tree.json @@ -0,0 +1,965 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXMemberExpression", + "object": { + "type": "JSXMemberExpression", + "object": { + "type": "JSXMemberExpression", + "object": { + "type": "JSXMemberExpression", + "object": { + "type": "JSXMemberExpression", + "object": { + "type": "JSXIdentifier", + "name": "SolarSystem", + "range": [ + 1, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "property": { + "type": "JSXIdentifier", + "name": "Earth", + "range": [ + 13, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 1, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "property": { + "type": "JSXIdentifier", + "name": "America", + "range": [ + 19, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 1, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "property": { + "type": "JSXIdentifier", + "name": "USA", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 1, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "property": { + "type": "JSXIdentifier", + "name": "California", + "range": [ + 31, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "range": [ + 1, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "property": { + "type": "JSXIdentifier", + "name": "mountain-view", + "range": [ + 42, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 55 + } + } + }, + "range": [ + 1, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 55 + } + } + }, + "selfClosing": false, + "attributes": [], + "range": [ + 0, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 56 + } + } + }, + "children": [], + "closingElement": { + "type": "JSXClosingElement", + "name": { + "type": "JSXMemberExpression", + "object": { + "type": "JSXMemberExpression", + "object": { + "type": "JSXMemberExpression", + "object": { + "type": "JSXMemberExpression", + "object": { + "type": "JSXMemberExpression", + "object": { + "type": "JSXIdentifier", + "name": "SolarSystem", + "range": [ + 58, + 69 + ], + "loc": { + "start": { + "line": 1, + "column": 58 + }, + "end": { + "line": 1, + "column": 69 + } + } + }, + "property": { + "type": "JSXIdentifier", + "name": "Earth", + "range": [ + 70, + 75 + ], + "loc": { + "start": { + "line": 1, + "column": 70 + }, + "end": { + "line": 1, + "column": 75 + } + } + }, + "range": [ + 58, + 75 + ], + "loc": { + "start": { + "line": 1, + "column": 58 + }, + "end": { + "line": 1, + "column": 75 + } + } + }, + "property": { + "type": "JSXIdentifier", + "name": "America", + "range": [ + 76, + 83 + ], + "loc": { + "start": { + "line": 1, + "column": 76 + }, + "end": { + "line": 1, + "column": 83 + } + } + }, + "range": [ + 58, + 83 + ], + "loc": { + "start": { + "line": 1, + "column": 58 + }, + "end": { + "line": 1, + "column": 83 + } + } + }, + "property": { + "type": "JSXIdentifier", + "name": "USA", + "range": [ + 84, + 87 + ], + "loc": { + "start": { + "line": 1, + "column": 84 + }, + "end": { + "line": 1, + "column": 87 + } + } + }, + "range": [ + 58, + 87 + ], + "loc": { + "start": { + "line": 1, + "column": 58 + }, + "end": { + "line": 1, + "column": 87 + } + } + }, + "property": { + "type": "JSXIdentifier", + "name": "California", + "range": [ + 88, + 98 + ], + "loc": { + "start": { + "line": 1, + "column": 88 + }, + "end": { + "line": 1, + "column": 98 + } + } + }, + "range": [ + 58, + 98 + ], + "loc": { + "start": { + "line": 1, + "column": 58 + }, + "end": { + "line": 1, + "column": 98 + } + } + }, + "property": { + "type": "JSXIdentifier", + "name": "mountain-view", + "range": [ + 99, + 112 + ], + "loc": { + "start": { + "line": 1, + "column": 99 + }, + "end": { + "line": 1, + "column": 112 + } + } + }, + "range": [ + 58, + 112 + ], + "loc": { + "start": { + "line": 1, + "column": 58 + }, + "end": { + "line": 1, + "column": 112 + } + } + }, + "range": [ + 56, + 113 + ], + "loc": { + "start": { + "line": 1, + "column": 56 + }, + "end": { + "line": 1, + "column": 113 + } + } + }, + "range": [ + 0, + 113 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 113 + } + } + }, + "range": [ + 0, + 113 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 113 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 113 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 113 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "SolarSystem", + "range": [ + 1, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "JSXIdentifier", + "value": "Earth", + "range": [ + 13, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "JSXIdentifier", + "value": "America", + "range": [ + 19, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "JSXIdentifier", + "value": "USA", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "JSXIdentifier", + "value": "California", + "range": [ + 31, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + { + "type": "JSXIdentifier", + "value": "mountain-view", + "range": [ + 42, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 55 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 55 + }, + "end": { + "line": 1, + "column": 56 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 1, + "column": 56 + }, + "end": { + "line": 1, + "column": 57 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 57, + 58 + ], + "loc": { + "start": { + "line": 1, + "column": 57 + }, + "end": { + "line": 1, + "column": 58 + } + } + }, + { + "type": "JSXIdentifier", + "value": "SolarSystem", + "range": [ + 58, + 69 + ], + "loc": { + "start": { + "line": 1, + "column": 58 + }, + "end": { + "line": 1, + "column": 69 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 69, + 70 + ], + "loc": { + "start": { + "line": 1, + "column": 69 + }, + "end": { + "line": 1, + "column": 70 + } + } + }, + { + "type": "JSXIdentifier", + "value": "Earth", + "range": [ + 70, + 75 + ], + "loc": { + "start": { + "line": 1, + "column": 70 + }, + "end": { + "line": 1, + "column": 75 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 75, + 76 + ], + "loc": { + "start": { + "line": 1, + "column": 75 + }, + "end": { + "line": 1, + "column": 76 + } + } + }, + { + "type": "JSXIdentifier", + "value": "America", + "range": [ + 76, + 83 + ], + "loc": { + "start": { + "line": 1, + "column": 76 + }, + "end": { + "line": 1, + "column": 83 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 83, + 84 + ], + "loc": { + "start": { + "line": 1, + "column": 83 + }, + "end": { + "line": 1, + "column": 84 + } + } + }, + { + "type": "JSXIdentifier", + "value": "USA", + "range": [ + 84, + 87 + ], + "loc": { + "start": { + "line": 1, + "column": 84 + }, + "end": { + "line": 1, + "column": 87 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 87, + 88 + ], + "loc": { + "start": { + "line": 1, + "column": 87 + }, + "end": { + "line": 1, + "column": 88 + } + } + }, + { + "type": "JSXIdentifier", + "value": "California", + "range": [ + 88, + 98 + ], + "loc": { + "start": { + "line": 1, + "column": 88 + }, + "end": { + "line": 1, + "column": 98 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 98, + 99 + ], + "loc": { + "start": { + "line": 1, + "column": 98 + }, + "end": { + "line": 1, + "column": 99 + } + } + }, + { + "type": "JSXIdentifier", + "value": "mountain-view", + "range": [ + 99, + 112 + ], + "loc": { + "start": { + "line": 1, + "column": 99 + }, + "end": { + "line": 1, + "column": 112 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 112, + 113 + ], + "loc": { + "start": { + "line": 1, + "column": 112 + }, + "end": { + "line": 1, + "column": 113 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/long-member.js b/lib/test/esprima/JSX/long-member.js new file mode 100644 index 0000000..6cfbd30 --- /dev/null +++ b/lib/test/esprima/JSX/long-member.js @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/JSX/long-member.tree.json b/lib/test/esprima/JSX/long-member.tree.json new file mode 100644 index 0000000..48b27c9 --- /dev/null +++ b/lib/test/esprima/JSX/long-member.tree.json @@ -0,0 +1,522 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXMemberExpression", + "object": { + "type": "JSXMemberExpression", + "object": { + "type": "JSXMemberExpression", + "object": { + "type": "JSXMemberExpression", + "object": { + "type": "JSXMemberExpression", + "object": { + "type": "JSXIdentifier", + "name": "SolarSystem", + "range": [ + 1, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "property": { + "type": "JSXIdentifier", + "name": "Earth", + "range": [ + 13, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 1, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "property": { + "type": "JSXIdentifier", + "name": "America", + "range": [ + 19, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 1, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "property": { + "type": "JSXIdentifier", + "name": "USA", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 1, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "property": { + "type": "JSXIdentifier", + "name": "California", + "range": [ + 31, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "range": [ + 1, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "property": { + "type": "JSXIdentifier", + "name": "mountain-view", + "range": [ + 42, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 55 + } + } + }, + "range": [ + 1, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 55 + } + } + }, + "selfClosing": true, + "attributes": [], + "range": [ + 0, + 58 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + } + }, + "children": [], + "closingElement": null, + "range": [ + 0, + 58 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + } + }, + "range": [ + 0, + 58 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 58 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "SolarSystem", + "range": [ + 1, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "JSXIdentifier", + "value": "Earth", + "range": [ + 13, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "JSXIdentifier", + "value": "America", + "range": [ + 19, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "JSXIdentifier", + "value": "USA", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "JSXIdentifier", + "value": "California", + "range": [ + 31, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + { + "type": "JSXIdentifier", + "value": "mountain-view", + "range": [ + 42, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 55 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 1, + "column": 56 + }, + "end": { + "line": 1, + "column": 57 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 57, + 58 + ], + "loc": { + "start": { + "line": 1, + "column": 57 + }, + "end": { + "line": 1, + "column": 58 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/multi-attributes.js b/lib/test/esprima/JSX/multi-attributes.js new file mode 100644 index 0000000..3ea51df --- /dev/null +++ b/lib/test/esprima/JSX/multi-attributes.js @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/JSX/multi-attributes.tree.json b/lib/test/esprima/JSX/multi-attributes.tree.json new file mode 100644 index 0000000..d0afc11 --- /dev/null +++ b/lib/test/esprima/JSX/multi-attributes.tree.json @@ -0,0 +1,543 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "home", + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "selfClosing": false, + "attributes": [ + { + "type": "JSXAttribute", + "name": { + "type": "JSXNamespacedName", + "namespace": { + "type": "JSXIdentifier", + "name": "xlink", + "range": [ + 6, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "name": { + "type": "JSXIdentifier", + "name": "type", + "range": [ + 12, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 6, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "value": { + "type": "Literal", + "value": "simple", + "raw": "\"simple\"", + "range": [ + 17, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "range": [ + 6, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "JSXAttribute", + "name": { + "type": "JSXIdentifier", + "name": "other", + "range": [ + 26, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "value": { + "type": "Literal", + "value": "foo", + "raw": "\"foo\"", + "range": [ + 32, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + "range": [ + 26, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + ], + "range": [ + 0, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + "children": [], + "closingElement": { + "type": "JSXClosingElement", + "name": { + "type": "JSXIdentifier", + "name": "home", + "range": [ + 41, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + "range": [ + 39, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "range": [ + 0, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "range": [ + 0, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "home", + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "JSXIdentifier", + "value": "xlink", + "range": [ + 6, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "JSXIdentifier", + "value": "type", + "range": [ + 12, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "String", + "value": "\"simple\"", + "range": [ + 17, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "JSXIdentifier", + "value": "other", + "range": [ + 26, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "String", + "value": "\"foo\"", + "range": [ + 32, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + { + "type": "JSXIdentifier", + "value": "home", + "range": [ + 41, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 46 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/multiline-crlf-text.js b/lib/test/esprima/JSX/multiline-crlf-text.js new file mode 100644 index 0000000..ee074f1 --- /dev/null +++ b/lib/test/esprima/JSX/multiline-crlf-text.js @@ -0,0 +1,5 @@ + +One +Two +Three + diff --git a/lib/test/esprima/JSX/multiline-crlf-text.skip b/lib/test/esprima/JSX/multiline-crlf-text.skip new file mode 100644 index 0000000..52db826 --- /dev/null +++ b/lib/test/esprima/JSX/multiline-crlf-text.skip @@ -0,0 +1 @@ +TODO: newlines? diff --git a/lib/test/esprima/JSX/multiline-crlf-text.tree.json b/lib/test/esprima/JSX/multiline-crlf-text.tree.json new file mode 100644 index 0000000..5189f1b --- /dev/null +++ b/lib/test/esprima/JSX/multiline-crlf-text.tree.json @@ -0,0 +1,293 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "em", + "range": [ + 1, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "selfClosing": false, + "attributes": [], + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "children": [ + { + "type": "JSXText", + "value": "\rOne\rTwo\rThree\r", + "raw": "\r\nOne\r\nTwo\r\nThree\r\n", + "range": [ + 4, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 5, + "column": 0 + } + } + } + ], + "closingElement": { + "type": "JSXClosingElement", + "name": { + "type": "JSXIdentifier", + "name": "em", + "range": [ + 25, + 27 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 4 + } + } + }, + "range": [ + 23, + 28 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 5 + } + } + }, + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 5 + } + } + }, + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 5 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "em", + "range": [ + 1, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "JSXText", + "value": "\r\nOne\r\nTwo\r\nThree\r\n", + "range": [ + 4, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 2 + } + } + }, + { + "type": "JSXIdentifier", + "value": "em", + "range": [ + 25, + 27 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 5 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/multiline-text.js b/lib/test/esprima/JSX/multiline-text.js new file mode 100644 index 0000000..7a89afd --- /dev/null +++ b/lib/test/esprima/JSX/multiline-text.js @@ -0,0 +1,5 @@ + +One +Two +Three + diff --git a/lib/test/esprima/JSX/multiline-text.tree.json b/lib/test/esprima/JSX/multiline-text.tree.json new file mode 100644 index 0000000..5964633 --- /dev/null +++ b/lib/test/esprima/JSX/multiline-text.tree.json @@ -0,0 +1,293 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "em", + "range": [ + 1, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "selfClosing": false, + "attributes": [], + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "children": [ + { + "type": "JSXText", + "value": "\nOne\nTwo\nThree\n", + "raw": "\nOne\nTwo\nThree\n", + "range": [ + 4, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 5, + "column": 0 + } + } + } + ], + "closingElement": { + "type": "JSXClosingElement", + "name": { + "type": "JSXIdentifier", + "name": "em", + "range": [ + 21, + 23 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 4 + } + } + }, + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 5 + } + } + }, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 5 + } + } + }, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 5 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "em", + "range": [ + 1, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "JSXText", + "value": "\nOne\nTwo\nThree\n", + "range": [ + 4, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 2 + } + } + }, + { + "type": "JSXIdentifier", + "value": "em", + "range": [ + 21, + 23 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 5 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/nested-elements.js b/lib/test/esprima/JSX/nested-elements.js new file mode 100644 index 0000000..632d220 --- /dev/null +++ b/lib/test/esprima/JSX/nested-elements.js @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/JSX/nested-elements.tree.json b/lib/test/esprima/JSX/nested-elements.tree.json new file mode 100644 index 0000000..b9b35d9 --- /dev/null +++ b/lib/test/esprima/JSX/nested-elements.tree.json @@ -0,0 +1,675 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "selfClosing": false, + "attributes": [], + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "children": [ + { + "type": "JSXText", + "value": " ", + "raw": " ", + "range": [ + 3, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "b", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "selfClosing": false, + "attributes": [], + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "children": [ + { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "c", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "selfClosing": true, + "attributes": [], + "range": [ + 8, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "children": [], + "closingElement": null, + "range": [ + 8, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "closingElement": { + "type": "JSXClosingElement", + "name": { + "type": "JSXIdentifier", + "name": "b", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 12, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 5, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "JSXText", + "value": " ", + "raw": " ", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "closingElement": { + "type": "JSXClosingElement", + "name": { + "type": "JSXIdentifier", + "name": "a", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 17, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "JSXText", + "value": " ", + "range": [ + 3, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "JSXIdentifier", + "value": "b", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "JSXIdentifier", + "value": "c", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "JSXIdentifier", + "value": "b", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "JSXText", + "value": " ", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "JSXIdentifier", + "value": "a", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/null-attribute-value.js b/lib/test/esprima/JSX/null-attribute-value.js new file mode 100644 index 0000000..d45bbc7 --- /dev/null +++ b/lib/test/esprima/JSX/null-attribute-value.js @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/JSX/null-attribute-value.tree.json b/lib/test/esprima/JSX/null-attribute-value.tree.json new file mode 100644 index 0000000..7140e42 --- /dev/null +++ b/lib/test/esprima/JSX/null-attribute-value.tree.json @@ -0,0 +1,293 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "rect", + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "selfClosing": true, + "attributes": [ + { + "type": "JSXAttribute", + "name": { + "type": "JSXNamespacedName", + "namespace": { + "type": "JSXIdentifier", + "name": "option", + "range": [ + 6, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "name": { + "type": "JSXIdentifier", + "name": "square", + "range": [ + 13, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "range": [ + 6, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "value": null, + "range": [ + 6, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "children": [], + "closingElement": null, + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "rect", + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "JSXIdentifier", + "value": "option", + "range": [ + 6, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "JSXIdentifier", + "value": "square", + "range": [ + 13, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/simple-deeply-nested-pair.js b/lib/test/esprima/JSX/simple-deeply-nested-pair.js new file mode 100644 index 0000000..8d1faef --- /dev/null +++ b/lib/test/esprima/JSX/simple-deeply-nested-pair.js @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/JSX/simple-deeply-nested-pair.tree.json b/lib/test/esprima/JSX/simple-deeply-nested-pair.tree.json new file mode 100644 index 0000000..8fa1194 --- /dev/null +++ b/lib/test/esprima/JSX/simple-deeply-nested-pair.tree.json @@ -0,0 +1,927 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "strong", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "selfClosing": false, + "attributes": [], + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "children": [ + { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "em", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "selfClosing": false, + "attributes": [], + "range": [ + 8, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "children": [ + { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "a", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "selfClosing": false, + "attributes": [ + { + "type": "JSXAttribute", + "name": { + "type": "JSXIdentifier", + "name": "href", + "range": [ + 15, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "value": { + "type": "Literal", + "value": "{link}", + "raw": "\"{link}\"", + "range": [ + 20, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "range": [ + 15, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "range": [ + 12, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "children": [ + { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "test", + "range": [ + 30, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "selfClosing": true, + "attributes": [], + "range": [ + 29, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "children": [], + "closingElement": null, + "range": [ + 29, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "closingElement": { + "type": "JSXClosingElement", + "name": { + "type": "JSXIdentifier", + "name": "a", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + "range": [ + 36, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + "range": [ + 12, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 40 + } + } + } + ], + "closingElement": { + "type": "JSXClosingElement", + "name": { + "type": "JSXIdentifier", + "name": "em", + "range": [ + 42, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + "range": [ + 40, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + "range": [ + 8, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 45 + } + } + } + ], + "closingElement": { + "type": "JSXClosingElement", + "name": { + "type": "JSXIdentifier", + "name": "strong", + "range": [ + 47, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 53 + } + } + }, + "range": [ + 45, + 54 + ], + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 54 + } + } + }, + "range": [ + 0, + 54 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + } + }, + "range": [ + 0, + 54 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 54 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "strong", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "JSXIdentifier", + "value": "em", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "JSXIdentifier", + "value": "a", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "JSXIdentifier", + "value": "href", + "range": [ + 15, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "String", + "value": "\"{link}\"", + "range": [ + 20, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "JSXIdentifier", + "value": "test", + "range": [ + 30, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "JSXIdentifier", + "value": "a", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + { + "type": "JSXIdentifier", + "value": "em", + "range": [ + 42, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 47 + } + } + }, + { + "type": "JSXIdentifier", + "value": "strong", + "range": [ + 47, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 53 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 54 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/simple-expression-container.js b/lib/test/esprima/JSX/simple-expression-container.js new file mode 100644 index 0000000..207462d --- /dev/null +++ b/lib/test/esprima/JSX/simple-expression-container.js @@ -0,0 +1 @@ +{$caption} diff --git a/lib/test/esprima/JSX/simple-expression-container.tree.json b/lib/test/esprima/JSX/simple-expression-container.tree.json new file mode 100644 index 0000000..d29518f --- /dev/null +++ b/lib/test/esprima/JSX/simple-expression-container.tree.json @@ -0,0 +1,363 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "title", + "range": [ + 1, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "selfClosing": false, + "attributes": [], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "children": [ + { + "type": "JSXExpressionContainer", + "expression": { + "type": "Identifier", + "name": "$caption", + "range": [ + 8, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 7, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "closingElement": { + "type": "JSXClosingElement", + "name": { + "type": "JSXIdentifier", + "name": "title", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "range": [ + 17, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "title", + "range": [ + 1, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "$caption", + "range": [ + 8, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "JSXIdentifier", + "value": "title", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/simple-member-pair.js b/lib/test/esprima/JSX/simple-member-pair.js new file mode 100644 index 0000000..dfa8885 --- /dev/null +++ b/lib/test/esprima/JSX/simple-member-pair.js @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/JSX/simple-member-pair.tree.json b/lib/test/esprima/JSX/simple-member-pair.tree.json new file mode 100644 index 0000000..4af687f --- /dev/null +++ b/lib/test/esprima/JSX/simple-member-pair.tree.json @@ -0,0 +1,397 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXMemberExpression", + "object": { + "type": "JSXIdentifier", + "name": "milky-way", + "range": [ + 1, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "property": { + "type": "JSXIdentifier", + "name": "solar-system", + "range": [ + 11, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "range": [ + 1, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "selfClosing": false, + "attributes": [], + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "children": [], + "closingElement": { + "type": "JSXClosingElement", + "name": { + "type": "JSXMemberExpression", + "object": { + "type": "JSXIdentifier", + "name": "milky-way", + "range": [ + 26, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + "property": { + "type": "JSXIdentifier", + "name": "solar-system", + "range": [ + 36, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + "range": [ + 26, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + "range": [ + 24, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 49 + } + } + }, + "range": [ + 0, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + } + }, + "range": [ + 0, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "milky-way", + "range": [ + 1, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "JSXIdentifier", + "value": "solar-system", + "range": [ + 11, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "JSXIdentifier", + "value": "milky-way", + "range": [ + 26, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "JSXIdentifier", + "value": "solar-system", + "range": [ + 36, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 49 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/simple-member.js b/lib/test/esprima/JSX/simple-member.js new file mode 100644 index 0000000..a6dd26b --- /dev/null +++ b/lib/test/esprima/JSX/simple-member.js @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/JSX/simple-member.tree.json b/lib/test/esprima/JSX/simple-member.tree.json new file mode 100644 index 0000000..042d138 --- /dev/null +++ b/lib/test/esprima/JSX/simple-member.tree.json @@ -0,0 +1,238 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXMemberExpression", + "object": { + "type": "JSXIdentifier", + "name": "earth", + "range": [ + 1, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "property": { + "type": "JSXIdentifier", + "name": "america", + "range": [ + 7, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 1, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "selfClosing": true, + "attributes": [], + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "children": [], + "closingElement": null, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "earth", + "range": [ + 1, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "JSXIdentifier", + "value": "america", + "range": [ + 7, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/simple-namespace-pair.js b/lib/test/esprima/JSX/simple-namespace-pair.js new file mode 100644 index 0000000..7438307 --- /dev/null +++ b/lib/test/esprima/JSX/simple-namespace-pair.js @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/JSX/simple-namespace-pair.tree.json b/lib/test/esprima/JSX/simple-namespace-pair.tree.json new file mode 100644 index 0000000..4cb323d --- /dev/null +++ b/lib/test/esprima/JSX/simple-namespace-pair.tree.json @@ -0,0 +1,397 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXNamespacedName", + "namespace": { + "type": "JSXIdentifier", + "name": "svg", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "name": { + "type": "JSXIdentifier", + "name": "path", + "range": [ + 5, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "selfClosing": false, + "attributes": [], + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "children": [], + "closingElement": { + "type": "JSXClosingElement", + "name": { + "type": "JSXNamespacedName", + "namespace": { + "type": "JSXIdentifier", + "name": "svg", + "range": [ + 12, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "name": { + "type": "JSXIdentifier", + "name": "path", + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 12, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 10, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "svg", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "JSXIdentifier", + "value": "path", + "range": [ + 5, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "JSXIdentifier", + "value": "svg", + "range": [ + 12, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "JSXIdentifier", + "value": "path", + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/simple-namespace.js b/lib/test/esprima/JSX/simple-namespace.js new file mode 100644 index 0000000..14f035f --- /dev/null +++ b/lib/test/esprima/JSX/simple-namespace.js @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/JSX/simple-namespace.tree.json b/lib/test/esprima/JSX/simple-namespace.tree.json new file mode 100644 index 0000000..6bce228 --- /dev/null +++ b/lib/test/esprima/JSX/simple-namespace.tree.json @@ -0,0 +1,238 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXNamespacedName", + "namespace": { + "type": "JSXIdentifier", + "name": "svg", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "name": { + "type": "JSXIdentifier", + "name": "path", + "range": [ + 5, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "selfClosing": true, + "attributes": [], + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "children": [], + "closingElement": null, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "svg", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "JSXIdentifier", + "value": "path", + "range": [ + 5, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/simple-nested-pair.js b/lib/test/esprima/JSX/simple-nested-pair.js new file mode 100644 index 0000000..f52e009 --- /dev/null +++ b/lib/test/esprima/JSX/simple-nested-pair.js @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/JSX/simple-nested-pair.tree.json b/lib/test/esprima/JSX/simple-nested-pair.tree.json new file mode 100644 index 0000000..e574030 --- /dev/null +++ b/lib/test/esprima/JSX/simple-nested-pair.tree.json @@ -0,0 +1,472 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "strong", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "selfClosing": false, + "attributes": [], + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "children": [ + { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "em", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "selfClosing": false, + "attributes": [], + "range": [ + 8, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "children": [], + "closingElement": { + "type": "JSXClosingElement", + "name": { + "type": "JSXIdentifier", + "name": "em", + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 12, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 8, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "closingElement": { + "type": "JSXClosingElement", + "name": { + "type": "JSXIdentifier", + "name": "strong", + "range": [ + 19, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "range": [ + 17, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "strong", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "JSXIdentifier", + "value": "em", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "JSXIdentifier", + "value": "em", + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "JSXIdentifier", + "value": "strong", + "range": [ + 19, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/simple-pair.js b/lib/test/esprima/JSX/simple-pair.js new file mode 100644 index 0000000..dd5c5cf --- /dev/null +++ b/lib/test/esprima/JSX/simple-pair.js @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/JSX/simple-pair.tree.json b/lib/test/esprima/JSX/simple-pair.tree.json new file mode 100644 index 0000000..209dfd3 --- /dev/null +++ b/lib/test/esprima/JSX/simple-pair.tree.json @@ -0,0 +1,255 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "strong", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "selfClosing": false, + "attributes": [], + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "children": [], + "closingElement": { + "type": "JSXClosingElement", + "name": { + "type": "JSXIdentifier", + "name": "strong", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 8, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "strong", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "JSXIdentifier", + "value": "strong", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/simple-selfclosing-linefeed.js b/lib/test/esprima/JSX/simple-selfclosing-linefeed.js new file mode 100644 index 0000000..5fdb3b7 --- /dev/null +++ b/lib/test/esprima/JSX/simple-selfclosing-linefeed.js @@ -0,0 +1,2 @@ + diff --git a/lib/test/esprima/JSX/simple-selfclosing-linefeed.tree.json b/lib/test/esprima/JSX/simple-selfclosing-linefeed.tree.json new file mode 100644 index 0000000..03e9609 --- /dev/null +++ b/lib/test/esprima/JSX/simple-selfclosing-linefeed.tree.json @@ -0,0 +1,167 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "selfClosing": true, + "attributes": [], + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + } + }, + "children": [], + "closingElement": null, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 2 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/simple-selfclosing-whitespace.js b/lib/test/esprima/JSX/simple-selfclosing-whitespace.js new file mode 100644 index 0000000..c200e6b --- /dev/null +++ b/lib/test/esprima/JSX/simple-selfclosing-whitespace.js @@ -0,0 +1,2 @@ + + diff --git a/lib/test/esprima/JSX/simple-selfclosing-whitespace.tree.json b/lib/test/esprima/JSX/simple-selfclosing-whitespace.tree.json new file mode 100644 index 0000000..ca2600b --- /dev/null +++ b/lib/test/esprima/JSX/simple-selfclosing-whitespace.tree.json @@ -0,0 +1,167 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "img", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "selfClosing": true, + "attributes": [], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "children": [], + "closingElement": null, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "img", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/simple-selfclosing.js b/lib/test/esprima/JSX/simple-selfclosing.js new file mode 100644 index 0000000..15b8cde --- /dev/null +++ b/lib/test/esprima/JSX/simple-selfclosing.js @@ -0,0 +1,2 @@ + + diff --git a/lib/test/esprima/JSX/simple-selfclosing.tree.json b/lib/test/esprima/JSX/simple-selfclosing.tree.json new file mode 100644 index 0000000..a8940bf --- /dev/null +++ b/lib/test/esprima/JSX/simple-selfclosing.tree.json @@ -0,0 +1,167 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "img", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "selfClosing": true, + "attributes": [], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "children": [], + "closingElement": null, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "img", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/JSX/simple-text.js b/lib/test/esprima/JSX/simple-text.js new file mode 100644 index 0000000..9db1c64 --- /dev/null +++ b/lib/test/esprima/JSX/simple-text.js @@ -0,0 +1 @@ +Hello diff --git a/lib/test/esprima/JSX/simple-text.tree.json b/lib/test/esprima/JSX/simple-text.tree.json new file mode 100644 index 0000000..d61fe7f --- /dev/null +++ b/lib/test/esprima/JSX/simple-text.tree.json @@ -0,0 +1,293 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "b", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "selfClosing": false, + "attributes": [], + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "children": [ + { + "type": "JSXText", + "value": "Hello", + "raw": "Hello", + "range": [ + 3, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "closingElement": { + "type": "JSXClosingElement", + "name": { + "type": "JSXIdentifier", + "name": "b", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 8, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "b", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "JSXText", + "value": "Hello", + "range": [ + 3, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "JSXIdentifier", + "value": "b", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/LICENSE.BSD b/lib/test/esprima/LICENSE.BSD new file mode 100644 index 0000000..17557ec --- /dev/null +++ b/lib/test/esprima/LICENSE.BSD @@ -0,0 +1,21 @@ +Copyright (c) jQuery Foundation, Inc. and Contributors, All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0000.diff b/lib/test/esprima/automatic-semicolon-insertion/migrated_0000.diff new file mode 100644 index 0000000..0ab9078 --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0000.diff @@ -0,0 +1,12 @@ +{ + 'body': { + '0': { + 'body': { + '1': { + 'range': { '1': 7 }, + 'loc': { 'end': { 'column': 3 }} + } + } + } + } +} diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0000.js b/lib/test/esprima/automatic-semicolon-insertion/migrated_0000.js new file mode 100644 index 0000000..27d3601 --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0000.js @@ -0,0 +1,2 @@ +{ x +++y } \ No newline at end of file diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0000.tree.json b/lib/test/esprima/automatic-semicolon-insertion/migrated_0000.tree.json new file mode 100644 index 0000000..fe5ff01 --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0000.tree.json @@ -0,0 +1,220 @@ +{ + "type": "Program", + "body": [ + { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "x", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "++", + "argument": { + "type": "Identifier", + "name": "y", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + } + }, + "prefix": true, + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + } + } + }, + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 4 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "{", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "++", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } +} diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0001.diff b/lib/test/esprima/automatic-semicolon-insertion/migrated_0001.diff new file mode 100644 index 0000000..0ab9078 --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0001.diff @@ -0,0 +1,12 @@ +{ + 'body': { + '0': { + 'body': { + '1': { + 'range': { '1': 7 }, + 'loc': { 'end': { 'column': 3 }} + } + } + } + } +} diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0001.js b/lib/test/esprima/automatic-semicolon-insertion/migrated_0001.js new file mode 100644 index 0000000..7291b9f --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0001.js @@ -0,0 +1,2 @@ +{ x +--y } \ No newline at end of file diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0001.tree.json b/lib/test/esprima/automatic-semicolon-insertion/migrated_0001.tree.json new file mode 100644 index 0000000..dedb379 --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0001.tree.json @@ -0,0 +1,220 @@ +{ + "type": "Program", + "body": [ + { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "x", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "--", + "argument": { + "type": "Identifier", + "name": "y", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + } + }, + "prefix": true, + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + } + } + }, + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 4 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "{", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "--", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } +} diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0002.js b/lib/test/esprima/automatic-semicolon-insertion/migrated_0002.js new file mode 100644 index 0000000..8997f17 --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0002.js @@ -0,0 +1 @@ +var x /* comment */; \ No newline at end of file diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0002.tree.json b/lib/test/esprima/automatic-semicolon-insertion/migrated_0002.tree.json new file mode 100644 index 0000000..4ffdbca --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0002.tree.json @@ -0,0 +1,132 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": null, + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } +} diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0003.js b/lib/test/esprima/automatic-semicolon-insertion/migrated_0003.js new file mode 100644 index 0000000..d9fb2e4 --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0003.js @@ -0,0 +1,2 @@ +{ var x = 14, y = 3 +z; } \ No newline at end of file diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0003.tree.json b/lib/test/esprima/automatic-semicolon-insertion/migrated_0003.tree.json new file mode 100644 index 0000000..8ea27d6 --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0003.tree.json @@ -0,0 +1,420 @@ +{ + "type": "Program", + "body": [ + { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "init": { + "type": "Literal", + "value": 14, + "raw": "14", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 6, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "y", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "init": { + "type": "Literal", + "value": 3, + "raw": "3", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "kind": "var", + "range": [ + 2, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "z", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + "range": [ + 20, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + } + } + ], + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 4 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "{", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 2, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Numeric", + "value": "14", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Numeric", + "value": "3", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + } + } + } + ], + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 4 + } + } +} diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0004.js b/lib/test/esprima/automatic-semicolon-insertion/migrated_0004.js new file mode 100644 index 0000000..2d42709 --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0004.js @@ -0,0 +1,2 @@ +while (true) { continue +there; } \ No newline at end of file diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0004.tree.json b/lib/test/esprima/automatic-semicolon-insertion/migrated_0004.tree.json new file mode 100644 index 0000000..2a2e2f9 --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0004.tree.json @@ -0,0 +1,292 @@ +{ + "type": "Program", + "body": [ + { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ContinueStatement", + "label": null, + "range": [ + 15, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "there", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + "range": [ + 24, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + ], + "range": [ + 13, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "while", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "continue", + "range": [ + 15, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "there", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + } + } + ], + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + } +} diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0005.js b/lib/test/esprima/automatic-semicolon-insertion/migrated_0005.js new file mode 100644 index 0000000..acff166 --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0005.js @@ -0,0 +1,2 @@ +while (true) { continue // Comment +there; } \ No newline at end of file diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0005.tree.json b/lib/test/esprima/automatic-semicolon-insertion/migrated_0005.tree.json new file mode 100644 index 0000000..73b593b --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0005.tree.json @@ -0,0 +1,292 @@ +{ + "type": "Program", + "body": [ + { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ContinueStatement", + "label": null, + "range": [ + 15, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "there", + "range": [ + 35, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + "range": [ + 35, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + ], + "range": [ + 13, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + "range": [ + 0, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "while", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "continue", + "range": [ + 15, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "there", + "range": [ + 35, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + } + } + ], + "range": [ + 0, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + } +} diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0006.js b/lib/test/esprima/automatic-semicolon-insertion/migrated_0006.js new file mode 100644 index 0000000..91c90d2 --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0006.js @@ -0,0 +1,2 @@ +while (true) { continue /* Multiline +Comment */there; } \ No newline at end of file diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0006.tree.json b/lib/test/esprima/automatic-semicolon-insertion/migrated_0006.tree.json new file mode 100644 index 0000000..24864ec --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0006.tree.json @@ -0,0 +1,292 @@ +{ + "type": "Program", + "body": [ + { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ContinueStatement", + "label": null, + "range": [ + 15, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "there", + "range": [ + 47, + 52 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "range": [ + 47, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 16 + } + } + } + ], + "range": [ + 13, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + "range": [ + 0, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "while", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "continue", + "range": [ + 15, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "there", + "range": [ + 47, + 52 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + } + } + ], + "range": [ + 0, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + } +} diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0007.js b/lib/test/esprima/automatic-semicolon-insertion/migrated_0007.js new file mode 100644 index 0000000..f88d9eb --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0007.js @@ -0,0 +1,2 @@ +while (true) { break +there; } \ No newline at end of file diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0007.tree.json b/lib/test/esprima/automatic-semicolon-insertion/migrated_0007.tree.json new file mode 100644 index 0000000..4d3d73e --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0007.tree.json @@ -0,0 +1,292 @@ +{ + "type": "Program", + "body": [ + { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "BreakStatement", + "label": null, + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "there", + "range": [ + 21, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + "range": [ + 21, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + ], + "range": [ + 13, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "while", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "break", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "there", + "range": [ + 21, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + } + } + ], + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + } +} diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0008.js b/lib/test/esprima/automatic-semicolon-insertion/migrated_0008.js new file mode 100644 index 0000000..ca7755f --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0008.js @@ -0,0 +1,2 @@ +while (true) { break // Comment +there; } \ No newline at end of file diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0008.tree.json b/lib/test/esprima/automatic-semicolon-insertion/migrated_0008.tree.json new file mode 100644 index 0000000..93e48e5 --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0008.tree.json @@ -0,0 +1,292 @@ +{ + "type": "Program", + "body": [ + { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "BreakStatement", + "label": null, + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "there", + "range": [ + 32, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + "range": [ + 32, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + ], + "range": [ + 13, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + "range": [ + 0, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "while", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "break", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "there", + "range": [ + 32, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + } + } + ], + "range": [ + 0, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + } +} diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0009.js b/lib/test/esprima/automatic-semicolon-insertion/migrated_0009.js new file mode 100644 index 0000000..f689faf --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0009.js @@ -0,0 +1,2 @@ +while (true) { break /* Multiline +Comment */there; } \ No newline at end of file diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0009.tree.json b/lib/test/esprima/automatic-semicolon-insertion/migrated_0009.tree.json new file mode 100644 index 0000000..750b622 --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0009.tree.json @@ -0,0 +1,292 @@ +{ + "type": "Program", + "body": [ + { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "BreakStatement", + "label": null, + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "there", + "range": [ + 44, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "range": [ + 44, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 16 + } + } + } + ], + "range": [ + 13, + 52 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + "range": [ + 0, + 52 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "while", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "break", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "there", + "range": [ + 44, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 49, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + } + } + ], + "range": [ + 0, + 52 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + } +} diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0010.js b/lib/test/esprima/automatic-semicolon-insertion/migrated_0010.js new file mode 100644 index 0000000..8fa031a --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0010.js @@ -0,0 +1,2 @@ +(function(){ return +x; }) \ No newline at end of file diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0010.tree.json b/lib/test/esprima/automatic-semicolon-insertion/migrated_0010.tree.json new file mode 100644 index 0000000..ddc349e --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0010.tree.json @@ -0,0 +1,312 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": null, + "range": [ + 13, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "x", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + "range": [ + 20, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + } + } + ], + "range": [ + 11, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 1, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 13, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + } + } + ], + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } +} diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0011.js b/lib/test/esprima/automatic-semicolon-insertion/migrated_0011.js new file mode 100644 index 0000000..fe3fb4a --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0011.js @@ -0,0 +1,2 @@ +(function(){ return // Comment +x; }) \ No newline at end of file diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0011.tree.json b/lib/test/esprima/automatic-semicolon-insertion/migrated_0011.tree.json new file mode 100644 index 0000000..14dc2a8 --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0011.tree.json @@ -0,0 +1,312 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": null, + "range": [ + 13, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "x", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + "range": [ + 31, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + } + } + ], + "range": [ + 11, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 1, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 13, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + } + } + ], + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } +} diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0012.js b/lib/test/esprima/automatic-semicolon-insertion/migrated_0012.js new file mode 100644 index 0000000..fcd344b --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0012.js @@ -0,0 +1,2 @@ +(function(){ return/* Multiline +Comment */x; }) \ No newline at end of file diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0012.tree.json b/lib/test/esprima/automatic-semicolon-insertion/migrated_0012.tree.json new file mode 100644 index 0000000..83f1a32 --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0012.tree.json @@ -0,0 +1,312 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": null, + "range": [ + 13, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "x", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "range": [ + 42, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 12 + } + } + } + ], + "range": [ + 11, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 1, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "range": [ + 0, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 13, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + ], + "range": [ + 0, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 15 + } + } +} diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0013.js b/lib/test/esprima/automatic-semicolon-insertion/migrated_0013.js new file mode 100644 index 0000000..6431b5a --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0013.js @@ -0,0 +1,2 @@ +{ throw error +error; } \ No newline at end of file diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0013.tree.json b/lib/test/esprima/automatic-semicolon-insertion/migrated_0013.tree.json new file mode 100644 index 0000000..04cc11b --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0013.tree.json @@ -0,0 +1,219 @@ +{ + "type": "Program", + "body": [ + { + "type": "BlockStatement", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "Identifier", + "name": "error", + "range": [ + 8, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 2, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "error", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + "range": [ + 14, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + ], + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "{", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "throw", + "range": [ + 2, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "error", + "range": [ + 8, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "error", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + } + } + ], + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + } +} diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0014.js b/lib/test/esprima/automatic-semicolon-insertion/migrated_0014.js new file mode 100644 index 0000000..46c1a50 --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0014.js @@ -0,0 +1,2 @@ +{ throw error// Comment +error; } \ No newline at end of file diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0014.tree.json b/lib/test/esprima/automatic-semicolon-insertion/migrated_0014.tree.json new file mode 100644 index 0000000..3f08b3a --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0014.tree.json @@ -0,0 +1,219 @@ +{ + "type": "Program", + "body": [ + { + "type": "BlockStatement", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "Identifier", + "name": "error", + "range": [ + 8, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 2, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "error", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + "range": [ + 24, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + ], + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "{", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "throw", + "range": [ + 2, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "error", + "range": [ + 8, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "error", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + } + } + ], + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + } +} diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0015.js b/lib/test/esprima/automatic-semicolon-insertion/migrated_0015.js new file mode 100644 index 0000000..21b8c27 --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0015.js @@ -0,0 +1,2 @@ +{ throw error/* Multiline +Comment */error; } \ No newline at end of file diff --git a/lib/test/esprima/automatic-semicolon-insertion/migrated_0015.tree.json b/lib/test/esprima/automatic-semicolon-insertion/migrated_0015.tree.json new file mode 100644 index 0000000..8d7946b --- /dev/null +++ b/lib/test/esprima/automatic-semicolon-insertion/migrated_0015.tree.json @@ -0,0 +1,219 @@ +{ + "type": "Program", + "body": [ + { + "type": "BlockStatement", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "Identifier", + "name": "error", + "range": [ + 8, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 2, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "error", + "range": [ + 36, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "range": [ + 36, + 42 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 16 + } + } + } + ], + "range": [ + 0, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "{", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "throw", + "range": [ + 2, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "error", + "range": [ + 8, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "error", + "range": [ + 36, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + } + } + ], + "range": [ + 0, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0000.js b/lib/test/esprima/comment/migrated_0000.js new file mode 100644 index 0000000..69793e8 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0000.js @@ -0,0 +1 @@ +/* block comment */ 42 \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0000.tree.json b/lib/test/esprima/comment/migrated_0000.tree.json new file mode 100644 index 0000000..7e8c0ca --- /dev/null +++ b/lib/test/esprima/comment/migrated_0000.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 20, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 20, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "42", + "range": [ + 20, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "range": [ + 20, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0001.js b/lib/test/esprima/comment/migrated_0001.js new file mode 100644 index 0000000..b0087ba --- /dev/null +++ b/lib/test/esprima/comment/migrated_0001.js @@ -0,0 +1 @@ +42 /* block comment 1 */ /* block comment 2 */ \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0001.skip b/lib/test/esprima/comment/migrated_0001.skip new file mode 100644 index 0000000..486143a --- /dev/null +++ b/lib/test/esprima/comment/migrated_0001.skip @@ -0,0 +1 @@ +TODO: location differences diff --git a/lib/test/esprima/comment/migrated_0001.tree.json b/lib/test/esprima/comment/migrated_0001.tree.json new file mode 100644 index 0000000..c0ccf09 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0001.tree.json @@ -0,0 +1,72 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "trailingComments": [ + { + "type": "Block", + "value": " block comment 1 ", + "range": [ + 3, + 24 + ] + }, + { + "type": "Block", + "value": " block comment 2 ", + "range": [ + 25, + 46 + ] + } + ], + "range": [ + 0, + 2 + ] + }, + "range": [ + 0, + 46 + ] + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": " block comment 1 ", + "range": [ + 3, + 24 + ] + }, + { + "type": "Block", + "value": " block comment 2 ", + "range": [ + 25, + 46 + ] + } + ], + "tokens": [ + { + "type": "Numeric", + "value": "42", + "range": [ + 0, + 2 + ] + } + ], + "range": [ + 0, + 46 + ] +} diff --git a/lib/test/esprima/comment/migrated_0002.diff b/lib/test/esprima/comment/migrated_0002.diff new file mode 100644 index 0000000..c565a28 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0002.diff @@ -0,0 +1,7 @@ +{ + "body": { + "0": { + "trailingComments": undefined + } + } +} diff --git a/lib/test/esprima/comment/migrated_0002.js b/lib/test/esprima/comment/migrated_0002.js new file mode 100644 index 0000000..e0a2d80 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0002.js @@ -0,0 +1 @@ +var p1;/* block comment 1 */ /* block comment 2 */ \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0002.tree.json b/lib/test/esprima/comment/migrated_0002.tree.json new file mode 100644 index 0000000..67da9c4 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0002.tree.json @@ -0,0 +1,208 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "p1", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "init": null, + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "kind": "var", + "trailingComments": [ + { + "type": "Block", + "value": " block comment 1 ", + "range": [ + 7, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Block", + "value": " block comment 2 ", + "range": [ + 29, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 50 + } + } + } + ], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": " block comment 1 ", + "range": [ + 7, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Block", + "value": " block comment 2 ", + "range": [ + 29, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 50 + } + } + } + ], + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "p1", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0003.diff b/lib/test/esprima/comment/migrated_0003.diff new file mode 100644 index 0000000..c3c4873 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0003.diff @@ -0,0 +1,3 @@ +{ + "leadingComments": undefined +} diff --git a/lib/test/esprima/comment/migrated_0003.js b/lib/test/esprima/comment/migrated_0003.js new file mode 100644 index 0000000..c0cb4c9 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0003.js @@ -0,0 +1 @@ +/*42*/ \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0003.tree.json b/lib/test/esprima/comment/migrated_0003.tree.json new file mode 100644 index 0000000..95125cd --- /dev/null +++ b/lib/test/esprima/comment/migrated_0003.tree.json @@ -0,0 +1,60 @@ +{ + "type": "Program", + "body": [], + "sourceType": "script", + "leadingComments": [ + { + "type": "Block", + "value": "42", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "comments": [ + { + "type": "Block", + "value": "42", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "tokens": [], + "range": [ + 6, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 6 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0004.diff b/lib/test/esprima/comment/migrated_0004.diff new file mode 100644 index 0000000..713b2e1 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0004.diff @@ -0,0 +1,13 @@ +{ + "body": { + "0": { + "expression": { + "left": { + "right": { + "leadingComments": undefined + } + } + } + } + } +} diff --git a/lib/test/esprima/comment/migrated_0004.js b/lib/test/esprima/comment/migrated_0004.js new file mode 100644 index 0000000..bc84c15 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0004.js @@ -0,0 +1 @@ +(a + /* assignmenr */b ) * c diff --git a/lib/test/esprima/comment/migrated_0004.tree.json b/lib/test/esprima/comment/migrated_0004.tree.json new file mode 100644 index 0000000..9ea910f --- /dev/null +++ b/lib/test/esprima/comment/migrated_0004.tree.json @@ -0,0 +1,295 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "*", + "left": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "Identifier", + "name": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "right": { + "type": "Identifier", + "name": "b", + "leadingComments": [ + { + "type": "Block", + "value": " assignmenr ", + "range": [ + 5, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 1, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "right": { + "type": "Identifier", + "name": "c", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": " assignmenr ", + "range": [ + 5, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0005.diff b/lib/test/esprima/comment/migrated_0005.diff new file mode 100644 index 0000000..eb0c1f2 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0005.diff @@ -0,0 +1,7 @@ +{ + "body": { + "0": { + "leadingComments": undefined + } + } +} diff --git a/lib/test/esprima/comment/migrated_0005.js b/lib/test/esprima/comment/migrated_0005.js new file mode 100644 index 0000000..f0cd7ab --- /dev/null +++ b/lib/test/esprima/comment/migrated_0005.js @@ -0,0 +1,2 @@ +/* assignmenr */ + a = b diff --git a/lib/test/esprima/comment/migrated_0005.tree.json b/lib/test/esprima/comment/migrated_0005.tree.json new file mode 100644 index 0000000..6a2241c --- /dev/null +++ b/lib/test/esprima/comment/migrated_0005.tree.json @@ -0,0 +1,187 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "a", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 2 + } + } + }, + "right": { + "type": "Identifier", + "name": "b", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "range": [ + 18, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "leadingComments": [ + { + "type": "Block", + "value": " assignmenr ", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 18, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": " assignmenr ", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "tokens": [ + { + "type": "Identifier", + "value": "a", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + ], + "range": [ + 18, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 6 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0006.js b/lib/test/esprima/comment/migrated_0006.js new file mode 100644 index 0000000..9a549f7 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0006.js @@ -0,0 +1 @@ +42 /*The*/ /*Answer*/ \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0006.skip b/lib/test/esprima/comment/migrated_0006.skip new file mode 100644 index 0000000..486143a --- /dev/null +++ b/lib/test/esprima/comment/migrated_0006.skip @@ -0,0 +1 @@ +TODO: location differences diff --git a/lib/test/esprima/comment/migrated_0006.tree.json b/lib/test/esprima/comment/migrated_0006.tree.json new file mode 100644 index 0000000..2b964c6 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0006.tree.json @@ -0,0 +1,114 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": "The", + "range": [ + 3, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Block", + "value": "Answer", + "range": [ + 11, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "tokens": [ + { + "type": "Numeric", + "value": "42", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ], + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0007.js b/lib/test/esprima/comment/migrated_0007.js new file mode 100644 index 0000000..515f604 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0007.js @@ -0,0 +1 @@ +42 /*the*/ /*answer*/ \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0007.skip b/lib/test/esprima/comment/migrated_0007.skip new file mode 100644 index 0000000..486143a --- /dev/null +++ b/lib/test/esprima/comment/migrated_0007.skip @@ -0,0 +1 @@ +TODO: location differences diff --git a/lib/test/esprima/comment/migrated_0007.tree.json b/lib/test/esprima/comment/migrated_0007.tree.json new file mode 100644 index 0000000..d30f0f4 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0007.tree.json @@ -0,0 +1,54 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 0, + 2 + ] + }, + "range": [ + 0, + 21 + ] + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": "the", + "range": [ + 3, + 10 + ] + }, + { + "type": "Block", + "value": "answer", + "range": [ + 11, + 21 + ] + } + ], + "tokens": [ + { + "type": "Numeric", + "value": "42", + "range": [ + 0, + 2 + ] + } + ], + "range": [ + 0, + 21 + ] +} diff --git a/lib/test/esprima/comment/migrated_0008.js b/lib/test/esprima/comment/migrated_0008.js new file mode 100644 index 0000000..5d485dc --- /dev/null +++ b/lib/test/esprima/comment/migrated_0008.js @@ -0,0 +1 @@ +42 /* the * answer */ \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0008.skip b/lib/test/esprima/comment/migrated_0008.skip new file mode 100644 index 0000000..486143a --- /dev/null +++ b/lib/test/esprima/comment/migrated_0008.skip @@ -0,0 +1 @@ +TODO: location differences diff --git a/lib/test/esprima/comment/migrated_0008.tree.json b/lib/test/esprima/comment/migrated_0008.tree.json new file mode 100644 index 0000000..af57a9c --- /dev/null +++ b/lib/test/esprima/comment/migrated_0008.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "42", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ], + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0009.js b/lib/test/esprima/comment/migrated_0009.js new file mode 100644 index 0000000..c86aa3b --- /dev/null +++ b/lib/test/esprima/comment/migrated_0009.js @@ -0,0 +1 @@ +42 /* The * answer */ \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0009.skip b/lib/test/esprima/comment/migrated_0009.skip new file mode 100644 index 0000000..486143a --- /dev/null +++ b/lib/test/esprima/comment/migrated_0009.skip @@ -0,0 +1 @@ +TODO: location differences diff --git a/lib/test/esprima/comment/migrated_0009.tree.json b/lib/test/esprima/comment/migrated_0009.tree.json new file mode 100644 index 0000000..0163f43 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0009.tree.json @@ -0,0 +1,96 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": " The * answer ", + "range": [ + 3, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "tokens": [ + { + "type": "Numeric", + "value": "42", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ], + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0010.js b/lib/test/esprima/comment/migrated_0010.js new file mode 100644 index 0000000..853fe1b --- /dev/null +++ b/lib/test/esprima/comment/migrated_0010.js @@ -0,0 +1,5 @@ +/* multiline +comment +should +be +ignored */ 42 \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0010.tree.json b/lib/test/esprima/comment/migrated_0010.tree.json new file mode 100644 index 0000000..1e618a3 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0010.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 42, + 44 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "range": [ + 42, + 44 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "42", + "range": [ + 42, + 44 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + ], + "range": [ + 42, + 44 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 13 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0011.diff b/lib/test/esprima/comment/migrated_0011.diff new file mode 100644 index 0000000..eb0c1f2 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0011.diff @@ -0,0 +1,7 @@ +{ + "body": { + "0": { + "leadingComments": undefined + } + } +} diff --git a/lib/test/esprima/comment/migrated_0011.js b/lib/test/esprima/comment/migrated_0011.js new file mode 100644 index 0000000..8b7c235 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0011.js @@ -0,0 +1,2 @@ +/*a +b*/ 42 \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0011.tree.json b/lib/test/esprima/comment/migrated_0011.tree.json new file mode 100644 index 0000000..33827d5 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0011.tree.json @@ -0,0 +1,116 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "a\r\nb", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + } + } + } + ], + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": "a\r\nb", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + } + } + } + ], + "tokens": [ + { + "type": "Numeric", + "value": "42", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + ], + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0012.js b/lib/test/esprima/comment/migrated_0012.js new file mode 100644 index 0000000..72e3074 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0012.js @@ -0,0 +1 @@ +/*a b*/ 42 \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0012.tree.json b/lib/test/esprima/comment/migrated_0012.tree.json new file mode 100644 index 0000000..c46019c --- /dev/null +++ b/lib/test/esprima/comment/migrated_0012.tree.json @@ -0,0 +1,96 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": "a\rb", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + } + } + } + ], + "tokens": [ + { + "type": "Numeric", + "value": "42", + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + ], + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0013.diff b/lib/test/esprima/comment/migrated_0013.diff new file mode 100644 index 0000000..eb0c1f2 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0013.diff @@ -0,0 +1,7 @@ +{ + "body": { + "0": { + "leadingComments": undefined + } + } +} diff --git a/lib/test/esprima/comment/migrated_0013.js b/lib/test/esprima/comment/migrated_0013.js new file mode 100644 index 0000000..224921a --- /dev/null +++ b/lib/test/esprima/comment/migrated_0013.js @@ -0,0 +1,2 @@ +/*a +b*/ 42 \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0013.tree.json b/lib/test/esprima/comment/migrated_0013.tree.json new file mode 100644 index 0000000..9909cb5 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0013.tree.json @@ -0,0 +1,116 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "a\nb", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + } + } + } + ], + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": "a\nb", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + } + } + } + ], + "tokens": [ + { + "type": "Numeric", + "value": "42", + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + ], + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0014.diff b/lib/test/esprima/comment/migrated_0014.diff new file mode 100644 index 0000000..eb0c1f2 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0014.diff @@ -0,0 +1,7 @@ +{ + "body": { + "0": { + "leadingComments": undefined + } + } +} diff --git a/lib/test/esprima/comment/migrated_0014.js b/lib/test/esprima/comment/migrated_0014.js new file mode 100644 index 0000000..fb73f13 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0014.js @@ -0,0 +1,2 @@ +/*a +c*/ 42 \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0014.tree.json b/lib/test/esprima/comment/migrated_0014.tree.json new file mode 100644 index 0000000..20b2df0 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0014.tree.json @@ -0,0 +1,116 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "a\nc", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + } + } + } + ], + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": "a\nc", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + } + } + } + ], + "tokens": [ + { + "type": "Numeric", + "value": "42", + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + ], + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0015.diff b/lib/test/esprima/comment/migrated_0015.diff new file mode 100644 index 0000000..c3c4873 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0015.diff @@ -0,0 +1,3 @@ +{ + "leadingComments": undefined +} diff --git a/lib/test/esprima/comment/migrated_0015.js b/lib/test/esprima/comment/migrated_0015.js new file mode 100644 index 0000000..251d510 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0015.js @@ -0,0 +1 @@ +// one\n \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0015.tree.json b/lib/test/esprima/comment/migrated_0015.tree.json new file mode 100644 index 0000000..c378a21 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0015.tree.json @@ -0,0 +1,60 @@ +{ + "type": "Program", + "body": [], + "sourceType": "script", + "leadingComments": [ + { + "type": "Line", + "value": " one\\n", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "comments": [ + { + "type": "Line", + "value": " one\\n", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "tokens": [], + "range": [ + 8, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 8 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0016.js b/lib/test/esprima/comment/migrated_0016.js new file mode 100644 index 0000000..e2e6ed6 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0016.js @@ -0,0 +1,2 @@ +// line comment +42 \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0016.tree.json b/lib/test/esprima/comment/migrated_0016.tree.json new file mode 100644 index 0000000..698bda5 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0016.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 16, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + } + }, + "range": [ + 16, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "42", + "range": [ + 16, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + } + } + ], + "range": [ + 16, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0017.js b/lib/test/esprima/comment/migrated_0017.js new file mode 100644 index 0000000..1b07a11 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0017.js @@ -0,0 +1 @@ +42 // line comment \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0017.skip b/lib/test/esprima/comment/migrated_0017.skip new file mode 100644 index 0000000..486143a --- /dev/null +++ b/lib/test/esprima/comment/migrated_0017.skip @@ -0,0 +1 @@ +TODO: location differences diff --git a/lib/test/esprima/comment/migrated_0017.tree.json b/lib/test/esprima/comment/migrated_0017.tree.json new file mode 100644 index 0000000..d848fed --- /dev/null +++ b/lib/test/esprima/comment/migrated_0017.tree.json @@ -0,0 +1,116 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "trailingComments": [ + { + "type": "Line", + "value": " line comment", + "range": [ + 3, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Line", + "value": " line comment", + "range": [ + 3, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "tokens": [ + { + "type": "Numeric", + "value": "42", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ], + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0018.diff b/lib/test/esprima/comment/migrated_0018.diff new file mode 100644 index 0000000..eb0c1f2 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0018.diff @@ -0,0 +1,7 @@ +{ + "body": { + "0": { + "leadingComments": undefined + } + } +} diff --git a/lib/test/esprima/comment/migrated_0018.js b/lib/test/esprima/comment/migrated_0018.js new file mode 100644 index 0000000..029d8fb --- /dev/null +++ b/lib/test/esprima/comment/migrated_0018.js @@ -0,0 +1,2 @@ +// Hello, world! +42 \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0018.tree.json b/lib/test/esprima/comment/migrated_0018.tree.json new file mode 100644 index 0000000..ec11af6 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0018.tree.json @@ -0,0 +1,116 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 17, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + } + }, + "leadingComments": [ + { + "type": "Line", + "value": " Hello, world!", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 17, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + } + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Line", + "value": " Hello, world!", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "tokens": [ + { + "type": "Numeric", + "value": "42", + "range": [ + 17, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + } + } + ], + "range": [ + 17, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0019.js b/lib/test/esprima/comment/migrated_0019.js new file mode 100644 index 0000000..9dafbd7 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0019.js @@ -0,0 +1 @@ +// Hello, world! diff --git a/lib/test/esprima/comment/migrated_0019.tree.json b/lib/test/esprima/comment/migrated_0019.tree.json new file mode 100644 index 0000000..9362759 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0019.tree.json @@ -0,0 +1,40 @@ +{ + "type": "Program", + "body": [], + "sourceType": "script", + "comments": [ + { + "type": "Line", + "value": " Hello, world!", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "tokens": [], + "range": [ + 17, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 0 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0020.js b/lib/test/esprima/comment/migrated_0020.js new file mode 100644 index 0000000..de7dd60 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0020.js @@ -0,0 +1 @@ +// Hallo, world! diff --git a/lib/test/esprima/comment/migrated_0020.tree.json b/lib/test/esprima/comment/migrated_0020.tree.json new file mode 100644 index 0000000..7135de9 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0020.tree.json @@ -0,0 +1,32 @@ +{ + "type": "Program", + "body": [], + "sourceType": "script", + "comments": [ + { + "type": "Line", + "value": " Hallo, world!", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "tokens": [], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 0 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0021.diff b/lib/test/esprima/comment/migrated_0021.diff new file mode 100644 index 0000000..eb0c1f2 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0021.diff @@ -0,0 +1,7 @@ +{ + "body": { + "0": { + "leadingComments": undefined + } + } +} diff --git a/lib/test/esprima/comment/migrated_0021.js b/lib/test/esprima/comment/migrated_0021.js new file mode 100644 index 0000000..3db5fd5 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0021.js @@ -0,0 +1,2 @@ +// +42 \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0021.tree.json b/lib/test/esprima/comment/migrated_0021.tree.json new file mode 100644 index 0000000..9f3254a --- /dev/null +++ b/lib/test/esprima/comment/migrated_0021.tree.json @@ -0,0 +1,116 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 3, + 5 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + } + }, + "leadingComments": [ + { + "type": "Line", + "value": "", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ], + "range": [ + 3, + 5 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + } + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Line", + "value": "", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ], + "tokens": [ + { + "type": "Numeric", + "value": "42", + "range": [ + 3, + 5 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + } + } + ], + "range": [ + 3, + 5 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0022.js b/lib/test/esprima/comment/migrated_0022.js new file mode 100644 index 0000000..ab0c014 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0022.js @@ -0,0 +1 @@ +// \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0022.tree.json b/lib/test/esprima/comment/migrated_0022.tree.json new file mode 100644 index 0000000..ec7a27f --- /dev/null +++ b/lib/test/esprima/comment/migrated_0022.tree.json @@ -0,0 +1,40 @@ +{ + "type": "Program", + "body": [], + "sourceType": "script", + "comments": [ + { + "type": "Line", + "value": "", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ], + "tokens": [], + "range": [ + 2, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 2 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0023.js b/lib/test/esprima/comment/migrated_0023.js new file mode 100644 index 0000000..078426a --- /dev/null +++ b/lib/test/esprima/comment/migrated_0023.js @@ -0,0 +1 @@ +// \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0023.tree.json b/lib/test/esprima/comment/migrated_0023.tree.json new file mode 100644 index 0000000..a6e0e8d --- /dev/null +++ b/lib/test/esprima/comment/migrated_0023.tree.json @@ -0,0 +1,20 @@ +{ + "type": "Program", + "body": [], + "sourceType": "script", + "comments": [ + { + "type": "Line", + "value": " ", + "range": [ + 0, + 3 + ] + } + ], + "tokens": [], + "range": [ + 3, + 3 + ] +} diff --git a/lib/test/esprima/comment/migrated_0024.diff b/lib/test/esprima/comment/migrated_0024.diff new file mode 100644 index 0000000..eb0c1f2 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0024.diff @@ -0,0 +1,7 @@ +{ + "body": { + "0": { + "leadingComments": undefined + } + } +} diff --git a/lib/test/esprima/comment/migrated_0024.js b/lib/test/esprima/comment/migrated_0024.js new file mode 100644 index 0000000..b15c6a2 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0024.js @@ -0,0 +1 @@ +/**/42 \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0024.tree.json b/lib/test/esprima/comment/migrated_0024.tree.json new file mode 100644 index 0000000..cd79471 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0024.tree.json @@ -0,0 +1,116 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": "", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "tokens": [ + { + "type": "Numeric", + "value": "42", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0025.js b/lib/test/esprima/comment/migrated_0025.js new file mode 100644 index 0000000..435f253 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0025.js @@ -0,0 +1 @@ +42/**/ \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0025.skip b/lib/test/esprima/comment/migrated_0025.skip new file mode 100644 index 0000000..486143a --- /dev/null +++ b/lib/test/esprima/comment/migrated_0025.skip @@ -0,0 +1 @@ +TODO: location differences diff --git a/lib/test/esprima/comment/migrated_0025.tree.json b/lib/test/esprima/comment/migrated_0025.tree.json new file mode 100644 index 0000000..80ff44b --- /dev/null +++ b/lib/test/esprima/comment/migrated_0025.tree.json @@ -0,0 +1,116 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "trailingComments": [ + { + "type": "Block", + "value": "", + "range": [ + 2, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": "", + "range": [ + 2, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "tokens": [ + { + "type": "Numeric", + "value": "42", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0026.diff b/lib/test/esprima/comment/migrated_0026.diff new file mode 100644 index 0000000..eb0c1f2 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0026.diff @@ -0,0 +1,7 @@ +{ + "body": { + "0": { + "leadingComments": undefined + } + } +} diff --git a/lib/test/esprima/comment/migrated_0026.js b/lib/test/esprima/comment/migrated_0026.js new file mode 100644 index 0000000..1550507 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0026.js @@ -0,0 +1,4 @@ +// Hello, world! + +// Another hello +42 \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0026.tree.json b/lib/test/esprima/comment/migrated_0026.tree.json new file mode 100644 index 0000000..5935962 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0026.tree.json @@ -0,0 +1,152 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 37, + 39 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 2 + } + } + }, + "leadingComments": [ + { + "type": "Line", + "value": " Hello, world!", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Line", + "value": " Another hello", + "range": [ + 18, + 36 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 18 + } + } + } + ], + "range": [ + 37, + 39 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 2 + } + } + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Line", + "value": " Hello, world!", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Line", + "value": " Another hello", + "range": [ + 18, + 36 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 18 + } + } + } + ], + "tokens": [ + { + "type": "Numeric", + "value": "42", + "range": [ + 37, + 39 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 2 + } + } + } + ], + "range": [ + 37, + 39 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 2 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0027.diff b/lib/test/esprima/comment/migrated_0027.diff new file mode 100644 index 0000000..314a70f --- /dev/null +++ b/lib/test/esprima/comment/migrated_0027.diff @@ -0,0 +1,13 @@ +{ + "body": { + "0": { + "consequent": { + "body": { + "0": { + "trailingComments": undefined, + } + } + } + } + } +} diff --git a/lib/test/esprima/comment/migrated_0027.js b/lib/test/esprima/comment/migrated_0027.js new file mode 100644 index 0000000..21084e0 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0027.js @@ -0,0 +1,2 @@ +if (x) { doThat() // Some comment + } \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0027.tree.json b/lib/test/esprima/comment/migrated_0027.tree.json new file mode 100644 index 0000000..4682911 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0027.tree.json @@ -0,0 +1,332 @@ +{ + "type": "Program", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "doThat", + "range": [ + 9, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "arguments": [], + "range": [ + 9, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "trailingComments": [ + { + "type": "Line", + "value": " Some comment", + "range": [ + 18, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "range": [ + 9, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "range": [ + 7, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 2, + "column": 2 + } + } + }, + "alternate": null, + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + } + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Line", + "value": " Some comment", + "range": [ + 18, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "tokens": [ + { + "type": "Keyword", + "value": "if", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "doThat", + "range": [ + 9, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 2 + } + } + } + ], + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0028.diff b/lib/test/esprima/comment/migrated_0028.diff new file mode 100644 index 0000000..faac8f4 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0028.diff @@ -0,0 +1,13 @@ +{ + "body": { + "0": { + "consequent": { + "body": { + "0": { + "leadingComments": undefined, + } + } + } + } + } +} diff --git a/lib/test/esprima/comment/migrated_0028.js b/lib/test/esprima/comment/migrated_0028.js new file mode 100644 index 0000000..a12c523 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0028.js @@ -0,0 +1,2 @@ +if (x) { // Some comment +doThat(); } \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0028.tree.json b/lib/test/esprima/comment/migrated_0028.tree.json new file mode 100644 index 0000000..a9ebf97 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0028.tree.json @@ -0,0 +1,350 @@ +{ + "type": "Program", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "doThat", + "range": [ + 25, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "arguments": [], + "range": [ + 25, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + "leadingComments": [ + { + "type": "Line", + "value": " Some comment", + "range": [ + 9, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "range": [ + 25, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 9 + } + } + } + ], + "range": [ + 7, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "alternate": null, + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Line", + "value": " Some comment", + "range": [ + 9, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "tokens": [ + { + "type": "Keyword", + "value": "if", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "doThat", + "range": [ + 25, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + ], + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 11 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0029.js b/lib/test/esprima/comment/migrated_0029.js new file mode 100644 index 0000000..9c4a74b --- /dev/null +++ b/lib/test/esprima/comment/migrated_0029.js @@ -0,0 +1 @@ +if (x) { /* Some comment */ doThat() } \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0029.skip b/lib/test/esprima/comment/migrated_0029.skip new file mode 100644 index 0000000..486143a --- /dev/null +++ b/lib/test/esprima/comment/migrated_0029.skip @@ -0,0 +1 @@ +TODO: location differences diff --git a/lib/test/esprima/comment/migrated_0029.tree.json b/lib/test/esprima/comment/migrated_0029.tree.json new file mode 100644 index 0000000..b5bd241 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0029.tree.json @@ -0,0 +1,332 @@ +{ + "type": "Program", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "doThat", + "range": [ + 28, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "arguments": [], + "range": [ + 28, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "leadingComments": [ + { + "type": "Block", + "value": " Some comment ", + "range": [ + 9, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "range": [ + 28, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + ], + "range": [ + 7, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "alternate": null, + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": " Some comment ", + "range": [ + 9, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "tokens": [ + { + "type": "Keyword", + "value": "if", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "doThat", + "range": [ + 28, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + ], + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0030.js b/lib/test/esprima/comment/migrated_0030.js new file mode 100644 index 0000000..d74e0bb --- /dev/null +++ b/lib/test/esprima/comment/migrated_0030.js @@ -0,0 +1 @@ +if (x) { doThat() /* Some comment */ } \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0030.skip b/lib/test/esprima/comment/migrated_0030.skip new file mode 100644 index 0000000..486143a --- /dev/null +++ b/lib/test/esprima/comment/migrated_0030.skip @@ -0,0 +1 @@ +TODO: location differences diff --git a/lib/test/esprima/comment/migrated_0030.tree.json b/lib/test/esprima/comment/migrated_0030.tree.json new file mode 100644 index 0000000..34e2c6e --- /dev/null +++ b/lib/test/esprima/comment/migrated_0030.tree.json @@ -0,0 +1,332 @@ +{ + "type": "Program", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "doThat", + "range": [ + 9, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "arguments": [], + "trailingComments": [ + { + "type": "Block", + "value": " Some comment ", + "range": [ + 18, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "range": [ + 9, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 9, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + ], + "range": [ + 7, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "alternate": null, + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": " Some comment ", + "range": [ + 18, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "tokens": [ + { + "type": "Keyword", + "value": "if", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "doThat", + "range": [ + 9, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + ], + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0031.js b/lib/test/esprima/comment/migrated_0031.js new file mode 100644 index 0000000..521601c --- /dev/null +++ b/lib/test/esprima/comment/migrated_0031.js @@ -0,0 +1 @@ +switch (answer) { case 42: /* perfect */ bingo() } \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0031.skip b/lib/test/esprima/comment/migrated_0031.skip new file mode 100644 index 0000000..486143a --- /dev/null +++ b/lib/test/esprima/comment/migrated_0031.skip @@ -0,0 +1 @@ +TODO: location differences diff --git a/lib/test/esprima/comment/migrated_0031.tree.json b/lib/test/esprima/comment/migrated_0031.tree.json new file mode 100644 index 0000000..7911576 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0031.tree.json @@ -0,0 +1,406 @@ +{ + "type": "Program", + "body": [ + { + "type": "SwitchStatement", + "discriminant": { + "type": "Identifier", + "name": "answer", + "range": [ + 8, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "cases": [ + { + "type": "SwitchCase", + "test": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 23, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "consequent": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "bingo", + "range": [ + 41, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "arguments": [], + "range": [ + 41, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + "leadingComments": [ + { + "type": "Block", + "value": " perfect ", + "range": [ + 27, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 40 + } + } + } + ], + "range": [ + 41, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 49 + } + } + } + ], + "range": [ + 18, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 49 + } + } + } + ], + "range": [ + 0, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + } + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": " perfect ", + "range": [ + 27, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 40 + } + } + } + ], + "tokens": [ + { + "type": "Keyword", + "value": "switch", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "answer", + "range": [ + 8, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Keyword", + "value": "case", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 23, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "bingo", + "range": [ + 41, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 47 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 49, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 50 + } + } + } + ], + "range": [ + 0, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0032.js b/lib/test/esprima/comment/migrated_0032.js new file mode 100644 index 0000000..dcea2cc --- /dev/null +++ b/lib/test/esprima/comment/migrated_0032.js @@ -0,0 +1 @@ +switch (answer) { case 42: bingo() /* perfect */ } \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0032.skip b/lib/test/esprima/comment/migrated_0032.skip new file mode 100644 index 0000000..486143a --- /dev/null +++ b/lib/test/esprima/comment/migrated_0032.skip @@ -0,0 +1 @@ +TODO: location differences diff --git a/lib/test/esprima/comment/migrated_0032.tree.json b/lib/test/esprima/comment/migrated_0032.tree.json new file mode 100644 index 0000000..4c4b2b6 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0032.tree.json @@ -0,0 +1,406 @@ +{ + "type": "Program", + "body": [ + { + "type": "SwitchStatement", + "discriminant": { + "type": "Identifier", + "name": "answer", + "range": [ + 8, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "cases": [ + { + "type": "SwitchCase", + "test": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 23, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "consequent": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "bingo", + "range": [ + 27, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "arguments": [], + "trailingComments": [ + { + "type": "Block", + "value": " perfect ", + "range": [ + 35, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 48 + } + } + } + ], + "range": [ + 27, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 27, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 49 + } + } + } + ], + "range": [ + 18, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 49 + } + } + } + ], + "range": [ + 0, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + } + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": " perfect ", + "range": [ + 35, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 48 + } + } + } + ], + "tokens": [ + { + "type": "Keyword", + "value": "switch", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "answer", + "range": [ + 8, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Keyword", + "value": "case", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 23, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "bingo", + "range": [ + 27, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 49, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 50 + } + } + } + ], + "range": [ + 0, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0033.diff b/lib/test/esprima/comment/migrated_0033.diff new file mode 100644 index 0000000..eb0c1f2 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0033.diff @@ -0,0 +1,7 @@ +{ + "body": { + "0": { + "leadingComments": undefined + } + } +} diff --git a/lib/test/esprima/comment/migrated_0033.js b/lib/test/esprima/comment/migrated_0033.js new file mode 100644 index 0000000..77501e6 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0033.js @@ -0,0 +1 @@ +/* header */ (function(){ var version = 1; }).call(this) \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0033.tree.json b/lib/test/esprima/comment/migrated_0033.tree.json new file mode 100644 index 0000000..ac2a599 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0033.tree.json @@ -0,0 +1,571 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "version", + "range": [ + 30, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + "init": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "range": [ + 30, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 41 + } + } + } + ], + "kind": "var", + "range": [ + 26, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 42 + } + } + } + ], + "range": [ + 24, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 14, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + "property": { + "type": "Identifier", + "name": "call", + "range": [ + 46, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 50 + } + } + }, + "range": [ + 13, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 50 + } + } + }, + "arguments": [ + { + "type": "ThisExpression", + "range": [ + 51, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 1, + "column": 55 + } + } + } + ], + "range": [ + 13, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 56 + } + } + }, + "leadingComments": [ + { + "type": "Block", + "value": " header ", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "range": [ + 13, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 56 + } + } + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": " header ", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 14, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 26, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Identifier", + "value": "version", + "range": [ + 30, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + { + "type": "Identifier", + "value": "call", + "range": [ + 46, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 50 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 50 + }, + "end": { + "line": 1, + "column": 51 + } + } + }, + { + "type": "Keyword", + "value": "this", + "range": [ + 51, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 1, + "column": 55 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 55 + }, + "end": { + "line": 1, + "column": 56 + } + } + } + ], + "range": [ + 13, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 56 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0034.diff b/lib/test/esprima/comment/migrated_0034.diff new file mode 100644 index 0000000..3189c3f --- /dev/null +++ b/lib/test/esprima/comment/migrated_0034.diff @@ -0,0 +1,22 @@ +{ + "body": { + "0": { + "expression": { + "callee": { + "property": { + "leadingComments": undefined + }, + "object": { + "body": { + "body": { + "0": { + "trailingComments": undefined, + } + } + } + } + } + } + } + } +} diff --git a/lib/test/esprima/comment/migrated_0034.js b/lib/test/esprima/comment/migrated_0034.js new file mode 100644 index 0000000..deb6af5 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0034.js @@ -0,0 +1 @@ +(function(){ var version = 1; /* sync */ }).call(this) \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0034.tree.json b/lib/test/esprima/comment/migrated_0034.tree.json new file mode 100644 index 0000000..9508c12 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0034.tree.json @@ -0,0 +1,591 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "version", + "range": [ + 17, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "init": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "range": [ + 17, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "kind": "var", + "trailingComments": [ + { + "type": "Block", + "value": " sync ", + "range": [ + 30, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 40 + } + } + } + ], + "range": [ + 13, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "range": [ + 11, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 1, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + "property": { + "type": "Identifier", + "name": "call", + "leadingComments": [ + { + "type": "Block", + "value": " sync ", + "range": [ + 30, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 40 + } + } + } + ], + "range": [ + 44, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + "range": [ + 0, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + "arguments": [ + { + "type": "ThisExpression", + "range": [ + 49, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 53 + } + } + } + ], + "range": [ + 0, + 54 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + } + }, + "range": [ + 0, + 54 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + } + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": " sync ", + "range": [ + 30, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 40 + } + } + } + ], + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "version", + "range": [ + 17, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + { + "type": "Identifier", + "value": "call", + "range": [ + 44, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 49 + } + } + }, + { + "type": "Keyword", + "value": "this", + "range": [ + 49, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 53 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 54 + } + } + } + ], + "range": [ + 0, + 54 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0035.diff b/lib/test/esprima/comment/migrated_0035.diff new file mode 100644 index 0000000..b07c6b9 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0035.diff @@ -0,0 +1,17 @@ +{ + "body": { + "0": { + "body": { + "body": { + "0": { + "leadingComments": undefined, + "trailingComments": undefined + }, + "1": { + "leadingComments": undefined, + } + } + } + } + } +} diff --git a/lib/test/esprima/comment/migrated_0035.js b/lib/test/esprima/comment/migrated_0035.js new file mode 100644 index 0000000..42fc51a --- /dev/null +++ b/lib/test/esprima/comment/migrated_0035.js @@ -0,0 +1 @@ +function f() { /* infinite */ while (true) { } /* bar */ var each; } \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0035.tree.json b/lib/test/esprima/comment/migrated_0035.tree.json new file mode 100644 index 0000000..4a1b523 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0035.tree.json @@ -0,0 +1,557 @@ +{ + "type": "Program", + "body": [ + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "f", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 37, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 43, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "leadingComments": [ + { + "type": "Block", + "value": " infinite ", + "range": [ + 15, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": " bar ", + "range": [ + 47, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 56 + } + } + } + ], + "range": [ + 30, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "each", + "range": [ + 61, + 65 + ], + "loc": { + "start": { + "line": 1, + "column": 61 + }, + "end": { + "line": 1, + "column": 65 + } + } + }, + "init": null, + "range": [ + 61, + 65 + ], + "loc": { + "start": { + "line": 1, + "column": 61 + }, + "end": { + "line": 1, + "column": 65 + } + } + } + ], + "kind": "var", + "leadingComments": [ + { + "type": "Block", + "value": " bar ", + "range": [ + 47, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 56 + } + } + } + ], + "range": [ + 57, + 66 + ], + "loc": { + "start": { + "line": 1, + "column": 57 + }, + "end": { + "line": 1, + "column": 66 + } + } + } + ], + "range": [ + 13, + 68 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 68 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 0, + 68 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 68 + } + } + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": " infinite ", + "range": [ + 15, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Block", + "value": " bar ", + "range": [ + 47, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 56 + } + } + } + ], + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "while", + "range": [ + 30, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 37, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 57, + 60 + ], + "loc": { + "start": { + "line": 1, + "column": 57 + }, + "end": { + "line": 1, + "column": 60 + } + } + }, + { + "type": "Identifier", + "value": "each", + "range": [ + 61, + 65 + ], + "loc": { + "start": { + "line": 1, + "column": 61 + }, + "end": { + "line": 1, + "column": 65 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 65, + 66 + ], + "loc": { + "start": { + "line": 1, + "column": 65 + }, + "end": { + "line": 1, + "column": 66 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 67, + 68 + ], + "loc": { + "start": { + "line": 1, + "column": 67 + }, + "end": { + "line": 1, + "column": 68 + } + } + } + ], + "range": [ + 0, + 68 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 68 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0036.js b/lib/test/esprima/comment/migrated_0036.js new file mode 100644 index 0000000..552a2da --- /dev/null +++ b/lib/test/esprima/comment/migrated_0036.js @@ -0,0 +1 @@ + comment \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0038.skip b/lib/test/esprima/comment/migrated_0038.skip new file mode 100644 index 0000000..486143a --- /dev/null +++ b/lib/test/esprima/comment/migrated_0038.skip @@ -0,0 +1 @@ +TODO: location differences diff --git a/lib/test/esprima/comment/migrated_0038.tree.json b/lib/test/esprima/comment/migrated_0038.tree.json new file mode 100644 index 0000000..6439cf0 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0038.tree.json @@ -0,0 +1,40 @@ +{ + "type": "Program", + "body": [], + "sourceType": "script", + "comments": [ + { + "type": "Line", + "value": " comment", + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "tokens": [], + "range": [ + 11, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 11 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0039.js b/lib/test/esprima/comment/migrated_0039.js new file mode 100644 index 0000000..bf723fd --- /dev/null +++ b/lib/test/esprima/comment/migrated_0039.js @@ -0,0 +1 @@ + comment \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0040.skip b/lib/test/esprima/comment/migrated_0040.skip new file mode 100644 index 0000000..ed7bd50 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0040.skip @@ -0,0 +1 @@ +TODO: parse errors diff --git a/lib/test/esprima/comment/migrated_0040.tree.json b/lib/test/esprima/comment/migrated_0040.tree.json new file mode 100644 index 0000000..a505a65 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0040.tree.json @@ -0,0 +1,40 @@ +{ + "type": "Program", + "body": [], + "sourceType": "script", + "comments": [ + { + "type": "Line", + "value": " comment", + "range": [ + 3, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "tokens": [], + "range": [ + 14, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 14 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0041.js b/lib/test/esprima/comment/migrated_0041.js new file mode 100644 index 0000000..4e5397b --- /dev/null +++ b/lib/test/esprima/comment/migrated_0041.js @@ -0,0 +1 @@ + /* block comment */ --> comment \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0041.skip b/lib/test/esprima/comment/migrated_0041.skip new file mode 100644 index 0000000..ed7bd50 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0041.skip @@ -0,0 +1 @@ +TODO: parse errors diff --git a/lib/test/esprima/comment/migrated_0041.tree.json b/lib/test/esprima/comment/migrated_0041.tree.json new file mode 100644 index 0000000..cdb7bce --- /dev/null +++ b/lib/test/esprima/comment/migrated_0041.tree.json @@ -0,0 +1,58 @@ +{ + "type": "Program", + "body": [], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": " block comment ", + "range": [ + 3, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Line", + "value": " comment", + "range": [ + 24, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "tokens": [], + "range": [ + 35, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 35 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0042.js b/lib/test/esprima/comment/migrated_0042.js new file mode 100644 index 0000000..a0848a2 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0042.js @@ -0,0 +1 @@ +/* block comment */--> comment \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0042.skip b/lib/test/esprima/comment/migrated_0042.skip new file mode 100644 index 0000000..ed7bd50 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0042.skip @@ -0,0 +1 @@ +TODO: parse errors diff --git a/lib/test/esprima/comment/migrated_0042.tree.json b/lib/test/esprima/comment/migrated_0042.tree.json new file mode 100644 index 0000000..e2a845e --- /dev/null +++ b/lib/test/esprima/comment/migrated_0042.tree.json @@ -0,0 +1,58 @@ +{ + "type": "Program", + "body": [], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": " block comment ", + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Line", + "value": " comment", + "range": [ + 19, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 30 + } + } + } + ], + "tokens": [], + "range": [ + 30, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 30 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0043.js b/lib/test/esprima/comment/migrated_0043.js new file mode 100644 index 0000000..956ed81 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0043.js @@ -0,0 +1 @@ +/* not comment*/; i-->0 \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0043.tree.json b/lib/test/esprima/comment/migrated_0043.tree.json new file mode 100644 index 0000000..7c7c6b6 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0043.tree.json @@ -0,0 +1,220 @@ +{ + "type": "Program", + "body": [ + { + "type": "EmptyStatement", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": ">", + "left": { + "type": "UpdateExpression", + "operator": "--", + "argument": { + "type": "Identifier", + "name": "i", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "prefix": false, + "range": [ + 18, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "right": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "range": [ + 18, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "range": [ + 18, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": ";", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "i", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "--", + "range": [ + 19, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 16, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 23 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0044.js b/lib/test/esprima/comment/migrated_0044.js new file mode 100644 index 0000000..18b482b --- /dev/null +++ b/lib/test/esprima/comment/migrated_0044.js @@ -0,0 +1 @@ +while (i-->0) {} \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0044.tree.json b/lib/test/esprima/comment/migrated_0044.tree.json new file mode 100644 index 0000000..34a4b81 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0044.tree.json @@ -0,0 +1,293 @@ +{ + "type": "Program", + "body": [ + { + "type": "WhileStatement", + "test": { + "type": "BinaryExpression", + "operator": ">", + "left": { + "type": "UpdateExpression", + "operator": "--", + "argument": { + "type": "Identifier", + "name": "i", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "prefix": false, + "range": [ + 7, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "right": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 7, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "while", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "i", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "--", + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0045.diff b/lib/test/esprima/comment/migrated_0045.diff new file mode 100644 index 0000000..42f7950 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0045.diff @@ -0,0 +1,8 @@ +{ + "body": { + "0": { + "leadingComments": undefined, + "trailingComments": undefined + } + } +} diff --git a/lib/test/esprima/comment/migrated_0045.js b/lib/test/esprima/comment/migrated_0045.js new file mode 100644 index 0000000..f3665d1 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0045.js @@ -0,0 +1 @@ +/*Venus*/ debugger; // Mars \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0045.tree.json b/lib/test/esprima/comment/migrated_0045.tree.json new file mode 100644 index 0000000..f121ec4 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0045.tree.json @@ -0,0 +1,153 @@ +{ + "type": "Program", + "body": [ + { + "type": "DebuggerStatement", + "leadingComments": [ + { + "type": "Block", + "value": "Venus", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "trailingComments": [ + { + "type": "Line", + "value": " Mars", + "range": [ + 20, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "range": [ + 10, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": "Venus", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Line", + "value": " Mars", + "range": [ + 20, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "tokens": [ + { + "type": "Keyword", + "value": "debugger", + "range": [ + 10, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "range": [ + 10, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 19 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0046.js b/lib/test/esprima/comment/migrated_0046.js new file mode 100644 index 0000000..fb49a93 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0046.js @@ -0,0 +1 @@ +function x(){ /*Jupiter*/ return; /*Saturn*/} \ No newline at end of file diff --git a/lib/test/esprima/comment/migrated_0046.tree.json b/lib/test/esprima/comment/migrated_0046.tree.json new file mode 100644 index 0000000..45036f2 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0046.tree.json @@ -0,0 +1,241 @@ +{ + "type": "Program", + "body": [ + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": null, + "range": [ + 26, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "range": [ + 12, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 0, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 26, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 45 + } + } + } + ], + "range": [ + 0, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + } +} diff --git a/lib/test/esprima/comment/migrated_0047.diff b/lib/test/esprima/comment/migrated_0047.diff new file mode 100644 index 0000000..72ef9c5 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0047.diff @@ -0,0 +1,9 @@ +{ + "body": { + "0": { + "expression": { + "leadingComments": undefined, + } + } + } +} diff --git a/lib/test/esprima/comment/migrated_0047.js b/lib/test/esprima/comment/migrated_0047.js new file mode 100644 index 0000000..5ff6136 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0047.js @@ -0,0 +1,3 @@ +(/* comment */{ + p1: null +}) diff --git a/lib/test/esprima/comment/migrated_0047.tree.json b/lib/test/esprima/comment/migrated_0047.tree.json new file mode 100644 index 0000000..c495f4b --- /dev/null +++ b/lib/test/esprima/comment/migrated_0047.tree.json @@ -0,0 +1,132 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 31 + ], + "type": "ExpressionStatement", + "expression": { + "range": [ + 14, + 30 + ], + "type": "ObjectExpression", + "properties": [ + { + "range": [ + 20, + 28 + ], + "type": "Property", + "key": { + "range": [ + 20, + 22 + ], + "type": "Identifier", + "name": "p1" + }, + "computed": false, + "value": { + "range": [ + 24, + 28 + ], + "type": "Literal", + "value": null, + "raw": "null" + }, + "kind": "init", + "method": false, + "shorthand": false + } + ], + "leadingComments": [ + { + "type": "Block", + "value": " comment ", + "range": [ + 1, + 14 + ] + } + ] + } + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": " comment ", + "range": [ + 1, + 14 + ] + } + ], + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 14, + 15 + ] + }, + { + "type": "Identifier", + "value": "p1", + "range": [ + 20, + 22 + ] + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 22, + 23 + ] + }, + { + "type": "Null", + "value": "null", + "range": [ + 24, + 28 + ] + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 29, + 30 + ] + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 30, + 31 + ] + } + ], + "range": [ + 0, + 31 + ] +} diff --git a/lib/test/esprima/comment/migrated_0048.diff b/lib/test/esprima/comment/migrated_0048.diff new file mode 100644 index 0000000..72ef9c5 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0048.diff @@ -0,0 +1,9 @@ +{ + "body": { + "0": { + "expression": { + "leadingComments": undefined, + } + } + } +} diff --git a/lib/test/esprima/comment/migrated_0048.js b/lib/test/esprima/comment/migrated_0048.js new file mode 100644 index 0000000..cf80026 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0048.js @@ -0,0 +1,4 @@ +(/* comment */{ + p1: null, + p2: null +}) diff --git a/lib/test/esprima/comment/migrated_0048.tree.json b/lib/test/esprima/comment/migrated_0048.tree.json new file mode 100644 index 0000000..00c0b2e --- /dev/null +++ b/lib/test/esprima/comment/migrated_0048.tree.json @@ -0,0 +1,192 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 45 + ], + "type": "ExpressionStatement", + "expression": { + "range": [ + 14, + 44 + ], + "type": "ObjectExpression", + "properties": [ + { + "range": [ + 20, + 28 + ], + "type": "Property", + "key": { + "range": [ + 20, + 22 + ], + "type": "Identifier", + "name": "p1" + }, + "computed": false, + "value": { + "range": [ + 24, + 28 + ], + "type": "Literal", + "value": null, + "raw": "null" + }, + "kind": "init", + "method": false, + "shorthand": false + }, + { + "range": [ + 34, + 42 + ], + "type": "Property", + "key": { + "range": [ + 34, + 36 + ], + "type": "Identifier", + "name": "p2" + }, + "computed": false, + "value": { + "range": [ + 38, + 42 + ], + "type": "Literal", + "value": null, + "raw": "null" + }, + "kind": "init", + "method": false, + "shorthand": false + } + ], + "leadingComments": [ + { + "type": "Block", + "value": " comment ", + "range": [ + 1, + 14 + ] + } + ] + } + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": " comment ", + "range": [ + 1, + 14 + ] + } + ], + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 14, + 15 + ] + }, + { + "type": "Identifier", + "value": "p1", + "range": [ + 20, + 22 + ] + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 22, + 23 + ] + }, + { + "type": "Null", + "value": "null", + "range": [ + 24, + 28 + ] + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 28, + 29 + ] + }, + { + "type": "Identifier", + "value": "p2", + "range": [ + 34, + 36 + ] + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 36, + 37 + ] + }, + { + "type": "Null", + "value": "null", + "range": [ + 38, + 42 + ] + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 43, + 44 + ] + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 44, + 45 + ] + } + ], + "range": [ + 0, + 45 + ] +} diff --git a/lib/test/esprima/comment/migrated_0049.diff b/lib/test/esprima/comment/migrated_0049.diff new file mode 100644 index 0000000..eb0c1f2 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0049.diff @@ -0,0 +1,7 @@ +{ + "body": { + "0": { + "leadingComments": undefined + } + } +} diff --git a/lib/test/esprima/comment/migrated_0049.js b/lib/test/esprima/comment/migrated_0049.js new file mode 100644 index 0000000..2815ca0 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0049.js @@ -0,0 +1,4 @@ +/** + * @type {number} + */ +var a = 5; diff --git a/lib/test/esprima/comment/migrated_0049.tree.json b/lib/test/esprima/comment/migrated_0049.tree.json new file mode 100644 index 0000000..dc48a4f --- /dev/null +++ b/lib/test/esprima/comment/migrated_0049.tree.json @@ -0,0 +1,106 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 26, + 36 + ], + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 30, + 35 + ], + "type": "VariableDeclarator", + "id": { + "range": [ + 30, + 31 + ], + "type": "Identifier", + "name": "a" + }, + "init": { + "range": [ + 34, + 35 + ], + "type": "Literal", + "value": 5, + "raw": "5" + } + } + ], + "kind": "var", + "leadingComments": [ + { + "type": "Block", + "value": "*\n * @type {number}\n ", + "range": [ + 0, + 25 + ] + } + ] + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": "*\n * @type {number}\n ", + "range": [ + 0, + 25 + ] + } + ], + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 26, + 29 + ] + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 30, + 31 + ] + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 32, + 33 + ] + }, + { + "type": "Numeric", + "value": "5", + "range": [ + 34, + 35 + ] + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 35, + 36 + ] + } + ], + "range": [ + 26, + 36 + ] +} diff --git a/lib/test/esprima/comment/migrated_0050.diff b/lib/test/esprima/comment/migrated_0050.diff new file mode 100644 index 0000000..981e973 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0050.diff @@ -0,0 +1,12 @@ +{ + "body": { + "0": { + "leadingComments": undefined, + "declarations": { + "1": { + "leadingComments": undefined, + } + } + } + } +} diff --git a/lib/test/esprima/comment/migrated_0050.js b/lib/test/esprima/comment/migrated_0050.js new file mode 100644 index 0000000..92f0070 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0050.js @@ -0,0 +1,8 @@ +/** + * @type {number} + */ +var a = 5, + /** + * @type {number} + */ + b = 6; diff --git a/lib/test/esprima/comment/migrated_0050.tree.json b/lib/test/esprima/comment/migrated_0050.tree.json new file mode 100644 index 0000000..6a8077b --- /dev/null +++ b/lib/test/esprima/comment/migrated_0050.tree.json @@ -0,0 +1,180 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 26, + 85 + ], + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 30, + 35 + ], + "type": "VariableDeclarator", + "id": { + "range": [ + 30, + 31 + ], + "type": "Identifier", + "name": "a" + }, + "init": { + "range": [ + 34, + 35 + ], + "type": "Literal", + "value": 5, + "raw": "5" + } + }, + { + "range": [ + 79, + 84 + ], + "type": "VariableDeclarator", + "id": { + "range": [ + 79, + 80 + ], + "type": "Identifier", + "name": "b" + }, + "init": { + "range": [ + 83, + 84 + ], + "type": "Literal", + "value": 6, + "raw": "6" + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * @type {number}\n ", + "range": [ + 41, + 74 + ] + } + ] + } + ], + "kind": "var", + "leadingComments": [ + { + "type": "Block", + "value": "*\n * @type {number}\n ", + "range": [ + 0, + 25 + ] + } + ] + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": "*\n * @type {number}\n ", + "range": [ + 0, + 25 + ] + }, + { + "type": "Block", + "value": "*\n * @type {number}\n ", + "range": [ + 41, + 74 + ] + } + ], + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 26, + 29 + ] + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 30, + 31 + ] + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 32, + 33 + ] + }, + { + "type": "Numeric", + "value": "5", + "range": [ + 34, + 35 + ] + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 35, + 36 + ] + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 79, + 80 + ] + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 81, + 82 + ] + }, + { + "type": "Numeric", + "value": "6", + "range": [ + 83, + 84 + ] + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 84, + 85 + ] + } + ], + "range": [ + 26, + 85 + ] +} diff --git a/lib/test/esprima/comment/migrated_0051.diff b/lib/test/esprima/comment/migrated_0051.diff new file mode 100644 index 0000000..75c0efb --- /dev/null +++ b/lib/test/esprima/comment/migrated_0051.diff @@ -0,0 +1,14 @@ +{ + "body": { + "0": { + "expression": { + "leadingComments": undefined, + "properties" : { + "0": { + "leadingComments": undefined, + } + } + } + } + } +} diff --git a/lib/test/esprima/comment/migrated_0051.js b/lib/test/esprima/comment/migrated_0051.js new file mode 100644 index 0000000..d367759 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0051.js @@ -0,0 +1,4 @@ +(/* comment */{ + /* comment 2 */ + p1: null +}) diff --git a/lib/test/esprima/comment/migrated_0051.tree.json b/lib/test/esprima/comment/migrated_0051.tree.json new file mode 100644 index 0000000..1427ad9 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0051.tree.json @@ -0,0 +1,150 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 51 + ], + "type": "ExpressionStatement", + "expression": { + "range": [ + 14, + 50 + ], + "type": "ObjectExpression", + "properties": [ + { + "range": [ + 40, + 48 + ], + "type": "Property", + "key": { + "range": [ + 40, + 42 + ], + "type": "Identifier", + "name": "p1" + }, + "computed": false, + "value": { + "range": [ + 44, + 48 + ], + "type": "Literal", + "value": null, + "raw": "null" + }, + "kind": "init", + "method": false, + "shorthand": false, + "leadingComments": [ + { + "type": "Block", + "value": " comment 2 ", + "range": [ + 20, + 35 + ] + } + ] + } + ], + "leadingComments": [ + { + "type": "Block", + "value": " comment ", + "range": [ + 1, + 14 + ] + } + ] + } + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": " comment ", + "range": [ + 1, + 14 + ] + }, + { + "type": "Block", + "value": " comment 2 ", + "range": [ + 20, + 35 + ] + } + ], + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 14, + 15 + ] + }, + { + "type": "Identifier", + "value": "p1", + "range": [ + 40, + 42 + ] + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 42, + 43 + ] + }, + { + "type": "Null", + "value": "null", + "range": [ + 44, + 48 + ] + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 49, + 50 + ] + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 50, + 51 + ] + } + ], + "range": [ + 0, + 51 + ] +} diff --git a/lib/test/esprima/comment/migrated_0052.diff b/lib/test/esprima/comment/migrated_0052.diff new file mode 100644 index 0000000..eb0c1f2 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0052.diff @@ -0,0 +1,7 @@ +{ + "body": { + "0": { + "leadingComments": undefined + } + } +} diff --git a/lib/test/esprima/comment/migrated_0052.js b/lib/test/esprima/comment/migrated_0052.js new file mode 100644 index 0000000..8d206aa --- /dev/null +++ b/lib/test/esprima/comment/migrated_0052.js @@ -0,0 +1 @@ +/**/ function a() {} diff --git a/lib/test/esprima/comment/migrated_0052.tree.json b/lib/test/esprima/comment/migrated_0052.tree.json new file mode 100644 index 0000000..7542a59 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0052.tree.json @@ -0,0 +1,106 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 5, + 20 + ], + "type": "FunctionDeclaration", + "id": { + "range": [ + 14, + 15 + ], + "type": "Identifier", + "name": "a" + }, + "params": [], + "body": { + "range": [ + 18, + 20 + ], + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false, + "leadingComments": [ + { + "type": "Block", + "value": "", + "range": [ + 0, + 4 + ] + } + ] + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": "", + "range": [ + 0, + 4 + ] + } + ], + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 5, + 13 + ] + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 19, + 20 + ] + } + ], + "range": [ + 5, + 20 + ] +} diff --git a/lib/test/esprima/comment/migrated_0053.diff b/lib/test/esprima/comment/migrated_0053.diff new file mode 100644 index 0000000..eb0c1f2 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0053.diff @@ -0,0 +1,7 @@ +{ + "body": { + "0": { + "leadingComments": undefined + } + } +} diff --git a/lib/test/esprima/comment/migrated_0053.js b/lib/test/esprima/comment/migrated_0053.js new file mode 100644 index 0000000..57190c3 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0053.js @@ -0,0 +1 @@ +/**/ function a() {function o() {}} diff --git a/lib/test/esprima/comment/migrated_0053.tree.json b/lib/test/esprima/comment/migrated_0053.tree.json new file mode 100644 index 0000000..7f3613a --- /dev/null +++ b/lib/test/esprima/comment/migrated_0053.tree.json @@ -0,0 +1,181 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 5, + 35 + ], + "type": "FunctionDeclaration", + "id": { + "range": [ + 14, + 15 + ], + "type": "Identifier", + "name": "a" + }, + "params": [], + "body": { + "range": [ + 18, + 35 + ], + "type": "BlockStatement", + "body": [ + { + "range": [ + 19, + 34 + ], + "type": "FunctionDeclaration", + "id": { + "range": [ + 28, + 29 + ], + "type": "Identifier", + "name": "o" + }, + "params": [], + "body": { + "range": [ + 32, + 34 + ], + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false + } + ] + }, + "generator": false, + "expression": false, + "leadingComments": [ + { + "type": "Block", + "value": "", + "range": [ + 0, + 4 + ] + } + ] + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": "", + "range": [ + 0, + 4 + ] + } + ], + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 5, + 13 + ] + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ] + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 19, + 27 + ] + }, + { + "type": "Identifier", + "value": "o", + "range": [ + 28, + 29 + ] + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 29, + 30 + ] + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 30, + 31 + ] + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 32, + 33 + ] + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 33, + 34 + ] + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 34, + 35 + ] + } + ], + "range": [ + 5, + 35 + ] +} diff --git a/lib/test/esprima/comment/migrated_0054.diff b/lib/test/esprima/comment/migrated_0054.diff new file mode 100644 index 0000000..36956d2 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0054.diff @@ -0,0 +1,14 @@ +{ + "body": { + "0": { + "leadingComments": undefined, + "body": { + "body" : { + "0": { + "leadingComments": undefined, + } + } + } + } + } +} diff --git a/lib/test/esprima/comment/migrated_0054.js b/lib/test/esprima/comment/migrated_0054.js new file mode 100644 index 0000000..7648669 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0054.js @@ -0,0 +1 @@ +/**/ function a() {/**/function o() {}} diff --git a/lib/test/esprima/comment/migrated_0054.tree.json b/lib/test/esprima/comment/migrated_0054.tree.json new file mode 100644 index 0000000..92ec59b --- /dev/null +++ b/lib/test/esprima/comment/migrated_0054.tree.json @@ -0,0 +1,199 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 5, + 39 + ], + "type": "FunctionDeclaration", + "id": { + "range": [ + 14, + 15 + ], + "type": "Identifier", + "name": "a" + }, + "params": [], + "body": { + "range": [ + 18, + 39 + ], + "type": "BlockStatement", + "body": [ + { + "range": [ + 23, + 38 + ], + "type": "FunctionDeclaration", + "id": { + "range": [ + 32, + 33 + ], + "type": "Identifier", + "name": "o" + }, + "params": [], + "body": { + "range": [ + 36, + 38 + ], + "type": "BlockStatement", + "body": [] + }, + "generator": false, + "expression": false, + "leadingComments": [ + { + "type": "Block", + "value": "", + "range": [ + 19, + 23 + ] + } + ] + } + ] + }, + "generator": false, + "expression": false, + "leadingComments": [ + { + "type": "Block", + "value": "", + "range": [ + 0, + 4 + ] + } + ] + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": "", + "range": [ + 0, + 4 + ] + }, + { + "type": "Block", + "value": "", + "range": [ + 19, + 23 + ] + } + ], + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 5, + 13 + ] + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ] + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 23, + 31 + ] + }, + { + "type": "Identifier", + "value": "o", + "range": [ + 32, + 33 + ] + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 33, + 34 + ] + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 34, + 35 + ] + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 36, + 37 + ] + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 37, + 38 + ] + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 38, + 39 + ] + } + ], + "range": [ + 5, + 39 + ] +} diff --git a/lib/test/esprima/comment/migrated_0055.js b/lib/test/esprima/comment/migrated_0055.js new file mode 100644 index 0000000..3771b20 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0055.js @@ -0,0 +1,5 @@ +while (true) { + /** + * comments in empty block + */ +} diff --git a/lib/test/esprima/comment/migrated_0055.tree.json b/lib/test/esprima/comment/migrated_0055.tree.json new file mode 100644 index 0000000..e4a2256 --- /dev/null +++ b/lib/test/esprima/comment/migrated_0055.tree.json @@ -0,0 +1,224 @@ +{ + "range": [ + 0, + 57 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "type": "Program", + "body": [ + { + "range": [ + 0, + 57 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "type": "WhileStatement", + "test": { + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Literal", + "value": true, + "raw": "true" + }, + "body": { + "range": [ + 13, + 57 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "type": "BlockStatement", + "body": [], + "innerComments": [ + { + "type": "Block", + "value": "*\n * comments in empty block\n ", + "range": [ + 17, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 4, + "column": 5 + } + } + } + ] + } + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": "*\n * comments in empty block\n ", + "range": [ + 17, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 4, + "column": 5 + } + } + } + ], + "tokens": [ + { + "type": "Keyword", + "value": "while", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + } + ] +} diff --git a/lib/test/esprima/declaration/const/migrated_0000.js b/lib/test/esprima/declaration/const/migrated_0000.js new file mode 100644 index 0000000..699d3a3 --- /dev/null +++ b/lib/test/esprima/declaration/const/migrated_0000.js @@ -0,0 +1 @@ +const x = 42 \ No newline at end of file diff --git a/lib/test/esprima/declaration/const/migrated_0000.tree.json b/lib/test/esprima/declaration/const/migrated_0000.tree.json new file mode 100644 index 0000000..c15305e --- /dev/null +++ b/lib/test/esprima/declaration/const/migrated_0000.tree.json @@ -0,0 +1,168 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "init": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 6, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "kind": "const", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "const", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } +} diff --git a/lib/test/esprima/declaration/const/migrated_0001.diff b/lib/test/esprima/declaration/const/migrated_0001.diff new file mode 100644 index 0000000..44cc876 --- /dev/null +++ b/lib/test/esprima/declaration/const/migrated_0001.diff @@ -0,0 +1,12 @@ +{ + 'body': { + '0': { + 'body': { + '0': { + 'range': { '1': 14 }, + 'loc': { 'end': { 'column': 14 }} + } + } + } + } +} diff --git a/lib/test/esprima/declaration/const/migrated_0001.js b/lib/test/esprima/declaration/const/migrated_0001.js new file mode 100644 index 0000000..9beb4c7 --- /dev/null +++ b/lib/test/esprima/declaration/const/migrated_0001.js @@ -0,0 +1 @@ +{ const x = 42 } \ No newline at end of file diff --git a/lib/test/esprima/declaration/const/migrated_0001.tree.json b/lib/test/esprima/declaration/const/migrated_0001.tree.json new file mode 100644 index 0000000..94884c6 --- /dev/null +++ b/lib/test/esprima/declaration/const/migrated_0001.tree.json @@ -0,0 +1,223 @@ +{ + "type": "Program", + "body": [ + { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "init": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 8, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "kind": "const", + "range": [ + 2, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "{", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "const", + "range": [ + 2, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } +} diff --git a/lib/test/esprima/declaration/const/migrated_0002.diff b/lib/test/esprima/declaration/const/migrated_0002.diff new file mode 100644 index 0000000..b882457 --- /dev/null +++ b/lib/test/esprima/declaration/const/migrated_0002.diff @@ -0,0 +1,12 @@ +{ + 'body': { + '0': { + 'body': { + '0': { + 'range': { '1': 31 }, + 'loc': { 'end': { 'column': 31 }} + } + } + } + } +} diff --git a/lib/test/esprima/declaration/const/migrated_0002.js b/lib/test/esprima/declaration/const/migrated_0002.js new file mode 100644 index 0000000..2eaf32c --- /dev/null +++ b/lib/test/esprima/declaration/const/migrated_0002.js @@ -0,0 +1 @@ +{ const x = 14, y = 3, z = 1977 } \ No newline at end of file diff --git a/lib/test/esprima/declaration/const/migrated_0002.tree.json b/lib/test/esprima/declaration/const/migrated_0002.tree.json new file mode 100644 index 0000000..5c4c675 --- /dev/null +++ b/lib/test/esprima/declaration/const/migrated_0002.tree.json @@ -0,0 +1,475 @@ +{ + "type": "Program", + "body": [ + { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "init": { + "type": "Literal", + "value": 14, + "raw": "14", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 8, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "y", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "init": { + "type": "Literal", + "value": 3, + "raw": "3", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "z", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "init": { + "type": "Literal", + "value": 1977, + "raw": "1977", + "range": [ + 27, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "range": [ + 23, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "kind": "const", + "range": [ + 2, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ], + "range": [ + 0, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "{", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "const", + "range": [ + 2, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Numeric", + "value": "14", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Numeric", + "value": "3", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Numeric", + "value": "1977", + "range": [ + 27, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "range": [ + 0, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + } +} diff --git a/lib/test/esprima/declaration/function/dupe-param.diff b/lib/test/esprima/declaration/function/dupe-param.diff new file mode 100644 index 0000000..593fe9d --- /dev/null +++ b/lib/test/esprima/declaration/function/dupe-param.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 14 }, + "end": { "line": 1, "column": 15 } + } + } + } +} diff --git a/lib/test/esprima/declaration/function/dupe-param.js b/lib/test/esprima/declaration/function/dupe-param.js new file mode 100644 index 0000000..3b836d3 --- /dev/null +++ b/lib/test/esprima/declaration/function/dupe-param.js @@ -0,0 +1 @@ +function a(x, x) {'use strict';} diff --git a/lib/test/esprima/declaration/function/dupe-param.tree.json b/lib/test/esprima/declaration/function/dupe-param.tree.json new file mode 100644 index 0000000..e080345 --- /dev/null +++ b/lib/test/esprima/declaration/function/dupe-param.tree.json @@ -0,0 +1,359 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Identifier", + "name": "a" + }, + "params": [ + { + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "type": "Identifier", + "name": "x" + }, + { + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "Identifier", + "name": "x" + } + ], + "body": { + "range": [ + 17, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 18, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 18, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "type": "Literal", + "value": "use strict", + "raw": "'use strict'" + }, + "directive": "use strict" + } + ] + }, + "generator": false, + "expression": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "String", + "value": "'use strict'", + "range": [ + 18, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ], + "errors": [ + { + "index": 14, + "lineNumber": 1, + "column": 15, + "message": "Error: Line 1: Strict mode function may not have duplicate parameter names" + } + ], + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + } +} diff --git a/lib/test/esprima/declaration/function/empty-param.js b/lib/test/esprima/declaration/function/empty-param.js new file mode 100644 index 0000000..860cafa --- /dev/null +++ b/lib/test/esprima/declaration/function/empty-param.js @@ -0,0 +1 @@ +function a([], []) {'use strict';} diff --git a/lib/test/esprima/declaration/function/empty-param.tree.json b/lib/test/esprima/declaration/function/empty-param.tree.json new file mode 100644 index 0000000..7cde4d4 --- /dev/null +++ b/lib/test/esprima/declaration/function/empty-param.tree.json @@ -0,0 +1,387 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "type": "FunctionDeclaration", + "id": { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Identifier", + "name": "a" + }, + "params": [ + { + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "ArrayPattern", + "elements": [] + }, + { + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "ArrayPattern", + "elements": [] + } + ], + "body": { + "range": [ + 19, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 20, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 20, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "type": "Literal", + "value": "use strict", + "raw": "'use strict'" + }, + "directive": "use strict" + } + ] + }, + "generator": false, + "expression": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "String", + "value": "'use strict'", + "range": [ + 20, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } +} diff --git a/lib/test/esprima/declaration/function/migrated_0000.js b/lib/test/esprima/declaration/function/migrated_0000.js new file mode 100644 index 0000000..5a9b481 --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0000.js @@ -0,0 +1 @@ +function hello() { sayHi(); } \ No newline at end of file diff --git a/lib/test/esprima/declaration/function/migrated_0000.tree.json b/lib/test/esprima/declaration/function/migrated_0000.tree.json new file mode 100644 index 0000000..f6c904a --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0000.tree.json @@ -0,0 +1,312 @@ +{ + "type": "Program", + "body": [ + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "hello", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "sayHi", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "arguments": [], + "range": [ + 19, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 19, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "range": [ + 17, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "hello", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "sayHi", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } +} diff --git a/lib/test/esprima/declaration/function/migrated_0001.js b/lib/test/esprima/declaration/function/migrated_0001.js new file mode 100644 index 0000000..e2ecc80 --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0001.js @@ -0,0 +1 @@ +function eval() { } \ No newline at end of file diff --git a/lib/test/esprima/declaration/function/migrated_0001.tree.json b/lib/test/esprima/declaration/function/migrated_0001.tree.json new file mode 100644 index 0000000..8bd6aa9 --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0001.tree.json @@ -0,0 +1,186 @@ +{ + "type": "Program", + "body": [ + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "eval", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 16, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "eval", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } +} diff --git a/lib/test/esprima/declaration/function/migrated_0002.js b/lib/test/esprima/declaration/function/migrated_0002.js new file mode 100644 index 0000000..705459a --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0002.js @@ -0,0 +1 @@ +function arguments() { } \ No newline at end of file diff --git a/lib/test/esprima/declaration/function/migrated_0002.tree.json b/lib/test/esprima/declaration/function/migrated_0002.tree.json new file mode 100644 index 0000000..dd3aebb --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0002.tree.json @@ -0,0 +1,186 @@ +{ + "type": "Program", + "body": [ + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "arguments", + "range": [ + 9, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "arguments", + "range": [ + 9, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } +} diff --git a/lib/test/esprima/declaration/function/migrated_0003.js b/lib/test/esprima/declaration/function/migrated_0003.js new file mode 100644 index 0000000..f175fd4 --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0003.js @@ -0,0 +1 @@ +function test(t, t) { } \ No newline at end of file diff --git a/lib/test/esprima/declaration/function/migrated_0003.tree.json b/lib/test/esprima/declaration/function/migrated_0003.tree.json new file mode 100644 index 0000000..d647993 --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0003.tree.json @@ -0,0 +1,277 @@ +{ + "type": "Program", + "body": [ + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "test", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "t", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "name": "t", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 20, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "test", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "t", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "t", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } +} diff --git a/lib/test/esprima/declaration/function/migrated_0004.js b/lib/test/esprima/declaration/function/migrated_0004.js new file mode 100644 index 0000000..c6db60a --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0004.js @@ -0,0 +1 @@ +(function test(t, t) { }) \ No newline at end of file diff --git a/lib/test/esprima/declaration/function/migrated_0004.tree.json b/lib/test/esprima/declaration/function/migrated_0004.tree.json new file mode 100644 index 0000000..15ff216 --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0004.tree.json @@ -0,0 +1,330 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": { + "type": "Identifier", + "name": "test", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "t", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "name": "t", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 1, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "test", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "t", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "t", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } +} diff --git a/lib/test/esprima/declaration/function/migrated_0005.diff b/lib/test/esprima/declaration/function/migrated_0005.diff new file mode 100644 index 0000000..736f45b --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0005.diff @@ -0,0 +1,20 @@ +{ + 'body': { + '0': { + 'body': { + 'body': { + '0': { + 'body': { + 'body': { + '0': { + 'range': { '1': 49 }, + 'loc': { 'end': { 'column': 49 }} + } + } + } + } + } + } + } + } +} diff --git a/lib/test/esprima/declaration/function/migrated_0005.js b/lib/test/esprima/declaration/function/migrated_0005.js new file mode 100644 index 0000000..d273ac1 --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0005.js @@ -0,0 +1 @@ +function eval() { function inner() { "use strict" } } \ No newline at end of file diff --git a/lib/test/esprima/declaration/function/migrated_0005.tree.json b/lib/test/esprima/declaration/function/migrated_0005.tree.json new file mode 100644 index 0000000..f35f3e7 --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0005.tree.json @@ -0,0 +1,407 @@ +{ + "type": "Program", + "body": [ + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "eval", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "inner", + "range": [ + 27, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 37, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 49 + } + } + }, + "directive": "use strict", + "range": [ + 37, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 50 + } + } + } + ], + "range": [ + 35, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 51 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 18, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 51 + } + } + } + ], + "range": [ + 16, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 53 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 0, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "eval", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 18, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "inner", + "range": [ + 27, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 37, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 49 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 50 + }, + "end": { + "line": 1, + "column": 51 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 52 + }, + "end": { + "line": 1, + "column": 53 + } + } + } + ], + "range": [ + 0, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + } +} diff --git a/lib/test/esprima/declaration/function/migrated_0006.js b/lib/test/esprima/declaration/function/migrated_0006.js new file mode 100644 index 0000000..e8689d1 --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0006.js @@ -0,0 +1 @@ +function hello(a) { sayHi(); } \ No newline at end of file diff --git a/lib/test/esprima/declaration/function/migrated_0006.tree.json b/lib/test/esprima/declaration/function/migrated_0006.tree.json new file mode 100644 index 0000000..12954fc --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0006.tree.json @@ -0,0 +1,349 @@ +{ + "type": "Program", + "body": [ + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "hello", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "sayHi", + "range": [ + 20, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "arguments": [], + "range": [ + 20, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "range": [ + 20, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "range": [ + 18, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "hello", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "sayHi", + "range": [ + 20, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + } + ], + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + } +} diff --git a/lib/test/esprima/declaration/function/migrated_0007.js b/lib/test/esprima/declaration/function/migrated_0007.js new file mode 100644 index 0000000..6bed4ae --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0007.js @@ -0,0 +1 @@ +function hello(a, b) { sayHi(); } \ No newline at end of file diff --git a/lib/test/esprima/declaration/function/migrated_0007.tree.json b/lib/test/esprima/declaration/function/migrated_0007.tree.json new file mode 100644 index 0000000..a610726 --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0007.tree.json @@ -0,0 +1,403 @@ +{ + "type": "Program", + "body": [ + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "hello", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "name": "b", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "sayHi", + "range": [ + 23, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "arguments": [], + "range": [ + 23, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 23, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "range": [ + 21, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 0, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "hello", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "sayHi", + "range": [ + 23, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "range": [ + 0, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + } +} diff --git a/lib/test/esprima/declaration/function/migrated_0008.diff b/lib/test/esprima/declaration/function/migrated_0008.diff new file mode 100644 index 0000000..768fc56 --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0008.diff @@ -0,0 +1,20 @@ +{ + 'body': { + '0': { + 'declarations': { + '0': { + 'init': { + 'body': { + 'body': { + '0': { + 'range': { '1': 29 }, + 'loc': { 'end': { 'column': 29 }} + } + } + } + } + } + } + } + } +} diff --git a/lib/test/esprima/declaration/function/migrated_0008.js b/lib/test/esprima/declaration/function/migrated_0008.js new file mode 100644 index 0000000..93adf3f --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0008.js @@ -0,0 +1 @@ +var hi = function() { sayHi() }; \ No newline at end of file diff --git a/lib/test/esprima/declaration/function/migrated_0008.tree.json b/lib/test/esprima/declaration/function/migrated_0008.tree.json new file mode 100644 index 0000000..01266ba --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0008.tree.json @@ -0,0 +1,386 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "hi", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "init": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "sayHi", + "range": [ + 22, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "arguments": [], + "range": [ + 22, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 30 + } + } + } + ], + "range": [ + 20, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 9, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "range": [ + 4, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "hi", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 9, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "sayHi", + "range": [ + 22, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ], + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + } +} diff --git a/lib/test/esprima/declaration/function/migrated_0009.js b/lib/test/esprima/declaration/function/migrated_0009.js new file mode 100644 index 0000000..f1f907e --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0009.js @@ -0,0 +1 @@ +var hi = function eval() { }; \ No newline at end of file diff --git a/lib/test/esprima/declaration/function/migrated_0009.tree.json b/lib/test/esprima/declaration/function/migrated_0009.tree.json new file mode 100644 index 0000000..ce700bd --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0009.tree.json @@ -0,0 +1,313 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "hi", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "init": { + "type": "FunctionExpression", + "id": { + "type": "Identifier", + "name": "eval", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 25, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 9, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "range": [ + 4, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "hi", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 9, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "eval", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } +} diff --git a/lib/test/esprima/declaration/function/migrated_0010.js b/lib/test/esprima/declaration/function/migrated_0010.js new file mode 100644 index 0000000..4f643b1 --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0010.js @@ -0,0 +1 @@ +var hi = function arguments() { }; \ No newline at end of file diff --git a/lib/test/esprima/declaration/function/migrated_0010.tree.json b/lib/test/esprima/declaration/function/migrated_0010.tree.json new file mode 100644 index 0000000..f9ea3ce --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0010.tree.json @@ -0,0 +1,313 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "hi", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "init": { + "type": "FunctionExpression", + "id": { + "type": "Identifier", + "name": "arguments", + "range": [ + 18, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 30, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 9, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "range": [ + 4, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "hi", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 9, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "arguments", + "range": [ + 18, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } +} diff --git a/lib/test/esprima/declaration/function/migrated_0011.diff b/lib/test/esprima/declaration/function/migrated_0011.diff new file mode 100644 index 0000000..f41aea7 --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0011.diff @@ -0,0 +1,20 @@ +{ + 'body': { + '0': { + 'declarations': { + '0': { + 'init': { + 'body': { + 'body': { + '0': { + 'range': { '1': 35 }, + 'loc': { 'end': { 'column': 35 }} + } + } + } + } + } + } + } + } +} diff --git a/lib/test/esprima/declaration/function/migrated_0011.js b/lib/test/esprima/declaration/function/migrated_0011.js new file mode 100644 index 0000000..a531f59 --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0011.js @@ -0,0 +1 @@ +var hello = function hi() { sayHi() }; \ No newline at end of file diff --git a/lib/test/esprima/declaration/function/migrated_0011.tree.json b/lib/test/esprima/declaration/function/migrated_0011.tree.json new file mode 100644 index 0000000..17f1027 --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0011.tree.json @@ -0,0 +1,421 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "hello", + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "init": { + "type": "FunctionExpression", + "id": { + "type": "Identifier", + "name": "hi", + "range": [ + 21, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "sayHi", + "range": [ + 28, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "arguments": [], + "range": [ + 28, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + "range": [ + 28, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "range": [ + 26, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 12, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + "range": [ + 4, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "hello", + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 12, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "hi", + "range": [ + 21, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Identifier", + "value": "sayHi", + "range": [ + 28, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + ], + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } +} diff --git a/lib/test/esprima/declaration/function/migrated_0012.js b/lib/test/esprima/declaration/function/migrated_0012.js new file mode 100644 index 0000000..4c206a3 --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0012.js @@ -0,0 +1 @@ +(function(){}) \ No newline at end of file diff --git a/lib/test/esprima/declaration/function/migrated_0012.tree.json b/lib/test/esprima/declaration/function/migrated_0012.tree.json new file mode 100644 index 0000000..bd16643 --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0012.tree.json @@ -0,0 +1,204 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 1, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } +} diff --git a/lib/test/esprima/declaration/function/migrated_0013.js b/lib/test/esprima/declaration/function/migrated_0013.js new file mode 100644 index 0000000..22c48c4 --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0013.js @@ -0,0 +1 @@ +function universe(__proto__) { } \ No newline at end of file diff --git a/lib/test/esprima/declaration/function/migrated_0013.tree.json b/lib/test/esprima/declaration/function/migrated_0013.tree.json new file mode 100644 index 0000000..240a814 --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0013.tree.json @@ -0,0 +1,223 @@ +{ + "type": "Program", + "body": [ + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "universe", + "range": [ + 9, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "__proto__", + "range": [ + 18, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 29, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "universe", + "range": [ + 9, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "__proto__", + "range": [ + 18, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ], + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + } +} diff --git a/lib/test/esprima/declaration/function/migrated_0014.js b/lib/test/esprima/declaration/function/migrated_0014.js new file mode 100644 index 0000000..3ed40a4 --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0014.js @@ -0,0 +1 @@ +function test() { "use strict" + 42; } \ No newline at end of file diff --git a/lib/test/esprima/declaration/function/migrated_0014.tree.json b/lib/test/esprima/declaration/function/migrated_0014.tree.json new file mode 100644 index 0000000..418d86d --- /dev/null +++ b/lib/test/esprima/declaration/function/migrated_0014.tree.json @@ -0,0 +1,332 @@ +{ + "type": "Program", + "body": [ + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "test", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 18, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 33, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + "range": [ + 18, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + "range": [ + 18, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "range": [ + 16, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "test", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 18, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 33, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + ], + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } +} diff --git a/lib/test/esprima/declaration/let/migrated_0000.js b/lib/test/esprima/declaration/let/migrated_0000.js new file mode 100644 index 0000000..4ebc2e5 --- /dev/null +++ b/lib/test/esprima/declaration/let/migrated_0000.js @@ -0,0 +1 @@ +let x \ No newline at end of file diff --git a/lib/test/esprima/declaration/let/migrated_0000.tree.json b/lib/test/esprima/declaration/let/migrated_0000.tree.json new file mode 100644 index 0000000..96f0817 --- /dev/null +++ b/lib/test/esprima/declaration/let/migrated_0000.tree.json @@ -0,0 +1,114 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": null, + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "kind": "let", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "let", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } +} diff --git a/lib/test/esprima/declaration/let/migrated_0001.diff b/lib/test/esprima/declaration/let/migrated_0001.diff new file mode 100644 index 0000000..e90fd64 --- /dev/null +++ b/lib/test/esprima/declaration/let/migrated_0001.diff @@ -0,0 +1,12 @@ +{ + 'body': { + '0': { + 'body': { + '0': { + 'range': { '1': 7 }, + 'loc': { 'end': { 'column': 7 }} + } + } + } + } +} diff --git a/lib/test/esprima/declaration/let/migrated_0001.js b/lib/test/esprima/declaration/let/migrated_0001.js new file mode 100644 index 0000000..7fc703d --- /dev/null +++ b/lib/test/esprima/declaration/let/migrated_0001.js @@ -0,0 +1 @@ +{ let x } \ No newline at end of file diff --git a/lib/test/esprima/declaration/let/migrated_0001.tree.json b/lib/test/esprima/declaration/let/migrated_0001.tree.json new file mode 100644 index 0000000..f2a058d --- /dev/null +++ b/lib/test/esprima/declaration/let/migrated_0001.tree.json @@ -0,0 +1,169 @@ +{ + "type": "Program", + "body": [ + { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "init": null, + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "kind": "let", + "range": [ + 2, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "{", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 2, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } +} diff --git a/lib/test/esprima/declaration/let/migrated_0002.diff b/lib/test/esprima/declaration/let/migrated_0002.diff new file mode 100644 index 0000000..c2b01a8 --- /dev/null +++ b/lib/test/esprima/declaration/let/migrated_0002.diff @@ -0,0 +1,12 @@ +{ + 'body': { + '0': { + 'body': { + '0': { + 'range': { '1': 12 }, + 'loc': { 'end': { 'column': 12 }} + } + } + } + } +} diff --git a/lib/test/esprima/declaration/let/migrated_0002.js b/lib/test/esprima/declaration/let/migrated_0002.js new file mode 100644 index 0000000..61e073f --- /dev/null +++ b/lib/test/esprima/declaration/let/migrated_0002.js @@ -0,0 +1 @@ +{ let x = 42 } \ No newline at end of file diff --git a/lib/test/esprima/declaration/let/migrated_0002.tree.json b/lib/test/esprima/declaration/let/migrated_0002.tree.json new file mode 100644 index 0000000..4d659ab --- /dev/null +++ b/lib/test/esprima/declaration/let/migrated_0002.tree.json @@ -0,0 +1,223 @@ +{ + "type": "Program", + "body": [ + { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "init": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 6, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "kind": "let", + "range": [ + 2, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "{", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 2, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } +} diff --git a/lib/test/esprima/declaration/let/migrated_0003.diff b/lib/test/esprima/declaration/let/migrated_0003.diff new file mode 100644 index 0000000..42208a2 --- /dev/null +++ b/lib/test/esprima/declaration/let/migrated_0003.diff @@ -0,0 +1,12 @@ +{ + 'body': { + '0': { + 'body': { + '0': { + 'range': { '1': 29 }, + 'loc': { 'end': { 'column': 29 }} + } + } + } + } +} diff --git a/lib/test/esprima/declaration/let/migrated_0003.js b/lib/test/esprima/declaration/let/migrated_0003.js new file mode 100644 index 0000000..1747134 --- /dev/null +++ b/lib/test/esprima/declaration/let/migrated_0003.js @@ -0,0 +1 @@ +{ let x = 14, y = 3, z = 1977 } \ No newline at end of file diff --git a/lib/test/esprima/declaration/let/migrated_0003.tree.json b/lib/test/esprima/declaration/let/migrated_0003.tree.json new file mode 100644 index 0000000..b0f590c --- /dev/null +++ b/lib/test/esprima/declaration/let/migrated_0003.tree.json @@ -0,0 +1,475 @@ +{ + "type": "Program", + "body": [ + { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "init": { + "type": "Literal", + "value": 14, + "raw": "14", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 6, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "y", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "init": { + "type": "Literal", + "value": 3, + "raw": "3", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "z", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "init": { + "type": "Literal", + "value": 1977, + "raw": "1977", + "range": [ + 25, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "range": [ + 21, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "kind": "let", + "range": [ + 2, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 30 + } + } + } + ], + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "{", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 2, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Numeric", + "value": "14", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Numeric", + "value": "3", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Numeric", + "value": "1977", + "range": [ + 25, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } +} diff --git a/lib/test/esprima/directive-prolog/migrated_0000.js b/lib/test/esprima/directive-prolog/migrated_0000.js new file mode 100644 index 0000000..e7d9694 --- /dev/null +++ b/lib/test/esprima/directive-prolog/migrated_0000.js @@ -0,0 +1 @@ +(function () { 'use\x20strict'; with (i); }()) \ No newline at end of file diff --git a/lib/test/esprima/directive-prolog/migrated_0000.tree.json b/lib/test/esprima/directive-prolog/migrated_0000.tree.json new file mode 100644 index 0000000..9dd313d --- /dev/null +++ b/lib/test/esprima/directive-prolog/migrated_0000.tree.json @@ -0,0 +1,474 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "'use\\x20strict'", + "range": [ + 15, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "directive": "use\\x20strict", + "range": [ + 15, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "WithStatement", + "object": { + "type": "Identifier", + "name": "i", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + "body": { + "type": "EmptyStatement", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "range": [ + 32, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 41 + } + } + } + ], + "range": [ + 13, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 1, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + "arguments": [], + "range": [ + 1, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + "range": [ + 0, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "String", + "value": "'use\\x20strict'", + "range": [ + 15, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Keyword", + "value": "with", + "range": [ + 32, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Identifier", + "value": "i", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 46 + } + } + } + ], + "range": [ + 0, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + } +} diff --git a/lib/test/esprima/directive-prolog/migrated_0001.js b/lib/test/esprima/directive-prolog/migrated_0001.js new file mode 100644 index 0000000..df34629 --- /dev/null +++ b/lib/test/esprima/directive-prolog/migrated_0001.js @@ -0,0 +1 @@ +(function () { 'use\nstrict'; with (i); }()) \ No newline at end of file diff --git a/lib/test/esprima/directive-prolog/migrated_0001.tree.json b/lib/test/esprima/directive-prolog/migrated_0001.tree.json new file mode 100644 index 0000000..baa5415 --- /dev/null +++ b/lib/test/esprima/directive-prolog/migrated_0001.tree.json @@ -0,0 +1,474 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use\nstrict", + "raw": "'use\\nstrict'", + "range": [ + 15, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "directive": "use\\nstrict", + "range": [ + 15, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "WithStatement", + "object": { + "type": "Identifier", + "name": "i", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + "body": { + "type": "EmptyStatement", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + "range": [ + 30, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 39 + } + } + } + ], + "range": [ + 13, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 1, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "arguments": [], + "range": [ + 1, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + "range": [ + 0, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "String", + "value": "'use\\nstrict'", + "range": [ + 15, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Keyword", + "value": "with", + "range": [ + 30, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Identifier", + "value": "i", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 44 + } + } + } + ], + "range": [ + 0, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + } +} diff --git a/lib/test/esprima/expression/additive/migrated_0000.js b/lib/test/esprima/expression/additive/migrated_0000.js new file mode 100644 index 0000000..f96f157 --- /dev/null +++ b/lib/test/esprima/expression/additive/migrated_0000.js @@ -0,0 +1 @@ +x + y \ No newline at end of file diff --git a/lib/test/esprima/expression/additive/migrated_0000.tree.json b/lib/test/esprima/expression/additive/migrated_0000.tree.json new file mode 100644 index 0000000..29b6a97 --- /dev/null +++ b/lib/test/esprima/expression/additive/migrated_0000.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } +} diff --git a/lib/test/esprima/expression/additive/migrated_0001.js b/lib/test/esprima/expression/additive/migrated_0001.js new file mode 100644 index 0000000..2285ac2 --- /dev/null +++ b/lib/test/esprima/expression/additive/migrated_0001.js @@ -0,0 +1 @@ +x - y \ No newline at end of file diff --git a/lib/test/esprima/expression/additive/migrated_0001.tree.json b/lib/test/esprima/expression/additive/migrated_0001.tree.json new file mode 100644 index 0000000..50acd21 --- /dev/null +++ b/lib/test/esprima/expression/additive/migrated_0001.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "-", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "-", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } +} diff --git a/lib/test/esprima/expression/additive/migrated_0002.js b/lib/test/esprima/expression/additive/migrated_0002.js new file mode 100644 index 0000000..2a5470c --- /dev/null +++ b/lib/test/esprima/expression/additive/migrated_0002.js @@ -0,0 +1 @@ +"use strict" + 42 \ No newline at end of file diff --git a/lib/test/esprima/expression/additive/migrated_0002.tree.json b/lib/test/esprima/expression/additive/migrated_0002.tree.json new file mode 100644 index 0000000..0517d1f --- /dev/null +++ b/lib/test/esprima/expression/additive/migrated_0002.tree.json @@ -0,0 +1,149 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } +} diff --git a/lib/test/esprima/expression/assignment/migrated_0000.js b/lib/test/esprima/expression/assignment/migrated_0000.js new file mode 100644 index 0000000..4452ec6 --- /dev/null +++ b/lib/test/esprima/expression/assignment/migrated_0000.js @@ -0,0 +1 @@ +x = 42 \ No newline at end of file diff --git a/lib/test/esprima/expression/assignment/migrated_0000.tree.json b/lib/test/esprima/expression/assignment/migrated_0000.tree.json new file mode 100644 index 0000000..5c121d9 --- /dev/null +++ b/lib/test/esprima/expression/assignment/migrated_0000.tree.json @@ -0,0 +1,148 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } +} diff --git a/lib/test/esprima/expression/assignment/migrated_0001.js b/lib/test/esprima/expression/assignment/migrated_0001.js new file mode 100644 index 0000000..d1e8c38 --- /dev/null +++ b/lib/test/esprima/expression/assignment/migrated_0001.js @@ -0,0 +1 @@ +eval = 42 \ No newline at end of file diff --git a/lib/test/esprima/expression/assignment/migrated_0001.tree.json b/lib/test/esprima/expression/assignment/migrated_0001.tree.json new file mode 100644 index 0000000..95e0baa --- /dev/null +++ b/lib/test/esprima/expression/assignment/migrated_0001.tree.json @@ -0,0 +1,148 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "eval", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "eval", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } +} diff --git a/lib/test/esprima/expression/assignment/migrated_0002.js b/lib/test/esprima/expression/assignment/migrated_0002.js new file mode 100644 index 0000000..dde1683 --- /dev/null +++ b/lib/test/esprima/expression/assignment/migrated_0002.js @@ -0,0 +1 @@ +arguments = 42 \ No newline at end of file diff --git a/lib/test/esprima/expression/assignment/migrated_0002.tree.json b/lib/test/esprima/expression/assignment/migrated_0002.tree.json new file mode 100644 index 0000000..377cc8f --- /dev/null +++ b/lib/test/esprima/expression/assignment/migrated_0002.tree.json @@ -0,0 +1,148 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "arguments", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "arguments", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } +} diff --git a/lib/test/esprima/expression/assignment/migrated_0003.js b/lib/test/esprima/expression/assignment/migrated_0003.js new file mode 100644 index 0000000..9addd71 --- /dev/null +++ b/lib/test/esprima/expression/assignment/migrated_0003.js @@ -0,0 +1 @@ +x *= 42 \ No newline at end of file diff --git a/lib/test/esprima/expression/assignment/migrated_0003.tree.json b/lib/test/esprima/expression/assignment/migrated_0003.tree.json new file mode 100644 index 0000000..bd3b563 --- /dev/null +++ b/lib/test/esprima/expression/assignment/migrated_0003.tree.json @@ -0,0 +1,148 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "*=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "*=", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } +} diff --git a/lib/test/esprima/expression/assignment/migrated_0004.js b/lib/test/esprima/expression/assignment/migrated_0004.js new file mode 100644 index 0000000..23b2b58 --- /dev/null +++ b/lib/test/esprima/expression/assignment/migrated_0004.js @@ -0,0 +1 @@ +x /= 42 \ No newline at end of file diff --git a/lib/test/esprima/expression/assignment/migrated_0004.tree.json b/lib/test/esprima/expression/assignment/migrated_0004.tree.json new file mode 100644 index 0000000..9218143 --- /dev/null +++ b/lib/test/esprima/expression/assignment/migrated_0004.tree.json @@ -0,0 +1,148 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "/=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/=", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } +} diff --git a/lib/test/esprima/expression/assignment/migrated_0005.js b/lib/test/esprima/expression/assignment/migrated_0005.js new file mode 100644 index 0000000..c4d5c9e --- /dev/null +++ b/lib/test/esprima/expression/assignment/migrated_0005.js @@ -0,0 +1 @@ +x %= 42 \ No newline at end of file diff --git a/lib/test/esprima/expression/assignment/migrated_0005.tree.json b/lib/test/esprima/expression/assignment/migrated_0005.tree.json new file mode 100644 index 0000000..8e49c92 --- /dev/null +++ b/lib/test/esprima/expression/assignment/migrated_0005.tree.json @@ -0,0 +1,148 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "%=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "%=", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } +} diff --git a/lib/test/esprima/expression/assignment/migrated_0006.js b/lib/test/esprima/expression/assignment/migrated_0006.js new file mode 100644 index 0000000..217b625 --- /dev/null +++ b/lib/test/esprima/expression/assignment/migrated_0006.js @@ -0,0 +1 @@ +x += 42 \ No newline at end of file diff --git a/lib/test/esprima/expression/assignment/migrated_0006.tree.json b/lib/test/esprima/expression/assignment/migrated_0006.tree.json new file mode 100644 index 0000000..20951f0 --- /dev/null +++ b/lib/test/esprima/expression/assignment/migrated_0006.tree.json @@ -0,0 +1,148 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "+=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "+=", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } +} diff --git a/lib/test/esprima/expression/assignment/migrated_0007.js b/lib/test/esprima/expression/assignment/migrated_0007.js new file mode 100644 index 0000000..d79ce34 --- /dev/null +++ b/lib/test/esprima/expression/assignment/migrated_0007.js @@ -0,0 +1 @@ +x -= 42 \ No newline at end of file diff --git a/lib/test/esprima/expression/assignment/migrated_0007.tree.json b/lib/test/esprima/expression/assignment/migrated_0007.tree.json new file mode 100644 index 0000000..9d899e4 --- /dev/null +++ b/lib/test/esprima/expression/assignment/migrated_0007.tree.json @@ -0,0 +1,148 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "-=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "-=", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } +} diff --git a/lib/test/esprima/expression/assignment/migrated_0008.js b/lib/test/esprima/expression/assignment/migrated_0008.js new file mode 100644 index 0000000..5ad52f7 --- /dev/null +++ b/lib/test/esprima/expression/assignment/migrated_0008.js @@ -0,0 +1 @@ +x <<= 42 \ No newline at end of file diff --git a/lib/test/esprima/expression/assignment/migrated_0008.tree.json b/lib/test/esprima/expression/assignment/migrated_0008.tree.json new file mode 100644 index 0000000..afe4b28 --- /dev/null +++ b/lib/test/esprima/expression/assignment/migrated_0008.tree.json @@ -0,0 +1,148 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "<<=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<<=", + "range": [ + 2, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } +} diff --git a/lib/test/esprima/expression/assignment/migrated_0009.js b/lib/test/esprima/expression/assignment/migrated_0009.js new file mode 100644 index 0000000..80af4fd --- /dev/null +++ b/lib/test/esprima/expression/assignment/migrated_0009.js @@ -0,0 +1 @@ +x >>= 42 \ No newline at end of file diff --git a/lib/test/esprima/expression/assignment/migrated_0009.tree.json b/lib/test/esprima/expression/assignment/migrated_0009.tree.json new file mode 100644 index 0000000..c14d382 --- /dev/null +++ b/lib/test/esprima/expression/assignment/migrated_0009.tree.json @@ -0,0 +1,148 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": ">>=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": ">>=", + "range": [ + 2, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } +} diff --git a/lib/test/esprima/expression/assignment/migrated_0010.js b/lib/test/esprima/expression/assignment/migrated_0010.js new file mode 100644 index 0000000..c8b561c --- /dev/null +++ b/lib/test/esprima/expression/assignment/migrated_0010.js @@ -0,0 +1 @@ +x >>>= 42 \ No newline at end of file diff --git a/lib/test/esprima/expression/assignment/migrated_0010.tree.json b/lib/test/esprima/expression/assignment/migrated_0010.tree.json new file mode 100644 index 0000000..97636eb --- /dev/null +++ b/lib/test/esprima/expression/assignment/migrated_0010.tree.json @@ -0,0 +1,148 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": ">>>=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": ">>>=", + "range": [ + 2, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } +} diff --git a/lib/test/esprima/expression/assignment/migrated_0011.js b/lib/test/esprima/expression/assignment/migrated_0011.js new file mode 100644 index 0000000..98b2f54 --- /dev/null +++ b/lib/test/esprima/expression/assignment/migrated_0011.js @@ -0,0 +1 @@ +x &= 42 \ No newline at end of file diff --git a/lib/test/esprima/expression/assignment/migrated_0011.tree.json b/lib/test/esprima/expression/assignment/migrated_0011.tree.json new file mode 100644 index 0000000..b2c2288 --- /dev/null +++ b/lib/test/esprima/expression/assignment/migrated_0011.tree.json @@ -0,0 +1,148 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "&=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "&=", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } +} diff --git a/lib/test/esprima/expression/assignment/migrated_0012.js b/lib/test/esprima/expression/assignment/migrated_0012.js new file mode 100644 index 0000000..f2c536b --- /dev/null +++ b/lib/test/esprima/expression/assignment/migrated_0012.js @@ -0,0 +1 @@ +x ^= 42 \ No newline at end of file diff --git a/lib/test/esprima/expression/assignment/migrated_0012.tree.json b/lib/test/esprima/expression/assignment/migrated_0012.tree.json new file mode 100644 index 0000000..fff7571 --- /dev/null +++ b/lib/test/esprima/expression/assignment/migrated_0012.tree.json @@ -0,0 +1,148 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "^=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "^=", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } +} diff --git a/lib/test/esprima/expression/assignment/migrated_0013.js b/lib/test/esprima/expression/assignment/migrated_0013.js new file mode 100644 index 0000000..af7ab3b --- /dev/null +++ b/lib/test/esprima/expression/assignment/migrated_0013.js @@ -0,0 +1 @@ +x |= 42 \ No newline at end of file diff --git a/lib/test/esprima/expression/assignment/migrated_0013.tree.json b/lib/test/esprima/expression/assignment/migrated_0013.tree.json new file mode 100644 index 0000000..9dd043c --- /dev/null +++ b/lib/test/esprima/expression/assignment/migrated_0013.tree.json @@ -0,0 +1,148 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "|=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "|=", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } +} diff --git a/lib/test/esprima/expression/binary-bitwise/migrated_0000.js b/lib/test/esprima/expression/binary-bitwise/migrated_0000.js new file mode 100644 index 0000000..90b80fa --- /dev/null +++ b/lib/test/esprima/expression/binary-bitwise/migrated_0000.js @@ -0,0 +1 @@ +x & y \ No newline at end of file diff --git a/lib/test/esprima/expression/binary-bitwise/migrated_0000.tree.json b/lib/test/esprima/expression/binary-bitwise/migrated_0000.tree.json new file mode 100644 index 0000000..61f8714 --- /dev/null +++ b/lib/test/esprima/expression/binary-bitwise/migrated_0000.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "&", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "&", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } +} diff --git a/lib/test/esprima/expression/binary-bitwise/migrated_0001.js b/lib/test/esprima/expression/binary-bitwise/migrated_0001.js new file mode 100644 index 0000000..e4579f0 --- /dev/null +++ b/lib/test/esprima/expression/binary-bitwise/migrated_0001.js @@ -0,0 +1 @@ +x ^ y \ No newline at end of file diff --git a/lib/test/esprima/expression/binary-bitwise/migrated_0001.tree.json b/lib/test/esprima/expression/binary-bitwise/migrated_0001.tree.json new file mode 100644 index 0000000..0bc3d55 --- /dev/null +++ b/lib/test/esprima/expression/binary-bitwise/migrated_0001.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "^", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "^", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } +} diff --git a/lib/test/esprima/expression/binary-bitwise/migrated_0002.js b/lib/test/esprima/expression/binary-bitwise/migrated_0002.js new file mode 100644 index 0000000..0bf2abb --- /dev/null +++ b/lib/test/esprima/expression/binary-bitwise/migrated_0002.js @@ -0,0 +1 @@ +x | y \ No newline at end of file diff --git a/lib/test/esprima/expression/binary-bitwise/migrated_0002.tree.json b/lib/test/esprima/expression/binary-bitwise/migrated_0002.tree.json new file mode 100644 index 0000000..dc765cc --- /dev/null +++ b/lib/test/esprima/expression/binary-bitwise/migrated_0002.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "|", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "|", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } +} diff --git a/lib/test/esprima/expression/binary-logical/migrated_0000.js b/lib/test/esprima/expression/binary-logical/migrated_0000.js new file mode 100644 index 0000000..a8ade45 --- /dev/null +++ b/lib/test/esprima/expression/binary-logical/migrated_0000.js @@ -0,0 +1 @@ +x || y \ No newline at end of file diff --git a/lib/test/esprima/expression/binary-logical/migrated_0000.tree.json b/lib/test/esprima/expression/binary-logical/migrated_0000.tree.json new file mode 100644 index 0000000..cf69b32 --- /dev/null +++ b/lib/test/esprima/expression/binary-logical/migrated_0000.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "LogicalExpression", + "operator": "||", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "||", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } +} diff --git a/lib/test/esprima/expression/binary-logical/migrated_0001.js b/lib/test/esprima/expression/binary-logical/migrated_0001.js new file mode 100644 index 0000000..ffe862c --- /dev/null +++ b/lib/test/esprima/expression/binary-logical/migrated_0001.js @@ -0,0 +1 @@ +x && y \ No newline at end of file diff --git a/lib/test/esprima/expression/binary-logical/migrated_0001.tree.json b/lib/test/esprima/expression/binary-logical/migrated_0001.tree.json new file mode 100644 index 0000000..bcda7df --- /dev/null +++ b/lib/test/esprima/expression/binary-logical/migrated_0001.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "&&", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } +} diff --git a/lib/test/esprima/expression/binary-logical/migrated_0002.js b/lib/test/esprima/expression/binary-logical/migrated_0002.js new file mode 100644 index 0000000..2b9f0bc --- /dev/null +++ b/lib/test/esprima/expression/binary-logical/migrated_0002.js @@ -0,0 +1 @@ +x || y || z \ No newline at end of file diff --git a/lib/test/esprima/expression/binary-logical/migrated_0002.tree.json b/lib/test/esprima/expression/binary-logical/migrated_0002.tree.json new file mode 100644 index 0000000..ecc21b5 --- /dev/null +++ b/lib/test/esprima/expression/binary-logical/migrated_0002.tree.json @@ -0,0 +1,219 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "LogicalExpression", + "operator": "||", + "left": { + "type": "LogicalExpression", + "operator": "||", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "||", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "||", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } +} diff --git a/lib/test/esprima/expression/binary-logical/migrated_0003.js b/lib/test/esprima/expression/binary-logical/migrated_0003.js new file mode 100644 index 0000000..e0346bb --- /dev/null +++ b/lib/test/esprima/expression/binary-logical/migrated_0003.js @@ -0,0 +1 @@ +x && y && z \ No newline at end of file diff --git a/lib/test/esprima/expression/binary-logical/migrated_0003.tree.json b/lib/test/esprima/expression/binary-logical/migrated_0003.tree.json new file mode 100644 index 0000000..6027ce1 --- /dev/null +++ b/lib/test/esprima/expression/binary-logical/migrated_0003.tree.json @@ -0,0 +1,219 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "&&", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "&&", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } +} diff --git a/lib/test/esprima/expression/binary-logical/migrated_0004.js b/lib/test/esprima/expression/binary-logical/migrated_0004.js new file mode 100644 index 0000000..b76f785 --- /dev/null +++ b/lib/test/esprima/expression/binary-logical/migrated_0004.js @@ -0,0 +1 @@ +x || y && z \ No newline at end of file diff --git a/lib/test/esprima/expression/binary-logical/migrated_0004.tree.json b/lib/test/esprima/expression/binary-logical/migrated_0004.tree.json new file mode 100644 index 0000000..8e034ef --- /dev/null +++ b/lib/test/esprima/expression/binary-logical/migrated_0004.tree.json @@ -0,0 +1,219 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "LogicalExpression", + "operator": "||", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 5, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "||", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "&&", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } +} diff --git a/lib/test/esprima/expression/binary-logical/migrated_0005.js b/lib/test/esprima/expression/binary-logical/migrated_0005.js new file mode 100644 index 0000000..5e12a04 --- /dev/null +++ b/lib/test/esprima/expression/binary-logical/migrated_0005.js @@ -0,0 +1 @@ +x || y ^ z \ No newline at end of file diff --git a/lib/test/esprima/expression/binary-logical/migrated_0005.tree.json b/lib/test/esprima/expression/binary-logical/migrated_0005.tree.json new file mode 100644 index 0000000..c0d3a9f --- /dev/null +++ b/lib/test/esprima/expression/binary-logical/migrated_0005.tree.json @@ -0,0 +1,219 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "LogicalExpression", + "operator": "||", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "^", + "left": { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 5, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "||", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "^", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } +} diff --git a/lib/test/esprima/expression/binary/migrated_0000.js b/lib/test/esprima/expression/binary/migrated_0000.js new file mode 100644 index 0000000..0432349 --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0000.js @@ -0,0 +1 @@ +x + y + z \ No newline at end of file diff --git a/lib/test/esprima/expression/binary/migrated_0000.tree.json b/lib/test/esprima/expression/binary/migrated_0000.tree.json new file mode 100644 index 0000000..9320543 --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0000.tree.json @@ -0,0 +1,219 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } +} diff --git a/lib/test/esprima/expression/binary/migrated_0001.js b/lib/test/esprima/expression/binary/migrated_0001.js new file mode 100644 index 0000000..e5b7880 --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0001.js @@ -0,0 +1 @@ +x - y + z \ No newline at end of file diff --git a/lib/test/esprima/expression/binary/migrated_0001.tree.json b/lib/test/esprima/expression/binary/migrated_0001.tree.json new file mode 100644 index 0000000..c27b39a --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0001.tree.json @@ -0,0 +1,219 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "BinaryExpression", + "operator": "-", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "-", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } +} diff --git a/lib/test/esprima/expression/binary/migrated_0002.js b/lib/test/esprima/expression/binary/migrated_0002.js new file mode 100644 index 0000000..55b4239 --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0002.js @@ -0,0 +1 @@ +x + y - z \ No newline at end of file diff --git a/lib/test/esprima/expression/binary/migrated_0002.tree.json b/lib/test/esprima/expression/binary/migrated_0002.tree.json new file mode 100644 index 0000000..8a9facc --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0002.tree.json @@ -0,0 +1,219 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "-", + "left": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "-", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } +} diff --git a/lib/test/esprima/expression/binary/migrated_0003.js b/lib/test/esprima/expression/binary/migrated_0003.js new file mode 100644 index 0000000..19e84aa --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0003.js @@ -0,0 +1 @@ +x - y - z \ No newline at end of file diff --git a/lib/test/esprima/expression/binary/migrated_0003.tree.json b/lib/test/esprima/expression/binary/migrated_0003.tree.json new file mode 100644 index 0000000..2d4e634 --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0003.tree.json @@ -0,0 +1,219 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "-", + "left": { + "type": "BinaryExpression", + "operator": "-", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "-", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "-", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } +} diff --git a/lib/test/esprima/expression/binary/migrated_0004.js b/lib/test/esprima/expression/binary/migrated_0004.js new file mode 100644 index 0000000..a251877 --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0004.js @@ -0,0 +1 @@ +x + y * z \ No newline at end of file diff --git a/lib/test/esprima/expression/binary/migrated_0004.tree.json b/lib/test/esprima/expression/binary/migrated_0004.tree.json new file mode 100644 index 0000000..1038e24 --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0004.tree.json @@ -0,0 +1,219 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "*", + "left": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } +} diff --git a/lib/test/esprima/expression/binary/migrated_0005.js b/lib/test/esprima/expression/binary/migrated_0005.js new file mode 100644 index 0000000..b1858db --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0005.js @@ -0,0 +1 @@ +x + y / z \ No newline at end of file diff --git a/lib/test/esprima/expression/binary/migrated_0005.tree.json b/lib/test/esprima/expression/binary/migrated_0005.tree.json new file mode 100644 index 0000000..a5d55a8 --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0005.tree.json @@ -0,0 +1,219 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "/", + "left": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } +} diff --git a/lib/test/esprima/expression/binary/migrated_0006.js b/lib/test/esprima/expression/binary/migrated_0006.js new file mode 100644 index 0000000..a665a0c --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0006.js @@ -0,0 +1 @@ +x - y % z \ No newline at end of file diff --git a/lib/test/esprima/expression/binary/migrated_0006.tree.json b/lib/test/esprima/expression/binary/migrated_0006.tree.json new file mode 100644 index 0000000..79ae0d0 --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0006.tree.json @@ -0,0 +1,219 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "-", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "%", + "left": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "-", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "%", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } +} diff --git a/lib/test/esprima/expression/binary/migrated_0007.js b/lib/test/esprima/expression/binary/migrated_0007.js new file mode 100644 index 0000000..7200a89 --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0007.js @@ -0,0 +1 @@ +x * y * z \ No newline at end of file diff --git a/lib/test/esprima/expression/binary/migrated_0007.tree.json b/lib/test/esprima/expression/binary/migrated_0007.tree.json new file mode 100644 index 0000000..0929e3d --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0007.tree.json @@ -0,0 +1,219 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "*", + "left": { + "type": "BinaryExpression", + "operator": "*", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } +} diff --git a/lib/test/esprima/expression/binary/migrated_0008.js b/lib/test/esprima/expression/binary/migrated_0008.js new file mode 100644 index 0000000..a55d62b --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0008.js @@ -0,0 +1 @@ +x * y / z \ No newline at end of file diff --git a/lib/test/esprima/expression/binary/migrated_0008.tree.json b/lib/test/esprima/expression/binary/migrated_0008.tree.json new file mode 100644 index 0000000..d00b385 --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0008.tree.json @@ -0,0 +1,219 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "/", + "left": { + "type": "BinaryExpression", + "operator": "*", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } +} diff --git a/lib/test/esprima/expression/binary/migrated_0009.js b/lib/test/esprima/expression/binary/migrated_0009.js new file mode 100644 index 0000000..50a532b --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0009.js @@ -0,0 +1 @@ +x * y % z \ No newline at end of file diff --git a/lib/test/esprima/expression/binary/migrated_0009.tree.json b/lib/test/esprima/expression/binary/migrated_0009.tree.json new file mode 100644 index 0000000..980c876 --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0009.tree.json @@ -0,0 +1,219 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "%", + "left": { + "type": "BinaryExpression", + "operator": "*", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "%", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } +} diff --git a/lib/test/esprima/expression/binary/migrated_0010.js b/lib/test/esprima/expression/binary/migrated_0010.js new file mode 100644 index 0000000..5d25d99 --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0010.js @@ -0,0 +1 @@ +x % y * z \ No newline at end of file diff --git a/lib/test/esprima/expression/binary/migrated_0010.tree.json b/lib/test/esprima/expression/binary/migrated_0010.tree.json new file mode 100644 index 0000000..40618bc --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0010.tree.json @@ -0,0 +1,219 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "*", + "left": { + "type": "BinaryExpression", + "operator": "%", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "%", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } +} diff --git a/lib/test/esprima/expression/binary/migrated_0011.js b/lib/test/esprima/expression/binary/migrated_0011.js new file mode 100644 index 0000000..06c766c --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0011.js @@ -0,0 +1 @@ +x << y << z \ No newline at end of file diff --git a/lib/test/esprima/expression/binary/migrated_0011.tree.json b/lib/test/esprima/expression/binary/migrated_0011.tree.json new file mode 100644 index 0000000..5caf5d7 --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0011.tree.json @@ -0,0 +1,219 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "<<", + "left": { + "type": "BinaryExpression", + "operator": "<<", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<<", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "<<", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } +} diff --git a/lib/test/esprima/expression/binary/migrated_0012.js b/lib/test/esprima/expression/binary/migrated_0012.js new file mode 100644 index 0000000..d58330b --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0012.js @@ -0,0 +1 @@ +x | y | z \ No newline at end of file diff --git a/lib/test/esprima/expression/binary/migrated_0012.tree.json b/lib/test/esprima/expression/binary/migrated_0012.tree.json new file mode 100644 index 0000000..bc0b44a --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0012.tree.json @@ -0,0 +1,219 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "|", + "left": { + "type": "BinaryExpression", + "operator": "|", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "|", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "|", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } +} diff --git a/lib/test/esprima/expression/binary/migrated_0013.js b/lib/test/esprima/expression/binary/migrated_0013.js new file mode 100644 index 0000000..bab523a --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0013.js @@ -0,0 +1 @@ +x & y & z \ No newline at end of file diff --git a/lib/test/esprima/expression/binary/migrated_0013.tree.json b/lib/test/esprima/expression/binary/migrated_0013.tree.json new file mode 100644 index 0000000..49baa69 --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0013.tree.json @@ -0,0 +1,219 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "&", + "left": { + "type": "BinaryExpression", + "operator": "&", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "&", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "&", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } +} diff --git a/lib/test/esprima/expression/binary/migrated_0014.js b/lib/test/esprima/expression/binary/migrated_0014.js new file mode 100644 index 0000000..ab3e260 --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0014.js @@ -0,0 +1 @@ +x ^ y ^ z \ No newline at end of file diff --git a/lib/test/esprima/expression/binary/migrated_0014.tree.json b/lib/test/esprima/expression/binary/migrated_0014.tree.json new file mode 100644 index 0000000..fa79ece --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0014.tree.json @@ -0,0 +1,219 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "^", + "left": { + "type": "BinaryExpression", + "operator": "^", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "^", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "^", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } +} diff --git a/lib/test/esprima/expression/binary/migrated_0015.js b/lib/test/esprima/expression/binary/migrated_0015.js new file mode 100644 index 0000000..1421c44 --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0015.js @@ -0,0 +1 @@ +x & y | z \ No newline at end of file diff --git a/lib/test/esprima/expression/binary/migrated_0015.tree.json b/lib/test/esprima/expression/binary/migrated_0015.tree.json new file mode 100644 index 0000000..cd1cdbc --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0015.tree.json @@ -0,0 +1,219 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "|", + "left": { + "type": "BinaryExpression", + "operator": "&", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "&", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "|", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } +} diff --git a/lib/test/esprima/expression/binary/migrated_0016.js b/lib/test/esprima/expression/binary/migrated_0016.js new file mode 100644 index 0000000..96ba003 --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0016.js @@ -0,0 +1 @@ +x | y ^ z \ No newline at end of file diff --git a/lib/test/esprima/expression/binary/migrated_0016.tree.json b/lib/test/esprima/expression/binary/migrated_0016.tree.json new file mode 100644 index 0000000..5f35c6b --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0016.tree.json @@ -0,0 +1,219 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "|", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "^", + "left": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "|", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "^", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } +} diff --git a/lib/test/esprima/expression/binary/migrated_0017.js b/lib/test/esprima/expression/binary/migrated_0017.js new file mode 100644 index 0000000..aa9af9c --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0017.js @@ -0,0 +1 @@ +x | y & z \ No newline at end of file diff --git a/lib/test/esprima/expression/binary/migrated_0017.tree.json b/lib/test/esprima/expression/binary/migrated_0017.tree.json new file mode 100644 index 0000000..7d9cbdc --- /dev/null +++ b/lib/test/esprima/expression/binary/migrated_0017.tree.json @@ -0,0 +1,219 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "|", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "&", + "left": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "|", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "&", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } +} diff --git a/lib/test/esprima/expression/bitwise-shift/migrated_0000.js b/lib/test/esprima/expression/bitwise-shift/migrated_0000.js new file mode 100644 index 0000000..ae3caa8 --- /dev/null +++ b/lib/test/esprima/expression/bitwise-shift/migrated_0000.js @@ -0,0 +1 @@ +x << y \ No newline at end of file diff --git a/lib/test/esprima/expression/bitwise-shift/migrated_0000.tree.json b/lib/test/esprima/expression/bitwise-shift/migrated_0000.tree.json new file mode 100644 index 0000000..8060d03 --- /dev/null +++ b/lib/test/esprima/expression/bitwise-shift/migrated_0000.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "<<", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<<", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } +} diff --git a/lib/test/esprima/expression/bitwise-shift/migrated_0001.js b/lib/test/esprima/expression/bitwise-shift/migrated_0001.js new file mode 100644 index 0000000..b860745 --- /dev/null +++ b/lib/test/esprima/expression/bitwise-shift/migrated_0001.js @@ -0,0 +1 @@ +x >> y \ No newline at end of file diff --git a/lib/test/esprima/expression/bitwise-shift/migrated_0001.tree.json b/lib/test/esprima/expression/bitwise-shift/migrated_0001.tree.json new file mode 100644 index 0000000..c585a05 --- /dev/null +++ b/lib/test/esprima/expression/bitwise-shift/migrated_0001.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": ">>", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": ">>", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } +} diff --git a/lib/test/esprima/expression/bitwise-shift/migrated_0002.js b/lib/test/esprima/expression/bitwise-shift/migrated_0002.js new file mode 100644 index 0000000..94b6eaf --- /dev/null +++ b/lib/test/esprima/expression/bitwise-shift/migrated_0002.js @@ -0,0 +1 @@ +x >>> y \ No newline at end of file diff --git a/lib/test/esprima/expression/bitwise-shift/migrated_0002.tree.json b/lib/test/esprima/expression/bitwise-shift/migrated_0002.tree.json new file mode 100644 index 0000000..e1d3a3e --- /dev/null +++ b/lib/test/esprima/expression/bitwise-shift/migrated_0002.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": ">>>", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": ">>>", + "range": [ + 2, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } +} diff --git a/lib/test/esprima/expression/complex/migrated_0000.js b/lib/test/esprima/expression/complex/migrated_0000.js new file mode 100644 index 0000000..732797b --- /dev/null +++ b/lib/test/esprima/expression/complex/migrated_0000.js @@ -0,0 +1 @@ +a || b && c | d ^ e & f == g < h >>> i + j * k \ No newline at end of file diff --git a/lib/test/esprima/expression/complex/migrated_0000.tree.json b/lib/test/esprima/expression/complex/migrated_0000.tree.json new file mode 100644 index 0000000..84e3a1b --- /dev/null +++ b/lib/test/esprima/expression/complex/migrated_0000.tree.json @@ -0,0 +1,795 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "LogicalExpression", + "operator": "||", + "left": { + "type": "Identifier", + "name": "a", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "Identifier", + "name": "b", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "|", + "left": { + "type": "Identifier", + "name": "c", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "^", + "left": { + "type": "Identifier", + "name": "d", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "&", + "left": { + "type": "Identifier", + "name": "e", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "==", + "left": { + "type": "Identifier", + "name": "f", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "<", + "left": { + "type": "Identifier", + "name": "g", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": ">>>", + "left": { + "type": "Identifier", + "name": "h", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "Identifier", + "name": "i", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "*", + "left": { + "type": "Identifier", + "name": "j", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + "right": { + "type": "Identifier", + "name": "k", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "range": [ + 41, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "range": [ + 37, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "range": [ + 31, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "range": [ + 27, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "range": [ + 22, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "range": [ + 18, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "range": [ + 14, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "range": [ + 10, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "range": [ + 5, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "range": [ + 0, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "range": [ + 0, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "a", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "||", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "&&", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "|", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "^", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "e", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "&", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "==", + "range": [ + 24, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "g", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Identifier", + "value": "h", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ">>>", + "range": [ + 33, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Identifier", + "value": "i", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + { + "type": "Identifier", + "value": "j", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + { + "type": "Identifier", + "value": "k", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 46 + } + } + } + ], + "range": [ + 0, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + } +} diff --git a/lib/test/esprima/expression/conditional/migrated_0000.js b/lib/test/esprima/expression/conditional/migrated_0000.js new file mode 100644 index 0000000..f042369 --- /dev/null +++ b/lib/test/esprima/expression/conditional/migrated_0000.js @@ -0,0 +1 @@ +y ? 1 : 2 \ No newline at end of file diff --git a/lib/test/esprima/expression/conditional/migrated_0000.tree.json b/lib/test/esprima/expression/conditional/migrated_0000.tree.json new file mode 100644 index 0000000..21ac60e --- /dev/null +++ b/lib/test/esprima/expression/conditional/migrated_0000.tree.json @@ -0,0 +1,202 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ConditionalExpression", + "test": { + "type": "Identifier", + "name": "y", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "consequent": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "alternate": { + "type": "Literal", + "value": 2, + "raw": "2", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "y", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "?", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } +} diff --git a/lib/test/esprima/expression/conditional/migrated_0001.js b/lib/test/esprima/expression/conditional/migrated_0001.js new file mode 100644 index 0000000..2d9c14c --- /dev/null +++ b/lib/test/esprima/expression/conditional/migrated_0001.js @@ -0,0 +1 @@ +x && y ? 1 : 2 \ No newline at end of file diff --git a/lib/test/esprima/expression/conditional/migrated_0001.tree.json b/lib/test/esprima/expression/conditional/migrated_0001.tree.json new file mode 100644 index 0000000..a0d6968 --- /dev/null +++ b/lib/test/esprima/expression/conditional/migrated_0001.tree.json @@ -0,0 +1,274 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ConditionalExpression", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "consequent": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "alternate": { + "type": "Literal", + "value": 2, + "raw": "2", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "&&", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "?", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } +} diff --git a/lib/test/esprima/expression/conditional/migrated_0002.js b/lib/test/esprima/expression/conditional/migrated_0002.js new file mode 100644 index 0000000..cb6c962 --- /dev/null +++ b/lib/test/esprima/expression/conditional/migrated_0002.js @@ -0,0 +1 @@ +x = (0) ? 1 : 2 \ No newline at end of file diff --git a/lib/test/esprima/expression/conditional/migrated_0002.tree.json b/lib/test/esprima/expression/conditional/migrated_0002.tree.json new file mode 100644 index 0000000..4cea16c --- /dev/null +++ b/lib/test/esprima/expression/conditional/migrated_0002.tree.json @@ -0,0 +1,311 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ConditionalExpression", + "test": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "consequent": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "alternate": { + "type": "Literal", + "value": 2, + "raw": "2", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 4, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "?", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } +} diff --git a/lib/test/esprima/expression/equality/migrated_0000.js b/lib/test/esprima/expression/equality/migrated_0000.js new file mode 100644 index 0000000..616ee70 --- /dev/null +++ b/lib/test/esprima/expression/equality/migrated_0000.js @@ -0,0 +1 @@ +x == y \ No newline at end of file diff --git a/lib/test/esprima/expression/equality/migrated_0000.tree.json b/lib/test/esprima/expression/equality/migrated_0000.tree.json new file mode 100644 index 0000000..29dce6f --- /dev/null +++ b/lib/test/esprima/expression/equality/migrated_0000.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "==", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "==", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } +} diff --git a/lib/test/esprima/expression/equality/migrated_0001.js b/lib/test/esprima/expression/equality/migrated_0001.js new file mode 100644 index 0000000..6d0ea2e --- /dev/null +++ b/lib/test/esprima/expression/equality/migrated_0001.js @@ -0,0 +1 @@ +x != y \ No newline at end of file diff --git a/lib/test/esprima/expression/equality/migrated_0001.tree.json b/lib/test/esprima/expression/equality/migrated_0001.tree.json new file mode 100644 index 0000000..2a735e2 --- /dev/null +++ b/lib/test/esprima/expression/equality/migrated_0001.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "!=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "!=", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } +} diff --git a/lib/test/esprima/expression/equality/migrated_0002.js b/lib/test/esprima/expression/equality/migrated_0002.js new file mode 100644 index 0000000..8af9189 --- /dev/null +++ b/lib/test/esprima/expression/equality/migrated_0002.js @@ -0,0 +1 @@ +x === y \ No newline at end of file diff --git a/lib/test/esprima/expression/equality/migrated_0002.tree.json b/lib/test/esprima/expression/equality/migrated_0002.tree.json new file mode 100644 index 0000000..774d670 --- /dev/null +++ b/lib/test/esprima/expression/equality/migrated_0002.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "===", + "range": [ + 2, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } +} diff --git a/lib/test/esprima/expression/equality/migrated_0003.js b/lib/test/esprima/expression/equality/migrated_0003.js new file mode 100644 index 0000000..81800ac --- /dev/null +++ b/lib/test/esprima/expression/equality/migrated_0003.js @@ -0,0 +1 @@ +x !== y \ No newline at end of file diff --git a/lib/test/esprima/expression/equality/migrated_0003.tree.json b/lib/test/esprima/expression/equality/migrated_0003.tree.json new file mode 100644 index 0000000..5ec8ec9 --- /dev/null +++ b/lib/test/esprima/expression/equality/migrated_0003.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "!==", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "!==", + "range": [ + 2, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } +} diff --git a/lib/test/esprima/expression/grouping/migrated_0000.js b/lib/test/esprima/expression/grouping/migrated_0000.js new file mode 100644 index 0000000..2881a8f --- /dev/null +++ b/lib/test/esprima/expression/grouping/migrated_0000.js @@ -0,0 +1 @@ +(1) + (2 ) + 3 \ No newline at end of file diff --git a/lib/test/esprima/expression/grouping/migrated_0000.tree.json b/lib/test/esprima/expression/grouping/migrated_0000.tree.json new file mode 100644 index 0000000..352f700 --- /dev/null +++ b/lib/test/esprima/expression/grouping/migrated_0000.tree.json @@ -0,0 +1,294 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "right": { + "type": "Literal", + "value": 2, + "raw": "2", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "right": { + "type": "Literal", + "value": 3, + "raw": "3", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Numeric", + "value": "3", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } +} diff --git a/lib/test/esprima/expression/grouping/migrated_0001.js b/lib/test/esprima/expression/grouping/migrated_0001.js new file mode 100644 index 0000000..af4dd22 --- /dev/null +++ b/lib/test/esprima/expression/grouping/migrated_0001.js @@ -0,0 +1 @@ +4 + 5 << (6) \ No newline at end of file diff --git a/lib/test/esprima/expression/grouping/migrated_0001.tree.json b/lib/test/esprima/expression/grouping/migrated_0001.tree.json new file mode 100644 index 0000000..bb93149 --- /dev/null +++ b/lib/test/esprima/expression/grouping/migrated_0001.tree.json @@ -0,0 +1,258 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "<<", + "left": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "Literal", + "value": 4, + "raw": "4", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Literal", + "value": 5, + "raw": "5", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Literal", + "value": 6, + "raw": "6", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "4", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Numeric", + "value": "5", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "<<", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Numeric", + "value": "6", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } +} diff --git a/lib/test/esprima/expression/left-hand-side/let_object_computed.js b/lib/test/esprima/expression/left-hand-side/let_object_computed.js new file mode 100644 index 0000000..3300a2a --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/let_object_computed.js @@ -0,0 +1 @@ +(let[foo]=bar) diff --git a/lib/test/esprima/expression/left-hand-side/let_object_computed.tree.json b/lib/test/esprima/expression/left-hand-side/let_object_computed.tree.json new file mode 100644 index 0000000..294cb43 --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/let_object_computed.tree.json @@ -0,0 +1,273 @@ +{ + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Program", + "body": [ + { + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 1, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "AssignmentExpression", + "operator": "=", + "left": { + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "MemberExpression", + "computed": true, + "object": { + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "type": "Identifier", + "name": "let" + }, + "property": { + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "Identifier", + "name": "foo" + } + }, + "right": { + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "Identifier", + "name": "bar" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ] +} diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0000.js b/lib/test/esprima/expression/left-hand-side/migrated_0000.js new file mode 100644 index 0000000..187236d --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0000.js @@ -0,0 +1 @@ +new Button \ No newline at end of file diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0000.tree.json b/lib/test/esprima/expression/left-hand-side/migrated_0000.tree.json new file mode 100644 index 0000000..5a090ab --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0000.tree.json @@ -0,0 +1,111 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "Button", + "range": [ + 4, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "arguments": [], + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "new", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "Button", + "range": [ + 4, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } +} diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0001.js b/lib/test/esprima/expression/left-hand-side/migrated_0001.js new file mode 100644 index 0000000..a94b102 --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0001.js @@ -0,0 +1 @@ +new Button() \ No newline at end of file diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0001.tree.json b/lib/test/esprima/expression/left-hand-side/migrated_0001.tree.json new file mode 100644 index 0000000..5779ecb --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0001.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "Button", + "range": [ + 4, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "arguments": [], + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "new", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "Button", + "range": [ + 4, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } +} diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0002.js b/lib/test/esprima/expression/left-hand-side/migrated_0002.js new file mode 100644 index 0000000..3dba77c --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0002.js @@ -0,0 +1 @@ +new new foo \ No newline at end of file diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0002.tree.json b/lib/test/esprima/expression/left-hand-side/migrated_0002.tree.json new file mode 100644 index 0000000..720e4d8 --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0002.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "NewExpression", + "callee": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "arguments": [], + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "arguments": [], + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "new", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Keyword", + "value": "new", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } +} diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0003.js b/lib/test/esprima/expression/left-hand-side/migrated_0003.js new file mode 100644 index 0000000..4e860f6 --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0003.js @@ -0,0 +1 @@ +new new foo() \ No newline at end of file diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0003.tree.json b/lib/test/esprima/expression/left-hand-side/migrated_0003.tree.json new file mode 100644 index 0000000..8ee91b8 --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0003.tree.json @@ -0,0 +1,183 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "NewExpression", + "callee": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "arguments": [], + "range": [ + 4, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "arguments": [], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "new", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Keyword", + "value": "new", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } +} diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0004.js b/lib/test/esprima/expression/left-hand-side/migrated_0004.js new file mode 100644 index 0000000..f477838 --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0004.js @@ -0,0 +1 @@ +new foo().bar() \ No newline at end of file diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0004.tree.json b/lib/test/esprima/expression/left-hand-side/migrated_0004.tree.json new file mode 100644 index 0000000..28178f2 --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0004.tree.json @@ -0,0 +1,273 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "foo", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "arguments": [], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "property": { + "type": "Identifier", + "name": "bar", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "arguments": [], + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "new", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } +} diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0005.js b/lib/test/esprima/expression/left-hand-side/migrated_0005.js new file mode 100644 index 0000000..e860175 --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0005.js @@ -0,0 +1 @@ +new foo[bar] \ No newline at end of file diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0005.tree.json b/lib/test/esprima/expression/left-hand-side/migrated_0005.tree.json new file mode 100644 index 0000000..0d686dc --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0005.tree.json @@ -0,0 +1,201 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "NewExpression", + "callee": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "foo", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "property": { + "type": "Identifier", + "name": "bar", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 4, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "arguments": [], + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "new", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } +} diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0006.js b/lib/test/esprima/expression/left-hand-side/migrated_0006.js new file mode 100644 index 0000000..0586f2b --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0006.js @@ -0,0 +1 @@ +new foo.bar() \ No newline at end of file diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0006.tree.json b/lib/test/esprima/expression/left-hand-side/migrated_0006.tree.json new file mode 100644 index 0000000..23bc184 --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0006.tree.json @@ -0,0 +1,219 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "NewExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "foo", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "property": { + "type": "Identifier", + "name": "bar", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "arguments": [], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "new", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } +} diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0007.js b/lib/test/esprima/expression/left-hand-side/migrated_0007.js new file mode 100644 index 0000000..0ff2def --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0007.js @@ -0,0 +1 @@ +( new foo).bar() \ No newline at end of file diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0007.tree.json b/lib/test/esprima/expression/left-hand-side/migrated_0007.tree.json new file mode 100644 index 0000000..dc0b65d --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0007.tree.json @@ -0,0 +1,273 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "foo", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "arguments": [], + "range": [ + 2, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "property": { + "type": "Identifier", + "name": "bar", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "arguments": [], + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "new", + "range": [ + 2, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } +} diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0008.js b/lib/test/esprima/expression/left-hand-side/migrated_0008.js new file mode 100644 index 0000000..9f942f4 --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0008.js @@ -0,0 +1 @@ +foo(bar, baz) \ No newline at end of file diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0008.tree.json b/lib/test/esprima/expression/left-hand-side/migrated_0008.tree.json new file mode 100644 index 0000000..ad6b3c0 --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0008.tree.json @@ -0,0 +1,220 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "foo", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "bar", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "name": "baz", + "range": [ + 9, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "foo", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "baz", + "range": [ + 9, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } +} diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0009.js b/lib/test/esprima/expression/left-hand-side/migrated_0009.js new file mode 100644 index 0000000..507493b --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0009.js @@ -0,0 +1 @@ +( foo )() \ No newline at end of file diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0009.tree.json b/lib/test/esprima/expression/left-hand-side/migrated_0009.tree.json new file mode 100644 index 0000000..dbaa072 --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0009.tree.json @@ -0,0 +1,165 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "foo", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "arguments": [], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } +} diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0010.js b/lib/test/esprima/expression/left-hand-side/migrated_0010.js new file mode 100644 index 0000000..1e1ee2e --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0010.js @@ -0,0 +1 @@ +universe.milkyway \ No newline at end of file diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0010.tree.json b/lib/test/esprima/expression/left-hand-side/migrated_0010.tree.json new file mode 100644 index 0000000..b79157f --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0010.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "name": "milkyway", + "range": [ + 9, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "milkyway", + "range": [ + 9, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } +} diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0011.js b/lib/test/esprima/expression/left-hand-side/migrated_0011.js new file mode 100644 index 0000000..c701858 --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0011.js @@ -0,0 +1 @@ +universe.milkyway.solarsystem \ No newline at end of file diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0011.tree.json b/lib/test/esprima/expression/left-hand-side/migrated_0011.tree.json new file mode 100644 index 0000000..ac93ae6 --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0011.tree.json @@ -0,0 +1,219 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "name": "milkyway", + "range": [ + 9, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "property": { + "type": "Identifier", + "name": "solarsystem", + "range": [ + 18, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "milkyway", + "range": [ + 9, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "solarsystem", + "range": [ + 18, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } +} diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0012.js b/lib/test/esprima/expression/left-hand-side/migrated_0012.js new file mode 100644 index 0000000..78aa72f --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0012.js @@ -0,0 +1 @@ +universe.milkyway.solarsystem.Earth \ No newline at end of file diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0012.tree.json b/lib/test/esprima/expression/left-hand-side/migrated_0012.tree.json new file mode 100644 index 0000000..8a8c5f2 --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0012.tree.json @@ -0,0 +1,291 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "name": "milkyway", + "range": [ + 9, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "property": { + "type": "Identifier", + "name": "solarsystem", + "range": [ + 18, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "property": { + "type": "Identifier", + "name": "Earth", + "range": [ + 30, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "milkyway", + "range": [ + 9, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "solarsystem", + "range": [ + 18, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Identifier", + "value": "Earth", + "range": [ + 30, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + } +} diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0013.js b/lib/test/esprima/expression/left-hand-side/migrated_0013.js new file mode 100644 index 0000000..8527f99 --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0013.js @@ -0,0 +1 @@ +universe[galaxyName, otherUselessName] \ No newline at end of file diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0013.tree.json b/lib/test/esprima/expression/left-hand-side/migrated_0013.tree.json new file mode 100644 index 0000000..14a9246 --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0013.tree.json @@ -0,0 +1,238 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "property": { + "type": "SequenceExpression", + "expressions": [ + { + "type": "Identifier", + "name": "galaxyName", + "range": [ + 9, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "name": "otherUselessName", + "range": [ + 21, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + ], + "range": [ + 9, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "galaxyName", + "range": [ + 9, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "otherUselessName", + "range": [ + 21, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + ], + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } +} diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0014.js b/lib/test/esprima/expression/left-hand-side/migrated_0014.js new file mode 100644 index 0000000..e11584c --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0014.js @@ -0,0 +1 @@ +universe[galaxyName] \ No newline at end of file diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0014.tree.json b/lib/test/esprima/expression/left-hand-side/migrated_0014.tree.json new file mode 100644 index 0000000..961fc8f --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0014.tree.json @@ -0,0 +1,165 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "name": "galaxyName", + "range": [ + 9, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "galaxyName", + "range": [ + 9, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } +} diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0015.js b/lib/test/esprima/expression/left-hand-side/migrated_0015.js new file mode 100644 index 0000000..b3797dc --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0015.js @@ -0,0 +1 @@ +universe[42].galaxies \ No newline at end of file diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0015.tree.json b/lib/test/esprima/expression/left-hand-side/migrated_0015.tree.json new file mode 100644 index 0000000..c3d0d05 --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0015.tree.json @@ -0,0 +1,238 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "property": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "galaxies", + "range": [ + 13, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "galaxies", + "range": [ + 13, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } +} diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0016.js b/lib/test/esprima/expression/left-hand-side/migrated_0016.js new file mode 100644 index 0000000..2da4997 --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0016.js @@ -0,0 +1 @@ +universe(42).galaxies \ No newline at end of file diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0016.tree.json b/lib/test/esprima/expression/left-hand-side/migrated_0016.tree.json new file mode 100644 index 0000000..1779230 --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0016.tree.json @@ -0,0 +1,239 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "arguments": [ + { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "galaxies", + "range": [ + 13, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "galaxies", + "range": [ + 13, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } +} diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0017.js b/lib/test/esprima/expression/left-hand-side/migrated_0017.js new file mode 100644 index 0000000..1bf483f --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0017.js @@ -0,0 +1 @@ +universe(42).galaxies(14, 3, 77).milkyway \ No newline at end of file diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0017.tree.json b/lib/test/esprima/expression/left-hand-side/migrated_0017.tree.json new file mode 100644 index 0000000..fc38836 --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0017.tree.json @@ -0,0 +1,513 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "arguments": [ + { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "galaxies", + "range": [ + 13, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "arguments": [ + { + "type": "Literal", + "value": 14, + "raw": "14", + "range": [ + 22, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Literal", + "value": 3, + "raw": "3", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Literal", + "value": 77, + "raw": "77", + "range": [ + 29, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "property": { + "type": "Identifier", + "name": "milkyway", + "range": [ + 33, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "range": [ + 0, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "range": [ + 0, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "galaxies", + "range": [ + 13, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Numeric", + "value": "14", + "range": [ + 22, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Numeric", + "value": "3", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Numeric", + "value": "77", + "range": [ + 29, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Identifier", + "value": "milkyway", + "range": [ + 33, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 41 + } + } + } + ], + "range": [ + 0, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + } +} diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0018.js b/lib/test/esprima/expression/left-hand-side/migrated_0018.js new file mode 100644 index 0000000..4bd8c59 --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0018.js @@ -0,0 +1 @@ +earth.asia.Indonesia.prepareForElection(2014) \ No newline at end of file diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0018.tree.json b/lib/test/esprima/expression/left-hand-side/migrated_0018.tree.json new file mode 100644 index 0000000..b6ae47a --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0018.tree.json @@ -0,0 +1,383 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "earth", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "property": { + "type": "Identifier", + "name": "asia", + "range": [ + 6, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "property": { + "type": "Identifier", + "name": "Indonesia", + "range": [ + 11, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "name": "prepareForElection", + "range": [ + 21, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + "range": [ + 0, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + "arguments": [ + { + "type": "Literal", + "value": 2014, + "raw": "2014", + "range": [ + 40, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 44 + } + } + } + ], + "range": [ + 0, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + "range": [ + 0, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "earth", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "asia", + "range": [ + 6, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "Indonesia", + "range": [ + 11, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "prepareForElection", + "range": [ + 21, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + { + "type": "Numeric", + "value": "2014", + "range": [ + 40, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 45 + } + } + } + ], + "range": [ + 0, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + } +} diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0019.js b/lib/test/esprima/expression/left-hand-side/migrated_0019.js new file mode 100644 index 0000000..be247f7 --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0019.js @@ -0,0 +1 @@ +universe.if \ No newline at end of file diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0019.tree.json b/lib/test/esprima/expression/left-hand-side/migrated_0019.tree.json new file mode 100644 index 0000000..169ec48 --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0019.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "name": "if", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Keyword", + "value": "if", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } +} diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0020.js b/lib/test/esprima/expression/left-hand-side/migrated_0020.js new file mode 100644 index 0000000..83d0015 --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0020.js @@ -0,0 +1 @@ +universe.true \ No newline at end of file diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0020.tree.json b/lib/test/esprima/expression/left-hand-side/migrated_0020.tree.json new file mode 100644 index 0000000..198f34b --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0020.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "name": "true", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } +} diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0021.js b/lib/test/esprima/expression/left-hand-side/migrated_0021.js new file mode 100644 index 0000000..85bcdd4 --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0021.js @@ -0,0 +1 @@ +universe.false \ No newline at end of file diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0021.tree.json b/lib/test/esprima/expression/left-hand-side/migrated_0021.tree.json new file mode 100644 index 0000000..1d68470 --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0021.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "name": "false", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Boolean", + "value": "false", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } +} diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0022.js b/lib/test/esprima/expression/left-hand-side/migrated_0022.js new file mode 100644 index 0000000..6ed7c77 --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0022.js @@ -0,0 +1 @@ +universe.null \ No newline at end of file diff --git a/lib/test/esprima/expression/left-hand-side/migrated_0022.tree.json b/lib/test/esprima/expression/left-hand-side/migrated_0022.tree.json new file mode 100644 index 0000000..13e3987 --- /dev/null +++ b/lib/test/esprima/expression/left-hand-side/migrated_0022.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "name": "null", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Null", + "value": "null", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } +} diff --git a/lib/test/esprima/expression/multiplicative/migrated_0000.js b/lib/test/esprima/expression/multiplicative/migrated_0000.js new file mode 100644 index 0000000..bb5b8a4 --- /dev/null +++ b/lib/test/esprima/expression/multiplicative/migrated_0000.js @@ -0,0 +1 @@ +x * y \ No newline at end of file diff --git a/lib/test/esprima/expression/multiplicative/migrated_0000.tree.json b/lib/test/esprima/expression/multiplicative/migrated_0000.tree.json new file mode 100644 index 0000000..28eb5e2 --- /dev/null +++ b/lib/test/esprima/expression/multiplicative/migrated_0000.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "*", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } +} diff --git a/lib/test/esprima/expression/multiplicative/migrated_0001.js b/lib/test/esprima/expression/multiplicative/migrated_0001.js new file mode 100644 index 0000000..d6029e9 --- /dev/null +++ b/lib/test/esprima/expression/multiplicative/migrated_0001.js @@ -0,0 +1 @@ +x / y \ No newline at end of file diff --git a/lib/test/esprima/expression/multiplicative/migrated_0001.tree.json b/lib/test/esprima/expression/multiplicative/migrated_0001.tree.json new file mode 100644 index 0000000..c5734cb --- /dev/null +++ b/lib/test/esprima/expression/multiplicative/migrated_0001.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "/", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } +} diff --git a/lib/test/esprima/expression/multiplicative/migrated_0002.js b/lib/test/esprima/expression/multiplicative/migrated_0002.js new file mode 100644 index 0000000..971b2f2 --- /dev/null +++ b/lib/test/esprima/expression/multiplicative/migrated_0002.js @@ -0,0 +1 @@ +x % y \ No newline at end of file diff --git a/lib/test/esprima/expression/multiplicative/migrated_0002.tree.json b/lib/test/esprima/expression/multiplicative/migrated_0002.tree.json new file mode 100644 index 0000000..215af4b --- /dev/null +++ b/lib/test/esprima/expression/multiplicative/migrated_0002.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "%", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "%", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } +} diff --git a/lib/test/esprima/expression/postfix/migrated_0000.js b/lib/test/esprima/expression/postfix/migrated_0000.js new file mode 100644 index 0000000..1dee13b --- /dev/null +++ b/lib/test/esprima/expression/postfix/migrated_0000.js @@ -0,0 +1 @@ +x++ \ No newline at end of file diff --git a/lib/test/esprima/expression/postfix/migrated_0000.tree.json b/lib/test/esprima/expression/postfix/migrated_0000.tree.json new file mode 100644 index 0000000..6a2171a --- /dev/null +++ b/lib/test/esprima/expression/postfix/migrated_0000.tree.json @@ -0,0 +1,112 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "++", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "prefix": false, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "++", + "range": [ + 1, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } +} diff --git a/lib/test/esprima/expression/postfix/migrated_0001.js b/lib/test/esprima/expression/postfix/migrated_0001.js new file mode 100644 index 0000000..61a1bfe --- /dev/null +++ b/lib/test/esprima/expression/postfix/migrated_0001.js @@ -0,0 +1 @@ +x-- \ No newline at end of file diff --git a/lib/test/esprima/expression/postfix/migrated_0001.tree.json b/lib/test/esprima/expression/postfix/migrated_0001.tree.json new file mode 100644 index 0000000..e939879 --- /dev/null +++ b/lib/test/esprima/expression/postfix/migrated_0001.tree.json @@ -0,0 +1,112 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "--", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "prefix": false, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "--", + "range": [ + 1, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } +} diff --git a/lib/test/esprima/expression/postfix/migrated_0002.js b/lib/test/esprima/expression/postfix/migrated_0002.js new file mode 100644 index 0000000..b289184 --- /dev/null +++ b/lib/test/esprima/expression/postfix/migrated_0002.js @@ -0,0 +1 @@ +eval++ \ No newline at end of file diff --git a/lib/test/esprima/expression/postfix/migrated_0002.tree.json b/lib/test/esprima/expression/postfix/migrated_0002.tree.json new file mode 100644 index 0000000..913538d --- /dev/null +++ b/lib/test/esprima/expression/postfix/migrated_0002.tree.json @@ -0,0 +1,112 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "++", + "argument": { + "type": "Identifier", + "name": "eval", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "prefix": false, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "eval", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "++", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } +} diff --git a/lib/test/esprima/expression/postfix/migrated_0003.js b/lib/test/esprima/expression/postfix/migrated_0003.js new file mode 100644 index 0000000..319fb38 --- /dev/null +++ b/lib/test/esprima/expression/postfix/migrated_0003.js @@ -0,0 +1 @@ +eval-- \ No newline at end of file diff --git a/lib/test/esprima/expression/postfix/migrated_0003.tree.json b/lib/test/esprima/expression/postfix/migrated_0003.tree.json new file mode 100644 index 0000000..01cb52a --- /dev/null +++ b/lib/test/esprima/expression/postfix/migrated_0003.tree.json @@ -0,0 +1,112 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "--", + "argument": { + "type": "Identifier", + "name": "eval", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "prefix": false, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "eval", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "--", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } +} diff --git a/lib/test/esprima/expression/postfix/migrated_0004.js b/lib/test/esprima/expression/postfix/migrated_0004.js new file mode 100644 index 0000000..9cf54e3 --- /dev/null +++ b/lib/test/esprima/expression/postfix/migrated_0004.js @@ -0,0 +1 @@ +arguments++ \ No newline at end of file diff --git a/lib/test/esprima/expression/postfix/migrated_0004.tree.json b/lib/test/esprima/expression/postfix/migrated_0004.tree.json new file mode 100644 index 0000000..922fb13 --- /dev/null +++ b/lib/test/esprima/expression/postfix/migrated_0004.tree.json @@ -0,0 +1,112 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "++", + "argument": { + "type": "Identifier", + "name": "arguments", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "prefix": false, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "arguments", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "++", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } +} diff --git a/lib/test/esprima/expression/postfix/migrated_0005.js b/lib/test/esprima/expression/postfix/migrated_0005.js new file mode 100644 index 0000000..8b1113a --- /dev/null +++ b/lib/test/esprima/expression/postfix/migrated_0005.js @@ -0,0 +1 @@ +arguments-- \ No newline at end of file diff --git a/lib/test/esprima/expression/postfix/migrated_0005.tree.json b/lib/test/esprima/expression/postfix/migrated_0005.tree.json new file mode 100644 index 0000000..dadfaac --- /dev/null +++ b/lib/test/esprima/expression/postfix/migrated_0005.tree.json @@ -0,0 +1,112 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "--", + "argument": { + "type": "Identifier", + "name": "arguments", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "prefix": false, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "arguments", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "--", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } +} diff --git a/lib/test/esprima/expression/primary/array/migrated_0000.js b/lib/test/esprima/expression/primary/array/migrated_0000.js new file mode 100644 index 0000000..93edbdf --- /dev/null +++ b/lib/test/esprima/expression/primary/array/migrated_0000.js @@ -0,0 +1 @@ +x = [] \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/array/migrated_0000.tree.json b/lib/test/esprima/expression/primary/array/migrated_0000.tree.json new file mode 100644 index 0000000..c34a7fe --- /dev/null +++ b/lib/test/esprima/expression/primary/array/migrated_0000.tree.json @@ -0,0 +1,165 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [], + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } +} diff --git a/lib/test/esprima/expression/primary/array/migrated_0001.js b/lib/test/esprima/expression/primary/array/migrated_0001.js new file mode 100644 index 0000000..bad19c7 --- /dev/null +++ b/lib/test/esprima/expression/primary/array/migrated_0001.js @@ -0,0 +1 @@ +x = [ ] \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/array/migrated_0001.tree.json b/lib/test/esprima/expression/primary/array/migrated_0001.tree.json new file mode 100644 index 0000000..d51abb2 --- /dev/null +++ b/lib/test/esprima/expression/primary/array/migrated_0001.tree.json @@ -0,0 +1,165 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [], + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } +} diff --git a/lib/test/esprima/expression/primary/array/migrated_0002.js b/lib/test/esprima/expression/primary/array/migrated_0002.js new file mode 100644 index 0000000..34a371c --- /dev/null +++ b/lib/test/esprima/expression/primary/array/migrated_0002.js @@ -0,0 +1 @@ +x = [ 42 ] \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/array/migrated_0002.tree.json b/lib/test/esprima/expression/primary/array/migrated_0002.tree.json new file mode 100644 index 0000000..936c906 --- /dev/null +++ b/lib/test/esprima/expression/primary/array/migrated_0002.tree.json @@ -0,0 +1,203 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [ + { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "range": [ + 4, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } +} diff --git a/lib/test/esprima/expression/primary/array/migrated_0003.js b/lib/test/esprima/expression/primary/array/migrated_0003.js new file mode 100644 index 0000000..4a52d85 --- /dev/null +++ b/lib/test/esprima/expression/primary/array/migrated_0003.js @@ -0,0 +1 @@ +x = [ 42, ] \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/array/migrated_0003.tree.json b/lib/test/esprima/expression/primary/array/migrated_0003.tree.json new file mode 100644 index 0000000..93d052c --- /dev/null +++ b/lib/test/esprima/expression/primary/array/migrated_0003.tree.json @@ -0,0 +1,221 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [ + { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } +} diff --git a/lib/test/esprima/expression/primary/array/migrated_0004.js b/lib/test/esprima/expression/primary/array/migrated_0004.js new file mode 100644 index 0000000..18ce8c0 --- /dev/null +++ b/lib/test/esprima/expression/primary/array/migrated_0004.js @@ -0,0 +1 @@ +x = [ ,, 42 ] \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/array/migrated_0004.tree.json b/lib/test/esprima/expression/primary/array/migrated_0004.tree.json new file mode 100644 index 0000000..a7ba3ec --- /dev/null +++ b/lib/test/esprima/expression/primary/array/migrated_0004.tree.json @@ -0,0 +1,241 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [ + null, + null, + { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "range": [ + 4, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } +} diff --git a/lib/test/esprima/expression/primary/array/migrated_0005.js b/lib/test/esprima/expression/primary/array/migrated_0005.js new file mode 100644 index 0000000..9a2988f --- /dev/null +++ b/lib/test/esprima/expression/primary/array/migrated_0005.js @@ -0,0 +1 @@ +x = [ 1, 2, 3, ] \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/array/migrated_0005.tree.json b/lib/test/esprima/expression/primary/array/migrated_0005.tree.json new file mode 100644 index 0000000..fc44bc3 --- /dev/null +++ b/lib/test/esprima/expression/primary/array/migrated_0005.tree.json @@ -0,0 +1,331 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [ + { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Literal", + "value": 2, + "raw": "2", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Literal", + "value": 3, + "raw": "3", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "range": [ + 4, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Numeric", + "value": "3", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } +} diff --git a/lib/test/esprima/expression/primary/array/migrated_0006.js b/lib/test/esprima/expression/primary/array/migrated_0006.js new file mode 100644 index 0000000..9fad480 --- /dev/null +++ b/lib/test/esprima/expression/primary/array/migrated_0006.js @@ -0,0 +1 @@ +x = [ 1, 2,, 3, ] \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/array/migrated_0006.tree.json b/lib/test/esprima/expression/primary/array/migrated_0006.tree.json new file mode 100644 index 0000000..6cf176d --- /dev/null +++ b/lib/test/esprima/expression/primary/array/migrated_0006.tree.json @@ -0,0 +1,350 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [ + { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Literal", + "value": 2, + "raw": "2", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + null, + { + "type": "Literal", + "value": 3, + "raw": "3", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "range": [ + 4, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Numeric", + "value": "3", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } +} diff --git a/lib/test/esprima/expression/primary/array/migrated_0007.js b/lib/test/esprima/expression/primary/array/migrated_0007.js new file mode 100644 index 0000000..16e202f --- /dev/null +++ b/lib/test/esprima/expression/primary/array/migrated_0007.js @@ -0,0 +1 @@ +日本語 = [] \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/array/migrated_0007.tree.json b/lib/test/esprima/expression/primary/array/migrated_0007.tree.json new file mode 100644 index 0000000..2b91895 --- /dev/null +++ b/lib/test/esprima/expression/primary/array/migrated_0007.tree.json @@ -0,0 +1,165 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "日本語", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [], + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "日本語", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } +} diff --git a/lib/test/esprima/expression/primary/array/migrated_0008.source.js b/lib/test/esprima/expression/primary/array/migrated_0008.source.js new file mode 100644 index 0000000..f0f4470 --- /dev/null +++ b/lib/test/esprima/expression/primary/array/migrated_0008.source.js @@ -0,0 +1 @@ +var source = 'T\u203F = []'; \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/array/migrated_0008.tree.json b/lib/test/esprima/expression/primary/array/migrated_0008.tree.json new file mode 100644 index 0000000..012440b --- /dev/null +++ b/lib/test/esprima/expression/primary/array/migrated_0008.tree.json @@ -0,0 +1,165 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "T‿", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [], + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "T‿", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } +} diff --git a/lib/test/esprima/expression/primary/array/migrated_0009.source.js b/lib/test/esprima/expression/primary/array/migrated_0009.source.js new file mode 100644 index 0000000..e2eb52f --- /dev/null +++ b/lib/test/esprima/expression/primary/array/migrated_0009.source.js @@ -0,0 +1 @@ +var source = 'T\u200C = []'; \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/array/migrated_0009.tree.json b/lib/test/esprima/expression/primary/array/migrated_0009.tree.json new file mode 100644 index 0000000..df9a28f --- /dev/null +++ b/lib/test/esprima/expression/primary/array/migrated_0009.tree.json @@ -0,0 +1,165 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "T‌", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [], + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "T‌", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } +} diff --git a/lib/test/esprima/expression/primary/array/migrated_0010.source.js b/lib/test/esprima/expression/primary/array/migrated_0010.source.js new file mode 100644 index 0000000..bafe63b --- /dev/null +++ b/lib/test/esprima/expression/primary/array/migrated_0010.source.js @@ -0,0 +1 @@ +var source = 'T\u200D = []'; \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/array/migrated_0010.tree.json b/lib/test/esprima/expression/primary/array/migrated_0010.tree.json new file mode 100644 index 0000000..88457cb --- /dev/null +++ b/lib/test/esprima/expression/primary/array/migrated_0010.tree.json @@ -0,0 +1,165 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "T‍", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [], + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "T‍", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } +} diff --git a/lib/test/esprima/expression/primary/array/migrated_0011.source.js b/lib/test/esprima/expression/primary/array/migrated_0011.source.js new file mode 100644 index 0000000..307b066 --- /dev/null +++ b/lib/test/esprima/expression/primary/array/migrated_0011.source.js @@ -0,0 +1 @@ +var source = '\u2163\u2161 = []'; \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/array/migrated_0011.tree.json b/lib/test/esprima/expression/primary/array/migrated_0011.tree.json new file mode 100644 index 0000000..785ea5b --- /dev/null +++ b/lib/test/esprima/expression/primary/array/migrated_0011.tree.json @@ -0,0 +1,165 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "ⅣⅡ", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [], + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "ⅣⅡ", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } +} diff --git a/lib/test/esprima/expression/primary/array/migrated_0012.source.js b/lib/test/esprima/expression/primary/array/migrated_0012.source.js new file mode 100644 index 0000000..b24f8e1 --- /dev/null +++ b/lib/test/esprima/expression/primary/array/migrated_0012.source.js @@ -0,0 +1 @@ +var source = '\u2163\u2161\u200A=\u2009[]'; \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/array/migrated_0012.tree.json b/lib/test/esprima/expression/primary/array/migrated_0012.tree.json new file mode 100644 index 0000000..785ea5b --- /dev/null +++ b/lib/test/esprima/expression/primary/array/migrated_0012.tree.json @@ -0,0 +1,165 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "ⅣⅡ", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [], + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "ⅣⅡ", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0000.js b/lib/test/esprima/expression/primary/literal/numeric/migrated_0000.js new file mode 100644 index 0000000..c227083 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0000.js @@ -0,0 +1 @@ +0 \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0000.tree.json b/lib/test/esprima/expression/primary/literal/numeric/migrated_0000.tree.json new file mode 100644 index 0000000..e4c1062 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0000.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "0", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0001.js b/lib/test/esprima/expression/primary/literal/numeric/migrated_0001.js new file mode 100644 index 0000000..f70d7bb --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0001.js @@ -0,0 +1 @@ +42 \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0001.tree.json b/lib/test/esprima/expression/primary/literal/numeric/migrated_0001.tree.json new file mode 100644 index 0000000..dab3c0c --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0001.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "42", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ], + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0002.js b/lib/test/esprima/expression/primary/literal/numeric/migrated_0002.js new file mode 100644 index 0000000..e440e5c --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0002.js @@ -0,0 +1 @@ +3 \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0002.tree.json b/lib/test/esprima/expression/primary/literal/numeric/migrated_0002.tree.json new file mode 100644 index 0000000..48a4356 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0002.tree.json @@ -0,0 +1,36 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 3, + "raw": "3", + "range": [ + 0, + 1 + ] + }, + "range": [ + 0, + 1 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "3", + "range": [ + 0, + 1 + ] + } + ], + "range": [ + 0, + 1 + ] +} diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0003.js b/lib/test/esprima/expression/primary/literal/numeric/migrated_0003.js new file mode 100644 index 0000000..7813681 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0003.js @@ -0,0 +1 @@ +5 \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0003.tree.json b/lib/test/esprima/expression/primary/literal/numeric/migrated_0003.tree.json new file mode 100644 index 0000000..8f85d26 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0003.tree.json @@ -0,0 +1,60 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 5, + "raw": "5", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "5", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0004.js b/lib/test/esprima/expression/primary/literal/numeric/migrated_0004.js new file mode 100644 index 0000000..be03e1f --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0004.js @@ -0,0 +1 @@ +.14 \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0004.tree.json b/lib/test/esprima/expression/primary/literal/numeric/migrated_0004.tree.json new file mode 100644 index 0000000..77b9ff3 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0004.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 0.14, + "raw": ".14", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": ".14", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0005.js b/lib/test/esprima/expression/primary/literal/numeric/migrated_0005.js new file mode 100644 index 0000000..2c0cac5 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0005.js @@ -0,0 +1 @@ +3.14159 \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0005.tree.json b/lib/test/esprima/expression/primary/literal/numeric/migrated_0005.tree.json new file mode 100644 index 0000000..31d1003 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0005.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 3.14159, + "raw": "3.14159", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "3.14159", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0006.js b/lib/test/esprima/expression/primary/literal/numeric/migrated_0006.js new file mode 100644 index 0000000..f5b274b --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0006.js @@ -0,0 +1 @@ +6.02214179e+23 \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0006.tree.json b/lib/test/esprima/expression/primary/literal/numeric/migrated_0006.tree.json new file mode 100644 index 0000000..e01a445 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0006.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 6.02214179e+23, + "raw": "6.02214179e+23", + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "6.02214179e+23", + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0007.js b/lib/test/esprima/expression/primary/literal/numeric/migrated_0007.js new file mode 100644 index 0000000..76ed586 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0007.js @@ -0,0 +1 @@ +1.492417830e-10 \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0007.tree.json b/lib/test/esprima/expression/primary/literal/numeric/migrated_0007.tree.json new file mode 100644 index 0000000..2ceec20 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0007.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 1.49241783e-10, + "raw": "1.492417830e-10", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "1.492417830e-10", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0008.js b/lib/test/esprima/expression/primary/literal/numeric/migrated_0008.js new file mode 100644 index 0000000..4eb9959 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0008.js @@ -0,0 +1 @@ +0x0 \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0008.tree.json b/lib/test/esprima/expression/primary/literal/numeric/migrated_0008.tree.json new file mode 100644 index 0000000..0c7355e --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0008.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 0, + "raw": "0x0", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "0x0", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0009.js b/lib/test/esprima/expression/primary/literal/numeric/migrated_0009.js new file mode 100644 index 0000000..920f1df --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0009.js @@ -0,0 +1 @@ +0x0; \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0009.tree.json b/lib/test/esprima/expression/primary/literal/numeric/migrated_0009.tree.json new file mode 100644 index 0000000..17756b7 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0009.tree.json @@ -0,0 +1,94 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 0, + "raw": "0x0", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "0x0", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0010.diff b/lib/test/esprima/expression/primary/literal/numeric/migrated_0010.diff new file mode 100644 index 0000000..017092a --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0010.diff @@ -0,0 +1,10 @@ +{ + 'range': { '1': 6 }, + 'loc': { 'end': { 'column': 6 }}, + 'body': { + '0': { + 'range': { '1': 6 }, + 'loc': { 'end': { 'column': 6 }}, + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0010.js b/lib/test/esprima/expression/primary/literal/numeric/migrated_0010.js new file mode 100644 index 0000000..fc205a7 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0010.js @@ -0,0 +1 @@ +0e+100 \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0010.tree.json b/lib/test/esprima/expression/primary/literal/numeric/migrated_0010.tree.json new file mode 100644 index 0000000..10e6e03 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0010.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 0, + "raw": "0e+100", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "0e+100", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0011.js b/lib/test/esprima/expression/primary/literal/numeric/migrated_0011.js new file mode 100644 index 0000000..09ef702 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0011.js @@ -0,0 +1 @@ +0e+100 \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0011.tree.json b/lib/test/esprima/expression/primary/literal/numeric/migrated_0011.tree.json new file mode 100644 index 0000000..756d338 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0011.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 0, + "raw": "0e+100", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "0e+100", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0012.js b/lib/test/esprima/expression/primary/literal/numeric/migrated_0012.js new file mode 100644 index 0000000..2638b79 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0012.js @@ -0,0 +1 @@ +0xabc \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0012.tree.json b/lib/test/esprima/expression/primary/literal/numeric/migrated_0012.tree.json new file mode 100644 index 0000000..ee9ae10 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0012.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 2748, + "raw": "0xabc", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "0xabc", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0013.js b/lib/test/esprima/expression/primary/literal/numeric/migrated_0013.js new file mode 100644 index 0000000..f52a51e --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0013.js @@ -0,0 +1 @@ +0xdef \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0013.tree.json b/lib/test/esprima/expression/primary/literal/numeric/migrated_0013.tree.json new file mode 100644 index 0000000..e8c8b56 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0013.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 3567, + "raw": "0xdef", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "0xdef", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0014.js b/lib/test/esprima/expression/primary/literal/numeric/migrated_0014.js new file mode 100644 index 0000000..64239bc --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0014.js @@ -0,0 +1 @@ +0X1A \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0014.tree.json b/lib/test/esprima/expression/primary/literal/numeric/migrated_0014.tree.json new file mode 100644 index 0000000..66e4765 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0014.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 26, + "raw": "0X1A", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "0X1A", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0015.js b/lib/test/esprima/expression/primary/literal/numeric/migrated_0015.js new file mode 100644 index 0000000..1543d40 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0015.js @@ -0,0 +1 @@ +0x10 \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0015.tree.json b/lib/test/esprima/expression/primary/literal/numeric/migrated_0015.tree.json new file mode 100644 index 0000000..7b31289 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0015.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 16, + "raw": "0x10", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "0x10", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0016.js b/lib/test/esprima/expression/primary/literal/numeric/migrated_0016.js new file mode 100644 index 0000000..b4df9e4 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0016.js @@ -0,0 +1 @@ +0x100 \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0016.tree.json b/lib/test/esprima/expression/primary/literal/numeric/migrated_0016.tree.json new file mode 100644 index 0000000..02c79fe --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0016.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 256, + "raw": "0x100", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "0x100", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0017.js b/lib/test/esprima/expression/primary/literal/numeric/migrated_0017.js new file mode 100644 index 0000000..0c023f5 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0017.js @@ -0,0 +1 @@ +0X04 \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0017.tree.json b/lib/test/esprima/expression/primary/literal/numeric/migrated_0017.tree.json new file mode 100644 index 0000000..68b7b01 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0017.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 4, + "raw": "0X04", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "0X04", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0018.js b/lib/test/esprima/expression/primary/literal/numeric/migrated_0018.js new file mode 100644 index 0000000..b08e327 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0018.js @@ -0,0 +1 @@ +02 \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0018.tree.json b/lib/test/esprima/expression/primary/literal/numeric/migrated_0018.tree.json new file mode 100644 index 0000000..fdb7d91 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0018.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 2, + "raw": "02", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "02", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ], + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0019.js b/lib/test/esprima/expression/primary/literal/numeric/migrated_0019.js new file mode 100644 index 0000000..108d4a6 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0019.js @@ -0,0 +1 @@ +012 \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0019.tree.json b/lib/test/esprima/expression/primary/literal/numeric/migrated_0019.tree.json new file mode 100644 index 0000000..79bcc35 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0019.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 10, + "raw": "012", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "012", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0020.js b/lib/test/esprima/expression/primary/literal/numeric/migrated_0020.js new file mode 100644 index 0000000..58aba07 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0020.js @@ -0,0 +1 @@ +0012 \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0020.tree.json b/lib/test/esprima/expression/primary/literal/numeric/migrated_0020.tree.json new file mode 100644 index 0000000..38d4c7e --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0020.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 10, + "raw": "0012", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "0012", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0021.js b/lib/test/esprima/expression/primary/literal/numeric/migrated_0021.js new file mode 100644 index 0000000..7d4defd --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0021.js @@ -0,0 +1 @@ +08 \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0021.tree.json b/lib/test/esprima/expression/primary/literal/numeric/migrated_0021.tree.json new file mode 100644 index 0000000..632febc --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0021.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 8, + "raw": "08", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "08", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ], + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0022.js b/lib/test/esprima/expression/primary/literal/numeric/migrated_0022.js new file mode 100644 index 0000000..63e484e --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0022.js @@ -0,0 +1 @@ +0008 \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0022.tree.json b/lib/test/esprima/expression/primary/literal/numeric/migrated_0022.tree.json new file mode 100644 index 0000000..e7d4e50 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0022.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 8, + "raw": "0008", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "0008", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0023.js b/lib/test/esprima/expression/primary/literal/numeric/migrated_0023.js new file mode 100644 index 0000000..aa2f0b2 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0023.js @@ -0,0 +1 @@ +09 \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0023.tree.json b/lib/test/esprima/expression/primary/literal/numeric/migrated_0023.tree.json new file mode 100644 index 0000000..626a6ce --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0023.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 9, + "raw": "09", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "09", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ], + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0024.js b/lib/test/esprima/expression/primary/literal/numeric/migrated_0024.js new file mode 100644 index 0000000..54bb538 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0024.js @@ -0,0 +1 @@ +09.5 \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/numeric/migrated_0024.tree.json b/lib/test/esprima/expression/primary/literal/numeric/migrated_0024.tree.json new file mode 100644 index 0000000..0b27f10 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/numeric/migrated_0024.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 9.5, + "raw": "09.5", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "09.5", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0000.diff b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0000.diff new file mode 100644 index 0000000..072f8ea --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0000.diff @@ -0,0 +1,9 @@ +{ + "body": { + "0": { + "expression": { + "value": null + } + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0000.js b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0000.js new file mode 100644 index 0000000..abc222e --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0000.js @@ -0,0 +1 @@ +/p/; \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0000.tree.json b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0000.tree.json new file mode 100644 index 0000000..420762c --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0000.tree.json @@ -0,0 +1,102 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": {}, + "raw": "/p/", + "regex": { + "pattern": "p", + "flags": "" + }, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "RegularExpression", + "value": "/p/", + "regex": { + "pattern": "p", + "flags": "" + }, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0001.diff b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0001.diff new file mode 100644 index 0000000..c6a5386 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0001.diff @@ -0,0 +1,13 @@ +{ + "body": { + "0": { + "expression": { + "elements": { + "0": { + "value": null + } + } + } + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0001.js b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0001.js new file mode 100644 index 0000000..3252cdd --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0001.js @@ -0,0 +1 @@ +[/q/] \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0001.tree.json b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0001.tree.json new file mode 100644 index 0000000..252e7d6 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0001.tree.json @@ -0,0 +1,139 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrayExpression", + "elements": [ + { + "type": "Literal", + "value": {}, + "raw": "/q/", + "regex": { + "pattern": "q", + "flags": "" + }, + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "[", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "RegularExpression", + "value": "/q/", + "regex": { + "pattern": "q", + "flags": "" + }, + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0002.diff b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0002.diff new file mode 100644 index 0000000..c306819 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0002.diff @@ -0,0 +1,13 @@ +{ + "body": { + "0": { + "declarations": { + "0": { + "init": { + "value": null + } + } + } + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0002.js b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0002.js new file mode 100644 index 0000000..6bb56b4 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0002.js @@ -0,0 +1 @@ +var x = /[a-z]/i \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0002.tree.json b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0002.tree.json new file mode 100644 index 0000000..1aa1b1b --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0002.tree.json @@ -0,0 +1,176 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "Literal", + "value": {}, + "raw": "/[a-z]/i", + "regex": { + "pattern": "[a-z]", + "flags": "i" + }, + "range": [ + 8, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 4, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "RegularExpression", + "value": "/[a-z]/i", + "regex": { + "pattern": "[a-z]", + "flags": "i" + }, + "range": [ + 8, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0003.js b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0003.js new file mode 100644 index 0000000..db1b90a --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0003.js @@ -0,0 +1 @@ +var x = /[a-z]/y \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0003.tree.json b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0003.tree.json new file mode 100644 index 0000000..0fa24dc --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0003.tree.json @@ -0,0 +1,176 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "Literal", + "value": null, + "raw": "/[a-z]/y", + "regex": { + "pattern": "[a-z]", + "flags": "y" + }, + "range": [ + 8, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 4, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "RegularExpression", + "value": "/[a-z]/y", + "regex": { + "pattern": "[a-z]", + "flags": "y" + }, + "range": [ + 8, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0004.js b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0004.js new file mode 100644 index 0000000..2c1de8e --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0004.js @@ -0,0 +1 @@ +var x = /[a-z]/u \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0004.tree.json b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0004.tree.json new file mode 100644 index 0000000..199a9a1 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0004.tree.json @@ -0,0 +1,176 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "Literal", + "value": null, + "raw": "/[a-z]/u", + "regex": { + "pattern": "[a-z]", + "flags": "u" + }, + "range": [ + 8, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 4, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "RegularExpression", + "value": "/[a-z]/u", + "regex": { + "pattern": "[a-z]", + "flags": "u" + }, + "range": [ + 8, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0005.source.js b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0005.source.js new file mode 100644 index 0000000..b2b646e --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0005.source.js @@ -0,0 +1 @@ +var source = 'var x = /[\\u{0000000000000061}-\\u{7A}]/u'; \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0005.tree.json b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0005.tree.json new file mode 100644 index 0000000..5021740 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0005.tree.json @@ -0,0 +1,176 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "Literal", + "value": null, + "raw": "/[\\u{0000000000000061}-\\u{7A}]/u", + "regex": { + "pattern": "[\\u{0000000000000061}-\\u{7A}]", + "flags": "u" + }, + "range": [ + 8, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + "range": [ + 4, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 40 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "RegularExpression", + "value": "/[\\u{0000000000000061}-\\u{7A}]/u", + "regex": { + "pattern": "[\\u{0000000000000061}-\\u{7A}]", + "flags": "u" + }, + "range": [ + 8, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 40 + } + } + } + ], + "range": [ + 0, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0006.failure.json b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0006.failure.json new file mode 100644 index 0000000..55cbc7a --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0006.failure.json @@ -0,0 +1,6 @@ +{ + "index": 21, + "lineNumber": 1, + "column": 22, + "message": "Error: Line 1: Invalid regular expression" +} \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0006.source.js b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0006.source.js new file mode 100644 index 0000000..964850a --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0006.source.js @@ -0,0 +1 @@ +var source = 'var x = /\\u{110000}/u'; \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0007.diff b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0007.diff new file mode 100644 index 0000000..c306819 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0007.diff @@ -0,0 +1,13 @@ +{ + "body": { + "0": { + "declarations": { + "0": { + "init": { + "value": null + } + } + } + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0007.js b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0007.js new file mode 100644 index 0000000..9381588 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0007.js @@ -0,0 +1 @@ +var x = /[x-z]/i \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0007.tree.json b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0007.tree.json new file mode 100644 index 0000000..7b3b5b8 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0007.tree.json @@ -0,0 +1,86 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ] + }, + "init": { + "type": "Literal", + "value": {}, + "raw": "/[x-z]/i", + "regex": { + "pattern": "[x-z]", + "flags": "i" + }, + "range": [ + 8, + 16 + ] + }, + "range": [ + 4, + 16 + ] + } + ], + "kind": "var", + "range": [ + 0, + 16 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ] + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ] + }, + { + "type": "RegularExpression", + "value": "/[x-z]/i", + "regex": { + "pattern": "[x-z]", + "flags": "i" + }, + "range": [ + 8, + 16 + ] + } + ], + "range": [ + 0, + 16 + ] +} diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0008.diff b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0008.diff new file mode 100644 index 0000000..c306819 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0008.diff @@ -0,0 +1,13 @@ +{ + "body": { + "0": { + "declarations": { + "0": { + "init": { + "value": null + } + } + } + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0008.js b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0008.js new file mode 100644 index 0000000..71e179d --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0008.js @@ -0,0 +1 @@ +var x = /[a-c]/i \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0008.tree.json b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0008.tree.json new file mode 100644 index 0000000..954306c --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0008.tree.json @@ -0,0 +1,140 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "Literal", + "value": {}, + "raw": "/[a-c]/i", + "regex": { + "pattern": "[a-c]", + "flags": "i" + }, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "kind": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "RegularExpression", + "value": "/[a-c]/i", + "regex": { + "pattern": "[a-c]", + "flags": "i" + }, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0009.diff b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0009.diff new file mode 100644 index 0000000..0ad3389 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0009.diff @@ -0,0 +1,13 @@ +{ + "body": { + "0": { + "declarations": { + "0": { + "init": { + "value": null + } + } + } + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0009.js b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0009.js new file mode 100644 index 0000000..cc13baa --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0009.js @@ -0,0 +1 @@ +var x = /[P QR]/i \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0009.tree.json b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0009.tree.json new file mode 100644 index 0000000..0f6a18c --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0009.tree.json @@ -0,0 +1,176 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "Literal", + "value": {}, + "raw": "/[P QR]/i", + "regex": { + "pattern": "[P QR]", + "flags": "i" + }, + "range": [ + 8, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 4, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "RegularExpression", + "value": "/[P QR]/i", + "regex": { + "pattern": "[P QR]", + "flags": "i" + }, + "range": [ + 8, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0010.diff b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0010.diff new file mode 100644 index 0000000..c306819 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0010.diff @@ -0,0 +1,13 @@ +{ + "body": { + "0": { + "declarations": { + "0": { + "init": { + "value": null + } + } + } + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0010.js b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0010.js new file mode 100644 index 0000000..de30ee8 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0010.js @@ -0,0 +1 @@ +var x = /[\]/]/ \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0010.tree.json b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0010.tree.json new file mode 100644 index 0000000..05a65bb --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0010.tree.json @@ -0,0 +1,176 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "Literal", + "value": {}, + "raw": "/[\\]/]/", + "regex": { + "pattern": "[\\]/]", + "flags": "" + }, + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 4, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "RegularExpression", + "value": "/[\\]/]/", + "regex": { + "pattern": "[\\]/]", + "flags": "" + }, + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0011.diff b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0011.diff new file mode 100644 index 0000000..c306819 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0011.diff @@ -0,0 +1,13 @@ +{ + "body": { + "0": { + "declarations": { + "0": { + "init": { + "value": null + } + } + } + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0011.js b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0011.js new file mode 100644 index 0000000..dec7c26 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0011.js @@ -0,0 +1 @@ +var x = /foo\/bar/ \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0011.tree.json b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0011.tree.json new file mode 100644 index 0000000..5213b03 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0011.tree.json @@ -0,0 +1,176 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "Literal", + "value": {}, + "raw": "/foo\\/bar/", + "regex": { + "pattern": "foo\\/bar", + "flags": "" + }, + "range": [ + 8, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 4, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "RegularExpression", + "value": "/foo\\/bar/", + "regex": { + "pattern": "foo\\/bar", + "flags": "" + }, + "range": [ + 8, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0012.diff b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0012.diff new file mode 100644 index 0000000..c306819 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0012.diff @@ -0,0 +1,13 @@ +{ + "body": { + "0": { + "declarations": { + "0": { + "init": { + "value": null + } + } + } + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0012.js b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0012.js new file mode 100644 index 0000000..3778fcf --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0012.js @@ -0,0 +1 @@ +var x = /=([^=\s])+/g \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0012.tree.json b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0012.tree.json new file mode 100644 index 0000000..3b8413f --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0012.tree.json @@ -0,0 +1,176 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "Literal", + "value": {}, + "raw": "/=([^=\\s])+/g", + "regex": { + "pattern": "=([^=\\s])+", + "flags": "g" + }, + "range": [ + 8, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 4, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "RegularExpression", + "value": "/=([^=\\s])+/g", + "regex": { + "pattern": "=([^=\\s])+", + "flags": "g" + }, + "range": [ + 8, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0013.diff b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0013.diff new file mode 100644 index 0000000..11fccb1 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0013.diff @@ -0,0 +1,15 @@ +{ + "body": { + "0": { + "declarations": { + "0": { + "init": { + "object": { + "value": null + } + } + } + } + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0013.js b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0013.js new file mode 100644 index 0000000..7bb9d02 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0013.js @@ -0,0 +1 @@ +var x = /42/g.test \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0013.tree.json b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0013.tree.json new file mode 100644 index 0000000..56cf4b0 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/migrated_0013.tree.json @@ -0,0 +1,248 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Literal", + "value": {}, + "raw": "/42/g", + "regex": { + "pattern": "42", + "flags": "g" + }, + "range": [ + 8, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "property": { + "type": "Identifier", + "name": "test", + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 8, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 4, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "RegularExpression", + "value": "/42/g", + "regex": { + "pattern": "42", + "flags": "g" + }, + "range": [ + 8, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "test", + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/u-flag-invalid-range-4-hex.failure.json b/lib/test/esprima/expression/primary/literal/regular-expression/u-flag-invalid-range-4-hex.failure.json new file mode 100644 index 0000000..9bfbe69 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/u-flag-invalid-range-4-hex.failure.json @@ -0,0 +1,6 @@ +{ + "index": 21, + "lineNumber": 1, + "column": 22, + "message": "Error: Line 1: Invalid regular expression" +} diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/u-flag-invalid-range-4-hex.js b/lib/test/esprima/expression/primary/literal/regular-expression/u-flag-invalid-range-4-hex.js new file mode 100644 index 0000000..3d8b6d0 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/u-flag-invalid-range-4-hex.js @@ -0,0 +1 @@ +var x = /[\u0063-b]/u; diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/u-flag-invalid-range-var-hex.failure.json b/lib/test/esprima/expression/primary/literal/regular-expression/u-flag-invalid-range-var-hex.failure.json new file mode 100644 index 0000000..9bfbe69 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/u-flag-invalid-range-var-hex.failure.json @@ -0,0 +1,6 @@ +{ + "index": 21, + "lineNumber": 1, + "column": 22, + "message": "Error: Line 1: Invalid regular expression" +} diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/u-flag-invalid-range-var-hex.js b/lib/test/esprima/expression/primary/literal/regular-expression/u-flag-invalid-range-var-hex.js new file mode 100644 index 0000000..34e1615 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/u-flag-invalid-range-var-hex.js @@ -0,0 +1 @@ +var x = /[\u{63}-b]/u; diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/u-flag-surrogate-pair.js b/lib/test/esprima/expression/primary/literal/regular-expression/u-flag-surrogate-pair.js new file mode 100644 index 0000000..b0c93c8 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/u-flag-surrogate-pair.js @@ -0,0 +1 @@ +var x = /[\uD834\uDF06-\uD834\uDF08a-z]/u diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/u-flag-surrogate-pair.tree.json b/lib/test/esprima/expression/primary/literal/regular-expression/u-flag-surrogate-pair.tree.json new file mode 100644 index 0000000..74098cf --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/u-flag-surrogate-pair.tree.json @@ -0,0 +1,176 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "Literal", + "value": null, + "raw": "/[\\uD834\\uDF06-\\uD834\\uDF08a-z]/u", + "regex": { + "pattern": "[\\uD834\\uDF06-\\uD834\\uDF08a-z]", + "flags": "u" + }, + "range": [ + 8, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "range": [ + 4, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 41 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "RegularExpression", + "value": "/[\\uD834\\uDF06-\\uD834\\uDF08a-z]/u", + "regex": { + "pattern": "[\\uD834\\uDF06-\\uD834\\uDF08a-z]", + "flags": "u" + }, + "range": [ + 8, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 41 + } + } + } + ], + "range": [ + 0, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/u-flag-valid-range.js b/lib/test/esprima/expression/primary/literal/regular-expression/u-flag-valid-range.js new file mode 100644 index 0000000..82055ad --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/u-flag-valid-range.js @@ -0,0 +1 @@ +var x = /[\u{61}-b][\u0061-b][a-\u{62}][a-\u0062]\u{1ffff}/u; diff --git a/lib/test/esprima/expression/primary/literal/regular-expression/u-flag-valid-range.tree.json b/lib/test/esprima/expression/primary/literal/regular-expression/u-flag-valid-range.tree.json new file mode 100644 index 0000000..5dd777e --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/regular-expression/u-flag-valid-range.tree.json @@ -0,0 +1,194 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "Literal", + "value": null, + "raw": "/[\\u{61}-b][\\u0061-b][a-\\u{62}][a-\\u0062]\\u{1ffff}/u", + "regex": { + "pattern": "[\\u{61}-b][\\u0061-b][a-\\u{62}][a-\\u0062]\\u{1ffff}", + "flags": "u" + }, + "range": [ + 8, + 60 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 60 + } + } + }, + "range": [ + 4, + 60 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 60 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 61 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 61 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "RegularExpression", + "value": "/[\\u{61}-b][\\u0061-b][a-\\u{62}][a-\\u0062]\\u{1ffff}/u", + "regex": { + "pattern": "[\\u{61}-b][\\u0061-b][a-\\u{62}][a-\\u0062]\\u{1ffff}", + "flags": "u" + }, + "range": [ + 8, + 60 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 60 + } + } + }, + { + "range": [ + 60, + 61 + ], + "loc": { + "start": { + "line": 1, + "column": 60 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "type": "Punctuator", + "value": ";" + } + ], + "range": [ + 0, + 61 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 61 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/string/migrated_0000.js b/lib/test/esprima/expression/primary/literal/string/migrated_0000.js new file mode 100644 index 0000000..5638d8b --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/string/migrated_0000.js @@ -0,0 +1 @@ +"Hello" \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/string/migrated_0000.tree.json b/lib/test/esprima/expression/primary/literal/string/migrated_0000.tree.json new file mode 100644 index 0000000..a712ae9 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/string/migrated_0000.tree.json @@ -0,0 +1,77 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "Hello", + "raw": "\"Hello\"", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "directive": "Hello", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"Hello\"", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/string/migrated_0001.js b/lib/test/esprima/expression/primary/literal/string/migrated_0001.js new file mode 100644 index 0000000..5df7cc4 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/string/migrated_0001.js @@ -0,0 +1 @@ +"\n\r\t\v\b\f\\\'\"\0" \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/string/migrated_0001.tree.json b/lib/test/esprima/expression/primary/literal/string/migrated_0001.tree.json new file mode 100644 index 0000000..58014e9 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/string/migrated_0001.tree.json @@ -0,0 +1,77 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "\n\r\t\u000b\b\f\\'\"\u0000", + "raw": "\"\\n\\r\\t\\v\\b\\f\\\\\\'\\\"\\0\"", + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "directive": "\\n\\r\\t\\v\\b\\f\\\\\\'\\\"\\0", + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"\\n\\r\\t\\v\\b\\f\\\\\\'\\\"\\0\"", + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/string/migrated_0002.source.js b/lib/test/esprima/expression/primary/literal/string/migrated_0002.source.js new file mode 100644 index 0000000..0447afb --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/string/migrated_0002.source.js @@ -0,0 +1 @@ +var source = '"\\u0061"'; \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/string/migrated_0002.tree.json b/lib/test/esprima/expression/primary/literal/string/migrated_0002.tree.json new file mode 100644 index 0000000..f636c6e --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/string/migrated_0002.tree.json @@ -0,0 +1,77 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "a", + "raw": "\"\\u0061\"", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "directive": "\\u0061", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"\\u0061\"", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/string/migrated_0003.js b/lib/test/esprima/expression/primary/literal/string/migrated_0003.js new file mode 100644 index 0000000..e2900ca --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/string/migrated_0003.js @@ -0,0 +1 @@ +"\x61" \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/string/migrated_0003.tree.json b/lib/test/esprima/expression/primary/literal/string/migrated_0003.tree.json new file mode 100644 index 0000000..960a5bb --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/string/migrated_0003.tree.json @@ -0,0 +1,77 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "a", + "raw": "\"\\x61\"", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "directive": "\\x61", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"\\x61\"", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/string/migrated_0006.js b/lib/test/esprima/expression/primary/literal/string/migrated_0006.js new file mode 100644 index 0000000..0b0d976 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/string/migrated_0006.js @@ -0,0 +1 @@ +"Hello\nworld" \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/string/migrated_0006.tree.json b/lib/test/esprima/expression/primary/literal/string/migrated_0006.tree.json new file mode 100644 index 0000000..817e221 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/string/migrated_0006.tree.json @@ -0,0 +1,77 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "Hello\nworld", + "raw": "\"Hello\\nworld\"", + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "directive": "Hello\\nworld", + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"Hello\\nworld\"", + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/string/migrated_0007.js b/lib/test/esprima/expression/primary/literal/string/migrated_0007.js new file mode 100644 index 0000000..7e5e4d1 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/string/migrated_0007.js @@ -0,0 +1,2 @@ +"Hello\ +world" \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/string/migrated_0007.tree.json b/lib/test/esprima/expression/primary/literal/string/migrated_0007.tree.json new file mode 100644 index 0000000..c5dc040 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/string/migrated_0007.tree.json @@ -0,0 +1,77 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "Helloworld", + "raw": "\"Hello\\\nworld\"", + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "directive": "Hello\\\nworld", + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"Hello\\\nworld\"", + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + ], + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/string/migrated_0008.js b/lib/test/esprima/expression/primary/literal/string/migrated_0008.js new file mode 100644 index 0000000..09a19f4 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/string/migrated_0008.js @@ -0,0 +1 @@ +"Hello\02World" \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/string/migrated_0008.tree.json b/lib/test/esprima/expression/primary/literal/string/migrated_0008.tree.json new file mode 100644 index 0000000..725ec73 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/string/migrated_0008.tree.json @@ -0,0 +1,77 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "Hello\u0002World", + "raw": "\"Hello\\02World\"", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "directive": "Hello\\02World", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"Hello\\02World\"", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/string/migrated_0009.js b/lib/test/esprima/expression/primary/literal/string/migrated_0009.js new file mode 100644 index 0000000..b0f9910 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/string/migrated_0009.js @@ -0,0 +1 @@ +"Hello\012World" \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/string/migrated_0009.tree.json b/lib/test/esprima/expression/primary/literal/string/migrated_0009.tree.json new file mode 100644 index 0000000..c4d1401 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/string/migrated_0009.tree.json @@ -0,0 +1,77 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "Hello\nWorld", + "raw": "\"Hello\\012World\"", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "directive": "Hello\\012World", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"Hello\\012World\"", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/string/migrated_0010.js b/lib/test/esprima/expression/primary/literal/string/migrated_0010.js new file mode 100644 index 0000000..a0768cd --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/string/migrated_0010.js @@ -0,0 +1 @@ +"Hello\122World" \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/string/migrated_0010.tree.json b/lib/test/esprima/expression/primary/literal/string/migrated_0010.tree.json new file mode 100644 index 0000000..d4ca39f --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/string/migrated_0010.tree.json @@ -0,0 +1,77 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "HelloRWorld", + "raw": "\"Hello\\122World\"", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "directive": "Hello\\122World", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"Hello\\122World\"", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/string/migrated_0011.js b/lib/test/esprima/expression/primary/literal/string/migrated_0011.js new file mode 100644 index 0000000..7bf8432 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/string/migrated_0011.js @@ -0,0 +1 @@ +"Hello\0122World" \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/string/migrated_0011.tree.json b/lib/test/esprima/expression/primary/literal/string/migrated_0011.tree.json new file mode 100644 index 0000000..6debc09 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/string/migrated_0011.tree.json @@ -0,0 +1,77 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "Hello\n2World", + "raw": "\"Hello\\0122World\"", + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "directive": "Hello\\0122World", + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"Hello\\0122World\"", + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/string/migrated_0012.js b/lib/test/esprima/expression/primary/literal/string/migrated_0012.js new file mode 100644 index 0000000..bb1e3cb --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/string/migrated_0012.js @@ -0,0 +1 @@ +"Hello\312World" \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/string/migrated_0012.tree.json b/lib/test/esprima/expression/primary/literal/string/migrated_0012.tree.json new file mode 100644 index 0000000..b875be8 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/string/migrated_0012.tree.json @@ -0,0 +1,77 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "HelloÊWorld", + "raw": "\"Hello\\312World\"", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "directive": "Hello\\312World", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"Hello\\312World\"", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/string/migrated_0013.js b/lib/test/esprima/expression/primary/literal/string/migrated_0013.js new file mode 100644 index 0000000..271e2de --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/string/migrated_0013.js @@ -0,0 +1 @@ +"Hello\412World" \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/string/migrated_0013.tree.json b/lib/test/esprima/expression/primary/literal/string/migrated_0013.tree.json new file mode 100644 index 0000000..3101892 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/string/migrated_0013.tree.json @@ -0,0 +1,77 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "Hello!2World", + "raw": "\"Hello\\412World\"", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "directive": "Hello\\412World", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"Hello\\412World\"", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/string/migrated_0015.js b/lib/test/esprima/expression/primary/literal/string/migrated_0015.js new file mode 100644 index 0000000..864a614 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/string/migrated_0015.js @@ -0,0 +1 @@ +"Hello\712World" \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/string/migrated_0015.tree.json b/lib/test/esprima/expression/primary/literal/string/migrated_0015.tree.json new file mode 100644 index 0000000..c20f739 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/string/migrated_0015.tree.json @@ -0,0 +1,77 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "Hello92World", + "raw": "\"Hello\\712World\"", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "directive": "Hello\\712World", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"Hello\\712World\"", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/string/migrated_0016.js b/lib/test/esprima/expression/primary/literal/string/migrated_0016.js new file mode 100644 index 0000000..8e8574d --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/string/migrated_0016.js @@ -0,0 +1 @@ +"Hello\0World" \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/string/migrated_0016.tree.json b/lib/test/esprima/expression/primary/literal/string/migrated_0016.tree.json new file mode 100644 index 0000000..f67c813 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/string/migrated_0016.tree.json @@ -0,0 +1,77 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "Hello\u0000World", + "raw": "\"Hello\\0World\"", + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "directive": "Hello\\0World", + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"Hello\\0World\"", + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/string/migrated_0017.js b/lib/test/esprima/expression/primary/literal/string/migrated_0017.js new file mode 100644 index 0000000..f9ac49b --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/string/migrated_0017.js @@ -0,0 +1,2 @@ +"Hello\ +world" \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/string/migrated_0017.tree.json b/lib/test/esprima/expression/primary/literal/string/migrated_0017.tree.json new file mode 100644 index 0000000..ce5408d --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/string/migrated_0017.tree.json @@ -0,0 +1,77 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "Helloworld", + "raw": "\"Hello\\\r\nworld\"", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "directive": "Hello\\\r\nworld", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"Hello\\\r\nworld\"", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + ], + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } +} diff --git a/lib/test/esprima/expression/primary/literal/string/migrated_0018.js b/lib/test/esprima/expression/primary/literal/string/migrated_0018.js new file mode 100644 index 0000000..d667033 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/string/migrated_0018.js @@ -0,0 +1 @@ +"Hello\1World" \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/literal/string/migrated_0018.tree.json b/lib/test/esprima/expression/primary/literal/string/migrated_0018.tree.json new file mode 100644 index 0000000..2da7443 --- /dev/null +++ b/lib/test/esprima/expression/primary/literal/string/migrated_0018.tree.json @@ -0,0 +1,77 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "Hello\u0001World", + "raw": "\"Hello\\1World\"", + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "directive": "Hello\\1World", + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"Hello\\1World\"", + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0000.js b/lib/test/esprima/expression/primary/object/migrated_0000.js new file mode 100644 index 0000000..ad92347 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0000.js @@ -0,0 +1 @@ +x = {} \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0000.tree.json b/lib/test/esprima/expression/primary/object/migrated_0000.tree.json new file mode 100644 index 0000000..f369eee --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0000.tree.json @@ -0,0 +1,165 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0001.js b/lib/test/esprima/expression/primary/object/migrated_0001.js new file mode 100644 index 0000000..e2070b1 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0001.js @@ -0,0 +1 @@ +x = { } \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0001.tree.json b/lib/test/esprima/expression/primary/object/migrated_0001.tree.json new file mode 100644 index 0000000..030b23d --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0001.tree.json @@ -0,0 +1,165 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0002.js b/lib/test/esprima/expression/primary/object/migrated_0002.js new file mode 100644 index 0000000..ac27b07 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0002.js @@ -0,0 +1 @@ +x = { answer: 42 } \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0002.tree.json b/lib/test/esprima/expression/primary/object/migrated_0002.tree.json new file mode 100644 index 0000000..8ebb95f --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0002.tree.json @@ -0,0 +1,278 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "answer", + "range": [ + 6, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "computed": false, + "value": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 6, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 4, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "answer", + "range": [ + 6, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0003.js b/lib/test/esprima/expression/primary/object/migrated_0003.js new file mode 100644 index 0000000..eb6c39e --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0003.js @@ -0,0 +1 @@ +x = { if: 42 } \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0003.tree.json b/lib/test/esprima/expression/primary/object/migrated_0003.tree.json new file mode 100644 index 0000000..d4e95ff --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0003.tree.json @@ -0,0 +1,278 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "if", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "computed": false, + "value": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 6, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "range": [ + 4, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "if", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0004.js b/lib/test/esprima/expression/primary/object/migrated_0004.js new file mode 100644 index 0000000..cc13060 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0004.js @@ -0,0 +1 @@ +x = { true: 42 } \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0004.tree.json b/lib/test/esprima/expression/primary/object/migrated_0004.tree.json new file mode 100644 index 0000000..98dc143 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0004.tree.json @@ -0,0 +1,278 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "true", + "range": [ + 6, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "computed": false, + "value": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 6, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "range": [ + 4, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 6, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0005.js b/lib/test/esprima/expression/primary/object/migrated_0005.js new file mode 100644 index 0000000..232f4d6 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0005.js @@ -0,0 +1 @@ +x = { false: 42 } \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0005.tree.json b/lib/test/esprima/expression/primary/object/migrated_0005.tree.json new file mode 100644 index 0000000..8f73e22 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0005.tree.json @@ -0,0 +1,278 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "false", + "range": [ + 6, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "computed": false, + "value": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 13, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 6, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 4, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Boolean", + "value": "false", + "range": [ + 6, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 13, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0006.js b/lib/test/esprima/expression/primary/object/migrated_0006.js new file mode 100644 index 0000000..73fedb5 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0006.js @@ -0,0 +1 @@ +x = { null: 42 } \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0006.tree.json b/lib/test/esprima/expression/primary/object/migrated_0006.tree.json new file mode 100644 index 0000000..a6008cc --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0006.tree.json @@ -0,0 +1,278 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "null", + "range": [ + 6, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "computed": false, + "value": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 6, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "range": [ + 4, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Null", + "value": "null", + "range": [ + 6, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0007.js b/lib/test/esprima/expression/primary/object/migrated_0007.js new file mode 100644 index 0000000..080fc0e --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0007.js @@ -0,0 +1 @@ +x = { "answer": 42 } \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0007.tree.json b/lib/test/esprima/expression/primary/object/migrated_0007.tree.json new file mode 100644 index 0000000..a16c00b --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0007.tree.json @@ -0,0 +1,279 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Literal", + "value": "answer", + "raw": "\"answer\"", + "range": [ + 6, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "computed": false, + "value": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 16, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 6, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "range": [ + 4, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "String", + "value": "\"answer\"", + "range": [ + 6, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 16, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0008.js b/lib/test/esprima/expression/primary/object/migrated_0008.js new file mode 100644 index 0000000..27dc99a --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0008.js @@ -0,0 +1 @@ +x = { x: 1, x: 2 } \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0008.tree.json b/lib/test/esprima/expression/primary/object/migrated_0008.tree.json new file mode 100644 index 0000000..d6d0ed9 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0008.tree.json @@ -0,0 +1,408 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "computed": false, + "value": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 6, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "x", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "computed": false, + "value": { + "type": "Literal", + "value": 2, + "raw": "2", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 12, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 4, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0009.diff b/lib/test/esprima/expression/primary/object/migrated_0009.diff new file mode 100644 index 0000000..51b56aa --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0009.diff @@ -0,0 +1,24 @@ +{ + 'body': { + '0': { + 'expression': { + 'right': { + 'properties': { + '0': { + 'value': { + 'body': { + 'body': { + '0': { + 'range': { '1': 34 }, + 'loc': { 'end': { 'column': 34 }} + } + } + } + } + } + } + } + } + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0009.js b/lib/test/esprima/expression/primary/object/migrated_0009.js new file mode 100644 index 0000000..6184558 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0009.js @@ -0,0 +1 @@ +x = { get width() { return m_width } } \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0009.tree.json b/lib/test/esprima/expression/primary/object/migrated_0009.tree.json new file mode 100644 index 0000000..f92f9f3 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0009.tree.json @@ -0,0 +1,424 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "width", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "Identifier", + "name": "m_width", + "range": [ + 27, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 20, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "range": [ + 18, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 15, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "kind": "get", + "method": false, + "shorthand": false, + "range": [ + 6, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "range": [ + 4, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "get", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "width", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 20, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "m_width", + "range": [ + 27, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + ], + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0010.js b/lib/test/esprima/expression/primary/object/migrated_0010.js new file mode 100644 index 0000000..3185831 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0010.js @@ -0,0 +1 @@ +x = { get undef() {} } \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0010.tree.json b/lib/test/esprima/expression/primary/object/migrated_0010.tree.json new file mode 100644 index 0000000..7b02d8e --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0010.tree.json @@ -0,0 +1,352 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "undef", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "kind": "get", + "method": false, + "shorthand": false, + "range": [ + 6, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "range": [ + 4, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "get", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "undef", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0011.js b/lib/test/esprima/expression/primary/object/migrated_0011.js new file mode 100644 index 0000000..d36a622 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0011.js @@ -0,0 +1 @@ +x = { get if() {} } \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0011.tree.json b/lib/test/esprima/expression/primary/object/migrated_0011.tree.json new file mode 100644 index 0000000..965a87e --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0011.tree.json @@ -0,0 +1,352 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "if", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 12, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "kind": "get", + "method": false, + "shorthand": false, + "range": [ + 6, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "range": [ + 4, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "get", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Keyword", + "value": "if", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0012.js b/lib/test/esprima/expression/primary/object/migrated_0012.js new file mode 100644 index 0000000..d1eebe3 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0012.js @@ -0,0 +1 @@ +x = { get true() {} } \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0012.tree.json b/lib/test/esprima/expression/primary/object/migrated_0012.tree.json new file mode 100644 index 0000000..90e117f --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0012.tree.json @@ -0,0 +1,352 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "true", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 17, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "kind": "get", + "method": false, + "shorthand": false, + "range": [ + 6, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "range": [ + 4, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "get", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0013.js b/lib/test/esprima/expression/primary/object/migrated_0013.js new file mode 100644 index 0000000..bfdd86e --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0013.js @@ -0,0 +1 @@ +x = { get false() {} } \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0013.tree.json b/lib/test/esprima/expression/primary/object/migrated_0013.tree.json new file mode 100644 index 0000000..e055940 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0013.tree.json @@ -0,0 +1,352 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "false", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "kind": "get", + "method": false, + "shorthand": false, + "range": [ + 6, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "range": [ + 4, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "get", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Boolean", + "value": "false", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0014.js b/lib/test/esprima/expression/primary/object/migrated_0014.js new file mode 100644 index 0000000..11f3416 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0014.js @@ -0,0 +1 @@ +x = { get null() {} } \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0014.tree.json b/lib/test/esprima/expression/primary/object/migrated_0014.tree.json new file mode 100644 index 0000000..b7cfadd --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0014.tree.json @@ -0,0 +1,352 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "null", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 17, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "kind": "get", + "method": false, + "shorthand": false, + "range": [ + 6, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "range": [ + 4, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "get", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Null", + "value": "null", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0015.js b/lib/test/esprima/expression/primary/object/migrated_0015.js new file mode 100644 index 0000000..6b2adc2 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0015.js @@ -0,0 +1 @@ +x = { get "undef"() {} } \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0015.tree.json b/lib/test/esprima/expression/primary/object/migrated_0015.tree.json new file mode 100644 index 0000000..e28f316 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0015.tree.json @@ -0,0 +1,353 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Literal", + "value": "undef", + "raw": "\"undef\"", + "range": [ + 10, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 20, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "kind": "get", + "method": false, + "shorthand": false, + "range": [ + 6, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "range": [ + 4, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "get", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "String", + "value": "\"undef\"", + "range": [ + 10, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0016.js b/lib/test/esprima/expression/primary/object/migrated_0016.js new file mode 100644 index 0000000..a4b31f7 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0016.js @@ -0,0 +1 @@ +x = { get 10() {} } \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0016.tree.json b/lib/test/esprima/expression/primary/object/migrated_0016.tree.json new file mode 100644 index 0000000..5b04a09 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0016.tree.json @@ -0,0 +1,353 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Literal", + "value": 10, + "raw": "10", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 12, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "kind": "get", + "method": false, + "shorthand": false, + "range": [ + 6, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "range": [ + 4, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "get", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Numeric", + "value": "10", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0017.diff b/lib/test/esprima/expression/primary/object/migrated_0017.diff new file mode 100644 index 0000000..823cad2 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0017.diff @@ -0,0 +1,24 @@ +{ + 'body': { + '0': { + 'expression': { + 'right': { + 'properties': { + '0': { + 'value': { + 'body': { + 'body': { + '0': { + 'range': { '1': 32 }, + 'loc': { 'end': { 'column': 32 }} + } + } + } + } + } + } + } + } + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0017.js b/lib/test/esprima/expression/primary/object/migrated_0017.js new file mode 100644 index 0000000..195d9af --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0017.js @@ -0,0 +1 @@ +x = { set width(w) { m_width = w } } \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0017.tree.json b/lib/test/esprima/expression/primary/object/migrated_0017.tree.json new file mode 100644 index 0000000..7333930 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0017.tree.json @@ -0,0 +1,515 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "width", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "w", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "m_width", + "range": [ + 21, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "right": { + "type": "Identifier", + "name": "w", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "range": [ + 21, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "range": [ + 21, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "range": [ + 19, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 15, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "kind": "set", + "method": false, + "shorthand": false, + "range": [ + 6, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "range": [ + 4, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "set", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "width", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "w", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "m_width", + "range": [ + 21, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Identifier", + "value": "w", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0018.diff b/lib/test/esprima/expression/primary/object/migrated_0018.diff new file mode 100644 index 0000000..194d042 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0018.diff @@ -0,0 +1,24 @@ +{ + 'body': { + '0': { + 'expression': { + 'right': { + 'properties': { + '0': { + 'value': { + 'body': { + 'body': { + '0': { + 'range': { '1': 26 }, + 'loc': { 'end': { 'column': 26 }} + } + } + } + } + } + } + } + } + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0018.js b/lib/test/esprima/expression/primary/object/migrated_0018.js new file mode 100644 index 0000000..5a84a53 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0018.js @@ -0,0 +1 @@ +x = { set if(w) { m_if = w } } \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0018.tree.json b/lib/test/esprima/expression/primary/object/migrated_0018.tree.json new file mode 100644 index 0000000..d2dcf4d --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0018.tree.json @@ -0,0 +1,515 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "if", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "w", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "m_if", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "right": { + "type": "Identifier", + "name": "w", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 18, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 18, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "range": [ + 16, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 12, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "kind": "set", + "method": false, + "shorthand": false, + "range": [ + 6, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "range": [ + 4, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "set", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Keyword", + "value": "if", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "w", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "m_if", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "w", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + } + ], + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0019.diff b/lib/test/esprima/expression/primary/object/migrated_0019.diff new file mode 100644 index 0000000..04e16eb --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0019.diff @@ -0,0 +1,24 @@ +{ + 'body': { + '0': { + 'expression': { + 'right': { + 'properties': { + '0': { + 'value': { + 'body': { + 'body': { + '0': { + 'range': { '1': 30 }, + 'loc': { 'end': { 'column': 30 }} + } + } + } + } + } + } + } + } + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0019.js b/lib/test/esprima/expression/primary/object/migrated_0019.js new file mode 100644 index 0000000..9a2f22a --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0019.js @@ -0,0 +1 @@ +x = { set true(w) { m_true = w } } \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0019.tree.json b/lib/test/esprima/expression/primary/object/migrated_0019.tree.json new file mode 100644 index 0000000..42942e6 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0019.tree.json @@ -0,0 +1,515 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "true", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "w", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "m_true", + "range": [ + 20, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "right": { + "type": "Identifier", + "name": "w", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 20, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 20, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "range": [ + 18, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 14, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "kind": "set", + "method": false, + "shorthand": false, + "range": [ + 6, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ], + "range": [ + 4, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "set", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "w", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "m_true", + "range": [ + 20, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "w", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0020.diff b/lib/test/esprima/expression/primary/object/migrated_0020.diff new file mode 100644 index 0000000..823cad2 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0020.diff @@ -0,0 +1,24 @@ +{ + 'body': { + '0': { + 'expression': { + 'right': { + 'properties': { + '0': { + 'value': { + 'body': { + 'body': { + '0': { + 'range': { '1': 32 }, + 'loc': { 'end': { 'column': 32 }} + } + } + } + } + } + } + } + } + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0020.js b/lib/test/esprima/expression/primary/object/migrated_0020.js new file mode 100644 index 0000000..8689324 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0020.js @@ -0,0 +1 @@ +x = { set false(w) { m_false = w } } \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0020.tree.json b/lib/test/esprima/expression/primary/object/migrated_0020.tree.json new file mode 100644 index 0000000..5ecaa10 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0020.tree.json @@ -0,0 +1,515 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "false", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "w", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "m_false", + "range": [ + 21, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "right": { + "type": "Identifier", + "name": "w", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "range": [ + 21, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "range": [ + 21, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "range": [ + 19, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 15, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "kind": "set", + "method": false, + "shorthand": false, + "range": [ + 6, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "range": [ + 4, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "set", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Boolean", + "value": "false", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "w", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "m_false", + "range": [ + 21, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Identifier", + "value": "w", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0021.diff b/lib/test/esprima/expression/primary/object/migrated_0021.diff new file mode 100644 index 0000000..04e16eb --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0021.diff @@ -0,0 +1,24 @@ +{ + 'body': { + '0': { + 'expression': { + 'right': { + 'properties': { + '0': { + 'value': { + 'body': { + 'body': { + '0': { + 'range': { '1': 30 }, + 'loc': { 'end': { 'column': 30 }} + } + } + } + } + } + } + } + } + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0021.js b/lib/test/esprima/expression/primary/object/migrated_0021.js new file mode 100644 index 0000000..2694a88 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0021.js @@ -0,0 +1 @@ +x = { set null(w) { m_null = w } } \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0021.tree.json b/lib/test/esprima/expression/primary/object/migrated_0021.tree.json new file mode 100644 index 0000000..c8f6ebd --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0021.tree.json @@ -0,0 +1,515 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "null", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "w", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "m_null", + "range": [ + 20, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "right": { + "type": "Identifier", + "name": "w", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 20, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 20, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "range": [ + 18, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 14, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "kind": "set", + "method": false, + "shorthand": false, + "range": [ + 6, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ], + "range": [ + 4, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "set", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Null", + "value": "null", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "w", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "m_null", + "range": [ + 20, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "w", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0022.diff b/lib/test/esprima/expression/primary/object/migrated_0022.diff new file mode 100644 index 0000000..823cad2 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0022.diff @@ -0,0 +1,24 @@ +{ + 'body': { + '0': { + 'expression': { + 'right': { + 'properties': { + '0': { + 'value': { + 'body': { + 'body': { + '0': { + 'range': { '1': 32 }, + 'loc': { 'end': { 'column': 32 }} + } + } + } + } + } + } + } + } + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0022.js b/lib/test/esprima/expression/primary/object/migrated_0022.js new file mode 100644 index 0000000..46712ca --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0022.js @@ -0,0 +1 @@ +x = { set "null"(w) { m_null = w } } \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0022.tree.json b/lib/test/esprima/expression/primary/object/migrated_0022.tree.json new file mode 100644 index 0000000..aa6cd26 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0022.tree.json @@ -0,0 +1,516 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Literal", + "value": "null", + "raw": "\"null\"", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "w", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "m_null", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "right": { + "type": "Identifier", + "name": "w", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "range": [ + 22, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "range": [ + 22, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "range": [ + 20, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 16, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "kind": "set", + "method": false, + "shorthand": false, + "range": [ + 6, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "range": [ + 4, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "set", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "String", + "value": "\"null\"", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "w", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "m_null", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Identifier", + "value": "w", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0023.diff b/lib/test/esprima/expression/primary/object/migrated_0023.diff new file mode 100644 index 0000000..765ddba --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0023.diff @@ -0,0 +1,24 @@ +{ + 'body': { + '0': { + 'expression': { + 'right': { + 'properties': { + '0': { + 'value': { + 'body': { + 'body': { + '0': { + 'range': { '1': 28 }, + 'loc': { 'end': { 'column': 28 }} + } + } + } + } + } + } + } + } + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0023.js b/lib/test/esprima/expression/primary/object/migrated_0023.js new file mode 100644 index 0000000..c5e8300 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0023.js @@ -0,0 +1 @@ +x = { set 10(w) { m_null = w } } \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0023.tree.json b/lib/test/esprima/expression/primary/object/migrated_0023.tree.json new file mode 100644 index 0000000..5cafb62 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0023.tree.json @@ -0,0 +1,516 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Literal", + "value": 10, + "raw": "10", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "w", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "m_null", + "range": [ + 18, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "right": { + "type": "Identifier", + "name": "w", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "range": [ + 18, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "range": [ + 18, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "range": [ + 16, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 12, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "kind": "set", + "method": false, + "shorthand": false, + "range": [ + 6, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 30 + } + } + } + ], + "range": [ + 4, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "set", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Numeric", + "value": "10", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "w", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "m_null", + "range": [ + 18, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "w", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ], + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0024.js b/lib/test/esprima/expression/primary/object/migrated_0024.js new file mode 100644 index 0000000..12174c6 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0024.js @@ -0,0 +1 @@ +x = { get: 42 } \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0024.tree.json b/lib/test/esprima/expression/primary/object/migrated_0024.tree.json new file mode 100644 index 0000000..161380d --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0024.tree.json @@ -0,0 +1,278 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "get", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "computed": false, + "value": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 6, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "range": [ + 4, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "get", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0025.js b/lib/test/esprima/expression/primary/object/migrated_0025.js new file mode 100644 index 0000000..3750d76 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0025.js @@ -0,0 +1 @@ +x = { set: 43 } \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0025.tree.json b/lib/test/esprima/expression/primary/object/migrated_0025.tree.json new file mode 100644 index 0000000..fe67637 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0025.tree.json @@ -0,0 +1,278 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "set", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "computed": false, + "value": { + "type": "Literal", + "value": 43, + "raw": "43", + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 6, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "range": [ + 4, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "set", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Numeric", + "value": "43", + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0026.js b/lib/test/esprima/expression/primary/object/migrated_0026.js new file mode 100644 index 0000000..7ac6c98 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0026.js @@ -0,0 +1 @@ +x = { __proto__: 2 } \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0026.tree.json b/lib/test/esprima/expression/primary/object/migrated_0026.tree.json new file mode 100644 index 0000000..32d17e8 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0026.tree.json @@ -0,0 +1,278 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "__proto__", + "range": [ + 6, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "computed": false, + "value": { + "type": "Literal", + "value": 2, + "raw": "2", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 6, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "range": [ + 4, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "__proto__", + "range": [ + 6, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0027.js b/lib/test/esprima/expression/primary/object/migrated_0027.js new file mode 100644 index 0000000..47f74f2 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0027.js @@ -0,0 +1 @@ +x = {"__proto__": 2 } \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0027.tree.json b/lib/test/esprima/expression/primary/object/migrated_0027.tree.json new file mode 100644 index 0000000..453bfec --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0027.tree.json @@ -0,0 +1,279 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Literal", + "value": "__proto__", + "raw": "\"__proto__\"", + "range": [ + 5, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "computed": false, + "value": { + "type": "Literal", + "value": 2, + "raw": "2", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 5, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "range": [ + 4, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "String", + "value": "\"__proto__\"", + "range": [ + 5, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0028.diff b/lib/test/esprima/expression/primary/object/migrated_0028.diff new file mode 100644 index 0000000..51b56aa --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0028.diff @@ -0,0 +1,24 @@ +{ + 'body': { + '0': { + 'expression': { + 'right': { + 'properties': { + '0': { + 'value': { + 'body': { + 'body': { + '0': { + 'range': { '1': 34 }, + 'loc': { 'end': { 'column': 34 }} + } + } + } + } + } + } + } + } + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0028.js b/lib/test/esprima/expression/primary/object/migrated_0028.js new file mode 100644 index 0000000..32bbc3d --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0028.js @@ -0,0 +1 @@ +x = { get width() { return m_width }, set width(width) { m_width = width; } } \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0028.tree.json b/lib/test/esprima/expression/primary/object/migrated_0028.tree.json new file mode 100644 index 0000000..684d824 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0028.tree.json @@ -0,0 +1,809 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "width", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "Identifier", + "name": "m_width", + "range": [ + 27, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 20, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "range": [ + 18, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 15, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "kind": "get", + "method": false, + "shorthand": false, + "range": [ + 6, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "width", + "range": [ + 42, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 47 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "width", + "range": [ + 48, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 53 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "m_width", + "range": [ + 57, + 64 + ], + "loc": { + "start": { + "line": 1, + "column": 57 + }, + "end": { + "line": 1, + "column": 64 + } + } + }, + "right": { + "type": "Identifier", + "name": "width", + "range": [ + 67, + 72 + ], + "loc": { + "start": { + "line": 1, + "column": 67 + }, + "end": { + "line": 1, + "column": 72 + } + } + }, + "range": [ + 57, + 72 + ], + "loc": { + "start": { + "line": 1, + "column": 57 + }, + "end": { + "line": 1, + "column": 72 + } + } + }, + "range": [ + 57, + 73 + ], + "loc": { + "start": { + "line": 1, + "column": 57 + }, + "end": { + "line": 1, + "column": 73 + } + } + } + ], + "range": [ + 55, + 75 + ], + "loc": { + "start": { + "line": 1, + "column": 55 + }, + "end": { + "line": 1, + "column": 75 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 47, + 75 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 75 + } + } + }, + "kind": "set", + "method": false, + "shorthand": false, + "range": [ + 38, + 75 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 75 + } + } + } + ], + "range": [ + 4, + 77 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 77 + } + } + }, + "range": [ + 0, + 77 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 77 + } + } + }, + "range": [ + 0, + 77 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 77 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "get", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "width", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 20, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "m_width", + "range": [ + 27, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Identifier", + "value": "set", + "range": [ + 38, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + { + "type": "Identifier", + "value": "width", + "range": [ + 42, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 47 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + { + "type": "Identifier", + "value": "width", + "range": [ + 48, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 53 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 54 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 55 + }, + "end": { + "line": 1, + "column": 56 + } + } + }, + { + "type": "Identifier", + "value": "m_width", + "range": [ + 57, + 64 + ], + "loc": { + "start": { + "line": 1, + "column": 57 + }, + "end": { + "line": 1, + "column": 64 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 65, + 66 + ], + "loc": { + "start": { + "line": 1, + "column": 65 + }, + "end": { + "line": 1, + "column": 66 + } + } + }, + { + "type": "Identifier", + "value": "width", + "range": [ + 67, + 72 + ], + "loc": { + "start": { + "line": 1, + "column": 67 + }, + "end": { + "line": 1, + "column": 72 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 72, + 73 + ], + "loc": { + "start": { + "line": 1, + "column": 72 + }, + "end": { + "line": 1, + "column": 73 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 74, + 75 + ], + "loc": { + "start": { + "line": 1, + "column": 74 + }, + "end": { + "line": 1, + "column": 75 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 76, + 77 + ], + "loc": { + "start": { + "line": 1, + "column": 76 + }, + "end": { + "line": 1, + "column": 77 + } + } + } + ], + "range": [ + 0, + 77 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 77 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0029.js b/lib/test/esprima/expression/primary/object/migrated_0029.js new file mode 100644 index 0000000..485ec58 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0029.js @@ -0,0 +1 @@ +({ get i() { }, i: 42 }) \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0029.tree.json b/lib/test/esprima/expression/primary/object/migrated_0029.tree.json new file mode 100644 index 0000000..e5136df --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0029.tree.json @@ -0,0 +1,446 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "i", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 8, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "kind": "get", + "method": false, + "shorthand": false, + "range": [ + 3, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "i", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "computed": false, + "value": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 19, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 1, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "get", + "range": [ + 3, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "i", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "i", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 19, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0030.js b/lib/test/esprima/expression/primary/object/migrated_0030.js new file mode 100644 index 0000000..77c8fde --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0030.js @@ -0,0 +1 @@ +"use strict";x={y:1,y:1} \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0030.tree.json b/lib/test/esprima/expression/primary/object/migrated_0030.tree.json new file mode 100644 index 0000000..0a59f26 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0030.tree.json @@ -0,0 +1,482 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "directive": "use strict", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "y", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "computed": false, + "value": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 16, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "y", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "computed": false, + "value": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 20, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 15, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "range": [ + 13, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "range": [ + 13, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "sourceType": "script", + "comments": [], + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0031.js b/lib/test/esprima/expression/primary/object/migrated_0031.js new file mode 100644 index 0000000..eefc56a --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0031.js @@ -0,0 +1 @@ +"use strict"; var x = { get i() {}, get i() {} } \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0031.tree.json b/lib/test/esprima/expression/primary/object/migrated_0031.tree.json new file mode 100644 index 0000000..822763b --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0031.tree.json @@ -0,0 +1,650 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "directive": "use strict", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "init": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "i", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 32, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 29, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "kind": "get", + "method": false, + "shorthand": false, + "range": [ + 24, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "i", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 44, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 41, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "kind": "get", + "method": false, + "shorthand": false, + "range": [ + 36, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 46 + } + } + } + ], + "range": [ + 22, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + "range": [ + 18, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 48 + } + } + } + ], + "kind": "var", + "range": [ + 14, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 48 + } + } + } + ], + "sourceType": "script", + "comments": [], + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "get", + "range": [ + 24, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Identifier", + "value": "i", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Identifier", + "value": "get", + "range": [ + 36, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Identifier", + "value": "i", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + } + } + ], + "range": [ + 0, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0032.js b/lib/test/esprima/expression/primary/object/migrated_0032.js new file mode 100644 index 0000000..74514c2 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0032.js @@ -0,0 +1 @@ +"use strict"; var x = { i: 42, get i() {} } \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0032.tree.json b/lib/test/esprima/expression/primary/object/migrated_0032.tree.json new file mode 100644 index 0000000..33b4b19 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0032.tree.json @@ -0,0 +1,576 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "directive": "use strict", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "init": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "i", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "computed": false, + "value": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 27, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "i", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 39, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 36, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "kind": "get", + "method": false, + "shorthand": false, + "range": [ + 31, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 41 + } + } + } + ], + "range": [ + 22, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + "range": [ + 18, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 43 + } + } + } + ], + "kind": "var", + "range": [ + 14, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 43 + } + } + } + ], + "sourceType": "script", + "comments": [], + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "i", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 27, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Identifier", + "value": "get", + "range": [ + 31, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Identifier", + "value": "i", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + } + } + } + ], + "range": [ + 0, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0033.js b/lib/test/esprima/expression/primary/object/migrated_0033.js new file mode 100644 index 0000000..7e54c3e --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0033.js @@ -0,0 +1 @@ +"use strict"; var x = { set i(x) {}, i: 42 } \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0033.tree.json b/lib/test/esprima/expression/primary/object/migrated_0033.tree.json new file mode 100644 index 0000000..969da74 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0033.tree.json @@ -0,0 +1,613 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "directive": "use strict", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "init": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "i", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 33, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 29, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + "kind": "set", + "method": false, + "shorthand": false, + "range": [ + 24, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "i", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "computed": false, + "value": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 40, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 37, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 42 + } + } + } + ], + "range": [ + 22, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + "range": [ + 18, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 44 + } + } + } + ], + "kind": "var", + "range": [ + 14, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 44 + } + } + } + ], + "sourceType": "script", + "comments": [], + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "set", + "range": [ + 24, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Identifier", + "value": "i", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Identifier", + "value": "i", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 40, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 44 + } + } + } + ], + "range": [ + 0, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0034.js b/lib/test/esprima/expression/primary/object/migrated_0034.js new file mode 100644 index 0000000..dc29fd9 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0034.js @@ -0,0 +1 @@ +({[a](){}}) \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0034.tree.json b/lib/test/esprima/expression/primary/object/migrated_0034.tree.json new file mode 100644 index 0000000..a57fd38 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0034.tree.json @@ -0,0 +1,334 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "computed": true, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 5, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "kind": "init", + "method": true, + "shorthand": false, + "range": [ + 2, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 1, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0035.js b/lib/test/esprima/expression/primary/object/migrated_0035.js new file mode 100644 index 0000000..1f56c40 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0035.js @@ -0,0 +1 @@ +({[a]:()=>{}}) \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0035.tree.json b/lib/test/esprima/expression/primary/object/migrated_0035.tree.json new file mode 100644 index 0000000..c1f0298 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0035.tree.json @@ -0,0 +1,370 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "computed": true, + "value": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 6, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 2, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "range": [ + 1, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0036.js b/lib/test/esprima/expression/primary/object/migrated_0036.js new file mode 100644 index 0000000..a086e03 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0036.js @@ -0,0 +1 @@ +({["__proto__"]:0, ["__proto__"]:0}) \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0036.tree.json b/lib/test/esprima/expression/primary/object/migrated_0036.tree.json new file mode 100644 index 0000000..5a78b90 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0036.tree.json @@ -0,0 +1,446 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Literal", + "value": "__proto__", + "raw": "\"__proto__\"", + "range": [ + 3, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "computed": true, + "value": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 2, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Property", + "key": { + "type": "Literal", + "value": "__proto__", + "raw": "\"__proto__\"", + "range": [ + 20, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "computed": true, + "value": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 19, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "range": [ + 1, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "String", + "value": "\"__proto__\"", + "range": [ + 3, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "String", + "value": "\"__proto__\"", + "range": [ + 20, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0037.js b/lib/test/esprima/expression/primary/object/migrated_0037.js new file mode 100644 index 0000000..5333738 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0037.js @@ -0,0 +1 @@ +({"[": 42}) \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0037.tree.json b/lib/test/esprima/expression/primary/object/migrated_0037.tree.json new file mode 100644 index 0000000..180982a --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0037.tree.json @@ -0,0 +1,243 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Literal", + "value": "[", + "raw": "\"[\"", + "range": [ + 2, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "computed": false, + "value": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 2, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 1, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "String", + "value": "\"[\"", + "range": [ + 2, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } +} diff --git a/lib/test/esprima/expression/primary/object/migrated_0038.js b/lib/test/esprima/expression/primary/object/migrated_0038.js new file mode 100644 index 0000000..1f93bdb --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0038.js @@ -0,0 +1 @@ +({set x(a=0){}}) \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/object/migrated_0038.tree.json b/lib/test/esprima/expression/primary/object/migrated_0038.tree.json new file mode 100644 index 0000000..6c63835 --- /dev/null +++ b/lib/test/esprima/expression/primary/object/migrated_0038.tree.json @@ -0,0 +1,425 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "AssignmentPattern", + "left": { + "type": "Identifier", + "name": "a", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "right": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 7, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "kind": "set", + "method": false, + "shorthand": false, + "range": [ + 2, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "range": [ + 1, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "set", + "range": [ + 2, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ] +} \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/other/migrated_0000.js b/lib/test/esprima/expression/primary/other/migrated_0000.js new file mode 100644 index 0000000..9ecf3cf --- /dev/null +++ b/lib/test/esprima/expression/primary/other/migrated_0000.js @@ -0,0 +1 @@ +this diff --git a/lib/test/esprima/expression/primary/other/migrated_0000.tree.json b/lib/test/esprima/expression/primary/other/migrated_0000.tree.json new file mode 100644 index 0000000..4c47e1e --- /dev/null +++ b/lib/test/esprima/expression/primary/other/migrated_0000.tree.json @@ -0,0 +1,74 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ThisExpression", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "this", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } +} diff --git a/lib/test/esprima/expression/primary/other/migrated_0001.js b/lib/test/esprima/expression/primary/other/migrated_0001.js new file mode 100644 index 0000000..19765bd --- /dev/null +++ b/lib/test/esprima/expression/primary/other/migrated_0001.js @@ -0,0 +1 @@ +null diff --git a/lib/test/esprima/expression/primary/other/migrated_0001.tree.json b/lib/test/esprima/expression/primary/other/migrated_0001.tree.json new file mode 100644 index 0000000..a1f2c70 --- /dev/null +++ b/lib/test/esprima/expression/primary/other/migrated_0001.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Null", + "value": "null", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } +} diff --git a/lib/test/esprima/expression/primary/other/migrated_0002.js b/lib/test/esprima/expression/primary/other/migrated_0002.js new file mode 100644 index 0000000..aa5dcab --- /dev/null +++ b/lib/test/esprima/expression/primary/other/migrated_0002.js @@ -0,0 +1,3 @@ + + 42 + diff --git a/lib/test/esprima/expression/primary/other/migrated_0002.tree.json b/lib/test/esprima/expression/primary/other/migrated_0002.tree.json new file mode 100644 index 0000000..beaaa9e --- /dev/null +++ b/lib/test/esprima/expression/primary/other/migrated_0002.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "42", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + ], + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + } +} diff --git a/lib/test/esprima/expression/primary/other/migrated_0003.js b/lib/test/esprima/expression/primary/other/migrated_0003.js new file mode 100644 index 0000000..7000f9b --- /dev/null +++ b/lib/test/esprima/expression/primary/other/migrated_0003.js @@ -0,0 +1 @@ +(1 + 2 ) * 3 \ No newline at end of file diff --git a/lib/test/esprima/expression/primary/other/migrated_0003.tree.json b/lib/test/esprima/expression/primary/other/migrated_0003.tree.json new file mode 100644 index 0000000..33855cc --- /dev/null +++ b/lib/test/esprima/expression/primary/other/migrated_0003.tree.json @@ -0,0 +1,258 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "*", + "left": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "right": { + "type": "Literal", + "value": 2, + "raw": "2", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 1, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "right": { + "type": "Literal", + "value": 3, + "raw": "3", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Numeric", + "value": "3", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } +} diff --git a/lib/test/esprima/expression/relational/migrated_0000.js b/lib/test/esprima/expression/relational/migrated_0000.js new file mode 100644 index 0000000..2a585b8 --- /dev/null +++ b/lib/test/esprima/expression/relational/migrated_0000.js @@ -0,0 +1 @@ +x < y \ No newline at end of file diff --git a/lib/test/esprima/expression/relational/migrated_0000.tree.json b/lib/test/esprima/expression/relational/migrated_0000.tree.json new file mode 100644 index 0000000..5d1d0a1 --- /dev/null +++ b/lib/test/esprima/expression/relational/migrated_0000.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "<", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } +} diff --git a/lib/test/esprima/expression/relational/migrated_0001.js b/lib/test/esprima/expression/relational/migrated_0001.js new file mode 100644 index 0000000..c231f12 --- /dev/null +++ b/lib/test/esprima/expression/relational/migrated_0001.js @@ -0,0 +1 @@ +x > y \ No newline at end of file diff --git a/lib/test/esprima/expression/relational/migrated_0001.tree.json b/lib/test/esprima/expression/relational/migrated_0001.tree.json new file mode 100644 index 0000000..74e289f --- /dev/null +++ b/lib/test/esprima/expression/relational/migrated_0001.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": ">", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } +} diff --git a/lib/test/esprima/expression/relational/migrated_0002.js b/lib/test/esprima/expression/relational/migrated_0002.js new file mode 100644 index 0000000..2b216c2 --- /dev/null +++ b/lib/test/esprima/expression/relational/migrated_0002.js @@ -0,0 +1 @@ +x <= y \ No newline at end of file diff --git a/lib/test/esprima/expression/relational/migrated_0002.tree.json b/lib/test/esprima/expression/relational/migrated_0002.tree.json new file mode 100644 index 0000000..76b3ea9 --- /dev/null +++ b/lib/test/esprima/expression/relational/migrated_0002.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "<=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<=", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } +} diff --git a/lib/test/esprima/expression/relational/migrated_0003.js b/lib/test/esprima/expression/relational/migrated_0003.js new file mode 100644 index 0000000..491e7fe --- /dev/null +++ b/lib/test/esprima/expression/relational/migrated_0003.js @@ -0,0 +1 @@ +x >= y \ No newline at end of file diff --git a/lib/test/esprima/expression/relational/migrated_0003.tree.json b/lib/test/esprima/expression/relational/migrated_0003.tree.json new file mode 100644 index 0000000..dad924b --- /dev/null +++ b/lib/test/esprima/expression/relational/migrated_0003.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": ">=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": ">=", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } +} diff --git a/lib/test/esprima/expression/relational/migrated_0004.js b/lib/test/esprima/expression/relational/migrated_0004.js new file mode 100644 index 0000000..9d2a513 --- /dev/null +++ b/lib/test/esprima/expression/relational/migrated_0004.js @@ -0,0 +1 @@ +x in y \ No newline at end of file diff --git a/lib/test/esprima/expression/relational/migrated_0004.tree.json b/lib/test/esprima/expression/relational/migrated_0004.tree.json new file mode 100644 index 0000000..38ca1e3 --- /dev/null +++ b/lib/test/esprima/expression/relational/migrated_0004.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "in", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "in", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } +} diff --git a/lib/test/esprima/expression/relational/migrated_0005.js b/lib/test/esprima/expression/relational/migrated_0005.js new file mode 100644 index 0000000..9b2d626 --- /dev/null +++ b/lib/test/esprima/expression/relational/migrated_0005.js @@ -0,0 +1 @@ +x instanceof y \ No newline at end of file diff --git a/lib/test/esprima/expression/relational/migrated_0005.tree.json b/lib/test/esprima/expression/relational/migrated_0005.tree.json new file mode 100644 index 0000000..9698d7c --- /dev/null +++ b/lib/test/esprima/expression/relational/migrated_0005.tree.json @@ -0,0 +1,147 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "instanceof", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "instanceof", + "range": [ + 2, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } +} diff --git a/lib/test/esprima/expression/relational/migrated_0006.js b/lib/test/esprima/expression/relational/migrated_0006.js new file mode 100644 index 0000000..48f0852 --- /dev/null +++ b/lib/test/esprima/expression/relational/migrated_0006.js @@ -0,0 +1 @@ +x < y < z \ No newline at end of file diff --git a/lib/test/esprima/expression/relational/migrated_0006.tree.json b/lib/test/esprima/expression/relational/migrated_0006.tree.json new file mode 100644 index 0000000..c247436 --- /dev/null +++ b/lib/test/esprima/expression/relational/migrated_0006.tree.json @@ -0,0 +1,219 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "<", + "left": { + "type": "BinaryExpression", + "operator": "<", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } +} diff --git a/lib/test/esprima/expression/unary/migrated_0000.js b/lib/test/esprima/expression/unary/migrated_0000.js new file mode 100644 index 0000000..76eaf4c --- /dev/null +++ b/lib/test/esprima/expression/unary/migrated_0000.js @@ -0,0 +1 @@ +++x \ No newline at end of file diff --git a/lib/test/esprima/expression/unary/migrated_0000.tree.json b/lib/test/esprima/expression/unary/migrated_0000.tree.json new file mode 100644 index 0000000..fb68fc3 --- /dev/null +++ b/lib/test/esprima/expression/unary/migrated_0000.tree.json @@ -0,0 +1,112 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "++", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "prefix": true, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "++", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } +} diff --git a/lib/test/esprima/expression/unary/migrated_0001.js b/lib/test/esprima/expression/unary/migrated_0001.js new file mode 100644 index 0000000..39fec25 --- /dev/null +++ b/lib/test/esprima/expression/unary/migrated_0001.js @@ -0,0 +1 @@ +--x \ No newline at end of file diff --git a/lib/test/esprima/expression/unary/migrated_0001.tree.json b/lib/test/esprima/expression/unary/migrated_0001.tree.json new file mode 100644 index 0000000..8b0ea6a --- /dev/null +++ b/lib/test/esprima/expression/unary/migrated_0001.tree.json @@ -0,0 +1,112 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "--", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "prefix": true, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "--", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } +} diff --git a/lib/test/esprima/expression/unary/migrated_0002.js b/lib/test/esprima/expression/unary/migrated_0002.js new file mode 100644 index 0000000..afae5bb --- /dev/null +++ b/lib/test/esprima/expression/unary/migrated_0002.js @@ -0,0 +1 @@ +++eval \ No newline at end of file diff --git a/lib/test/esprima/expression/unary/migrated_0002.tree.json b/lib/test/esprima/expression/unary/migrated_0002.tree.json new file mode 100644 index 0000000..873fc90 --- /dev/null +++ b/lib/test/esprima/expression/unary/migrated_0002.tree.json @@ -0,0 +1,112 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "++", + "argument": { + "type": "Identifier", + "name": "eval", + "range": [ + 2, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "prefix": true, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "++", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "eval", + "range": [ + 2, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } +} diff --git a/lib/test/esprima/expression/unary/migrated_0003.js b/lib/test/esprima/expression/unary/migrated_0003.js new file mode 100644 index 0000000..2d4178c --- /dev/null +++ b/lib/test/esprima/expression/unary/migrated_0003.js @@ -0,0 +1 @@ +--eval \ No newline at end of file diff --git a/lib/test/esprima/expression/unary/migrated_0003.tree.json b/lib/test/esprima/expression/unary/migrated_0003.tree.json new file mode 100644 index 0000000..07574c7 --- /dev/null +++ b/lib/test/esprima/expression/unary/migrated_0003.tree.json @@ -0,0 +1,112 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "--", + "argument": { + "type": "Identifier", + "name": "eval", + "range": [ + 2, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "prefix": true, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "--", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "eval", + "range": [ + 2, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } +} diff --git a/lib/test/esprima/expression/unary/migrated_0004.js b/lib/test/esprima/expression/unary/migrated_0004.js new file mode 100644 index 0000000..df35d14 --- /dev/null +++ b/lib/test/esprima/expression/unary/migrated_0004.js @@ -0,0 +1 @@ +++arguments \ No newline at end of file diff --git a/lib/test/esprima/expression/unary/migrated_0004.tree.json b/lib/test/esprima/expression/unary/migrated_0004.tree.json new file mode 100644 index 0000000..d994b0f --- /dev/null +++ b/lib/test/esprima/expression/unary/migrated_0004.tree.json @@ -0,0 +1,112 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "++", + "argument": { + "type": "Identifier", + "name": "arguments", + "range": [ + 2, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "prefix": true, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "++", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "arguments", + "range": [ + 2, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } +} diff --git a/lib/test/esprima/expression/unary/migrated_0005.js b/lib/test/esprima/expression/unary/migrated_0005.js new file mode 100644 index 0000000..f4b69ca --- /dev/null +++ b/lib/test/esprima/expression/unary/migrated_0005.js @@ -0,0 +1 @@ +--arguments \ No newline at end of file diff --git a/lib/test/esprima/expression/unary/migrated_0005.tree.json b/lib/test/esprima/expression/unary/migrated_0005.tree.json new file mode 100644 index 0000000..3d2e219 --- /dev/null +++ b/lib/test/esprima/expression/unary/migrated_0005.tree.json @@ -0,0 +1,112 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "--", + "argument": { + "type": "Identifier", + "name": "arguments", + "range": [ + 2, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "prefix": true, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "--", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "arguments", + "range": [ + 2, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } +} diff --git a/lib/test/esprima/expression/unary/migrated_0006.js b/lib/test/esprima/expression/unary/migrated_0006.js new file mode 100644 index 0000000..46b9f7f --- /dev/null +++ b/lib/test/esprima/expression/unary/migrated_0006.js @@ -0,0 +1 @@ ++x \ No newline at end of file diff --git a/lib/test/esprima/expression/unary/migrated_0006.tree.json b/lib/test/esprima/expression/unary/migrated_0006.tree.json new file mode 100644 index 0000000..54f4ae7 --- /dev/null +++ b/lib/test/esprima/expression/unary/migrated_0006.tree.json @@ -0,0 +1,112 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "UnaryExpression", + "operator": "+", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "prefix": true, + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "+", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ], + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } +} diff --git a/lib/test/esprima/expression/unary/migrated_0007.js b/lib/test/esprima/expression/unary/migrated_0007.js new file mode 100644 index 0000000..e1c1426 --- /dev/null +++ b/lib/test/esprima/expression/unary/migrated_0007.js @@ -0,0 +1 @@ +-x \ No newline at end of file diff --git a/lib/test/esprima/expression/unary/migrated_0007.tree.json b/lib/test/esprima/expression/unary/migrated_0007.tree.json new file mode 100644 index 0000000..f73edac --- /dev/null +++ b/lib/test/esprima/expression/unary/migrated_0007.tree.json @@ -0,0 +1,112 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "UnaryExpression", + "operator": "-", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "prefix": true, + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "-", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ], + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } +} diff --git a/lib/test/esprima/expression/unary/migrated_0008.js b/lib/test/esprima/expression/unary/migrated_0008.js new file mode 100644 index 0000000..edbe207 --- /dev/null +++ b/lib/test/esprima/expression/unary/migrated_0008.js @@ -0,0 +1 @@ +~x \ No newline at end of file diff --git a/lib/test/esprima/expression/unary/migrated_0008.tree.json b/lib/test/esprima/expression/unary/migrated_0008.tree.json new file mode 100644 index 0000000..6a78d91 --- /dev/null +++ b/lib/test/esprima/expression/unary/migrated_0008.tree.json @@ -0,0 +1,112 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "UnaryExpression", + "operator": "~", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "prefix": true, + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "~", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ], + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } +} diff --git a/lib/test/esprima/expression/unary/migrated_0009.js b/lib/test/esprima/expression/unary/migrated_0009.js new file mode 100644 index 0000000..252b5dd --- /dev/null +++ b/lib/test/esprima/expression/unary/migrated_0009.js @@ -0,0 +1 @@ +!x \ No newline at end of file diff --git a/lib/test/esprima/expression/unary/migrated_0009.tree.json b/lib/test/esprima/expression/unary/migrated_0009.tree.json new file mode 100644 index 0000000..1c9af9e --- /dev/null +++ b/lib/test/esprima/expression/unary/migrated_0009.tree.json @@ -0,0 +1,112 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "UnaryExpression", + "operator": "!", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "prefix": true, + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "!", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ], + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } +} diff --git a/lib/test/esprima/expression/unary/migrated_0010.js b/lib/test/esprima/expression/unary/migrated_0010.js new file mode 100644 index 0000000..d37d4c1 --- /dev/null +++ b/lib/test/esprima/expression/unary/migrated_0010.js @@ -0,0 +1 @@ +void x \ No newline at end of file diff --git a/lib/test/esprima/expression/unary/migrated_0010.tree.json b/lib/test/esprima/expression/unary/migrated_0010.tree.json new file mode 100644 index 0000000..ab8a53d --- /dev/null +++ b/lib/test/esprima/expression/unary/migrated_0010.tree.json @@ -0,0 +1,112 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "UnaryExpression", + "operator": "void", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "prefix": true, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "void", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } +} diff --git a/lib/test/esprima/expression/unary/migrated_0011.js b/lib/test/esprima/expression/unary/migrated_0011.js new file mode 100644 index 0000000..5209804 --- /dev/null +++ b/lib/test/esprima/expression/unary/migrated_0011.js @@ -0,0 +1 @@ +delete x \ No newline at end of file diff --git a/lib/test/esprima/expression/unary/migrated_0011.tree.json b/lib/test/esprima/expression/unary/migrated_0011.tree.json new file mode 100644 index 0000000..b23d8f1 --- /dev/null +++ b/lib/test/esprima/expression/unary/migrated_0011.tree.json @@ -0,0 +1,112 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "UnaryExpression", + "operator": "delete", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "prefix": true, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "delete", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } +} diff --git a/lib/test/esprima/expression/unary/migrated_0012.js b/lib/test/esprima/expression/unary/migrated_0012.js new file mode 100644 index 0000000..8b9e2be --- /dev/null +++ b/lib/test/esprima/expression/unary/migrated_0012.js @@ -0,0 +1 @@ +typeof x \ No newline at end of file diff --git a/lib/test/esprima/expression/unary/migrated_0012.tree.json b/lib/test/esprima/expression/unary/migrated_0012.tree.json new file mode 100644 index 0000000..140b023 --- /dev/null +++ b/lib/test/esprima/expression/unary/migrated_0012.tree.json @@ -0,0 +1,112 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "UnaryExpression", + "operator": "typeof", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "prefix": true, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "typeof", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } +} diff --git a/lib/test/esprima/invalid-syntax/GH-1106-00.failure.json b/lib/test/esprima/invalid-syntax/GH-1106-00.failure.json new file mode 100644 index 0000000..a86d2c6 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/GH-1106-00.failure.json @@ -0,0 +1,6 @@ +{ + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} diff --git a/lib/test/esprima/invalid-syntax/GH-1106-00.js b/lib/test/esprima/invalid-syntax/GH-1106-00.js new file mode 100644 index 0000000..5a64203 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/GH-1106-00.js @@ -0,0 +1 @@ +"\x"; diff --git a/lib/test/esprima/invalid-syntax/GH-1106-01.failure.json b/lib/test/esprima/invalid-syntax/GH-1106-01.failure.json new file mode 100644 index 0000000..37b15ef --- /dev/null +++ b/lib/test/esprima/invalid-syntax/GH-1106-01.failure.json @@ -0,0 +1,6 @@ +{ + "index": 4, + "lineNumber": 1, + "column": 5, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} diff --git a/lib/test/esprima/invalid-syntax/GH-1106-01.js b/lib/test/esprima/invalid-syntax/GH-1106-01.js new file mode 100644 index 0000000..fdf6b4f --- /dev/null +++ b/lib/test/esprima/invalid-syntax/GH-1106-01.js @@ -0,0 +1 @@ +"\x0"; diff --git a/lib/test/esprima/invalid-syntax/GH-1106-02.failure.json b/lib/test/esprima/invalid-syntax/GH-1106-02.failure.json new file mode 100644 index 0000000..a86d2c6 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/GH-1106-02.failure.json @@ -0,0 +1,6 @@ +{ + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} diff --git a/lib/test/esprima/invalid-syntax/GH-1106-02.js b/lib/test/esprima/invalid-syntax/GH-1106-02.js new file mode 100644 index 0000000..ce2c7df --- /dev/null +++ b/lib/test/esprima/invalid-syntax/GH-1106-02.js @@ -0,0 +1 @@ +"\xx"; diff --git a/lib/test/esprima/invalid-syntax/GH-1106-03.failure.json b/lib/test/esprima/invalid-syntax/GH-1106-03.failure.json new file mode 100644 index 0000000..a86d2c6 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/GH-1106-03.failure.json @@ -0,0 +1,6 @@ +{ + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} diff --git a/lib/test/esprima/invalid-syntax/GH-1106-03.js b/lib/test/esprima/invalid-syntax/GH-1106-03.js new file mode 100644 index 0000000..8f04b77 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/GH-1106-03.js @@ -0,0 +1 @@ +"\u"; diff --git a/lib/test/esprima/invalid-syntax/GH-1106-04.failure.json b/lib/test/esprima/invalid-syntax/GH-1106-04.failure.json new file mode 100644 index 0000000..37b15ef --- /dev/null +++ b/lib/test/esprima/invalid-syntax/GH-1106-04.failure.json @@ -0,0 +1,6 @@ +{ + "index": 4, + "lineNumber": 1, + "column": 5, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} diff --git a/lib/test/esprima/invalid-syntax/GH-1106-04.js b/lib/test/esprima/invalid-syntax/GH-1106-04.js new file mode 100644 index 0000000..422fe60 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/GH-1106-04.js @@ -0,0 +1 @@ +"\u0"; diff --git a/lib/test/esprima/invalid-syntax/GH-1106-05.failure.json b/lib/test/esprima/invalid-syntax/GH-1106-05.failure.json new file mode 100644 index 0000000..a86d2c6 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/GH-1106-05.failure.json @@ -0,0 +1,6 @@ +{ + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} diff --git a/lib/test/esprima/invalid-syntax/GH-1106-05.js b/lib/test/esprima/invalid-syntax/GH-1106-05.js new file mode 100644 index 0000000..0e0fb8f --- /dev/null +++ b/lib/test/esprima/invalid-syntax/GH-1106-05.js @@ -0,0 +1 @@ +"\ux"; diff --git a/lib/test/esprima/invalid-syntax/GH-1106-06.failure.json b/lib/test/esprima/invalid-syntax/GH-1106-06.failure.json new file mode 100644 index 0000000..9dd83b9 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/GH-1106-06.failure.json @@ -0,0 +1,6 @@ +{ + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} diff --git a/lib/test/esprima/invalid-syntax/GH-1106-06.js b/lib/test/esprima/invalid-syntax/GH-1106-06.js new file mode 100644 index 0000000..e9a8c01 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/GH-1106-06.js @@ -0,0 +1 @@ +"\u00"; diff --git a/lib/test/esprima/invalid-syntax/GH-1106-07.failure.json b/lib/test/esprima/invalid-syntax/GH-1106-07.failure.json new file mode 100644 index 0000000..92cc6ac --- /dev/null +++ b/lib/test/esprima/invalid-syntax/GH-1106-07.failure.json @@ -0,0 +1,6 @@ +{ + "index": 6, + "lineNumber": 1, + "column": 7, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} diff --git a/lib/test/esprima/invalid-syntax/GH-1106-07.js b/lib/test/esprima/invalid-syntax/GH-1106-07.js new file mode 100644 index 0000000..b77b4ff --- /dev/null +++ b/lib/test/esprima/invalid-syntax/GH-1106-07.js @@ -0,0 +1 @@ +"\u000"; diff --git a/lib/test/esprima/invalid-syntax/GH-1106-08.failure.json b/lib/test/esprima/invalid-syntax/GH-1106-08.failure.json new file mode 100644 index 0000000..a86d2c6 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/GH-1106-08.failure.json @@ -0,0 +1,6 @@ +{ + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} diff --git a/lib/test/esprima/invalid-syntax/GH-1106-08.js b/lib/test/esprima/invalid-syntax/GH-1106-08.js new file mode 100644 index 0000000..a8293fe --- /dev/null +++ b/lib/test/esprima/invalid-syntax/GH-1106-08.js @@ -0,0 +1 @@ +"\8"; diff --git a/lib/test/esprima/invalid-syntax/GH-1106-09.failure.json b/lib/test/esprima/invalid-syntax/GH-1106-09.failure.json new file mode 100644 index 0000000..a86d2c6 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/GH-1106-09.failure.json @@ -0,0 +1,6 @@ +{ + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} diff --git a/lib/test/esprima/invalid-syntax/GH-1106-09.js b/lib/test/esprima/invalid-syntax/GH-1106-09.js new file mode 100644 index 0000000..a29592d --- /dev/null +++ b/lib/test/esprima/invalid-syntax/GH-1106-09.js @@ -0,0 +1 @@ +"\9"; diff --git a/lib/test/esprima/invalid-syntax/migrated_0000.failure.json b/lib/test/esprima/invalid-syntax/migrated_0000.failure.json new file mode 100644 index 0000000..a8ad27f --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0000.failure.json @@ -0,0 +1,6 @@ +{ + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Error: Line 1: Unexpected end of input" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0000.js b/lib/test/esprima/invalid-syntax/migrated_0000.js new file mode 100644 index 0000000..81750b9 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0000.js @@ -0,0 +1 @@ +{ \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0001.failure.json b/lib/test/esprima/invalid-syntax/migrated_0001.failure.json new file mode 100644 index 0000000..06ff70d --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0001.failure.json @@ -0,0 +1,6 @@ +{ + "index": 0, + "lineNumber": 1, + "column": 1, + "message": "Error: Line 1: Unexpected token }" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0001.js b/lib/test/esprima/invalid-syntax/migrated_0001.js new file mode 100644 index 0000000..ff30235 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0001.js @@ -0,0 +1 @@ +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0002.failure.json b/lib/test/esprima/invalid-syntax/migrated_0002.failure.json new file mode 100644 index 0000000..9a84332 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0002.failure.json @@ -0,0 +1,6 @@ +{ + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0002.js b/lib/test/esprima/invalid-syntax/migrated_0002.js new file mode 100644 index 0000000..74f6857 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0002.js @@ -0,0 +1 @@ +3ea \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0003.failure.json b/lib/test/esprima/invalid-syntax/migrated_0003.failure.json new file mode 100644 index 0000000..b966e10 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0003.failure.json @@ -0,0 +1,6 @@ +{ + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0003.js b/lib/test/esprima/invalid-syntax/migrated_0003.js new file mode 100644 index 0000000..d72fce0 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0003.js @@ -0,0 +1 @@ +3in [] \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0004.failure.json b/lib/test/esprima/invalid-syntax/migrated_0004.failure.json new file mode 100644 index 0000000..9a84332 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0004.failure.json @@ -0,0 +1,6 @@ +{ + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0004.js b/lib/test/esprima/invalid-syntax/migrated_0004.js new file mode 100644 index 0000000..42bd7f5 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0004.js @@ -0,0 +1 @@ +3e \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0005.failure.json b/lib/test/esprima/invalid-syntax/migrated_0005.failure.json new file mode 100644 index 0000000..e026030 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0005.failure.json @@ -0,0 +1,6 @@ +{ + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0005.js b/lib/test/esprima/invalid-syntax/migrated_0005.js new file mode 100644 index 0000000..587c307 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0005.js @@ -0,0 +1 @@ +3e+ \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0006.failure.json b/lib/test/esprima/invalid-syntax/migrated_0006.failure.json new file mode 100644 index 0000000..e026030 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0006.failure.json @@ -0,0 +1,6 @@ +{ + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0006.js b/lib/test/esprima/invalid-syntax/migrated_0006.js new file mode 100644 index 0000000..5af2393 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0006.js @@ -0,0 +1 @@ +3e- \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0007.failure.json b/lib/test/esprima/invalid-syntax/migrated_0007.failure.json new file mode 100644 index 0000000..b966e10 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0007.failure.json @@ -0,0 +1,6 @@ +{ + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0007.js b/lib/test/esprima/invalid-syntax/migrated_0007.js new file mode 100644 index 0000000..ccd6e88 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0007.js @@ -0,0 +1 @@ +3x \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0008.failure.json b/lib/test/esprima/invalid-syntax/migrated_0008.failure.json new file mode 100644 index 0000000..b966e10 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0008.failure.json @@ -0,0 +1,6 @@ +{ + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0008.js b/lib/test/esprima/invalid-syntax/migrated_0008.js new file mode 100644 index 0000000..2c08018 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0008.js @@ -0,0 +1 @@ +3x0 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0009.failure.json b/lib/test/esprima/invalid-syntax/migrated_0009.failure.json new file mode 100644 index 0000000..9a84332 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0009.failure.json @@ -0,0 +1,6 @@ +{ + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0009.js b/lib/test/esprima/invalid-syntax/migrated_0009.js new file mode 100644 index 0000000..99e07d0 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0009.js @@ -0,0 +1 @@ +0x \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0010.failure.json b/lib/test/esprima/invalid-syntax/migrated_0010.failure.json new file mode 100644 index 0000000..9a84332 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0010.failure.json @@ -0,0 +1,6 @@ +{ + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0010.js b/lib/test/esprima/invalid-syntax/migrated_0010.js new file mode 100644 index 0000000..adc4228 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0010.js @@ -0,0 +1 @@ +01a \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0011.failure.json b/lib/test/esprima/invalid-syntax/migrated_0011.failure.json new file mode 100644 index 0000000..e026030 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0011.failure.json @@ -0,0 +1,6 @@ +{ + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0011.js b/lib/test/esprima/invalid-syntax/migrated_0011.js new file mode 100644 index 0000000..1bd0a8f --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0011.js @@ -0,0 +1 @@ +0o1a \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0012.failure.json b/lib/test/esprima/invalid-syntax/migrated_0012.failure.json new file mode 100644 index 0000000..9a84332 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0012.failure.json @@ -0,0 +1,6 @@ +{ + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0012.js b/lib/test/esprima/invalid-syntax/migrated_0012.js new file mode 100644 index 0000000..a25b980 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0012.js @@ -0,0 +1 @@ +0o \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0013.failure.json b/lib/test/esprima/invalid-syntax/migrated_0013.failure.json new file mode 100644 index 0000000..9a84332 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0013.failure.json @@ -0,0 +1,6 @@ +{ + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0013.js b/lib/test/esprima/invalid-syntax/migrated_0013.js new file mode 100644 index 0000000..69acded --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0013.js @@ -0,0 +1 @@ +0O \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0014.failure.json b/lib/test/esprima/invalid-syntax/migrated_0014.failure.json new file mode 100644 index 0000000..9a84332 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0014.failure.json @@ -0,0 +1,6 @@ +{ + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0014.js b/lib/test/esprima/invalid-syntax/migrated_0014.js new file mode 100644 index 0000000..8b5d41d --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0014.js @@ -0,0 +1 @@ +0o9 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0015.failure.json b/lib/test/esprima/invalid-syntax/migrated_0015.failure.json new file mode 100644 index 0000000..e026030 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0015.failure.json @@ -0,0 +1,6 @@ +{ + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0015.js b/lib/test/esprima/invalid-syntax/migrated_0015.js new file mode 100644 index 0000000..18131ad --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0015.js @@ -0,0 +1 @@ +0o18 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0016.failure.json b/lib/test/esprima/invalid-syntax/migrated_0016.failure.json new file mode 100644 index 0000000..e026030 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0016.failure.json @@ -0,0 +1,6 @@ +{ + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0016.js b/lib/test/esprima/invalid-syntax/migrated_0016.js new file mode 100644 index 0000000..c7dc199 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0016.js @@ -0,0 +1 @@ +0O1a \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0017.failure.json b/lib/test/esprima/invalid-syntax/migrated_0017.failure.json new file mode 100644 index 0000000..9a84332 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0017.failure.json @@ -0,0 +1,6 @@ +{ + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0017.js b/lib/test/esprima/invalid-syntax/migrated_0017.js new file mode 100644 index 0000000..d3523d9 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0017.js @@ -0,0 +1 @@ +0b \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0018.failure.json b/lib/test/esprima/invalid-syntax/migrated_0018.failure.json new file mode 100644 index 0000000..e026030 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0018.failure.json @@ -0,0 +1,6 @@ +{ + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0018.js b/lib/test/esprima/invalid-syntax/migrated_0018.js new file mode 100644 index 0000000..0eb95c6 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0018.js @@ -0,0 +1 @@ +0b1a \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0019.failure.json b/lib/test/esprima/invalid-syntax/migrated_0019.failure.json new file mode 100644 index 0000000..9a84332 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0019.failure.json @@ -0,0 +1,6 @@ +{ + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0019.js b/lib/test/esprima/invalid-syntax/migrated_0019.js new file mode 100644 index 0000000..9cb968b --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0019.js @@ -0,0 +1 @@ +0b9 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0020.failure.json b/lib/test/esprima/invalid-syntax/migrated_0020.failure.json new file mode 100644 index 0000000..e026030 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0020.failure.json @@ -0,0 +1,6 @@ +{ + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0020.js b/lib/test/esprima/invalid-syntax/migrated_0020.js new file mode 100644 index 0000000..795efc9 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0020.js @@ -0,0 +1 @@ +0b18 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0021.failure.json b/lib/test/esprima/invalid-syntax/migrated_0021.failure.json new file mode 100644 index 0000000..e026030 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0021.failure.json @@ -0,0 +1,6 @@ +{ + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0021.js b/lib/test/esprima/invalid-syntax/migrated_0021.js new file mode 100644 index 0000000..2474c30 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0021.js @@ -0,0 +1 @@ +0b12 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0022.failure.json b/lib/test/esprima/invalid-syntax/migrated_0022.failure.json new file mode 100644 index 0000000..9a84332 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0022.failure.json @@ -0,0 +1,6 @@ +{ + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0022.js b/lib/test/esprima/invalid-syntax/migrated_0022.js new file mode 100644 index 0000000..50ec12f --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0022.js @@ -0,0 +1 @@ +0B \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0023.failure.json b/lib/test/esprima/invalid-syntax/migrated_0023.failure.json new file mode 100644 index 0000000..e026030 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0023.failure.json @@ -0,0 +1,6 @@ +{ + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0023.js b/lib/test/esprima/invalid-syntax/migrated_0023.js new file mode 100644 index 0000000..d8e3b4f --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0023.js @@ -0,0 +1 @@ +0B1a \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0024.failure.json b/lib/test/esprima/invalid-syntax/migrated_0024.failure.json new file mode 100644 index 0000000..9a84332 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0024.failure.json @@ -0,0 +1,6 @@ +{ + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0024.js b/lib/test/esprima/invalid-syntax/migrated_0024.js new file mode 100644 index 0000000..79f9dca --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0024.js @@ -0,0 +1 @@ +0B9 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0025.failure.json b/lib/test/esprima/invalid-syntax/migrated_0025.failure.json new file mode 100644 index 0000000..e026030 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0025.failure.json @@ -0,0 +1,6 @@ +{ + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0025.js b/lib/test/esprima/invalid-syntax/migrated_0025.js new file mode 100644 index 0000000..63c7fb7 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0025.js @@ -0,0 +1 @@ +0B18 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0026.failure.json b/lib/test/esprima/invalid-syntax/migrated_0026.failure.json new file mode 100644 index 0000000..e026030 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0026.failure.json @@ -0,0 +1,6 @@ +{ + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0026.js b/lib/test/esprima/invalid-syntax/migrated_0026.js new file mode 100644 index 0000000..08162d6 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0026.js @@ -0,0 +1 @@ +0B12 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0027.failure.json b/lib/test/esprima/invalid-syntax/migrated_0027.failure.json new file mode 100644 index 0000000..9a84332 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0027.failure.json @@ -0,0 +1,6 @@ +{ + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0027.js b/lib/test/esprima/invalid-syntax/migrated_0027.js new file mode 100644 index 0000000..6efd559 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0027.js @@ -0,0 +1 @@ +0O9 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0028.failure.json b/lib/test/esprima/invalid-syntax/migrated_0028.failure.json new file mode 100644 index 0000000..e026030 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0028.failure.json @@ -0,0 +1,6 @@ +{ + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0028.js b/lib/test/esprima/invalid-syntax/migrated_0028.js new file mode 100644 index 0000000..4fb08bf --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0028.js @@ -0,0 +1 @@ +0O18 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0029.failure.json b/lib/test/esprima/invalid-syntax/migrated_0029.failure.json new file mode 100644 index 0000000..b966e10 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0029.failure.json @@ -0,0 +1,6 @@ +{ + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0029.js b/lib/test/esprima/invalid-syntax/migrated_0029.js new file mode 100644 index 0000000..38f8bb7 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0029.js @@ -0,0 +1 @@ +3in[] \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0030.failure.json b/lib/test/esprima/invalid-syntax/migrated_0030.failure.json new file mode 100644 index 0000000..e026030 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0030.failure.json @@ -0,0 +1,6 @@ +{ + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0030.js b/lib/test/esprima/invalid-syntax/migrated_0030.js new file mode 100644 index 0000000..6673c56 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0030.js @@ -0,0 +1 @@ +0x3in[] \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0031.failure.json b/lib/test/esprima/invalid-syntax/migrated_0031.failure.json new file mode 100644 index 0000000..01bfca3 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0031.failure.json @@ -0,0 +1,6 @@ +{ + "index": 0, + "lineNumber": 1, + "column": 1, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} diff --git a/lib/test/esprima/invalid-syntax/migrated_0031.js b/lib/test/esprima/invalid-syntax/migrated_0031.js new file mode 100644 index 0000000..cc39262 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0031.js @@ -0,0 +1,2 @@ +"Hello +World" \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0032.failure.json b/lib/test/esprima/invalid-syntax/migrated_0032.failure.json new file mode 100644 index 0000000..9a84332 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0032.failure.json @@ -0,0 +1,6 @@ +{ + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0032.js b/lib/test/esprima/invalid-syntax/migrated_0032.js new file mode 100644 index 0000000..08eb2e0 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0032.js @@ -0,0 +1 @@ +x\ \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0033.failure.json b/lib/test/esprima/invalid-syntax/migrated_0033.failure.json new file mode 100644 index 0000000..42c4387 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0033.failure.json @@ -0,0 +1,6 @@ +{ + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0033.source.js b/lib/test/esprima/invalid-syntax/migrated_0033.source.js new file mode 100644 index 0000000..d085518 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0033.source.js @@ -0,0 +1 @@ +var source = 'x\\u005c'; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0034.failure.json b/lib/test/esprima/invalid-syntax/migrated_0034.failure.json new file mode 100644 index 0000000..42c4387 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0034.failure.json @@ -0,0 +1,6 @@ +{ + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0034.source.js b/lib/test/esprima/invalid-syntax/migrated_0034.source.js new file mode 100644 index 0000000..c09d0b3 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0034.source.js @@ -0,0 +1 @@ +var source = 'x\\u002a'; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0035.failure.json b/lib/test/esprima/invalid-syntax/migrated_0035.failure.json new file mode 100644 index 0000000..b007b4a --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0035.failure.json @@ -0,0 +1,6 @@ +{ + "index": 13, + "lineNumber": 1, + "column": 14, + "message": "Error: Line 1: Invalid regular expression" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0035.js b/lib/test/esprima/invalid-syntax/migrated_0035.js new file mode 100644 index 0000000..18f469f --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0035.js @@ -0,0 +1 @@ +var x = /(s/g \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0036.failure.json b/lib/test/esprima/invalid-syntax/migrated_0036.failure.json new file mode 100644 index 0000000..e026030 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0036.failure.json @@ -0,0 +1,6 @@ +{ + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0036.source.js b/lib/test/esprima/invalid-syntax/migrated_0036.source.js new file mode 100644 index 0000000..9df3d4f --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0036.source.js @@ -0,0 +1 @@ +var source = 'a\\u'; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0037.failure.json b/lib/test/esprima/invalid-syntax/migrated_0037.failure.json new file mode 100644 index 0000000..e026030 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0037.failure.json @@ -0,0 +1,6 @@ +{ + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0037.source.js b/lib/test/esprima/invalid-syntax/migrated_0037.source.js new file mode 100644 index 0000000..017d6bb --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0037.source.js @@ -0,0 +1 @@ +var source = '\\ua'; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0038.failure.json b/lib/test/esprima/invalid-syntax/migrated_0038.failure.json new file mode 100644 index 0000000..393a170 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0038.failure.json @@ -0,0 +1,6 @@ +{ + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Error: Line 1: Invalid regular expression: missing /" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0038.js b/lib/test/esprima/invalid-syntax/migrated_0038.js new file mode 100644 index 0000000..35ec3b9 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0038.js @@ -0,0 +1 @@ +/ \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0039.failure.json b/lib/test/esprima/invalid-syntax/migrated_0039.failure.json new file mode 100644 index 0000000..b894f9c --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0039.failure.json @@ -0,0 +1,6 @@ +{ + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Error: Line 1: Invalid regular expression: missing /" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0039.js b/lib/test/esprima/invalid-syntax/migrated_0039.js new file mode 100644 index 0000000..32bcdf1 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0039.js @@ -0,0 +1 @@ +/test \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0040.failure.json b/lib/test/esprima/invalid-syntax/migrated_0040.failure.json new file mode 100644 index 0000000..7a3b53a --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0040.failure.json @@ -0,0 +1,6 @@ +{ + "index": 6, + "lineNumber": 1, + "column": 7, + "message": "Error: Line 1: Invalid regular expression: missing /" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0040.js b/lib/test/esprima/invalid-syntax/migrated_0040.js new file mode 100644 index 0000000..6d5430f --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0040.js @@ -0,0 +1,2 @@ +/test +/ \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0041.failure.json b/lib/test/esprima/invalid-syntax/migrated_0041.failure.json new file mode 100644 index 0000000..ae3aa0d --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0041.failure.json @@ -0,0 +1,6 @@ +{ + "index": 17, + "lineNumber": 1, + "column": 18, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0041.source.js b/lib/test/esprima/invalid-syntax/migrated_0041.source.js new file mode 100644 index 0000000..db545c9 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0041.source.js @@ -0,0 +1 @@ +var source = 'var x = /[a-z]/\\ux'; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0042.failure.json b/lib/test/esprima/invalid-syntax/migrated_0042.failure.json new file mode 100644 index 0000000..f4b8288 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0042.failure.json @@ -0,0 +1,6 @@ +{ + "index": 14, + "lineNumber": 1, + "column": 15, + "message": "Error: Line 1: Invalid regular expression: missing /" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0042.source.js b/lib/test/esprima/invalid-syntax/migrated_0042.source.js new file mode 100644 index 0000000..921a03b --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0042.source.js @@ -0,0 +1 @@ +var source = 'var x = /[a-z\n]/\\ux'; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0043.failure.json b/lib/test/esprima/invalid-syntax/migrated_0043.failure.json new file mode 100644 index 0000000..3a1b486 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0043.failure.json @@ -0,0 +1,6 @@ +{ + "index": 16, + "lineNumber": 1, + "column": 17, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0043.source.js b/lib/test/esprima/invalid-syntax/migrated_0043.source.js new file mode 100644 index 0000000..4fe6cea --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0043.source.js @@ -0,0 +1 @@ +var source = 'var x = /[a-z]/\\\\ux'; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0044.failure.json b/lib/test/esprima/invalid-syntax/migrated_0044.failure.json new file mode 100644 index 0000000..ae3aa0d --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0044.failure.json @@ -0,0 +1,6 @@ +{ + "index": 17, + "lineNumber": 1, + "column": 18, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0044.source.js b/lib/test/esprima/invalid-syntax/migrated_0044.source.js new file mode 100644 index 0000000..803b823 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0044.source.js @@ -0,0 +1 @@ +var source = 'var x = /[P QR]/\\\\u0067'; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0045.failure.json b/lib/test/esprima/invalid-syntax/migrated_0045.failure.json new file mode 100644 index 0000000..a609d1a --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0045.failure.json @@ -0,0 +1,6 @@ +{ + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Error: Line 1: Invalid left-hand side in assignment" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0045.js b/lib/test/esprima/invalid-syntax/migrated_0045.js new file mode 100644 index 0000000..f585591 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0045.js @@ -0,0 +1 @@ +3 = 4 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0046.failure.json b/lib/test/esprima/invalid-syntax/migrated_0046.failure.json new file mode 100644 index 0000000..e219d58 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0046.failure.json @@ -0,0 +1,6 @@ +{ + "index": 6, + "lineNumber": 1, + "column": 7, + "message": "Error: Line 1: Invalid left-hand side in assignment" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0046.js b/lib/test/esprima/invalid-syntax/migrated_0046.js new file mode 100644 index 0000000..88a4a11 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0046.js @@ -0,0 +1 @@ +func() = 4 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0047.failure.json b/lib/test/esprima/invalid-syntax/migrated_0047.failure.json new file mode 100644 index 0000000..b4d73ed --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0047.failure.json @@ -0,0 +1,6 @@ +{ + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Error: Line 1: Invalid left-hand side in assignment" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0047.js b/lib/test/esprima/invalid-syntax/migrated_0047.js new file mode 100644 index 0000000..9ee7f11 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0047.js @@ -0,0 +1 @@ +(1 + 1) = 10 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0048.failure.json b/lib/test/esprima/invalid-syntax/migrated_0048.failure.json new file mode 100644 index 0000000..00afd9a --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0048.failure.json @@ -0,0 +1,6 @@ +{ + "index": 11, + "lineNumber": 1, + "column": 12, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0048.source.js b/lib/test/esprima/invalid-syntax/migrated_0048.source.js new file mode 100644 index 0000000..419b041 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0048.source.js @@ -0,0 +1 @@ +var source = '"\\u{110000}"'; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0049.failure.json b/lib/test/esprima/invalid-syntax/migrated_0049.failure.json new file mode 100644 index 0000000..4af43b0 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0049.failure.json @@ -0,0 +1,6 @@ +{ + "index": 4, + "lineNumber": 1, + "column": 5, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0049.source.js b/lib/test/esprima/invalid-syntax/migrated_0049.source.js new file mode 100644 index 0000000..8e7bb6a --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0049.source.js @@ -0,0 +1 @@ +var source = '"\\u{}"'; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0050.failure.json b/lib/test/esprima/invalid-syntax/migrated_0050.failure.json new file mode 100644 index 0000000..0226210 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0050.failure.json @@ -0,0 +1,6 @@ +{ + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0050.source.js b/lib/test/esprima/invalid-syntax/migrated_0050.source.js new file mode 100644 index 0000000..d904d21 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0050.source.js @@ -0,0 +1 @@ +var source = '"\\u{FFFF"'; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0051.failure.json b/lib/test/esprima/invalid-syntax/migrated_0051.failure.json new file mode 100644 index 0000000..42c4387 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0051.failure.json @@ -0,0 +1,6 @@ +{ + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0051.source.js b/lib/test/esprima/invalid-syntax/migrated_0051.source.js new file mode 100644 index 0000000..4630a4e --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0051.source.js @@ -0,0 +1 @@ +var source = '"\\u{FFZ}"'; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0052.failure.json b/lib/test/esprima/invalid-syntax/migrated_0052.failure.json new file mode 100644 index 0000000..a609d1a --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0052.failure.json @@ -0,0 +1,6 @@ +{ + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Error: Line 1: Invalid left-hand side in assignment" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0052.js b/lib/test/esprima/invalid-syntax/migrated_0052.js new file mode 100644 index 0000000..1c8af92 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0052.js @@ -0,0 +1 @@ +1++ \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0053.failure.json b/lib/test/esprima/invalid-syntax/migrated_0053.failure.json new file mode 100644 index 0000000..a609d1a --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0053.failure.json @@ -0,0 +1,6 @@ +{ + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Error: Line 1: Invalid left-hand side in assignment" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0053.js b/lib/test/esprima/invalid-syntax/migrated_0053.js new file mode 100644 index 0000000..6a5ca8a --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0053.js @@ -0,0 +1 @@ +1-- \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0054.failure.json b/lib/test/esprima/invalid-syntax/migrated_0054.failure.json new file mode 100644 index 0000000..2c14339 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0054.failure.json @@ -0,0 +1,6 @@ +{ + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Invalid left-hand side in assignment" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0054.js b/lib/test/esprima/invalid-syntax/migrated_0054.js new file mode 100644 index 0000000..e3bc4bd --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0054.js @@ -0,0 +1 @@ +++1 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0055.failure.json b/lib/test/esprima/invalid-syntax/migrated_0055.failure.json new file mode 100644 index 0000000..2c14339 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0055.failure.json @@ -0,0 +1,6 @@ +{ + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Invalid left-hand side in assignment" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0055.js b/lib/test/esprima/invalid-syntax/migrated_0055.js new file mode 100644 index 0000000..bfbbe2b --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0055.js @@ -0,0 +1 @@ +--1 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0056.failure.json b/lib/test/esprima/invalid-syntax/migrated_0056.failure.json new file mode 100644 index 0000000..0a61ce2 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0056.failure.json @@ -0,0 +1,6 @@ +{ + "index": 11, + "lineNumber": 1, + "column": 12, + "message": "Error: Line 1: Invalid left-hand side in for-in" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0056.js b/lib/test/esprima/invalid-syntax/migrated_0056.js new file mode 100644 index 0000000..1aed2d9 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0056.js @@ -0,0 +1 @@ +for((1 + 1) in list) process(x); \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0057.failure.json b/lib/test/esprima/invalid-syntax/migrated_0057.failure.json new file mode 100644 index 0000000..a8ad27f --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0057.failure.json @@ -0,0 +1,6 @@ +{ + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Error: Line 1: Unexpected end of input" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0057.js b/lib/test/esprima/invalid-syntax/migrated_0057.js new file mode 100644 index 0000000..8e2f0be --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0057.js @@ -0,0 +1 @@ +[ \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0058.failure.json b/lib/test/esprima/invalid-syntax/migrated_0058.failure.json new file mode 100644 index 0000000..c9fe862 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0058.failure.json @@ -0,0 +1,6 @@ +{ + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected end of input" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0058.js b/lib/test/esprima/invalid-syntax/migrated_0058.js new file mode 100644 index 0000000..6295fdc --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0058.js @@ -0,0 +1 @@ +[, \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0059.failure.json b/lib/test/esprima/invalid-syntax/migrated_0059.failure.json new file mode 100644 index 0000000..e177f1b --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0059.failure.json @@ -0,0 +1,6 @@ +{ + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Error: Line 1: Unexpected end of input" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0059.js b/lib/test/esprima/invalid-syntax/migrated_0059.js new file mode 100644 index 0000000..fb324a5 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0059.js @@ -0,0 +1 @@ +1 + { \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0060.failure.json b/lib/test/esprima/invalid-syntax/migrated_0060.failure.json new file mode 100644 index 0000000..ebe6206 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0060.failure.json @@ -0,0 +1,6 @@ +{ + "index": 10, + "lineNumber": 1, + "column": 11, + "message": "Error: Line 1: Unexpected end of input" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0060.js b/lib/test/esprima/invalid-syntax/migrated_0060.js new file mode 100644 index 0000000..33338e4 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0060.js @@ -0,0 +1 @@ +1 + { t:t \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0061.failure.json b/lib/test/esprima/invalid-syntax/migrated_0061.failure.json new file mode 100644 index 0000000..ebe6206 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0061.failure.json @@ -0,0 +1,6 @@ +{ + "index": 10, + "lineNumber": 1, + "column": 11, + "message": "Error: Line 1: Unexpected end of input" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0061.js b/lib/test/esprima/invalid-syntax/migrated_0061.js new file mode 100644 index 0000000..91e132b --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0061.js @@ -0,0 +1 @@ +1 + { t:t, \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0062.failure.json b/lib/test/esprima/invalid-syntax/migrated_0062.failure.json new file mode 100644 index 0000000..a753f76 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0062.failure.json @@ -0,0 +1,6 @@ +{ + "index": 10, + "lineNumber": 1, + "column": 11, + "message": "Error: Line 1: Invalid regular expression: missing /" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0062.js b/lib/test/esprima/invalid-syntax/migrated_0062.js new file mode 100644 index 0000000..8c4bbaf --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0062.js @@ -0,0 +1,2 @@ +var x = / +/ \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0063.failure.json b/lib/test/esprima/invalid-syntax/migrated_0063.failure.json new file mode 100644 index 0000000..3c8c6ae --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0063.failure.json @@ -0,0 +1,6 @@ +{ + "index": 8, + "lineNumber": 1, + "column": 9, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} diff --git a/lib/test/esprima/invalid-syntax/migrated_0063.js b/lib/test/esprima/invalid-syntax/migrated_0063.js new file mode 100644 index 0000000..6638620 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0063.js @@ -0,0 +1 @@ +var x = " diff --git a/lib/test/esprima/invalid-syntax/migrated_0064.failure.json b/lib/test/esprima/invalid-syntax/migrated_0064.failure.json new file mode 100644 index 0000000..e290343 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0064.failure.json @@ -0,0 +1,6 @@ +{ + "index": 4, + "lineNumber": 1, + "column": 5, + "message": "Error: Line 1: Unexpected token if" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0064.js b/lib/test/esprima/invalid-syntax/migrated_0064.js new file mode 100644 index 0000000..1f92917 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0064.js @@ -0,0 +1 @@ +var if = 42 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0065.failure.json b/lib/test/esprima/invalid-syntax/migrated_0065.failure.json new file mode 100644 index 0000000..47d3cae --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0065.failure.json @@ -0,0 +1,6 @@ +{ + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} diff --git a/lib/test/esprima/invalid-syntax/migrated_0065.js b/lib/test/esprima/invalid-syntax/migrated_0065.js new file mode 100644 index 0000000..04b9f4b --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0065.js @@ -0,0 +1 @@ +i #= 42 diff --git a/lib/test/esprima/invalid-syntax/migrated_0066.failure.json b/lib/test/esprima/invalid-syntax/migrated_0066.failure.json new file mode 100644 index 0000000..409a281 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0066.failure.json @@ -0,0 +1,6 @@ +{ + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Error: Line 1: Invalid left-hand side in assignment" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0066.js b/lib/test/esprima/invalid-syntax/migrated_0066.js new file mode 100644 index 0000000..dc8424a --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0066.js @@ -0,0 +1 @@ +i + 2 = 42 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0067.failure.json b/lib/test/esprima/invalid-syntax/migrated_0067.failure.json new file mode 100644 index 0000000..129c578 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0067.failure.json @@ -0,0 +1,6 @@ +{ + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Invalid left-hand side in assignment" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0067.js b/lib/test/esprima/invalid-syntax/migrated_0067.js new file mode 100644 index 0000000..71b4fc4 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0067.js @@ -0,0 +1 @@ ++i = 42 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0068.failure.json b/lib/test/esprima/invalid-syntax/migrated_0068.failure.json new file mode 100644 index 0000000..e177f1b --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0068.failure.json @@ -0,0 +1,6 @@ +{ + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Error: Line 1: Unexpected end of input" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0068.js b/lib/test/esprima/invalid-syntax/migrated_0068.js new file mode 100644 index 0000000..7c6a458 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0068.js @@ -0,0 +1 @@ +1 + ( \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0069.failure.json b/lib/test/esprima/invalid-syntax/migrated_0069.failure.json new file mode 100644 index 0000000..1a0b14c --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0069.failure.json @@ -0,0 +1,6 @@ +{ + "index": 4, + "lineNumber": 4, + "column": 2, + "message": "Error: Line 4: Unexpected end of input" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0069.js b/lib/test/esprima/invalid-syntax/migrated_0069.js new file mode 100644 index 0000000..f820c95 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0069.js @@ -0,0 +1,4 @@ + + + +{ \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0070.failure.json b/lib/test/esprima/invalid-syntax/migrated_0070.failure.json new file mode 100644 index 0000000..d14654a --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0070.failure.json @@ -0,0 +1,6 @@ +{ + "index": 30, + "lineNumber": 4, + "column": 1, + "message": "Error: Line 4: Unexpected token )" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0070.js b/lib/test/esprima/invalid-syntax/migrated_0070.js new file mode 100644 index 0000000..de71d5f --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0070.js @@ -0,0 +1,4 @@ + +/* Some multiline +comment */ +) \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0071.failure.json b/lib/test/esprima/invalid-syntax/migrated_0071.failure.json new file mode 100644 index 0000000..7a96e67 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0071.failure.json @@ -0,0 +1,6 @@ +{ + "index": 6, + "lineNumber": 1, + "column": 7, + "message": "Error: Line 1: Unexpected number" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0071.js b/lib/test/esprima/invalid-syntax/migrated_0071.js new file mode 100644 index 0000000..0b86a72 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0071.js @@ -0,0 +1 @@ +{ set 1 } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0072.failure.json b/lib/test/esprima/invalid-syntax/migrated_0072.failure.json new file mode 100644 index 0000000..7a96e67 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0072.failure.json @@ -0,0 +1,6 @@ +{ + "index": 6, + "lineNumber": 1, + "column": 7, + "message": "Error: Line 1: Unexpected number" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0072.js b/lib/test/esprima/invalid-syntax/migrated_0072.js new file mode 100644 index 0000000..c4250ca --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0072.js @@ -0,0 +1 @@ +{ get 2 } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0073.failure.json b/lib/test/esprima/invalid-syntax/migrated_0073.failure.json new file mode 100644 index 0000000..ba912d5 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0073.failure.json @@ -0,0 +1,6 @@ +{ + "index": 10, + "lineNumber": 1, + "column": 11, + "message": "Error: Line 1: Unexpected token if" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0073.js b/lib/test/esprima/invalid-syntax/migrated_0073.js new file mode 100644 index 0000000..b96ae85 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0073.js @@ -0,0 +1 @@ +({ set: s(if) { } }) \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0074.failure.json b/lib/test/esprima/invalid-syntax/migrated_0074.failure.json new file mode 100644 index 0000000..a517593 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0074.failure.json @@ -0,0 +1,6 @@ +{ + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Unexpected token ." +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0074.js b/lib/test/esprima/invalid-syntax/migrated_0074.js new file mode 100644 index 0000000..8dbf3e2 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0074.js @@ -0,0 +1 @@ +({ set s(.) { } }) \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0075.failure.json b/lib/test/esprima/invalid-syntax/migrated_0075.failure.json new file mode 100644 index 0000000..e597f63 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0075.failure.json @@ -0,0 +1,6 @@ +{ + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Unexpected token )" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0075.js b/lib/test/esprima/invalid-syntax/migrated_0075.js new file mode 100644 index 0000000..45a8933 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0075.js @@ -0,0 +1 @@ +({ set s() { } }) \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0076.failure.json b/lib/test/esprima/invalid-syntax/migrated_0076.failure.json new file mode 100644 index 0000000..600c4de --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0076.failure.json @@ -0,0 +1,6 @@ +{ + "index": 12, + "lineNumber": 1, + "column": 13, + "message": "Error: Line 1: Unexpected token {" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0076.js b/lib/test/esprima/invalid-syntax/migrated_0076.js new file mode 100644 index 0000000..32ecb82 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0076.js @@ -0,0 +1 @@ +({ set: s() { } }) \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0077.failure.json b/lib/test/esprima/invalid-syntax/migrated_0077.failure.json new file mode 100644 index 0000000..728fd9c --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0077.failure.json @@ -0,0 +1,6 @@ +{ + "index": 16, + "lineNumber": 1, + "column": 17, + "message": "Error: Line 1: Unexpected token {" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0077.js b/lib/test/esprima/invalid-syntax/migrated_0077.js new file mode 100644 index 0000000..6d70b15 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0077.js @@ -0,0 +1 @@ +({ set: s(a, b) { } }) \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0078.failure.json b/lib/test/esprima/invalid-syntax/migrated_0078.failure.json new file mode 100644 index 0000000..0806300 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0078.failure.json @@ -0,0 +1,6 @@ +{ + "index": 13, + "lineNumber": 1, + "column": 14, + "message": "Error: Line 1: Unexpected token {" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0078.js b/lib/test/esprima/invalid-syntax/migrated_0078.js new file mode 100644 index 0000000..b1df4de --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0078.js @@ -0,0 +1 @@ +({ get: g(d) { } }) \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0080.failure.json b/lib/test/esprima/invalid-syntax/migrated_0080.failure.json new file mode 100644 index 0000000..873745b --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0080.failure.json @@ -0,0 +1,6 @@ +{ + "index": 4, + "lineNumber": 1, + "column": 5, + "message": "Error: Line 1: Unexpected token ," +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0080.js b/lib/test/esprima/invalid-syntax/migrated_0080.js new file mode 100644 index 0000000..35c90e7 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0080.js @@ -0,0 +1 @@ +({[a,b]:0}) \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0081.failure.json b/lib/test/esprima/invalid-syntax/migrated_0081.failure.json new file mode 100644 index 0000000..f6f6944 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0081.failure.json @@ -0,0 +1,6 @@ +{ + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Error: Line 1: Unexpected token ," +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0081.js b/lib/test/esprima/invalid-syntax/migrated_0081.js new file mode 100644 index 0000000..5dfb87e --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0081.js @@ -0,0 +1 @@ +({get[a,b]:0}) \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0082.failure.json b/lib/test/esprima/invalid-syntax/migrated_0082.failure.json new file mode 100644 index 0000000..75274ce --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0082.failure.json @@ -0,0 +1,6 @@ +{ + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected token (" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0082.js b/lib/test/esprima/invalid-syntax/migrated_0082.js new file mode 100644 index 0000000..280fb0e --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0082.js @@ -0,0 +1 @@ +({(a):0}) \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0083.failure.json b/lib/test/esprima/invalid-syntax/migrated_0083.failure.json new file mode 100644 index 0000000..32776ce --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0083.failure.json @@ -0,0 +1,6 @@ +{ + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Error: Line 1: Unexpected token {" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0083.js b/lib/test/esprima/invalid-syntax/migrated_0083.js new file mode 100644 index 0000000..a11e719 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0083.js @@ -0,0 +1 @@ +({get{a}:0}) \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0084.failure.json b/lib/test/esprima/invalid-syntax/migrated_0084.failure.json new file mode 100644 index 0000000..389eecd --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0084.failure.json @@ -0,0 +1,6 @@ +{ + "index": 6, + "lineNumber": 1, + "column": 7, + "message": "Error: Line 1: Unexpected end of input" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0084.js b/lib/test/esprima/invalid-syntax/migrated_0084.js new file mode 100644 index 0000000..9cbbaf9 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0084.js @@ -0,0 +1 @@ +({get \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0085.failure.json b/lib/test/esprima/invalid-syntax/migrated_0085.failure.json new file mode 100644 index 0000000..487c408 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0085.failure.json @@ -0,0 +1,6 @@ +{ + "index": 6, + "lineNumber": 1, + "column": 7, + "message": "Error: Line 1: Unexpected token =>" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0085.js b/lib/test/esprima/invalid-syntax/migrated_0085.js new file mode 100644 index 0000000..cc7b1e3 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0085.js @@ -0,0 +1 @@ +((a)) => 42 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0086.failure.json b/lib/test/esprima/invalid-syntax/migrated_0086.failure.json new file mode 100644 index 0000000..7606282 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0086.failure.json @@ -0,0 +1,6 @@ +{ + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Unexpected token =>" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0086.js b/lib/test/esprima/invalid-syntax/migrated_0086.js new file mode 100644 index 0000000..145e580 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0086.js @@ -0,0 +1 @@ +(a, (b)) => 42 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0087.failure.json b/lib/test/esprima/invalid-syntax/migrated_0087.failure.json new file mode 100644 index 0000000..7691604 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0087.failure.json @@ -0,0 +1,6 @@ +{ + "index": 15, + "lineNumber": 1, + "column": 16, + "message": "Error: Line 1: Assignment to eval or arguments is not allowed in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0087.js b/lib/test/esprima/invalid-syntax/migrated_0087.js new file mode 100644 index 0000000..2d73cdb --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0087.js @@ -0,0 +1 @@ +"use strict"; (eval = 10) => 42 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0088.failure.json b/lib/test/esprima/invalid-syntax/migrated_0088.failure.json new file mode 100644 index 0000000..f631233 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0088.failure.json @@ -0,0 +1,6 @@ +{ + "index": 24, + "lineNumber": 1, + "column": 25, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0088.js b/lib/test/esprima/invalid-syntax/migrated_0088.js new file mode 100644 index 0000000..8cc5c2e --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0088.js @@ -0,0 +1 @@ +"use strict"; eval => 42 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0089.failure.json b/lib/test/esprima/invalid-syntax/migrated_0089.failure.json new file mode 100644 index 0000000..7c049ee --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0089.failure.json @@ -0,0 +1,6 @@ +{ + "index": 29, + "lineNumber": 1, + "column": 30, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0089.js b/lib/test/esprima/invalid-syntax/migrated_0089.js new file mode 100644 index 0000000..b6e4d39 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0089.js @@ -0,0 +1 @@ +"use strict"; arguments => 42 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0090.failure.json b/lib/test/esprima/invalid-syntax/migrated_0090.failure.json new file mode 100644 index 0000000..7c049ee --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0090.failure.json @@ -0,0 +1,6 @@ +{ + "index": 29, + "lineNumber": 1, + "column": 30, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0090.js b/lib/test/esprima/invalid-syntax/migrated_0090.js new file mode 100644 index 0000000..aacb688 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0090.js @@ -0,0 +1 @@ +"use strict"; (eval, a) => 42 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0091.failure.json b/lib/test/esprima/invalid-syntax/migrated_0091.failure.json new file mode 100644 index 0000000..3cff0b9 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0091.failure.json @@ -0,0 +1,6 @@ +{ + "index": 34, + "lineNumber": 1, + "column": 35, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0091.js b/lib/test/esprima/invalid-syntax/migrated_0091.js new file mode 100644 index 0000000..0494c25 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0091.js @@ -0,0 +1 @@ +"use strict"; (arguments, a) => 42 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0092.failure.json b/lib/test/esprima/invalid-syntax/migrated_0092.failure.json new file mode 100644 index 0000000..5bf635c --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0092.failure.json @@ -0,0 +1,6 @@ +{ + "index": 6, + "lineNumber": 1, + "column": 7, + "message": "Error: Line 1: Strict mode function may not have duplicate parameter names" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0092.js b/lib/test/esprima/invalid-syntax/migrated_0092.js new file mode 100644 index 0000000..1f226ec --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0092.js @@ -0,0 +1 @@ +(a, a) => 42 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0093.failure.json b/lib/test/esprima/invalid-syntax/migrated_0093.failure.json new file mode 100644 index 0000000..13ab24c --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0093.failure.json @@ -0,0 +1,6 @@ +{ + "index": 20, + "lineNumber": 1, + "column": 21, + "message": "Error: Line 1: Strict mode function may not have duplicate parameter names" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0093.js b/lib/test/esprima/invalid-syntax/migrated_0093.js new file mode 100644 index 0000000..a315178 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0093.js @@ -0,0 +1 @@ +"use strict"; (a, a) => 42 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0094.failure.json b/lib/test/esprima/invalid-syntax/migrated_0094.failure.json new file mode 100644 index 0000000..99a852b --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0094.failure.json @@ -0,0 +1,6 @@ +{ + "index": 21, + "lineNumber": 1, + "column": 22, + "message": "Error: Line 1: Octal literals are not allowed in strict mode." +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0094.js b/lib/test/esprima/invalid-syntax/migrated_0094.js new file mode 100644 index 0000000..caa92f7 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0094.js @@ -0,0 +1 @@ +"use strict"; (a) => 00 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0095.failure.json b/lib/test/esprima/invalid-syntax/migrated_0095.failure.json new file mode 100644 index 0000000..5cf2126 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0095.failure.json @@ -0,0 +1,6 @@ +{ + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token <=" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0095.js b/lib/test/esprima/invalid-syntax/migrated_0095.js new file mode 100644 index 0000000..84c06cc --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0095.js @@ -0,0 +1 @@ +() <= 42 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0096.failure.json b/lib/test/esprima/invalid-syntax/migrated_0096.failure.json new file mode 100644 index 0000000..79b81f9 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0096.failure.json @@ -0,0 +1,6 @@ +{ + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ?" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0096.js b/lib/test/esprima/invalid-syntax/migrated_0096.js new file mode 100644 index 0000000..f960bb2 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0096.js @@ -0,0 +1 @@ +() ? 42 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0097.failure.json b/lib/test/esprima/invalid-syntax/migrated_0097.failure.json new file mode 100644 index 0000000..628e4b6 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0097.failure.json @@ -0,0 +1,6 @@ +{ + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token +" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0097.js b/lib/test/esprima/invalid-syntax/migrated_0097.js new file mode 100644 index 0000000..d2bcdf5 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0097.js @@ -0,0 +1 @@ +() + 42 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0098.failure.json b/lib/test/esprima/invalid-syntax/migrated_0098.failure.json new file mode 100644 index 0000000..0f41c4f --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0098.failure.json @@ -0,0 +1,6 @@ +{ + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Error: Line 1: Unexpected token =>" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0098.js b/lib/test/esprima/invalid-syntax/migrated_0098.js new file mode 100644 index 0000000..a167d2a --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0098.js @@ -0,0 +1 @@ +(10) => 00 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0099.failure.json b/lib/test/esprima/invalid-syntax/migrated_0099.failure.json new file mode 100644 index 0000000..7606282 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0099.failure.json @@ -0,0 +1,6 @@ +{ + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Unexpected token =>" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0099.js b/lib/test/esprima/invalid-syntax/migrated_0099.js new file mode 100644 index 0000000..f9e8b9d --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0099.js @@ -0,0 +1 @@ +(10, 20) => 00 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0100.failure.json b/lib/test/esprima/invalid-syntax/migrated_0100.failure.json new file mode 100644 index 0000000..ce19e1f --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0100.failure.json @@ -0,0 +1,6 @@ +{ + "index": 26, + "lineNumber": 1, + "column": 27, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0100.js b/lib/test/esprima/invalid-syntax/migrated_0100.js new file mode 100644 index 0000000..4a9a5d2 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0100.js @@ -0,0 +1 @@ +"use strict"; (eval) => 42 \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0101.failure.json b/lib/test/esprima/invalid-syntax/migrated_0101.failure.json new file mode 100644 index 0000000..2300a89 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0101.failure.json @@ -0,0 +1,6 @@ +{ + "index": 30, + "lineNumber": 1, + "column": 31, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0101.js b/lib/test/esprima/invalid-syntax/migrated_0101.js new file mode 100644 index 0000000..6bba987 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0101.js @@ -0,0 +1 @@ +(eval) => { "use strict"; 42 } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0102.failure.json b/lib/test/esprima/invalid-syntax/migrated_0102.failure.json new file mode 100644 index 0000000..1fba635 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0102.failure.json @@ -0,0 +1,6 @@ +{ + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Error: Line 1: Unexpected token /" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0102.js b/lib/test/esprima/invalid-syntax/migrated_0102.js new file mode 100644 index 0000000..67e5e8f --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0102.js @@ -0,0 +1 @@ +p = { q/ } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0103.failure.json b/lib/test/esprima/invalid-syntax/migrated_0103.failure.json new file mode 100644 index 0000000..0d90127 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0103.failure.json @@ -0,0 +1,6 @@ +{ + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Unexpected token /" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0103.js b/lib/test/esprima/invalid-syntax/migrated_0103.js new file mode 100644 index 0000000..0145495 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0103.js @@ -0,0 +1 @@ +p = { "q"/ } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0104.failure.json b/lib/test/esprima/invalid-syntax/migrated_0104.failure.json new file mode 100644 index 0000000..6a86a53 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0104.failure.json @@ -0,0 +1,6 @@ +{ + "index": 11, + "lineNumber": 1, + "column": 12, + "message": "Error: Line 1: Unexpected token if" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0104.js b/lib/test/esprima/invalid-syntax/migrated_0104.js new file mode 100644 index 0000000..9746c91 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0104.js @@ -0,0 +1 @@ +function t(if) { } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0105.failure.json b/lib/test/esprima/invalid-syntax/migrated_0105.failure.json new file mode 100644 index 0000000..fa25cf6 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0105.failure.json @@ -0,0 +1,6 @@ +{ + "index": 11, + "lineNumber": 1, + "column": 12, + "message": "Error: Line 1: Unexpected token true" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0105.js b/lib/test/esprima/invalid-syntax/migrated_0105.js new file mode 100644 index 0000000..5ab609e --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0105.js @@ -0,0 +1 @@ +function t(true) { } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0106.failure.json b/lib/test/esprima/invalid-syntax/migrated_0106.failure.json new file mode 100644 index 0000000..3144249 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0106.failure.json @@ -0,0 +1,6 @@ +{ + "index": 11, + "lineNumber": 1, + "column": 12, + "message": "Error: Line 1: Unexpected token false" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0106.js b/lib/test/esprima/invalid-syntax/migrated_0106.js new file mode 100644 index 0000000..b126b59 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0106.js @@ -0,0 +1 @@ +function t(false) { } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0107.failure.json b/lib/test/esprima/invalid-syntax/migrated_0107.failure.json new file mode 100644 index 0000000..0c2f527 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0107.failure.json @@ -0,0 +1,6 @@ +{ + "index": 11, + "lineNumber": 1, + "column": 12, + "message": "Error: Line 1: Unexpected token null" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0107.js b/lib/test/esprima/invalid-syntax/migrated_0107.js new file mode 100644 index 0000000..d5910a5 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0107.js @@ -0,0 +1 @@ +function t(null) { } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0108.failure.json b/lib/test/esprima/invalid-syntax/migrated_0108.failure.json new file mode 100644 index 0000000..694f7a5 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0108.failure.json @@ -0,0 +1,6 @@ +{ + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Unexpected token null" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0108.js b/lib/test/esprima/invalid-syntax/migrated_0108.js new file mode 100644 index 0000000..f724653 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0108.js @@ -0,0 +1 @@ +function null() { } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0109.failure.json b/lib/test/esprima/invalid-syntax/migrated_0109.failure.json new file mode 100644 index 0000000..b86208a --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0109.failure.json @@ -0,0 +1,6 @@ +{ + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Unexpected token true" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0109.js b/lib/test/esprima/invalid-syntax/migrated_0109.js new file mode 100644 index 0000000..9ccba00 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0109.js @@ -0,0 +1 @@ +function true() { } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0110.failure.json b/lib/test/esprima/invalid-syntax/migrated_0110.failure.json new file mode 100644 index 0000000..08aa420 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0110.failure.json @@ -0,0 +1,6 @@ +{ + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Unexpected token false" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0110.js b/lib/test/esprima/invalid-syntax/migrated_0110.js new file mode 100644 index 0000000..99192a0 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0110.js @@ -0,0 +1 @@ +function false() { } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0111.failure.json b/lib/test/esprima/invalid-syntax/migrated_0111.failure.json new file mode 100644 index 0000000..d1a5ed7 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0111.failure.json @@ -0,0 +1,6 @@ +{ + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Unexpected token if" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0111.js b/lib/test/esprima/invalid-syntax/migrated_0111.js new file mode 100644 index 0000000..60ae5cc --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0111.js @@ -0,0 +1 @@ +function if() { } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0112.failure.json b/lib/test/esprima/invalid-syntax/migrated_0112.failure.json new file mode 100644 index 0000000..d41f8dd --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0112.failure.json @@ -0,0 +1,6 @@ +{ + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected identifier" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0112.js b/lib/test/esprima/invalid-syntax/migrated_0112.js new file mode 100644 index 0000000..2fd3431 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0112.js @@ -0,0 +1 @@ +a b; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0113.failure.json b/lib/test/esprima/invalid-syntax/migrated_0113.failure.json new file mode 100644 index 0000000..9a38744 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0113.failure.json @@ -0,0 +1,6 @@ +{ + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected token ." +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0113.js b/lib/test/esprima/invalid-syntax/migrated_0113.js new file mode 100644 index 0000000..28f63db --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0113.js @@ -0,0 +1 @@ +if.a; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0114.failure.json b/lib/test/esprima/invalid-syntax/migrated_0114.failure.json new file mode 100644 index 0000000..f0a862a --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0114.failure.json @@ -0,0 +1,6 @@ +{ + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected token if" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0114.js b/lib/test/esprima/invalid-syntax/migrated_0114.js new file mode 100644 index 0000000..06050b1 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0114.js @@ -0,0 +1 @@ +a if; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0115.failure.json b/lib/test/esprima/invalid-syntax/migrated_0115.failure.json new file mode 100644 index 0000000..c73fe68 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0115.failure.json @@ -0,0 +1,6 @@ +{ + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected reserved word" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0115.js b/lib/test/esprima/invalid-syntax/migrated_0115.js new file mode 100644 index 0000000..5a6d989 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0115.js @@ -0,0 +1 @@ +a enum; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0116.failure.json b/lib/test/esprima/invalid-syntax/migrated_0116.failure.json new file mode 100644 index 0000000..df4e976 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0116.failure.json @@ -0,0 +1,6 @@ +{ + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Error: Line 1: Illegal break statement" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0116.js b/lib/test/esprima/invalid-syntax/migrated_0116.js new file mode 100644 index 0000000..bf3fdcd --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0116.js @@ -0,0 +1 @@ +break diff --git a/lib/test/esprima/invalid-syntax/migrated_0117.failure.json b/lib/test/esprima/invalid-syntax/migrated_0117.failure.json new file mode 100644 index 0000000..7a96e67 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0117.failure.json @@ -0,0 +1,6 @@ +{ + "index": 6, + "lineNumber": 1, + "column": 7, + "message": "Error: Line 1: Unexpected number" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0117.js b/lib/test/esprima/invalid-syntax/migrated_0117.js new file mode 100644 index 0000000..ecbca05 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0117.js @@ -0,0 +1 @@ +break 1; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0118.failure.json b/lib/test/esprima/invalid-syntax/migrated_0118.failure.json new file mode 100644 index 0000000..1632814 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0118.failure.json @@ -0,0 +1,6 @@ +{ + "index": 8, + "lineNumber": 1, + "column": 9, + "message": "Error: Line 1: Illegal continue statement" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0118.js b/lib/test/esprima/invalid-syntax/migrated_0118.js new file mode 100644 index 0000000..44c5d7d --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0118.js @@ -0,0 +1 @@ +continue diff --git a/lib/test/esprima/invalid-syntax/migrated_0119.failure.json b/lib/test/esprima/invalid-syntax/migrated_0119.failure.json new file mode 100644 index 0000000..3870732 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0119.failure.json @@ -0,0 +1,6 @@ +{ + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Unexpected number" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0119.js b/lib/test/esprima/invalid-syntax/migrated_0119.js new file mode 100644 index 0000000..5ff072b --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0119.js @@ -0,0 +1 @@ +continue 2; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0120.failure.json b/lib/test/esprima/invalid-syntax/migrated_0120.failure.json new file mode 100644 index 0000000..e177f1b --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0120.failure.json @@ -0,0 +1,6 @@ +{ + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Error: Line 1: Unexpected end of input" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0120.js b/lib/test/esprima/invalid-syntax/migrated_0120.js new file mode 100644 index 0000000..755c8ff --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0120.js @@ -0,0 +1 @@ +throw \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0121.failure.json b/lib/test/esprima/invalid-syntax/migrated_0121.failure.json new file mode 100644 index 0000000..dc565a6 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0121.failure.json @@ -0,0 +1,6 @@ +{ + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Error: Line 1: Unexpected token ;" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0121.js b/lib/test/esprima/invalid-syntax/migrated_0121.js new file mode 100644 index 0000000..bcd16c6 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0121.js @@ -0,0 +1 @@ +throw; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0122.failure.json b/lib/test/esprima/invalid-syntax/migrated_0122.failure.json new file mode 100644 index 0000000..b7ced57 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0122.failure.json @@ -0,0 +1,6 @@ +{ + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Error: Line 1: Illegal newline after throw" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0122.js b/lib/test/esprima/invalid-syntax/migrated_0122.js new file mode 100644 index 0000000..18db166 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0122.js @@ -0,0 +1 @@ +throw diff --git a/lib/test/esprima/invalid-syntax/migrated_0123.failure.json b/lib/test/esprima/invalid-syntax/migrated_0123.failure.json new file mode 100644 index 0000000..d1c9ddb --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0123.failure.json @@ -0,0 +1,6 @@ +{ + "index": 15, + "lineNumber": 1, + "column": 16, + "message": "Error: Line 1: Unexpected token in" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0123.js b/lib/test/esprima/invalid-syntax/migrated_0123.js new file mode 100644 index 0000000..5d57575 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0123.js @@ -0,0 +1 @@ +for (var i, i2 in {}); \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0124.failure.json b/lib/test/esprima/invalid-syntax/migrated_0124.failure.json new file mode 100644 index 0000000..06d751f --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0124.failure.json @@ -0,0 +1,6 @@ +{ + "index": 14, + "lineNumber": 1, + "column": 15, + "message": "Error: Line 1: Unexpected token )" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0124.js b/lib/test/esprima/invalid-syntax/migrated_0124.js new file mode 100644 index 0000000..fba65c9 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0124.js @@ -0,0 +1 @@ +for ((i in {})); \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0125.failure.json b/lib/test/esprima/invalid-syntax/migrated_0125.failure.json new file mode 100644 index 0000000..8af789a --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0125.failure.json @@ -0,0 +1,6 @@ +{ + "index": 10, + "lineNumber": 1, + "column": 11, + "message": "Error: Line 1: Invalid left-hand side in for-in" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0125.js b/lib/test/esprima/invalid-syntax/migrated_0125.js new file mode 100644 index 0000000..ec4b3d7 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0125.js @@ -0,0 +1 @@ +for (i + 1 in {}); \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0126.failure.json b/lib/test/esprima/invalid-syntax/migrated_0126.failure.json new file mode 100644 index 0000000..cd39b22 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0126.failure.json @@ -0,0 +1,6 @@ +{ + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Error: Line 1: Invalid left-hand side in for-in" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0126.js b/lib/test/esprima/invalid-syntax/migrated_0126.js new file mode 100644 index 0000000..296d2bb --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0126.js @@ -0,0 +1 @@ +for (+i in {}); \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0127.failure.json b/lib/test/esprima/invalid-syntax/migrated_0127.failure.json new file mode 100644 index 0000000..7b54e6a --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0127.failure.json @@ -0,0 +1,6 @@ +{ + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Unexpected end of input" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0127.js b/lib/test/esprima/invalid-syntax/migrated_0127.js new file mode 100644 index 0000000..edefc10 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0127.js @@ -0,0 +1 @@ +if(false) \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0128.failure.json b/lib/test/esprima/invalid-syntax/migrated_0128.failure.json new file mode 100644 index 0000000..d27d77f --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0128.failure.json @@ -0,0 +1,6 @@ +{ + "index": 24, + "lineNumber": 1, + "column": 25, + "message": "Error: Line 1: Unexpected end of input" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0128.js b/lib/test/esprima/invalid-syntax/migrated_0128.js new file mode 100644 index 0000000..71b98df --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0128.js @@ -0,0 +1 @@ +if(false) doThis(); else \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0129.failure.json b/lib/test/esprima/invalid-syntax/migrated_0129.failure.json new file mode 100644 index 0000000..c9fe862 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0129.failure.json @@ -0,0 +1,6 @@ +{ + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected end of input" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0129.js b/lib/test/esprima/invalid-syntax/migrated_0129.js new file mode 100644 index 0000000..7d46b28 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0129.js @@ -0,0 +1 @@ +do \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0130.failure.json b/lib/test/esprima/invalid-syntax/migrated_0130.failure.json new file mode 100644 index 0000000..32cb837 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0130.failure.json @@ -0,0 +1,6 @@ +{ + "index": 12, + "lineNumber": 1, + "column": 13, + "message": "Error: Line 1: Unexpected end of input" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0130.js b/lib/test/esprima/invalid-syntax/migrated_0130.js new file mode 100644 index 0000000..b321f19 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0130.js @@ -0,0 +1 @@ +while(false) \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0131.failure.json b/lib/test/esprima/invalid-syntax/migrated_0131.failure.json new file mode 100644 index 0000000..47d6431 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0131.failure.json @@ -0,0 +1,6 @@ +{ + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Error: Line 1: Unexpected end of input" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0131.js b/lib/test/esprima/invalid-syntax/migrated_0131.js new file mode 100644 index 0000000..3cee0cd --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0131.js @@ -0,0 +1 @@ +for(;;) \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0132.failure.json b/lib/test/esprima/invalid-syntax/migrated_0132.failure.json new file mode 100644 index 0000000..47d6431 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0132.failure.json @@ -0,0 +1,6 @@ +{ + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Error: Line 1: Unexpected end of input" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0132.js b/lib/test/esprima/invalid-syntax/migrated_0132.js new file mode 100644 index 0000000..c6bdc6d --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0132.js @@ -0,0 +1 @@ +with(x) \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0133.failure.json b/lib/test/esprima/invalid-syntax/migrated_0133.failure.json new file mode 100644 index 0000000..1f6452d --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0133.failure.json @@ -0,0 +1,6 @@ +{ + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Error: Line 1: Missing catch or finally after try" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0133.js b/lib/test/esprima/invalid-syntax/migrated_0133.js new file mode 100644 index 0000000..1b2a043 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0133.js @@ -0,0 +1 @@ +try { } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0134.failure.json b/lib/test/esprima/invalid-syntax/migrated_0134.failure.json new file mode 100644 index 0000000..8c257eb --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0134.failure.json @@ -0,0 +1,6 @@ +{ + "index": 14, + "lineNumber": 1, + "column": 15, + "message": "Error: Line 1: Unexpected number" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0134.js b/lib/test/esprima/invalid-syntax/migrated_0134.js new file mode 100644 index 0000000..ba5e91a --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0134.js @@ -0,0 +1 @@ +try {} catch (42) {} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0135.failure.json b/lib/test/esprima/invalid-syntax/migrated_0135.failure.json new file mode 100644 index 0000000..1c0fb22 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0135.failure.json @@ -0,0 +1,6 @@ +{ + "index": 20, + "lineNumber": 1, + "column": 21, + "message": "Error: Line 1: Unexpected token (" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0135.js b/lib/test/esprima/invalid-syntax/migrated_0135.js new file mode 100644 index 0000000..1346030 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0135.js @@ -0,0 +1 @@ +try {} catch (answer()) {} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0136.failure.json b/lib/test/esprima/invalid-syntax/migrated_0136.failure.json new file mode 100644 index 0000000..193a2a5 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0136.failure.json @@ -0,0 +1,6 @@ +{ + "index": 14, + "lineNumber": 1, + "column": 15, + "message": "Error: Line 1: Unexpected token -" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0136.js b/lib/test/esprima/invalid-syntax/migrated_0136.js new file mode 100644 index 0000000..98fe21c --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0136.js @@ -0,0 +1 @@ +try {} catch (-x) {} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0137.failure.json b/lib/test/esprima/invalid-syntax/migrated_0137.failure.json new file mode 100644 index 0000000..2c62392 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0137.failure.json @@ -0,0 +1,6 @@ +{ + "index": 0, + "lineNumber": 1, + "column": 1, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0137.source.js b/lib/test/esprima/invalid-syntax/migrated_0137.source.js new file mode 100644 index 0000000..2bab676 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0137.source.js @@ -0,0 +1 @@ +var source = '\u203F = 10'; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0138.failure.json b/lib/test/esprima/invalid-syntax/migrated_0138.failure.json new file mode 100644 index 0000000..23bbddd --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0138.failure.json @@ -0,0 +1,6 @@ +{ + "index": 15, + "lineNumber": 1, + "column": 16, + "message": "Error: Line 1: Unexpected token ;" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0138.js b/lib/test/esprima/invalid-syntax/migrated_0138.js new file mode 100644 index 0000000..92dc7af --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0138.js @@ -0,0 +1 @@ +const x = 12, y; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0139.failure.json b/lib/test/esprima/invalid-syntax/migrated_0139.failure.json new file mode 100644 index 0000000..f6f6944 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0139.failure.json @@ -0,0 +1,6 @@ +{ + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Error: Line 1: Unexpected token ," +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0139.js b/lib/test/esprima/invalid-syntax/migrated_0139.js new file mode 100644 index 0000000..3df8f8b --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0139.js @@ -0,0 +1 @@ +const x, y = 12; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0140.failure.json b/lib/test/esprima/invalid-syntax/migrated_0140.failure.json new file mode 100644 index 0000000..2d2e9ab --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0140.failure.json @@ -0,0 +1,6 @@ +{ + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Error: Line 1: Unexpected token ;" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0140.js b/lib/test/esprima/invalid-syntax/migrated_0140.js new file mode 100644 index 0000000..2a0cf2a --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0140.js @@ -0,0 +1 @@ +const x; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0141.failure.json b/lib/test/esprima/invalid-syntax/migrated_0141.failure.json new file mode 100644 index 0000000..6c58321 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0141.failure.json @@ -0,0 +1 @@ +{"index":13,"lineNumber":1,"column":14,"message":"Error: Line 1: Unexpected identifier","description":"Unexpected identifier"} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0141.js b/lib/test/esprima/invalid-syntax/migrated_0141.js new file mode 100644 index 0000000..0d93cbb --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0141.js @@ -0,0 +1 @@ +if(true) let a = 1; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0142.failure.json b/lib/test/esprima/invalid-syntax/migrated_0142.failure.json new file mode 100644 index 0000000..a89cc0f --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0142.failure.json @@ -0,0 +1,6 @@ +{ + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Unexpected token const" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0142.js b/lib/test/esprima/invalid-syntax/migrated_0142.js new file mode 100644 index 0000000..c36e6f2 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0142.js @@ -0,0 +1 @@ +if(true) const a = 1; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0143.failure.json b/lib/test/esprima/invalid-syntax/migrated_0143.failure.json new file mode 100644 index 0000000..5cde82c --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0143.failure.json @@ -0,0 +1,6 @@ +{ + "index": 30, + "lineNumber": 1, + "column": 31, + "message": "Error: Line 1: More than one default clause in switch statement" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0143.js b/lib/test/esprima/invalid-syntax/migrated_0143.js new file mode 100644 index 0000000..e95f254 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0143.js @@ -0,0 +1 @@ +switch (c) { default: default: } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0144.failure.json b/lib/test/esprima/invalid-syntax/migrated_0144.failure.json new file mode 100644 index 0000000..bb23e79 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0144.failure.json @@ -0,0 +1,6 @@ +{ + "index": 8, + "lineNumber": 1, + "column": 9, + "message": "Error: Line 1: Unexpected string" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0144.js b/lib/test/esprima/invalid-syntax/migrated_0144.js new file mode 100644 index 0000000..07afe03 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0144.js @@ -0,0 +1 @@ +new X()."s" \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0145.failure.json b/lib/test/esprima/invalid-syntax/migrated_0145.failure.json new file mode 100644 index 0000000..9a84332 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0145.failure.json @@ -0,0 +1,6 @@ +{ + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0145.js b/lib/test/esprima/invalid-syntax/migrated_0145.js new file mode 100644 index 0000000..22e8364 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0145.js @@ -0,0 +1 @@ +/* \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0146.failure.json b/lib/test/esprima/invalid-syntax/migrated_0146.failure.json new file mode 100644 index 0000000..5dde791 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0146.failure.json @@ -0,0 +1,6 @@ +{ + "index": 5, + "lineNumber": 4, + "column": 1, + "message": "Error: Line 4: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0146.js b/lib/test/esprima/invalid-syntax/migrated_0146.js new file mode 100644 index 0000000..c9a4262 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0146.js @@ -0,0 +1,3 @@ +/* + + diff --git a/lib/test/esprima/invalid-syntax/migrated_0147.failure.json b/lib/test/esprima/invalid-syntax/migrated_0147.failure.json new file mode 100644 index 0000000..e026030 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0147.failure.json @@ -0,0 +1,6 @@ +{ + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0147.js b/lib/test/esprima/invalid-syntax/migrated_0147.js new file mode 100644 index 0000000..45ee88f --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0147.js @@ -0,0 +1 @@ +/** \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0148.failure.json b/lib/test/esprima/invalid-syntax/migrated_0148.failure.json new file mode 100644 index 0000000..96be8c5 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0148.failure.json @@ -0,0 +1,6 @@ +{ + "index": 5, + "lineNumber": 3, + "column": 2, + "message": "Error: Line 3: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0148.js b/lib/test/esprima/invalid-syntax/migrated_0148.js new file mode 100644 index 0000000..95a6f3a --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0148.js @@ -0,0 +1,3 @@ +/* + +* \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0149.failure.json b/lib/test/esprima/invalid-syntax/migrated_0149.failure.json new file mode 100644 index 0000000..42c4387 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0149.failure.json @@ -0,0 +1,6 @@ +{ + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0149.js b/lib/test/esprima/invalid-syntax/migrated_0149.js new file mode 100644 index 0000000..c1dc0e4 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0149.js @@ -0,0 +1 @@ +/*hello \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0150.failure.json b/lib/test/esprima/invalid-syntax/migrated_0150.failure.json new file mode 100644 index 0000000..b14d755 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0150.failure.json @@ -0,0 +1,6 @@ +{ + "index": 10, + "lineNumber": 1, + "column": 11, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0150.js b/lib/test/esprima/invalid-syntax/migrated_0150.js new file mode 100644 index 0000000..f299909 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0150.js @@ -0,0 +1 @@ +/*hello * \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0151.failure.json b/lib/test/esprima/invalid-syntax/migrated_0151.failure.json new file mode 100644 index 0000000..2b9c412 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0151.failure.json @@ -0,0 +1,6 @@ +{ + "index": 1, + "lineNumber": 2, + "column": 1, + "message": "Error: Line 2: Unexpected token ]" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0151.js b/lib/test/esprima/invalid-syntax/migrated_0151.js new file mode 100644 index 0000000..4edaa42 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0151.js @@ -0,0 +1,2 @@ + +] \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0152.failure.json b/lib/test/esprima/invalid-syntax/migrated_0152.failure.json new file mode 100644 index 0000000..2b9c412 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0152.failure.json @@ -0,0 +1,6 @@ +{ + "index": 1, + "lineNumber": 2, + "column": 1, + "message": "Error: Line 2: Unexpected token ]" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0152.js b/lib/test/esprima/invalid-syntax/migrated_0152.js new file mode 100644 index 0000000..5965dc1 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0152.js @@ -0,0 +1 @@ + ] \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0153.failure.json b/lib/test/esprima/invalid-syntax/migrated_0153.failure.json new file mode 100644 index 0000000..6003dbf --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0153.failure.json @@ -0,0 +1,6 @@ +{ + "index": 2, + "lineNumber": 2, + "column": 1, + "message": "Error: Line 2: Unexpected token ]" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0153.js b/lib/test/esprima/invalid-syntax/migrated_0153.js new file mode 100644 index 0000000..0505244 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0153.js @@ -0,0 +1,2 @@ + +] \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0154.failure.json b/lib/test/esprima/invalid-syntax/migrated_0154.failure.json new file mode 100644 index 0000000..c430931 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0154.failure.json @@ -0,0 +1,6 @@ +{ + "index": 2, + "lineNumber": 3, + "column": 1, + "message": "Error: Line 3: Unexpected token ]" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0154.js b/lib/test/esprima/invalid-syntax/migrated_0154.js new file mode 100644 index 0000000..b02ef5a --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0154.js @@ -0,0 +1,2 @@ + + ] \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0155.failure.json b/lib/test/esprima/invalid-syntax/migrated_0155.failure.json new file mode 100644 index 0000000..fd756f4 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0155.failure.json @@ -0,0 +1,6 @@ +{ + "index": 4, + "lineNumber": 2, + "column": 1, + "message": "Error: Line 2: Unexpected token ]" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0155.js b/lib/test/esprima/invalid-syntax/migrated_0155.js new file mode 100644 index 0000000..c5a7dbb --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0155.js @@ -0,0 +1,2 @@ +// +] \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0156.failure.json b/lib/test/esprima/invalid-syntax/migrated_0156.failure.json new file mode 100644 index 0000000..9ab5582 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0156.failure.json @@ -0,0 +1,6 @@ +{ + "index": 4, + "lineNumber": 3, + "column": 1, + "message": "Error: Line 3: Unexpected token ]" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0156.js b/lib/test/esprima/invalid-syntax/migrated_0156.js new file mode 100644 index 0000000..89ac622 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0156.js @@ -0,0 +1,2 @@ +// + ] \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0157.failure.json b/lib/test/esprima/invalid-syntax/migrated_0157.failure.json new file mode 100644 index 0000000..959282b --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0157.failure.json @@ -0,0 +1,6 @@ +{ + "index": 4, + "lineNumber": 1, + "column": 5, + "message": "Error: Line 1: Invalid regular expression: missing /" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0157.js b/lib/test/esprima/invalid-syntax/migrated_0157.js new file mode 100644 index 0000000..706ad61 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0157.js @@ -0,0 +1,2 @@ +/a\ +/ \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0158.failure.json b/lib/test/esprima/invalid-syntax/migrated_0158.failure.json new file mode 100644 index 0000000..08ef1fb --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0158.failure.json @@ -0,0 +1,6 @@ +{ + "index": 5, + "lineNumber": 3, + "column": 1, + "message": "Error: Line 3: Unexpected token ]" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0158.js b/lib/test/esprima/invalid-syntax/migrated_0158.js new file mode 100644 index 0000000..e365ebe --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0158.js @@ -0,0 +1,2 @@ +// +] \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0159.failure.json b/lib/test/esprima/invalid-syntax/migrated_0159.failure.json new file mode 100644 index 0000000..9ef3b38 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0159.failure.json @@ -0,0 +1,6 @@ +{ + "index": 6, + "lineNumber": 2, + "column": 3, + "message": "Error: Line 2: Unexpected token ]" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0159.js b/lib/test/esprima/invalid-syntax/migrated_0159.js new file mode 100644 index 0000000..db9e136 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0159.js @@ -0,0 +1,2 @@ +/* +*/] \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0160.failure.json b/lib/test/esprima/invalid-syntax/migrated_0160.failure.json new file mode 100644 index 0000000..2972e60 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0160.failure.json @@ -0,0 +1,6 @@ +{ + "index": 6, + "lineNumber": 3, + "column": 3, + "message": "Error: Line 3: Unexpected token ]" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0160.js b/lib/test/esprima/invalid-syntax/migrated_0160.js new file mode 100644 index 0000000..365f61f --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0160.js @@ -0,0 +1,2 @@ +/* + */] \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0161.failure.json b/lib/test/esprima/invalid-syntax/migrated_0161.failure.json new file mode 100644 index 0000000..6054d91 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0161.failure.json @@ -0,0 +1,6 @@ +{ + "index": 7, + "lineNumber": 3, + "column": 3, + "message": "Error: Line 3: Unexpected token ]" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0161.js b/lib/test/esprima/invalid-syntax/migrated_0161.js new file mode 100644 index 0000000..7465fdb --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0161.js @@ -0,0 +1,2 @@ +/* +*/] \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0162.failure.json b/lib/test/esprima/invalid-syntax/migrated_0162.failure.json new file mode 100644 index 0000000..b966e10 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0162.failure.json @@ -0,0 +1,6 @@ +{ + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0162.js b/lib/test/esprima/invalid-syntax/migrated_0162.js new file mode 100644 index 0000000..ea4f9ca --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0162.js @@ -0,0 +1 @@ +\\ \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0163.failure.json b/lib/test/esprima/invalid-syntax/migrated_0163.failure.json new file mode 100644 index 0000000..d83e34a --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0163.failure.json @@ -0,0 +1,6 @@ +{ + "index": 6, + "lineNumber": 1, + "column": 7, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0163.source.js b/lib/test/esprima/invalid-syntax/migrated_0163.source.js new file mode 100644 index 0000000..8e99796 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0163.source.js @@ -0,0 +1 @@ +var source = '\\u005c'; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0164.failure.json b/lib/test/esprima/invalid-syntax/migrated_0164.failure.json new file mode 100644 index 0000000..b966e10 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0164.failure.json @@ -0,0 +1,6 @@ +{ + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0164.js b/lib/test/esprima/invalid-syntax/migrated_0164.js new file mode 100644 index 0000000..0d4eae5 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0164.js @@ -0,0 +1 @@ +\x \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0165.failure.json b/lib/test/esprima/invalid-syntax/migrated_0165.failure.json new file mode 100644 index 0000000..d83e34a --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0165.failure.json @@ -0,0 +1,6 @@ +{ + "index": 6, + "lineNumber": 1, + "column": 7, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0165.source.js b/lib/test/esprima/invalid-syntax/migrated_0165.source.js new file mode 100644 index 0000000..b27b307 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0165.source.js @@ -0,0 +1 @@ +var source = '\\u0000'; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0166.failure.json b/lib/test/esprima/invalid-syntax/migrated_0166.failure.json new file mode 100644 index 0000000..2c62392 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0166.failure.json @@ -0,0 +1,6 @@ +{ + "index": 0, + "lineNumber": 1, + "column": 1, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0166.source.js b/lib/test/esprima/invalid-syntax/migrated_0166.source.js new file mode 100644 index 0000000..3493241 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0166.source.js @@ -0,0 +1 @@ +var source = '\u200C = []'; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0167.failure.json b/lib/test/esprima/invalid-syntax/migrated_0167.failure.json new file mode 100644 index 0000000..2c62392 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0167.failure.json @@ -0,0 +1,6 @@ +{ + "index": 0, + "lineNumber": 1, + "column": 1, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0167.source.js b/lib/test/esprima/invalid-syntax/migrated_0167.source.js new file mode 100644 index 0000000..92ad111 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0167.source.js @@ -0,0 +1 @@ +var source = '\u200D = []'; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0168.failure.json b/lib/test/esprima/invalid-syntax/migrated_0168.failure.json new file mode 100644 index 0000000..01bfca3 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0168.failure.json @@ -0,0 +1,6 @@ +{ + "index": 0, + "lineNumber": 1, + "column": 1, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} diff --git a/lib/test/esprima/invalid-syntax/migrated_0168.js b/lib/test/esprima/invalid-syntax/migrated_0168.js new file mode 100644 index 0000000..00a2584 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0168.js @@ -0,0 +1 @@ +"\ \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0169.failure.json b/lib/test/esprima/invalid-syntax/migrated_0169.failure.json new file mode 100644 index 0000000..e026030 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0169.failure.json @@ -0,0 +1,6 @@ +{ + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ILLEGAL" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0169.source.js b/lib/test/esprima/invalid-syntax/migrated_0169.source.js new file mode 100644 index 0000000..fcd7144 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0169.source.js @@ -0,0 +1 @@ +var source = '"\\u'; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0170.failure.json b/lib/test/esprima/invalid-syntax/migrated_0170.failure.json new file mode 100644 index 0000000..06d751f --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0170.failure.json @@ -0,0 +1,6 @@ +{ + "index": 14, + "lineNumber": 1, + "column": 15, + "message": "Error: Line 1: Unexpected token )" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0170.js b/lib/test/esprima/invalid-syntax/migrated_0170.js new file mode 100644 index 0000000..362e0ff --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0170.js @@ -0,0 +1 @@ +try { } catch() {} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0171.failure.json b/lib/test/esprima/invalid-syntax/migrated_0171.failure.json new file mode 100644 index 0000000..3a193b7 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0171.failure.json @@ -0,0 +1,6 @@ +{ + "index": 6, + "lineNumber": 1, + "column": 7, + "message": "Error: Line 1: Illegal return statement" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0171.js b/lib/test/esprima/invalid-syntax/migrated_0171.js new file mode 100644 index 0000000..55b1f0f --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0171.js @@ -0,0 +1 @@ +return \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0172.failure.json b/lib/test/esprima/invalid-syntax/migrated_0172.failure.json new file mode 100644 index 0000000..df4e976 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0172.failure.json @@ -0,0 +1,6 @@ +{ + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Error: Line 1: Illegal break statement" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0172.js b/lib/test/esprima/invalid-syntax/migrated_0172.js new file mode 100644 index 0000000..5da7034 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0172.js @@ -0,0 +1 @@ +break \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0173.failure.json b/lib/test/esprima/invalid-syntax/migrated_0173.failure.json new file mode 100644 index 0000000..1632814 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0173.failure.json @@ -0,0 +1,6 @@ +{ + "index": 8, + "lineNumber": 1, + "column": 9, + "message": "Error: Line 1: Illegal continue statement" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0173.js b/lib/test/esprima/invalid-syntax/migrated_0173.js new file mode 100644 index 0000000..b296031 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0173.js @@ -0,0 +1 @@ +continue \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0174.failure.json b/lib/test/esprima/invalid-syntax/migrated_0174.failure.json new file mode 100644 index 0000000..3c5244a --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0174.failure.json @@ -0,0 +1,6 @@ +{ + "index": 31, + "lineNumber": 1, + "column": 32, + "message": "Error: Line 1: Illegal continue statement" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0174.js b/lib/test/esprima/invalid-syntax/migrated_0174.js new file mode 100644 index 0000000..4877dbd --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0174.js @@ -0,0 +1 @@ +switch (x) { default: continue; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0175.failure.json b/lib/test/esprima/invalid-syntax/migrated_0175.failure.json new file mode 100644 index 0000000..3f1a1e3 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0175.failure.json @@ -0,0 +1,6 @@ +{ + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Unexpected token *" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0175.js b/lib/test/esprima/invalid-syntax/migrated_0175.js new file mode 100644 index 0000000..d1dab07 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0175.js @@ -0,0 +1 @@ +do { x } * \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0176.failure.json b/lib/test/esprima/invalid-syntax/migrated_0176.failure.json new file mode 100644 index 0000000..c35c746 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0176.failure.json @@ -0,0 +1,6 @@ +{ + "index": 22, + "lineNumber": 1, + "column": 23, + "message": "Error: Line 1: Undefined label 'x'" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0176.js b/lib/test/esprima/invalid-syntax/migrated_0176.js new file mode 100644 index 0000000..73ddc91 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0176.js @@ -0,0 +1 @@ +while (true) { break x; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0177.failure.json b/lib/test/esprima/invalid-syntax/migrated_0177.failure.json new file mode 100644 index 0000000..84a852b --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0177.failure.json @@ -0,0 +1,6 @@ +{ + "index": 25, + "lineNumber": 1, + "column": 26, + "message": "Error: Line 1: Undefined label 'x'" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0177.js b/lib/test/esprima/invalid-syntax/migrated_0177.js new file mode 100644 index 0000000..518c967 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0177.js @@ -0,0 +1 @@ +while (true) { continue x; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0178.failure.json b/lib/test/esprima/invalid-syntax/migrated_0178.failure.json new file mode 100644 index 0000000..5133e4f --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0178.failure.json @@ -0,0 +1,6 @@ +{ + "index": 40, + "lineNumber": 1, + "column": 41, + "message": "Error: Line 1: Undefined label 'x'" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0178.js b/lib/test/esprima/invalid-syntax/migrated_0178.js new file mode 100644 index 0000000..d925d78 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0178.js @@ -0,0 +1 @@ +x: while (true) { (function () { break x; }); } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0179.failure.json b/lib/test/esprima/invalid-syntax/migrated_0179.failure.json new file mode 100644 index 0000000..defedbc --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0179.failure.json @@ -0,0 +1,6 @@ +{ + "index": 43, + "lineNumber": 1, + "column": 44, + "message": "Error: Line 1: Undefined label 'x'" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0179.js b/lib/test/esprima/invalid-syntax/migrated_0179.js new file mode 100644 index 0000000..2b6a7bb --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0179.js @@ -0,0 +1 @@ +x: while (true) { (function () { continue x; }); } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0180.failure.json b/lib/test/esprima/invalid-syntax/migrated_0180.failure.json new file mode 100644 index 0000000..bf304ee --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0180.failure.json @@ -0,0 +1,6 @@ +{ + "index": 39, + "lineNumber": 1, + "column": 40, + "message": "Error: Line 1: Illegal break statement" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0180.js b/lib/test/esprima/invalid-syntax/migrated_0180.js new file mode 100644 index 0000000..f013175 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0180.js @@ -0,0 +1 @@ +x: while (true) { (function () { break; }); } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0181.failure.json b/lib/test/esprima/invalid-syntax/migrated_0181.failure.json new file mode 100644 index 0000000..0861ea0 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0181.failure.json @@ -0,0 +1,6 @@ +{ + "index": 42, + "lineNumber": 1, + "column": 43, + "message": "Error: Line 1: Illegal continue statement" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0181.js b/lib/test/esprima/invalid-syntax/migrated_0181.js new file mode 100644 index 0000000..3e0f871 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0181.js @@ -0,0 +1 @@ +x: while (true) { (function () { continue; }); } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0182.failure.json b/lib/test/esprima/invalid-syntax/migrated_0182.failure.json new file mode 100644 index 0000000..02571b2 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0182.failure.json @@ -0,0 +1,6 @@ +{ + "index": 20, + "lineNumber": 1, + "column": 21, + "message": "Error: Line 1: Label 'x' has already been declared" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0182.js b/lib/test/esprima/invalid-syntax/migrated_0182.js new file mode 100644 index 0000000..93e3c1c --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0182.js @@ -0,0 +1 @@ +x: while (true) { x: while (true) { } } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0183.failure.json b/lib/test/esprima/invalid-syntax/migrated_0183.failure.json new file mode 100644 index 0000000..7946d11 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0183.failure.json @@ -0,0 +1,6 @@ +{ + "index": 37, + "lineNumber": 1, + "column": 38, + "message": "Error: Line 1: Delete of an unqualified identifier in strict mode." +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0183.js b/lib/test/esprima/invalid-syntax/migrated_0183.js new file mode 100644 index 0000000..9dcd5c4 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0183.js @@ -0,0 +1 @@ +(function () { 'use strict'; delete i; }()) \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0184.failure.json b/lib/test/esprima/invalid-syntax/migrated_0184.failure.json new file mode 100644 index 0000000..e815dd2 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0184.failure.json @@ -0,0 +1,6 @@ +{ + "index": 28, + "lineNumber": 1, + "column": 29, + "message": "Error: Line 1: Strict mode code may not include a with statement" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0184.js b/lib/test/esprima/invalid-syntax/migrated_0184.js new file mode 100644 index 0000000..ab4ab18 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0184.js @@ -0,0 +1 @@ +(function () { 'use strict'; with (i); }()) \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0185.failure.json b/lib/test/esprima/invalid-syntax/migrated_0185.failure.json new file mode 100644 index 0000000..8863e63 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0185.failure.json @@ -0,0 +1,6 @@ +{ + "index": 40, + "lineNumber": 1, + "column": 41, + "message": "Error: Line 1: Variable name may not be eval or arguments in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0185.js b/lib/test/esprima/invalid-syntax/migrated_0185.js new file mode 100644 index 0000000..9dd5785 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0185.js @@ -0,0 +1 @@ +function hello() {'use strict'; var eval = 10; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0186.failure.json b/lib/test/esprima/invalid-syntax/migrated_0186.failure.json new file mode 100644 index 0000000..5f6d88f --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0186.failure.json @@ -0,0 +1,6 @@ +{ + "index": 45, + "lineNumber": 1, + "column": 46, + "message": "Error: Line 1: Variable name may not be eval or arguments in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0186.js b/lib/test/esprima/invalid-syntax/migrated_0186.js new file mode 100644 index 0000000..20851bb --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0186.js @@ -0,0 +1 @@ +function hello() {'use strict'; var arguments = 10; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0187.failure.json b/lib/test/esprima/invalid-syntax/migrated_0187.failure.json new file mode 100644 index 0000000..d1576b0 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0187.failure.json @@ -0,0 +1,6 @@ +{ + "index": 51, + "lineNumber": 1, + "column": 52, + "message": "Error: Line 1: Catch variable may not be eval or arguments in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0187.js b/lib/test/esprima/invalid-syntax/migrated_0187.js new file mode 100644 index 0000000..543da77 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0187.js @@ -0,0 +1 @@ +function hello() {'use strict'; try { } catch (eval) { } } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0188.failure.json b/lib/test/esprima/invalid-syntax/migrated_0188.failure.json new file mode 100644 index 0000000..f9f4970 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0188.failure.json @@ -0,0 +1,6 @@ +{ + "index": 56, + "lineNumber": 1, + "column": 57, + "message": "Error: Line 1: Catch variable may not be eval or arguments in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0188.js b/lib/test/esprima/invalid-syntax/migrated_0188.js new file mode 100644 index 0000000..cc1030e --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0188.js @@ -0,0 +1 @@ +function hello() {'use strict'; try { } catch (arguments) { } } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0189.failure.json b/lib/test/esprima/invalid-syntax/migrated_0189.failure.json new file mode 100644 index 0000000..74a53a6 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0189.failure.json @@ -0,0 +1,6 @@ +{ + "index": 32, + "lineNumber": 1, + "column": 33, + "message": "Error: Line 1: Assignment to eval or arguments is not allowed in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0189.js b/lib/test/esprima/invalid-syntax/migrated_0189.js new file mode 100644 index 0000000..0b13acf --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0189.js @@ -0,0 +1 @@ +function hello() {'use strict'; eval = 10; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0190.failure.json b/lib/test/esprima/invalid-syntax/migrated_0190.failure.json new file mode 100644 index 0000000..74a53a6 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0190.failure.json @@ -0,0 +1,6 @@ +{ + "index": 32, + "lineNumber": 1, + "column": 33, + "message": "Error: Line 1: Assignment to eval or arguments is not allowed in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0190.js b/lib/test/esprima/invalid-syntax/migrated_0190.js new file mode 100644 index 0000000..d3f743d --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0190.js @@ -0,0 +1 @@ +function hello() {'use strict'; arguments = 10; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0191.failure.json b/lib/test/esprima/invalid-syntax/migrated_0191.failure.json new file mode 100644 index 0000000..450b437 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0191.failure.json @@ -0,0 +1,6 @@ +{ + "index": 38, + "lineNumber": 1, + "column": 39, + "message": "Error: Line 1: Prefix increment/decrement may not have eval or arguments operand in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0191.js b/lib/test/esprima/invalid-syntax/migrated_0191.js new file mode 100644 index 0000000..9908f08 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0191.js @@ -0,0 +1 @@ +function hello() {'use strict'; ++eval; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0192.failure.json b/lib/test/esprima/invalid-syntax/migrated_0192.failure.json new file mode 100644 index 0000000..450b437 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0192.failure.json @@ -0,0 +1,6 @@ +{ + "index": 38, + "lineNumber": 1, + "column": 39, + "message": "Error: Line 1: Prefix increment/decrement may not have eval or arguments operand in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0192.js b/lib/test/esprima/invalid-syntax/migrated_0192.js new file mode 100644 index 0000000..b0c9655 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0192.js @@ -0,0 +1 @@ +function hello() {'use strict'; --eval; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0193.failure.json b/lib/test/esprima/invalid-syntax/migrated_0193.failure.json new file mode 100644 index 0000000..ffb8652 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0193.failure.json @@ -0,0 +1,6 @@ +{ + "index": 43, + "lineNumber": 1, + "column": 44, + "message": "Error: Line 1: Prefix increment/decrement may not have eval or arguments operand in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0193.js b/lib/test/esprima/invalid-syntax/migrated_0193.js new file mode 100644 index 0000000..978196d --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0193.js @@ -0,0 +1 @@ +function hello() {'use strict'; ++arguments; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0194.failure.json b/lib/test/esprima/invalid-syntax/migrated_0194.failure.json new file mode 100644 index 0000000..ffb8652 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0194.failure.json @@ -0,0 +1,6 @@ +{ + "index": 43, + "lineNumber": 1, + "column": 44, + "message": "Error: Line 1: Prefix increment/decrement may not have eval or arguments operand in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0194.js b/lib/test/esprima/invalid-syntax/migrated_0194.js new file mode 100644 index 0000000..b1042be --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0194.js @@ -0,0 +1 @@ +function hello() {'use strict'; --arguments; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0195.failure.json b/lib/test/esprima/invalid-syntax/migrated_0195.failure.json new file mode 100644 index 0000000..0650d3a --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0195.failure.json @@ -0,0 +1,6 @@ +{ + "index": 36, + "lineNumber": 1, + "column": 37, + "message": "Error: Line 1: Postfix increment/decrement may not have eval or arguments operand in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0195.js b/lib/test/esprima/invalid-syntax/migrated_0195.js new file mode 100644 index 0000000..0d3bb5a --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0195.js @@ -0,0 +1 @@ +function hello() {'use strict'; eval++; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0196.failure.json b/lib/test/esprima/invalid-syntax/migrated_0196.failure.json new file mode 100644 index 0000000..0650d3a --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0196.failure.json @@ -0,0 +1,6 @@ +{ + "index": 36, + "lineNumber": 1, + "column": 37, + "message": "Error: Line 1: Postfix increment/decrement may not have eval or arguments operand in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0196.js b/lib/test/esprima/invalid-syntax/migrated_0196.js new file mode 100644 index 0000000..aa25d1f --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0196.js @@ -0,0 +1 @@ +function hello() {'use strict'; eval--; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0197.failure.json b/lib/test/esprima/invalid-syntax/migrated_0197.failure.json new file mode 100644 index 0000000..9150b8f --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0197.failure.json @@ -0,0 +1,6 @@ +{ + "index": 41, + "lineNumber": 1, + "column": 42, + "message": "Error: Line 1: Postfix increment/decrement may not have eval or arguments operand in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0197.js b/lib/test/esprima/invalid-syntax/migrated_0197.js new file mode 100644 index 0000000..2cf35cd --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0197.js @@ -0,0 +1 @@ +function hello() {'use strict'; arguments++; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0198.failure.json b/lib/test/esprima/invalid-syntax/migrated_0198.failure.json new file mode 100644 index 0000000..9150b8f --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0198.failure.json @@ -0,0 +1,6 @@ +{ + "index": 41, + "lineNumber": 1, + "column": 42, + "message": "Error: Line 1: Postfix increment/decrement may not have eval or arguments operand in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0198.js b/lib/test/esprima/invalid-syntax/migrated_0198.js new file mode 100644 index 0000000..4e578c0 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0198.js @@ -0,0 +1 @@ +function hello() {'use strict'; arguments--; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0199.failure.json b/lib/test/esprima/invalid-syntax/migrated_0199.failure.json new file mode 100644 index 0000000..ad820b9 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0199.failure.json @@ -0,0 +1,6 @@ +{ + "index": 41, + "lineNumber": 1, + "column": 42, + "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0199.js b/lib/test/esprima/invalid-syntax/migrated_0199.js new file mode 100644 index 0000000..c7fa960 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0199.js @@ -0,0 +1 @@ +function hello() {'use strict'; function eval() { } } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0200.failure.json b/lib/test/esprima/invalid-syntax/migrated_0200.failure.json new file mode 100644 index 0000000..ad820b9 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0200.failure.json @@ -0,0 +1,6 @@ +{ + "index": 41, + "lineNumber": 1, + "column": 42, + "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0200.js b/lib/test/esprima/invalid-syntax/migrated_0200.js new file mode 100644 index 0000000..59a6aa3 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0200.js @@ -0,0 +1 @@ +function hello() {'use strict'; function arguments() { } } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0201.failure.json b/lib/test/esprima/invalid-syntax/migrated_0201.failure.json new file mode 100644 index 0000000..b658c9e --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0201.failure.json @@ -0,0 +1,6 @@ +{ + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0201.js b/lib/test/esprima/invalid-syntax/migrated_0201.js new file mode 100644 index 0000000..4b75674 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0201.js @@ -0,0 +1 @@ +function eval() {'use strict'; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0202.failure.json b/lib/test/esprima/invalid-syntax/migrated_0202.failure.json new file mode 100644 index 0000000..b658c9e --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0202.failure.json @@ -0,0 +1,6 @@ +{ + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0202.js b/lib/test/esprima/invalid-syntax/migrated_0202.js new file mode 100644 index 0000000..3dca413 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0202.js @@ -0,0 +1 @@ +function arguments() {'use strict'; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0203.failure.json b/lib/test/esprima/invalid-syntax/migrated_0203.failure.json new file mode 100644 index 0000000..dd354d8 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0203.failure.json @@ -0,0 +1,6 @@ +{ + "index": 42, + "lineNumber": 1, + "column": 43, + "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0203.js b/lib/test/esprima/invalid-syntax/migrated_0203.js new file mode 100644 index 0000000..94168d7 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0203.js @@ -0,0 +1 @@ +function hello() {'use strict'; (function eval() { }()) } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0204.failure.json b/lib/test/esprima/invalid-syntax/migrated_0204.failure.json new file mode 100644 index 0000000..dd354d8 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0204.failure.json @@ -0,0 +1,6 @@ +{ + "index": 42, + "lineNumber": 1, + "column": 43, + "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0204.js b/lib/test/esprima/invalid-syntax/migrated_0204.js new file mode 100644 index 0000000..6f869d7 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0204.js @@ -0,0 +1 @@ +function hello() {'use strict'; (function arguments() { }()) } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0205.failure.json b/lib/test/esprima/invalid-syntax/migrated_0205.failure.json new file mode 100644 index 0000000..2e80978 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0205.failure.json @@ -0,0 +1,6 @@ +{ + "index": 10, + "lineNumber": 1, + "column": 11, + "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0205.js b/lib/test/esprima/invalid-syntax/migrated_0205.js new file mode 100644 index 0000000..52727a1 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0205.js @@ -0,0 +1 @@ +(function eval() {'use strict'; })() \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0206.failure.json b/lib/test/esprima/invalid-syntax/migrated_0206.failure.json new file mode 100644 index 0000000..2e80978 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0206.failure.json @@ -0,0 +1,6 @@ +{ + "index": 10, + "lineNumber": 1, + "column": 11, + "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0206.js b/lib/test/esprima/invalid-syntax/migrated_0206.js new file mode 100644 index 0000000..485202c --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0206.js @@ -0,0 +1 @@ +(function arguments() {'use strict'; })() \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0207.failure.json b/lib/test/esprima/invalid-syntax/migrated_0207.failure.json new file mode 100644 index 0000000..bd84d5c --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0207.failure.json @@ -0,0 +1,6 @@ +{ + "index": 47, + "lineNumber": 1, + "column": 48, + "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0207.js b/lib/test/esprima/invalid-syntax/migrated_0207.js new file mode 100644 index 0000000..baf4d38 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0207.js @@ -0,0 +1 @@ +function hello() {'use strict'; ({ s: function eval() { } }); } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0208.failure.json b/lib/test/esprima/invalid-syntax/migrated_0208.failure.json new file mode 100644 index 0000000..64c63f6 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0208.failure.json @@ -0,0 +1,6 @@ +{ + "index": 10, + "lineNumber": 1, + "column": 11, + "message": "Error: Line 1: Use of future reserved word in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0208.js b/lib/test/esprima/invalid-syntax/migrated_0208.js new file mode 100644 index 0000000..c915ef6 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0208.js @@ -0,0 +1 @@ +(function package() {'use strict'; })() \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0209.failure.json b/lib/test/esprima/invalid-syntax/migrated_0209.failure.json new file mode 100644 index 0000000..81f5436 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0209.failure.json @@ -0,0 +1,6 @@ +{ + "index": 48, + "lineNumber": 1, + "column": 49, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0209.js b/lib/test/esprima/invalid-syntax/migrated_0209.js new file mode 100644 index 0000000..2a69fba --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0209.js @@ -0,0 +1 @@ +function hello() {'use strict'; ({ i: 10, set s(eval) { } }); } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0210.failure.json b/lib/test/esprima/invalid-syntax/migrated_0210.failure.json new file mode 100644 index 0000000..f58d48c --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0210.failure.json @@ -0,0 +1,6 @@ +{ + "index": 41, + "lineNumber": 1, + "column": 42, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0210.js b/lib/test/esprima/invalid-syntax/migrated_0210.js new file mode 100644 index 0000000..82df3d8 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0210.js @@ -0,0 +1 @@ +function hello() {'use strict'; ({ set s(eval) { } }); } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0211.failure.json b/lib/test/esprima/invalid-syntax/migrated_0211.failure.json new file mode 100644 index 0000000..47e311c --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0211.failure.json @@ -0,0 +1,6 @@ +{ + "index": 49, + "lineNumber": 1, + "column": 50, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0211.js b/lib/test/esprima/invalid-syntax/migrated_0211.js new file mode 100644 index 0000000..411cc11 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0211.js @@ -0,0 +1 @@ +function hello() {'use strict'; ({ s: function s(eval) { } }); } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0212.failure.json b/lib/test/esprima/invalid-syntax/migrated_0212.failure.json new file mode 100644 index 0000000..55ee5d4 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0212.failure.json @@ -0,0 +1,6 @@ +{ + "index": 15, + "lineNumber": 1, + "column": 16, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0212.js b/lib/test/esprima/invalid-syntax/migrated_0212.js new file mode 100644 index 0000000..80fa129 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0212.js @@ -0,0 +1 @@ +function hello(eval) {'use strict';} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0213.failure.json b/lib/test/esprima/invalid-syntax/migrated_0213.failure.json new file mode 100644 index 0000000..55ee5d4 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0213.failure.json @@ -0,0 +1,6 @@ +{ + "index": 15, + "lineNumber": 1, + "column": 16, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0213.js b/lib/test/esprima/invalid-syntax/migrated_0213.js new file mode 100644 index 0000000..0dd1bab --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0213.js @@ -0,0 +1 @@ +function hello(arguments) {'use strict';} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0214.failure.json b/lib/test/esprima/invalid-syntax/migrated_0214.failure.json new file mode 100644 index 0000000..81f5436 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0214.failure.json @@ -0,0 +1,6 @@ +{ + "index": 48, + "lineNumber": 1, + "column": 49, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0214.js b/lib/test/esprima/invalid-syntax/migrated_0214.js new file mode 100644 index 0000000..44fbaba --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0214.js @@ -0,0 +1 @@ +function hello() { 'use strict'; function inner(eval) {} } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0215.failure.json b/lib/test/esprima/invalid-syntax/migrated_0215.failure.json new file mode 100644 index 0000000..81f5436 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0215.failure.json @@ -0,0 +1,6 @@ +{ + "index": 48, + "lineNumber": 1, + "column": 49, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0215.js b/lib/test/esprima/invalid-syntax/migrated_0215.js new file mode 100644 index 0000000..92c45ed --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0215.js @@ -0,0 +1 @@ +function hello() { 'use strict'; function inner(arguments) {} } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0216.failure.json b/lib/test/esprima/invalid-syntax/migrated_0216.failure.json new file mode 100644 index 0000000..2747096 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0216.failure.json @@ -0,0 +1,6 @@ +{ + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Error: Line 1: Octal literals are not allowed in strict mode." +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0216.js b/lib/test/esprima/invalid-syntax/migrated_0216.js new file mode 100644 index 0000000..584201b --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0216.js @@ -0,0 +1 @@ + "\1"; 'use strict'; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0217.failure.json b/lib/test/esprima/invalid-syntax/migrated_0217.failure.json new file mode 100644 index 0000000..299eb21 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0217.failure.json @@ -0,0 +1,6 @@ +{ + "index": 33, + "lineNumber": 1, + "column": 34, + "message": "Error: Line 1: Octal literals are not allowed in strict mode." +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0217.js b/lib/test/esprima/invalid-syntax/migrated_0217.js new file mode 100644 index 0000000..b86f218 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0217.js @@ -0,0 +1 @@ +function hello() { 'use strict'; "\1"; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0218.failure.json b/lib/test/esprima/invalid-syntax/migrated_0218.failure.json new file mode 100644 index 0000000..299eb21 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0218.failure.json @@ -0,0 +1,6 @@ +{ + "index": 33, + "lineNumber": 1, + "column": 34, + "message": "Error: Line 1: Octal literals are not allowed in strict mode." +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0218.js b/lib/test/esprima/invalid-syntax/migrated_0218.js new file mode 100644 index 0000000..4545763 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0218.js @@ -0,0 +1 @@ +function hello() { 'use strict'; 021; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0219.failure.json b/lib/test/esprima/invalid-syntax/migrated_0219.failure.json new file mode 100644 index 0000000..75b37f4 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0219.failure.json @@ -0,0 +1,6 @@ +{ + "index": 36, + "lineNumber": 1, + "column": 37, + "message": "Error: Line 1: Octal literals are not allowed in strict mode." +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0219.js b/lib/test/esprima/invalid-syntax/migrated_0219.js new file mode 100644 index 0000000..8994ebc --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0219.js @@ -0,0 +1 @@ +function hello() { 'use strict'; ({ "\1": 42 }); } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0220.failure.json b/lib/test/esprima/invalid-syntax/migrated_0220.failure.json new file mode 100644 index 0000000..75b37f4 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0220.failure.json @@ -0,0 +1,6 @@ +{ + "index": 36, + "lineNumber": 1, + "column": 37, + "message": "Error: Line 1: Octal literals are not allowed in strict mode." +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0220.js b/lib/test/esprima/invalid-syntax/migrated_0220.js new file mode 100644 index 0000000..2eeb8bb --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0220.js @@ -0,0 +1 @@ +function hello() { 'use strict'; ({ 021: 42 }); } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0221.failure.json b/lib/test/esprima/invalid-syntax/migrated_0221.failure.json new file mode 100644 index 0000000..01c15e4 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0221.failure.json @@ -0,0 +1,6 @@ +{ + "index": 19, + "lineNumber": 1, + "column": 20, + "message": "Error: Line 1: Octal literals are not allowed in strict mode." +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0221.js b/lib/test/esprima/invalid-syntax/migrated_0221.js new file mode 100644 index 0000000..a7303d5 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0221.js @@ -0,0 +1 @@ +function hello() { "octal directive\1"; "use strict"; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0222.failure.json b/lib/test/esprima/invalid-syntax/migrated_0222.failure.json new file mode 100644 index 0000000..01c15e4 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0222.failure.json @@ -0,0 +1,6 @@ +{ + "index": 19, + "lineNumber": 1, + "column": 20, + "message": "Error: Line 1: Octal literals are not allowed in strict mode." +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0222.js b/lib/test/esprima/invalid-syntax/migrated_0222.js new file mode 100644 index 0000000..cf73a4e --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0222.js @@ -0,0 +1 @@ +function hello() { "octal directive\1"; "octal directive\2"; "use strict"; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0223.failure.json b/lib/test/esprima/invalid-syntax/migrated_0223.failure.json new file mode 100644 index 0000000..3aa8abf --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0223.failure.json @@ -0,0 +1,6 @@ +{ + "index": 52, + "lineNumber": 1, + "column": 53, + "message": "Error: Line 1: Octal literals are not allowed in strict mode." +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0223.js b/lib/test/esprima/invalid-syntax/migrated_0223.js new file mode 100644 index 0000000..95fe09f --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0223.js @@ -0,0 +1 @@ +function hello() { "use strict"; function inner() { "octal directive\1"; } } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0224.failure.json b/lib/test/esprima/invalid-syntax/migrated_0224.failure.json new file mode 100644 index 0000000..4fda6b0 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0224.failure.json @@ -0,0 +1,6 @@ +{ + "index": 37, + "lineNumber": 1, + "column": 38, + "message": "Error: Line 1: Use of future reserved word in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0224.js b/lib/test/esprima/invalid-syntax/migrated_0224.js new file mode 100644 index 0000000..3df9ff1 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0224.js @@ -0,0 +1 @@ +function hello() { "use strict"; var implements; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0225.failure.json b/lib/test/esprima/invalid-syntax/migrated_0225.failure.json new file mode 100644 index 0000000..4fda6b0 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0225.failure.json @@ -0,0 +1,6 @@ +{ + "index": 37, + "lineNumber": 1, + "column": 38, + "message": "Error: Line 1: Use of future reserved word in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0225.js b/lib/test/esprima/invalid-syntax/migrated_0225.js new file mode 100644 index 0000000..faf5c1e --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0225.js @@ -0,0 +1 @@ +function hello() { "use strict"; var interface; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0226.failure.json b/lib/test/esprima/invalid-syntax/migrated_0226.failure.json new file mode 100644 index 0000000..4fda6b0 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0226.failure.json @@ -0,0 +1,6 @@ +{ + "index": 37, + "lineNumber": 1, + "column": 38, + "message": "Error: Line 1: Use of future reserved word in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0226.js b/lib/test/esprima/invalid-syntax/migrated_0226.js new file mode 100644 index 0000000..aa60af3 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0226.js @@ -0,0 +1 @@ +function hello() { "use strict"; var package; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0227.failure.json b/lib/test/esprima/invalid-syntax/migrated_0227.failure.json new file mode 100644 index 0000000..4fda6b0 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0227.failure.json @@ -0,0 +1,6 @@ +{ + "index": 37, + "lineNumber": 1, + "column": 38, + "message": "Error: Line 1: Use of future reserved word in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0227.js b/lib/test/esprima/invalid-syntax/migrated_0227.js new file mode 100644 index 0000000..1cacf74 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0227.js @@ -0,0 +1 @@ +function hello() { "use strict"; var private; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0228.failure.json b/lib/test/esprima/invalid-syntax/migrated_0228.failure.json new file mode 100644 index 0000000..4fda6b0 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0228.failure.json @@ -0,0 +1,6 @@ +{ + "index": 37, + "lineNumber": 1, + "column": 38, + "message": "Error: Line 1: Use of future reserved word in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0228.js b/lib/test/esprima/invalid-syntax/migrated_0228.js new file mode 100644 index 0000000..319c7f2 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0228.js @@ -0,0 +1 @@ +function hello() { "use strict"; var protected; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0229.failure.json b/lib/test/esprima/invalid-syntax/migrated_0229.failure.json new file mode 100644 index 0000000..4fda6b0 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0229.failure.json @@ -0,0 +1,6 @@ +{ + "index": 37, + "lineNumber": 1, + "column": 38, + "message": "Error: Line 1: Use of future reserved word in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0229.js b/lib/test/esprima/invalid-syntax/migrated_0229.js new file mode 100644 index 0000000..f799df4 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0229.js @@ -0,0 +1 @@ +function hello() { "use strict"; var public; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0230.failure.json b/lib/test/esprima/invalid-syntax/migrated_0230.failure.json new file mode 100644 index 0000000..4fda6b0 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0230.failure.json @@ -0,0 +1,6 @@ +{ + "index": 37, + "lineNumber": 1, + "column": 38, + "message": "Error: Line 1: Use of future reserved word in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0230.js b/lib/test/esprima/invalid-syntax/migrated_0230.js new file mode 100644 index 0000000..5c389d8 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0230.js @@ -0,0 +1 @@ +function hello() { "use strict"; var static; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0231.failure.json b/lib/test/esprima/invalid-syntax/migrated_0231.failure.json new file mode 100644 index 0000000..4fda6b0 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0231.failure.json @@ -0,0 +1,6 @@ +{ + "index": 37, + "lineNumber": 1, + "column": 38, + "message": "Error: Line 1: Use of future reserved word in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0231.js b/lib/test/esprima/invalid-syntax/migrated_0231.js new file mode 100644 index 0000000..80fdca7 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0231.js @@ -0,0 +1 @@ +function hello() { "use strict"; var yield; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0232.failure.json b/lib/test/esprima/invalid-syntax/migrated_0232.failure.json new file mode 100644 index 0000000..4fda6b0 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0232.failure.json @@ -0,0 +1,6 @@ +{ + "index": 37, + "lineNumber": 1, + "column": 38, + "message": "Error: Line 1: Use of future reserved word in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0232.js b/lib/test/esprima/invalid-syntax/migrated_0232.js new file mode 100644 index 0000000..311dc25 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0232.js @@ -0,0 +1 @@ +function hello() { "use strict"; var let; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0233.failure.json b/lib/test/esprima/invalid-syntax/migrated_0233.failure.json new file mode 100644 index 0000000..224fe4a --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0233.failure.json @@ -0,0 +1,6 @@ +{ + "index": 15, + "lineNumber": 1, + "column": 16, + "message": "Error: Line 1: Use of future reserved word in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0233.js b/lib/test/esprima/invalid-syntax/migrated_0233.js new file mode 100644 index 0000000..62445d1 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0233.js @@ -0,0 +1 @@ +function hello(static) { "use strict"; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0234.failure.json b/lib/test/esprima/invalid-syntax/migrated_0234.failure.json new file mode 100644 index 0000000..8845060 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0234.failure.json @@ -0,0 +1,6 @@ +{ + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Use of future reserved word in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0234.js b/lib/test/esprima/invalid-syntax/migrated_0234.js new file mode 100644 index 0000000..02d8601 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0234.js @@ -0,0 +1 @@ +function static() { "use strict"; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0235.failure.json b/lib/test/esprima/invalid-syntax/migrated_0235.failure.json new file mode 100644 index 0000000..b658c9e --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0235.failure.json @@ -0,0 +1,6 @@ +{ + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0235.js b/lib/test/esprima/invalid-syntax/migrated_0235.js new file mode 100644 index 0000000..87e1054 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0235.js @@ -0,0 +1 @@ +function eval(a) { "use strict"; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0236.failure.json b/lib/test/esprima/invalid-syntax/migrated_0236.failure.json new file mode 100644 index 0000000..b658c9e --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0236.failure.json @@ -0,0 +1,6 @@ +{ + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0236.js b/lib/test/esprima/invalid-syntax/migrated_0236.js new file mode 100644 index 0000000..a238dc5 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0236.js @@ -0,0 +1 @@ +function arguments(a) { "use strict"; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0239.failure.json b/lib/test/esprima/invalid-syntax/migrated_0239.failure.json new file mode 100644 index 0000000..00d5829 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0239.failure.json @@ -0,0 +1,6 @@ +{ + "index": 23, + "lineNumber": 1, + "column": 24, + "message": "Error: Line 1: Use of future reserved word in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0239.js b/lib/test/esprima/invalid-syntax/migrated_0239.js new file mode 100644 index 0000000..dc3ed02 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0239.js @@ -0,0 +1 @@ +"use strict"; function static() { } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0240.failure.json b/lib/test/esprima/invalid-syntax/migrated_0240.failure.json new file mode 100644 index 0000000..be67bcc --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0240.failure.json @@ -0,0 +1,6 @@ +{ + "index": 14, + "lineNumber": 1, + "column": 15, + "message": "Error: Line 1: Strict mode function may not have duplicate parameter names" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0240.js b/lib/test/esprima/invalid-syntax/migrated_0240.js new file mode 100644 index 0000000..c2eebad --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0240.js @@ -0,0 +1 @@ +function a(t, t) { "use strict"; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0241.failure.json b/lib/test/esprima/invalid-syntax/migrated_0241.failure.json new file mode 100644 index 0000000..a6df326 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0241.failure.json @@ -0,0 +1,6 @@ +{ + "index": 11, + "lineNumber": 1, + "column": 12, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0241.js b/lib/test/esprima/invalid-syntax/migrated_0241.js new file mode 100644 index 0000000..8a9bf32 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0241.js @@ -0,0 +1 @@ +function a(eval) { "use strict"; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0242.failure.json b/lib/test/esprima/invalid-syntax/migrated_0242.failure.json new file mode 100644 index 0000000..46287e3 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0242.failure.json @@ -0,0 +1,6 @@ +{ + "index": 11, + "lineNumber": 1, + "column": 12, + "message": "Error: Line 1: Use of future reserved word in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0242.js b/lib/test/esprima/invalid-syntax/migrated_0242.js new file mode 100644 index 0000000..494a785 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0242.js @@ -0,0 +1 @@ +function a(package) { "use strict"; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0243.failure.json b/lib/test/esprima/invalid-syntax/migrated_0243.failure.json new file mode 100644 index 0000000..2cb3f11 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0243.failure.json @@ -0,0 +1,6 @@ +{ + "index": 43, + "lineNumber": 1, + "column": 44, + "message": "Error: Line 1: Strict mode function may not have duplicate parameter names" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0243.js b/lib/test/esprima/invalid-syntax/migrated_0243.js new file mode 100644 index 0000000..1512965 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0243.js @@ -0,0 +1 @@ +function a() { "use strict"; function b(t, t) { }; } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0244.failure.json b/lib/test/esprima/invalid-syntax/migrated_0244.failure.json new file mode 100644 index 0000000..26ec5f9 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0244.failure.json @@ -0,0 +1,6 @@ +{ + "index": 15, + "lineNumber": 1, + "column": 16, + "message": "Error: Line 1: Strict mode function may not have duplicate parameter names" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0244.js b/lib/test/esprima/invalid-syntax/migrated_0244.js new file mode 100644 index 0000000..3b2a586 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0244.js @@ -0,0 +1 @@ +(function a(t, t) { "use strict"; }) \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0245.failure.json b/lib/test/esprima/invalid-syntax/migrated_0245.failure.json new file mode 100644 index 0000000..0133e97 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0245.failure.json @@ -0,0 +1,6 @@ +{ + "index": 44, + "lineNumber": 1, + "column": 45, + "message": "Error: Line 1: Strict mode function may not have duplicate parameter names" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0245.js b/lib/test/esprima/invalid-syntax/migrated_0245.js new file mode 100644 index 0000000..63bb595 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0245.js @@ -0,0 +1 @@ +function a() { "use strict"; (function b(t, t) { }); } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0246.failure.json b/lib/test/esprima/invalid-syntax/migrated_0246.failure.json new file mode 100644 index 0000000..0af9f05 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0246.failure.json @@ -0,0 +1,6 @@ +{ + "index": 12, + "lineNumber": 1, + "column": 13, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0246.js b/lib/test/esprima/invalid-syntax/migrated_0246.js new file mode 100644 index 0000000..c928b6f --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0246.js @@ -0,0 +1 @@ +(function a(eval) { "use strict"; }) \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0247.failure.json b/lib/test/esprima/invalid-syntax/migrated_0247.failure.json new file mode 100644 index 0000000..867e4b3 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0247.failure.json @@ -0,0 +1,6 @@ +{ + "index": 12, + "lineNumber": 1, + "column": 13, + "message": "Error: Line 1: Use of future reserved word in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0247.js b/lib/test/esprima/invalid-syntax/migrated_0247.js new file mode 100644 index 0000000..d7ffe81 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0247.js @@ -0,0 +1 @@ +(function a(package) { "use strict"; }) \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0248.failure.json b/lib/test/esprima/invalid-syntax/migrated_0248.failure.json new file mode 100644 index 0000000..258b50b --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0248.failure.json @@ -0,0 +1,6 @@ +{ + "index": 21, + "lineNumber": 1, + "column": 22, + "message": "Error: Line 1: Label '__proto__' has already been declared" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0248.js b/lib/test/esprima/invalid-syntax/migrated_0248.js new file mode 100644 index 0000000..c30573d --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0248.js @@ -0,0 +1 @@ +__proto__: __proto__: 42; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0249.failure.json b/lib/test/esprima/invalid-syntax/migrated_0249.failure.json new file mode 100644 index 0000000..dfe0345 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0249.failure.json @@ -0,0 +1,6 @@ +{ + "index": 36, + "lineNumber": 1, + "column": 37, + "message": "Error: Line 1: Strict mode function may not have duplicate parameter names" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0249.js b/lib/test/esprima/invalid-syntax/migrated_0249.js new file mode 100644 index 0000000..4d0854e --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0249.js @@ -0,0 +1 @@ +"use strict"; function t(__proto__, __proto__) { } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0250.failure.json b/lib/test/esprima/invalid-syntax/migrated_0250.failure.json new file mode 100644 index 0000000..eb0a11b --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0250.failure.json @@ -0,0 +1,6 @@ +{ + "index": 30, + "lineNumber": 1, + "column": 31, + "message": "Error: Line 1: Duplicate __proto__ fields are not allowed in object literals" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0250.js b/lib/test/esprima/invalid-syntax/migrated_0250.js new file mode 100644 index 0000000..368e822 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0250.js @@ -0,0 +1 @@ +x = { __proto__: 42, __proto__: 43 } \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0252.failure.json b/lib/test/esprima/invalid-syntax/migrated_0252.failure.json new file mode 100644 index 0000000..856ab25 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0252.failure.json @@ -0,0 +1,6 @@ +{ + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected end of input" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0252.js b/lib/test/esprima/invalid-syntax/migrated_0252.js new file mode 100644 index 0000000..0362a8a --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0252.js @@ -0,0 +1 @@ +var \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0254.failure.json b/lib/test/esprima/invalid-syntax/migrated_0254.failure.json new file mode 100644 index 0000000..e177f1b --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0254.failure.json @@ -0,0 +1,6 @@ +{ + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Error: Line 1: Unexpected end of input" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0254.js b/lib/test/esprima/invalid-syntax/migrated_0254.js new file mode 100644 index 0000000..8baacf4 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0254.js @@ -0,0 +1 @@ +const \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0255.failure.json b/lib/test/esprima/invalid-syntax/migrated_0255.failure.json new file mode 100644 index 0000000..f227f2e --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0255.failure.json @@ -0,0 +1,6 @@ +{ + "index": 8, + "lineNumber": 1, + "column": 9, + "message": "Error: Line 1: Unexpected end of input" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0255.js b/lib/test/esprima/invalid-syntax/migrated_0255.js new file mode 100644 index 0000000..833c700 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0255.js @@ -0,0 +1 @@ +{ ; ; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0256.failure.json b/lib/test/esprima/invalid-syntax/migrated_0256.failure.json new file mode 100644 index 0000000..8048500 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0256.failure.json @@ -0,0 +1,6 @@ +{ + "index": 21, + "lineNumber": 1, + "column": 22, + "message": "Error: Line 1: Unexpected end of input" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0256.js b/lib/test/esprima/invalid-syntax/migrated_0256.js new file mode 100644 index 0000000..8df4b7c --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0256.js @@ -0,0 +1 @@ +function t() { ; ; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0257.failure.json b/lib/test/esprima/invalid-syntax/migrated_0257.failure.json new file mode 100644 index 0000000..ba3d205 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0257.failure.json @@ -0,0 +1,6 @@ +{ + "index": 16, + "lineNumber": 1, + "column": 17, + "message": "Error: Line 1: Use of future reserved word in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0257.js b/lib/test/esprima/invalid-syntax/migrated_0257.js new file mode 100644 index 0000000..7ff4e30 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0257.js @@ -0,0 +1 @@ +'use strict'; a package \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0258.failure.json b/lib/test/esprima/invalid-syntax/migrated_0258.failure.json new file mode 100644 index 0000000..13d7a53 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0258.failure.json @@ -0,0 +1,6 @@ +{ + "index": 18, + "lineNumber": 1, + "column": 19, + "message": "Error: Line 1: Rest parameter must be last formal parameter" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0258.js b/lib/test/esprima/invalid-syntax/migrated_0258.js new file mode 100644 index 0000000..ebc8b18 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0258.js @@ -0,0 +1 @@ +function f(a, ...b, c){} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0259.failure.json b/lib/test/esprima/invalid-syntax/migrated_0259.failure.json new file mode 100644 index 0000000..21bb4a1 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0259.failure.json @@ -0,0 +1,6 @@ +{ + "index": 14, + "lineNumber": 1, + "column": 15, + "message": "Error: Line 1: Unexpected token {" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0259.js b/lib/test/esprima/invalid-syntax/migrated_0259.js new file mode 100644 index 0000000..e2c4369 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0259.js @@ -0,0 +1 @@ +function x(...{ a }){} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0260.failure.json b/lib/test/esprima/invalid-syntax/migrated_0260.failure.json new file mode 100644 index 0000000..b6512f8 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0260.failure.json @@ -0,0 +1,6 @@ +{ + "index": 15, + "lineNumber": 1, + "column": 16, + "message": "Error: Line 1: Unexpected token =" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0260.js b/lib/test/esprima/invalid-syntax/migrated_0260.js new file mode 100644 index 0000000..ea5e2b9 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0260.js @@ -0,0 +1 @@ +function x(...a = 1){} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0261.failure.json b/lib/test/esprima/invalid-syntax/migrated_0261.failure.json new file mode 100644 index 0000000..e177f1b --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0261.failure.json @@ -0,0 +1,6 @@ +{ + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Error: Line 1: Unexpected end of input" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0261.js b/lib/test/esprima/invalid-syntax/migrated_0261.js new file mode 100644 index 0000000..1e88aff --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0261.js @@ -0,0 +1 @@ +class \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0262.failure.json b/lib/test/esprima/invalid-syntax/migrated_0262.failure.json new file mode 100644 index 0000000..389eecd --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0262.failure.json @@ -0,0 +1,6 @@ +{ + "index": 6, + "lineNumber": 1, + "column": 7, + "message": "Error: Line 1: Unexpected end of input" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0262.js b/lib/test/esprima/invalid-syntax/migrated_0262.js new file mode 100644 index 0000000..8440d15 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0262.js @@ -0,0 +1 @@ +class \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0263.failure.json b/lib/test/esprima/invalid-syntax/migrated_0263.failure.json new file mode 100644 index 0000000..dc565a6 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0263.failure.json @@ -0,0 +1,6 @@ +{ + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Error: Line 1: Unexpected token ;" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0263.js b/lib/test/esprima/invalid-syntax/migrated_0263.js new file mode 100644 index 0000000..01cabf9 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0263.js @@ -0,0 +1 @@ +class; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0264.failure.json b/lib/test/esprima/invalid-syntax/migrated_0264.failure.json new file mode 100644 index 0000000..5bcbfe5 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0264.failure.json @@ -0,0 +1,6 @@ +{ + "index": 18, + "lineNumber": 1, + "column": 19, + "message": "Error: Line 1: Unexpected token +" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0264.js b/lib/test/esprima/invalid-syntax/migrated_0264.js new file mode 100644 index 0000000..5cdbfcd --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0264.js @@ -0,0 +1 @@ +class A extends a + b {} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0265.failure.json b/lib/test/esprima/invalid-syntax/migrated_0265.failure.json new file mode 100644 index 0000000..47d6431 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0265.failure.json @@ -0,0 +1,6 @@ +{ + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Error: Line 1: Unexpected end of input" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0265.js b/lib/test/esprima/invalid-syntax/migrated_0265.js new file mode 100644 index 0000000..fb7337e --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0265.js @@ -0,0 +1 @@ +class A \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0266.failure.json b/lib/test/esprima/invalid-syntax/migrated_0266.failure.json new file mode 100644 index 0000000..7b54e6a --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0266.failure.json @@ -0,0 +1,6 @@ +{ + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Unexpected end of input" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0266.js b/lib/test/esprima/invalid-syntax/migrated_0266.js new file mode 100644 index 0000000..2889cae --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0266.js @@ -0,0 +1 @@ +class A { \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0267.failure.json b/lib/test/esprima/invalid-syntax/migrated_0267.failure.json new file mode 100644 index 0000000..2d2e9ab --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0267.failure.json @@ -0,0 +1,6 @@ +{ + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Error: Line 1: Unexpected token ;" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0267.js b/lib/test/esprima/invalid-syntax/migrated_0267.js new file mode 100644 index 0000000..abf3ad6 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0267.js @@ -0,0 +1 @@ +class A; \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0268.failure.json b/lib/test/esprima/invalid-syntax/migrated_0268.failure.json new file mode 100644 index 0000000..2d6e43d --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0268.failure.json @@ -0,0 +1,6 @@ +{ + "index": 10, + "lineNumber": 1, + "column": 11, + "message": "Error: Line 1: Unexpected token :" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0268.js b/lib/test/esprima/invalid-syntax/migrated_0268.js new file mode 100644 index 0000000..e8de7f5 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0268.js @@ -0,0 +1 @@ +class A {a:0} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0269.failure.json b/lib/test/esprima/invalid-syntax/migrated_0269.failure.json new file mode 100644 index 0000000..5397f6f --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0269.failure.json @@ -0,0 +1,6 @@ +{ + "index": 14, + "lineNumber": 1, + "column": 15, + "message": "Error: Line 1: Unexpected token ," +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0269.js b/lib/test/esprima/invalid-syntax/migrated_0269.js new file mode 100644 index 0000000..3f16f8f --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0269.js @@ -0,0 +1 @@ +class A {a(){},b(){}} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0270.failure.json b/lib/test/esprima/invalid-syntax/migrated_0270.failure.json new file mode 100644 index 0000000..05f68a3 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0270.failure.json @@ -0,0 +1,6 @@ +{ + "index": 16, + "lineNumber": 1, + "column": 17, + "message": "Error: Line 1: Classes may not have static property named prototype" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0270.js b/lib/test/esprima/invalid-syntax/migrated_0270.js new file mode 100644 index 0000000..c884fdb --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0270.js @@ -0,0 +1 @@ +class A {static prototype(){}} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0271.failure.json b/lib/test/esprima/invalid-syntax/migrated_0271.failure.json new file mode 100644 index 0000000..05f68a3 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0271.failure.json @@ -0,0 +1,6 @@ +{ + "index": 16, + "lineNumber": 1, + "column": 17, + "message": "Error: Line 1: Classes may not have static property named prototype" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0271.js b/lib/test/esprima/invalid-syntax/migrated_0271.js new file mode 100644 index 0000000..0285beb --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0271.js @@ -0,0 +1 @@ +class A {static "prototype"(){}} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0272.failure.json b/lib/test/esprima/invalid-syntax/migrated_0272.failure.json new file mode 100644 index 0000000..e1046ef --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0272.failure.json @@ -0,0 +1,6 @@ +{ + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Class constructor may not be an accessor" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0272.js b/lib/test/esprima/invalid-syntax/migrated_0272.js new file mode 100644 index 0000000..a53b5e0 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0272.js @@ -0,0 +1 @@ +class A {get constructor(){}} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0273.failure.json b/lib/test/esprima/invalid-syntax/migrated_0273.failure.json new file mode 100644 index 0000000..e1046ef --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0273.failure.json @@ -0,0 +1,6 @@ +{ + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Class constructor may not be an accessor" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0273.js b/lib/test/esprima/invalid-syntax/migrated_0273.js new file mode 100644 index 0000000..19ce272 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0273.js @@ -0,0 +1 @@ +class A {set constructor(m){}} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0274.failure.json b/lib/test/esprima/invalid-syntax/migrated_0274.failure.json new file mode 100644 index 0000000..0c8ba8b --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0274.failure.json @@ -0,0 +1,6 @@ +{ + "index": 25, + "lineNumber": 1, + "column": 26, + "message": "Error: Line 1: A class may only have one constructor" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0274.js b/lib/test/esprima/invalid-syntax/migrated_0274.js new file mode 100644 index 0000000..210af4f --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0274.js @@ -0,0 +1 @@ +class A {constructor(){} "constructor"(){}} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0275.failure.json b/lib/test/esprima/invalid-syntax/migrated_0275.failure.json new file mode 100644 index 0000000..46287e3 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0275.failure.json @@ -0,0 +1,6 @@ +{ + "index": 11, + "lineNumber": 1, + "column": 12, + "message": "Error: Line 1: Use of future reserved word in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0275.js b/lib/test/esprima/invalid-syntax/migrated_0275.js new file mode 100644 index 0000000..cb10311 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0275.js @@ -0,0 +1 @@ +class A {a static(){}} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0276.failure.json b/lib/test/esprima/invalid-syntax/migrated_0276.failure.json new file mode 100644 index 0000000..00d5829 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0276.failure.json @@ -0,0 +1,6 @@ +{ + "index": 23, + "lineNumber": 1, + "column": 24, + "message": "Error: Line 1: Use of future reserved word in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0276.js b/lib/test/esprima/invalid-syntax/migrated_0276.js new file mode 100644 index 0000000..c9c078c --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0276.js @@ -0,0 +1 @@ +class A {static static static(){}} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0277.failure.json b/lib/test/esprima/invalid-syntax/migrated_0277.failure.json new file mode 100644 index 0000000..a771c73 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0277.failure.json @@ -0,0 +1,6 @@ +{ + "index": 11, + "lineNumber": 1, + "column": 12, + "message": "Error: Line 1: Unexpected reserved word" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0277.js b/lib/test/esprima/invalid-syntax/migrated_0277.js new file mode 100644 index 0000000..72c2619 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0277.js @@ -0,0 +1 @@ +class A {a(enum){}} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0278.failure.json b/lib/test/esprima/invalid-syntax/migrated_0278.failure.json new file mode 100644 index 0000000..f6f89cc --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0278.failure.json @@ -0,0 +1,6 @@ +{ + "index": 17, + "lineNumber": 1, + "column": 18, + "message": "Error: Line 1: Use of future reserved word in strict mode" +} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/migrated_0278.js b/lib/test/esprima/invalid-syntax/migrated_0278.js new file mode 100644 index 0000000..e672ad2 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/migrated_0278.js @@ -0,0 +1 @@ +class A {static [static](){};} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/strict_assignment_implements.failure.json b/lib/test/esprima/invalid-syntax/strict_assignment_implements.failure.json new file mode 100644 index 0000000..9a55c0d --- /dev/null +++ b/lib/test/esprima/invalid-syntax/strict_assignment_implements.failure.json @@ -0,0 +1 @@ +{"index":33,"lineNumber":1,"column":34,"message":"Error: Line 1: Use of future reserved word in strict mode","description":"Use of future reserved word in strict mode"} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/strict_assignment_implements.js b/lib/test/esprima/invalid-syntax/strict_assignment_implements.js new file mode 100644 index 0000000..bd437d2 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/strict_assignment_implements.js @@ -0,0 +1 @@ +function hello() { "use strict"; implements = 1; } diff --git a/lib/test/esprima/invalid-syntax/strict_assignment_interface.failure.json b/lib/test/esprima/invalid-syntax/strict_assignment_interface.failure.json new file mode 100644 index 0000000..9a55c0d --- /dev/null +++ b/lib/test/esprima/invalid-syntax/strict_assignment_interface.failure.json @@ -0,0 +1 @@ +{"index":33,"lineNumber":1,"column":34,"message":"Error: Line 1: Use of future reserved word in strict mode","description":"Use of future reserved word in strict mode"} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/strict_assignment_interface.js b/lib/test/esprima/invalid-syntax/strict_assignment_interface.js new file mode 100644 index 0000000..3a0eff3 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/strict_assignment_interface.js @@ -0,0 +1 @@ +function hello() { "use strict"; interface = 1; } diff --git a/lib/test/esprima/invalid-syntax/strict_assignment_let.failure.json b/lib/test/esprima/invalid-syntax/strict_assignment_let.failure.json new file mode 100644 index 0000000..9a55c0d --- /dev/null +++ b/lib/test/esprima/invalid-syntax/strict_assignment_let.failure.json @@ -0,0 +1 @@ +{"index":33,"lineNumber":1,"column":34,"message":"Error: Line 1: Use of future reserved word in strict mode","description":"Use of future reserved word in strict mode"} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/strict_assignment_let.js b/lib/test/esprima/invalid-syntax/strict_assignment_let.js new file mode 100644 index 0000000..15358c8 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/strict_assignment_let.js @@ -0,0 +1 @@ +function hello() { "use strict"; let = 1; } diff --git a/lib/test/esprima/invalid-syntax/strict_assignment_package.failure.json b/lib/test/esprima/invalid-syntax/strict_assignment_package.failure.json new file mode 100644 index 0000000..9a55c0d --- /dev/null +++ b/lib/test/esprima/invalid-syntax/strict_assignment_package.failure.json @@ -0,0 +1 @@ +{"index":33,"lineNumber":1,"column":34,"message":"Error: Line 1: Use of future reserved word in strict mode","description":"Use of future reserved word in strict mode"} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/strict_assignment_package.js b/lib/test/esprima/invalid-syntax/strict_assignment_package.js new file mode 100644 index 0000000..4344e3a --- /dev/null +++ b/lib/test/esprima/invalid-syntax/strict_assignment_package.js @@ -0,0 +1 @@ +function hello() { "use strict"; package = 1; } diff --git a/lib/test/esprima/invalid-syntax/strict_assignment_private.failure.json b/lib/test/esprima/invalid-syntax/strict_assignment_private.failure.json new file mode 100644 index 0000000..9a55c0d --- /dev/null +++ b/lib/test/esprima/invalid-syntax/strict_assignment_private.failure.json @@ -0,0 +1 @@ +{"index":33,"lineNumber":1,"column":34,"message":"Error: Line 1: Use of future reserved word in strict mode","description":"Use of future reserved word in strict mode"} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/strict_assignment_private.js b/lib/test/esprima/invalid-syntax/strict_assignment_private.js new file mode 100644 index 0000000..6912c0d --- /dev/null +++ b/lib/test/esprima/invalid-syntax/strict_assignment_private.js @@ -0,0 +1 @@ +function hello() { "use strict"; private = 1; } diff --git a/lib/test/esprima/invalid-syntax/strict_assignment_protected.failure.json b/lib/test/esprima/invalid-syntax/strict_assignment_protected.failure.json new file mode 100644 index 0000000..9a55c0d --- /dev/null +++ b/lib/test/esprima/invalid-syntax/strict_assignment_protected.failure.json @@ -0,0 +1 @@ +{"index":33,"lineNumber":1,"column":34,"message":"Error: Line 1: Use of future reserved word in strict mode","description":"Use of future reserved word in strict mode"} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/strict_assignment_protected.js b/lib/test/esprima/invalid-syntax/strict_assignment_protected.js new file mode 100644 index 0000000..0b156b3 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/strict_assignment_protected.js @@ -0,0 +1 @@ +function hello() { "use strict"; protected = 1; } diff --git a/lib/test/esprima/invalid-syntax/strict_assignment_public.failure.json b/lib/test/esprima/invalid-syntax/strict_assignment_public.failure.json new file mode 100644 index 0000000..9a55c0d --- /dev/null +++ b/lib/test/esprima/invalid-syntax/strict_assignment_public.failure.json @@ -0,0 +1 @@ +{"index":33,"lineNumber":1,"column":34,"message":"Error: Line 1: Use of future reserved word in strict mode","description":"Use of future reserved word in strict mode"} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/strict_assignment_public.js b/lib/test/esprima/invalid-syntax/strict_assignment_public.js new file mode 100644 index 0000000..e010564 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/strict_assignment_public.js @@ -0,0 +1 @@ +function hello() { "use strict"; public = 1; } diff --git a/lib/test/esprima/invalid-syntax/strict_assignment_static.failure.json b/lib/test/esprima/invalid-syntax/strict_assignment_static.failure.json new file mode 100644 index 0000000..9a55c0d --- /dev/null +++ b/lib/test/esprima/invalid-syntax/strict_assignment_static.failure.json @@ -0,0 +1 @@ +{"index":33,"lineNumber":1,"column":34,"message":"Error: Line 1: Use of future reserved word in strict mode","description":"Use of future reserved word in strict mode"} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/strict_assignment_static.js b/lib/test/esprima/invalid-syntax/strict_assignment_static.js new file mode 100644 index 0000000..3a7840f --- /dev/null +++ b/lib/test/esprima/invalid-syntax/strict_assignment_static.js @@ -0,0 +1 @@ +function hello() { "use strict"; static = 1; } diff --git a/lib/test/esprima/invalid-syntax/strict_assignment_yield.failure.json b/lib/test/esprima/invalid-syntax/strict_assignment_yield.failure.json new file mode 100644 index 0000000..9a55c0d --- /dev/null +++ b/lib/test/esprima/invalid-syntax/strict_assignment_yield.failure.json @@ -0,0 +1 @@ +{"index":33,"lineNumber":1,"column":34,"message":"Error: Line 1: Use of future reserved word in strict mode","description":"Use of future reserved word in strict mode"} \ No newline at end of file diff --git a/lib/test/esprima/invalid-syntax/strict_assignment_yield.js b/lib/test/esprima/invalid-syntax/strict_assignment_yield.js new file mode 100644 index 0000000..5933555 --- /dev/null +++ b/lib/test/esprima/invalid-syntax/strict_assignment_yield.js @@ -0,0 +1 @@ +function hello() { "use strict"; yield = 1; } diff --git a/lib/test/esprima/source-element/migrated_0000.js b/lib/test/esprima/source-element/migrated_0000.js new file mode 100644 index 0000000..e69de29 diff --git a/lib/test/esprima/source-element/migrated_0000.skip b/lib/test/esprima/source-element/migrated_0000.skip new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/lib/test/esprima/source-element/migrated_0000.skip @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/source-element/migrated_0000.tree.json b/lib/test/esprima/source-element/migrated_0000.tree.json new file mode 100644 index 0000000..034ea1b --- /dev/null +++ b/lib/test/esprima/source-element/migrated_0000.tree.json @@ -0,0 +1,20 @@ +{ + "type": "Program", + "body": [], + "sourceType": "script", + "tokens": [], + "range": [ + 0, + 0 + ], + "loc": { + "start": { + "line": 0, + "column": 0 + }, + "end": { + "line": 0, + "column": 0 + } + } +} diff --git a/lib/test/esprima/source-option/migrated_0000.diff b/lib/test/esprima/source-option/migrated_0000.diff new file mode 100644 index 0000000..9826ba7 --- /dev/null +++ b/lib/test/esprima/source-option/migrated_0000.diff @@ -0,0 +1,21 @@ +{ + 'loc': { 'source': null }, + 'body': { + '0': { + 'loc': { 'source': null }, + 'expression': { + 'loc': { 'source': null }, + 'right': { 'loc': { 'source': null } }, + 'left': { + 'loc': { 'source': null }, + 'left': { + 'loc': { 'source': null } + }, + 'right': { + 'loc': { 'source': null } + } + } + } + } + } +} diff --git a/lib/test/esprima/source-option/migrated_0000.js b/lib/test/esprima/source-option/migrated_0000.js new file mode 100644 index 0000000..55b4239 --- /dev/null +++ b/lib/test/esprima/source-option/migrated_0000.js @@ -0,0 +1 @@ +x + y - z \ No newline at end of file diff --git a/lib/test/esprima/source-option/migrated_0000.tree.json b/lib/test/esprima/source-option/migrated_0000.tree.json new file mode 100644 index 0000000..b3bbb28 --- /dev/null +++ b/lib/test/esprima/source-option/migrated_0000.tree.json @@ -0,0 +1,226 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "-", + "left": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "source": "42.js" + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "source": "42.js" + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "source": "42.js" + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + }, + "source": "42.js" + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + }, + "source": "42.js" + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + }, + "source": "42.js" + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "-", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + }, + "source": "42.js" + } +} diff --git a/lib/test/esprima/source-option/migrated_0001.diff b/lib/test/esprima/source-option/migrated_0001.diff new file mode 100644 index 0000000..1a89d6d --- /dev/null +++ b/lib/test/esprima/source-option/migrated_0001.diff @@ -0,0 +1,33 @@ +{ + 'loc': { 'source': null }, + 'body': { + '0': { + 'loc': { 'source': null }, + 'expression': { + 'loc': { 'source': null }, + 'right': { 'loc': { 'source': null } }, + 'left': { + 'loc': { 'source': null }, + 'left': { + 'loc': { 'source': null } + }, + 'right': { + 'loc': { 'source': null }, + 'left': { + 'loc': { 'source': null } + }, + 'right': { + 'loc': { 'source': null }, + 'left': { + 'loc': { 'source': null } + }, + 'right': { + 'loc': { 'source': null } + } + } + } + } + } + } + } +} diff --git a/lib/test/esprima/source-option/migrated_0001.js b/lib/test/esprima/source-option/migrated_0001.js new file mode 100644 index 0000000..5ed08c0 --- /dev/null +++ b/lib/test/esprima/source-option/migrated_0001.js @@ -0,0 +1 @@ +a + (b < (c * d)) + e \ No newline at end of file diff --git a/lib/test/esprima/source-option/migrated_0001.tree.json b/lib/test/esprima/source-option/migrated_0001.tree.json new file mode 100644 index 0000000..b912cca --- /dev/null +++ b/lib/test/esprima/source-option/migrated_0001.tree.json @@ -0,0 +1,446 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "Identifier", + "name": "a", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "source": "42.js" + } + }, + "right": { + "type": "BinaryExpression", + "operator": "<", + "left": { + "type": "Identifier", + "name": "b", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "source": "42.js" + } + }, + "right": { + "type": "BinaryExpression", + "operator": "*", + "left": { + "type": "Identifier", + "name": "c", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "source": "42.js" + } + }, + "right": { + "type": "Identifier", + "name": "d", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + }, + "source": "42.js" + } + }, + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + }, + "source": "42.js" + } + }, + "range": [ + 5, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 16 + }, + "source": "42.js" + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + }, + "source": "42.js" + } + }, + "right": { + "type": "Identifier", + "name": "e", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + }, + "source": "42.js" + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + }, + "source": "42.js" + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + }, + "source": "42.js" + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "a", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "e", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + }, + "source": "42.js" + } +} diff --git a/lib/test/esprima/source-type-module/error-delete.js b/lib/test/esprima/source-type-module/error-delete.js new file mode 100644 index 0000000..eb6dc52 --- /dev/null +++ b/lib/test/esprima/source-type-module/error-delete.js @@ -0,0 +1,2 @@ +import x from "x"; +delete x; diff --git a/lib/test/esprima/source-type-module/error-delete.module.json b/lib/test/esprima/source-type-module/error-delete.module.json new file mode 100644 index 0000000..88318ff --- /dev/null +++ b/lib/test/esprima/source-type-module/error-delete.module.json @@ -0,0 +1,7 @@ +{ + "index": 27, + "lineNumber": 2, + "column": 9, + "message": "Error: Line 2: Delete of an unqualified identifier in strict mode.", + "description": "Delete of an unqualified identifier in strict mode." +} diff --git a/lib/test/esprima/source-type-module/error-export-if.js b/lib/test/esprima/source-type-module/error-export-if.js new file mode 100644 index 0000000..b75a643 --- /dev/null +++ b/lib/test/esprima/source-type-module/error-export-if.js @@ -0,0 +1 @@ +export if foo = 1; diff --git a/lib/test/esprima/source-type-module/error-export-if.module.json b/lib/test/esprima/source-type-module/error-export-if.module.json new file mode 100644 index 0000000..fd931f2 --- /dev/null +++ b/lib/test/esprima/source-type-module/error-export-if.module.json @@ -0,0 +1,7 @@ +{ + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Error: Line 1: Unexpected token if", + "description": "Unexpected token if" +} diff --git a/lib/test/esprima/source-type-module/error-export-in-function.js b/lib/test/esprima/source-type-module/error-export-in-function.js new file mode 100644 index 0000000..cdc0cd3 --- /dev/null +++ b/lib/test/esprima/source-type-module/error-export-in-function.js @@ -0,0 +1,4 @@ +function x() { + export default friends; +} + diff --git a/lib/test/esprima/source-type-module/error-export-in-function.module.json b/lib/test/esprima/source-type-module/error-export-in-function.module.json new file mode 100644 index 0000000..5545a32 --- /dev/null +++ b/lib/test/esprima/source-type-module/error-export-in-function.module.json @@ -0,0 +1,7 @@ +{ + "index": 14, + "lineNumber": 1, + "column": 15, + "message": "Error: Line 1: Unexpected token", + "description": "Unexpected token" +} diff --git a/lib/test/esprima/source-type-module/error-import-in-function.js b/lib/test/esprima/source-type-module/error-import-in-function.js new file mode 100644 index 0000000..a669067 --- /dev/null +++ b/lib/test/esprima/source-type-module/error-import-in-function.js @@ -0,0 +1,3 @@ +function x() { + import foo from "foo"; +} diff --git a/lib/test/esprima/source-type-module/error-import-in-function.module.json b/lib/test/esprima/source-type-module/error-import-in-function.module.json new file mode 100644 index 0000000..5545a32 --- /dev/null +++ b/lib/test/esprima/source-type-module/error-import-in-function.module.json @@ -0,0 +1,7 @@ +{ + "index": 14, + "lineNumber": 1, + "column": 15, + "message": "Error: Line 1: Unexpected token", + "description": "Unexpected token" +} diff --git a/lib/test/esprima/source-type-module/error-invalid-export-declaration.failure.json b/lib/test/esprima/source-type-module/error-invalid-export-declaration.failure.json new file mode 100644 index 0000000..c1f352e --- /dev/null +++ b/lib/test/esprima/source-type-module/error-invalid-export-declaration.failure.json @@ -0,0 +1,7 @@ +{ + "index": 0, + "lineNumber": 1, + "column": 1, + "message": "Error: Line 1: Unexpected token", + "description": "Unexpected token" +} diff --git a/lib/test/esprima/source-type-module/error-invalid-export-declaration.js b/lib/test/esprima/source-type-module/error-invalid-export-declaration.js new file mode 100644 index 0000000..ea9b101 --- /dev/null +++ b/lib/test/esprima/source-type-module/error-invalid-export-declaration.js @@ -0,0 +1 @@ +export default function () {} diff --git a/lib/test/esprima/source-type-module/error-invalid-import-declaration.failure.json b/lib/test/esprima/source-type-module/error-invalid-import-declaration.failure.json new file mode 100644 index 0000000..c1f352e --- /dev/null +++ b/lib/test/esprima/source-type-module/error-invalid-import-declaration.failure.json @@ -0,0 +1,7 @@ +{ + "index": 0, + "lineNumber": 1, + "column": 1, + "message": "Error: Line 1: Unexpected token", + "description": "Unexpected token" +} diff --git a/lib/test/esprima/source-type-module/error-invalid-import-declaration.js b/lib/test/esprima/source-type-module/error-invalid-import-declaration.js new file mode 100644 index 0000000..8d14200 --- /dev/null +++ b/lib/test/esprima/source-type-module/error-invalid-import-declaration.js @@ -0,0 +1 @@ +import foo from "foo"; diff --git a/lib/test/esprima/source-type-module/error-strict.js b/lib/test/esprima/source-type-module/error-strict.js new file mode 100644 index 0000000..a17a321 --- /dev/null +++ b/lib/test/esprima/source-type-module/error-strict.js @@ -0,0 +1,5 @@ +import house from "house"; + +with (house) { + console.log(roof); +} diff --git a/lib/test/esprima/source-type-module/error-strict.module.json b/lib/test/esprima/source-type-module/error-strict.module.json new file mode 100644 index 0000000..5c2844a --- /dev/null +++ b/lib/test/esprima/source-type-module/error-strict.module.json @@ -0,0 +1,7 @@ +{ + "index": 26, + "lineNumber": 3, + "column": 27, + "message": "Error: Line 3: Strict mode code may not include a with statement", + "description": "Strict mode code may not include a with statement" +} diff --git a/lib/test/esprima/statement/block/migrated_0000.diff b/lib/test/esprima/statement/block/migrated_0000.diff new file mode 100644 index 0000000..409fd35 --- /dev/null +++ b/lib/test/esprima/statement/block/migrated_0000.diff @@ -0,0 +1,12 @@ +{ + 'body': { + '0': { + 'body': { + '0': { + 'range': { '1': 5 }, + 'loc': { 'end': { 'column': 5 }} + } + } + } + } +} diff --git a/lib/test/esprima/statement/block/migrated_0000.js b/lib/test/esprima/statement/block/migrated_0000.js new file mode 100644 index 0000000..d97825e --- /dev/null +++ b/lib/test/esprima/statement/block/migrated_0000.js @@ -0,0 +1 @@ +{ foo } \ No newline at end of file diff --git a/lib/test/esprima/statement/block/migrated_0000.tree.json b/lib/test/esprima/statement/block/migrated_0000.tree.json new file mode 100644 index 0000000..50b1165 --- /dev/null +++ b/lib/test/esprima/statement/block/migrated_0000.tree.json @@ -0,0 +1,130 @@ +{ + "type": "Program", + "body": [ + { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "foo", + "range": [ + 2, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 2, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "{", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 2, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } +} diff --git a/lib/test/esprima/statement/block/migrated_0001.js b/lib/test/esprima/statement/block/migrated_0001.js new file mode 100644 index 0000000..b258b54 --- /dev/null +++ b/lib/test/esprima/statement/block/migrated_0001.js @@ -0,0 +1 @@ +{ doThis(); doThat(); } \ No newline at end of file diff --git a/lib/test/esprima/statement/block/migrated_0001.tree.json b/lib/test/esprima/statement/block/migrated_0001.tree.json new file mode 100644 index 0000000..f2d2638 --- /dev/null +++ b/lib/test/esprima/statement/block/migrated_0001.tree.json @@ -0,0 +1,327 @@ +{ + "type": "Program", + "body": [ + { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "doThis", + "range": [ + 2, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "arguments": [], + "range": [ + 2, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 2, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "doThat", + "range": [ + 12, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "arguments": [], + "range": [ + 12, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 12, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "{", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "doThis", + "range": [ + 2, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "doThat", + "range": [ + 12, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } +} diff --git a/lib/test/esprima/statement/block/migrated_0002.js b/lib/test/esprima/statement/block/migrated_0002.js new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/lib/test/esprima/statement/block/migrated_0002.js @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/lib/test/esprima/statement/block/migrated_0002.tree.json b/lib/test/esprima/statement/block/migrated_0002.tree.json new file mode 100644 index 0000000..513df50 --- /dev/null +++ b/lib/test/esprima/statement/block/migrated_0002.tree.json @@ -0,0 +1,76 @@ +{ + "type": "Program", + "body": [ + { + "type": "BlockStatement", + "body": [], + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "{", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ], + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } +} diff --git a/lib/test/esprima/statement/break/migrated_0000.diff b/lib/test/esprima/statement/break/migrated_0000.diff new file mode 100644 index 0000000..561d4c4 --- /dev/null +++ b/lib/test/esprima/statement/break/migrated_0000.diff @@ -0,0 +1,14 @@ +{ + 'body': { + '0': { + 'body': { + 'body': { + '0': { + 'range': { '1': 20 }, + 'loc': { 'end': { 'column': 20 }} + } + } + } + } + } +} diff --git a/lib/test/esprima/statement/break/migrated_0000.js b/lib/test/esprima/statement/break/migrated_0000.js new file mode 100644 index 0000000..9fbb13a --- /dev/null +++ b/lib/test/esprima/statement/break/migrated_0000.js @@ -0,0 +1 @@ +while (true) { break } \ No newline at end of file diff --git a/lib/test/esprima/statement/break/migrated_0000.tree.json b/lib/test/esprima/statement/break/migrated_0000.tree.json new file mode 100644 index 0000000..9c1d2d4 --- /dev/null +++ b/lib/test/esprima/statement/break/migrated_0000.tree.json @@ -0,0 +1,221 @@ +{ + "type": "Program", + "body": [ + { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "BreakStatement", + "label": null, + "range": [ + 15, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 13, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "while", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "break", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } +} diff --git a/lib/test/esprima/statement/break/migrated_0001.diff b/lib/test/esprima/statement/break/migrated_0001.diff new file mode 100644 index 0000000..056274e --- /dev/null +++ b/lib/test/esprima/statement/break/migrated_0001.diff @@ -0,0 +1,16 @@ +{ + 'body': { + '0': { + 'body': { + 'body': { + 'body': { + '0': { + 'range': { '1': 31 }, + 'loc': { 'end': { 'column': 31 }} + } + } + } + } + } + } +} diff --git a/lib/test/esprima/statement/break/migrated_0001.js b/lib/test/esprima/statement/break/migrated_0001.js new file mode 100644 index 0000000..89388f7 --- /dev/null +++ b/lib/test/esprima/statement/break/migrated_0001.js @@ -0,0 +1 @@ +done: while (true) { break done } \ No newline at end of file diff --git a/lib/test/esprima/statement/break/migrated_0001.tree.json b/lib/test/esprima/statement/break/migrated_0001.tree.json new file mode 100644 index 0000000..420c07f --- /dev/null +++ b/lib/test/esprima/statement/break/migrated_0001.tree.json @@ -0,0 +1,327 @@ +{ + "type": "Program", + "body": [ + { + "type": "LabeledStatement", + "label": { + "type": "Identifier", + "name": "done", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "body": { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 13, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "BreakStatement", + "label": { + "type": "Identifier", + "name": "done", + "range": [ + 27, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "range": [ + 21, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ], + "range": [ + 19, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "range": [ + 6, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "range": [ + 0, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "done", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "while", + "range": [ + 6, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 13, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Keyword", + "value": "break", + "range": [ + 21, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "done", + "range": [ + 27, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "range": [ + 0, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + } +} diff --git a/lib/test/esprima/statement/break/migrated_0002.js b/lib/test/esprima/statement/break/migrated_0002.js new file mode 100644 index 0000000..f8f5f5f --- /dev/null +++ b/lib/test/esprima/statement/break/migrated_0002.js @@ -0,0 +1 @@ +done: while (true) { break done; } \ No newline at end of file diff --git a/lib/test/esprima/statement/break/migrated_0002.tree.json b/lib/test/esprima/statement/break/migrated_0002.tree.json new file mode 100644 index 0000000..05f336b --- /dev/null +++ b/lib/test/esprima/statement/break/migrated_0002.tree.json @@ -0,0 +1,345 @@ +{ + "type": "Program", + "body": [ + { + "type": "LabeledStatement", + "label": { + "type": "Identifier", + "name": "done", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "body": { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 13, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "BreakStatement", + "label": { + "type": "Identifier", + "name": "done", + "range": [ + 27, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "range": [ + 21, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ], + "range": [ + 19, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 6, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "done", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "while", + "range": [ + 6, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 13, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Keyword", + "value": "break", + "range": [ + 21, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "done", + "range": [ + 27, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } +} diff --git a/lib/test/esprima/statement/break/migrated_0003.js b/lib/test/esprima/statement/break/migrated_0003.js new file mode 100644 index 0000000..4e03cfa --- /dev/null +++ b/lib/test/esprima/statement/break/migrated_0003.js @@ -0,0 +1 @@ +__proto__: while (true) { break __proto__; } \ No newline at end of file diff --git a/lib/test/esprima/statement/break/migrated_0003.tree.json b/lib/test/esprima/statement/break/migrated_0003.tree.json new file mode 100644 index 0000000..3c8a49a --- /dev/null +++ b/lib/test/esprima/statement/break/migrated_0003.tree.json @@ -0,0 +1,345 @@ +{ + "type": "Program", + "body": [ + { + "type": "LabeledStatement", + "label": { + "type": "Identifier", + "name": "__proto__", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "body": { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "BreakStatement", + "label": { + "type": "Identifier", + "name": "__proto__", + "range": [ + 32, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "range": [ + 26, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 42 + } + } + } + ], + "range": [ + 24, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + "range": [ + 11, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + "range": [ + 0, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "__proto__", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "while", + "range": [ + 11, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Keyword", + "value": "break", + "range": [ + 26, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Identifier", + "value": "__proto__", + "range": [ + 32, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 44 + } + } + } + ], + "range": [ + 0, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + } +} diff --git a/lib/test/esprima/statement/break/semicolon_newline.js b/lib/test/esprima/statement/break/semicolon_newline.js new file mode 100644 index 0000000..011bf60 --- /dev/null +++ b/lib/test/esprima/statement/break/semicolon_newline.js @@ -0,0 +1,5 @@ +while (true) { + if (x) break + ; + else y; +} diff --git a/lib/test/esprima/statement/break/semicolon_newline.tree.json b/lib/test/esprima/statement/break/semicolon_newline.tree.json new file mode 100644 index 0000000..eb2cc7b --- /dev/null +++ b/lib/test/esprima/statement/break/semicolon_newline.tree.json @@ -0,0 +1,435 @@ +{ + "range": [ + 0, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "type": "Program", + "body": [ + { + "range": [ + 0, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "type": "WhileStatement", + "test": { + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "Literal", + "value": true, + "raw": "true" + }, + "body": { + "range": [ + 13, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "type": "BlockStatement", + "body": [ + { + "range": [ + 19, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 4, + "column": 11 + } + }, + "type": "IfStatement", + "test": { + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "type": "Identifier", + "name": "x" + }, + "consequent": { + "range": [ + 26, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "type": "BreakStatement", + "label": null + }, + "alternate": { + "range": [ + 47, + 49 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 11 + } + }, + "type": "ExpressionStatement", + "expression": { + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 10 + } + }, + "type": "Identifier", + "name": "y" + } + } + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "while", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "if", + "range": [ + 19, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "break", + "range": [ + 26, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "else", + "range": [ + 42, + 46 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + } + ] +} diff --git a/lib/test/esprima/statement/continue/migrated_0000.js b/lib/test/esprima/statement/continue/migrated_0000.js new file mode 100644 index 0000000..ed1b1e0 --- /dev/null +++ b/lib/test/esprima/statement/continue/migrated_0000.js @@ -0,0 +1 @@ +while (true) { continue; } \ No newline at end of file diff --git a/lib/test/esprima/statement/continue/migrated_0000.tree.json b/lib/test/esprima/statement/continue/migrated_0000.tree.json new file mode 100644 index 0000000..b9b7f91 --- /dev/null +++ b/lib/test/esprima/statement/continue/migrated_0000.tree.json @@ -0,0 +1,239 @@ +{ + "type": "Program", + "body": [ + { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ContinueStatement", + "label": null, + "range": [ + 15, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "range": [ + 13, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "while", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "continue", + "range": [ + 15, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + } +} diff --git a/lib/test/esprima/statement/continue/migrated_0001.diff b/lib/test/esprima/statement/continue/migrated_0001.diff new file mode 100644 index 0000000..da4348b --- /dev/null +++ b/lib/test/esprima/statement/continue/migrated_0001.diff @@ -0,0 +1,14 @@ +{ + 'body': { + '0': { + 'body': { + 'body': { + '0': { + 'range': { '1': 23 }, + 'loc': { 'end': { 'column': 23 }} + } + } + } + } + } +} diff --git a/lib/test/esprima/statement/continue/migrated_0001.js b/lib/test/esprima/statement/continue/migrated_0001.js new file mode 100644 index 0000000..703ffaa --- /dev/null +++ b/lib/test/esprima/statement/continue/migrated_0001.js @@ -0,0 +1 @@ +while (true) { continue } \ No newline at end of file diff --git a/lib/test/esprima/statement/continue/migrated_0001.tree.json b/lib/test/esprima/statement/continue/migrated_0001.tree.json new file mode 100644 index 0000000..95ffa62 --- /dev/null +++ b/lib/test/esprima/statement/continue/migrated_0001.tree.json @@ -0,0 +1,221 @@ +{ + "type": "Program", + "body": [ + { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ContinueStatement", + "label": null, + "range": [ + 15, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "range": [ + 13, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "while", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "continue", + "range": [ + 15, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } +} diff --git a/lib/test/esprima/statement/continue/migrated_0002.diff b/lib/test/esprima/statement/continue/migrated_0002.diff new file mode 100644 index 0000000..b492e76 --- /dev/null +++ b/lib/test/esprima/statement/continue/migrated_0002.diff @@ -0,0 +1,16 @@ +{ + 'body': { + '0': { + 'body': { + 'body': { + 'body': { + '0': { + 'range': { '1': 34 }, + 'loc': { 'end': { 'column': 34 }} + } + } + } + } + } + } +} diff --git a/lib/test/esprima/statement/continue/migrated_0002.js b/lib/test/esprima/statement/continue/migrated_0002.js new file mode 100644 index 0000000..acbaf67 --- /dev/null +++ b/lib/test/esprima/statement/continue/migrated_0002.js @@ -0,0 +1 @@ +done: while (true) { continue done } \ No newline at end of file diff --git a/lib/test/esprima/statement/continue/migrated_0002.tree.json b/lib/test/esprima/statement/continue/migrated_0002.tree.json new file mode 100644 index 0000000..72934cc --- /dev/null +++ b/lib/test/esprima/statement/continue/migrated_0002.tree.json @@ -0,0 +1,327 @@ +{ + "type": "Program", + "body": [ + { + "type": "LabeledStatement", + "label": { + "type": "Identifier", + "name": "done", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "body": { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 13, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ContinueStatement", + "label": { + "type": "Identifier", + "name": "done", + "range": [ + 30, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 21, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "range": [ + 19, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "range": [ + 6, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "done", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "while", + "range": [ + 6, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 13, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Keyword", + "value": "continue", + "range": [ + 21, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Identifier", + "value": "done", + "range": [ + 30, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + } +} diff --git a/lib/test/esprima/statement/continue/migrated_0003.js b/lib/test/esprima/statement/continue/migrated_0003.js new file mode 100644 index 0000000..57a848b --- /dev/null +++ b/lib/test/esprima/statement/continue/migrated_0003.js @@ -0,0 +1 @@ +done: while (true) { continue done; } \ No newline at end of file diff --git a/lib/test/esprima/statement/continue/migrated_0003.tree.json b/lib/test/esprima/statement/continue/migrated_0003.tree.json new file mode 100644 index 0000000..af8149f --- /dev/null +++ b/lib/test/esprima/statement/continue/migrated_0003.tree.json @@ -0,0 +1,345 @@ +{ + "type": "Program", + "body": [ + { + "type": "LabeledStatement", + "label": { + "type": "Identifier", + "name": "done", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "body": { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 13, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ContinueStatement", + "label": { + "type": "Identifier", + "name": "done", + "range": [ + 30, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 21, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "range": [ + 19, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + "range": [ + 6, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + "range": [ + 0, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "done", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "while", + "range": [ + 6, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 13, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Keyword", + "value": "continue", + "range": [ + 21, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Identifier", + "value": "done", + "range": [ + 30, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + ], + "range": [ + 0, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + } +} diff --git a/lib/test/esprima/statement/continue/migrated_0004.js b/lib/test/esprima/statement/continue/migrated_0004.js new file mode 100644 index 0000000..aed4f22 --- /dev/null +++ b/lib/test/esprima/statement/continue/migrated_0004.js @@ -0,0 +1 @@ +__proto__: while (true) { continue __proto__; } \ No newline at end of file diff --git a/lib/test/esprima/statement/continue/migrated_0004.tree.json b/lib/test/esprima/statement/continue/migrated_0004.tree.json new file mode 100644 index 0000000..2016e55 --- /dev/null +++ b/lib/test/esprima/statement/continue/migrated_0004.tree.json @@ -0,0 +1,345 @@ +{ + "type": "Program", + "body": [ + { + "type": "LabeledStatement", + "label": { + "type": "Identifier", + "name": "__proto__", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "body": { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ContinueStatement", + "label": { + "type": "Identifier", + "name": "__proto__", + "range": [ + 35, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + "range": [ + 26, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 45 + } + } + } + ], + "range": [ + 24, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 47 + } + } + }, + "range": [ + 11, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 47 + } + } + }, + "range": [ + 0, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "__proto__", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "while", + "range": [ + 11, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Keyword", + "value": "continue", + "range": [ + 26, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Identifier", + "value": "__proto__", + "range": [ + 35, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 47 + } + } + } + ], + "range": [ + 0, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + } +} diff --git a/lib/test/esprima/statement/debugger/migrated_0000.js b/lib/test/esprima/statement/debugger/migrated_0000.js new file mode 100644 index 0000000..9f5fb10 --- /dev/null +++ b/lib/test/esprima/statement/debugger/migrated_0000.js @@ -0,0 +1 @@ +debugger; \ No newline at end of file diff --git a/lib/test/esprima/statement/debugger/migrated_0000.tree.json b/lib/test/esprima/statement/debugger/migrated_0000.tree.json new file mode 100644 index 0000000..7abd1d8 --- /dev/null +++ b/lib/test/esprima/statement/debugger/migrated_0000.tree.json @@ -0,0 +1,75 @@ +{ + "type": "Program", + "body": [ + { + "type": "DebuggerStatement", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "debugger", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } +} diff --git a/lib/test/esprima/statement/empty/migrated_0000.js b/lib/test/esprima/statement/empty/migrated_0000.js new file mode 100644 index 0000000..1c8a0e7 --- /dev/null +++ b/lib/test/esprima/statement/empty/migrated_0000.js @@ -0,0 +1 @@ +; \ No newline at end of file diff --git a/lib/test/esprima/statement/empty/migrated_0000.tree.json b/lib/test/esprima/statement/empty/migrated_0000.tree.json new file mode 100644 index 0000000..29b8380 --- /dev/null +++ b/lib/test/esprima/statement/empty/migrated_0000.tree.json @@ -0,0 +1,57 @@ +{ + "type": "Program", + "body": [ + { + "type": "EmptyStatement", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": ";", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } +} diff --git a/lib/test/esprima/statement/expression/migrated_0000.js b/lib/test/esprima/statement/expression/migrated_0000.js new file mode 100644 index 0000000..c1b0730 --- /dev/null +++ b/lib/test/esprima/statement/expression/migrated_0000.js @@ -0,0 +1 @@ +x \ No newline at end of file diff --git a/lib/test/esprima/statement/expression/migrated_0000.tree.json b/lib/test/esprima/statement/expression/migrated_0000.tree.json new file mode 100644 index 0000000..ef8fd7b --- /dev/null +++ b/lib/test/esprima/statement/expression/migrated_0000.tree.json @@ -0,0 +1,75 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } +} diff --git a/lib/test/esprima/statement/expression/migrated_0001.js b/lib/test/esprima/statement/expression/migrated_0001.js new file mode 100644 index 0000000..76daf19 --- /dev/null +++ b/lib/test/esprima/statement/expression/migrated_0001.js @@ -0,0 +1 @@ +x, y \ No newline at end of file diff --git a/lib/test/esprima/statement/expression/migrated_0001.tree.json b/lib/test/esprima/statement/expression/migrated_0001.tree.json new file mode 100644 index 0000000..ed83266 --- /dev/null +++ b/lib/test/esprima/statement/expression/migrated_0001.tree.json @@ -0,0 +1,148 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "SequenceExpression", + "expressions": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "name": "y", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } +} diff --git a/lib/test/esprima/statement/expression/migrated_0002.source.js b/lib/test/esprima/statement/expression/migrated_0002.source.js new file mode 100644 index 0000000..6db2ef5 --- /dev/null +++ b/lib/test/esprima/statement/expression/migrated_0002.source.js @@ -0,0 +1 @@ +var source = '\\u0061'; \ No newline at end of file diff --git a/lib/test/esprima/statement/expression/migrated_0002.tree.json b/lib/test/esprima/statement/expression/migrated_0002.tree.json new file mode 100644 index 0000000..79d037a --- /dev/null +++ b/lib/test/esprima/statement/expression/migrated_0002.tree.json @@ -0,0 +1,75 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "a", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "\\u0061", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } +} diff --git a/lib/test/esprima/statement/expression/migrated_0003.source.js b/lib/test/esprima/statement/expression/migrated_0003.source.js new file mode 100644 index 0000000..d64c592 --- /dev/null +++ b/lib/test/esprima/statement/expression/migrated_0003.source.js @@ -0,0 +1 @@ +var source = 'a\\u0061'; \ No newline at end of file diff --git a/lib/test/esprima/statement/expression/migrated_0003.tree.json b/lib/test/esprima/statement/expression/migrated_0003.tree.json new file mode 100644 index 0000000..ccf5f77 --- /dev/null +++ b/lib/test/esprima/statement/expression/migrated_0003.tree.json @@ -0,0 +1,75 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "aa", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "a\\u0061", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } +} diff --git a/lib/test/esprima/statement/expression/migrated_0004.source.js b/lib/test/esprima/statement/expression/migrated_0004.source.js new file mode 100644 index 0000000..27e8e06 --- /dev/null +++ b/lib/test/esprima/statement/expression/migrated_0004.source.js @@ -0,0 +1 @@ +var source = '\\u0061a'; \ No newline at end of file diff --git a/lib/test/esprima/statement/expression/migrated_0004.tree.json b/lib/test/esprima/statement/expression/migrated_0004.tree.json new file mode 100644 index 0000000..c156e04 --- /dev/null +++ b/lib/test/esprima/statement/expression/migrated_0004.tree.json @@ -0,0 +1,75 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "aa", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "\\u0061a", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } +} diff --git a/lib/test/esprima/statement/expression/migrated_0005.source.js b/lib/test/esprima/statement/expression/migrated_0005.source.js new file mode 100644 index 0000000..dc73a88 --- /dev/null +++ b/lib/test/esprima/statement/expression/migrated_0005.source.js @@ -0,0 +1 @@ +var source = '\\u0061a '; \ No newline at end of file diff --git a/lib/test/esprima/statement/expression/migrated_0005.tree.json b/lib/test/esprima/statement/expression/migrated_0005.tree.json new file mode 100644 index 0000000..803b4b0 --- /dev/null +++ b/lib/test/esprima/statement/expression/migrated_0005.tree.json @@ -0,0 +1,75 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "aa", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "\\u0061a", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } +} diff --git a/lib/test/esprima/statement/if/migrated_0000.js b/lib/test/esprima/statement/if/migrated_0000.js new file mode 100644 index 0000000..dce48ac --- /dev/null +++ b/lib/test/esprima/statement/if/migrated_0000.js @@ -0,0 +1 @@ +if (morning) goodMorning() \ No newline at end of file diff --git a/lib/test/esprima/statement/if/migrated_0000.tree.json b/lib/test/esprima/statement/if/migrated_0000.tree.json new file mode 100644 index 0000000..90d2e7c --- /dev/null +++ b/lib/test/esprima/statement/if/migrated_0000.tree.json @@ -0,0 +1,237 @@ +{ + "type": "Program", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "morning", + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "goodMorning", + "range": [ + 13, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "arguments": [], + "range": [ + 13, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 13, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "alternate": null, + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "if", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "morning", + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "goodMorning", + "range": [ + 13, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + } +} diff --git a/lib/test/esprima/statement/if/migrated_0001.js b/lib/test/esprima/statement/if/migrated_0001.js new file mode 100644 index 0000000..ceb5cec --- /dev/null +++ b/lib/test/esprima/statement/if/migrated_0001.js @@ -0,0 +1 @@ +if (morning) (function(){}) \ No newline at end of file diff --git a/lib/test/esprima/statement/if/migrated_0001.tree.json b/lib/test/esprima/statement/if/migrated_0001.tree.json new file mode 100644 index 0000000..31cbff5 --- /dev/null +++ b/lib/test/esprima/statement/if/migrated_0001.tree.json @@ -0,0 +1,312 @@ +{ + "type": "Program", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "morning", + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 24, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 14, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 13, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "alternate": null, + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "if", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "morning", + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 14, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + } +} diff --git a/lib/test/esprima/statement/if/migrated_0002.js b/lib/test/esprima/statement/if/migrated_0002.js new file mode 100644 index 0000000..586d8d8 --- /dev/null +++ b/lib/test/esprima/statement/if/migrated_0002.js @@ -0,0 +1 @@ +if (morning) var x = 0; \ No newline at end of file diff --git a/lib/test/esprima/statement/if/migrated_0002.tree.json b/lib/test/esprima/statement/if/migrated_0002.tree.json new file mode 100644 index 0000000..a33ab51 --- /dev/null +++ b/lib/test/esprima/statement/if/migrated_0002.tree.json @@ -0,0 +1,294 @@ +{ + "type": "Program", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "morning", + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "consequent": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "init": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "kind": "var", + "range": [ + 13, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "alternate": null, + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "if", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "morning", + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } +} diff --git a/lib/test/esprima/statement/if/migrated_0003.js b/lib/test/esprima/statement/if/migrated_0003.js new file mode 100644 index 0000000..d2c93c7 --- /dev/null +++ b/lib/test/esprima/statement/if/migrated_0003.js @@ -0,0 +1 @@ +if (morning) function a(){} \ No newline at end of file diff --git a/lib/test/esprima/statement/if/migrated_0003.tree.json b/lib/test/esprima/statement/if/migrated_0003.tree.json new file mode 100644 index 0000000..515fa2a --- /dev/null +++ b/lib/test/esprima/statement/if/migrated_0003.tree.json @@ -0,0 +1,294 @@ +{ + "type": "Program", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "morning", + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "consequent": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "a", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 25, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 13, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "alternate": null, + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "if", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "morning", + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 13, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + } +} diff --git a/lib/test/esprima/statement/if/migrated_0004.js b/lib/test/esprima/statement/if/migrated_0004.js new file mode 100644 index 0000000..2bf0746 --- /dev/null +++ b/lib/test/esprima/statement/if/migrated_0004.js @@ -0,0 +1 @@ +if (morning) goodMorning(); else goodDay() \ No newline at end of file diff --git a/lib/test/esprima/statement/if/migrated_0004.tree.json b/lib/test/esprima/statement/if/migrated_0004.tree.json new file mode 100644 index 0000000..323780f --- /dev/null +++ b/lib/test/esprima/statement/if/migrated_0004.tree.json @@ -0,0 +1,379 @@ +{ + "type": "Program", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "morning", + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "goodMorning", + "range": [ + 13, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "arguments": [], + "range": [ + 13, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 13, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "alternate": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "goodDay", + "range": [ + 33, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + "arguments": [], + "range": [ + 33, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + "range": [ + 33, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + "range": [ + 0, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "if", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "morning", + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "goodMorning", + "range": [ + 13, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Keyword", + "value": "else", + "range": [ + 28, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Identifier", + "value": "goodDay", + "range": [ + 33, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + } + ], + "range": [ + 0, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + } +} diff --git a/lib/test/esprima/statement/if/migrated_0005.js b/lib/test/esprima/statement/if/migrated_0005.js new file mode 100644 index 0000000..f59f62d --- /dev/null +++ b/lib/test/esprima/statement/if/migrated_0005.js @@ -0,0 +1,2 @@ +if (true) that() +; else; \ No newline at end of file diff --git a/lib/test/esprima/statement/if/migrated_0005.tree.json b/lib/test/esprima/statement/if/migrated_0005.tree.json new file mode 100644 index 0000000..154bee1 --- /dev/null +++ b/lib/test/esprima/statement/if/migrated_0005.tree.json @@ -0,0 +1,308 @@ +{ + "type": "Program", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "that", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "arguments": [], + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 10, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + "alternate": { + "type": "EmptyStatement", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 7 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "if", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "that", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "else", + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + } + } + } + ], + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 7 + } + } +} diff --git a/lib/test/esprima/statement/if/migrated_0006.js b/lib/test/esprima/statement/if/migrated_0006.js new file mode 100644 index 0000000..9254cee --- /dev/null +++ b/lib/test/esprima/statement/if/migrated_0006.js @@ -0,0 +1 @@ +if (true) that(); else; \ No newline at end of file diff --git a/lib/test/esprima/statement/if/migrated_0006.tree.json b/lib/test/esprima/statement/if/migrated_0006.tree.json new file mode 100644 index 0000000..ba07118 --- /dev/null +++ b/lib/test/esprima/statement/if/migrated_0006.tree.json @@ -0,0 +1,308 @@ +{ + "type": "Program", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "that", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "arguments": [], + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 10, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "alternate": { + "type": "EmptyStatement", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "if", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "that", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Keyword", + "value": "else", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } +} diff --git a/lib/test/esprima/statement/iteration/const_forin.js b/lib/test/esprima/statement/iteration/const_forin.js new file mode 100644 index 0000000..48da176 --- /dev/null +++ b/lib/test/esprima/statement/iteration/const_forin.js @@ -0,0 +1 @@ +for (const x in list) process(x); diff --git a/lib/test/esprima/statement/iteration/const_forin.tree.json b/lib/test/esprima/statement/iteration/const_forin.tree.json new file mode 100644 index 0000000..022d7a6 --- /dev/null +++ b/lib/test/esprima/statement/iteration/const_forin.tree.json @@ -0,0 +1,402 @@ +{ + "type": "Program", + "body": [ + { + "type": "ForInStatement", + "left": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "init": null, + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "kind": "const", + "range": [ + 5, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "right": { + "type": "Identifier", + "name": "list", + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "process", + "range": [ + 22, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "range": [ + 22, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "range": [ + 22, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "each": false, + "range": [ + 0, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "const", + "range": [ + 5, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Keyword", + "value": "in", + "range": [ + 13, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "list", + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "process", + "range": [ + 22, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "range": [ + 0, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + } +} diff --git a/lib/test/esprima/statement/iteration/for-in-let.js b/lib/test/esprima/statement/iteration/for-in-let.js new file mode 100644 index 0000000..0f4b050 --- /dev/null +++ b/lib/test/esprima/statement/iteration/for-in-let.js @@ -0,0 +1 @@ +for (x in let) {} diff --git a/lib/test/esprima/statement/iteration/for-in-let.tree.json b/lib/test/esprima/statement/iteration/for-in-let.tree.json new file mode 100644 index 0000000..d8a28ce --- /dev/null +++ b/lib/test/esprima/statement/iteration/for-in-let.tree.json @@ -0,0 +1,238 @@ +{ + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "Program", + "body": [ + { + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "ForInStatement", + "left": { + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "Identifier", + "name": "x" + }, + "right": { + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "Identifier", + "name": "let" + }, + "body": { + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "BlockStatement", + "body": [] + }, + "each": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "in", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ] +} diff --git a/lib/test/esprima/statement/iteration/for-let-let.js b/lib/test/esprima/statement/iteration/for-let-let.js new file mode 100644 index 0000000..641d8c2 --- /dev/null +++ b/lib/test/esprima/statement/iteration/for-let-let.js @@ -0,0 +1 @@ +for (let x = let;;) {} diff --git a/lib/test/esprima/statement/iteration/for-let-let.skip b/lib/test/esprima/statement/iteration/for-let-let.skip new file mode 100644 index 0000000..1333ed7 --- /dev/null +++ b/lib/test/esprima/statement/iteration/for-let-let.skip @@ -0,0 +1 @@ +TODO diff --git a/lib/test/esprima/statement/iteration/for-let-let.tree.json b/lib/test/esprima/statement/iteration/for-let-let.tree.json new file mode 100644 index 0000000..1787421 --- /dev/null +++ b/lib/test/esprima/statement/iteration/for-let-let.tree.json @@ -0,0 +1,330 @@ +{ + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "Program", + "body": [ + { + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "ForStatement", + "init": { + "range": [ + 5, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 9, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Identifier", + "name": "x" + }, + "init": { + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "Identifier", + "name": "let" + } + } + ], + "kind": "let" + }, + "test": null, + "update": null, + "body": { + "range": [ + 20, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "type": "BlockStatement", + "body": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ] +} diff --git a/lib/test/esprima/statement/iteration/for-statement-with-seq.js b/lib/test/esprima/statement/iteration/for-statement-with-seq.js new file mode 100644 index 0000000..b44b084 --- /dev/null +++ b/lib/test/esprima/statement/iteration/for-statement-with-seq.js @@ -0,0 +1 @@ +for(a,b,c;;); diff --git a/lib/test/esprima/statement/iteration/for-statement-with-seq.tree.json b/lib/test/esprima/statement/iteration/for-statement-with-seq.tree.json new file mode 100644 index 0000000..1334c37 --- /dev/null +++ b/lib/test/esprima/statement/iteration/for-statement-with-seq.tree.json @@ -0,0 +1,329 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "ForStatement", + "init": { + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "SequenceExpression", + "expressions": [ + { + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "type": "Identifier", + "name": "a" + }, + { + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Identifier", + "name": "b" + }, + { + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "Identifier", + "name": "c" + } + ] + }, + "test": null, + "update": null, + "body": { + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "type": "EmptyStatement" + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } +} diff --git a/lib/test/esprima/statement/iteration/invalid-strict-for-in-let.failure.json b/lib/test/esprima/statement/iteration/invalid-strict-for-in-let.failure.json new file mode 100644 index 0000000..5cc7e6f --- /dev/null +++ b/lib/test/esprima/statement/iteration/invalid-strict-for-in-let.failure.json @@ -0,0 +1 @@ +{"index":24,"lineNumber":1,"column":25,"message":"Error: Line 1: Use of future reserved word in strict mode","description":"Use of future reserved word in strict mode"} \ No newline at end of file diff --git a/lib/test/esprima/statement/iteration/invalid-strict-for-in-let.js b/lib/test/esprima/statement/iteration/invalid-strict-for-in-let.js new file mode 100644 index 0000000..e47922a --- /dev/null +++ b/lib/test/esprima/statement/iteration/invalid-strict-for-in-let.js @@ -0,0 +1 @@ +"use strict"; for (x in let) {} diff --git a/lib/test/esprima/statement/iteration/migrated_0000.js b/lib/test/esprima/statement/iteration/migrated_0000.js new file mode 100644 index 0000000..83d1b13 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0000.js @@ -0,0 +1 @@ +do keep(); while (true) \ No newline at end of file diff --git a/lib/test/esprima/statement/iteration/migrated_0000.tree.json b/lib/test/esprima/statement/iteration/migrated_0000.tree.json new file mode 100644 index 0000000..d6f36fa --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0000.tree.json @@ -0,0 +1,273 @@ +{ + "type": "Program", + "body": [ + { + "type": "DoWhileStatement", + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "keep", + "range": [ + 3, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "arguments": [], + "range": [ + 3, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 3, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "do", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "keep", + "range": [ + 3, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "while", + "range": [ + 11, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } +} diff --git a/lib/test/esprima/statement/iteration/migrated_0001.js b/lib/test/esprima/statement/iteration/migrated_0001.js new file mode 100644 index 0000000..d42e8f5 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0001.js @@ -0,0 +1 @@ +do keep(); while (true); \ No newline at end of file diff --git a/lib/test/esprima/statement/iteration/migrated_0001.tree.json b/lib/test/esprima/statement/iteration/migrated_0001.tree.json new file mode 100644 index 0000000..d66565c --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0001.tree.json @@ -0,0 +1,291 @@ +{ + "type": "Program", + "body": [ + { + "type": "DoWhileStatement", + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "keep", + "range": [ + 3, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "arguments": [], + "range": [ + 3, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 3, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "do", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "keep", + "range": [ + 3, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "while", + "range": [ + 11, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } +} diff --git a/lib/test/esprima/statement/iteration/migrated_0002.js b/lib/test/esprima/statement/iteration/migrated_0002.js new file mode 100644 index 0000000..45bf487 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0002.js @@ -0,0 +1 @@ +do { x++; y--; } while (x < 10) \ No newline at end of file diff --git a/lib/test/esprima/statement/iteration/migrated_0002.tree.json b/lib/test/esprima/statement/iteration/migrated_0002.tree.json new file mode 100644 index 0000000..32ec370 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0002.tree.json @@ -0,0 +1,491 @@ +{ + "type": "Program", + "body": [ + { + "type": "DoWhileStatement", + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "++", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "prefix": false, + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 5, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "--", + "argument": { + "type": "Identifier", + "name": "y", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "prefix": false, + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "range": [ + 3, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "test": { + "type": "BinaryExpression", + "operator": "<", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "right": { + "type": "Literal", + "value": 10, + "raw": "10", + "range": [ + 28, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 24, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "do", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "++", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "--", + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Keyword", + "value": "while", + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Numeric", + "value": "10", + "range": [ + 28, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } +} diff --git a/lib/test/esprima/statement/iteration/migrated_0003.diff b/lib/test/esprima/statement/iteration/migrated_0003.diff new file mode 100644 index 0000000..8c5da76 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0003.diff @@ -0,0 +1,12 @@ +{ + 'body': { + '0': { + 'body': { + '1': { + 'range': { '1': 28 }, + 'loc': { 'end': { 'column': 28 }} + } + } + } + } +} diff --git a/lib/test/esprima/statement/iteration/migrated_0003.js b/lib/test/esprima/statement/iteration/migrated_0003.js new file mode 100644 index 0000000..785c71b --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0003.js @@ -0,0 +1 @@ +{ do { } while (false) false } \ No newline at end of file diff --git a/lib/test/esprima/statement/iteration/migrated_0003.tree.json b/lib/test/esprima/statement/iteration/migrated_0003.tree.json new file mode 100644 index 0000000..b39746c --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0003.tree.json @@ -0,0 +1,311 @@ +{ + "type": "Program", + "body": [ + { + "type": "BlockStatement", + "body": [ + { + "type": "DoWhileStatement", + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "test": { + "type": "Literal", + "value": false, + "raw": "false", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 2, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": false, + "raw": "false", + "range": [ + 23, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "range": [ + 23, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "{", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "do", + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "while", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Boolean", + "value": "false", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Boolean", + "value": "false", + "range": [ + 23, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + } + ], + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + } +} diff --git a/lib/test/esprima/statement/iteration/migrated_0004.js b/lib/test/esprima/statement/iteration/migrated_0004.js new file mode 100644 index 0000000..bb0ea13 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0004.js @@ -0,0 +1 @@ +do that();while (true) \ No newline at end of file diff --git a/lib/test/esprima/statement/iteration/migrated_0004.tree.json b/lib/test/esprima/statement/iteration/migrated_0004.tree.json new file mode 100644 index 0000000..211a3a2 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0004.tree.json @@ -0,0 +1,273 @@ +{ + "type": "Program", + "body": [ + { + "type": "DoWhileStatement", + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "that", + "range": [ + 3, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "arguments": [], + "range": [ + 3, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 3, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 17, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "do", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "that", + "range": [ + 3, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "while", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 17, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } +} diff --git a/lib/test/esprima/statement/iteration/migrated_0005.js b/lib/test/esprima/statement/iteration/migrated_0005.js new file mode 100644 index 0000000..f5cac2b --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0005.js @@ -0,0 +1,2 @@ +do that() +;while (true) \ No newline at end of file diff --git a/lib/test/esprima/statement/iteration/migrated_0005.tree.json b/lib/test/esprima/statement/iteration/migrated_0005.tree.json new file mode 100644 index 0000000..505dde0 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0005.tree.json @@ -0,0 +1,273 @@ +{ + "type": "Program", + "body": [ + { + "type": "DoWhileStatement", + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "that", + "range": [ + 3, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "arguments": [], + "range": [ + 3, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 3, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "do", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "that", + "range": [ + 3, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "while", + "range": [ + 11, + 16 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + ], + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 13 + } + } +} diff --git a/lib/test/esprima/statement/iteration/migrated_0006.js b/lib/test/esprima/statement/iteration/migrated_0006.js new file mode 100644 index 0000000..bb9e8a5 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0006.js @@ -0,0 +1 @@ +while (true) doSomething() \ No newline at end of file diff --git a/lib/test/esprima/statement/iteration/migrated_0006.tree.json b/lib/test/esprima/statement/iteration/migrated_0006.tree.json new file mode 100644 index 0000000..92897d2 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0006.tree.json @@ -0,0 +1,237 @@ +{ + "type": "Program", + "body": [ + { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "doSomething", + "range": [ + 13, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "arguments": [], + "range": [ + 13, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 13, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "while", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "doSomething", + "range": [ + 13, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + } +} diff --git a/lib/test/esprima/statement/iteration/migrated_0007.js b/lib/test/esprima/statement/iteration/migrated_0007.js new file mode 100644 index 0000000..cec73ff --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0007.js @@ -0,0 +1 @@ +while (x < 10) { x++; y--; } \ No newline at end of file diff --git a/lib/test/esprima/statement/iteration/migrated_0007.tree.json b/lib/test/esprima/statement/iteration/migrated_0007.tree.json new file mode 100644 index 0000000..d41a120 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0007.tree.json @@ -0,0 +1,473 @@ +{ + "type": "Program", + "body": [ + { + "type": "WhileStatement", + "test": { + "type": "BinaryExpression", + "operator": "<", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "right": { + "type": "Literal", + "value": 10, + "raw": "10", + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 7, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "++", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "prefix": false, + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 17, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "--", + "argument": { + "type": "Identifier", + "name": "y", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "prefix": false, + "range": [ + 22, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "range": [ + 22, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "range": [ + 15, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "while", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Numeric", + "value": "10", + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "++", + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "--", + "range": [ + 23, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + } +} diff --git a/lib/test/esprima/statement/iteration/migrated_0008.js b/lib/test/esprima/statement/iteration/migrated_0008.js new file mode 100644 index 0000000..80c8092 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0008.js @@ -0,0 +1 @@ +for(;;); \ No newline at end of file diff --git a/lib/test/esprima/statement/iteration/migrated_0008.tree.json b/lib/test/esprima/statement/iteration/migrated_0008.tree.json new file mode 100644 index 0000000..8dd573b --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0008.tree.json @@ -0,0 +1,167 @@ +{ + "type": "Program", + "body": [ + { + "type": "ForStatement", + "init": null, + "test": null, + "update": null, + "body": { + "type": "EmptyStatement", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } +} diff --git a/lib/test/esprima/statement/iteration/migrated_0009.js b/lib/test/esprima/statement/iteration/migrated_0009.js new file mode 100644 index 0000000..a96f450 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0009.js @@ -0,0 +1 @@ +for(;;){} \ No newline at end of file diff --git a/lib/test/esprima/statement/iteration/migrated_0009.tree.json b/lib/test/esprima/statement/iteration/migrated_0009.tree.json new file mode 100644 index 0000000..f0dc9b0 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0009.tree.json @@ -0,0 +1,186 @@ +{ + "type": "Program", + "body": [ + { + "type": "ForStatement", + "init": null, + "test": null, + "update": null, + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } +} diff --git a/lib/test/esprima/statement/iteration/migrated_0010.js b/lib/test/esprima/statement/iteration/migrated_0010.js new file mode 100644 index 0000000..188f89e --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0010.js @@ -0,0 +1 @@ +for(x = 0;;); \ No newline at end of file diff --git a/lib/test/esprima/statement/iteration/migrated_0010.tree.json b/lib/test/esprima/statement/iteration/migrated_0010.tree.json new file mode 100644 index 0000000..fc9c610 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0010.tree.json @@ -0,0 +1,275 @@ +{ + "type": "Program", + "body": [ + { + "type": "ForStatement", + "init": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "test": null, + "update": null, + "body": { + "type": "EmptyStatement", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } +} diff --git a/lib/test/esprima/statement/iteration/migrated_0011.js b/lib/test/esprima/statement/iteration/migrated_0011.js new file mode 100644 index 0000000..9ebc154 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0011.js @@ -0,0 +1 @@ +for(var x = 0;;); \ No newline at end of file diff --git a/lib/test/esprima/statement/iteration/migrated_0011.tree.json b/lib/test/esprima/statement/iteration/migrated_0011.tree.json new file mode 100644 index 0000000..b2ea20a --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0011.tree.json @@ -0,0 +1,312 @@ +{ + "type": "Program", + "body": [ + { + "type": "ForStatement", + "init": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "init": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 8, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "kind": "var", + "range": [ + 4, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "test": null, + "update": null, + "body": { + "type": "EmptyStatement", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } +} diff --git a/lib/test/esprima/statement/iteration/migrated_0012.diff b/lib/test/esprima/statement/iteration/migrated_0012.diff new file mode 100644 index 0000000..a38df42 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0012.diff @@ -0,0 +1,10 @@ +{ + "body": { + "0": { + "init": { + "range": { "1": 13 }, + "loc": { "end": { "column": 13 }} + } + } + } +} diff --git a/lib/test/esprima/statement/iteration/migrated_0012.js b/lib/test/esprima/statement/iteration/migrated_0012.js new file mode 100644 index 0000000..ee8093a --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0012.js @@ -0,0 +1 @@ +for(let x = 0;;); \ No newline at end of file diff --git a/lib/test/esprima/statement/iteration/migrated_0012.tree.json b/lib/test/esprima/statement/iteration/migrated_0012.tree.json new file mode 100644 index 0000000..e320bd1 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0012.tree.json @@ -0,0 +1,312 @@ +{ + "type": "Program", + "body": [ + { + "type": "ForStatement", + "init": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "init": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 8, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "kind": "let", + "range": [ + 4, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "test": null, + "update": null, + "body": { + "type": "EmptyStatement", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } +} diff --git a/lib/test/esprima/statement/iteration/migrated_0013.js b/lib/test/esprima/statement/iteration/migrated_0013.js new file mode 100644 index 0000000..fea9ea1 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0013.js @@ -0,0 +1 @@ +for(var x = 0, y = 1;;); \ No newline at end of file diff --git a/lib/test/esprima/statement/iteration/migrated_0013.tree.json b/lib/test/esprima/statement/iteration/migrated_0013.tree.json new file mode 100644 index 0000000..67e5736 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0013.tree.json @@ -0,0 +1,438 @@ +{ + "type": "Program", + "body": [ + { + "type": "ForStatement", + "init": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "init": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 8, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "y", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "init": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "kind": "var", + "range": [ + 4, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "test": null, + "update": null, + "body": { + "type": "EmptyStatement", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } +} diff --git a/lib/test/esprima/statement/iteration/migrated_0014.js b/lib/test/esprima/statement/iteration/migrated_0014.js new file mode 100644 index 0000000..b9ffae3 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0014.js @@ -0,0 +1 @@ +for(x = 0; x < 42;); \ No newline at end of file diff --git a/lib/test/esprima/statement/iteration/migrated_0014.tree.json b/lib/test/esprima/statement/iteration/migrated_0014.tree.json new file mode 100644 index 0000000..9b0c404 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0014.tree.json @@ -0,0 +1,383 @@ +{ + "type": "Program", + "body": [ + { + "type": "ForStatement", + "init": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "test": { + "type": "BinaryExpression", + "operator": "<", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 11, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "update": null, + "body": { + "type": "EmptyStatement", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } +} diff --git a/lib/test/esprima/statement/iteration/migrated_0015.js b/lib/test/esprima/statement/iteration/migrated_0015.js new file mode 100644 index 0000000..3eef549 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0015.js @@ -0,0 +1 @@ +for(x = 0; x < 42; x++); \ No newline at end of file diff --git a/lib/test/esprima/statement/iteration/migrated_0015.tree.json b/lib/test/esprima/statement/iteration/migrated_0015.tree.json new file mode 100644 index 0000000..a624096 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0015.tree.json @@ -0,0 +1,455 @@ +{ + "type": "Program", + "body": [ + { + "type": "ForStatement", + "init": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "test": { + "type": "BinaryExpression", + "operator": "<", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 11, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "update": { + "type": "UpdateExpression", + "operator": "++", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "prefix": false, + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "body": { + "type": "EmptyStatement", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "++", + "range": [ + 20, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } +} diff --git a/lib/test/esprima/statement/iteration/migrated_0016.js b/lib/test/esprima/statement/iteration/migrated_0016.js new file mode 100644 index 0000000..228926e --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0016.js @@ -0,0 +1 @@ +for(x = 0; x < 42; x++) process(x); \ No newline at end of file diff --git a/lib/test/esprima/statement/iteration/migrated_0016.tree.json b/lib/test/esprima/statement/iteration/migrated_0016.tree.json new file mode 100644 index 0000000..8cfec25 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0016.tree.json @@ -0,0 +1,582 @@ +{ + "type": "Program", + "body": [ + { + "type": "ForStatement", + "init": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "test": { + "type": "BinaryExpression", + "operator": "<", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 11, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "update": { + "type": "UpdateExpression", + "operator": "++", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "prefix": false, + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "process", + "range": [ + 24, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "range": [ + 24, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 24, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "++", + "range": [ + 20, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "process", + "range": [ + 24, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + } +} diff --git a/lib/test/esprima/statement/iteration/migrated_0017.js b/lib/test/esprima/statement/iteration/migrated_0017.js new file mode 100644 index 0000000..1c1271f --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0017.js @@ -0,0 +1 @@ +for(x in list) process(x); \ No newline at end of file diff --git a/lib/test/esprima/statement/iteration/migrated_0017.tree.json b/lib/test/esprima/statement/iteration/migrated_0017.tree.json new file mode 100644 index 0000000..f61b150 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0017.tree.json @@ -0,0 +1,346 @@ +{ + "type": "Program", + "body": [ + { + "type": "ForInStatement", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "list", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "process", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "range": [ + 15, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "range": [ + 15, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "each": false, + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "in", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "list", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "process", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + } +} diff --git a/lib/test/esprima/statement/iteration/migrated_0018.js b/lib/test/esprima/statement/iteration/migrated_0018.js new file mode 100644 index 0000000..b75ddde --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0018.js @@ -0,0 +1 @@ +for (var x in list) process(x); \ No newline at end of file diff --git a/lib/test/esprima/statement/iteration/migrated_0018.tree.json b/lib/test/esprima/statement/iteration/migrated_0018.tree.json new file mode 100644 index 0000000..a2944c7 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0018.tree.json @@ -0,0 +1,402 @@ +{ + "type": "Program", + "body": [ + { + "type": "ForInStatement", + "left": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "init": null, + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "kind": "var", + "range": [ + 5, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "right": { + "type": "Identifier", + "name": "list", + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "process", + "range": [ + 20, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "range": [ + 20, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 20, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "each": false, + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "in", + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "list", + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "process", + "range": [ + 20, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } +} diff --git a/lib/test/esprima/statement/iteration/migrated_0019.js b/lib/test/esprima/statement/iteration/migrated_0019.js new file mode 100644 index 0000000..b06fd22 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0019.js @@ -0,0 +1 @@ +for (var x = 42 in list) process(x); \ No newline at end of file diff --git a/lib/test/esprima/statement/iteration/migrated_0019.skip b/lib/test/esprima/statement/iteration/migrated_0019.skip new file mode 100644 index 0000000..1333ed7 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0019.skip @@ -0,0 +1 @@ +TODO diff --git a/lib/test/esprima/statement/iteration/migrated_0019.tree.json b/lib/test/esprima/statement/iteration/migrated_0019.tree.json new file mode 100644 index 0000000..e8d1f60 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0019.tree.json @@ -0,0 +1,456 @@ +{ + "type": "Program", + "body": [ + { + "type": "ForInStatement", + "left": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "init": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 13, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 9, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "kind": "var", + "range": [ + 5, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "right": { + "type": "Identifier", + "name": "list", + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "process", + "range": [ + 25, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "range": [ + 25, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + "range": [ + 25, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "each": false, + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 13, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Keyword", + "value": "in", + "range": [ + 16, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "list", + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "process", + "range": [ + 25, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + } +} diff --git a/lib/test/esprima/statement/iteration/migrated_0020.js b/lib/test/esprima/statement/iteration/migrated_0020.js new file mode 100644 index 0000000..8cd8b58 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0020.js @@ -0,0 +1 @@ +for (let x in list) process(x); \ No newline at end of file diff --git a/lib/test/esprima/statement/iteration/migrated_0020.tree.json b/lib/test/esprima/statement/iteration/migrated_0020.tree.json new file mode 100644 index 0000000..a05a0bb --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0020.tree.json @@ -0,0 +1,402 @@ +{ + "type": "Program", + "body": [ + { + "type": "ForInStatement", + "left": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "init": null, + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "kind": "let", + "range": [ + 5, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "right": { + "type": "Identifier", + "name": "list", + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "process", + "range": [ + 20, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "range": [ + 20, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 20, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "each": false, + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "in", + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "list", + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "process", + "range": [ + 20, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } +} diff --git a/lib/test/esprima/statement/iteration/migrated_0021.js b/lib/test/esprima/statement/iteration/migrated_0021.js new file mode 100644 index 0000000..53b2a04 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0021.js @@ -0,0 +1 @@ +for (var x = y = z in q); \ No newline at end of file diff --git a/lib/test/esprima/statement/iteration/migrated_0021.skip b/lib/test/esprima/statement/iteration/migrated_0021.skip new file mode 100644 index 0000000..1333ed7 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0021.skip @@ -0,0 +1 @@ +TODO diff --git a/lib/test/esprima/statement/iteration/migrated_0021.tree.json b/lib/test/esprima/statement/iteration/migrated_0021.tree.json new file mode 100644 index 0000000..f2a8619 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0021.tree.json @@ -0,0 +1,400 @@ +{ + "type": "Program", + "body": [ + { + "type": "ForInStatement", + "left": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "init": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "y", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 13, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 9, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "kind": "var", + "range": [ + 5, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "right": { + "type": "Identifier", + "name": "q", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "body": { + "type": "EmptyStatement", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "each": false, + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Keyword", + "value": "in", + "range": [ + 19, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "q", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } +} diff --git a/lib/test/esprima/statement/iteration/migrated_0022.js b/lib/test/esprima/statement/iteration/migrated_0022.js new file mode 100644 index 0000000..78a6e1e --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0022.js @@ -0,0 +1 @@ +for (var a = b = c = (d in e) in z); \ No newline at end of file diff --git a/lib/test/esprima/statement/iteration/migrated_0022.skip b/lib/test/esprima/statement/iteration/migrated_0022.skip new file mode 100644 index 0000000..1333ed7 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0022.skip @@ -0,0 +1 @@ +TODO diff --git a/lib/test/esprima/statement/iteration/migrated_0022.tree.json b/lib/test/esprima/statement/iteration/migrated_0022.tree.json new file mode 100644 index 0000000..59a2e4a --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0022.tree.json @@ -0,0 +1,580 @@ +{ + "type": "Program", + "body": [ + { + "type": "ForInStatement", + "left": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "a", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "init": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "b", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "right": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "c", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "in", + "left": { + "type": "Identifier", + "name": "d", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "right": { + "type": "Identifier", + "name": "e", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "range": [ + 17, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "range": [ + 13, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "range": [ + 9, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "kind": "var", + "range": [ + 5, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "body": { + "type": "EmptyStatement", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "each": false, + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Keyword", + "value": "in", + "range": [ + 24, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "e", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Keyword", + "value": "in", + "range": [ + 30, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + } +} diff --git a/lib/test/esprima/statement/iteration/migrated_0023.js b/lib/test/esprima/statement/iteration/migrated_0023.js new file mode 100644 index 0000000..d42823d --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0023.js @@ -0,0 +1 @@ +for (var i = function() { return 10 in [] } in list) process(x); \ No newline at end of file diff --git a/lib/test/esprima/statement/iteration/migrated_0023.skip b/lib/test/esprima/statement/iteration/migrated_0023.skip new file mode 100644 index 0000000..1333ed7 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0023.skip @@ -0,0 +1 @@ +TODO diff --git a/lib/test/esprima/statement/iteration/migrated_0023.tree.json b/lib/test/esprima/statement/iteration/migrated_0023.tree.json new file mode 100644 index 0000000..3d40de7 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0023.tree.json @@ -0,0 +1,711 @@ +{ + "type": "Program", + "body": [ + { + "type": "ForInStatement", + "left": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "i", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "init": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "BinaryExpression", + "operator": "in", + "left": { + "type": "Literal", + "value": 10, + "raw": "10", + "range": [ + 33, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [], + "range": [ + 39, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "range": [ + 33, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "range": [ + 26, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 42 + } + } + } + ], + "range": [ + 24, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 13, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + "range": [ + 9, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 43 + } + } + } + ], + "kind": "var", + "range": [ + 5, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + "right": { + "type": "Identifier", + "name": "list", + "range": [ + 47, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 51 + } + } + }, + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "process", + "range": [ + 53, + 60 + ], + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 60 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 61, + 62 + ], + "loc": { + "start": { + "line": 1, + "column": 61 + }, + "end": { + "line": 1, + "column": 62 + } + } + } + ], + "range": [ + 53, + 63 + ], + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 63 + } + } + }, + "range": [ + 53, + 64 + ], + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 64 + } + } + }, + "each": false, + "range": [ + 0, + 64 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 64 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "i", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 13, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 26, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Numeric", + "value": "10", + "range": [ + 33, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Keyword", + "value": "in", + "range": [ + 36, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + { + "type": "Keyword", + "value": "in", + "range": [ + 44, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + { + "type": "Identifier", + "value": "list", + "range": [ + 47, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 51 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 1, + "column": 52 + } + } + }, + { + "type": "Identifier", + "value": "process", + "range": [ + 53, + 60 + ], + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 60 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 60, + 61 + ], + "loc": { + "start": { + "line": 1, + "column": 60 + }, + "end": { + "line": 1, + "column": 61 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 61, + 62 + ], + "loc": { + "start": { + "line": 1, + "column": 61 + }, + "end": { + "line": 1, + "column": 62 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 1, + "column": 62 + }, + "end": { + "line": 1, + "column": 63 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 63, + 64 + ], + "loc": { + "start": { + "line": 1, + "column": 63 + }, + "end": { + "line": 1, + "column": 64 + } + } + } + ], + "range": [ + 0, + 64 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 64 + } + } +} diff --git a/lib/test/esprima/statement/iteration/migrated_0024.js b/lib/test/esprima/statement/iteration/migrated_0024.js new file mode 100644 index 0000000..ad46536 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0024.js @@ -0,0 +1 @@ +for (a[b in c] in d); \ No newline at end of file diff --git a/lib/test/esprima/statement/iteration/migrated_0024.tree.json b/lib/test/esprima/statement/iteration/migrated_0024.tree.json new file mode 100644 index 0000000..c143217 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0024.tree.json @@ -0,0 +1,381 @@ +{ + "type": "Program", + "body": [ + { + "type": "ForInStatement", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "a", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "property": { + "type": "BinaryExpression", + "operator": "in", + "left": { + "type": "Identifier", + "name": "b", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "right": { + "type": "Identifier", + "name": "c", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 7, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 5, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "right": { + "type": "Identifier", + "name": "d", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "body": { + "type": "EmptyStatement", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "each": false, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "in", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "in", + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } +} diff --git a/lib/test/esprima/statement/iteration/migrated_0025.js b/lib/test/esprima/statement/iteration/migrated_0025.js new file mode 100644 index 0000000..2593b76 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0025.js @@ -0,0 +1 @@ +for (a(b in c)[0] in d); \ No newline at end of file diff --git a/lib/test/esprima/statement/iteration/migrated_0025.tree.json b/lib/test/esprima/statement/iteration/migrated_0025.tree.json new file mode 100644 index 0000000..b3d4e4c --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0025.tree.json @@ -0,0 +1,473 @@ +{ + "type": "Program", + "body": [ + { + "type": "ForInStatement", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "a", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "arguments": [ + { + "type": "BinaryExpression", + "operator": "in", + "left": { + "type": "Identifier", + "name": "b", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "right": { + "type": "Identifier", + "name": "c", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 7, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "range": [ + 5, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "property": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 5, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "right": { + "type": "Identifier", + "name": "d", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "body": { + "type": "EmptyStatement", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "each": false, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "in", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Keyword", + "value": "in", + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } +} diff --git a/lib/test/esprima/statement/iteration/migrated_0026.js b/lib/test/esprima/statement/iteration/migrated_0026.js new file mode 100644 index 0000000..6b8d17c --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0026.js @@ -0,0 +1 @@ +for (a.in in a); \ No newline at end of file diff --git a/lib/test/esprima/statement/iteration/migrated_0026.tree.json b/lib/test/esprima/statement/iteration/migrated_0026.tree.json new file mode 100644 index 0000000..47239c3 --- /dev/null +++ b/lib/test/esprima/statement/iteration/migrated_0026.tree.json @@ -0,0 +1,291 @@ +{ + "type": "Program", + "body": [ + { + "type": "ForInStatement", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "a", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "property": { + "type": "Identifier", + "name": "in", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 5, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "right": { + "type": "Identifier", + "name": "a", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "body": { + "type": "EmptyStatement", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "each": false, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Keyword", + "value": "in", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Keyword", + "value": "in", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } +} diff --git a/lib/test/esprima/statement/iteration/pattern-in-for-in.js b/lib/test/esprima/statement/iteration/pattern-in-for-in.js new file mode 100644 index 0000000..7bfdb2f --- /dev/null +++ b/lib/test/esprima/statement/iteration/pattern-in-for-in.js @@ -0,0 +1 @@ +for([a,b[a],{c,d=e,[f]:[g,h().a,(0).k,...i[0]]}] in 0); diff --git a/lib/test/esprima/statement/iteration/pattern-in-for-in.tree.json b/lib/test/esprima/statement/iteration/pattern-in-for-in.tree.json new file mode 100644 index 0000000..6d7bf07 --- /dev/null +++ b/lib/test/esprima/statement/iteration/pattern-in-for-in.tree.json @@ -0,0 +1,1474 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 55 + } + }, + "type": "ForInStatement", + "left": { + "range": [ + 4, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "Identifier", + "name": "a" + }, + { + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "type": "MemberExpression", + "computed": true, + "object": { + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "Identifier", + "name": "b" + }, + "property": { + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "type": "Identifier", + "name": "a" + } + }, + { + "range": [ + 12, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "type": "ObjectPattern", + "properties": [ + { + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Property", + "key": { + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Identifier", + "name": "c" + }, + "computed": false, + "value": { + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "type": "Identifier", + "name": "c" + }, + "kind": "init", + "method": false, + "shorthand": true + }, + { + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "Property", + "key": { + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "Identifier", + "name": "d" + }, + "computed": false, + "value": { + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "AssignmentPattern", + "left": { + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "Identifier", + "name": "d" + }, + "right": { + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "type": "Identifier", + "name": "e" + } + }, + "kind": "init", + "method": false, + "shorthand": true + }, + { + "range": [ + 19, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "type": "Property", + "key": { + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "type": "Identifier", + "name": "f" + }, + "computed": true, + "value": { + "range": [ + 23, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "type": "ArrayPattern", + "elements": [ + { + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "type": "Identifier", + "name": "g" + }, + { + "range": [ + 26, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "type": "MemberExpression", + "computed": false, + "object": { + "range": [ + 26, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "type": "CallExpression", + "callee": { + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "type": "Identifier", + "name": "h" + }, + "arguments": [] + }, + "property": { + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "type": "Identifier", + "name": "a" + } + }, + { + "range": [ + 32, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "type": "MemberExpression", + "computed": false, + "object": { + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + }, + "property": { + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "type": "Identifier", + "name": "k" + } + }, + { + "range": [ + 38, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "type": "RestElement", + "argument": { + "range": [ + 41, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "type": "MemberExpression", + "computed": true, + "object": { + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "type": "Identifier", + "name": "i" + }, + "property": { + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + } + } + } + ] + }, + "kind": "init", + "method": false, + "shorthand": false + } + ] + } + ] + }, + "right": { + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 52 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "type": "Literal", + "value": 0, + "raw": "0" + }, + "body": { + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 55 + } + }, + "type": "EmptyStatement" + }, + "each": false + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "e", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "g", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "h", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Identifier", + "value": "k", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 38, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + { + "type": "Identifier", + "value": "i", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 47 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + { + "type": "Keyword", + "value": "in", + "range": [ + 49, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 51 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 52 + }, + "end": { + "line": 1, + "column": 53 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 54 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 55 + } + } + } + ], + "range": [ + 0, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 55 + } + } +} diff --git a/lib/test/esprima/statement/labelled/migrated_0000.js b/lib/test/esprima/statement/labelled/migrated_0000.js new file mode 100644 index 0000000..818f601 --- /dev/null +++ b/lib/test/esprima/statement/labelled/migrated_0000.js @@ -0,0 +1 @@ +start: for (;;) break start \ No newline at end of file diff --git a/lib/test/esprima/statement/labelled/migrated_0000.tree.json b/lib/test/esprima/statement/labelled/migrated_0000.tree.json new file mode 100644 index 0000000..3b471af --- /dev/null +++ b/lib/test/esprima/statement/labelled/migrated_0000.tree.json @@ -0,0 +1,274 @@ +{ + "type": "Program", + "body": [ + { + "type": "LabeledStatement", + "label": { + "type": "Identifier", + "name": "start", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "body": { + "type": "ForStatement", + "init": null, + "test": null, + "update": null, + "body": { + "type": "BreakStatement", + "label": { + "type": "Identifier", + "name": "start", + "range": [ + 22, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "range": [ + 16, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "range": [ + 7, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "start", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "for", + "range": [ + 7, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Keyword", + "value": "break", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "start", + "range": [ + 22, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + } +} diff --git a/lib/test/esprima/statement/labelled/migrated_0001.js b/lib/test/esprima/statement/labelled/migrated_0001.js new file mode 100644 index 0000000..d7a526b --- /dev/null +++ b/lib/test/esprima/statement/labelled/migrated_0001.js @@ -0,0 +1 @@ +start: while (true) break start \ No newline at end of file diff --git a/lib/test/esprima/statement/labelled/migrated_0001.tree.json b/lib/test/esprima/statement/labelled/migrated_0001.tree.json new file mode 100644 index 0000000..950d44e --- /dev/null +++ b/lib/test/esprima/statement/labelled/migrated_0001.tree.json @@ -0,0 +1,272 @@ +{ + "type": "Program", + "body": [ + { + "type": "LabeledStatement", + "label": { + "type": "Identifier", + "name": "start", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "body": { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "body": { + "type": "BreakStatement", + "label": { + "type": "Identifier", + "name": "start", + "range": [ + 26, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "range": [ + 20, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "range": [ + 7, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "start", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "while", + "range": [ + 7, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Keyword", + "value": "break", + "range": [ + 20, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "start", + "range": [ + 26, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } +} diff --git a/lib/test/esprima/statement/labelled/migrated_0002.js b/lib/test/esprima/statement/labelled/migrated_0002.js new file mode 100644 index 0000000..6d34f5d --- /dev/null +++ b/lib/test/esprima/statement/labelled/migrated_0002.js @@ -0,0 +1 @@ +__proto__: test \ No newline at end of file diff --git a/lib/test/esprima/statement/labelled/migrated_0002.tree.json b/lib/test/esprima/statement/labelled/migrated_0002.tree.json new file mode 100644 index 0000000..20adadb --- /dev/null +++ b/lib/test/esprima/statement/labelled/migrated_0002.tree.json @@ -0,0 +1,146 @@ +{ + "type": "Program", + "body": [ + { + "type": "LabeledStatement", + "label": { + "type": "Identifier", + "name": "__proto__", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "test", + "range": [ + 11, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 11, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "__proto__", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "test", + "range": [ + 11, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } +} diff --git a/lib/test/esprima/statement/return/migrated_0000.diff b/lib/test/esprima/statement/return/migrated_0000.diff new file mode 100644 index 0000000..51a0cc4 --- /dev/null +++ b/lib/test/esprima/statement/return/migrated_0000.diff @@ -0,0 +1,22 @@ +{ + 'body': { + '0': { + 'expression': { + 'body': { + 'body': { + '0': { + 'range': { + '1': 19 + }, + 'loc': { + 'end': { + 'column': 19 + } + } + } + } + } + } + } + } +} diff --git a/lib/test/esprima/statement/return/migrated_0000.js b/lib/test/esprima/statement/return/migrated_0000.js new file mode 100644 index 0000000..7619e9f --- /dev/null +++ b/lib/test/esprima/statement/return/migrated_0000.js @@ -0,0 +1 @@ +(function(){ return }) \ No newline at end of file diff --git a/lib/test/esprima/statement/return/migrated_0000.tree.json b/lib/test/esprima/statement/return/migrated_0000.tree.json new file mode 100644 index 0000000..221de8f --- /dev/null +++ b/lib/test/esprima/statement/return/migrated_0000.tree.json @@ -0,0 +1,241 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": null, + "range": [ + 13, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "range": [ + 11, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 1, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 13, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } +} diff --git a/lib/test/esprima/statement/return/migrated_0001.js b/lib/test/esprima/statement/return/migrated_0001.js new file mode 100644 index 0000000..1a2219d --- /dev/null +++ b/lib/test/esprima/statement/return/migrated_0001.js @@ -0,0 +1 @@ +(function(){ return; }) \ No newline at end of file diff --git a/lib/test/esprima/statement/return/migrated_0001.tree.json b/lib/test/esprima/statement/return/migrated_0001.tree.json new file mode 100644 index 0000000..43b2057 --- /dev/null +++ b/lib/test/esprima/statement/return/migrated_0001.tree.json @@ -0,0 +1,259 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": null, + "range": [ + 13, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "range": [ + 11, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 1, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 13, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } +} diff --git a/lib/test/esprima/statement/return/migrated_0002.js b/lib/test/esprima/statement/return/migrated_0002.js new file mode 100644 index 0000000..2e2bb6f --- /dev/null +++ b/lib/test/esprima/statement/return/migrated_0002.js @@ -0,0 +1 @@ +(function(){ return x; }) \ No newline at end of file diff --git a/lib/test/esprima/statement/return/migrated_0002.tree.json b/lib/test/esprima/statement/return/migrated_0002.tree.json new file mode 100644 index 0000000..7319981 --- /dev/null +++ b/lib/test/esprima/statement/return/migrated_0002.tree.json @@ -0,0 +1,294 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 13, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "range": [ + 11, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 1, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 13, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } +} diff --git a/lib/test/esprima/statement/return/migrated_0003.diff b/lib/test/esprima/statement/return/migrated_0003.diff new file mode 100644 index 0000000..30208aa --- /dev/null +++ b/lib/test/esprima/statement/return/migrated_0003.diff @@ -0,0 +1,22 @@ +{ + 'body': { + '0': { + 'expression': { + 'body': { + 'body': { + '0': { + 'range': { + '1': 25 + }, + 'loc': { + 'end': { + 'column': 25 + } + } + } + } + } + } + } + } +} diff --git a/lib/test/esprima/statement/return/migrated_0003.js b/lib/test/esprima/statement/return/migrated_0003.js new file mode 100644 index 0000000..0deb010 --- /dev/null +++ b/lib/test/esprima/statement/return/migrated_0003.js @@ -0,0 +1 @@ +(function(){ return x * y }) \ No newline at end of file diff --git a/lib/test/esprima/statement/return/migrated_0003.tree.json b/lib/test/esprima/statement/return/migrated_0003.tree.json new file mode 100644 index 0000000..64be835 --- /dev/null +++ b/lib/test/esprima/statement/return/migrated_0003.tree.json @@ -0,0 +1,348 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "BinaryExpression", + "operator": "*", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "range": [ + 20, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "range": [ + 13, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "range": [ + 11, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 1, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 13, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + } +} diff --git a/lib/test/esprima/statement/switch/migrated_0000.js b/lib/test/esprima/statement/switch/migrated_0000.js new file mode 100644 index 0000000..d571ea8 --- /dev/null +++ b/lib/test/esprima/statement/switch/migrated_0000.js @@ -0,0 +1 @@ +switch (x) {} \ No newline at end of file diff --git a/lib/test/esprima/statement/switch/migrated_0000.tree.json b/lib/test/esprima/statement/switch/migrated_0000.tree.json new file mode 100644 index 0000000..761a962 --- /dev/null +++ b/lib/test/esprima/statement/switch/migrated_0000.tree.json @@ -0,0 +1,166 @@ +{ + "type": "Program", + "body": [ + { + "type": "SwitchStatement", + "discriminant": { + "type": "Identifier", + "name": "x", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "cases": [], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "switch", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } +} diff --git a/lib/test/esprima/statement/switch/migrated_0001.js b/lib/test/esprima/statement/switch/migrated_0001.js new file mode 100644 index 0000000..fd9a2cb --- /dev/null +++ b/lib/test/esprima/statement/switch/migrated_0001.js @@ -0,0 +1 @@ +switch (answer) { case 42: hi(); break; } \ No newline at end of file diff --git a/lib/test/esprima/statement/switch/migrated_0001.tree.json b/lib/test/esprima/statement/switch/migrated_0001.tree.json new file mode 100644 index 0000000..9f46287 --- /dev/null +++ b/lib/test/esprima/statement/switch/migrated_0001.tree.json @@ -0,0 +1,438 @@ +{ + "type": "Program", + "body": [ + { + "type": "SwitchStatement", + "discriminant": { + "type": "Identifier", + "name": "answer", + "range": [ + 8, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "cases": [ + { + "type": "SwitchCase", + "test": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 23, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "consequent": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "hi", + "range": [ + 27, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "arguments": [], + "range": [ + 27, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "range": [ + 27, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "BreakStatement", + "label": null, + "range": [ + 33, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 39 + } + } + } + ], + "range": [ + 18, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 39 + } + } + } + ], + "range": [ + 0, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "switch", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "answer", + "range": [ + 8, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Keyword", + "value": "case", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 23, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "hi", + "range": [ + 27, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Keyword", + "value": "break", + "range": [ + 33, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + } + ], + "range": [ + 0, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + } +} diff --git a/lib/test/esprima/statement/switch/migrated_0002.diff b/lib/test/esprima/statement/switch/migrated_0002.diff new file mode 100644 index 0000000..3f1c658 --- /dev/null +++ b/lib/test/esprima/statement/switch/migrated_0002.diff @@ -0,0 +1,18 @@ +{ + 'body': { + '0': { + 'cases': { + '1': { + 'range': { '1': 54 }, + 'loc': { 'end': { 'column': 54 }}, + 'consequent': { + '0': { + 'range': { '1': 54 }, + 'loc': { 'end': { 'column': 54 }}, + } + } + } + } + } + } +} diff --git a/lib/test/esprima/statement/switch/migrated_0002.js b/lib/test/esprima/statement/switch/migrated_0002.js new file mode 100644 index 0000000..a945c13 --- /dev/null +++ b/lib/test/esprima/statement/switch/migrated_0002.js @@ -0,0 +1 @@ +switch (answer) { case 42: hi(); break; default: break } \ No newline at end of file diff --git a/lib/test/esprima/statement/switch/migrated_0002.tree.json b/lib/test/esprima/statement/switch/migrated_0002.tree.json new file mode 100644 index 0000000..69b351b --- /dev/null +++ b/lib/test/esprima/statement/switch/migrated_0002.tree.json @@ -0,0 +1,530 @@ +{ + "type": "Program", + "body": [ + { + "type": "SwitchStatement", + "discriminant": { + "type": "Identifier", + "name": "answer", + "range": [ + 8, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "cases": [ + { + "type": "SwitchCase", + "test": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 23, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "consequent": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "hi", + "range": [ + 27, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "arguments": [], + "range": [ + 27, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "range": [ + 27, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "BreakStatement", + "label": null, + "range": [ + 33, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 39 + } + } + } + ], + "range": [ + 18, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "SwitchCase", + "test": null, + "consequent": [ + { + "type": "BreakStatement", + "label": null, + "range": [ + 49, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 55 + } + } + } + ], + "range": [ + 40, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 55 + } + } + } + ], + "range": [ + 0, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 56 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "switch", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "answer", + "range": [ + 8, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Keyword", + "value": "case", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 23, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "hi", + "range": [ + 27, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Keyword", + "value": "break", + "range": [ + 33, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Keyword", + "value": "default", + "range": [ + 40, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 47 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + { + "type": "Keyword", + "value": "break", + "range": [ + 49, + 54 + ], + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 54 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 55 + }, + "end": { + "line": 1, + "column": 56 + } + } + } + ], + "range": [ + 0, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 56 + } + } +} diff --git a/lib/test/esprima/statement/throw/migrated_0000.js b/lib/test/esprima/statement/throw/migrated_0000.js new file mode 100644 index 0000000..073d027 --- /dev/null +++ b/lib/test/esprima/statement/throw/migrated_0000.js @@ -0,0 +1 @@ +throw x; \ No newline at end of file diff --git a/lib/test/esprima/statement/throw/migrated_0000.tree.json b/lib/test/esprima/statement/throw/migrated_0000.tree.json new file mode 100644 index 0000000..8c7e842 --- /dev/null +++ b/lib/test/esprima/statement/throw/migrated_0000.tree.json @@ -0,0 +1,111 @@ +{ + "type": "Program", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "throw", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } +} diff --git a/lib/test/esprima/statement/throw/migrated_0001.js b/lib/test/esprima/statement/throw/migrated_0001.js new file mode 100644 index 0000000..4593b61 --- /dev/null +++ b/lib/test/esprima/statement/throw/migrated_0001.js @@ -0,0 +1 @@ +throw x * y \ No newline at end of file diff --git a/lib/test/esprima/statement/throw/migrated_0001.tree.json b/lib/test/esprima/statement/throw/migrated_0001.tree.json new file mode 100644 index 0000000..6c8eb50 --- /dev/null +++ b/lib/test/esprima/statement/throw/migrated_0001.tree.json @@ -0,0 +1,165 @@ +{ + "type": "Program", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "BinaryExpression", + "operator": "*", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 6, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "throw", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } +} diff --git a/lib/test/esprima/statement/throw/migrated_0002.js b/lib/test/esprima/statement/throw/migrated_0002.js new file mode 100644 index 0000000..e529bfa --- /dev/null +++ b/lib/test/esprima/statement/throw/migrated_0002.js @@ -0,0 +1 @@ +throw { message: "Error" } \ No newline at end of file diff --git a/lib/test/esprima/statement/throw/migrated_0002.tree.json b/lib/test/esprima/statement/throw/migrated_0002.tree.json new file mode 100644 index 0000000..4701a7e --- /dev/null +++ b/lib/test/esprima/statement/throw/migrated_0002.tree.json @@ -0,0 +1,224 @@ +{ + "type": "Program", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "message", + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "computed": false, + "value": { + "type": "Literal", + "value": "Error", + "raw": "\"Error\"", + "range": [ + 17, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 8, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "range": [ + 6, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "throw", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "message", + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "String", + "value": "\"Error\"", + "range": [ + 17, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + } +} diff --git a/lib/test/esprima/statement/try/migrated_0000.js b/lib/test/esprima/statement/try/migrated_0000.js new file mode 100644 index 0000000..73f247b --- /dev/null +++ b/lib/test/esprima/statement/try/migrated_0000.js @@ -0,0 +1 @@ +try { } catch (e) { } \ No newline at end of file diff --git a/lib/test/esprima/statement/try/migrated_0000.tree.json b/lib/test/esprima/statement/try/migrated_0000.tree.json new file mode 100644 index 0000000..095c0da --- /dev/null +++ b/lib/test/esprima/statement/try/migrated_0000.tree.json @@ -0,0 +1,273 @@ +{ + "type": "Program", + "body": [ + { + "type": "TryStatement", + "block": { + "type": "BlockStatement", + "body": [], + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "handler": { + "type": "CatchClause", + "param": { + "type": "Identifier", + "name": "e", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 18, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 8, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "finalizer": null, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "try", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Keyword", + "value": "catch", + "range": [ + 8, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "e", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } +} diff --git a/lib/test/esprima/statement/try/migrated_0001.js b/lib/test/esprima/statement/try/migrated_0001.js new file mode 100644 index 0000000..9f28761 --- /dev/null +++ b/lib/test/esprima/statement/try/migrated_0001.js @@ -0,0 +1 @@ +try { } catch (eval) { } \ No newline at end of file diff --git a/lib/test/esprima/statement/try/migrated_0001.tree.json b/lib/test/esprima/statement/try/migrated_0001.tree.json new file mode 100644 index 0000000..8b9ef1d --- /dev/null +++ b/lib/test/esprima/statement/try/migrated_0001.tree.json @@ -0,0 +1,273 @@ +{ + "type": "Program", + "body": [ + { + "type": "TryStatement", + "block": { + "type": "BlockStatement", + "body": [], + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "handler": { + "type": "CatchClause", + "param": { + "type": "Identifier", + "name": "eval", + "range": [ + 15, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "range": [ + 8, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "finalizer": null, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "try", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Keyword", + "value": "catch", + "range": [ + 8, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "eval", + "range": [ + 15, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } +} diff --git a/lib/test/esprima/statement/try/migrated_0002.js b/lib/test/esprima/statement/try/migrated_0002.js new file mode 100644 index 0000000..4a6beaf --- /dev/null +++ b/lib/test/esprima/statement/try/migrated_0002.js @@ -0,0 +1 @@ +try { } catch (arguments) { } \ No newline at end of file diff --git a/lib/test/esprima/statement/try/migrated_0002.tree.json b/lib/test/esprima/statement/try/migrated_0002.tree.json new file mode 100644 index 0000000..eec582a --- /dev/null +++ b/lib/test/esprima/statement/try/migrated_0002.tree.json @@ -0,0 +1,273 @@ +{ + "type": "Program", + "body": [ + { + "type": "TryStatement", + "block": { + "type": "BlockStatement", + "body": [], + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "handler": { + "type": "CatchClause", + "param": { + "type": "Identifier", + "name": "arguments", + "range": [ + 15, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 26, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "range": [ + 8, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "finalizer": null, + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "try", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Keyword", + "value": "catch", + "range": [ + 8, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "arguments", + "range": [ + 15, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } +} diff --git a/lib/test/esprima/statement/try/migrated_0003.diff b/lib/test/esprima/statement/try/migrated_0003.diff new file mode 100644 index 0000000..b1bef75 --- /dev/null +++ b/lib/test/esprima/statement/try/migrated_0003.diff @@ -0,0 +1,16 @@ +{ + 'body': { + '0': { + 'handler': { + 'body': { + 'body': { + '0': { + 'range': { '1': 26 }, + 'loc': { 'end': { 'column': 26 }} + } + } + } + } + } + } +} diff --git a/lib/test/esprima/statement/try/migrated_0003.js b/lib/test/esprima/statement/try/migrated_0003.js new file mode 100644 index 0000000..f8e09cd --- /dev/null +++ b/lib/test/esprima/statement/try/migrated_0003.js @@ -0,0 +1 @@ +try { } catch (e) { say(e) } \ No newline at end of file diff --git a/lib/test/esprima/statement/try/migrated_0003.tree.json b/lib/test/esprima/statement/try/migrated_0003.tree.json new file mode 100644 index 0000000..f7f2cdf --- /dev/null +++ b/lib/test/esprima/statement/try/migrated_0003.tree.json @@ -0,0 +1,418 @@ +{ + "type": "Program", + "body": [ + { + "type": "TryStatement", + "block": { + "type": "BlockStatement", + "body": [], + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "handler": { + "type": "CatchClause", + "param": { + "type": "Identifier", + "name": "e", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "say", + "range": [ + 20, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "e", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "range": [ + 20, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 20, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "range": [ + 18, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "range": [ + 8, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "finalizer": null, + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "try", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Keyword", + "value": "catch", + "range": [ + 8, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "e", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "say", + "range": [ + 20, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "e", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + } +} diff --git a/lib/test/esprima/statement/try/migrated_0004.diff b/lib/test/esprima/statement/try/migrated_0004.diff new file mode 100644 index 0000000..921637e --- /dev/null +++ b/lib/test/esprima/statement/try/migrated_0004.diff @@ -0,0 +1,14 @@ +{ + 'body': { + '0': { + 'finalizer': { + 'body': { + '0': { + 'range': { '1': 32 }, + 'loc': { 'end': { 'column': 32 }} + } + } + } + } + } +} diff --git a/lib/test/esprima/statement/try/migrated_0004.js b/lib/test/esprima/statement/try/migrated_0004.js new file mode 100644 index 0000000..08ff3b5 --- /dev/null +++ b/lib/test/esprima/statement/try/migrated_0004.js @@ -0,0 +1 @@ +try { } finally { cleanup(stuff) } \ No newline at end of file diff --git a/lib/test/esprima/statement/try/migrated_0004.tree.json b/lib/test/esprima/statement/try/migrated_0004.tree.json new file mode 100644 index 0000000..29982e7 --- /dev/null +++ b/lib/test/esprima/statement/try/migrated_0004.tree.json @@ -0,0 +1,329 @@ +{ + "type": "Program", + "body": [ + { + "type": "TryStatement", + "block": { + "type": "BlockStatement", + "body": [], + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "handler": null, + "finalizer": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "cleanup", + "range": [ + 18, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "stuff", + "range": [ + 26, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "range": [ + 18, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "range": [ + 18, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "range": [ + 16, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "try", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Keyword", + "value": "finally", + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "cleanup", + "range": [ + 18, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "stuff", + "range": [ + 26, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } +} diff --git a/lib/test/esprima/statement/try/migrated_0005.diff b/lib/test/esprima/statement/try/migrated_0005.diff new file mode 100644 index 0000000..2c1692a --- /dev/null +++ b/lib/test/esprima/statement/try/migrated_0005.diff @@ -0,0 +1,16 @@ +{ + 'body': { + '0': { + 'handler': { + 'body': { + 'body': { + '0': { + 'range': { '1': 36 }, + 'loc': { 'end': { 'column': 36 }} + } + } + } + } + } + } +} diff --git a/lib/test/esprima/statement/try/migrated_0005.js b/lib/test/esprima/statement/try/migrated_0005.js new file mode 100644 index 0000000..a9e58c6 --- /dev/null +++ b/lib/test/esprima/statement/try/migrated_0005.js @@ -0,0 +1 @@ +try { doThat(); } catch (e) { say(e) } \ No newline at end of file diff --git a/lib/test/esprima/statement/try/migrated_0005.tree.json b/lib/test/esprima/statement/try/migrated_0005.tree.json new file mode 100644 index 0000000..ec7f137 --- /dev/null +++ b/lib/test/esprima/statement/try/migrated_0005.tree.json @@ -0,0 +1,544 @@ +{ + "type": "Program", + "body": [ + { + "type": "TryStatement", + "block": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "doThat", + "range": [ + 6, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "arguments": [], + "range": [ + 6, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 6, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 4, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "handler": { + "type": "CatchClause", + "param": { + "type": "Identifier", + "name": "e", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "say", + "range": [ + 30, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "e", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "range": [ + 30, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "range": [ + 30, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + ], + "range": [ + 28, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "range": [ + 18, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "finalizer": null, + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "try", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "doThat", + "range": [ + 6, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Keyword", + "value": "catch", + "range": [ + 18, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "e", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Identifier", + "value": "say", + "range": [ + 30, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Identifier", + "value": "e", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + ], + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } +} diff --git a/lib/test/esprima/statement/try/migrated_0006.diff b/lib/test/esprima/statement/try/migrated_0006.diff new file mode 100644 index 0000000..57eec2b --- /dev/null +++ b/lib/test/esprima/statement/try/migrated_0006.diff @@ -0,0 +1,24 @@ +{ + 'body': { + '0': { + 'handler': { + 'body': { + 'body': { + '0': { + 'range': { '1': 36 }, + 'loc': { 'end': { 'column': 36 }} + } + } + } + }, + 'finalizer': { + 'body': { + '0': { + 'range': { '1': 63 }, + 'loc': { 'end': { 'column': 63 }} + } + } + } + } + } +} diff --git a/lib/test/esprima/statement/try/migrated_0006.js b/lib/test/esprima/statement/try/migrated_0006.js new file mode 100644 index 0000000..e457d7f --- /dev/null +++ b/lib/test/esprima/statement/try/migrated_0006.js @@ -0,0 +1 @@ +try { doThat(); } catch (e) { say(e) } finally { cleanup(stuff) } \ No newline at end of file diff --git a/lib/test/esprima/statement/try/migrated_0006.tree.json b/lib/test/esprima/statement/try/migrated_0006.tree.json new file mode 100644 index 0000000..a67b562 --- /dev/null +++ b/lib/test/esprima/statement/try/migrated_0006.tree.json @@ -0,0 +1,760 @@ +{ + "type": "Program", + "body": [ + { + "type": "TryStatement", + "block": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "doThat", + "range": [ + 6, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "arguments": [], + "range": [ + 6, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 6, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 4, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "handler": { + "type": "CatchClause", + "param": { + "type": "Identifier", + "name": "e", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "say", + "range": [ + 30, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "e", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "range": [ + 30, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "range": [ + 30, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + ], + "range": [ + 28, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "range": [ + 18, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "finalizer": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "cleanup", + "range": [ + 49, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 56 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "stuff", + "range": [ + 57, + 62 + ], + "loc": { + "start": { + "line": 1, + "column": 57 + }, + "end": { + "line": 1, + "column": 62 + } + } + } + ], + "range": [ + 49, + 63 + ], + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 63 + } + } + }, + "range": [ + 49, + 64 + ], + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 64 + } + } + } + ], + "range": [ + 47, + 65 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 65 + } + } + }, + "range": [ + 0, + 65 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 65 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "try", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "doThat", + "range": [ + 6, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Keyword", + "value": "catch", + "range": [ + 18, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "e", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Identifier", + "value": "say", + "range": [ + 30, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Identifier", + "value": "e", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Keyword", + "value": "finally", + "range": [ + 39, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + { + "type": "Identifier", + "value": "cleanup", + "range": [ + 49, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 56 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 1, + "column": 56 + }, + "end": { + "line": 1, + "column": 57 + } + } + }, + { + "type": "Identifier", + "value": "stuff", + "range": [ + 57, + 62 + ], + "loc": { + "start": { + "line": 1, + "column": 57 + }, + "end": { + "line": 1, + "column": 62 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 1, + "column": 62 + }, + "end": { + "line": 1, + "column": 63 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 1, + "column": 64 + }, + "end": { + "line": 1, + "column": 65 + } + } + } + ], + "range": [ + 0, + 65 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 65 + } + } +} diff --git a/lib/test/esprima/statement/try/strict_simple_catch.js b/lib/test/esprima/statement/try/strict_simple_catch.js new file mode 100644 index 0000000..ba9aa2d --- /dev/null +++ b/lib/test/esprima/statement/try/strict_simple_catch.js @@ -0,0 +1,2 @@ +"use strict"; +try {} catch (evil) {} diff --git a/lib/test/esprima/statement/try/strict_simple_catch.tree.json b/lib/test/esprima/statement/try/strict_simple_catch.tree.json new file mode 100644 index 0000000..3f4a402 --- /dev/null +++ b/lib/test/esprima/statement/try/strict_simple_catch.tree.json @@ -0,0 +1,346 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "directive": "use strict", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "TryStatement", + "block": { + "type": "BlockStatement", + "body": [], + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "handler": { + "type": "CatchClause", + "param": { + "type": "Identifier", + "name": "evil", + "range": [ + 28, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 34, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 21, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "finalizer": null, + "range": [ + 14, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "try", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "catch", + "range": [ + 21, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "evil", + "range": [ + 28, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ] +} diff --git a/lib/test/esprima/statement/variable/complex-pattern-requires-init.failure.json b/lib/test/esprima/statement/variable/complex-pattern-requires-init.failure.json new file mode 100644 index 0000000..d2a124b --- /dev/null +++ b/lib/test/esprima/statement/variable/complex-pattern-requires-init.failure.json @@ -0,0 +1 @@ +{"index":7,"lineNumber":2,"column":1,"message":"Error: Line 2: Unexpected end of input","description":"Unexpected end of input"} \ No newline at end of file diff --git a/lib/test/esprima/statement/variable/complex-pattern-requires-init.js b/lib/test/esprima/statement/variable/complex-pattern-requires-init.js new file mode 100644 index 0000000..9fc941b --- /dev/null +++ b/lib/test/esprima/statement/variable/complex-pattern-requires-init.js @@ -0,0 +1 @@ +var [] diff --git a/lib/test/esprima/statement/variable/invalid_trailing_comma_1.failure.json b/lib/test/esprima/statement/variable/invalid_trailing_comma_1.failure.json new file mode 100644 index 0000000..d2a124b --- /dev/null +++ b/lib/test/esprima/statement/variable/invalid_trailing_comma_1.failure.json @@ -0,0 +1 @@ +{"index":7,"lineNumber":2,"column":1,"message":"Error: Line 2: Unexpected end of input","description":"Unexpected end of input"} \ No newline at end of file diff --git a/lib/test/esprima/statement/variable/invalid_trailing_comma_1.js b/lib/test/esprima/statement/variable/invalid_trailing_comma_1.js new file mode 100644 index 0000000..2a1960b --- /dev/null +++ b/lib/test/esprima/statement/variable/invalid_trailing_comma_1.js @@ -0,0 +1 @@ +var x, diff --git a/lib/test/esprima/statement/variable/invalid_trailing_comma_2.failure.json b/lib/test/esprima/statement/variable/invalid_trailing_comma_2.failure.json new file mode 100644 index 0000000..3b08351 --- /dev/null +++ b/lib/test/esprima/statement/variable/invalid_trailing_comma_2.failure.json @@ -0,0 +1 @@ +{"index":6,"lineNumber":1,"column":7,"message":"Error: Line 1: Unexpected token ;","description":"Unexpected token ;"} \ No newline at end of file diff --git a/lib/test/esprima/statement/variable/invalid_trailing_comma_2.js b/lib/test/esprima/statement/variable/invalid_trailing_comma_2.js new file mode 100644 index 0000000..71ef9ad --- /dev/null +++ b/lib/test/esprima/statement/variable/invalid_trailing_comma_2.js @@ -0,0 +1 @@ +var x,; diff --git a/lib/test/esprima/statement/variable/invalid_trailing_comma_3.failure.json b/lib/test/esprima/statement/variable/invalid_trailing_comma_3.failure.json new file mode 100644 index 0000000..85fc6a4 --- /dev/null +++ b/lib/test/esprima/statement/variable/invalid_trailing_comma_3.failure.json @@ -0,0 +1 @@ +{"index":7,"lineNumber":1,"column":8,"message":"Error: Line 1: Unexpected token ;","description":"Unexpected token ;"} \ No newline at end of file diff --git a/lib/test/esprima/statement/variable/invalid_trailing_comma_3.js b/lib/test/esprima/statement/variable/invalid_trailing_comma_3.js new file mode 100644 index 0000000..f657517 --- /dev/null +++ b/lib/test/esprima/statement/variable/invalid_trailing_comma_3.js @@ -0,0 +1 @@ +var x, ; diff --git a/lib/test/esprima/statement/variable/invalid_trailing_comma_4.failure.json b/lib/test/esprima/statement/variable/invalid_trailing_comma_4.failure.json new file mode 100644 index 0000000..37f74a0 --- /dev/null +++ b/lib/test/esprima/statement/variable/invalid_trailing_comma_4.failure.json @@ -0,0 +1 @@ +{"index":10,"lineNumber":2,"column":1,"message":"Error: Line 2: Unexpected end of input","description":"Unexpected end of input"} \ No newline at end of file diff --git a/lib/test/esprima/statement/variable/invalid_trailing_comma_4.js b/lib/test/esprima/statement/variable/invalid_trailing_comma_4.js new file mode 100644 index 0000000..5d56eb1 --- /dev/null +++ b/lib/test/esprima/statement/variable/invalid_trailing_comma_4.js @@ -0,0 +1 @@ +var x, y, diff --git a/lib/test/esprima/statement/variable/invalid_trailing_comma_5.failure.json b/lib/test/esprima/statement/variable/invalid_trailing_comma_5.failure.json new file mode 100644 index 0000000..c85fec8 --- /dev/null +++ b/lib/test/esprima/statement/variable/invalid_trailing_comma_5.failure.json @@ -0,0 +1 @@ +{"index":11,"lineNumber":2,"column":5,"message":"Error: Line 2: Unexpected token ;","description":"Unexpected token ;"} \ No newline at end of file diff --git a/lib/test/esprima/statement/variable/invalid_trailing_comma_5.js b/lib/test/esprima/statement/variable/invalid_trailing_comma_5.js new file mode 100644 index 0000000..4a1cd60 --- /dev/null +++ b/lib/test/esprima/statement/variable/invalid_trailing_comma_5.js @@ -0,0 +1,2 @@ +var x, + y,; diff --git a/lib/test/esprima/statement/variable/invalid_trailing_comma_6.failure.json b/lib/test/esprima/statement/variable/invalid_trailing_comma_6.failure.json new file mode 100644 index 0000000..3115da3 --- /dev/null +++ b/lib/test/esprima/statement/variable/invalid_trailing_comma_6.failure.json @@ -0,0 +1 @@ +{"index":17,"lineNumber":2,"column":1,"message":"Error: Line 2: Unexpected end of input","description":"Unexpected end of input"} \ No newline at end of file diff --git a/lib/test/esprima/statement/variable/invalid_trailing_comma_6.js b/lib/test/esprima/statement/variable/invalid_trailing_comma_6.js new file mode 100644 index 0000000..d773b4c --- /dev/null +++ b/lib/test/esprima/statement/variable/invalid_trailing_comma_6.js @@ -0,0 +1 @@ +var answer = 42, diff --git a/lib/test/esprima/statement/variable/migrated_0000.js b/lib/test/esprima/statement/variable/migrated_0000.js new file mode 100644 index 0000000..72f136b --- /dev/null +++ b/lib/test/esprima/statement/variable/migrated_0000.js @@ -0,0 +1 @@ +var x \ No newline at end of file diff --git a/lib/test/esprima/statement/variable/migrated_0000.tree.json b/lib/test/esprima/statement/variable/migrated_0000.tree.json new file mode 100644 index 0000000..98c7272 --- /dev/null +++ b/lib/test/esprima/statement/variable/migrated_0000.tree.json @@ -0,0 +1,114 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": null, + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } +} diff --git a/lib/test/esprima/statement/variable/migrated_0001.js b/lib/test/esprima/statement/variable/migrated_0001.js new file mode 100644 index 0000000..84592dd --- /dev/null +++ b/lib/test/esprima/statement/variable/migrated_0001.js @@ -0,0 +1 @@ +var x, y; \ No newline at end of file diff --git a/lib/test/esprima/statement/variable/migrated_0001.tree.json b/lib/test/esprima/statement/variable/migrated_0001.tree.json new file mode 100644 index 0000000..f83ec33 --- /dev/null +++ b/lib/test/esprima/statement/variable/migrated_0001.tree.json @@ -0,0 +1,204 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": null, + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "y", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "init": null, + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } +} diff --git a/lib/test/esprima/statement/variable/migrated_0002.js b/lib/test/esprima/statement/variable/migrated_0002.js new file mode 100644 index 0000000..af223d0 --- /dev/null +++ b/lib/test/esprima/statement/variable/migrated_0002.js @@ -0,0 +1 @@ +var x = 42 \ No newline at end of file diff --git a/lib/test/esprima/statement/variable/migrated_0002.tree.json b/lib/test/esprima/statement/variable/migrated_0002.tree.json new file mode 100644 index 0000000..ade80f2 --- /dev/null +++ b/lib/test/esprima/statement/variable/migrated_0002.tree.json @@ -0,0 +1,168 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 4, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } +} diff --git a/lib/test/esprima/statement/variable/migrated_0003.js b/lib/test/esprima/statement/variable/migrated_0003.js new file mode 100644 index 0000000..6903ba0 --- /dev/null +++ b/lib/test/esprima/statement/variable/migrated_0003.js @@ -0,0 +1 @@ +var eval = 42, arguments = 42 \ No newline at end of file diff --git a/lib/test/esprima/statement/variable/migrated_0003.tree.json b/lib/test/esprima/statement/variable/migrated_0003.tree.json new file mode 100644 index 0000000..01adf3c --- /dev/null +++ b/lib/test/esprima/statement/variable/migrated_0003.tree.json @@ -0,0 +1,294 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "eval", + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "init": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 4, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "arguments", + "range": [ + 15, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "init": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 27, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "range": [ + 15, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "eval", + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "arguments", + "range": [ + 15, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 27, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } +} diff --git a/lib/test/esprima/statement/variable/migrated_0004.js b/lib/test/esprima/statement/variable/migrated_0004.js new file mode 100644 index 0000000..984fdd2 --- /dev/null +++ b/lib/test/esprima/statement/variable/migrated_0004.js @@ -0,0 +1 @@ +var x = 14, y = 3, z = 1977 \ No newline at end of file diff --git a/lib/test/esprima/statement/variable/migrated_0004.tree.json b/lib/test/esprima/statement/variable/migrated_0004.tree.json new file mode 100644 index 0000000..5ea36a6 --- /dev/null +++ b/lib/test/esprima/statement/variable/migrated_0004.tree.json @@ -0,0 +1,420 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "Literal", + "value": 14, + "raw": "14", + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 4, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "y", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "init": { + "type": "Literal", + "value": 3, + "raw": "3", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 12, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "z", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "init": { + "type": "Literal", + "value": 1977, + "raw": "1977", + "range": [ + 23, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "range": [ + 19, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Numeric", + "value": "14", + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Numeric", + "value": "3", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Numeric", + "value": "1977", + "range": [ + 23, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + } +} diff --git a/lib/test/esprima/statement/variable/migrated_0005.js b/lib/test/esprima/statement/variable/migrated_0005.js new file mode 100644 index 0000000..179e8b5 --- /dev/null +++ b/lib/test/esprima/statement/variable/migrated_0005.js @@ -0,0 +1 @@ +var implements, interface, package \ No newline at end of file diff --git a/lib/test/esprima/statement/variable/migrated_0005.tree.json b/lib/test/esprima/statement/variable/migrated_0005.tree.json new file mode 100644 index 0000000..8b08ee0 --- /dev/null +++ b/lib/test/esprima/statement/variable/migrated_0005.tree.json @@ -0,0 +1,258 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "implements", + "range": [ + 4, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "init": null, + "range": [ + 4, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "interface", + "range": [ + 16, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "init": null, + "range": [ + 16, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "package", + "range": [ + 27, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "init": null, + "range": [ + 27, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "implements", + "range": [ + 4, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "interface", + "range": [ + 16, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "package", + "range": [ + 27, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } +} diff --git a/lib/test/esprima/statement/variable/migrated_0006.js b/lib/test/esprima/statement/variable/migrated_0006.js new file mode 100644 index 0000000..d2c2ed5 --- /dev/null +++ b/lib/test/esprima/statement/variable/migrated_0006.js @@ -0,0 +1 @@ +var private, protected, public, static \ No newline at end of file diff --git a/lib/test/esprima/statement/variable/migrated_0006.tree.json b/lib/test/esprima/statement/variable/migrated_0006.tree.json new file mode 100644 index 0000000..dc502ad --- /dev/null +++ b/lib/test/esprima/statement/variable/migrated_0006.tree.json @@ -0,0 +1,330 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "private", + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "init": null, + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "protected", + "range": [ + 13, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "init": null, + "range": [ + 13, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "public", + "range": [ + 24, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "init": null, + "range": [ + 24, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "static", + "range": [ + 32, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "init": null, + "range": [ + 32, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "private", + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "protected", + "range": [ + 13, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "public", + "range": [ + 24, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Identifier", + "value": "static", + "range": [ + 32, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + ], + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } +} diff --git a/lib/test/esprima/statement/variable/var_let.js b/lib/test/esprima/statement/variable/var_let.js new file mode 100644 index 0000000..a7aa975 --- /dev/null +++ b/lib/test/esprima/statement/variable/var_let.js @@ -0,0 +1 @@ +var let; diff --git a/lib/test/esprima/statement/variable/var_let.tree.json b/lib/test/esprima/statement/variable/var_let.tree.json new file mode 100644 index 0000000..cc4fb74 --- /dev/null +++ b/lib/test/esprima/statement/variable/var_let.tree.json @@ -0,0 +1,132 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Identifier", + "name": "let" + }, + "init": null + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } +} diff --git a/lib/test/esprima/statement/with/migrated_0000.js b/lib/test/esprima/statement/with/migrated_0000.js new file mode 100644 index 0000000..aaa12b6 --- /dev/null +++ b/lib/test/esprima/statement/with/migrated_0000.js @@ -0,0 +1 @@ +with (x) foo = bar \ No newline at end of file diff --git a/lib/test/esprima/statement/with/migrated_0000.tree.json b/lib/test/esprima/statement/with/migrated_0000.tree.json new file mode 100644 index 0000000..8f9a72a --- /dev/null +++ b/lib/test/esprima/statement/with/migrated_0000.tree.json @@ -0,0 +1,254 @@ +{ + "type": "Program", + "body": [ + { + "type": "WithStatement", + "object": { + "type": "Identifier", + "name": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "foo", + "range": [ + 9, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "right": { + "type": "Identifier", + "name": "bar", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 9, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 9, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "with", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 9, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } +} diff --git a/lib/test/esprima/statement/with/migrated_0001.js b/lib/test/esprima/statement/with/migrated_0001.js new file mode 100644 index 0000000..56807e9 --- /dev/null +++ b/lib/test/esprima/statement/with/migrated_0001.js @@ -0,0 +1 @@ +with (x) foo = bar; \ No newline at end of file diff --git a/lib/test/esprima/statement/with/migrated_0001.tree.json b/lib/test/esprima/statement/with/migrated_0001.tree.json new file mode 100644 index 0000000..e064683 --- /dev/null +++ b/lib/test/esprima/statement/with/migrated_0001.tree.json @@ -0,0 +1,272 @@ +{ + "type": "Program", + "body": [ + { + "type": "WithStatement", + "object": { + "type": "Identifier", + "name": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "foo", + "range": [ + 9, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "right": { + "type": "Identifier", + "name": "bar", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 9, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 9, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "with", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 9, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } +} diff --git a/lib/test/esprima/statement/with/migrated_0002.diff b/lib/test/esprima/statement/with/migrated_0002.diff new file mode 100644 index 0000000..561d4c4 --- /dev/null +++ b/lib/test/esprima/statement/with/migrated_0002.diff @@ -0,0 +1,14 @@ +{ + 'body': { + '0': { + 'body': { + 'body': { + '0': { + 'range': { '1': 20 }, + 'loc': { 'end': { 'column': 20 }} + } + } + } + } + } +} diff --git a/lib/test/esprima/statement/with/migrated_0002.js b/lib/test/esprima/statement/with/migrated_0002.js new file mode 100644 index 0000000..4faa234 --- /dev/null +++ b/lib/test/esprima/statement/with/migrated_0002.js @@ -0,0 +1 @@ +with (x) { foo = bar } \ No newline at end of file diff --git a/lib/test/esprima/statement/with/migrated_0002.tree.json b/lib/test/esprima/statement/with/migrated_0002.tree.json new file mode 100644 index 0000000..78ff791 --- /dev/null +++ b/lib/test/esprima/statement/with/migrated_0002.tree.json @@ -0,0 +1,309 @@ +{ + "type": "Program", + "body": [ + { + "type": "WithStatement", + "object": { + "type": "Identifier", + "name": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "foo", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "right": { + "type": "Identifier", + "name": "bar", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 11, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 11, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 9, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "with", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } +} diff --git a/lib/test/esprima/tokenize/empty.skip b/lib/test/esprima/tokenize/empty.skip new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/lib/test/esprima/tokenize/empty.skip @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/tokenize/empty.tokens.json b/lib/test/esprima/tokenize/empty.tokens.json new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/lib/test/esprima/tokenize/empty.tokens.json @@ -0,0 +1 @@ +[] diff --git a/lib/test/esprima/tokenize/leading_comment.js b/lib/test/esprima/tokenize/leading_comment.js new file mode 100644 index 0000000..1ff58dd --- /dev/null +++ b/lib/test/esprima/tokenize/leading_comment.js @@ -0,0 +1 @@ +/* hello world */ /42/ diff --git a/lib/test/esprima/tokenize/leading_comment.tokens.json b/lib/test/esprima/tokenize/leading_comment.tokens.json new file mode 100644 index 0000000..d120530 --- /dev/null +++ b/lib/test/esprima/tokenize/leading_comment.tokens.json @@ -0,0 +1,42 @@ +[ + { + "type": "BlockComment", + "value": " hello world ", + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "RegularExpression", + "value": "/42/", + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "regex": { + "pattern": "42", + "flags": "" + } + } +] diff --git a/lib/test/esprima/tokenize/line_comment.js b/lib/test/esprima/tokenize/line_comment.js new file mode 100644 index 0000000..41b26d2 --- /dev/null +++ b/lib/test/esprima/tokenize/line_comment.js @@ -0,0 +1 @@ +var answer = 42 // the Ultimate diff --git a/lib/test/esprima/tokenize/line_comment.tokens.json b/lib/test/esprima/tokenize/line_comment.tokens.json new file mode 100644 index 0000000..7854d71 --- /dev/null +++ b/lib/test/esprima/tokenize/line_comment.tokens.json @@ -0,0 +1,92 @@ +[ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "answer", + "range": [ + 4, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 13, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "LineComment", + "value": " the Ultimate", + "range": [ + 17, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 32 + } + } + } +] diff --git a/lib/test/esprima/tokenize/line_terminators.js b/lib/test/esprima/tokenize/line_terminators.js new file mode 100644 index 0000000..fd40910 --- /dev/null +++ b/lib/test/esprima/tokenize/line_terminators.js @@ -0,0 +1,4 @@ + + + + diff --git a/lib/test/esprima/tokenize/line_terminators.tokens.json b/lib/test/esprima/tokenize/line_terminators.tokens.json new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/lib/test/esprima/tokenize/line_terminators.tokens.json @@ -0,0 +1 @@ +[] diff --git a/lib/test/esprima/tokenize/migrated_0000.js b/lib/test/esprima/tokenize/migrated_0000.js new file mode 100644 index 0000000..5f35808 --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0000.js @@ -0,0 +1 @@ +tokenize(/42/) \ No newline at end of file diff --git a/lib/test/esprima/tokenize/migrated_0000.tokens.json b/lib/test/esprima/tokenize/migrated_0000.tokens.json new file mode 100644 index 0000000..9d0b203 --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0000.tokens.json @@ -0,0 +1,78 @@ +[ + { + "type": "Identifier", + "value": "tokenize", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "RegularExpression", + "value": "/42/", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "regex": { + "pattern": "42", + "flags": "" + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + } +] diff --git a/lib/test/esprima/tokenize/migrated_0001.js b/lib/test/esprima/tokenize/migrated_0001.js new file mode 100644 index 0000000..f877963 --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0001.js @@ -0,0 +1 @@ +if (false) { /42/ } \ No newline at end of file diff --git a/lib/test/esprima/tokenize/migrated_0001.tokens.json b/lib/test/esprima/tokenize/migrated_0001.tokens.json new file mode 100644 index 0000000..5de2b9e --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0001.tokens.json @@ -0,0 +1,132 @@ +[ + { + "type": "Keyword", + "value": "if", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Boolean", + "value": "false", + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "RegularExpression", + "value": "/42/", + "range": [ + 13, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "regex": { + "pattern": "42", + "flags": "" + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + } +] diff --git a/lib/test/esprima/tokenize/migrated_0002.js b/lib/test/esprima/tokenize/migrated_0002.js new file mode 100644 index 0000000..9c231b0 --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0002.js @@ -0,0 +1 @@ +with (false) /42/ \ No newline at end of file diff --git a/lib/test/esprima/tokenize/migrated_0002.tokens.json b/lib/test/esprima/tokenize/migrated_0002.tokens.json new file mode 100644 index 0000000..a33901a --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0002.tokens.json @@ -0,0 +1,96 @@ +[ + { + "type": "Keyword", + "value": "with", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Boolean", + "value": "false", + "range": [ + 6, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "RegularExpression", + "value": "/42/", + "range": [ + 13, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "regex": { + "pattern": "42", + "flags": "" + } + } +] diff --git a/lib/test/esprima/tokenize/migrated_0003.js b/lib/test/esprima/tokenize/migrated_0003.js new file mode 100644 index 0000000..6bb9a7d --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0003.js @@ -0,0 +1 @@ +(false) /42/ \ No newline at end of file diff --git a/lib/test/esprima/tokenize/migrated_0003.tokens.json b/lib/test/esprima/tokenize/migrated_0003.tokens.json new file mode 100644 index 0000000..7460074 --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0003.tokens.json @@ -0,0 +1,110 @@ +[ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Boolean", + "value": "false", + "range": [ + 1, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + } +] \ No newline at end of file diff --git a/lib/test/esprima/tokenize/migrated_0004.js b/lib/test/esprima/tokenize/migrated_0004.js new file mode 100644 index 0000000..9266e75 --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0004.js @@ -0,0 +1 @@ +function f(){} /42/ \ No newline at end of file diff --git a/lib/test/esprima/tokenize/migrated_0004.tokens.json b/lib/test/esprima/tokenize/migrated_0004.tokens.json new file mode 100644 index 0000000..239370f --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0004.tokens.json @@ -0,0 +1,132 @@ +[ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "RegularExpression", + "value": "/42/", + "range": [ + 15, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "regex": { + "pattern": "42", + "flags": "" + } + } +] diff --git a/lib/test/esprima/tokenize/migrated_0005.js b/lib/test/esprima/tokenize/migrated_0005.js new file mode 100644 index 0000000..efc02d4 --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0005.js @@ -0,0 +1 @@ +function(){} /42 \ No newline at end of file diff --git a/lib/test/esprima/tokenize/migrated_0005.tokens.json b/lib/test/esprima/tokenize/migrated_0005.tokens.json new file mode 100644 index 0000000..6d9e471 --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0005.tokens.json @@ -0,0 +1,128 @@ +[ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + } +] \ No newline at end of file diff --git a/lib/test/esprima/tokenize/migrated_0006.js b/lib/test/esprima/tokenize/migrated_0006.js new file mode 100644 index 0000000..63f01a5 --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0006.js @@ -0,0 +1 @@ +{} /42 \ No newline at end of file diff --git a/lib/test/esprima/tokenize/migrated_0006.tokens.json b/lib/test/esprima/tokenize/migrated_0006.tokens.json new file mode 100644 index 0000000..5404b05 --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0006.tokens.json @@ -0,0 +1,74 @@ +[ + { + "type": "Punctuator", + "value": "{", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + } +] \ No newline at end of file diff --git a/lib/test/esprima/tokenize/migrated_0007.js b/lib/test/esprima/tokenize/migrated_0007.js new file mode 100644 index 0000000..fd96a9c --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0007.js @@ -0,0 +1 @@ +[function(){} /42] \ No newline at end of file diff --git a/lib/test/esprima/tokenize/migrated_0007.tokens.json b/lib/test/esprima/tokenize/migrated_0007.tokens.json new file mode 100644 index 0000000..2648203 --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0007.tokens.json @@ -0,0 +1,164 @@ +[ + { + "type": "Punctuator", + "value": "[", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + } +] \ No newline at end of file diff --git a/lib/test/esprima/tokenize/migrated_0008.js b/lib/test/esprima/tokenize/migrated_0008.js new file mode 100644 index 0000000..a6526fd --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0008.js @@ -0,0 +1 @@ +;function f(){} /42/ \ No newline at end of file diff --git a/lib/test/esprima/tokenize/migrated_0008.tokens.json b/lib/test/esprima/tokenize/migrated_0008.tokens.json new file mode 100644 index 0000000..2970a92 --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0008.tokens.json @@ -0,0 +1,150 @@ +[ + { + "type": "Punctuator", + "value": ";", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "RegularExpression", + "value": "/42/", + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "regex": { + "pattern": "42", + "flags": "" + } + } +] diff --git a/lib/test/esprima/tokenize/migrated_0009.js b/lib/test/esprima/tokenize/migrated_0009.js new file mode 100644 index 0000000..88dc3d6 --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0009.js @@ -0,0 +1 @@ +void /42/ \ No newline at end of file diff --git a/lib/test/esprima/tokenize/migrated_0009.tokens.json b/lib/test/esprima/tokenize/migrated_0009.tokens.json new file mode 100644 index 0000000..1b250b4 --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0009.tokens.json @@ -0,0 +1,42 @@ +[ + { + "type": "Keyword", + "value": "void", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "RegularExpression", + "value": "/42/", + "range": [ + 5, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "regex": { + "pattern": "42", + "flags": "" + } + } +] diff --git a/lib/test/esprima/tokenize/migrated_0010.js b/lib/test/esprima/tokenize/migrated_0010.js new file mode 100644 index 0000000..58598d0 --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0010.js @@ -0,0 +1 @@ +/42/ \ No newline at end of file diff --git a/lib/test/esprima/tokenize/migrated_0010.tokens.json b/lib/test/esprima/tokenize/migrated_0010.tokens.json new file mode 100644 index 0000000..41edf71 --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0010.tokens.json @@ -0,0 +1,24 @@ +[ + { + "type": "RegularExpression", + "value": "/42/", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "regex": { + "pattern": "42", + "flags": "" + } + } +] diff --git a/lib/test/esprima/tokenize/migrated_0011.js b/lib/test/esprima/tokenize/migrated_0011.js new file mode 100644 index 0000000..ce808a9 --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0011.js @@ -0,0 +1 @@ +foo[/42] \ No newline at end of file diff --git a/lib/test/esprima/tokenize/migrated_0011.tokens.json b/lib/test/esprima/tokenize/migrated_0011.tokens.json new file mode 100644 index 0000000..a7c8ab4 --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0011.tokens.json @@ -0,0 +1,38 @@ +[ + { + "type": "Identifier", + "value": "foo", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + } +] \ No newline at end of file diff --git a/lib/test/esprima/tokenize/migrated_0012.js b/lib/test/esprima/tokenize/migrated_0012.js new file mode 100644 index 0000000..39fb405 --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0012.js @@ -0,0 +1 @@ +[a] / b \ No newline at end of file diff --git a/lib/test/esprima/tokenize/migrated_0012.tokens.json b/lib/test/esprima/tokenize/migrated_0012.tokens.json new file mode 100644 index 0000000..ee092c7 --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0012.tokens.json @@ -0,0 +1,92 @@ +[ + { + "type": "Punctuator", + "value": "[", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + } +] \ No newline at end of file diff --git a/lib/test/esprima/tokenize/migrated_0013.skip b/lib/test/esprima/tokenize/migrated_0013.skip new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0013.skip @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/tokenize/migrated_0013.tokens.json b/lib/test/esprima/tokenize/migrated_0013.tokens.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0013.tokens.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/lib/test/esprima/tokenize/migrated_0014.failure.json b/lib/test/esprima/tokenize/migrated_0014.failure.json new file mode 100644 index 0000000..750ece1 --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0014.failure.json @@ -0,0 +1,7 @@ +{ + "tokenize": true, + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Invalid regular expression: missing /" +} \ No newline at end of file diff --git a/lib/test/esprima/tokenize/migrated_0014.js b/lib/test/esprima/tokenize/migrated_0014.js new file mode 100644 index 0000000..b6a8c8b --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0014.js @@ -0,0 +1 @@ +/42 \ No newline at end of file diff --git a/lib/test/esprima/tokenize/migrated_0015.failure.json b/lib/test/esprima/tokenize/migrated_0015.failure.json new file mode 100644 index 0000000..6031909 --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0015.failure.json @@ -0,0 +1,7 @@ +{ + "tokenize": true, + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Error: Line 1: Invalid regular expression: missing /" +} \ No newline at end of file diff --git a/lib/test/esprima/tokenize/migrated_0015.js b/lib/test/esprima/tokenize/migrated_0015.js new file mode 100644 index 0000000..df80d0d --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0015.js @@ -0,0 +1 @@ +foo[/42 \ No newline at end of file diff --git a/lib/test/esprima/tokenize/migrated_0016.js b/lib/test/esprima/tokenize/migrated_0016.js new file mode 100644 index 0000000..9e90c49 --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0016.js @@ -0,0 +1 @@ +this / 100; \ No newline at end of file diff --git a/lib/test/esprima/tokenize/migrated_0016.tokens.json b/lib/test/esprima/tokenize/migrated_0016.tokens.json new file mode 100644 index 0000000..2d16185 --- /dev/null +++ b/lib/test/esprima/tokenize/migrated_0016.tokens.json @@ -0,0 +1,74 @@ +[ + { + "type": "Keyword", + "value": "this", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Numeric", + "value": "100", + "range": [ + 7, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + } +] \ No newline at end of file diff --git a/lib/test/esprima/tokenize/trailing_comment.js b/lib/test/esprima/tokenize/trailing_comment.js new file mode 100644 index 0000000..d85be2c --- /dev/null +++ b/lib/test/esprima/tokenize/trailing_comment.js @@ -0,0 +1 @@ +/42/ /* answer */ diff --git a/lib/test/esprima/tokenize/trailing_comment.tokens.json b/lib/test/esprima/tokenize/trailing_comment.tokens.json new file mode 100644 index 0000000..6d671bf --- /dev/null +++ b/lib/test/esprima/tokenize/trailing_comment.tokens.json @@ -0,0 +1,42 @@ +[ + { + "type": "RegularExpression", + "value": "/42/", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "regex": { + "pattern": "42", + "flags": "" + } + }, + { + "type": "BlockComment", + "value": " answer ", + "range": [ + 5, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 17 + } + } + } +] diff --git a/lib/test/esprima/tolerant-parse/for-in-missing-parenthesis.diff b/lib/test/esprima/tolerant-parse/for-in-missing-parenthesis.diff new file mode 100644 index 0000000..f31cdae --- /dev/null +++ b/lib/test/esprima/tolerant-parse/for-in-missing-parenthesis.diff @@ -0,0 +1,21 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 3, "column": 0 }, + "end": { "line": 3, "column": 0 } + }, + "message":"Unexpected end of input, expected the token `)`" + }, + "1": { + "loc": { + "start": { "line": 3, "column": 0 }, + "end": { "line": 3, "column": 0 } + }, + "message":"Unexpected end of input, expected the start of a statement" + } + } +} diff --git a/lib/test/esprima/tolerant-parse/for-in-missing-parenthesis.js b/lib/test/esprima/tolerant-parse/for-in-missing-parenthesis.js new file mode 100644 index 0000000..5d65004 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/for-in-missing-parenthesis.js @@ -0,0 +1,2 @@ +for (x in y + diff --git a/lib/test/esprima/tolerant-parse/for-in-missing-parenthesis.tree.json b/lib/test/esprima/tolerant-parse/for-in-missing-parenthesis.tree.json new file mode 100644 index 0000000..af7a44f --- /dev/null +++ b/lib/test/esprima/tolerant-parse/for-in-missing-parenthesis.tree.json @@ -0,0 +1,191 @@ +{ + "type": "Program", + "body": [ + { + "type": "ForInStatement", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "body": { + "range": [ + 15, + 15 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 0 + } + }, + "type": "EmptyStatement" + }, + "each": false, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 0 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 0 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "in", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "errors": [ + { + "index": 15, + "lineNumber": 3, + "column": 1, + "message": "Error: Line 3: Unexpected end of input" + } + ] +} diff --git a/lib/test/esprima/tolerant-parse/for-missing-parenthesis.diff b/lib/test/esprima/tolerant-parse/for-missing-parenthesis.diff new file mode 100644 index 0000000..50cb11e --- /dev/null +++ b/lib/test/esprima/tolerant-parse/for-missing-parenthesis.diff @@ -0,0 +1,21 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 2, "column": 0 }, + "end": { "line": 2, "column": 0 } + }, + "message":"Unexpected end of input, expected the token `)`" + }, + "1": { + "loc": { + "start": { "line": 2, "column": 0 }, + "end": { "line": 2, "column": 0 } + }, + "message":"Unexpected end of input, expected the start of a statement" + } + } +} diff --git a/lib/test/esprima/tolerant-parse/for-missing-parenthesis.js b/lib/test/esprima/tolerant-parse/for-missing-parenthesis.js new file mode 100644 index 0000000..2ee0c78 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/for-missing-parenthesis.js @@ -0,0 +1 @@ +for (var i = 0; i < j; ++i diff --git a/lib/test/esprima/tolerant-parse/for-missing-parenthesis.tree.json b/lib/test/esprima/tolerant-parse/for-missing-parenthesis.tree.json new file mode 100644 index 0000000..668d46a --- /dev/null +++ b/lib/test/esprima/tolerant-parse/for-missing-parenthesis.tree.json @@ -0,0 +1,463 @@ +{ + "type": "Program", + "body": [ + { + "type": "ForStatement", + "init": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "i", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "init": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "kind": "var", + "range": [ + 5, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "test": { + "type": "BinaryExpression", + "operator": "<", + "left": { + "type": "Identifier", + "name": "i", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "right": { + "type": "Identifier", + "name": "j", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "update": { + "type": "UpdateExpression", + "operator": "++", + "argument": { + "type": "Identifier", + "name": "i", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "prefix": true, + "range": [ + 23, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "body": { + "range": [ + 27, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 0 + } + }, + "type": "EmptyStatement" + }, + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 0 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 0 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "i", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "i", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "j", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "++", + "range": [ + 23, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "i", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "errors": [ + { + "index": 27, + "lineNumber": 2, + "column": 1, + "message": "Error: Line 2: Unexpected end of input" + } + ] +} diff --git a/lib/test/esprima/tolerant-parse/for-of-missing-parenthesis.diff b/lib/test/esprima/tolerant-parse/for-of-missing-parenthesis.diff new file mode 100644 index 0000000..f31cdae --- /dev/null +++ b/lib/test/esprima/tolerant-parse/for-of-missing-parenthesis.diff @@ -0,0 +1,21 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 3, "column": 0 }, + "end": { "line": 3, "column": 0 } + }, + "message":"Unexpected end of input, expected the token `)`" + }, + "1": { + "loc": { + "start": { "line": 3, "column": 0 }, + "end": { "line": 3, "column": 0 } + }, + "message":"Unexpected end of input, expected the start of a statement" + } + } +} diff --git a/lib/test/esprima/tolerant-parse/for-of-missing-parenthesis.js b/lib/test/esprima/tolerant-parse/for-of-missing-parenthesis.js new file mode 100644 index 0000000..b5ff8c6 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/for-of-missing-parenthesis.js @@ -0,0 +1,2 @@ +for (x of y + diff --git a/lib/test/esprima/tolerant-parse/for-of-missing-parenthesis.tree.json b/lib/test/esprima/tolerant-parse/for-of-missing-parenthesis.tree.json new file mode 100644 index 0000000..4e2312c --- /dev/null +++ b/lib/test/esprima/tolerant-parse/for-of-missing-parenthesis.tree.json @@ -0,0 +1,190 @@ +{ + "type": "Program", + "body": [ + { + "type": "ForOfStatement", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "body": { + "range": [ + 15, + 15 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 0 + } + }, + "type": "EmptyStatement" + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 0 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 0 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "of", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "errors": [ + { + "index": 15, + "lineNumber": 3, + "column": 1, + "message": "Error: Line 3: Unexpected end of input" + } + ] +} diff --git a/lib/test/esprima/tolerant-parse/if-missing-parenthesis.diff b/lib/test/esprima/tolerant-parse/if-missing-parenthesis.diff new file mode 100644 index 0000000..50cb11e --- /dev/null +++ b/lib/test/esprima/tolerant-parse/if-missing-parenthesis.diff @@ -0,0 +1,21 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 2, "column": 0 }, + "end": { "line": 2, "column": 0 } + }, + "message":"Unexpected end of input, expected the token `)`" + }, + "1": { + "loc": { + "start": { "line": 2, "column": 0 }, + "end": { "line": 2, "column": 0 } + }, + "message":"Unexpected end of input, expected the start of a statement" + } + } +} diff --git a/lib/test/esprima/tolerant-parse/if-missing-parenthesis.js b/lib/test/esprima/tolerant-parse/if-missing-parenthesis.js new file mode 100644 index 0000000..e391e63 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/if-missing-parenthesis.js @@ -0,0 +1 @@ +if (x < 42 diff --git a/lib/test/esprima/tolerant-parse/if-missing-parenthesis.tree.json b/lib/test/esprima/tolerant-parse/if-missing-parenthesis.tree.json new file mode 100644 index 0000000..0317204 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/if-missing-parenthesis.tree.json @@ -0,0 +1,210 @@ +{ + "type": "Program", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "<", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 4, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "consequent": { + "range": [ + 11, + 11 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 0 + } + }, + "type": "EmptyStatement" + }, + "alternate": null, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 0 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 0 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "if", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "errors": [ + { + "index": 11, + "lineNumber": 2, + "column": 1, + "message": "Error: Line 2: Unexpected end of input" + } + ] +} diff --git a/lib/test/esprima/tolerant-parse/let_eval.diff b/lib/test/esprima/tolerant-parse/let_eval.diff new file mode 100644 index 0000000..d25ca2d --- /dev/null +++ b/lib/test/esprima/tolerant-parse/let_eval.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 18 }, + "end": { "line": 1, "column": 22 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/let_eval.js b/lib/test/esprima/tolerant-parse/let_eval.js new file mode 100644 index 0000000..bffd1c2 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/let_eval.js @@ -0,0 +1 @@ +"use strict"; let eval; diff --git a/lib/test/esprima/tolerant-parse/let_eval.tree.json b/lib/test/esprima/tolerant-parse/let_eval.tree.json new file mode 100644 index 0000000..53748ff --- /dev/null +++ b/lib/test/esprima/tolerant-parse/let_eval.tree.json @@ -0,0 +1,213 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "directive": "use strict", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "eval", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "init": null, + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "kind": "let", + "range": [ + 14, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "eval", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "errors": [ + { + "index": 22, + "lineNumber": 1, + "column": 23, + "message": "Error: Line 1: Variable name may not be eval or arguments in strict mode" + } + ], + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0000.diff b/lib/test/esprima/tolerant-parse/migrated_0000.diff new file mode 100644 index 0000000..1150876 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0000.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 3 }, + "end": { "line": 1, "column": 3 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0000.js b/lib/test/esprima/tolerant-parse/migrated_0000.js new file mode 100644 index 0000000..ce064e6 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0000.js @@ -0,0 +1 @@ +/* \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0000.tree.json b/lib/test/esprima/tolerant-parse/migrated_0000.tree.json new file mode 100644 index 0000000..c596c7e --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0000.tree.json @@ -0,0 +1,48 @@ +{ + "type": "Program", + "body": [], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": " ", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "tokens": [], + "errors": [ + { + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ILLEGAL" + } + ], + "range": [ + 3, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 3 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0001.diff b/lib/test/esprima/tolerant-parse/migrated_0001.diff new file mode 100644 index 0000000..87c8549 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0001.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 16 }, + "end": { "line": 1, "column": 16 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0001.js b/lib/test/esprima/tolerant-parse/migrated_0001.js new file mode 100644 index 0000000..c9cab31 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0001.js @@ -0,0 +1 @@ +var foo = 1; /* \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0001.tree.json b/lib/test/esprima/tolerant-parse/migrated_0001.tree.json new file mode 100644 index 0000000..875b8d1 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0001.tree.json @@ -0,0 +1,214 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "foo", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "init": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": " ", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "errors": [ + { + "index": 16, + "lineNumber": 1, + "column": 17, + "message": "Error: Line 1: Unexpected token ILLEGAL" + } + ], + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0002.diff b/lib/test/esprima/tolerant-parse/migrated_0002.diff new file mode 100644 index 0000000..c4d1dc0 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0002.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 15 }, + "end": { "line": 1, "column": 15 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0002.js b/lib/test/esprima/tolerant-parse/migrated_0002.js new file mode 100644 index 0000000..c93b91f --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0002.js @@ -0,0 +1 @@ +/* var fo0 = 1; \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0002.tree.json b/lib/test/esprima/tolerant-parse/migrated_0002.tree.json new file mode 100644 index 0000000..ca45ecd --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0002.tree.json @@ -0,0 +1,48 @@ +{ + "type": "Program", + "body": [], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": " var fo0 = 1;", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "tokens": [], + "errors": [ + { + "index": 15, + "lineNumber": 1, + "column": 16, + "message": "Error: Line 1: Unexpected token ILLEGAL" + } + ], + "range": [ + 15, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 15 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0003.diff b/lib/test/esprima/tolerant-parse/migrated_0003.diff new file mode 100644 index 0000000..87c8549 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0003.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 16 }, + "end": { "line": 1, "column": 16 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0003.js b/lib/test/esprima/tolerant-parse/migrated_0003.js new file mode 100644 index 0000000..11c2043 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0003.js @@ -0,0 +1 @@ +/* /* if(foo) {} \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0003.tree.json b/lib/test/esprima/tolerant-parse/migrated_0003.tree.json new file mode 100644 index 0000000..4ddc0d9 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0003.tree.json @@ -0,0 +1,48 @@ +{ + "type": "Program", + "body": [], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": " /* if(foo) {}", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "tokens": [], + "errors": [ + { + "index": 16, + "lineNumber": 1, + "column": 17, + "message": "Error: Line 1: Unexpected token ILLEGAL" + } + ], + "range": [ + 16, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 16 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0004.diff b/lib/test/esprima/tolerant-parse/migrated_0004.diff new file mode 100644 index 0000000..cc8aeac --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0004.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 3, "column": 0 }, + "end": { "line": 3, "column": 0 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0004.js b/lib/test/esprima/tolerant-parse/migrated_0004.js new file mode 100644 index 0000000..081b298 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0004.js @@ -0,0 +1,2 @@ +/* foo + diff --git a/lib/test/esprima/tolerant-parse/migrated_0004.tree.json b/lib/test/esprima/tolerant-parse/migrated_0004.tree.json new file mode 100644 index 0000000..c27c998 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0004.tree.json @@ -0,0 +1,48 @@ +{ + "type": "Program", + "body": [], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": " foo \n\n", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 0 + } + } + } + ], + "tokens": [], + "errors": [ + { + "index": 9, + "lineNumber": 3, + "column": 1, + "message": "Error: Line 3: Unexpected token ILLEGAL" + } + ], + "range": [ + 9, + 9 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 0 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0005.js b/lib/test/esprima/tolerant-parse/migrated_0005.js new file mode 100644 index 0000000..c2cac6e --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0005.js @@ -0,0 +1 @@ +f(a b c); \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0005.skip b/lib/test/esprima/tolerant-parse/migrated_0005.skip new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0005.skip @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/tolerant-parse/migrated_0005.tree.json b/lib/test/esprima/tolerant-parse/migrated_0005.tree.json new file mode 100644 index 0000000..7e7f3a4 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0005.tree.json @@ -0,0 +1,270 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "f", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "name": "b", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "name": "c", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "f", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "errors": [ + { + "index": 4, + "lineNumber": 1, + "column": 5, + "message": "Error: Line 1: Unexpected token b" + }, + { + "index": 6, + "lineNumber": 1, + "column": 7, + "message": "Error: Line 1: Unexpected token c" + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0006.js b/lib/test/esprima/tolerant-parse/migrated_0006.js new file mode 100644 index 0000000..7c073b7 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0006.js @@ -0,0 +1 @@ +f(a function(){} c); \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0006.skip b/lib/test/esprima/tolerant-parse/migrated_0006.skip new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0006.skip @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/tolerant-parse/migrated_0006.tree.json b/lib/test/esprima/tolerant-parse/migrated_0006.tree.json new file mode 100644 index 0000000..55c1407 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0006.tree.json @@ -0,0 +1,363 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "f", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 4, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "name": "c", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "f", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 4, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "errors": [ + { + "index": 4, + "lineNumber": 1, + "column": 5, + "message": "Error: Line 1: Unexpected token function" + }, + { + "index": 17, + "lineNumber": 1, + "column": 18, + "message": "Error: Line 1: Unexpected token c" + } + ], + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0007.js b/lib/test/esprima/tolerant-parse/migrated_0007.js new file mode 100644 index 0000000..19c20f1 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0007.js @@ -0,0 +1 @@ +f({} b c); \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0007.skip b/lib/test/esprima/tolerant-parse/migrated_0007.skip new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0007.skip @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/tolerant-parse/migrated_0007.tree.json b/lib/test/esprima/tolerant-parse/migrated_0007.tree.json new file mode 100644 index 0000000..8be0118 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0007.tree.json @@ -0,0 +1,288 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "f", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "arguments": [ + { + "type": "ObjectExpression", + "properties": [], + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "name": "b", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "name": "c", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "f", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "errors": [ + { + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Error: Line 1: Unexpected token b" + }, + { + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Error: Line 1: Unexpected token c" + } + ], + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0008.js b/lib/test/esprima/tolerant-parse/migrated_0008.js new file mode 100644 index 0000000..1bf4b1e --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0008.js @@ -0,0 +1 @@ +var o = {one: function() {} two:2}; \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0008.skip b/lib/test/esprima/tolerant-parse/migrated_0008.skip new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0008.skip @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/tolerant-parse/migrated_0008.tree.json b/lib/test/esprima/tolerant-parse/migrated_0008.tree.json new file mode 100644 index 0000000..9a2e85c --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0008.tree.json @@ -0,0 +1,528 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "o", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "one", + "range": [ + 9, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 25, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 14, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 9, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "two", + "range": [ + 28, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "computed": false, + "value": { + "type": "Literal", + "value": 2, + "raw": "2", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 28, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "range": [ + 8, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 4, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "o", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "one", + "range": [ + 9, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 14, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Identifier", + "value": "two", + "range": [ + 28, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "errors": [ + { + "index": 28, + "lineNumber": 1, + "column": 29, + "message": "Error: Line 1: Unexpected token two" + } + ], + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0009.js b/lib/test/esprima/tolerant-parse/migrated_0009.js new file mode 100644 index 0000000..1120e1a --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0009.js @@ -0,0 +1 @@ +var o = {one: function() {} two:2 three: 3}; \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0009.skip b/lib/test/esprima/tolerant-parse/migrated_0009.skip new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0009.skip @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/tolerant-parse/migrated_0009.tree.json b/lib/test/esprima/tolerant-parse/migrated_0009.tree.json new file mode 100644 index 0000000..e857170 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0009.tree.json @@ -0,0 +1,646 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "o", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "one", + "range": [ + 9, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 25, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 14, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 9, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "two", + "range": [ + 28, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "computed": false, + "value": { + "type": "Literal", + "value": 2, + "raw": "2", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 28, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "three", + "range": [ + 34, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + "computed": false, + "value": { + "type": "Literal", + "value": 3, + "raw": "3", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 34, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 42 + } + } + } + ], + "range": [ + 8, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + "range": [ + 4, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 43 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "o", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "one", + "range": [ + 9, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 14, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Identifier", + "value": "two", + "range": [ + 28, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Identifier", + "value": "three", + "range": [ + 34, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + { + "type": "Numeric", + "value": "3", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 44 + } + } + } + ], + "errors": [ + { + "index": 28, + "lineNumber": 1, + "column": 29, + "message": "Error: Line 1: Unexpected token two" + }, + { + "index": 34, + "lineNumber": 1, + "column": 35, + "message": "Error: Line 1: Unexpected token three" + } + ], + "range": [ + 0, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0010.js b/lib/test/esprima/tolerant-parse/migrated_0010.js new file mode 100644 index 0000000..818b665 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0010.js @@ -0,0 +1 @@ +var o = {one: function() {} two:2, three: 3 "four":4}; \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0010.skip b/lib/test/esprima/tolerant-parse/migrated_0010.skip new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0010.skip @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/tolerant-parse/migrated_0010.tree.json b/lib/test/esprima/tolerant-parse/migrated_0010.tree.json new file mode 100644 index 0000000..3588dcf --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0010.tree.json @@ -0,0 +1,777 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "o", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "one", + "range": [ + 9, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 25, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 14, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 9, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "two", + "range": [ + 28, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "computed": false, + "value": { + "type": "Literal", + "value": 2, + "raw": "2", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 28, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "three", + "range": [ + 35, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + "computed": false, + "value": { + "type": "Literal", + "value": 3, + "raw": "3", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 35, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + { + "type": "Property", + "key": { + "type": "Literal", + "value": "four", + "raw": "\"four\"", + "range": [ + 44, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 50 + } + } + }, + "computed": false, + "value": { + "type": "Literal", + "value": 4, + "raw": "4", + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 1, + "column": 52 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 44, + 52 + ], + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 52 + } + } + } + ], + "range": [ + 8, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 53 + } + } + }, + "range": [ + 4, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 53 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 54 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "o", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "one", + "range": [ + 9, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 14, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Identifier", + "value": "two", + "range": [ + 28, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Identifier", + "value": "three", + "range": [ + 35, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + { + "type": "Numeric", + "value": "3", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + { + "type": "String", + "value": "\"four\"", + "range": [ + 44, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 50 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 50 + }, + "end": { + "line": 1, + "column": 51 + } + } + }, + { + "type": "Numeric", + "value": "4", + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 1, + "column": 52 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 52 + }, + "end": { + "line": 1, + "column": 53 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 54 + } + } + } + ], + "errors": [ + { + "index": 28, + "lineNumber": 1, + "column": 29, + "message": "Error: Line 1: Unexpected token two" + }, + { + "index": 44, + "lineNumber": 1, + "column": 45, + "message": "Error: Line 1: Unexpected token four" + } + ], + "range": [ + 0, + 54 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0011.js b/lib/test/esprima/tolerant-parse/migrated_0011.js new file mode 100644 index 0000000..d8430aa --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0011.js @@ -0,0 +1 @@ +var o = {one: function() {} two:2, three: {aa: "a" bb: "b"} four: 4}; \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0011.skip b/lib/test/esprima/tolerant-parse/migrated_0011.skip new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0011.skip @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/tolerant-parse/migrated_0011.tree.json b/lib/test/esprima/tolerant-parse/migrated_0011.tree.json new file mode 100644 index 0000000..d5374d4 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0011.tree.json @@ -0,0 +1,1024 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "o", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "one", + "range": [ + 9, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 25, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 14, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 9, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "two", + "range": [ + 28, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "computed": false, + "value": { + "type": "Literal", + "value": 2, + "raw": "2", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 28, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "three", + "range": [ + 35, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + "computed": false, + "value": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "aa", + "range": [ + 43, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + "computed": false, + "value": { + "type": "Literal", + "value": "a", + "raw": "\"a\"", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 50 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 43, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 50 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "bb", + "range": [ + 51, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 1, + "column": 53 + } + } + }, + "computed": false, + "value": { + "type": "Literal", + "value": "b", + "raw": "\"b\"", + "range": [ + 55, + 58 + ], + "loc": { + "start": { + "line": 1, + "column": 55 + }, + "end": { + "line": 1, + "column": 58 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 51, + 58 + ], + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 1, + "column": 58 + } + } + } + ], + "range": [ + 42, + 59 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 59 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 35, + 59 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 59 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "four", + "range": [ + 60, + 64 + ], + "loc": { + "start": { + "line": 1, + "column": 60 + }, + "end": { + "line": 1, + "column": 64 + } + } + }, + "computed": false, + "value": { + "type": "Literal", + "value": 4, + "raw": "4", + "range": [ + 66, + 67 + ], + "loc": { + "start": { + "line": 1, + "column": 66 + }, + "end": { + "line": 1, + "column": 67 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 60, + 67 + ], + "loc": { + "start": { + "line": 1, + "column": 60 + }, + "end": { + "line": 1, + "column": 67 + } + } + } + ], + "range": [ + 8, + 68 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 68 + } + } + }, + "range": [ + 4, + 68 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 68 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 69 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 69 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "o", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "one", + "range": [ + 9, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 14, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Identifier", + "value": "two", + "range": [ + 28, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Identifier", + "value": "three", + "range": [ + 35, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + { + "type": "Identifier", + "value": "aa", + "range": [ + 43, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + { + "type": "String", + "value": "\"a\"", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 50 + } + } + }, + { + "type": "Identifier", + "value": "bb", + "range": [ + 51, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 1, + "column": 53 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 54 + } + } + }, + { + "type": "String", + "value": "\"b\"", + "range": [ + 55, + 58 + ], + "loc": { + "start": { + "line": 1, + "column": 55 + }, + "end": { + "line": 1, + "column": 58 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 1, + "column": 58 + }, + "end": { + "line": 1, + "column": 59 + } + } + }, + { + "type": "Identifier", + "value": "four", + "range": [ + 60, + 64 + ], + "loc": { + "start": { + "line": 1, + "column": 60 + }, + "end": { + "line": 1, + "column": 64 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 1, + "column": 64 + }, + "end": { + "line": 1, + "column": 65 + } + } + }, + { + "type": "Numeric", + "value": "4", + "range": [ + 66, + 67 + ], + "loc": { + "start": { + "line": 1, + "column": 66 + }, + "end": { + "line": 1, + "column": 67 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 67, + 68 + ], + "loc": { + "start": { + "line": 1, + "column": 67 + }, + "end": { + "line": 1, + "column": 68 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 68, + 69 + ], + "loc": { + "start": { + "line": 1, + "column": 68 + }, + "end": { + "line": 1, + "column": 69 + } + } + } + ], + "errors": [ + { + "index": 28, + "lineNumber": 1, + "column": 29, + "message": "Error: Line 1: Unexpected token two" + }, + { + "index": 51, + "lineNumber": 1, + "column": 52, + "message": "Error: Line 1: Unexpected token bb" + }, + { + "index": 60, + "lineNumber": 1, + "column": 61, + "message": "Error: Line 1: Unexpected token four" + } + ], + "range": [ + 0, + 69 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 69 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0012.diff b/lib/test/esprima/tolerant-parse/migrated_0012.diff new file mode 100644 index 0000000..125d81c --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0012.diff @@ -0,0 +1,14 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 10 }, + "end": { "line": 1, "column": 11 } + }, + "message":"Unexpected token `;`, expected the token `,`" + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0012.js b/lib/test/esprima/tolerant-parse/migrated_0012.js new file mode 100644 index 0000000..e00b5c1 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0012.js @@ -0,0 +1 @@ +x = { y: z; } \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0012.tree.json b/lib/test/esprima/tolerant-parse/migrated_0012.tree.json new file mode 100644 index 0000000..388da1b --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0012.tree.json @@ -0,0 +1,303 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "y", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "computed": false, + "value": { + "type": "Identifier", + "name": "z", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 6, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "range": [ + 4, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "errors": [ + { + "index": 10, + "lineNumber": 1, + "column": 11, + "message": "Error: Line 1: Unexpected token ;" + } + ], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0013.diff b/lib/test/esprima/tolerant-parse/migrated_0013.diff new file mode 100644 index 0000000..99b4f86 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0013.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 0 }, + "end": { "line": 1, "column": 6 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0013.js b/lib/test/esprima/tolerant-parse/migrated_0013.js new file mode 100644 index 0000000..55b1f0f --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0013.js @@ -0,0 +1 @@ +return \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0013.tree.json b/lib/test/esprima/tolerant-parse/migrated_0013.tree.json new file mode 100644 index 0000000..aa72848 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0013.tree.json @@ -0,0 +1,66 @@ +{ + "type": "Program", + "body": [ + { + "type": "ReturnStatement", + "argument": null, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "return", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "errors": [ + { + "index": 6, + "lineNumber": 1, + "column": 7, + "message": "Error: Line 1: Illegal return statement" + } + ], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0014.diff b/lib/test/esprima/tolerant-parse/migrated_0014.diff new file mode 100644 index 0000000..3790516 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0014.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 29 }, + "end": { "line": 1, "column": 38 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0014.js b/lib/test/esprima/tolerant-parse/migrated_0014.js new file mode 100644 index 0000000..ab4ab18 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0014.js @@ -0,0 +1 @@ +(function () { 'use strict'; with (i); }()) \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0014.tree.json b/lib/test/esprima/tolerant-parse/migrated_0014.tree.json new file mode 100644 index 0000000..7296d21 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0014.tree.json @@ -0,0 +1,482 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "'use strict'", + "range": [ + 15, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "directive": "use strict", + "range": [ + 15, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "WithStatement", + "object": { + "type": "Identifier", + "name": "i", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "body": { + "type": "EmptyStatement", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "range": [ + 29, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + ], + "range": [ + 13, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 1, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + "arguments": [], + "range": [ + 1, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + "range": [ + 0, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "String", + "value": "'use strict'", + "range": [ + 15, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Keyword", + "value": "with", + "range": [ + 29, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Identifier", + "value": "i", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + } + } + } + ], + "errors": [ + { + "index": 28, + "lineNumber": 1, + "column": 29, + "message": "Error: Line 1: Strict mode code may not include a with statement" + } + ], + "range": [ + 0, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0015.diff b/lib/test/esprima/tolerant-parse/migrated_0015.diff new file mode 100644 index 0000000..6fea177 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0015.diff @@ -0,0 +1,29 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 29 }, + "end": { "line": 1, "column": 32 } + } + } + }, + "body": { + "0": { + "expression": { + "callee": { + "body": { + "body": { + "1": { + "range": { "1": 32 }, + "loc": { "end": { "column": 32 } } + } + } + } + } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0015.js b/lib/test/esprima/tolerant-parse/migrated_0015.js new file mode 100644 index 0000000..338824e --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0015.js @@ -0,0 +1 @@ +(function () { 'use strict'; 021 }()) \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0015.tree.json b/lib/test/esprima/tolerant-parse/migrated_0015.tree.json new file mode 100644 index 0000000..67ad8c8 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0015.tree.json @@ -0,0 +1,394 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "'use strict'", + "range": [ + 15, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "directive": "use strict", + "range": [ + 15, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 17, + "raw": "021", + "range": [ + 29, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "range": [ + 29, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "range": [ + 13, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 1, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "arguments": [], + "range": [ + 1, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "range": [ + 0, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "String", + "value": "'use strict'", + "range": [ + 15, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Numeric", + "value": "021", + "range": [ + 29, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + ], + "errors": [ + { + "index": 29, + "lineNumber": 1, + "column": 30, + "message": "Error: Line 1: Octal literals are not allowed in strict mode." + } + ], + "range": [ + 0, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0016.diff b/lib/test/esprima/tolerant-parse/migrated_0016.diff new file mode 100644 index 0000000..51f7490 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0016.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 14 }, + "end": { "line": 1, "column": 22 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0016.js b/lib/test/esprima/tolerant-parse/migrated_0016.js new file mode 100644 index 0000000..4a92fb9 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0016.js @@ -0,0 +1 @@ +"use strict"; delete x \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0016.tree.json b/lib/test/esprima/tolerant-parse/migrated_0016.tree.json new file mode 100644 index 0000000..c42a6c0 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0016.tree.json @@ -0,0 +1,193 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "directive": "use strict", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "UnaryExpression", + "operator": "delete", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "prefix": true, + "range": [ + 14, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 14, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "delete", + "range": [ + 14, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "errors": [ + { + "index": 22, + "lineNumber": 1, + "column": 23, + "message": "Error: Line 1: Delete of an unqualified identifier in strict mode." + } + ], + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0017.diff b/lib/test/esprima/tolerant-parse/migrated_0017.diff new file mode 100644 index 0000000..36e4ff3 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0017.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 28 }, + "end": { "line": 1, "column": 32 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0017.js b/lib/test/esprima/tolerant-parse/migrated_0017.js new file mode 100644 index 0000000..f2527d1 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0017.js @@ -0,0 +1 @@ +"use strict"; try {} catch (eval) {} \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0017.tree.json b/lib/test/esprima/tolerant-parse/migrated_0017.tree.json new file mode 100644 index 0000000..04afdc2 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0017.tree.json @@ -0,0 +1,354 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "directive": "use strict", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "TryStatement", + "block": { + "type": "BlockStatement", + "body": [], + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "handler": { + "type": "CatchClause", + "param": { + "type": "Identifier", + "name": "eval", + "range": [ + 28, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 34, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "range": [ + 21, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "finalizer": null, + "range": [ + 14, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "try", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Keyword", + "value": "catch", + "range": [ + 21, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "eval", + "range": [ + 28, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "errors": [ + { + "index": 32, + "lineNumber": 1, + "column": 33, + "message": "Error: Line 1: Catch variable may not be eval or arguments in strict mode" + } + ], + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0018.diff b/lib/test/esprima/tolerant-parse/migrated_0018.diff new file mode 100644 index 0000000..3701bd1 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0018.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 28 }, + "end": { "line": 1, "column": 37 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0018.js b/lib/test/esprima/tolerant-parse/migrated_0018.js new file mode 100644 index 0000000..e3e6785 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0018.js @@ -0,0 +1 @@ +"use strict"; try {} catch (arguments) {} \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0018.tree.json b/lib/test/esprima/tolerant-parse/migrated_0018.tree.json new file mode 100644 index 0000000..2685ca3 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0018.tree.json @@ -0,0 +1,354 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "directive": "use strict", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "TryStatement", + "block": { + "type": "BlockStatement", + "body": [], + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "handler": { + "type": "CatchClause", + "param": { + "type": "Identifier", + "name": "arguments", + "range": [ + 28, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 39, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "range": [ + 21, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "finalizer": null, + "range": [ + 14, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 41 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "try", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Keyword", + "value": "catch", + "range": [ + 21, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "arguments", + "range": [ + 28, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + } + ], + "errors": [ + { + "index": 37, + "lineNumber": 1, + "column": 38, + "message": "Error: Line 1: Catch variable may not be eval or arguments in strict mode" + } + ], + "range": [ + 0, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0019.diff b/lib/test/esprima/tolerant-parse/migrated_0019.diff new file mode 100644 index 0000000..d25ca2d --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0019.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 18 }, + "end": { "line": 1, "column": 22 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0019.js b/lib/test/esprima/tolerant-parse/migrated_0019.js new file mode 100644 index 0000000..2458a1d --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0019.js @@ -0,0 +1 @@ +"use strict"; var eval; \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0019.tree.json b/lib/test/esprima/tolerant-parse/migrated_0019.tree.json new file mode 100644 index 0000000..814b677 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0019.tree.json @@ -0,0 +1,213 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "directive": "use strict", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "eval", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "init": null, + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "kind": "var", + "range": [ + 14, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "eval", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "errors": [ + { + "index": 22, + "lineNumber": 1, + "column": 23, + "message": "Error: Line 1: Variable name may not be eval or arguments in strict mode" + } + ], + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0020.diff b/lib/test/esprima/tolerant-parse/migrated_0020.diff new file mode 100644 index 0000000..1f5f129 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0020.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 18 }, + "end": { "line": 1, "column": 27 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0020.js b/lib/test/esprima/tolerant-parse/migrated_0020.js new file mode 100644 index 0000000..94fa953 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0020.js @@ -0,0 +1 @@ +"use strict"; var arguments; \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0020.tree.json b/lib/test/esprima/tolerant-parse/migrated_0020.tree.json new file mode 100644 index 0000000..cbc32ab --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0020.tree.json @@ -0,0 +1,213 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "directive": "use strict", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "arguments", + "range": [ + 18, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "init": null, + "range": [ + 18, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "kind": "var", + "range": [ + 14, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "arguments", + "range": [ + 18, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "errors": [ + { + "index": 27, + "lineNumber": 1, + "column": 28, + "message": "Error: Line 1: Variable name may not be eval or arguments in strict mode" + } + ], + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0021.diff b/lib/test/esprima/tolerant-parse/migrated_0021.diff new file mode 100644 index 0000000..e7e3069 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0021.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 14 }, + "end": { "line": 1, "column": 18 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0021.js b/lib/test/esprima/tolerant-parse/migrated_0021.js new file mode 100644 index 0000000..fe91722 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0021.js @@ -0,0 +1 @@ +"use strict"; eval = 0; \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0021.tree.json b/lib/test/esprima/tolerant-parse/migrated_0021.tree.json new file mode 100644 index 0000000..9e86dca --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0021.tree.json @@ -0,0 +1,247 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "directive": "use strict", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "eval", + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "right": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 14, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 14, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "eval", + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "errors": [ + { + "index": 14, + "lineNumber": 1, + "column": 15, + "message": "Error: Line 1: Assignment to eval or arguments is not allowed in strict mode" + } + ], + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0022.diff b/lib/test/esprima/tolerant-parse/migrated_0022.diff new file mode 100644 index 0000000..f55eeec --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0022.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 18 }, + "end": { "line": 1, "column": 20 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0022.js b/lib/test/esprima/tolerant-parse/migrated_0022.js new file mode 100644 index 0000000..a7ac077 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0022.js @@ -0,0 +1 @@ +"use strict"; eval++; \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0022.tree.json b/lib/test/esprima/tolerant-parse/migrated_0022.tree.json new file mode 100644 index 0000000..f32503b --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0022.tree.json @@ -0,0 +1,211 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "directive": "use strict", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "++", + "argument": { + "type": "Identifier", + "name": "eval", + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "prefix": false, + "range": [ + 14, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 14, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "eval", + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "++", + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "errors": [ + { + "index": 18, + "lineNumber": 1, + "column": 19, + "message": "Error: Line 1: Postfix increment/decrement may not have eval or arguments operand in strict mode" + } + ], + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0023.diff b/lib/test/esprima/tolerant-parse/migrated_0023.diff new file mode 100644 index 0000000..0b42f3b --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0023.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 20 }, + "end": { "line": 1, "column": 21 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0023.js b/lib/test/esprima/tolerant-parse/migrated_0023.js new file mode 100644 index 0000000..28514bf --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0023.js @@ -0,0 +1 @@ +"use strict"; --eval; \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0023.tree.json b/lib/test/esprima/tolerant-parse/migrated_0023.tree.json new file mode 100644 index 0000000..63823aa --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0023.tree.json @@ -0,0 +1,211 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "directive": "use strict", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "--", + "argument": { + "type": "Identifier", + "name": "eval", + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "prefix": true, + "range": [ + 14, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 14, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "--", + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "eval", + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "errors": [ + { + "index": 20, + "lineNumber": 1, + "column": 21, + "message": "Error: Line 1: Prefix increment/decrement may not have eval or arguments operand in strict mode" + } + ], + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0024.diff b/lib/test/esprima/tolerant-parse/migrated_0024.diff new file mode 100644 index 0000000..b856640 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0024.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 14 }, + "end": { "line": 1, "column": 23 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0024.js b/lib/test/esprima/tolerant-parse/migrated_0024.js new file mode 100644 index 0000000..065a97f --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0024.js @@ -0,0 +1 @@ +"use strict"; arguments = 0; \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0024.tree.json b/lib/test/esprima/tolerant-parse/migrated_0024.tree.json new file mode 100644 index 0000000..ef4a577 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0024.tree.json @@ -0,0 +1,247 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "directive": "use strict", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "arguments", + "range": [ + 14, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "right": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "range": [ + 14, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "range": [ + 14, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "arguments", + "range": [ + 14, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "errors": [ + { + "index": 14, + "lineNumber": 1, + "column": 15, + "message": "Error: Line 1: Assignment to eval or arguments is not allowed in strict mode" + } + ], + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0025.diff b/lib/test/esprima/tolerant-parse/migrated_0025.diff new file mode 100644 index 0000000..426b75c --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0025.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 23 }, + "end": { "line": 1, "column": 25 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0025.js b/lib/test/esprima/tolerant-parse/migrated_0025.js new file mode 100644 index 0000000..869f212 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0025.js @@ -0,0 +1 @@ +"use strict"; arguments--; \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0025.tree.json b/lib/test/esprima/tolerant-parse/migrated_0025.tree.json new file mode 100644 index 0000000..63bffee --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0025.tree.json @@ -0,0 +1,211 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "directive": "use strict", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "--", + "argument": { + "type": "Identifier", + "name": "arguments", + "range": [ + 14, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "prefix": false, + "range": [ + 14, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "range": [ + 14, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "arguments", + "range": [ + 14, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "--", + "range": [ + 23, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "errors": [ + { + "index": 23, + "lineNumber": 1, + "column": 24, + "message": "Error: Line 1: Postfix increment/decrement may not have eval or arguments operand in strict mode" + } + ], + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0026.diff b/lib/test/esprima/tolerant-parse/migrated_0026.diff new file mode 100644 index 0000000..ccc9a30 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0026.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 25 }, + "end": { "line": 1, "column": 26 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0026.js b/lib/test/esprima/tolerant-parse/migrated_0026.js new file mode 100644 index 0000000..f4b68c7 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0026.js @@ -0,0 +1 @@ +"use strict"; ++arguments; \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0026.tree.json b/lib/test/esprima/tolerant-parse/migrated_0026.tree.json new file mode 100644 index 0000000..ded88bb --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0026.tree.json @@ -0,0 +1,211 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "directive": "use strict", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "++", + "argument": { + "type": "Identifier", + "name": "arguments", + "range": [ + 16, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "prefix": true, + "range": [ + 14, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "range": [ + 14, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "++", + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "arguments", + "range": [ + 16, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "errors": [ + { + "index": 25, + "lineNumber": 1, + "column": 26, + "message": "Error: Line 1: Prefix increment/decrement may not have eval or arguments operand in strict mode" + } + ], + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0027.diff b/lib/test/esprima/tolerant-parse/migrated_0027.diff new file mode 100644 index 0000000..711f968 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0027.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 23 }, + "end": { "line": 1, "column": 27 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0027.js b/lib/test/esprima/tolerant-parse/migrated_0027.js new file mode 100644 index 0000000..b4e5fa0 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0027.js @@ -0,0 +1 @@ +"use strict"; function eval() {}; \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0027.tree.json b/lib/test/esprima/tolerant-parse/migrated_0027.tree.json new file mode 100644 index 0000000..fe2e3ff --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0027.tree.json @@ -0,0 +1,302 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "directive": "use strict", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "eval", + "range": [ + 23, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 30, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 14, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "EmptyStatement", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 14, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "eval", + "range": [ + 23, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "errors": [ + { + "index": 23, + "lineNumber": 1, + "column": 24, + "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" + } + ], + "range": [ + 0, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0028.diff b/lib/test/esprima/tolerant-parse/migrated_0028.diff new file mode 100644 index 0000000..46100b6 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0028.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 23 }, + "end": { "line": 1, "column": 32 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0028.js b/lib/test/esprima/tolerant-parse/migrated_0028.js new file mode 100644 index 0000000..4f7c6fb --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0028.js @@ -0,0 +1 @@ +"use strict"; function arguments() {}; \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0028.tree.json b/lib/test/esprima/tolerant-parse/migrated_0028.tree.json new file mode 100644 index 0000000..b92ada1 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0028.tree.json @@ -0,0 +1,302 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "directive": "use strict", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "arguments", + "range": [ + 23, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 35, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 14, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "EmptyStatement", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 14, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "arguments", + "range": [ + 23, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + ], + "errors": [ + { + "index": 23, + "lineNumber": 1, + "column": 24, + "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" + } + ], + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0029.diff b/lib/test/esprima/tolerant-parse/migrated_0029.diff new file mode 100644 index 0000000..46100b6 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0029.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 23 }, + "end": { "line": 1, "column": 32 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0029.js b/lib/test/esprima/tolerant-parse/migrated_0029.js new file mode 100644 index 0000000..3d27dcd --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0029.js @@ -0,0 +1 @@ +"use strict"; function interface() {}; \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0029.tree.json b/lib/test/esprima/tolerant-parse/migrated_0029.tree.json new file mode 100644 index 0000000..c35f820 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0029.tree.json @@ -0,0 +1,302 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "directive": "use strict", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "interface", + "range": [ + 23, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 35, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 14, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "EmptyStatement", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 14, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Keyword", + "value": "interface", + "range": [ + 23, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + ], + "errors": [ + { + "index": 23, + "lineNumber": 1, + "column": 24, + "message": "Error: Line 1: Use of future reserved word in strict mode" + } + ], + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0030.diff b/lib/test/esprima/tolerant-parse/migrated_0030.diff new file mode 100644 index 0000000..8d07cab --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0030.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 24 }, + "end": { "line": 1, "column": 28 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0030.js b/lib/test/esprima/tolerant-parse/migrated_0030.js new file mode 100644 index 0000000..2ed985a --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0030.js @@ -0,0 +1 @@ +"use strict"; (function eval() {}); \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0030.tree.json b/lib/test/esprima/tolerant-parse/migrated_0030.tree.json new file mode 100644 index 0000000..fe2b76b --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0030.tree.json @@ -0,0 +1,338 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "directive": "use strict", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": { + "type": "Identifier", + "name": "eval", + "range": [ + 24, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 31, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 15, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "range": [ + 14, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 15, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "eval", + "range": [ + 24, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "errors": [ + { + "index": 24, + "lineNumber": 1, + "column": 25, + "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" + } + ], + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0031.diff b/lib/test/esprima/tolerant-parse/migrated_0031.diff new file mode 100644 index 0000000..a2a4b1e --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0031.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 24 }, + "end": { "line": 1, "column": 33 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0031.js b/lib/test/esprima/tolerant-parse/migrated_0031.js new file mode 100644 index 0000000..ba211da --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0031.js @@ -0,0 +1 @@ +"use strict"; (function arguments() {}); \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0031.tree.json b/lib/test/esprima/tolerant-parse/migrated_0031.tree.json new file mode 100644 index 0000000..8547201 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0031.tree.json @@ -0,0 +1,338 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "directive": "use strict", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": { + "type": "Identifier", + "name": "arguments", + "range": [ + 24, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 36, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 15, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "range": [ + 14, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 40 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 15, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "arguments", + "range": [ + 24, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + } + ], + "errors": [ + { + "index": 24, + "lineNumber": 1, + "column": 25, + "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" + } + ], + "range": [ + 0, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0032.diff b/lib/test/esprima/tolerant-parse/migrated_0032.diff new file mode 100644 index 0000000..a2a4b1e --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0032.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 24 }, + "end": { "line": 1, "column": 33 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0032.js b/lib/test/esprima/tolerant-parse/migrated_0032.js new file mode 100644 index 0000000..ca5c859 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0032.js @@ -0,0 +1 @@ +"use strict"; (function interface() {}); \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0032.tree.json b/lib/test/esprima/tolerant-parse/migrated_0032.tree.json new file mode 100644 index 0000000..0351b61 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0032.tree.json @@ -0,0 +1,338 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "directive": "use strict", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": { + "type": "Identifier", + "name": "interface", + "range": [ + 24, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 36, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 15, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "range": [ + 14, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 40 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 15, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Keyword", + "value": "interface", + "range": [ + 24, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + } + ], + "errors": [ + { + "index": 24, + "lineNumber": 1, + "column": 25, + "message": "Error: Line 1: Use of future reserved word in strict mode" + } + ], + "range": [ + 0, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0033.diff b/lib/test/esprima/tolerant-parse/migrated_0033.diff new file mode 100644 index 0000000..fff7a11 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0033.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 25 }, + "end": { "line": 1, "column": 29 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0033.js b/lib/test/esprima/tolerant-parse/migrated_0033.js new file mode 100644 index 0000000..9b22149 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0033.js @@ -0,0 +1 @@ +"use strict"; function f(eval) {}; \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0033.tree.json b/lib/test/esprima/tolerant-parse/migrated_0033.tree.json new file mode 100644 index 0000000..690af53 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0033.tree.json @@ -0,0 +1,339 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "directive": "use strict", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "f", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "eval", + "range": [ + 25, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 31, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 14, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "EmptyStatement", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 14, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "eval", + "range": [ + 25, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "errors": [ + { + "index": 25, + "lineNumber": 1, + "column": 26, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" + } + ], + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0034.diff b/lib/test/esprima/tolerant-parse/migrated_0034.diff new file mode 100644 index 0000000..93183c2 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0034.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 25 }, + "end": { "line": 1, "column": 34 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0034.js b/lib/test/esprima/tolerant-parse/migrated_0034.js new file mode 100644 index 0000000..b16ebd0 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0034.js @@ -0,0 +1 @@ +"use strict"; function f(arguments) {}; \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0034.tree.json b/lib/test/esprima/tolerant-parse/migrated_0034.tree.json new file mode 100644 index 0000000..d86f63b --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0034.tree.json @@ -0,0 +1,339 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "directive": "use strict", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "f", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "arguments", + "range": [ + 25, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 36, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 14, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "EmptyStatement", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 14, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "arguments", + "range": [ + 25, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + } + ], + "errors": [ + { + "index": 25, + "lineNumber": 1, + "column": 26, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" + } + ], + "range": [ + 0, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0035.diff b/lib/test/esprima/tolerant-parse/migrated_0035.diff new file mode 100644 index 0000000..3e96c29 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0035.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 31 }, + "end": { "line": 1, "column": 34 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0035.js b/lib/test/esprima/tolerant-parse/migrated_0035.js new file mode 100644 index 0000000..a696b80 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0035.js @@ -0,0 +1 @@ +"use strict"; function f(foo, foo) {}; \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0035.tree.json b/lib/test/esprima/tolerant-parse/migrated_0035.tree.json new file mode 100644 index 0000000..fdc0b64 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0035.tree.json @@ -0,0 +1,393 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "directive": "use strict", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "f", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "foo", + "range": [ + 25, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Identifier", + "name": "foo", + "range": [ + 31, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 36, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 14, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "EmptyStatement", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 14, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 25, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 31, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + } + ], + "errors": [ + { + "index": 31, + "lineNumber": 1, + "column": 32, + "message": "Error: Line 1: Strict mode function may not have duplicate parameter names" + } + ], + "range": [ + 0, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0036.diff b/lib/test/esprima/tolerant-parse/migrated_0036.diff new file mode 100644 index 0000000..044ec29 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0036.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 26 }, + "end": { "line": 1, "column": 30 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0036.js b/lib/test/esprima/tolerant-parse/migrated_0036.js new file mode 100644 index 0000000..50673bb --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0036.js @@ -0,0 +1 @@ +"use strict"; (function f(eval) {}); \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0036.tree.json b/lib/test/esprima/tolerant-parse/migrated_0036.tree.json new file mode 100644 index 0000000..fb453b9 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0036.tree.json @@ -0,0 +1,375 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "directive": "use strict", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": { + "type": "Identifier", + "name": "f", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "eval", + "range": [ + 26, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 30 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 32, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 15, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 14, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 15, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "eval", + "range": [ + 26, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "errors": [ + { + "index": 26, + "lineNumber": 1, + "column": 27, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" + } + ], + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0037.diff b/lib/test/esprima/tolerant-parse/migrated_0037.diff new file mode 100644 index 0000000..2ce554d --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0037.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 26 }, + "end": { "line": 1, "column": 35 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0037.js b/lib/test/esprima/tolerant-parse/migrated_0037.js new file mode 100644 index 0000000..8592191 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0037.js @@ -0,0 +1 @@ +"use strict"; (function f(arguments) {}); \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0037.tree.json b/lib/test/esprima/tolerant-parse/migrated_0037.tree.json new file mode 100644 index 0000000..4e0f118 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0037.tree.json @@ -0,0 +1,375 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "directive": "use strict", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": { + "type": "Identifier", + "name": "f", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "arguments", + "range": [ + 26, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 37, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 15, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + "range": [ + 14, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 41 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 15, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "arguments", + "range": [ + 26, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + } + ], + "errors": [ + { + "index": 26, + "lineNumber": 1, + "column": 27, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" + } + ], + "range": [ + 0, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0038.diff b/lib/test/esprima/tolerant-parse/migrated_0038.diff new file mode 100644 index 0000000..7e8adfa --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0038.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 32 }, + "end": { "line": 1, "column": 35 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0038.js b/lib/test/esprima/tolerant-parse/migrated_0038.js new file mode 100644 index 0000000..82065bd --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0038.js @@ -0,0 +1 @@ +"use strict"; (function f(foo, foo) {}); \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0038.tree.json b/lib/test/esprima/tolerant-parse/migrated_0038.tree.json new file mode 100644 index 0000000..831dd69 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0038.tree.json @@ -0,0 +1,429 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "directive": "use strict", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": { + "type": "Identifier", + "name": "f", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "foo", + "range": [ + 26, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Identifier", + "name": "foo", + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 37, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 15, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + "range": [ + 14, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 41 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 15, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 26, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + } + ], + "errors": [ + { + "index": 32, + "lineNumber": 1, + "column": 33, + "message": "Error: Line 1: Strict mode function may not have duplicate parameter names" + } + ], + "range": [ + 0, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0039.diff b/lib/test/esprima/tolerant-parse/migrated_0039.diff new file mode 100644 index 0000000..044ec29 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0039.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 26 }, + "end": { "line": 1, "column": 30 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0039.js b/lib/test/esprima/tolerant-parse/migrated_0039.js new file mode 100644 index 0000000..be276aa --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0039.js @@ -0,0 +1 @@ +"use strict"; x = { set f(eval) {} } \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0039.tree.json b/lib/test/esprima/tolerant-parse/migrated_0039.tree.json new file mode 100644 index 0000000..35ba479 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0039.tree.json @@ -0,0 +1,470 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "directive": "use strict", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "f", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "eval", + "range": [ + 26, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 30 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 32, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 25, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "kind": "set", + "method": false, + "shorthand": false, + "range": [ + 20, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "range": [ + 18, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "range": [ + 14, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "range": [ + 14, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "set", + "range": [ + 20, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "eval", + "range": [ + 26, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "errors": [ + { + "index": 26, + "lineNumber": 1, + "column": 27, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" + } + ], + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0040.diff b/lib/test/esprima/tolerant-parse/migrated_0040.diff new file mode 100644 index 0000000..3f29190 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0040.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 19 }, + "end": { "line": 1, "column": 38 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0040.js b/lib/test/esprima/tolerant-parse/migrated_0040.js new file mode 100644 index 0000000..a7303d5 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0040.js @@ -0,0 +1 @@ +function hello() { "octal directive\1"; "use strict"; } \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0040.tree.json b/lib/test/esprima/tolerant-parse/migrated_0040.tree.json new file mode 100644 index 0000000..b5df5cf --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0040.tree.json @@ -0,0 +1,341 @@ +{ + "type": "Program", + "body": [ + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "hello", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "octal directive\u0001", + "raw": "\"octal directive\\1\"", + "range": [ + 19, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "directive": "octal directive\\1", + "range": [ + 19, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 40, + 52 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 52 + } + } + }, + "directive": "use strict", + "range": [ + 40, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 53 + } + } + } + ], + "range": [ + 17, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 55 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 0, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 55 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "hello", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "String", + "value": "\"octal directive\\1\"", + "range": [ + 19, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 40, + 52 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 52 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 52 + }, + "end": { + "line": 1, + "column": 53 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 55 + } + } + } + ], + "errors": [ + { + "index": 19, + "lineNumber": 1, + "column": 20, + "message": "Error: Line 1: Octal literals are not allowed in strict mode." + } + ], + "range": [ + 0, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 55 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0041.diff b/lib/test/esprima/tolerant-parse/migrated_0041.diff new file mode 100644 index 0000000..2491bab --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0041.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 0 }, + "end": { "line": 1, "column": 4 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0041.js b/lib/test/esprima/tolerant-parse/migrated_0041.js new file mode 100644 index 0000000..1c0d4fd --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0041.js @@ -0,0 +1 @@ +"\1"; 'use strict'; \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0041.tree.json b/lib/test/esprima/tolerant-parse/migrated_0041.tree.json new file mode 100644 index 0000000..a839d4b --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0041.tree.json @@ -0,0 +1,176 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "\u0001", + "raw": "\"\\1\"", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "directive": "\\1", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "'use strict'", + "range": [ + 6, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "directive": "use strict", + "range": [ + 6, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"\\1\"", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "String", + "value": "'use strict'", + "range": [ + 6, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "errors": [ + { + "index": 0, + "lineNumber": 1, + "column": 1, + "message": "Error: Line 1: Octal literals are not allowed in strict mode." + } + ], + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0042.diff b/lib/test/esprima/tolerant-parse/migrated_0042.diff new file mode 100644 index 0000000..ecfc67a --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0042.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 24 }, + "end": { "line": 1, "column": 27 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0042.js b/lib/test/esprima/tolerant-parse/migrated_0042.js new file mode 100644 index 0000000..04e2bef --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0042.js @@ -0,0 +1 @@ +"use strict"; var x = { 014: 3} \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0042.tree.json b/lib/test/esprima/tolerant-parse/migrated_0042.tree.json new file mode 100644 index 0000000..5431f8e --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0042.tree.json @@ -0,0 +1,380 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "directive": "use strict", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "init": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Literal", + "value": 12, + "raw": "014", + "range": [ + 24, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "computed": false, + "value": { + "type": "Literal", + "value": 3, + "raw": "3", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "range": [ + 24, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 30 + } + } + } + ], + "range": [ + 22, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "range": [ + 18, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "kind": "var", + "range": [ + 14, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Numeric", + "value": "014", + "range": [ + 24, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Numeric", + "value": "3", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "errors": [ + { + "index": 24, + "lineNumber": 1, + "column": 25, + "message": "Error: Line 1: Octal literals are not allowed in strict mode." + } + ], + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0043.diff b/lib/test/esprima/tolerant-parse/migrated_0043.diff new file mode 100644 index 0000000..38db4e6 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0043.diff @@ -0,0 +1,14 @@ +{ + "errors": { + "0": { + "message": "Setter should have exactly one parameter", + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 7 }, + "end": { "line": 1, "column": 8 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0043.js b/lib/test/esprima/tolerant-parse/migrated_0043.js new file mode 100644 index 0000000..45a8933 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0043.js @@ -0,0 +1 @@ +({ set s() { } }) \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0043.tree.json b/lib/test/esprima/tolerant-parse/migrated_0043.tree.json new file mode 100644 index 0000000..3020dd4 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0043.tree.json @@ -0,0 +1,324 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "s", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 8, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "kind": "set", + "method": false, + "shorthand": false, + "range": [ + 3, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "range": [ + 1, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "set", + "range": [ + 3, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "s", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "errors": [ + { + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Unexpected token )" + } + ], + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0044.diff b/lib/test/esprima/tolerant-parse/migrated_0044.diff new file mode 100644 index 0000000..104a801 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0044.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 0 }, + "end": { "line": 1, "column": 10 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0044.js b/lib/test/esprima/tolerant-parse/migrated_0044.js new file mode 100644 index 0000000..998fd04 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0044.js @@ -0,0 +1 @@ +foo("bar") = baz \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0044.tree.json b/lib/test/esprima/tolerant-parse/migrated_0044.tree.json new file mode 100644 index 0000000..44675a0 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0044.tree.json @@ -0,0 +1,247 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "foo", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "arguments": [ + { + "type": "Literal", + "value": "bar", + "raw": "\"bar\"", + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "right": { + "type": "Identifier", + "name": "baz", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "foo", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "String", + "value": "\"bar\"", + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "baz", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "errors": [ + { + "index": 10, + "lineNumber": 1, + "column": 11, + "message": "Error: Line 1: Invalid left-hand side in assignment" + } + ], + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0045.diff b/lib/test/esprima/tolerant-parse/migrated_0045.diff new file mode 100644 index 0000000..3c93360 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0045.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 0 }, + "end": { "line": 1, "column": 1 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0045.js b/lib/test/esprima/tolerant-parse/migrated_0045.js new file mode 100644 index 0000000..a82bea5 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0045.js @@ -0,0 +1 @@ +1 = 2 \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0045.tree.json b/lib/test/esprima/tolerant-parse/migrated_0045.tree.json new file mode 100644 index 0000000..2e41094 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0045.tree.json @@ -0,0 +1,157 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Literal", + "value": 2, + "raw": "2", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "1", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "errors": [ + { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Error: Line 1: Invalid left-hand side in assignment" + } + ], + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0046.diff b/lib/test/esprima/tolerant-parse/migrated_0046.diff new file mode 100644 index 0000000..3c93360 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0046.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 0 }, + "end": { "line": 1, "column": 1 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0046.js b/lib/test/esprima/tolerant-parse/migrated_0046.js new file mode 100644 index 0000000..ba308e8 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0046.js @@ -0,0 +1 @@ +3++ \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0046.tree.json b/lib/test/esprima/tolerant-parse/migrated_0046.tree.json new file mode 100644 index 0000000..6bbeec7 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0046.tree.json @@ -0,0 +1,121 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "++", + "argument": { + "type": "Literal", + "value": 3, + "raw": "3", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "prefix": false, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "3", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "++", + "range": [ + 1, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "errors": [ + { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Error: Line 1: Invalid left-hand side in assignment" + } + ], + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0047.diff b/lib/test/esprima/tolerant-parse/migrated_0047.diff new file mode 100644 index 0000000..f7acb6b --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0047.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 2 }, + "end": { "line": 1, "column": 3 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0047.js b/lib/test/esprima/tolerant-parse/migrated_0047.js new file mode 100644 index 0000000..e9f4a69 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0047.js @@ -0,0 +1 @@ +--4 \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0047.tree.json b/lib/test/esprima/tolerant-parse/migrated_0047.tree.json new file mode 100644 index 0000000..efc71d0 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0047.tree.json @@ -0,0 +1,121 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "--", + "argument": { + "type": "Literal", + "value": 4, + "raw": "4", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "prefix": true, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "--", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Numeric", + "value": "4", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "errors": [ + { + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Invalid left-hand side in assignment" + } + ], + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0048.diff b/lib/test/esprima/tolerant-parse/migrated_0048.diff new file mode 100644 index 0000000..9582303 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0048.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 5 }, + "end": { "line": 1, "column": 6 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0048.js b/lib/test/esprima/tolerant-parse/migrated_0048.js new file mode 100644 index 0000000..7488b92 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0048.js @@ -0,0 +1 @@ +for (5 in []) {} \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0048.tree.json b/lib/test/esprima/tolerant-parse/migrated_0048.tree.json new file mode 100644 index 0000000..60ec657 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0048.tree.json @@ -0,0 +1,265 @@ +{ + "type": "Program", + "body": [ + { + "type": "ForInStatement", + "left": { + "type": "Literal", + "value": 5, + "raw": "5", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [], + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "each": false, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Numeric", + "value": "5", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "in", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "errors": [ + { + "index": 6, + "lineNumber": 1, + "column": 7, + "message": "Error: Line 1: Invalid left-hand side in for-in" + } + ], + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0049.js b/lib/test/esprima/tolerant-parse/migrated_0049.js new file mode 100644 index 0000000..2f21fd3 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0049.js @@ -0,0 +1 @@ +var x = /[P QR]/\g \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0049.skip b/lib/test/esprima/tolerant-parse/migrated_0049.skip new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0049.skip @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/tolerant-parse/migrated_0049.tree.json b/lib/test/esprima/tolerant-parse/migrated_0049.tree.json new file mode 100644 index 0000000..bf9d862 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0049.tree.json @@ -0,0 +1,184 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "Literal", + "value": {}, + "raw": "/[P QR]/\\g", + "regex": { + "pattern": "[P QR]", + "flags": "g" + }, + "range": [ + 8, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 4, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "RegularExpression", + "value": "/[P QR]/\\g", + "regex": { + "pattern": "[P QR]", + "flags": "g" + }, + "range": [ + 8, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "errors": [ + { + "index": 17, + "lineNumber": 1, + "column": 18, + "message": "Error: Line 1: Unexpected token ILLEGAL" + } + ], + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0050.source.js b/lib/test/esprima/tolerant-parse/migrated_0050.source.js new file mode 100644 index 0000000..803b823 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0050.source.js @@ -0,0 +1 @@ +var source = 'var x = /[P QR]/\\\\u0067'; \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0050.tree.json b/lib/test/esprima/tolerant-parse/migrated_0050.tree.json new file mode 100644 index 0000000..4c5c470 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0050.tree.json @@ -0,0 +1,190 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "Literal", + "value": {}, + "raw": "/[P QR]/\\\\u0067", + "regex": { + "pattern": "[P QR]", + "flags": "g" + }, + "range": [ + 8, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "range": [ + 4, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "RegularExpression", + "value": "/[P QR]/\\\\u0067", + "regex": { + "pattern": "[P QR]", + "flags": "g" + }, + "range": [ + 8, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "errors": [ + { + "index": 17, + "lineNumber": 1, + "column": 18, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + { + "index": 23, + "lineNumber": 1, + "column": 24, + "message": "Error: Line 1: Unexpected token ILLEGAL" + } + ], + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0051.diff b/lib/test/esprima/tolerant-parse/migrated_0051.diff new file mode 100644 index 0000000..737fe4d --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0051.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 4 }, + "end": { "line": 1, "column": 8 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0051.js b/lib/test/esprima/tolerant-parse/migrated_0051.js new file mode 100644 index 0000000..9ab0e62 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0051.js @@ -0,0 +1 @@ +({x(eval){"use strict";}}) \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0051.tree.json b/lib/test/esprima/tolerant-parse/migrated_0051.tree.json new file mode 100644 index 0000000..e09369f --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0051.tree.json @@ -0,0 +1,417 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "x", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "eval", + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 10, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "directive": "use strict", + "range": [ + 10, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 9, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 3, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "kind": "init", + "method": true, + "shorthand": false, + "range": [ + 2, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "range": [ + 1, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "eval", + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 10, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "errors": [ + { + "index": 4, + "lineNumber": 1, + "column": 5, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" + } + ], + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0052.diff b/lib/test/esprima/tolerant-parse/migrated_0052.diff new file mode 100644 index 0000000..737fe4d --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0052.diff @@ -0,0 +1,13 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 1, "column": 4 }, + "end": { "line": 1, "column": 8 } + } + } + } +} diff --git a/lib/test/esprima/tolerant-parse/migrated_0052.js b/lib/test/esprima/tolerant-parse/migrated_0052.js new file mode 100644 index 0000000..c37b96c --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0052.js @@ -0,0 +1 @@ +({x(eval){"use strict"}}) \ No newline at end of file diff --git a/lib/test/esprima/tolerant-parse/migrated_0052.tree.json b/lib/test/esprima/tolerant-parse/migrated_0052.tree.json new file mode 100644 index 0000000..a15c8e4 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/migrated_0052.tree.json @@ -0,0 +1,399 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "x", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "eval", + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 10, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "directive": "use strict", + "range": [ + 10, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "range": [ + 9, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 3, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "kind": "init", + "method": true, + "shorthand": false, + "range": [ + 2, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 1, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "eval", + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 10, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "errors": [ + { + "index": 4, + "lineNumber": 1, + "column": 5, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" + } + ], + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/string_literal_escape_eight.js b/lib/test/esprima/tolerant-parse/string_literal_escape_eight.js new file mode 100644 index 0000000..1a52ce1 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/string_literal_escape_eight.js @@ -0,0 +1 @@ +var x = 'abc\8'; diff --git a/lib/test/esprima/tolerant-parse/string_literal_escape_eight.skip b/lib/test/esprima/tolerant-parse/string_literal_escape_eight.skip new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/string_literal_escape_eight.skip @@ -0,0 +1 @@ + diff --git a/lib/test/esprima/tolerant-parse/string_literal_escape_eight.tree.json b/lib/test/esprima/tolerant-parse/string_literal_escape_eight.tree.json new file mode 100644 index 0000000..5fc72e3 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/string_literal_escape_eight.tree.json @@ -0,0 +1,194 @@ +{ + "type": "Program", + "body": [ + { + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "type": "Identifier", + "name": "x" + }, + "init": { + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "type": "Literal", + "value": "abc8", + "raw": "'abc\\8'" + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "String", + "value": "'abc\\8'", + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "errors": [ + { + "index": 14, + "lineNumber": 1, + "column": 15, + "message": "Error: Line 1: Unexpected token ILLEGAL" + } + ], + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } +} diff --git a/lib/test/esprima/tolerant-parse/while-missing-parenthesis.diff b/lib/test/esprima/tolerant-parse/while-missing-parenthesis.diff new file mode 100644 index 0000000..50cb11e --- /dev/null +++ b/lib/test/esprima/tolerant-parse/while-missing-parenthesis.diff @@ -0,0 +1,21 @@ +{ + "errors": { + "0": { + "lineNumber": undefined, + "index": undefined, + "column": undefined, + "loc": { + "start": { "line": 2, "column": 0 }, + "end": { "line": 2, "column": 0 } + }, + "message":"Unexpected end of input, expected the token `)`" + }, + "1": { + "loc": { + "start": { "line": 2, "column": 0 }, + "end": { "line": 2, "column": 0 } + }, + "message":"Unexpected end of input, expected the start of a statement" + } + } +} diff --git a/lib/test/esprima/tolerant-parse/while-missing-parenthesis.js b/lib/test/esprima/tolerant-parse/while-missing-parenthesis.js new file mode 100644 index 0000000..4975c02 --- /dev/null +++ b/lib/test/esprima/tolerant-parse/while-missing-parenthesis.js @@ -0,0 +1 @@ +while (true diff --git a/lib/test/esprima/tolerant-parse/while-missing-parenthesis.tree.json b/lib/test/esprima/tolerant-parse/while-missing-parenthesis.tree.json new file mode 100644 index 0000000..30e068e --- /dev/null +++ b/lib/test/esprima/tolerant-parse/while-missing-parenthesis.tree.json @@ -0,0 +1,137 @@ +{ + "type": "Program", + "body": [ + { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "body": { + "range": [ + 13, + 13 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 0 + } + }, + "type": "EmptyStatement" + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 0 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 0 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "while", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "errors": [ + { + "index": 13, + "lineNumber": 2, + "column": 1, + "message": "Error: Line 2: Unexpected end of input" + } + ] +} diff --git a/lib/test/esprima/whitespace/migrated_0000.source.js b/lib/test/esprima/whitespace/migrated_0000.source.js new file mode 100644 index 0000000..a7030d2 --- /dev/null +++ b/lib/test/esprima/whitespace/migrated_0000.source.js @@ -0,0 +1 @@ +var source = 'new\x20\x09\x0B\x0C\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\uFEFFa'; diff --git a/lib/test/esprima/whitespace/migrated_0000.tree.json b/lib/test/esprima/whitespace/migrated_0000.tree.json new file mode 100644 index 0000000..be26a6e --- /dev/null +++ b/lib/test/esprima/whitespace/migrated_0000.tree.json @@ -0,0 +1,111 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "a", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "arguments": [], + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "new", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } +} diff --git a/lib/test/esprima/whitespace/migrated_0001.source.js b/lib/test/esprima/whitespace/migrated_0001.source.js new file mode 100644 index 0000000..f025d60 --- /dev/null +++ b/lib/test/esprima/whitespace/migrated_0001.source.js @@ -0,0 +1 @@ +var source = '{0\x0A1\x0D2\u20283\u20294}'; \ No newline at end of file diff --git a/lib/test/esprima/whitespace/migrated_0001.tree.json b/lib/test/esprima/whitespace/migrated_0001.tree.json new file mode 100644 index 0000000..4e36d6f --- /dev/null +++ b/lib/test/esprima/whitespace/migrated_0001.tree.json @@ -0,0 +1,347 @@ +{ + "type": "Program", + "body": [ + { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 2, + "raw": "2", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 3, + "raw": "3", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 4, + "raw": "4", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + } + ], + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "{", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + { + "type": "Numeric", + "value": "3", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + { + "type": "Numeric", + "value": "4", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 2 + } + } + } + ], + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + } +} diff --git a/lib/test/esprima_tests.js b/lib/test/esprima_tests.js new file mode 100644 index 0000000..286653f --- /dev/null +++ b/lib/test/esprima_tests.js @@ -0,0 +1,3329 @@ +module.exports = { + todo: { + 'ES6: Destructured Parameters': true, + 'Harmony Invalid syntax': true, + }, + sections: { + 'Function Expression': [ + '(function(){}())', + 'var x = function(){}.bind(this)', + ], + + 'Invalid syntax': [ + { + content: '{', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected end of input', + actual: 'Unexpected end of input, expected the token `}`' + } + } + }, + { + content: '}', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token }', + actual: 'Unexpected token `}`, expected the start of a statement' + } + } + }, + '3ea', + '3in []', + '3e', + { + content: '3e+', + explanation: "Esprima counts comments in its loc, Flow doesn't", + expected_differences: { + 'root.errors.0.column': { + type: 'Wrong error column', + expected: 3, + actual: '0-2' + }, + } + }, + { + content: '3e-', + explanation: "Esprima counts comments in its loc, Flow doesn't", + expected_differences: { + 'root.errors.0.column': { + type: 'Wrong error column', + expected: 3, + actual: '0-2' + }, + } + }, + '3x', + '3x0', + '0x', + { + content: '09', + explanation: "Spec doesn't support this but every implementation does", + expected_differences: { + 'root.errors': { + type: 'Flow found no error', + expected: 'Line 1: Unexpected token ILLEGAL', + actual: undefined + }, + } + }, + '01a', + '3in[]', + '0x3in[]', + '"Hello\nWorld"', + 'x\\', + 'var x = /(s/g', + '/', + '/test', + '/test\n/', + /* TODO uncomment when esprima is fixed + * https://code.google.com/p/esprima/issues/detail?id=604 + { + content: 'var x = /[a-z]/\\ux', + explanation: "10.8.5.1 disallows unicode escape flags", + expected_differences: { + 'root.errors.0.column': { + type: 'Wrong error column', + expected: 18, + actual: '15-16' + }, + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Invalid regular expression', + actual: 'Unexpected token ILLEGAL' + }, + } + }, + { + content: 'var x = /[a-z]/\\\\ux', + explanation: "10.8.5.1 disallows unicode escape flags", + expected_differences: { + 'root.errors.0.column': { + type: 'Wrong error column', + expected: 19, + actual: '15-16' + }, + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Invalid regular expression', + actual: 'Unexpected token ILLEGAL' + }, + } + }, + */ + '3 = 4', + 'func() = 4', + { + content: '(1 + 1) = 10', + explanation: "Esprima counts parens in its loc, Flow doesn't", + expected_differences: { + 'root.errors.0.column': { + type: 'Wrong error column', + expected: 7, + actual: '1-6' + }, + } + }, + '"\\u{110000}"', + { + content: '"\\u{}"', + explanation: "Flow's lexer complains at the beginning of a bad escape", + expected_differences: { + 'root.errors.0.column': { + type: 'Wrong error column', + expected: 4, + actual: '2-3' + }, + } + }, + { + content: '"\\u{FFFF"', + explanation: "Flow's lexer complains at the beginning of a bad escape", + expected_differences: { + 'root.errors.0.column': { + type: 'Wrong error column', + expected: 9, + actual: '2-3' + }, + } + }, + { + content: '"\\u{FFZ}"', + explanation: "Flow's lexer complains at the beginning of a bad escape", + expected_differences: { + 'root.errors.0.column': { + type: 'Wrong error column', + expected: 7, + actual: '2-3' + }, + } + }, + 'x\\', + '1++', + '1--', + '++1', + '--1', + { + content: 'for((1 + 1) in list) process(x);', + explanation: "Esprima counts comments in its loc, Flow doesn't", + expected_differences: { + 'root.errors.0.column': { + type: 'Wrong error column', + expected: 11, + actual: '5-10' + }, + } + }, + { + content: '[', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected end of input', + actual: 'Unexpected end of input, expected the token `]`' + } + } + }, + { + content: '[,', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected end of input', + actual: 'Unexpected end of input, expected the token `]`' + } + } + }, + { + content: '1 + {', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected end of input', + actual: 'Unexpected end of input, expected the token `}`' + } + } + }, + { + content: '1 + { t:t ', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected end of input', + actual: 'Unexpected end of input, expected the token `}`' + } + } + }, + { + content: '1 + { t:t,', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected end of input', + actual: 'Unexpected end of input, expected the token `}`' + } + } + }, + 'var x = /\n/', + 'var x = "\n', + { + content: 'var if = 42', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token if', + actual: 'Unexpected token `if`' + } + } + }, + { + content: 'i #= 42', + explanation: "# is no longer illegal in Flow, since we support private class fields. " + + "Instead, it is unexpected since we are not parsing a member expression " + + "or class property.", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token ILLEGAL', + actual: 'Unexpected token `#`, expected the end of an expression statement (`;`)' + }, + } + }, + 'i + 2 = 42', + '+i = 42', + '1 + (', + { + content: '\n\n\n{', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected end of input', + actual: 'Unexpected end of input, expected the token `}`' + } + } + }, + { + content: '\n/* Some multiline\ncomment */\n)', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token )', + actual: 'Unexpected token `)`, expected the start of a statement' + } + } + }, + { + content: '{ set 1 }', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected number', + actual: 'Unexpected number, expected the end of an expression statement (`;`)' + } + } + }, + { + content: '{ get 2 }', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected number', + actual: 'Unexpected number, expected the end of an expression statement (`;`)' + } + } + }, + { + content: '({ set: s(if) { } })', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token if', + actual: 'Unexpected token `if`' + } + } + }, + { + content: '({ set s(.) { } })', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token .', + actual: 'Unexpected token `.`, expected an identifier' + } + } + }, + { + content: '({ set s() { } })', + explanation: "Esprima error isn't great", + expected_differences: { + 'root.errors.0.column': { + type: 'Wrong error column', + expected: 9, + actual: '7-8' + }, + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token )', + actual: 'Setter should have exactly one parameter' + } + } + }, + { + content: '({ set: s() { } })', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token {', + actual: 'Unexpected token `{`, expected the token `,`' + } + } + }, + { + content: '({ set: s(a, b) { } })', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token {', + actual: 'Unexpected token `{`, expected the token `,`' + } + } + }, + { + content: '({ get: g(d) { } })', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token {', + actual: 'Unexpected token `{`, expected the token `,`' + } + } + }, + { + content: '({ get i() { }, i: 42 })', + explanation: 'Esprima-fb is wrong, ES6 allows duplicates', + expected_differences: { + 'root.errors': { + type: 'Flow found no error', + expected: 'Line 1: Object literal may not have data and accessor property with the same name', + actual: undefined, + } + } + }, + { + content: '({ i: 42, get i() { } })', + explanation: 'Esprima-fb is wrong, ES6 allows duplicates', + expected_differences: { + 'root.errors': { + type: 'Flow found no error', + expected: 'Line 1: Object literal may not have data and accessor property with the same name', + actual: undefined, + } + } + }, + { + content: '({ set i(x) { }, i: 42 })', + explanation: 'Esprima-fb is wrong, ES6 allows duplicates', + expected_differences: { + 'root.errors': { + type: 'Flow found no error', + expected: 'Line 1: Object literal may not have data and accessor property with the same name', + actual: undefined, + } + } + }, + { + content: '({ i: 42, set i(x) { } })', + explanation: 'Esprima-fb is wrong, ES6 allows duplicates', + expected_differences: { + 'root.errors': { + type: 'Flow found no error', + expected: 'Line 1: Object literal may not have data and accessor property with the same name', + actual: undefined, + } + } + }, + { + content: '({ get i() { }, get i() { } })', + explanation: 'Esprima-fb is wrong, ES6 allows duplicates', + expected_differences: { + 'root.errors': { + type: 'Flow found no error', + expected: 'Line 1: Object literal may not have multiple get/set accessors with the same name', + actual: undefined, + } + } + }, + { + content: '({ set i(x) { }, set i(x) { } })', + explanation: 'Esprima-fb is wrong, ES6 allows duplicates', + expected_differences: { + 'root.errors': { + type: 'Flow found no error', + expected: 'Line 1: Object literal may not have multiple get/set accessors with the same name', + actual: undefined, + } + } + }, + { + content: '((a)) => 42', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token =>', + actual: 'Unexpected token `=>`, expected the end of an expression statement (`;`)' + } + } + }, + { + content: '(a, (b)) => 42', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token =>', + actual: 'Unexpected token `=>`, expected the end of an expression statement (`;`)' + } + } + }, + { + content: '"use strict"; (eval = 10) => 42', + explanation: "This is an arrow function error, not an assignment "+ + "error", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Assignment to eval or arguments is not allowed in strict mode', + actual: 'Parameter name eval or arguments is not allowed in strict mode', + }, + }, + }, + // strict mode, using eval when IsSimpleParameterList is true + { + content: '"use strict"; eval => 42', + explanation: "Esprima error loc is crazy here", + expected_differences: { + 'root.errors.0.column': { + type: 'Wrong error column', + expected: 24, + actual: '14-18' + }, + } + }, + // strict mode, using arguments when IsSimpleParameterList is true + { + content: '"use strict"; arguments => 42', + explanation: "Esprima doesn't point to the bad argument", + expected_differences: { + 'root.errors.0.column': { + type: 'Wrong error column', + expected: 29, + actual: '14-23' + }, + } + }, + // strict mode, using eval when IsSimpleParameterList is true + { + content: '"use strict"; (eval, a) => 42', + explanation: "Esprima error loc is crazy here", + expected_differences: { + 'root.errors.0.column': { + type: 'Wrong error column', + expected: 29, + actual: '15-19' + }, + } + }, + // strict mode, using arguments when IsSimpleParameterList is true + { + content: '"use strict"; (arguments, a) => 42', + explanation: "Esprima doesn't point to the bad argument", + expected_differences: { + 'root.errors.0.column': { + type: 'Wrong error column', + expected: 34, + actual: '15-24' + }, + } + }, + { + content: '"use strict"; (a, a) => 42', + explanation: "Esprima counts parens in its loc, Flow doesn't", + expected_differences: { + 'root.errors.0.column': { + type: 'Wrong error column', + expected: 20, + actual: '18-19' + }, + } + }, + '"use strict"; (a) => 00', + { + content: '() <= 42', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token <=', + actual: 'Unexpected token `<=`, expected the token `=>`' + } + } + }, + { + content: '() ? 42', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token ?', + actual: 'Unexpected token `?`, expected the token `=>`' + } + } + }, + { + content: '() + 42', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token +', + actual: 'Unexpected token `+`, expected the token `=>`' + } + } + }, + { + content: '(...x) + 42', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token +', + actual: 'Unexpected token `+`, expected the token `=>`' + } + } + }, + { + content: '()++', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token ++', + actual: 'Unexpected token `++`, expected the token `=>`' + } + } + }, + { + content: '()()', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token (', + actual: 'Unexpected token `(`, expected the token `=>`' + } + } + }, + { + content: '(10) => 00', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token =>', + actual: 'Unexpected token `=>`, expected the end of an expression statement (`;`)' + } + } + }, + { + content: '(10, 20) => 00', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token =>', + actual: 'Unexpected token `=>`, expected the end of an expression statement (`;`)' + } + } + }, + { + content: '"use strict"; (eval) => 42', + explanation: "Esprima error loc is crazy here", + expected_differences: { + 'root.errors.0.column': { + type: 'Wrong error column', + expected: 26, + actual: '15-19' + }, + } + }, + { + content: '(eval) => { "use strict"; 42 }', + explanation: "Esprima error loc is crazy here", + expected_differences: { + 'root.errors.0.column': { + type: 'Wrong error column', + expected: 30, + actual: '1-5' + }, + } + }, + { + content: 'function t(if) { }', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token if', + actual: 'Unexpected token `if`' + } + } + }, + { + content: 'function t(true) { }', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token true', + actual: 'Unexpected token `true`' + } + } + }, + { + content: 'function t(false) { }', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token false', + actual: 'Unexpected token `false`' + } + } + }, + { + content: 'function t(null) { }', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token null', + actual: 'Unexpected token `null`' + } + } + }, + { + content: 'function null() { }', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token null', + actual: 'Unexpected token `null`' + } + } + }, + { + content: 'function true() { }', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token true', + actual: 'Unexpected token `true`' + } + } + }, + { + content: 'function false() { }', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token false', + actual: 'Unexpected token `false`' + } + } + }, + { + content: 'function if() { }', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token if', + actual: 'Unexpected token `if`' + } + } + }, + { + content: 'a b;', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected identifier', + actual: 'Unexpected identifier, expected the end of an expression statement (`;`)' + } + } + }, + { + content: 'if.a;', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token .', + actual: 'Unexpected token `.`, expected the token `(`' + } + } + }, + { + content: 'a if;', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token if', + actual: 'Unexpected token `if`, expected the end of an expression statement (`;`)' + } + } + }, + { + content: 'a class;', + explanation: 'class is no longer a future reserved word', + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected reserved word', + actual: 'Unexpected token `class`, expected the end of an expression statement (`;`)', + }, + }, + }, + 'break\n', + { + content: 'break 1;', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected number', + actual: 'Unexpected number, expected an identifier' + } + } + }, + 'continue\n', + { + content: 'continue 2;', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected number', + actual: 'Unexpected number, expected an identifier' + } + } + }, + 'throw', + { + content: 'throw;', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token ;', + actual: 'Unexpected token `;`' + } + } + }, + 'throw\n', + { + content: 'for (var i, i2 in {});', + explanation: "Esprima counts comments in its loc, Flow doesn't", + expected_differences: { + 'root.errors.0.column': { + type: 'Wrong error column', + expected: 15, + actual: '5-14' + }, + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token in', + actual: 'Invalid left-hand side in for-in' + }, + } + }, + { + content: 'for ((i in {}));', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token )', + actual: 'Unexpected token `)`, expected the token `;`' + } + } + }, + 'for (i + 1 in {});', + 'for (+i in {});', + { + content: 'if(false)', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected end of input', + actual: 'Unexpected end of input, expected the start of a statement' + } + } + }, + { + content: 'if(false) doThis(); else', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected end of input', + actual: 'Unexpected end of input, expected the start of a statement' + } + } + }, + { + content: 'do', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected end of input', + actual: 'Unexpected end of input, expected the start of a statement' + } + } + }, + { + content: 'while(false)', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected end of input', + actual: 'Unexpected end of input, expected the start of a statement' + } + } + }, + { + content: 'for(;;)', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected end of input', + actual: 'Unexpected end of input, expected the start of a statement' + } + } + }, + { + content: 'with(x)', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected end of input', + actual: 'Unexpected end of input, expected the start of a statement' + } + } + }, + 'try { }', + + 'const x = 12, y;', + 'const x, y = 12;', + 'const x;', + { + content: 'if(true) let a = 1;', + explanation: "The let keyword is parsed as an identifer. " + + "It's the a that causes the error", + expected_differences: { + 'root.errors.0.column': { + type: 'Wrong error column', + expected: 9, + actual: '13-14' + }, + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token let', + actual: 'Unexpected identifier, expected the end of an expression statement (`;`)', + }, + } + }, + { + content: 'if(true) const a = 1;', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token const', + actual: 'Unexpected token `const`' + } + } + }, + { + content: 'switch (c) { default: default: }', + explanation: "Esprima points after the duplicate default", + expected_differences: { + 'root.errors.0.column': { + type: 'Wrong error column', + expected: 30, + actual: '22-29' + }, + } + }, + { + content: 'new X()."s"', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected string', + actual: 'Unexpected string, expected an identifier' + } + } + }, + '/*', + '/*\n\n\n', + '/**', + '/*\n\n*', + '/*hello', + '/*hello *', + { + content: '\n]', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token ]', + actual: 'Unexpected token `]`, expected the start of a statement' + } + } + }, + { + content: '\r]', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token ]', + actual: 'Unexpected token `]`, expected the start of a statement' + } + } + }, + { + content: '\r\n]', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token ]', + actual: 'Unexpected token `]`, expected the start of a statement' + } + } + }, + { + content: '\n\r]', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token ]', + actual: 'Unexpected token `]`, expected the start of a statement' + } + } + }, + { + content: '//\r\n]', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token ]', + actual: 'Unexpected token `]`, expected the start of a statement' + } + } + }, + { + content: '//\n\r]', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token ]', + actual: 'Unexpected token `]`, expected the start of a statement' + } + } + }, + '/a\\\n/', + { + content: '//\r \n]', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token ]', + actual: 'Unexpected token `]`, expected the start of a statement' + } + } + }, + { + content: '/*\r\n*/]', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token ]', + actual: 'Unexpected token `]`, expected the start of a statement' + } + } + }, + { + content: '/*\n\r*/]', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token ]', + actual: 'Unexpected token `]`, expected the start of a statement' + } + } + }, + { + content: '/*\r \n*/]', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token ]', + actual: 'Unexpected token `]`, expected the start of a statement' + } + } + }, + '\\\\', + '\\x', + { + content: '"\\', + explanation: "Esprima has a non-existent location for the eof", + expected_differences: { + 'root.errors.0.column': { + type: 'Wrong error column', + expected: 3, + actual: '2-2' + }, + } + }, + '"\\u', + { + content: 'try { } catch() {}', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token )', + actual: 'Unexpected token `)`, expected an identifier' + } + } + }, + 'return', + 'break', + 'continue', + 'switch (x) { default: continue; }', + { + content: 'do { x } *', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token *', + actual: 'Unexpected token `*`, expected the token `while`' + } + } + }, + 'while (true) { break x; }', + 'while (true) { continue x; }', + 'x: while (true) { (function () { break x; }); }', + 'x: while (true) { (function () { continue x; }); }', + 'x: while (true) { (function () { break; }); }', + 'x: while (true) { (function () { continue; }); }', + { + content: 'x: while (true) { x: while (true) { } }', + explanation: "Esprima points to the location after the second colon", + expected_differences: { + 'root.errors.0.column': { + type: 'Wrong error column', + expected: 20, + actual: '18-19' + }, + } + }, + '(function () { \'use strict\'; delete i; }())', + '(function () { \'use strict\'; with (i); }())', + { + content: 'function hello() {\'use strict\'; ({ i: 42, i: 42 }) }', + explanation: 'Esprima-fb is wrong, ES6 allows duplicates', + expected_differences: { + 'root.errors': { + type: 'Flow found no error', + expected: 'Line 1: Duplicate data property in object literal not allowed in strict mode', + actual: undefined, + } + } + }, + { + content: 'function hello() {\'use strict\'; ({ hasOwnProperty: 42, hasOwnProperty: 42 }) }', + explanation: 'Esprima-fb is wrong, ES6 allows duplicates', + expected_differences: { + 'root.errors': { + type: 'Flow found no error', + expected: 'Line 1: Duplicate data property in object literal not allowed in strict mode', + actual: undefined, + } + } + }, + 'function hello() {\'use strict\'; var eval = 10; }', + 'function hello() {\'use strict\'; var arguments = 10; }', + 'function hello() {\'use strict\'; try { } catch (eval) { } }', + 'function hello() {\'use strict\'; try { } catch (arguments) { } }', + 'function hello() {\'use strict\'; eval = 10; }', + 'function hello() {\'use strict\'; arguments = 10; }', + 'function hello() {\'use strict\'; ++eval; }', + 'function hello() {\'use strict\'; --eval; }', + 'function hello() {\'use strict\'; ++arguments; }', + 'function hello() {\'use strict\'; --arguments; }', + 'function hello() {\'use strict\'; eval++; }', + 'function hello() {\'use strict\'; eval--; }', + 'function hello() {\'use strict\'; arguments++; }', + 'function hello() {\'use strict\'; arguments--; }', + 'function hello() {\'use strict\'; function eval() { } }', + 'function hello() {\'use strict\'; function arguments() { } }', + 'function eval() {\'use strict\'; }', + 'function arguments() {\'use strict\'; }', + 'function hello() {\'use strict\'; (function eval() { }()) }', + 'function hello() {\'use strict\'; (function arguments() { }()) }', + '(function eval() {\'use strict\'; })()', + '(function arguments() {\'use strict\'; })()', + 'function hello() {\'use strict\'; ({ s: function eval() { } }); }', + '(function package() {\'use strict\'; })()', + 'function hello() {\'use strict\'; ({ i: 10, set s(eval) { } }); }', + 'function hello() {\'use strict\'; ({ set s(eval) { } }); }', + 'function hello() {\'use strict\'; ({ s: function s(eval) { } }); }', + 'function hello(eval) {\'use strict\';}', + 'function hello(arguments) {\'use strict\';}', + 'function hello() { \'use strict\'; function inner(eval) {} }', + 'function hello() { \'use strict\'; function inner(arguments) {} }', + ' "\\1"; \'use strict\';', + 'function hello() { \'use strict\'; "\\1"; }', + 'function hello() { \'use strict\'; 021; }', + 'function hello() { \'use strict\'; ({ "\\1": 42 }); }', + 'function hello() { \'use strict\'; ({ 021: 42 }); }', + 'function hello() { "octal directive\\1"; "use strict"; }', + 'function hello() { "octal directive\\1"; "octal directive\\2"; "use strict"; }', + 'function hello() { "use strict"; function inner() { "octal directive\\1"; } }', + 'function hello() { "use strict"; var implements; }', + 'function hello() { "use strict"; var interface; }', + 'function hello() { "use strict"; var package; }', + 'function hello() { "use strict"; var private; }', + 'function hello() { "use strict"; var protected; }', + 'function hello() { "use strict"; var public; }', + 'function hello() { "use strict"; var static; }', + 'function hello() { "use strict"; var yield; }', + 'function hello() { "use strict"; var let; }', + 'function hello(static) { "use strict"; }', + 'function static() { "use strict"; }', + 'function eval(a) { "use strict"; }', + 'function arguments(a) { "use strict"; }', + 'var yield', + { + content: 'var let', + explanation: "Bug in esprima. This should be allowed", + expected_differences: { + 'root.errors': { + type: 'Flow found no error', + expected: 'Line 1: Unexpected token let', + actual: undefined + }, + } + }, + '"use strict"; function static() { }', + 'function a(t, t) { "use strict"; }', + 'function a(eval) { "use strict"; }', + 'function a(package) { "use strict"; }', + 'function a() { "use strict"; function b(t, t) { }; }', + '(function a(t, t) { "use strict"; })', + 'function a() { "use strict"; (function b(t, t) { }); }', + // Duplicates are forbidden if IsSimpleParameterList is false, and rest + // params, patterns, and defaults all make the params non-simple + { + content: '(t, t, ...rest) => 42', + explanation: "Esprima points to the end of the params not to the "+ + "bad param itself", + expected_differences: { + 'root.errors.0.column': { + type: 'Wrong error column', + expected: 15, + actual: '4-5' + }, + } + }, + { + content: '(t, t, [b]) => 42', + explanation: "Esprima points to the end of the params not to the "+ + "bad param itself", + expected_differences: { + 'root.errors.0.column': { + type: 'Wrong error column', + expected: 11, + actual: '4-5' + }, + } + }, + { + content: '(t, t, {b}) => 42', + explanation: "Esprima points to the end of the params not to the "+ + "bad param itself", + expected_differences: { + 'root.errors.0.column': { + type: 'Wrong error column', + expected: 11, + actual: '4-5' + }, + } + }, + { + content: '(t, t, b=1) => 42', + explanation: "Esprima points to the end of the params not to the "+ + "bad param itself", + expected_differences: { + 'root.errors.0.column': { + type: 'Wrong error column', + expected: 11, + actual: '4-5' + }, + } + }, + '(function a(eval) { "use strict"; })', + '(function a(package) { "use strict"; })', + { + content: '__proto__: __proto__: 42;', + explanation: "Esprima points to the location after the second colon", + expected_differences: { + 'root.errors.0.column': { + type: 'Wrong error column', + expected: 21, + actual: '11-20' + }, + } + }, + '"use strict"; function t(__proto__, __proto__) { }', + { + content: '"use strict"; x = { __proto__: 42, __proto__: 43 }', + explanation: 'Esprima-fb is wrong, ES6 allows duplicates', + expected_differences: { + 'root.errors': { + type: 'Flow found no error', + expected: 'Line 1: Duplicate data property in object literal not allowed in strict mode', + actual: undefined, + } + } + }, + { + content: '"use strict"; x = { get __proto__() { }, __proto__: 43 }', + explanation: 'Esprima-fb is wrong, ES6 allows duplicates', + expected_differences: { + 'root.errors': { + type: 'Flow found no error', + expected: 'Line 1: Object literal may not have data and accessor property with the same name', + actual: undefined, + } + } + }, + { + content: 'var', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected end of input', + actual: 'Unexpected end of input, expected an identifier' + } + } + }, + { + content: 'let', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected end of input', + actual: 'Unexpected end of input, expected an identifier' + } + } + }, + { + content: 'const', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected end of input', + actual: 'Unexpected end of input, expected an identifier' + } + } + }, + { + content: '{ ; ; ', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected end of input', + actual: 'Unexpected end of input, expected the token `}`' + } + } + }, + { + content: 'function t() { ; ; ', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected end of input', + actual: 'Unexpected end of input, expected the token `}`' + } + } + }, + { + content: 'let let', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token let', + actual: 'Unexpected token `let`' + } + } + }, + { + content: 'const let=4', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token let', + actual: 'Unexpected token `let`' + } + } + }, + { + content: 'for (let let=4;;) {}', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token let', + actual: 'Unexpected token `let`' + } + } + }, + { + content: 'for (let in arr) {}', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token in', + actual: 'Unexpected token `in`' + } + } + }, + { + content: 'for (let let in arr) {}', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token let', + actual: 'Unexpected token `let`' + } + } + }, + { + content: 'class let { }', + explanation: "Esprima counts comments in its loc, Flow doesn't", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token let', + actual: 'Use of future reserved word in strict mode' + }, + } + }, + 'class A { foo() { let let } }', + { + content: 'function foo([a.a]) {}', + explanation: 'Esprima is off by one, flow fails to parse it', + expected_differences: { + 'root.errors.0.column': { + type: 'Wrong error column', + expected: 18, + actual: '15-16' + }, + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Invalid left-hand side in formals list', + actual: 'Unexpected token `.`, expected the token `,`', + } + }, + }, + { + content: 'var f = function ([a.a]) {}', + explanation: 'Esprima is off by one, flow fails to parse it', + expected_differences: { + 'root.errors.0.column': { + type: 'Wrong error column', + expected: 23, + actual: '20-21' + }, + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Invalid left-hand side in formals list', + actual: 'Unexpected token `.`, expected the token `,`', + } + }, + }, + ], + 'JSX': [ + '', + ' {value} ', + '', + '<日本語>', + '\nbar\nbaz\n', + ' : } />', + '

', + '

7x invalid-js-identifier
', + '
', + '
', + '
', + '
', + ], + 'Invalid JSX Syntax': [ + '', + '', + '`' + } + } + }, + { + content: '', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token :', + actual: 'Unexpected token `:`, expected the token `>`' + } + } + }, + '', + { + content: '<.a>', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token .', + actual: 'Unexpected token `.`, expected the token `>`' + } + } + }, + { + content: '', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token [', + actual: 'Unexpected token `[`, expected the token `>`' + } + } + }, + { + content: '', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token [', + actual: 'Unexpected token `[`, expected the token `>`' + } + } + }, + '', + { + content: '{"str";}', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token ;', + actual: 'Unexpected token `;`, expected the token `}`' + } + } + }, + { + content: '', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token ,', + actual: 'Unexpected token `,`, expected the token `>`' + } + } + }, + { + content: '
', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected string', + actual: 'Unexpected string, expected the token `>`' + } + } + }, + { + content: '
', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected identifier', + actual: 'Unexpected identifier, expected the token `...`' + } + } + }, + { + content: '
stuff
', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token {', + actual: 'Unexpected token `{`, expected the token `>`' + } + } + }, + { + content: '
stuff
', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token {', + actual: 'Unexpected token `{`, expected the token `>`' + } + } + }, + '
', + ], + + 'ES6 Unicode Code Point Escape Sequence': [ + '"\\u{714E}\\u{8336}"', + '"\\u{20BB7}\\u{91CE}\\u{5BB6}"' + ], + + // ECMAScript 6th Syntax, 11.1. 9 Template Literals + + 'ES6 Template Strings': [ + '`Hello\rworld`', + '`foo ${\n "bar"\n} baz`', + '`foo ${/* a */ "bar" /* b */} baz`', + '( foo)`bar`', + '[...a.b`hi`.c`bye`]', + 'foo`foo`.bar`bar`.baz', + 'foo`bar``baz`', + 'foo`foo`()', + ], + + + // ECMAScript 6th Syntax, 13.2 Arrow Function Definitions + + 'ES6: Arrow Function': [ + '([a, , b]) => 42', + { + content: '([a.a]) => 42', + explanation: 'Flow fails to parse it correctly', + expected_differences: { + 'root.errors.0.column': { + type: 'Wrong error column', + expected: 7, + actual: '8-10' + }, + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Invalid left-hand side in formals list', + actual: 'Unexpected token `=>`, expected the end of an expression statement (`;`)', + } + }, + }, + // I don't see why this should be an error. 14.2.9 + { + content: '(a, a) => 42', + explanation: "Esprima counts parens in its loc, Flow doesn't", + expected_differences: { + 'root.errors': { + type: 'Flow found no error', + expected: 'Line 1: Strict mode function may not have duplicate parameter names', + actual: undefined + }, + } + }, + '([...a]) => 42', + '({...a}) => 42', + ], + + + // http://wiki.ecmascript.org/doku.php?id=harmony:destructuring + + 'Harmony: Destructuring': [ + '[a, b] = [b, a]', + '({ responseText: text }) = res', + 'const {a} = {}', + 'const [a] = []', + 'let {a} = {}', + 'let [a] = []', + 'var {a} = {}', + 'var [a] = []', + 'const {a:b} = {}', + 'let {a:b} = {}', + 'var {a:b} = {}', + 'var f = function({node, guestStatus}) {}', + ], + + // http://wiki.ecmascript.org/doku.php?id=strawman:maximally_minimal_classes + + 'Harmony: Class (strawman)': [ + 'var A = class extends B {}', + 'class type {}', + 'class A extends class B extends C {} {}', + { + content: 'class A {get() {}}', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 15, + actual: 12, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 15, + actual: 12, + }, + }, + }, + { + content: 'class A { static get() {}}', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 23, + actual: 20, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 23, + actual: 20, + }, + }, + }, + { + content: 'class A extends B {get foo() {}}', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 29, + actual: 26, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 29, + actual: 26, + }, + }, + }, + { + content: 'class A extends B { static get foo() {}}', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 37, + actual: 34, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 37, + actual: 34, + }, + }, + }, + { + content: 'class A {set a(v) {}}', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 18, + actual: 14, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 18, + actual: 14, + }, + }, + }, + { + content: 'class A { static set a(v) {}}', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 26, + actual: 22, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 26, + actual: 22, + }, + }, + }, + { + content: 'class A {set(v) {};}', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 16, + actual: 12, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 16, + actual: 12, + }, + }, + }, + { + content: 'class A { static set(v) {};}', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 24, + actual: 20, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 24, + actual: 20, + }, + }, + }, + { + content: 'class A {*gen(v) { yield v; }}', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 17, + actual: 13, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 17, + actual: 13, + }, + }, + }, + { + content: 'class A { static *gen(v) { yield v; }}', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 25, + actual: 21, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 25, + actual: 21, + }, + }, + }, + { + content: '"use strict"; (class A {constructor() { super() }})', + explanation: "Esprima counts the implicit semicolon in its loc, " + + "Flow doesn't. Esprima-fb also doesn't include params in " + + "FunctionExpression location. It also mishandles `super`", + expected_differences: { + 'root.body.1.expression.body.body.0.value.body.body.0.loc.end.column': { + type: 'Wrong number', + expected: 48, + actual: 47 + }, + 'root.body.1.expression.body.body.0.value.body.body.0.range.1': { + type: 'Wrong number', + expected: 48, + actual: 47 + }, + 'root.body.1.expression.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 38, + actual: 35, + }, + 'root.body.1.expression.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 38, + actual: 35, + }, + 'root.body.1.expression.body.body.0.value.body.body.0.expression.callee.type': { + type: 'Wrong string', + expected: 'Identifier', + actual: 'Super', + }, + 'root.body.1.expression.body.body.0.value.body.body.0.expression.callee.name': { + type: 'Missing property' + }, + 'root.body.1.expression.body.body.0.value.body.body.0.expression.callee.typeAnnotation': { + type: 'Missing property' + }, + 'root.body.1.expression.body.body.0.value.body.body.0.expression.callee.optional': { + type: 'Missing property' + }, + } + }, + { + content: 'class A {static foo() {}}', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 22, + actual: 19, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 22, + actual: 19, + }, + }, + }, + { + content: 'class A {foo() {} static bar() {}}', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 15, + actual: 12, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 15, + actual: 12, + }, + 'root.body.0.body.body.1.value.range.0': { + type: 'Wrong number', + expected: 31, + actual: 28, + }, + 'root.body.0.body.body.1.value.loc.start.column': { + type: 'Wrong number', + expected: 31, + actual: 28, + }, + }, + }, + { + content: 'class A { foo() {} bar() {}}', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 16, + actual: 13, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 16, + actual: 13, + }, + 'root.body.0.body.body.1.value.range.0': { + type: 'Wrong number', + expected: 25, + actual: 22, + }, + 'root.body.0.body.body.1.value.loc.start.column': { + type: 'Wrong number', + expected: 25, + actual: 22, + }, + }, + }, + { + content: 'class A { get foo() {} set foo(v) {}}', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 20, + actual: 17, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 20, + actual: 17, + }, + 'root.body.0.body.body.1.value.range.0': { + type: 'Wrong number', + expected: 34, + actual: 30, + }, + 'root.body.0.body.body.1.value.loc.start.column': { + type: 'Wrong number', + expected: 34, + actual: 30, + }, + }, + }, + { + content: 'class A { static get foo() {} get foo() {}}', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 27, + actual: 24, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 27, + actual: 24, + }, + 'root.body.0.body.body.1.value.range.0': { + type: 'Wrong number', + expected: 40, + actual: 37, + }, + 'root.body.0.body.body.1.value.loc.start.column': { + type: 'Wrong number', + expected: 40, + actual: 37, + }, + }, + }, + { + content: 'class A { static get foo() {} static get bar() {} }', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 27, + actual: 24, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 27, + actual: 24, + }, + 'root.body.0.body.body.1.value.range.0': { + type: 'Wrong number', + expected: 47, + actual: 44, + }, + 'root.body.0.body.body.1.value.loc.start.column': { + type: 'Wrong number', + expected: 47, + actual: 44, + }, + }, + }, + { + content: 'class A { static get foo() {} static set foo(v) {} get foo() {} set foo(v) {}}', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 27, + actual: 24, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 27, + actual: 24, + }, + 'root.body.0.body.body.1.value.range.0': { + type: 'Wrong number', + expected: 48, + actual: 44, + }, + 'root.body.0.body.body.1.value.loc.start.column': { + type: 'Wrong number', + expected: 48, + actual: 44, + }, + 'root.body.0.body.body.2.value.range.0': { + type: 'Wrong number', + expected: 61, + actual: 58, + }, + 'root.body.0.body.body.2.value.loc.start.column': { + type: 'Wrong number', + expected: 61, + actual: 58, + }, + 'root.body.0.body.body.3.value.range.0': { + type: 'Wrong number', + expected: 75, + actual: 71, + }, + 'root.body.0.body.body.3.value.loc.start.column': { + type: 'Wrong number', + expected: 75, + actual: 71, + }, + }, + }, + { + content: 'class A { set foo(v) {} get foo() {} }', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 21, + actual: 17, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 21, + actual: 17, + }, + 'root.body.0.body.body.1.value.range.0': { + type: 'Wrong number', + expected: 34, + actual: 31, + }, + 'root.body.0.body.body.1.value.loc.start.column': { + type: 'Wrong number', + expected: 34, + actual: 31, + }, + }, + }, + { + content: 'class A { [x]() {} }', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 16, + actual: 13, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 16, + actual: 13, + }, + }, + }, + { + content: 'class A { [1+1]() {} }', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 18, + actual: 15, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 18, + actual: 15, + }, + }, + }, + { + content: 'class A { get [1+1]() {} }', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 22, + actual: 19, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 22, + actual: 19, + }, + }, + }, + { + content: 'class A { static get [1+1]() {} }', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 29, + actual: 26, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 29, + actual: 26, + }, + }, + }, + { + content: 'class A { static() {} }', + explanation: 'Our version of esprima is outdated', + expected_differences: { + 'root.errors': { + type: 'Flow found no error', + expected: 'Line 1: Unexpected token )', + actual: undefined, + }, + }, + }, + { + content: 'class A { static static() {} }', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 26, + actual: 23, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 26, + actual: 23, + }, + }, + }, + ], + + 'ES6: Computed Properties': [ + '({[x]: 10})', + '({["x" + "y"]: 10})', + '({[x]: function() {}})', + '({[x]: 10, y: 20})', + { + content: '({get [x]() {}, set [x](v) {}})', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.expression.properties.0.value.range.0': { + type: 'Wrong number', + expected: 12, + actual: 9, + }, + 'root.body.0.expression.properties.0.value.loc.start.column': { + type: 'Wrong number', + expected: 12, + actual: 9, + }, + 'root.body.0.expression.properties.1.value.range.0': { + type: 'Wrong number', + expected: 27, + actual: 23, + }, + 'root.body.0.expression.properties.1.value.loc.start.column': { + type: 'Wrong number', + expected: 27, + actual: 23, + }, + }, + }, + { + content: '({[x]() {}})', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.expression.properties.0.value.range.0': { + type: 'Wrong number', + expected: 8, + actual: 5, + }, + 'root.body.0.expression.properties.0.value.loc.start.column': { + type: 'Wrong number', + expected: 8, + actual: 5, + }, + }, + }, + // These tests fail due to computed Properties + // 'var {[x]: y} = {y}', + // 'function f({[x]: y}) {}', + { + content: 'var x = {*[test]() { yield *v; }}', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.declarations.0.init.properties.0.value.range.0': { + type: 'Wrong number', + expected: 19, + actual: 16, + }, + 'root.body.0.declarations.0.init.properties.0.value.loc.start.column': { + type: 'Wrong number', + expected: 19, + actual: 16, + }, + }, + }, + ], + + 'ES6: Default parameters': [ + 'function f([x] = [1]) {}', + 'function f({x} = {x: 10}) {}', + 'f = function({x} = {x: 10}) {}', + '({f: function({x} = {x: 10}) {}})', + { + content: '({f({x} = {x: 10}) {}})', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.expression.properties.0.value.range.0': { + type: 'Wrong number', + expected: 19, + actual: 3, + }, + 'root.body.0.expression.properties.0.value.loc.start.column': { + type: 'Wrong number', + expected: 19, + actual: 3, + }, + }, + }, + { + content: '(class {f({x} = {x: 10}) {}})', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.expression.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 25, + actual: 9, + }, + 'root.body.0.expression.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 25, + actual: 9, + }, + }, + }, + '(({x} = {x: 10}) => {})', + { + content: 'x = { f(a=1) {} }', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.expression.right.properties.0.value.range.0': { + type: 'Wrong number', + expected: 13, + actual: 7, + }, + 'root.body.0.expression.right.properties.0.value.loc.start.column': { + type: 'Wrong number', + expected: 13, + actual: 7, + }, + }, + }, + ], + + 'ES6: Destructured Parameters': [ + 'function x([ a, b ]){}', + 'function x({ a, b }){}', + '"use strict"; function x({ a }){ "use strict"; }', + 'function x(a, { a }){}', + 'function x(...[ a, b ]){}', + 'function x({ a: { w, x }, b: [y, z] }, ...[a, b, c]){}', + '(function x([ a, b ]){})', + '(function x({ a, b }){})', + '(function x(...[ a, b ]){})', + '(function x({ a: { w, x }, b: [y, z] }, ...[a, b, c]){})', + '({ x([ a, b ]){} })', + '({ x(...[ a, b ]){} })', + '({ x({ a: { w, x }, b: [y, z] }, ...[a, b, c]){} })', + '(...a) => {}', + '(a, ...b) => {}', + '({ a }) => {}', + '({ a }, ...b) => {}', + '(...[a, b]) => {}', + '(a, ...[b]) => {}', + '({ a: [a, b] }, ...c) => {}', + '({ a: b, c }, [d, e], ...f) => {}' + ], + + 'ES6: SpreadElement': [ + '[...a] = b', + '[a, ...b] = c', + '[{ a, b }, ...c] = d', + '[a, ...[b, c]] = d', + 'var [...a] = b', + 'var [a, ...b] = c', + 'var [{ a, b }, ...c] = d', + 'var [a, ...[b, c]] = d', + 'func(...a)', + 'func(a, ...b)', + 'new foo(...a)', + 'new foo(a, ...b)', + 'function foo(...a){}', + 'function foo(a, ...b){}', + { + content: 'function foo(a, ...a){}', + explanation: "esprima-fb doesn't catch this", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: undefined, + actual: 'Strict mode function may not have duplicate parameter names', + }, + 'root.errors.0.line': { + type: 'Wrong error line', + expected: undefined, + actual: 1, + }, + 'root.errors.0.column': { + type: 'Wrong error column', + expected: undefined, + actual: 20, + }, + } + } + ], + + // https://gist.github.com/sebmarkbage/aa849c7973cb4452c547 + 'ES7 Proposal: Spread Properties': [ + 'let z = {...x}', + 'z = {x, ...y}', + '({x, ...y, a, ...b, c})', + ], + + 'Harmony Invalid syntax': [ + '"\\u{110000}"', + '[v] += ary', + '[2] = 42', + '({ obj:20 }) = 42', + '( { get x() {} } ) = 0', + 'x \n is y', + 'x \n isnt y', + 'function default() {}', + 'function hello() {\'use strict\'; ({ i: 10, s(eval) { } }); }', + 'function a() { "use strict"; ({ b(t, t) { } }); }', + 'var super', + 'var default', + 'let default', + 'const default', + '({ v: eval }) = obj', + '({ v: arguments }) = obj', + 'for (var i = function() { return 10 in [] } in list) process(x);', + 'for (let x = 42 in list) process(x);', + 'for (let x = 42 of list) process(x);', + 'module\n"crypto" {}', + 'module foo from bar', + 'module 42', + 'module foo bar', + 'module "crypto" { module "e" {} }', + 'module "x" { export * from foo }', + 'import foo', + 'import { foo, bar }', + 'import foo from bar', + '((a)) => 42', + '(a, (b)) => 42', + '"use strict"; (eval = 10) => 42', + // strict mode, using eval when IsSimpleParameterList is true + '"use strict"; eval => 42', + // strict mode, using arguments when IsSimpleParameterList is true + '"use strict"; arguments => 42', + // strict mode, using eval when IsSimpleParameterList is true + '"use strict"; (eval, a) => 42', + // strict mode, using arguments when IsSimpleParameterList is true + '"use strict"; (arguments, a) => 42', + // strict mode, using eval when IsSimpleParameterList is false + '"use strict"; (eval, a = 10) => 42', + '(a, a) => 42', + '"use strict"; (a, a) => 42', + '"use strict"; (a) => 00', + '() <= 42', + '(10) => 00', + '(10, 20) => 00', + 'yield v', + 'yield 10', + 'yield* 10', + 'e => yield* 10', + '(function () { yield* 10 })', + '(function() { "use strict"; f(yield v) })', + 'var obj = { *test** }', + 'class A extends yield B { }', + 'class default', + '`test', + 'switch `test`', + '`hello ${10 `test`', + '`hello ${10;test`', + 'function a() 1 // expression closure is not supported', + '[a,b if (a)] // (a,b)', + 'for each (let x in {}) {};', + '[x for (let x in [])]', + '[x for (const x in [])]', + '[x for (var x in [])]', + '[a,b for (a in [])] // (a,b) ', + '[x if (x)] // block required', + 'var a = [x if (x)]', + '[for (x in [])] // no espression', + '({ "chance" }) = obj', + '({ 42 }) = obj', + 'function f(a, ...b = 0)', + 'function x(...{ a }){}', + '"use strict"; function x(a, { a }){}', + '"use strict"; function x({ b: { a } }, [{ b: { a } }]){}', + '"use strict"; function x(a, ...[a]){}', + '(...a, b) => {}', + '([ 5 ]) => {}', + '({ 5 }) => {}', + '(...[ 5 ]) => {}', + '[...{ a }] = b', + '[...a, b] = c', + 'func(...a, b)', + 'let {...a, b} = x', + '(function({...a, b}) {})', + '({ t(eval) { "use strict"; } });', + '"use strict"; `${test}\\02`;', + '[...a, ] = b', + 'if (b,...a, );', + '(b, ...a)', + 'module "Universe" { ; ; ', + 'switch (cond) { case 10: let a = 20; ', + '"use strict"; (eval) => 42', + '(eval) => { "use strict"; 42 }', + '({ get test() { } }) => 42' + ], + 'Type Annotations': [ + 'a = class Foo { }', + 'a = class Foo extends Bar {}', + 'a=function() {}', + { + content: 'a={set fooProp(value:number){}}', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.expression.right.properties.0.value.range.0': { + type: 'Wrong number', + expected: 28, + actual: 14, + }, + 'root.body.0.expression.right.properties.0.value.loc.start.column': { + type: 'Wrong number', + expected: 28, + actual: 14, + }, + }, + }, + { + content: 'class Array { concat(items:number | string) {}; }', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 44, + actual: 20, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 44, + actual: 20, + }, + }, + }, + 'class Foo { [1 + 1]: string; }', + 'class Foo { 123:string; }', + { + content: 'class Foo { "bar"() { } }', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 23, + actual: 17, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 23, + actual: 17, + }, + }, + }, + 'class Foo { "prop1":string; }', + 'class Foo { [prop1]: string; }' , + 'class Foo { prop1:string; prop2:number; }', + 'class Foo { static prop1:string; prop2:number; }', + { + content: 'class Foo {set fooProp(value:number){}}', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 36, + actual: 22, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 36, + actual: 22, + }, + }, + }, + 'class Foo {}', + { + content: 'class Foo { bar():number { return 42; }}', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 31, + actual: 18, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 31, + actual: 18, + }, + }, + }, + 'class Foo extends Bar {}', + 'class Foo extends mixin(Bar) {}', + 'function foo(): {} {}', + 'function foo():(_:bool) => number{}', + 'function foo():(_?:bool) => number{}', + 'function foo(callback: (_1:bool, _2:string) => number){}', + 'function foo(callback: (_:bool) => number){}', + 'function foo(callback: () => number){}', + 'function foo(callback: () => void){}', + 'function foo(nullableNum: ?number){}', + 'function foo():number{}', + 'function foo(numVal: any){}', + 'function foo(numVal: number){}', + 'function foo(numVal: number, strVal: string){}', + 'function foo(numVal: number, untypedVal){}', + 'function foo(numVal: number, x: number){}', + 'function foo(requiredParam, optParam?) {}', + 'function foo(requiredParam, optParam?=123) {}', + 'function foo() {}', + 'function foo() {}', + 'function foo(...typedRest: Array){}', + 'function foo(untypedVal, numVal: number){}', + 'function foo():() => void{}', + 'function foo([x]: Array) {}', + 'var a:Array = [1, 2, 3]', + 'var a:(...rest:Array) => number', + 'var bar: (str:number, i:number)=> string = foo;', + 'var numVal:number;', + 'var numVal:number = otherNumVal;', + 'var [x]: Array = [ "hello" ];', + 'var x : number | string = 4;', + 'var x : number & string = 4;', + 'var x : () => number | () => string = fn;', + 'var x : () => number & () => string = fn;', + 'var x: typeof Y | number = Y;', + 'var x: typeof Y & number = Y;', + 'var x: typeof Y = Y;', + ], + 'Tuples': [ /* TODO */ ], + 'Type Aliases': [ + 'type FBID = number;', + 'type FBID = number', + 'type Arr = Array;', + ], + 'Interfaces': [ + 'interface A {}', + 'interface A {}', + 'interface A extends B {}', + 'interface A extends B, C {}', + 'interface A extends B {}', + 'class Foo implements Bar {}', + 'class Foo extends Bar implements Bat, Man {}', + 'class Foo extends class Bar implements Bat {} {}', + 'class Foo extends class Bar implements Bat {} implements Man {}', + ], + 'Array Types': [ + 'var x: number[];', + 'var x: ?number[];', + { + content: 'var x: (?number)[];', + explanation: 'Flow does not count parens in its locs', + expected_differences: { + 'root.body.0.declarations.0.id.typeAnnotation.typeAnnotation.loc.start.column': { + type: 'Wrong number', + expected: 7, + actual: 8, + }, + 'root.body.0.declarations.0.id.typeAnnotation.typeAnnotation.range.0': { + type: 'Wrong number', + expected: 7, + actual: 8, + } + } + }, + 'var x: () => number[];', + { + content: 'var x: (() => number)[];', + explanation: 'Flow does not count parens in its locs', + expected_differences: { + 'root.body.0.declarations.0.id.typeAnnotation.typeAnnotation.loc.start.column': { + type: 'Wrong number', + expected: 7, + actual: 8, + }, + 'root.body.0.declarations.0.id.typeAnnotation.typeAnnotation.range.0': { + type: 'Wrong number', + expected: 7, + actual: 8, + } + } + }, + 'var x: typeof A[];', + ], + 'Export': { + 'options': { sourceType: "module" }, + 'tests': [ + { + content: 'export var x, y', + explanation: 'esprima-fb is outdated', + expected_differences: { + 'root.body.0.type': { + type: 'Wrong string', + expected: 'ExportDeclaration', + actual: 'ExportNamedDeclaration', + }, + 'root.body.0.default': { + type: 'Missing property', + }, + }, + }, + { + content: 'export let x, y', + explanation: 'esprima-fb is outdated', + expected_differences: { + 'root.body.0.type': { + type: 'Wrong string', + expected: 'ExportDeclaration', + actual: 'ExportNamedDeclaration', + }, + 'root.body.0.default': { + type: 'Missing property', + }, + }, + }, + 'export const x, y', + { + content: 'export class A {}', + explanation: 'esprima-fb is outdated', + expected_differences: { + 'root.body.0.type': { + type: 'Wrong string', + expected: 'ExportDeclaration', + actual: 'ExportNamedDeclaration', + }, + 'root.body.0.default': { + type: 'Missing property', + }, + }, + }, + { + content: 'export default 1 + 1;', + explanation: 'esprima-fb is outdated', + expected_differences: { + 'root.body.0.type': { + type: 'Wrong string', + expected: 'ExportDeclaration', + actual: 'ExportDefaultDeclaration', + }, + 'root.body.0.default': { + type: 'Missing property', + }, + 'root.body.0.specifiers': { + type: 'Missing property', + }, + 'root.body.0.source': { + type: 'Missing property', + }, + }, + }, + { + content: 'export default 1 + 1', + explanation: 'esprima-fb is outdated', + expected_differences: { + 'root.body.0.type': { + type: 'Wrong string', + expected: 'ExportDeclaration', + actual: 'ExportDefaultDeclaration', + }, + 'root.body.0.default': { + type: 'Missing property', + }, + 'root.body.0.specifiers': { + type: 'Missing property', + }, + 'root.body.0.source': { + type: 'Missing property', + }, + }, + }, + /* Esprima parses default exports wrong + 'export default function foo() {}', + 'export default function *foo() {}', + 'export default class {};', + 'export default class A {};', + */ + ] + }, + 'Invalid Exports': { + 'options': { sourceType: "module" }, + 'tests': [ + /* Esprima doesn't parse nameless exported classes yet + 'export class {}', + */ + { + content: 'export function {}', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token {', + actual: 'Unexpected token `{`, expected an identifier' + } + } + }, + /* Esprima parses default exports wrong + 'export default class A {}', + */ + ], + }, + 'Import': { + 'options': { sourceType: "module" }, + 'tests': [ + 'import defaultbinding, {} from "MyModule";', + /* TODO Esprima should support these + 'import defaultbinding, {x,} from "MyModule";', + */ + 'import defaultbinding, {x,y} from "MyModule";', + 'import defaultbinding, {x as z} from "MyModule";', + 'import defaultbinding, {x, y as z} from "MyModule";', + + // These aren't import types + 'import type from "MyModule"', + 'import type, {} from "MyModule"', + 'import type, * as namespace from "MyModule"', + 'import {type} from "MyModule"', + 'import {type as type} from "MyModule"', + + // Other pseudo keywords + 'import of from "MyModule"', + 'import {of} from "MyModule"', + 'import declare from "MyModule"', + 'import {declare} from "MyModule"', + 'import async from "MyModule"', + 'import {async} from "MyModule"', + + 'import {of as of} from "MyModule"', + 'import {declare as declare} from "MyModule"', + 'import {async as async} from "MyModule"', + ], + }, + 'Import Type': { + 'options': { sourceType: "module" }, + 'tests': [ + 'import type defaultbinding from "MyModule";', + /* TODO This is invalid; Esprima should also error + 'import type * as namespace from "MyModule";', + */ + 'import type {} from "MyModule";', + 'import type defaultbinding, {} from "MyModule";', + /* TODO Esprima should support these + 'import type {x,} from "MyModule";', + 'import type defaultbinding, {x,} from "MyModule";', + */ + 'import type {x} from "MyModule";', + 'import type {x,y} from "MyModule";', + 'import type {x as z} from "MyModule";', + 'import type {x, y as z} from "MyModule";', + 'import type defaultbinding, * as namespace from "MyModule";', + 'import type defaultbinding, {x} from "MyModule";', + 'import type defaultbinding, {x,y} from "MyModule";', + 'import type defaultbinding, {x as z} from "MyModule";', + 'import type defaultbinding, {x, y as z} from "MyModule";', + ], + }, + 'Import Typeof': { + 'options': { sourceType: "module" }, + 'tests': [ + 'import typeof defaultbinding from "MyModule";', + 'import typeof {} from "MyModule";', + 'import typeof defaultbinding, {} from "MyModule";', + /* TODO Esprima should support these + 'import typeof {x,} from "MyModule";', + 'import typeof defaultbinding, {x,} from "MyModule";', + */ + 'import typeof {x} from "MyModule";', + 'import typeof {x,y} from "MyModule";', + 'import typeof {x as z} from "MyModule";', + 'import typeof {x, y as z} from "MyModule";', + 'import typeof defaultbinding, {x} from "MyModule";', + 'import typeof defaultbinding, {x,y} from "MyModule";', + 'import typeof defaultbinding, {x as z} from "MyModule";', + 'import typeof defaultbinding, {x, y as z} from "MyModule";', + ], + }, + 'Declare Statements': [ + 'declare var foo', + 'declare var foo;', + 'declare var foo: number;', + 'declare function foo(): void', + 'declare function foo(): void;', + 'declare function foo(): void;', + 'declare function foo(x: number, y: string): void;', + ], + 'Invalid Declare Statements': [ + { + content: 'declare function foo();', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token ;', + actual: 'Unexpected token `;`, expected the token `:`' + } + } + }, + ], + 'Declare Module': [ + 'declare module A {}', + 'declare module "./a/b.js" {}', + 'declare module A { declare var x: number; }', + 'declare module A { declare function foo(): number; }', + ], + 'Invalid Declare Module': [ + { + content: 'declare Module A {}', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected identifier', + actual: 'Unexpected identifier, expected the end of an expression statement (`;`)' + } + } + }, + { + content: 'declare module {}', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token {', + actual: 'Unexpected token `{`, expected an identifier' + } + } + }, + '"use strict"; declare module "\\01" {}', + { + content: 'declare module A { declare module B {} }', + explanation: "We realize the error as soon as we see the B", + expected_differences: { + 'root.errors.0.column': { + type: 'Wrong error column', + expected: 19, + actual: '34-35' + }, + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected identifier', + actual: 'Unexpected identifier, expected the token `.`' + } + } + }, + { + content: 'declare module A { export default 1 +1; }', + explanation: 'export is no longer a future reserved word', + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected reserved word', + actual: 'Unexpected token `export`, expected the token `declare`', + }, + }, + }, + ], + 'Type Grouping': [ + 'var a: (number)', + { + content: 'var a: (() => number) | () => string', + explanation: 'Esprima counts the parens in the type locs', + expected_differences: { + 'root.body.0.declarations.0.id.typeAnnotation.typeAnnotation.range.0': { + type: 'Wrong number', + expected: 7, + actual: 8 + }, + 'root.body.0.declarations.0.id.typeAnnotation.typeAnnotation.loc.start.column': { + type: 'Wrong number', + expected: 7, + actual: 8 + } + } + }, + 'var a: (A | B)', + 'var a: (typeof A)', + 'var a: Array<(number)>', + 'var a: ([]) = []', + 'var a: (A)', + 'var a: (A.B)', + 'var a: (A)', + 'var a: (A | B)', + 'var a: (A & B)', + ], + 'Bounded Polymorphism': [ + 'function foo() {}', + { + content: 'class Foo() {}', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token (', + actual: 'Unexpected token `(`, expected the token `{`' + } + } + }, + ], + 'Async/Await': [ + 'try { foo(); } catch (async) { bar(); }', + 'try { foo(); } catch (await) { bar(); }', + { + content: 'var x = { async() { bar(); }}', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.declarations.0.init.properties.0.value.range.0': { + type: 'Wrong number', + expected: 18, + actual: 15, + }, + 'root.body.0.declarations.0.init.properties.0.value.loc.start.column': { + type: 'Wrong number', + expected: 18, + actual: 15, + }, + }, + }, + { + content: 'var x = { set async(v) { }, get async() { return "foo";}, }', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.declarations.0.init.properties.0.value.range.0': { + type: 'Wrong number', + expected: 23, + actual: 19, + }, + 'root.body.0.declarations.0.init.properties.0.value.loc.start.column': { + type: 'Wrong number', + expected: 23, + actual: 19, + }, + 'root.body.0.declarations.0.init.properties.1.value.range.0': { + type: 'Wrong number', + expected: 40, + actual: 37, + }, + 'root.body.0.declarations.0.init.properties.1.value.loc.start.column': { + type: 'Wrong number', + expected: 40, + actual: 37, + }, + }, + }, + { + content: 'var x = { set await(v) { }, get await() { return "foo";}, }', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.declarations.0.init.properties.0.value.range.0': { + type: 'Wrong number', + expected: 23, + actual: 19, + }, + 'root.body.0.declarations.0.init.properties.0.value.loc.start.column': { + type: 'Wrong number', + expected: 23, + actual: 19, + }, + 'root.body.0.declarations.0.init.properties.1.value.range.0': { + type: 'Wrong number', + expected: 40, + actual: 37, + }, + 'root.body.0.declarations.0.init.properties.1.value.loc.start.column': { + type: 'Wrong number', + expected: 40, + actual: 37, + }, + }, + }, + 'class async { }', + { + content: 'class async { async() { } }', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 22, + actual: 19, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 22, + actual: 19, + }, + }, + }, + { + content: 'class async { async async() { await foo; } }', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 28, + actual: 25, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 28, + actual: 25, + }, + }, + }, + { + content: 'class await { await() { } }', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 22, + actual: 19, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 22, + actual: 19, + }, + }, + }, + { + content: 'class A { set async(v) { } get async() { return "foo";} }', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 23, + actual: 19, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 23, + actual: 19, + }, + 'root.body.0.body.body.1.value.range.0': { + type: 'Wrong number', + expected: 39, + actual: 36, + }, + 'root.body.0.body.body.1.value.loc.start.column': { + type: 'Wrong number', + expected: 39, + actual: 36, + }, + }, + }, + { + content: 'class A { set await(v) { } get await() { return "foo";} }', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 23, + actual: 19, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 23, + actual: 19, + }, + 'root.body.0.body.body.1.value.range.0': { + type: 'Wrong number', + expected: 39, + actual: 36, + }, + 'root.body.0.body.body.1.value.loc.start.column': { + type: 'Wrong number', + expected: 39, + actual: 36, + }, + }, + }, + { + content: 'y = async function() { return await bar; } ()', + explanation: 'Babel has no problem with this, and it seems ' + + 'perfectly sensical', + expected_differences: { + 'root.errors': { + type: 'Flow found no error', + expected: 'Line 1: Unexpected token (', + actual: undefined, + }, + }, + }, + 'async function f() { return 1; }', + 'async function foo() { await 1; }', + { + content: 'var x = { async m() { await 1; } };', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.declarations.0.init.properties.0.value.range.0': { + type: 'Wrong number', + expected: 20, + actual: 17, + }, + 'root.body.0.declarations.0.init.properties.0.value.loc.start.column': { + type: 'Wrong number', + expected: 20, + actual: 17, + }, + }, + }, + 'function async() { }', + { + content: 'async function foo() { return await foo + await bar + 5; }', + explanation: 'Works in Babel and the spec appears to allow it', + expected_differences: { + 'root.errors': { + type: 'Flow found no error', + expected: 'Line 1: Unexpected identifier', + actual: undefined, + }, + }, + }, + 'var x = async function bar() { await foo; }', + { + content: 'async function foo() { return await; }', + explanation: "Improved error message", + expected_differences: { + 'root.errors.0.message': { + type: 'Wrong error message', + expected: 'Unexpected token ;', + actual: 'Unexpected token `;`' + } + } + }, + 'var x = async (a, b) => await a;', + 'var x = async a => await a;', + 'foo(async () => await bar);', + 'var x = async\ny => y', + { + content: 'class A { async bar() { await foo; } }', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.body.body.0.value.range.0': { + type: 'Wrong number', + expected: 22, + actual: 19, + }, + 'root.body.0.body.body.0.value.loc.start.column': { + type: 'Wrong number', + expected: 22, + actual: 19, + }, + }, + }, + { + content: 'var x = { async "foo"() { await y; } }', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.declarations.0.init.properties.0.value.range.0': { + type: 'Wrong number', + expected: 24, + actual: 21, + }, + 'root.body.0.declarations.0.init.properties.0.value.loc.start.column': { + type: 'Wrong number', + expected: 24, + actual: 21, + }, + }, + }, + { + content: 'var x = { async 123() { await y; } }', + explanation: "Esprima-fb doesn't include params in " + + "FunctionExpression location", + expected_differences: { + 'root.body.0.declarations.0.init.properties.0.value.range.0': { + type: 'Wrong number', + expected: 22, + actual: 19, + }, + 'root.body.0.declarations.0.init.properties.0.value.loc.start.column': { + type: 'Wrong number', + expected: 22, + actual: 19, + }, + }, + }, + ], + } +}; diff --git a/lib/test/file_utils.ml b/lib/test/file_utils.ml new file mode 100644 index 0000000..121f36a --- /dev/null +++ b/lib/test/file_utils.ml @@ -0,0 +1,70 @@ +(* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + *) + +type file_kind = + | Dir of string + | File of string + +let lstat_kind file = + Unix.( + try Some (lstat file).st_kind + with Unix_error (ENOENT, _, _) -> + prerr_endline ("File not found: " ^ file); + None) + +module FileSet = Set.Make (struct + type t = file_kind + + let compare a b = + match (a, b) with + | (Dir a', Dir b') + | (File a', File b') -> + String.compare a' b' + | (Dir _, File _) -> 1 + | (File _, Dir _) -> -1 +end) + +let fold_files + (type t) + ?max_depth + ?(filter = (fun _ -> true)) + ?(file_only = false) + (paths : string list) + (action : file_kind -> t -> t) + (init : t) = + let rec fold depth acc dir = + let acc = + if (not file_only) && filter dir then + action (Dir dir) acc + else + acc + in + if max_depth = Some depth then + acc + else + let files = + Sys.readdir dir + |> Array.fold_left + (fun acc file -> + Unix.( + let abs = Filename.concat dir file in + match lstat_kind abs with + | Some S_REG -> FileSet.add (File abs) acc + | Some S_DIR -> FileSet.add (Dir abs) acc + | _ -> acc)) + FileSet.empty + in + FileSet.fold + (fun entry acc -> + match entry with + | File file when filter file -> action (File file) acc + | Dir file -> fold (depth + 1) acc file + | _ -> acc) + files + acc + in + List.fold_left (fold 0) init paths diff --git a/lib/test/file_utils.mli b/lib/test/file_utils.mli new file mode 100644 index 0000000..054ac03 --- /dev/null +++ b/lib/test/file_utils.mli @@ -0,0 +1,19 @@ +(* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + *) + +type file_kind = + | Dir of string + | File of string + +val fold_files : + ?max_depth:int -> + ?filter:(string -> bool) -> + ?file_only:bool -> + string list -> + (file_kind -> 'a -> 'a) -> + 'a -> + 'a diff --git a/lib/test/flow/ES6/binding-pattern/array-pattern/rest_not_final.js b/lib/test/flow/ES6/binding-pattern/array-pattern/rest_not_final.js new file mode 100644 index 0000000..fdb600c --- /dev/null +++ b/lib/test/flow/ES6/binding-pattern/array-pattern/rest_not_final.js @@ -0,0 +1 @@ +let [...a, b] = []; diff --git a/lib/test/flow/ES6/binding-pattern/array-pattern/rest_not_final.tree.json b/lib/test/flow/ES6/binding-pattern/array-pattern/rest_not_final.tree.json new file mode 100644 index 0000000..8456e5d --- /dev/null +++ b/lib/test/flow/ES6/binding-pattern/array-pattern/rest_not_final.tree.json @@ -0,0 +1,62 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":9}}, + "message":"Rest element must be final element of an array pattern" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "range":[0,19], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "range":[0,19], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":18}}, + "range":[4,18], + "id":{ + "type":"ArrayPattern", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, + "range":[4,13], + "elements":[ + { + "type":"RestElement", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":9}}, + "range":[5,9], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "name":"a", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"b", + "typeAnnotation":null, + "optional":false + } + ], + "typeAnnotation":null + }, + "init":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, + "range":[16,18], + "elements":[] + } + } + ], + "kind":"let" + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/binding-pattern/object-pattern/await-prop-in-async-function.js b/lib/test/flow/ES6/binding-pattern/object-pattern/await-prop-in-async-function.js new file mode 100644 index 0000000..f8c4ee2 --- /dev/null +++ b/lib/test/flow/ES6/binding-pattern/object-pattern/await-prop-in-async-function.js @@ -0,0 +1,5 @@ +/* + * When [+Await], `await` isn't a valid IdentifierReference. + * #prod-AssignmentProperty -> #prod-IdentifierReference + */ +(async function() { 0, { await } = {}; }); diff --git a/lib/test/flow/ES6/binding-pattern/object-pattern/await-prop-in-async-function.tree.json b/lib/test/flow/ES6/binding-pattern/object-pattern/await-prop-in-async-function.tree.json new file mode 100644 index 0000000..b659061 --- /dev/null +++ b/lib/test/flow/ES6/binding-pattern/object-pattern/await-prop-in-async-function.tree.json @@ -0,0 +1,112 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":5,"column":25},"end":{"line":5,"column":30}}, + "message":"`await` is an invalid identifier in async functions" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":42}}, + "range":[125,167], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":42}}, + "range":[125,167], + "expression":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":5,"column":1},"end":{"line":5,"column":40}}, + "range":[126,165], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":5,"column":18},"end":{"line":5,"column":40}}, + "range":[143,165], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":5,"column":20},"end":{"line":5,"column":38}}, + "range":[145,163], + "expression":{ + "type":"SequenceExpression", + "loc":{"source":null,"start":{"line":5,"column":20},"end":{"line":5,"column":37}}, + "range":[145,162], + "expressions":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":5,"column":20},"end":{"line":5,"column":21}}, + "range":[145,146], + "value":0, + "raw":"0" + }, + { + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":5,"column":23},"end":{"line":5,"column":37}}, + "range":[148,162], + "operator":"=", + "left":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":5,"column":23},"end":{"line":5,"column":32}}, + "range":[148,157], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":5,"column":25},"end":{"line":5,"column":30}}, + "range":[150,155], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":25},"end":{"line":5,"column":30}}, + "range":[150,155], + "name":"await", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":25},"end":{"line":5,"column":30}}, + "range":[150,155], + "name":"await", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ], + "typeAnnotation":null + }, + "right":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":5,"column":35},"end":{"line":5,"column":37}}, + "range":[160,162], + "properties":[] + } + } + ] + }, + "directive":null + } + ] + }, + "async":true, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "directive":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":3}}, + "range":[0,124], + "value":"\n * When [+Await], `await` isn't a valid IdentifierReference.\n * #prod-AssignmentProperty -> #prod-IdentifierReference\n " + } + ] +} diff --git a/lib/test/flow/ES6/binding-pattern/object-pattern/eval-prop-assignment-strict.js b/lib/test/flow/ES6/binding-pattern/object-pattern/eval-prop-assignment-strict.js new file mode 100644 index 0000000..0eacf99 --- /dev/null +++ b/lib/test/flow/ES6/binding-pattern/object-pattern/eval-prop-assignment-strict.js @@ -0,0 +1,2 @@ +"use strict"; +({ eval } = {}); diff --git a/lib/test/flow/ES6/binding-pattern/object-pattern/eval-prop-assignment-strict.tree.json b/lib/test/flow/ES6/binding-pattern/object-pattern/eval-prop-assignment-strict.tree.json new file mode 100644 index 0000000..867265f --- /dev/null +++ b/lib/test/flow/ES6/binding-pattern/object-pattern/eval-prop-assignment-strict.tree.json @@ -0,0 +1,78 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":7}}, + "message":"Assignment to eval or arguments is not allowed in strict mode" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, + "range":[0,30], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "value":"use strict", + "raw":"\"use strict\"" + }, + "directive":"use strict" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":16}}, + "range":[14,30], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":2,"column":1},"end":{"line":2,"column":14}}, + "range":[15,28], + "operator":"=", + "left":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":2,"column":1},"end":{"line":2,"column":9}}, + "range":[15,23], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":7}}, + "range":[17,21], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":7}}, + "range":[17,21], + "name":"eval", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":7}}, + "range":[17,21], + "name":"eval", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ], + "typeAnnotation":null + }, + "right":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, + "range":[26,28], + "properties":[] + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/binding-pattern/object-pattern/methods_are_invalid.js b/lib/test/flow/ES6/binding-pattern/object-pattern/methods_are_invalid.js new file mode 100644 index 0000000..17f725b --- /dev/null +++ b/lib/test/flow/ES6/binding-pattern/object-pattern/methods_are_invalid.js @@ -0,0 +1 @@ +({ m() {} } = {}); diff --git a/lib/test/flow/ES6/binding-pattern/object-pattern/methods_are_invalid.tree.json b/lib/test/flow/ES6/binding-pattern/object-pattern/methods_are_invalid.tree.json new file mode 100644 index 0000000..720364e --- /dev/null +++ b/lib/test/flow/ES6/binding-pattern/object-pattern/methods_are_invalid.tree.json @@ -0,0 +1,39 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, + "message":"Object pattern can't contain methods" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":16}}, + "range":[1,16], + "operator":"=", + "left":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":11}}, + "range":[1,11], + "properties":[], + "typeAnnotation":null + }, + "right":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, + "range":[14,16], + "properties":[] + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/binding-pattern/object-pattern/public-prop-assignment-strict.js b/lib/test/flow/ES6/binding-pattern/object-pattern/public-prop-assignment-strict.js new file mode 100644 index 0000000..cddd3e9 --- /dev/null +++ b/lib/test/flow/ES6/binding-pattern/object-pattern/public-prop-assignment-strict.js @@ -0,0 +1,2 @@ +"use strict"; +({ public } = {}); diff --git a/lib/test/flow/ES6/binding-pattern/object-pattern/public-prop-assignment-strict.tree.json b/lib/test/flow/ES6/binding-pattern/object-pattern/public-prop-assignment-strict.tree.json new file mode 100644 index 0000000..c8495d5 --- /dev/null +++ b/lib/test/flow/ES6/binding-pattern/object-pattern/public-prop-assignment-strict.tree.json @@ -0,0 +1,78 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":9}}, + "message":"Use of future reserved word in strict mode" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, + "range":[0,32], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "value":"use strict", + "raw":"\"use strict\"" + }, + "directive":"use strict" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":18}}, + "range":[14,32], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":2,"column":1},"end":{"line":2,"column":16}}, + "range":[15,30], + "operator":"=", + "left":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":2,"column":1},"end":{"line":2,"column":11}}, + "range":[15,25], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":9}}, + "range":[17,23], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":9}}, + "range":[17,23], + "name":"public", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":9}}, + "range":[17,23], + "name":"public", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ], + "typeAnnotation":null + }, + "right":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":16}}, + "range":[28,30], + "properties":[] + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-alias-assignment-strict.js b/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-alias-assignment-strict.js new file mode 100644 index 0000000..6e14570 --- /dev/null +++ b/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-alias-assignment-strict.js @@ -0,0 +1,2 @@ +"use strict"; +({ yield: x } = {}); diff --git a/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-alias-assignment-strict.tree.json b/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-alias-assignment-strict.tree.json new file mode 100644 index 0000000..26e70d3 --- /dev/null +++ b/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-alias-assignment-strict.tree.json @@ -0,0 +1,72 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":20}}, + "range":[0,34], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "value":"use strict", + "raw":"\"use strict\"" + }, + "directive":"use strict" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":20}}, + "range":[14,34], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":2,"column":1},"end":{"line":2,"column":18}}, + "range":[15,32], + "operator":"=", + "left":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":2,"column":1},"end":{"line":2,"column":13}}, + "range":[15,27], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":11}}, + "range":[17,25], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":8}}, + "range":[17,22], + "name":"yield", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, + "range":[24,25], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":false, + "computed":false + } + ], + "typeAnnotation":null + }, + "right":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":18}}, + "range":[30,32], + "properties":[] + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-alias-invalid-assignment-strict.js b/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-alias-invalid-assignment-strict.js new file mode 100644 index 0000000..c37bcb6 --- /dev/null +++ b/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-alias-invalid-assignment-strict.js @@ -0,0 +1,2 @@ +"use strict"; +({ yield: yield } = {}); diff --git a/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-alias-invalid-assignment-strict.tree.json b/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-alias-invalid-assignment-strict.tree.json new file mode 100644 index 0000000..a1eac2f --- /dev/null +++ b/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-alias-invalid-assignment-strict.tree.json @@ -0,0 +1,78 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":15}}, + "message":"Use of future reserved word in strict mode" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":24}}, + "range":[0,38], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "value":"use strict", + "raw":"\"use strict\"" + }, + "directive":"use strict" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":24}}, + "range":[14,38], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":2,"column":1},"end":{"line":2,"column":22}}, + "range":[15,36], + "operator":"=", + "left":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":2,"column":1},"end":{"line":2,"column":17}}, + "range":[15,31], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":15}}, + "range":[17,29], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":8}}, + "range":[17,22], + "name":"yield", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":15}}, + "range":[24,29], + "name":"yield", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":false, + "computed":false + } + ], + "typeAnnotation":null + }, + "right":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":2,"column":20},"end":{"line":2,"column":22}}, + "range":[34,36], + "properties":[] + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-assignment-strict.js b/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-assignment-strict.js new file mode 100644 index 0000000..a6c6c8f --- /dev/null +++ b/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-assignment-strict.js @@ -0,0 +1,2 @@ +"use strict"; +({ yield } = {}); diff --git a/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-assignment-strict.tree.json b/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-assignment-strict.tree.json new file mode 100644 index 0000000..dd3d091 --- /dev/null +++ b/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-assignment-strict.tree.json @@ -0,0 +1,78 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":8}}, + "message":"Use of future reserved word in strict mode" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":17}}, + "range":[0,31], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "value":"use strict", + "raw":"\"use strict\"" + }, + "directive":"use strict" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":17}}, + "range":[14,31], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":2,"column":1},"end":{"line":2,"column":15}}, + "range":[15,29], + "operator":"=", + "left":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":2,"column":1},"end":{"line":2,"column":10}}, + "range":[15,24], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":8}}, + "range":[17,22], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":8}}, + "range":[17,22], + "name":"yield", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":8}}, + "range":[17,22], + "name":"yield", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ], + "typeAnnotation":null + }, + "right":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":15}}, + "range":[27,29], + "properties":[] + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-binding-strict.js b/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-binding-strict.js new file mode 100644 index 0000000..4aaefe3 --- /dev/null +++ b/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-binding-strict.js @@ -0,0 +1,2 @@ +"use strict"; +var { yield } = {}; diff --git a/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-binding-strict.tree.json b/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-binding-strict.tree.json new file mode 100644 index 0000000..11fcfd1 --- /dev/null +++ b/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-binding-strict.tree.json @@ -0,0 +1,79 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":11}}, + "message":"Use of future reserved word in strict mode" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":19}}, + "range":[0,33], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "value":"use strict", + "raw":"\"use strict\"" + }, + "directive":"use strict" + }, + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":19}}, + "range":[14,33], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":18}}, + "range":[18,32], + "id":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":13}}, + "range":[18,27], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":11}}, + "range":[20,25], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":11}}, + "range":[20,25], + "name":"yield", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":11}}, + "range":[20,25], + "name":"yield", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ], + "typeAnnotation":null + }, + "init":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":18}}, + "range":[30,32], + "properties":[] + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-in-generator-strict.js b/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-in-generator-strict.js new file mode 100644 index 0000000..dc32f35 --- /dev/null +++ b/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-in-generator-strict.js @@ -0,0 +1,6 @@ +/* + * When [+Yield], `yield` isn't a valid IdentifierReference. + * #prod-AssignmentProperty -> #prod-IdentifierReference + */ +"use strict"; +(function*() { 0, { yield } = {}; }); diff --git a/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-in-generator-strict.tree.json b/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-in-generator-strict.tree.json new file mode 100644 index 0000000..c1c6a0c --- /dev/null +++ b/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-in-generator-strict.tree.json @@ -0,0 +1,125 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":6,"column":20},"end":{"line":6,"column":25}}, + "message":"Use of future reserved word in strict mode" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":6,"column":37}}, + "range":[125,176], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":13}}, + "range":[125,138], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":12}}, + "range":[125,137], + "value":"use strict", + "raw":"\"use strict\"" + }, + "directive":"use strict" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":6,"column":0},"end":{"line":6,"column":37}}, + "range":[139,176], + "expression":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":6,"column":1},"end":{"line":6,"column":35}}, + "range":[140,174], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":6,"column":13},"end":{"line":6,"column":35}}, + "range":[152,174], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":6,"column":15},"end":{"line":6,"column":33}}, + "range":[154,172], + "expression":{ + "type":"SequenceExpression", + "loc":{"source":null,"start":{"line":6,"column":15},"end":{"line":6,"column":32}}, + "range":[154,171], + "expressions":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":6,"column":15},"end":{"line":6,"column":16}}, + "range":[154,155], + "value":0, + "raw":"0" + }, + { + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":6,"column":18},"end":{"line":6,"column":32}}, + "range":[157,171], + "operator":"=", + "left":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":6,"column":18},"end":{"line":6,"column":27}}, + "range":[157,166], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":6,"column":20},"end":{"line":6,"column":25}}, + "range":[159,164], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":20},"end":{"line":6,"column":25}}, + "range":[159,164], + "name":"yield", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":20},"end":{"line":6,"column":25}}, + "range":[159,164], + "name":"yield", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ], + "typeAnnotation":null + }, + "right":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":6,"column":30},"end":{"line":6,"column":32}}, + "range":[169,171], + "properties":[] + } + } + ] + }, + "directive":null + } + ] + }, + "async":false, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "directive":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":3}}, + "range":[0,124], + "value":"\n * When [+Yield], `yield` isn't a valid IdentifierReference.\n * #prod-AssignmentProperty -> #prod-IdentifierReference\n " + } + ] +} diff --git a/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-in-generator.js b/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-in-generator.js new file mode 100644 index 0000000..2781dcd --- /dev/null +++ b/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-in-generator.js @@ -0,0 +1,5 @@ +/* + * When [+Yield], `yield` isn't a valid IdentifierReference. + * #prod-AssignmentProperty -> #prod-IdentifierReference + */ +(function*() { 0, { yield } = {}; }); diff --git a/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-in-generator.tree.json b/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-in-generator.tree.json new file mode 100644 index 0000000..877ee44 --- /dev/null +++ b/lib/test/flow/ES6/binding-pattern/object-pattern/yield-prop-in-generator.tree.json @@ -0,0 +1,112 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":5,"column":20},"end":{"line":5,"column":25}}, + "message":"`yield` is an invalid identifier in generators" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":37}}, + "range":[125,162], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":37}}, + "range":[125,162], + "expression":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":5,"column":1},"end":{"line":5,"column":35}}, + "range":[126,160], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":5,"column":13},"end":{"line":5,"column":35}}, + "range":[138,160], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":5,"column":15},"end":{"line":5,"column":33}}, + "range":[140,158], + "expression":{ + "type":"SequenceExpression", + "loc":{"source":null,"start":{"line":5,"column":15},"end":{"line":5,"column":32}}, + "range":[140,157], + "expressions":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":5,"column":15},"end":{"line":5,"column":16}}, + "range":[140,141], + "value":0, + "raw":"0" + }, + { + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":5,"column":18},"end":{"line":5,"column":32}}, + "range":[143,157], + "operator":"=", + "left":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":5,"column":18},"end":{"line":5,"column":27}}, + "range":[143,152], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":5,"column":20},"end":{"line":5,"column":25}}, + "range":[145,150], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":20},"end":{"line":5,"column":25}}, + "range":[145,150], + "name":"yield", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":20},"end":{"line":5,"column":25}}, + "range":[145,150], + "name":"yield", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ], + "typeAnnotation":null + }, + "right":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":5,"column":30},"end":{"line":5,"column":32}}, + "range":[155,157], + "properties":[] + } + } + ] + }, + "directive":null + } + ] + }, + "async":false, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "directive":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":3}}, + "range":[0,124], + "value":"\n * When [+Yield], `yield` isn't a valid IdentifierReference.\n * #prod-AssignmentProperty -> #prod-IdentifierReference\n " + } + ] +} diff --git a/lib/test/flow/ES6/computed_properties/migrated_0000.js b/lib/test/flow/ES6/computed_properties/migrated_0000.js new file mode 100644 index 0000000..360ab81 --- /dev/null +++ b/lib/test/flow/ES6/computed_properties/migrated_0000.js @@ -0,0 +1 @@ +({[x]}) diff --git a/lib/test/flow/ES6/computed_properties/migrated_0000.tree.json b/lib/test/flow/ES6/computed_properties/migrated_0000.tree.json new file mode 100644 index 0000000..ba9030d --- /dev/null +++ b/lib/test/flow/ES6/computed_properties/migrated_0000.tree.json @@ -0,0 +1,52 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":4}}, + "message":"Computed properties must have a value." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "expression":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "range":[1,6], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, + "range":[2,5], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":4}}, + "range":[3,4], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":4}}, + "range":[3,4], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":true + } + ] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/modules/export_default_class_implements.js b/lib/test/flow/ES6/modules/export_default_class_implements.js new file mode 100644 index 0000000..7fad7df --- /dev/null +++ b/lib/test/flow/ES6/modules/export_default_class_implements.js @@ -0,0 +1 @@ +export default class implements IFoo {} diff --git a/lib/test/flow/ES6/modules/export_default_class_implements.tree.json b/lib/test/flow/ES6/modules/export_default_class_implements.tree.json new file mode 100644 index 0000000..c824f7e --- /dev/null +++ b/lib/test/flow/ES6/modules/export_default_class_implements.tree.json @@ -0,0 +1,46 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "range":[0,39], + "body":[ + { + "type":"ExportDefaultDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "range":[0,39], + "declaration":{ + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":39}}, + "range":[15,39], + "id":null, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":39}}, + "range":[37,39], + "body":[] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[ + { + "type":"ClassImplements", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":36}}, + "range":[32,36], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":36}}, + "range":[32,36], + "name":"IFoo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ], + "decorators":[] + }, + "exportKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/modules/migrated_0000.js b/lib/test/flow/ES6/modules/migrated_0000.js new file mode 100644 index 0000000..c433d66 --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0000.js @@ -0,0 +1 @@ +export class {} diff --git a/lib/test/flow/ES6/modules/migrated_0000.tree.json b/lib/test/flow/ES6/modules/migrated_0000.tree.json new file mode 100644 index 0000000..94b1846 --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0000.tree.json @@ -0,0 +1,39 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":15}}, + "message":"When exporting a class as a named export, you must specify a class name. Did you mean `export default class ...`?" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "declaration":{ + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":15}}, + "range":[7,15], + "id":null, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, + "range":[13,15], + "body":[] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + "specifiers":[], + "source":null, + "exportKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/modules/migrated_0001.js b/lib/test/flow/ES6/modules/migrated_0001.js new file mode 100644 index 0000000..223d0a8 --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0001.js @@ -0,0 +1 @@ +export class Foo {} diff --git a/lib/test/flow/ES6/modules/migrated_0001.tree.json b/lib/test/flow/ES6/modules/migrated_0001.tree.json new file mode 100644 index 0000000..3873e50 --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0001.tree.json @@ -0,0 +1,40 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "range":[0,19], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "range":[0,19], + "declaration":{ + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":19}}, + "range":[7,19], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, + "range":[13,16], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, + "range":[17,19], + "body":[] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + "specifiers":[], + "source":null, + "exportKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/modules/migrated_0002.js b/lib/test/flow/ES6/modules/migrated_0002.js new file mode 100644 index 0000000..a6e68e9 --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0002.js @@ -0,0 +1 @@ +export default class {} diff --git a/lib/test/flow/ES6/modules/migrated_0002.tree.json b/lib/test/flow/ES6/modules/migrated_0002.tree.json new file mode 100644 index 0000000..553ae93 --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0002.tree.json @@ -0,0 +1,31 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "body":[ + { + "type":"ExportDefaultDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "declaration":{ + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":23}}, + "range":[15,23], + "id":null, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, + "range":[21,23], + "body":[] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + "exportKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/modules/migrated_0003.js b/lib/test/flow/ES6/modules/migrated_0003.js new file mode 100644 index 0000000..2eddcfb --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0003.js @@ -0,0 +1 @@ +export default class A {} diff --git a/lib/test/flow/ES6/modules/migrated_0003.tree.json b/lib/test/flow/ES6/modules/migrated_0003.tree.json new file mode 100644 index 0000000..795e23a --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0003.tree.json @@ -0,0 +1,38 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "body":[ + { + "type":"ExportDefaultDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "declaration":{ + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":25}}, + "range":[15,25], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, + "range":[23,25], + "body":[] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + "exportKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/modules/migrated_0004.js b/lib/test/flow/ES6/modules/migrated_0004.js new file mode 100644 index 0000000..6ab80bc --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0004.js @@ -0,0 +1 @@ +export default function() {} diff --git a/lib/test/flow/ES6/modules/migrated_0004.tree.json b/lib/test/flow/ES6/modules/migrated_0004.tree.json new file mode 100644 index 0000000..dd4c236 --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0004.tree.json @@ -0,0 +1,33 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "body":[ + { + "type":"ExportDefaultDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "declaration":{ + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":28}}, + "range":[15,28], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":28}}, + "range":[26,28], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "exportKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/modules/migrated_0005.js b/lib/test/flow/ES6/modules/migrated_0005.js new file mode 100644 index 0000000..c33f563 --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0005.js @@ -0,0 +1 @@ +export default function a() {} diff --git a/lib/test/flow/ES6/modules/migrated_0005.tree.json b/lib/test/flow/ES6/modules/migrated_0005.tree.json new file mode 100644 index 0000000..793fde9 --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0005.tree.json @@ -0,0 +1,40 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "body":[ + { + "type":"ExportDefaultDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "declaration":{ + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":30}}, + "range":[15,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, + "range":[24,25], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, + "range":[28,30], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "exportKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/modules/migrated_0006.js b/lib/test/flow/ES6/modules/migrated_0006.js new file mode 100644 index 0000000..932546d --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0006.js @@ -0,0 +1 @@ +export type A = number diff --git a/lib/test/flow/ES6/modules/migrated_0006.tree.json b/lib/test/flow/ES6/modules/migrated_0006.tree.json new file mode 100644 index 0000000..2ca48db --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0006.tree.json @@ -0,0 +1,35 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "declaration":{ + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":22}}, + "range":[7,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":22}}, + "range":[16,22] + } + }, + "specifiers":[], + "source":null, + "exportKind":"type" + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/modules/migrated_0007.js b/lib/test/flow/ES6/modules/migrated_0007.js new file mode 100644 index 0000000..7fd9c97 --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0007.js @@ -0,0 +1 @@ +export interface foo {p: number} diff --git a/lib/test/flow/ES6/modules/migrated_0007.tree.json b/lib/test/flow/ES6/modules/migrated_0007.tree.json new file mode 100644 index 0000000..ff7670d --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0007.tree.json @@ -0,0 +1,66 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "declaration":{ + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":32}}, + "range":[7,32], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":32}}, + "range":[21,32], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":31}}, + "range":[22,31], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, + "range":[22,23], + "name":"p", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":31}}, + "range":[25,31] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + }, + "specifiers":[], + "source":null, + "exportKind":"type" + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/modules/migrated_0008.js b/lib/test/flow/ES6/modules/migrated_0008.js new file mode 100644 index 0000000..6f743f1 --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0008.js @@ -0,0 +1 @@ +export * as foo from "bar" diff --git a/lib/test/flow/ES6/modules/migrated_0008.options.json b/lib/test/flow/ES6/modules/migrated_0008.options.json new file mode 100644 index 0000000..9364ccb --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0008.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_export_star_as": true +} \ No newline at end of file diff --git a/lib/test/flow/ES6/modules/migrated_0008.tree.json b/lib/test/flow/ES6/modules/migrated_0008.tree.json new file mode 100644 index 0000000..8c45bdf --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0008.tree.json @@ -0,0 +1,37 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "declaration":null, + "specifiers":[ + { + "type":"ExportNamespaceSpecifier", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "range":[7,8], + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":15}}, + "range":[12,15], + "name":"foo", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":26}}, + "range":[21,26], + "value":"bar", + "raw":"\"bar\"" + }, + "exportKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/modules/migrated_0009.js b/lib/test/flow/ES6/modules/migrated_0009.js new file mode 100644 index 0000000..eae11eb --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0009.js @@ -0,0 +1 @@ +export type * from "foo" diff --git a/lib/test/flow/ES6/modules/migrated_0009.tree.json b/lib/test/flow/ES6/modules/migrated_0009.tree.json new file mode 100644 index 0000000..e984200 --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0009.tree.json @@ -0,0 +1,21 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "body":[ + { + "type":"ExportAllDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":24}}, + "range":[19,24], + "value":"foo", + "raw":"\"foo\"" + }, + "exportKind":"type" + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/modules/migrated_0010.js b/lib/test/flow/ES6/modules/migrated_0010.js new file mode 100644 index 0000000..dd926eb --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0010.js @@ -0,0 +1,3 @@ +// Duplicate exports are an early/parse error +export let foo = 1; +export const foo = 2; diff --git a/lib/test/flow/ES6/modules/migrated_0010.tree.json b/lib/test/flow/ES6/modules/migrated_0010.tree.json new file mode 100644 index 0000000..18ec714 --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0010.tree.json @@ -0,0 +1,93 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":3,"column":13},"end":{"line":3,"column":16}}, + "message":"Duplicate export for `foo`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":3,"column":21}}, + "range":[46,87], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":19}}, + "range":[46,65], + "declaration":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":19}}, + "range":[53,65], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":18}}, + "range":[57,64], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":14}}, + "range":[57,60], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":18}}, + "range":[63,64], + "value":1, + "raw":"1" + } + } + ], + "kind":"let" + }, + "specifiers":[], + "source":null, + "exportKind":"value" + }, + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":21}}, + "range":[66,87], + "declaration":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":3,"column":7},"end":{"line":3,"column":21}}, + "range":[73,87], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":3,"column":13},"end":{"line":3,"column":20}}, + "range":[79,86], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":13},"end":{"line":3,"column":16}}, + "range":[79,82], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":19},"end":{"line":3,"column":20}}, + "range":[85,86], + "value":2, + "raw":"2" + } + } + ], + "kind":"const" + }, + "specifiers":[], + "source":null, + "exportKind":"value" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "range":[0,45], + "value":" Duplicate exports are an early/parse error" + } + ] +} diff --git a/lib/test/flow/ES6/modules/migrated_0011.js b/lib/test/flow/ES6/modules/migrated_0011.js new file mode 100644 index 0000000..42baccf --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0011.js @@ -0,0 +1,3 @@ +// Duplicate exports are an early/parse error +export const foo = 1; +export var foo = 2; diff --git a/lib/test/flow/ES6/modules/migrated_0011.tree.json b/lib/test/flow/ES6/modules/migrated_0011.tree.json new file mode 100644 index 0000000..a0a446f --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0011.tree.json @@ -0,0 +1,93 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":3,"column":11},"end":{"line":3,"column":14}}, + "message":"Duplicate export for `foo`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":3,"column":19}}, + "range":[46,87], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":21}}, + "range":[46,67], + "declaration":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":21}}, + "range":[53,67], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":20}}, + "range":[59,66], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":16}}, + "range":[59,62], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":20}}, + "range":[65,66], + "value":1, + "raw":"1" + } + } + ], + "kind":"const" + }, + "specifiers":[], + "source":null, + "exportKind":"value" + }, + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":19}}, + "range":[68,87], + "declaration":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":3,"column":7},"end":{"line":3,"column":19}}, + "range":[75,87], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":3,"column":11},"end":{"line":3,"column":18}}, + "range":[79,86], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":11},"end":{"line":3,"column":14}}, + "range":[79,82], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":17},"end":{"line":3,"column":18}}, + "range":[85,86], + "value":2, + "raw":"2" + } + } + ], + "kind":"var" + }, + "specifiers":[], + "source":null, + "exportKind":"value" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "range":[0,45], + "value":" Duplicate exports are an early/parse error" + } + ] +} diff --git a/lib/test/flow/ES6/modules/migrated_0012.js b/lib/test/flow/ES6/modules/migrated_0012.js new file mode 100644 index 0000000..c96d256 --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0012.js @@ -0,0 +1,3 @@ +// Duplicate exports are an early/parse error +export var foo = 1; +export let foo = 2; diff --git a/lib/test/flow/ES6/modules/migrated_0012.tree.json b/lib/test/flow/ES6/modules/migrated_0012.tree.json new file mode 100644 index 0000000..b86b31a --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0012.tree.json @@ -0,0 +1,93 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":3,"column":11},"end":{"line":3,"column":14}}, + "message":"Duplicate export for `foo`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":3,"column":19}}, + "range":[46,85], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":19}}, + "range":[46,65], + "declaration":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":19}}, + "range":[53,65], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":18}}, + "range":[57,64], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":14}}, + "range":[57,60], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":18}}, + "range":[63,64], + "value":1, + "raw":"1" + } + } + ], + "kind":"var" + }, + "specifiers":[], + "source":null, + "exportKind":"value" + }, + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":19}}, + "range":[66,85], + "declaration":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":3,"column":7},"end":{"line":3,"column":19}}, + "range":[73,85], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":3,"column":11},"end":{"line":3,"column":18}}, + "range":[77,84], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":11},"end":{"line":3,"column":14}}, + "range":[77,80], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":17},"end":{"line":3,"column":18}}, + "range":[83,84], + "value":2, + "raw":"2" + } + } + ], + "kind":"let" + }, + "specifiers":[], + "source":null, + "exportKind":"value" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "range":[0,45], + "value":" Duplicate exports are an early/parse error" + } + ] +} diff --git a/lib/test/flow/ES6/modules/migrated_0013.js b/lib/test/flow/ES6/modules/migrated_0013.js new file mode 100644 index 0000000..8ac2512 --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0013.js @@ -0,0 +1,3 @@ +// Duplicate exports are an early/parse error +export function foo() {}; +export var foo = 1; diff --git a/lib/test/flow/ES6/modules/migrated_0013.tree.json b/lib/test/flow/ES6/modules/migrated_0013.tree.json new file mode 100644 index 0000000..f644936 --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0013.tree.json @@ -0,0 +1,96 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":3,"column":11},"end":{"line":3,"column":14}}, + "message":"Duplicate export for `foo`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":3,"column":19}}, + "range":[46,91], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":24}}, + "range":[46,70], + "declaration":{ + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":24}}, + "range":[53,70], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":19}}, + "range":[62,65], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":22},"end":{"line":2,"column":24}}, + "range":[68,70], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "specifiers":[], + "source":null, + "exportKind":"value" + }, + { + "type":"EmptyStatement", + "loc":{"source":null,"start":{"line":2,"column":24},"end":{"line":2,"column":25}}, + "range":[70,71] + }, + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":19}}, + "range":[72,91], + "declaration":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":3,"column":7},"end":{"line":3,"column":19}}, + "range":[79,91], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":3,"column":11},"end":{"line":3,"column":18}}, + "range":[83,90], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":11},"end":{"line":3,"column":14}}, + "range":[83,86], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":17},"end":{"line":3,"column":18}}, + "range":[89,90], + "value":1, + "raw":"1" + } + } + ], + "kind":"var" + }, + "specifiers":[], + "source":null, + "exportKind":"value" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "range":[0,45], + "value":" Duplicate exports are an early/parse error" + } + ] +} diff --git a/lib/test/flow/ES6/modules/migrated_0014.js b/lib/test/flow/ES6/modules/migrated_0014.js new file mode 100644 index 0000000..9e569cc --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0014.js @@ -0,0 +1,3 @@ +// Duplicate exports are an early/parse error +export function foo() {}; +export async function foo() {}; diff --git a/lib/test/flow/ES6/modules/migrated_0014.tree.json b/lib/test/flow/ES6/modules/migrated_0014.tree.json new file mode 100644 index 0000000..3a2e1f2 --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0014.tree.json @@ -0,0 +1,99 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":3,"column":7},"end":{"line":3,"column":30}}, + "message":"Duplicate export for `foo`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":3,"column":31}}, + "range":[46,103], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":24}}, + "range":[46,70], + "declaration":{ + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":24}}, + "range":[53,70], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":19}}, + "range":[62,65], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":22},"end":{"line":2,"column":24}}, + "range":[68,70], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "specifiers":[], + "source":null, + "exportKind":"value" + }, + { + "type":"EmptyStatement", + "loc":{"source":null,"start":{"line":2,"column":24},"end":{"line":2,"column":25}}, + "range":[70,71] + }, + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":30}}, + "range":[72,102], + "declaration":{ + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":3,"column":7},"end":{"line":3,"column":30}}, + "range":[79,102], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":22},"end":{"line":3,"column":25}}, + "range":[94,97], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":28},"end":{"line":3,"column":30}}, + "range":[100,102], + "body":[] + }, + "async":true, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "specifiers":[], + "source":null, + "exportKind":"value" + }, + { + "type":"EmptyStatement", + "loc":{"source":null,"start":{"line":3,"column":30},"end":{"line":3,"column":31}}, + "range":[102,103] + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "range":[0,45], + "value":" Duplicate exports are an early/parse error" + } + ] +} diff --git a/lib/test/flow/ES6/modules/migrated_0015.js b/lib/test/flow/ES6/modules/migrated_0015.js new file mode 100644 index 0000000..70449fb --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0015.js @@ -0,0 +1,3 @@ +// Duplicate exports are an early/parse error +export function foo() {}; +export class foo {}; diff --git a/lib/test/flow/ES6/modules/migrated_0015.tree.json b/lib/test/flow/ES6/modules/migrated_0015.tree.json new file mode 100644 index 0000000..341599d --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0015.tree.json @@ -0,0 +1,97 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":3,"column":7},"end":{"line":3,"column":19}}, + "message":"Duplicate export for `foo`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":3,"column":20}}, + "range":[46,92], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":24}}, + "range":[46,70], + "declaration":{ + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":24}}, + "range":[53,70], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":19}}, + "range":[62,65], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":22},"end":{"line":2,"column":24}}, + "range":[68,70], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "specifiers":[], + "source":null, + "exportKind":"value" + }, + { + "type":"EmptyStatement", + "loc":{"source":null,"start":{"line":2,"column":24},"end":{"line":2,"column":25}}, + "range":[70,71] + }, + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":19}}, + "range":[72,91], + "declaration":{ + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":3,"column":7},"end":{"line":3,"column":19}}, + "range":[79,91], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":13},"end":{"line":3,"column":16}}, + "range":[85,88], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":3,"column":17},"end":{"line":3,"column":19}}, + "range":[89,91], + "body":[] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + "specifiers":[], + "source":null, + "exportKind":"value" + }, + { + "type":"EmptyStatement", + "loc":{"source":null,"start":{"line":3,"column":19},"end":{"line":3,"column":20}}, + "range":[91,92] + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "range":[0,45], + "value":" Duplicate exports are an early/parse error" + } + ] +} diff --git a/lib/test/flow/ES6/modules/migrated_0016.js b/lib/test/flow/ES6/modules/migrated_0016.js new file mode 100644 index 0000000..8a9b2ff --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0016.js @@ -0,0 +1,3 @@ +// Duplicate exports are an early/parse error +export {foo}; +export {foo}; diff --git a/lib/test/flow/ES6/modules/migrated_0016.tree.json b/lib/test/flow/ES6/modules/migrated_0016.tree.json new file mode 100644 index 0000000..6e99c1e --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0016.tree.json @@ -0,0 +1,83 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":11}}, + "message":"Duplicate export for `foo`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":3,"column":13}}, + "range":[46,73], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":13}}, + "range":[46,59], + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":11}}, + "range":[54,57], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":11}}, + "range":[54,57], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":11}}, + "range":[54,57], + "name":"foo", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":null, + "exportKind":"value" + }, + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":13}}, + "range":[60,73], + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":11}}, + "range":[68,71], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":11}}, + "range":[68,71], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":11}}, + "range":[68,71], + "name":"foo", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":null, + "exportKind":"value" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "range":[0,45], + "value":" Duplicate exports are an early/parse error" + } + ] +} diff --git a/lib/test/flow/ES6/modules/migrated_0017.js b/lib/test/flow/ES6/modules/migrated_0017.js new file mode 100644 index 0000000..86f04b7 --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0017.js @@ -0,0 +1,3 @@ +// Duplicate exports are an early/parse error +export {foo as bar}; +export {bar}; diff --git a/lib/test/flow/ES6/modules/migrated_0017.tree.json b/lib/test/flow/ES6/modules/migrated_0017.tree.json new file mode 100644 index 0000000..b5e7362 --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0017.tree.json @@ -0,0 +1,83 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":11}}, + "message":"Duplicate export for `bar`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":3,"column":13}}, + "range":[46,80], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":20}}, + "range":[46,66], + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":18}}, + "range":[54,64], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":11}}, + "range":[54,57], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":15},"end":{"line":2,"column":18}}, + "range":[61,64], + "name":"bar", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":null, + "exportKind":"value" + }, + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":13}}, + "range":[67,80], + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":11}}, + "range":[75,78], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":11}}, + "range":[75,78], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":11}}, + "range":[75,78], + "name":"bar", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":null, + "exportKind":"value" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "range":[0,45], + "value":" Duplicate exports are an early/parse error" + } + ] +} diff --git a/lib/test/flow/ES6/modules/migrated_0018.js b/lib/test/flow/ES6/modules/migrated_0018.js new file mode 100644 index 0000000..ab79258 --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0018.js @@ -0,0 +1,3 @@ +// Duplicate exports are an early/parse error +export default 42; +export default 43; diff --git a/lib/test/flow/ES6/modules/migrated_0018.tree.json b/lib/test/flow/ES6/modules/migrated_0018.tree.json new file mode 100644 index 0000000..8d42e4e --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0018.tree.json @@ -0,0 +1,47 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":17}}, + "message":"Duplicate export for `default`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":3,"column":18}}, + "range":[46,83], + "body":[ + { + "type":"ExportDefaultDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":18}}, + "range":[46,64], + "declaration":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":15},"end":{"line":2,"column":17}}, + "range":[61,63], + "value":42, + "raw":"42" + }, + "exportKind":"value" + }, + { + "type":"ExportDefaultDeclaration", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":18}}, + "range":[65,83], + "declaration":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":15},"end":{"line":3,"column":17}}, + "range":[80,82], + "value":43, + "raw":"43" + }, + "exportKind":"value" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "range":[0,45], + "value":" Duplicate exports are an early/parse error" + } + ] +} diff --git a/lib/test/flow/ES6/modules/migrated_0019.js b/lib/test/flow/ES6/modules/migrated_0019.js new file mode 100644 index 0000000..bd146ad --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0019.js @@ -0,0 +1 @@ +export function foo() { var foo = 42; } diff --git a/lib/test/flow/ES6/modules/migrated_0019.tree.json b/lib/test/flow/ES6/modules/migrated_0019.tree.json new file mode 100644 index 0000000..523cf4f --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0019.tree.json @@ -0,0 +1,71 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "range":[0,39], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "range":[0,39], + "declaration":{ + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":39}}, + "range":[7,39], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":19}}, + "range":[16,19], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":39}}, + "range":[22,39], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":37}}, + "range":[24,37], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":36}}, + "range":[28,36], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":31}}, + "range":[28,31], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":36}}, + "range":[34,36], + "value":42, + "raw":"42" + } + } + ], + "kind":"var" + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "specifiers":[], + "source":null, + "exportKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/modules/migrated_0020.js b/lib/test/flow/ES6/modules/migrated_0020.js new file mode 100644 index 0000000..45690cf --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0020.js @@ -0,0 +1 @@ +export {foo as bar}; export {foo}; diff --git a/lib/test/flow/ES6/modules/migrated_0020.tree.json b/lib/test/flow/ES6/modules/migrated_0020.tree.json new file mode 100644 index 0000000..1d92047 --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0020.tree.json @@ -0,0 +1,70 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "range":[0,34], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":18}}, + "range":[8,18], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":11}}, + "range":[8,11], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, + "range":[15,18], + "name":"bar", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":null, + "exportKind":"value" + }, + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":34}}, + "range":[21,34], + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":32}}, + "range":[29,32], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":32}}, + "range":[29,32], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":32}}, + "range":[29,32], + "name":"foo", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":null, + "exportKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/modules/migrated_0021.js b/lib/test/flow/ES6/modules/migrated_0021.js new file mode 100644 index 0000000..00c9799 --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0021.js @@ -0,0 +1 @@ +export default (foo = 42); export let foo = 43; diff --git a/lib/test/flow/ES6/modules/migrated_0021.tree.json b/lib/test/flow/ES6/modules/migrated_0021.tree.json new file mode 100644 index 0000000..a48ade7 --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0021.tree.json @@ -0,0 +1,71 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "range":[0,47], + "body":[ + { + "type":"ExportDefaultDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "declaration":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":24}}, + "range":[16,24], + "operator":"=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":19}}, + "range":[16,19], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, + "range":[22,24], + "value":42, + "raw":"42" + } + }, + "exportKind":"value" + }, + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":47}}, + "range":[27,47], + "declaration":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":47}}, + "range":[34,47], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":46}}, + "range":[38,46], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":41}}, + "range":[38,41], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":44},"end":{"line":1,"column":46}}, + "range":[44,46], + "value":43, + "raw":"43" + } + } + ], + "kind":"let" + }, + "specifiers":[], + "source":null, + "exportKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/modules/migrated_0022.js b/lib/test/flow/ES6/modules/migrated_0022.js new file mode 100644 index 0000000..23f2811 --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0022.js @@ -0,0 +1 @@ +export let bar = 43; export let foo = (bar = 43) diff --git a/lib/test/flow/ES6/modules/migrated_0022.tree.json b/lib/test/flow/ES6/modules/migrated_0022.tree.json new file mode 100644 index 0000000..18ff1d1 --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0022.tree.json @@ -0,0 +1,94 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "range":[0,48], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "declaration":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":20}}, + "range":[7,20], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":19}}, + "range":[11,19], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "range":[11,14], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, + "range":[17,19], + "value":43, + "raw":"43" + } + } + ], + "kind":"let" + }, + "specifiers":[], + "source":null, + "exportKind":"value" + }, + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":48}}, + "range":[21,48], + "declaration":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":48}}, + "range":[28,48], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":48}}, + "range":[32,48], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":35}}, + "range":[32,35], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":47}}, + "range":[39,47], + "operator":"=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":42}}, + "range":[39,42], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":45},"end":{"line":1,"column":47}}, + "range":[45,47], + "value":43, + "raw":"43" + } + } + } + ], + "kind":"let" + }, + "specifiers":[], + "source":null, + "exportKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/modules/migrated_0023.js b/lib/test/flow/ES6/modules/migrated_0023.js new file mode 100644 index 0000000..a07888a --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0023.js @@ -0,0 +1 @@ +export default function(arg:T):T {return arg;} diff --git a/lib/test/flow/ES6/modules/migrated_0023.tree.json b/lib/test/flow/ES6/modules/migrated_0023.tree.json new file mode 100644 index 0000000..5b7097e --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0023.tree.json @@ -0,0 +1,107 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "range":[0,49], + "body":[ + { + "type":"ExportDefaultDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "range":[0,49], + "declaration":{ + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":49}}, + "range":[15,49], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":32}}, + "range":[27,32], + "name":"arg", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":32}}, + "range":[30,32], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":32}}, + "range":[31,32], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":32}}, + "range":[31,32], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":49}}, + "range":[36,49], + "body":[ + { + "type":"ReturnStatement", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":48}}, + "range":[37,48], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":44},"end":{"line":1,"column":47}}, + "range":[44,47], + "name":"arg", + "typeAnnotation":null, + "optional":false + } + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":35}}, + "range":[33,35], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, + "range":[34,35], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, + "range":[34,35], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":26}}, + "range":[23,26], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, + "range":[24,25], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "exportKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/modules/migrated_0024.js b/lib/test/flow/ES6/modules/migrated_0024.js new file mode 100644 index 0000000..0959537 --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0024.js @@ -0,0 +1 @@ +export default class{} diff --git a/lib/test/flow/ES6/modules/migrated_0024.tree.json b/lib/test/flow/ES6/modules/migrated_0024.tree.json new file mode 100644 index 0000000..93e4f60 --- /dev/null +++ b/lib/test/flow/ES6/modules/migrated_0024.tree.json @@ -0,0 +1,46 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "body":[ + { + "type":"ExportDefaultDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "declaration":{ + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":25}}, + "range":[15,25], + "id":null, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, + "range":[23,25], + "body":[] + }, + "superClass":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":23}}, + "range":[20,23], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + "exportKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/object_short_notation/migrated_0000.js b/lib/test/flow/ES6/object_short_notation/migrated_0000.js new file mode 100644 index 0000000..0da8a85 --- /dev/null +++ b/lib/test/flow/ES6/object_short_notation/migrated_0000.js @@ -0,0 +1 @@ +let get = 123; let x = { get }; diff --git a/lib/test/flow/ES6/object_short_notation/migrated_0000.tree.json b/lib/test/flow/ES6/object_short_notation/migrated_0000.tree.json new file mode 100644 index 0000000..76a8ae9 --- /dev/null +++ b/lib/test/flow/ES6/object_short_notation/migrated_0000.tree.json @@ -0,0 +1,89 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, + "range":[4,13], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "range":[4,7], + "name":"get", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, + "range":[10,13], + "value":123, + "raw":"123" + } + } + ], + "kind":"let" + }, + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":31}}, + "range":[15,31], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":30}}, + "range":[19,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "range":[19,20], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":30}}, + "range":[23,30], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":28}}, + "range":[25,28], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":28}}, + "range":[25,28], + "name":"get", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":28}}, + "range":[25,28], + "name":"get", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ] + } + } + ], + "kind":"let" + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/object_short_notation/migrated_0001.js b/lib/test/flow/ES6/object_short_notation/migrated_0001.js new file mode 100644 index 0000000..7dcf20e --- /dev/null +++ b/lib/test/flow/ES6/object_short_notation/migrated_0001.js @@ -0,0 +1 @@ +let set = 123; let x = { set }; diff --git a/lib/test/flow/ES6/object_short_notation/migrated_0001.tree.json b/lib/test/flow/ES6/object_short_notation/migrated_0001.tree.json new file mode 100644 index 0000000..fd372be --- /dev/null +++ b/lib/test/flow/ES6/object_short_notation/migrated_0001.tree.json @@ -0,0 +1,89 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, + "range":[4,13], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "range":[4,7], + "name":"set", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, + "range":[10,13], + "value":123, + "raw":"123" + } + } + ], + "kind":"let" + }, + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":31}}, + "range":[15,31], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":30}}, + "range":[19,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "range":[19,20], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":30}}, + "range":[23,30], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":28}}, + "range":[25,28], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":28}}, + "range":[25,28], + "name":"set", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":28}}, + "range":[25,28], + "name":"set", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ] + } + } + ], + "kind":"let" + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/object_short_notation/migrated_0002.js b/lib/test/flow/ES6/object_short_notation/migrated_0002.js new file mode 100644 index 0000000..6bb3abc --- /dev/null +++ b/lib/test/flow/ES6/object_short_notation/migrated_0002.js @@ -0,0 +1 @@ +let get = 123, set = 234; let x = { get, set }; diff --git a/lib/test/flow/ES6/object_short_notation/migrated_0002.tree.json b/lib/test/flow/ES6/object_short_notation/migrated_0002.tree.json new file mode 100644 index 0000000..9a5f9f9 --- /dev/null +++ b/lib/test/flow/ES6/object_short_notation/migrated_0002.tree.json @@ -0,0 +1,134 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "range":[0,47], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, + "range":[4,13], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "range":[4,7], + "name":"get", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, + "range":[10,13], + "value":123, + "raw":"123" + } + }, + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":24}}, + "range":[15,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, + "range":[15,18], + "name":"set", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":24}}, + "range":[21,24], + "value":234, + "raw":"234" + } + } + ], + "kind":"let" + }, + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":47}}, + "range":[26,47], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":46}}, + "range":[30,46], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":31}}, + "range":[30,31], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":46}}, + "range":[34,46], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":39}}, + "range":[36,39], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":39}}, + "range":[36,39], + "name":"get", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":39}}, + "range":[36,39], + "name":"get", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + }, + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":44}}, + "range":[41,44], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":44}}, + "range":[41,44], + "name":"set", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":44}}, + "range":[41,44], + "name":"set", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ] + } + } + ], + "kind":"let" + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/octal-integer-literal/migrated_0000.js b/lib/test/flow/ES6/octal-integer-literal/migrated_0000.js new file mode 100644 index 0000000..834603b --- /dev/null +++ b/lib/test/flow/ES6/octal-integer-literal/migrated_0000.js @@ -0,0 +1 @@ +0O2 diff --git a/lib/test/flow/ES6/octal-integer-literal/migrated_0000.tree.json b/lib/test/flow/ES6/octal-integer-literal/migrated_0000.tree.json new file mode 100644 index 0000000..a2e5477 --- /dev/null +++ b/lib/test/flow/ES6/octal-integer-literal/migrated_0000.tree.json @@ -0,0 +1,21 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "value":2, + "raw":"0O2" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/octal-integer-literal/migrated_0001.js b/lib/test/flow/ES6/octal-integer-literal/migrated_0001.js new file mode 100644 index 0000000..44b5454 --- /dev/null +++ b/lib/test/flow/ES6/octal-integer-literal/migrated_0001.js @@ -0,0 +1 @@ +0O12 diff --git a/lib/test/flow/ES6/octal-integer-literal/migrated_0001.tree.json b/lib/test/flow/ES6/octal-integer-literal/migrated_0001.tree.json new file mode 100644 index 0000000..7990a47 --- /dev/null +++ b/lib/test/flow/ES6/octal-integer-literal/migrated_0001.tree.json @@ -0,0 +1,21 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "value":10, + "raw":"0O12" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/octal-integer-literal/migrated_0002.js b/lib/test/flow/ES6/octal-integer-literal/migrated_0002.js new file mode 100644 index 0000000..ca79cb0 --- /dev/null +++ b/lib/test/flow/ES6/octal-integer-literal/migrated_0002.js @@ -0,0 +1 @@ +function test() {'use strict'; 0O0; } diff --git a/lib/test/flow/ES6/octal-integer-literal/migrated_0002.tree.json b/lib/test/flow/ES6/octal-integer-literal/migrated_0002.tree.json new file mode 100644 index 0000000..1078138 --- /dev/null +++ b/lib/test/flow/ES6/octal-integer-literal/migrated_0002.tree.json @@ -0,0 +1,61 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "range":[0,37], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "range":[0,37], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, + "range":[9,13], + "name":"test", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":37}}, + "range":[16,37], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":30}}, + "range":[17,30], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":29}}, + "range":[17,29], + "value":"use strict", + "raw":"'use strict'" + }, + "directive":"use strict" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":35}}, + "range":[31,35], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":34}}, + "range":[31,34], + "value":0, + "raw":"0O0" + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/super-property/super-call-in-static-constructor.js b/lib/test/flow/ES6/super-property/super-call-in-static-constructor.js new file mode 100644 index 0000000..c3b4299 --- /dev/null +++ b/lib/test/flow/ES6/super-property/super-call-in-static-constructor.js @@ -0,0 +1 @@ +class C { static constructor() { super() } } diff --git a/lib/test/flow/ES6/super-property/super-call-in-static-constructor.tree.json b/lib/test/flow/ES6/super-property/super-call-in-static-constructor.tree.json new file mode 100644 index 0000000..2af387c --- /dev/null +++ b/lib/test/flow/ES6/super-property/super-call-in-static-constructor.tree.json @@ -0,0 +1,96 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":38}}, + "message":"`super()` is only valid in a class constructor" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, + "range":[0,44], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, + "range":[0,44], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":44}}, + "range":[8,44], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":42}}, + "range":[10,42], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":28}}, + "range":[17,28], + "name":"constructor", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":42}}, + "range":[28,42], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":42}}, + "range":[31,42], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":40}}, + "range":[33,40], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":40}}, + "range":[33,40], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":38}}, + "range":[33,38], + "name":"super", + "typeAnnotation":null, + "optional":false + }, + "arguments":[] + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":true, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/yield/invalid-yield-expression.js b/lib/test/flow/ES6/yield/invalid-yield-expression.js new file mode 100644 index 0000000..e88270d --- /dev/null +++ b/lib/test/flow/ES6/yield/invalid-yield-expression.js @@ -0,0 +1 @@ +(function() { yield 3; }) diff --git a/lib/test/flow/ES6/yield/invalid-yield-expression.tree.json b/lib/test/flow/ES6/yield/invalid-yield-expression.tree.json new file mode 100644 index 0000000..db674ae --- /dev/null +++ b/lib/test/flow/ES6/yield/invalid-yield-expression.tree.json @@ -0,0 +1,67 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "message":"Unexpected number, expected the end of an expression statement (`;`)" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "expression":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":24}}, + "range":[1,24], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":24}}, + "range":[12,24], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, + "range":[14,19], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, + "range":[14,19], + "name":"yield", + "typeAnnotation":null, + "optional":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "range":[20,22], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "value":3, + "raw":"3" + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/yield/invalid-yield-ident-arrow-param-strict.js b/lib/test/flow/ES6/yield/invalid-yield-ident-arrow-param-strict.js new file mode 100644 index 0000000..bdb6c57 --- /dev/null +++ b/lib/test/flow/ES6/yield/invalid-yield-ident-arrow-param-strict.js @@ -0,0 +1,2 @@ +"use strict"; +let f = (x = yield) => {} diff --git a/lib/test/flow/ES6/yield/invalid-yield-ident-arrow-param-strict.tree.json b/lib/test/flow/ES6/yield/invalid-yield-ident-arrow-param-strict.tree.json new file mode 100644 index 0000000..e5ceea5 --- /dev/null +++ b/lib/test/flow/ES6/yield/invalid-yield-ident-arrow-param-strict.tree.json @@ -0,0 +1,89 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":18}}, + "message":"Use of future reserved word in strict mode" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":25}}, + "range":[0,39], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "value":"use strict", + "raw":"\"use strict\"" + }, + "directive":"use strict" + }, + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":25}}, + "range":[14,39], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":25}}, + "range":[18,39], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":5}}, + "range":[18,19], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":25}}, + "range":[22,39], + "id":null, + "params":[ + { + "type":"AssignmentPattern", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":18}}, + "range":[23,32], + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, + "range":[23,24], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":18}}, + "range":[27,32], + "name":"yield", + "typeAnnotation":null, + "optional":false + } + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":23},"end":{"line":2,"column":25}}, + "range":[37,39], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + } + ], + "kind":"let" + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/yield/invalid-yield-ident-assign-strict.js b/lib/test/flow/ES6/yield/invalid-yield-ident-assign-strict.js new file mode 100644 index 0000000..7f6cab4 --- /dev/null +++ b/lib/test/flow/ES6/yield/invalid-yield-ident-assign-strict.js @@ -0,0 +1,2 @@ +"use strict"; +let f = (x = yield); diff --git a/lib/test/flow/ES6/yield/invalid-yield-ident-assign-strict.tree.json b/lib/test/flow/ES6/yield/invalid-yield-ident-assign-strict.tree.json new file mode 100644 index 0000000..24d610e --- /dev/null +++ b/lib/test/flow/ES6/yield/invalid-yield-ident-assign-strict.tree.json @@ -0,0 +1,70 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":18}}, + "message":"Use of future reserved word in strict mode" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":20}}, + "range":[0,34], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "value":"use strict", + "raw":"\"use strict\"" + }, + "directive":"use strict" + }, + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":20}}, + "range":[14,34], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":19}}, + "range":[18,33], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":5}}, + "range":[18,19], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":18}}, + "range":[23,32], + "operator":"=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, + "range":[23,24], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":18}}, + "range":[27,32], + "name":"yield", + "typeAnnotation":null, + "optional":false + } + } + } + ], + "kind":"let" + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/yield/invalid-yield-ident-dstr-strict.js b/lib/test/flow/ES6/yield/invalid-yield-ident-dstr-strict.js new file mode 100644 index 0000000..bc0ff28 --- /dev/null +++ b/lib/test/flow/ES6/yield/invalid-yield-ident-dstr-strict.js @@ -0,0 +1,2 @@ +"use strict"; +for ({ x: x = yield } of [{}]) ; diff --git a/lib/test/flow/ES6/yield/invalid-yield-ident-dstr-strict.tree.json b/lib/test/flow/ES6/yield/invalid-yield-ident-dstr-strict.tree.json new file mode 100644 index 0000000..688ceea --- /dev/null +++ b/lib/test/flow/ES6/yield/invalid-yield-ident-dstr-strict.tree.json @@ -0,0 +1,97 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":19}}, + "message":"Use of future reserved word in strict mode" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":32}}, + "range":[0,46], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "value":"use strict", + "raw":"\"use strict\"" + }, + "directive":"use strict" + }, + { + "type":"ForOfStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":32}}, + "range":[14,46], + "left":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":21}}, + "range":[19,35], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":19}}, + "range":[21,33], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":8}}, + "range":[21,22], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"AssignmentPattern", + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":19}}, + "range":[24,33], + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, + "range":[24,25], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":19}}, + "range":[28,33], + "name":"yield", + "typeAnnotation":null, + "optional":false + } + }, + "kind":"init", + "method":false, + "shorthand":false, + "computed":false + } + ], + "typeAnnotation":null + }, + "right":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":2,"column":25},"end":{"line":2,"column":29}}, + "range":[39,43], + "elements":[ + { + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":2,"column":26},"end":{"line":2,"column":28}}, + "range":[40,42], + "properties":[] + } + ] + }, + "body":{ + "type":"EmptyStatement", + "loc":{"source":null,"start":{"line":2,"column":31},"end":{"line":2,"column":32}}, + "range":[45,46] + }, + "await":false + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/yield/invalid-yield-ident-func-param-strict.js b/lib/test/flow/ES6/yield/invalid-yield-ident-func-param-strict.js new file mode 100644 index 0000000..5e18e11 --- /dev/null +++ b/lib/test/flow/ES6/yield/invalid-yield-ident-func-param-strict.js @@ -0,0 +1,2 @@ +"use strict"; +function f(x = yield) {} diff --git a/lib/test/flow/ES6/yield/invalid-yield-ident-func-param-strict.tree.json b/lib/test/flow/ES6/yield/invalid-yield-ident-func-param-strict.tree.json new file mode 100644 index 0000000..0858cac --- /dev/null +++ b/lib/test/flow/ES6/yield/invalid-yield-ident-func-param-strict.tree.json @@ -0,0 +1,75 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":15},"end":{"line":2,"column":20}}, + "message":"Use of future reserved word in strict mode" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":24}}, + "range":[0,38], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "value":"use strict", + "raw":"\"use strict\"" + }, + "directive":"use strict" + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":24}}, + "range":[14,38], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, + "range":[23,24], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"AssignmentPattern", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":20}}, + "range":[25,34], + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":12}}, + "range":[25,26], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":15},"end":{"line":2,"column":20}}, + "range":[29,34], + "name":"yield", + "typeAnnotation":null, + "optional":false + } + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":22},"end":{"line":2,"column":24}}, + "range":[36,38], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/yield/migrated_0000.js b/lib/test/flow/ES6/yield/migrated_0000.js new file mode 100644 index 0000000..8b46a9c --- /dev/null +++ b/lib/test/flow/ES6/yield/migrated_0000.js @@ -0,0 +1,3 @@ +function *f() { + yield foo; +} diff --git a/lib/test/flow/ES6/yield/migrated_0000.tree.json b/lib/test/flow/ES6/yield/migrated_0000.tree.json new file mode 100644 index 0000000..f8682c4 --- /dev/null +++ b/lib/test/flow/ES6/yield/migrated_0000.tree.json @@ -0,0 +1,55 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,30], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":3,"column":1}}, + "range":[14,30], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, + "range":[18,28], + "expression":{ + "type":"YieldExpression", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":11}}, + "range":[18,27], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":11}}, + "range":[24,27], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "delegate":false + }, + "directive":null + } + ] + }, + "async":false, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/yield/migrated_0001.js b/lib/test/flow/ES6/yield/migrated_0001.js new file mode 100644 index 0000000..19b601d --- /dev/null +++ b/lib/test/flow/ES6/yield/migrated_0001.js @@ -0,0 +1,3 @@ +function *f() { + yield* foo; +} diff --git a/lib/test/flow/ES6/yield/migrated_0001.tree.json b/lib/test/flow/ES6/yield/migrated_0001.tree.json new file mode 100644 index 0000000..77cd82d --- /dev/null +++ b/lib/test/flow/ES6/yield/migrated_0001.tree.json @@ -0,0 +1,55 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,31], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":3,"column":1}}, + "range":[14,31], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, + "range":[18,29], + "expression":{ + "type":"YieldExpression", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, + "range":[18,28], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":12}}, + "range":[25,28], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "delegate":true + }, + "directive":null + } + ] + }, + "async":false, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/yield/migrated_0002.js b/lib/test/flow/ES6/yield/migrated_0002.js new file mode 100644 index 0000000..22bf9b5 --- /dev/null +++ b/lib/test/flow/ES6/yield/migrated_0002.js @@ -0,0 +1,3 @@ +function *f() { + yield; +} diff --git a/lib/test/flow/ES6/yield/migrated_0002.tree.json b/lib/test/flow/ES6/yield/migrated_0002.tree.json new file mode 100644 index 0000000..fcb4b06 --- /dev/null +++ b/lib/test/flow/ES6/yield/migrated_0002.tree.json @@ -0,0 +1,48 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,26], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,26], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":3,"column":1}}, + "range":[14,26], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":8}}, + "range":[18,24], + "expression":{ + "type":"YieldExpression", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":7}}, + "range":[18,23], + "argument":null, + "delegate":false + }, + "directive":null + } + ] + }, + "async":false, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/yield/migrated_0003.js b/lib/test/flow/ES6/yield/migrated_0003.js new file mode 100644 index 0000000..8b0059a --- /dev/null +++ b/lib/test/flow/ES6/yield/migrated_0003.js @@ -0,0 +1,4 @@ +function *f() { + yield + foo +} diff --git a/lib/test/flow/ES6/yield/migrated_0003.tree.json b/lib/test/flow/ES6/yield/migrated_0003.tree.json new file mode 100644 index 0000000..57aa2d8 --- /dev/null +++ b/lib/test/flow/ES6/yield/migrated_0003.tree.json @@ -0,0 +1,62 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,31], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":4,"column":1}}, + "range":[14,31], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":7}}, + "range":[18,23], + "expression":{ + "type":"YieldExpression", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":7}}, + "range":[18,23], + "argument":null, + "delegate":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":5}}, + "range":[26,29], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":5}}, + "range":[26,29], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "directive":null + } + ] + }, + "async":false, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/yield/migrated_0004.js b/lib/test/flow/ES6/yield/migrated_0004.js new file mode 100644 index 0000000..32dc952 --- /dev/null +++ b/lib/test/flow/ES6/yield/migrated_0004.js @@ -0,0 +1,3 @@ +function *f() { + { yield } +} diff --git a/lib/test/flow/ES6/yield/migrated_0004.tree.json b/lib/test/flow/ES6/yield/migrated_0004.tree.json new file mode 100644 index 0000000..dd24d8d --- /dev/null +++ b/lib/test/flow/ES6/yield/migrated_0004.tree.json @@ -0,0 +1,55 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,29], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,29], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":3,"column":1}}, + "range":[14,29], + "body":[ + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":11}}, + "range":[18,27], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":9}}, + "range":[20,25], + "expression":{ + "type":"YieldExpression", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":9}}, + "range":[20,25], + "argument":null, + "delegate":false + }, + "directive":null + } + ] + } + ] + }, + "async":false, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/ES6/yield/migrated_0005.js b/lib/test/flow/ES6/yield/migrated_0005.js new file mode 100644 index 0000000..5b72427 --- /dev/null +++ b/lib/test/flow/ES6/yield/migrated_0005.js @@ -0,0 +1,3 @@ +function *f() { + yield*; +} diff --git a/lib/test/flow/ES6/yield/migrated_0005.tree.json b/lib/test/flow/ES6/yield/migrated_0005.tree.json new file mode 100644 index 0000000..9a457eb --- /dev/null +++ b/lib/test/flow/ES6/yield/migrated_0005.tree.json @@ -0,0 +1,60 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "message":"Unexpected token `;`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,27], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,27], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":3,"column":1}}, + "range":[14,27], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "range":[18,25], + "expression":{ + "type":"YieldExpression", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":8}}, + "range":[18,24], + "argument":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "range":[24,25], + "value":null, + "raw":"null" + }, + "delegate":true + }, + "directive":null + } + ] + }, + "async":false, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/JSX/gt_in_attribute.js b/lib/test/flow/JSX/gt_in_attribute.js new file mode 100644 index 0000000..7ece6a2 --- /dev/null +++ b/lib/test/flow/JSX/gt_in_attribute.js @@ -0,0 +1 @@ +() diff --git a/lib/test/flow/JSX/gt_in_attribute.tree.json b/lib/test/flow/JSX/gt_in_attribute.tree.json new file mode 100644 index 0000000..f197db2 --- /dev/null +++ b/lib/test/flow/JSX/gt_in_attribute.tree.json @@ -0,0 +1,53 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "expression":{ + "type":"JSXElement", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":16}}, + "range":[1,16], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":16}}, + "range":[1,16], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, + "range":[2,5], + "name":"foo" + }, + "attributes":[ + { + "type":"JSXAttribute", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":13}}, + "range":[6,13], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "name":"bar" + }, + "value":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, + "range":[10,13], + "value":">", + "raw":"\">\"" + } + } + ], + "selfClosing":true + }, + "closingElement":null, + "children":[] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/JSX/html_entity_at_start_of_child.js b/lib/test/flow/JSX/html_entity_at_start_of_child.js new file mode 100644 index 0000000..a1ed94d --- /dev/null +++ b/lib/test/flow/JSX/html_entity_at_start_of_child.js @@ -0,0 +1 @@ +(
 
); diff --git a/lib/test/flow/JSX/html_entity_at_start_of_child.tree.json b/lib/test/flow/JSX/html_entity_at_start_of_child.tree.json new file mode 100644 index 0000000..410d171 --- /dev/null +++ b/lib/test/flow/JSX/html_entity_at_start_of_child.tree.json @@ -0,0 +1,52 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "expression":{ + "type":"JSXElement", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":18}}, + "range":[1,18], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "range":[1,6], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, + "range":[2,5], + "name":"div" + }, + "attributes":[], + "selfClosing":false + }, + "closingElement":{ + "type":"JSXClosingElement", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":18}}, + "range":[12,18], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, + "range":[14,17], + "name":"div" + } + }, + "children":[ + { + "type":"JSXText", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, + "range":[6,12], + "value":" ", + "raw":" " + } + ] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/JSX/invalid_unpaired_gt.js b/lib/test/flow/JSX/invalid_unpaired_gt.js new file mode 100644 index 0000000..fa06d93 --- /dev/null +++ b/lib/test/flow/JSX/invalid_unpaired_gt.js @@ -0,0 +1 @@ +(>) diff --git a/lib/test/flow/JSX/invalid_unpaired_gt.tree.json b/lib/test/flow/JSX/invalid_unpaired_gt.tree.json new file mode 100644 index 0000000..a235bd8 --- /dev/null +++ b/lib/test/flow/JSX/invalid_unpaired_gt.tree.json @@ -0,0 +1,58 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "message":"Unexpected token `>`. Did you mean `{'>'}`?" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "expression":{ + "type":"JSXElement", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":13}}, + "range":[1,13], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "range":[1,6], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, + "range":[2,5], + "name":"foo" + }, + "attributes":[], + "selfClosing":false + }, + "closingElement":{ + "type":"JSXClosingElement", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, + "range":[7,13], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo" + } + }, + "children":[ + { + "type":"JSXText", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "value":"", + "raw":"" + } + ] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/JSX/invalid_unpaired_rcurly.js b/lib/test/flow/JSX/invalid_unpaired_rcurly.js new file mode 100644 index 0000000..5be99d6 --- /dev/null +++ b/lib/test/flow/JSX/invalid_unpaired_rcurly.js @@ -0,0 +1 @@ +(}) diff --git a/lib/test/flow/JSX/invalid_unpaired_rcurly.tree.json b/lib/test/flow/JSX/invalid_unpaired_rcurly.tree.json new file mode 100644 index 0000000..0f81ef4 --- /dev/null +++ b/lib/test/flow/JSX/invalid_unpaired_rcurly.tree.json @@ -0,0 +1,58 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "message":"Unexpected token `}`. Did you mean `{'}'}`?" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "expression":{ + "type":"JSXElement", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":13}}, + "range":[1,13], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "range":[1,6], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, + "range":[2,5], + "name":"foo" + }, + "attributes":[], + "selfClosing":false + }, + "closingElement":{ + "type":"JSXClosingElement", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, + "range":[7,13], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo" + } + }, + "children":[ + { + "type":"JSXText", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "value":"", + "raw":"" + } + ] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/JSX/migrated_0000.js b/lib/test/flow/JSX/migrated_0000.js new file mode 100644 index 0000000..53ef18d --- /dev/null +++ b/lib/test/flow/JSX/migrated_0000.js @@ -0,0 +1 @@ +(
{}
) diff --git a/lib/test/flow/JSX/migrated_0000.tree.json b/lib/test/flow/JSX/migrated_0000.tree.json new file mode 100644 index 0000000..0cdbf52 --- /dev/null +++ b/lib/test/flow/JSX/migrated_0000.tree.json @@ -0,0 +1,55 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "expression":{ + "type":"JSXElement", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":14}}, + "range":[1,14], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "range":[1,6], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, + "range":[2,5], + "name":"div" + }, + "attributes":[], + "selfClosing":false + }, + "closingElement":{ + "type":"JSXClosingElement", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, + "range":[8,14], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, + "range":[10,13], + "name":"div" + } + }, + "children":[ + { + "type":"JSXExpressionContainer", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":8}}, + "range":[6,8], + "expression":{ + "type":"JSXEmptyExpression", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":7}}, + "range":[7,7] + } + } + ] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/JSX/migrated_0001.js b/lib/test/flow/JSX/migrated_0001.js new file mode 100644 index 0000000..d69733d --- /dev/null +++ b/lib/test/flow/JSX/migrated_0001.js @@ -0,0 +1 @@ +(
{ }
) diff --git a/lib/test/flow/JSX/migrated_0001.tree.json b/lib/test/flow/JSX/migrated_0001.tree.json new file mode 100644 index 0000000..293b727 --- /dev/null +++ b/lib/test/flow/JSX/migrated_0001.tree.json @@ -0,0 +1,55 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "expression":{ + "type":"JSXElement", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":15}}, + "range":[1,15], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "range":[1,6], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, + "range":[2,5], + "name":"div" + }, + "attributes":[], + "selfClosing":false + }, + "closingElement":{ + "type":"JSXClosingElement", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "range":[9,15], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "range":[11,14], + "name":"div" + } + }, + "children":[ + { + "type":"JSXExpressionContainer", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "expression":{ + "type":"JSXEmptyExpression", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "range":[7,8] + } + } + ] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/JSX/migrated_0002.js b/lib/test/flow/JSX/migrated_0002.js new file mode 100644 index 0000000..84f6cc6 --- /dev/null +++ b/lib/test/flow/JSX/migrated_0002.js @@ -0,0 +1,3 @@ +(
{ + +}
) diff --git a/lib/test/flow/JSX/migrated_0002.tree.json b/lib/test/flow/JSX/migrated_0002.tree.json new file mode 100644 index 0000000..dd30b8e --- /dev/null +++ b/lib/test/flow/JSX/migrated_0002.tree.json @@ -0,0 +1,55 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":8}}, + "range":[0,17], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":8}}, + "range":[0,17], + "expression":{ + "type":"JSXElement", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":3,"column":7}}, + "range":[1,16], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "range":[1,6], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, + "range":[2,5], + "name":"div" + }, + "attributes":[], + "selfClosing":false + }, + "closingElement":{ + "type":"JSXClosingElement", + "loc":{"source":null,"start":{"line":3,"column":1},"end":{"line":3,"column":7}}, + "range":[10,16], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":3,"column":3},"end":{"line":3,"column":6}}, + "range":[12,15], + "name":"div" + } + }, + "children":[ + { + "type":"JSXExpressionContainer", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":3,"column":1}}, + "range":[6,10], + "expression":{ + "type":"JSXEmptyExpression", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":3,"column":0}}, + "range":[7,9] + } + } + ] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/JSX/mismatched_closing_tag.js b/lib/test/flow/JSX/mismatched_closing_tag.js new file mode 100644 index 0000000..63d9718 --- /dev/null +++ b/lib/test/flow/JSX/mismatched_closing_tag.js @@ -0,0 +1,4 @@ +( + + +) diff --git a/lib/test/flow/JSX/mismatched_closing_tag.tree.json b/lib/test/flow/JSX/mismatched_closing_tag.tree.json new file mode 100644 index 0000000..9419394 --- /dev/null +++ b/lib/test/flow/JSX/mismatched_closing_tag.tree.json @@ -0,0 +1,103 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":4,"column":0}}, + "message":"Expected corresponding JSX closing tag for bar" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":7}}, + "range":[0,31], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":7}}, + "range":[0,31], + "expression":{ + "type":"JSXElement", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":4,"column":6}}, + "range":[1,30], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "range":[1,6], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, + "range":[2,5], + "name":"foo" + }, + "attributes":[], + "selfClosing":false + }, + "closingElement":{ + "type":"JSXClosingElement", + "loc":{"source":null,"start":{"line":4,"column":0},"end":{"line":4,"column":6}}, + "range":[24,30], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":5}}, + "range":[26,29], + "name":"foo" + } + }, + "children":[ + { + "type":"JSXText", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":2,"column":2}}, + "range":[6,9], + "value":"\n ", + "raw":"\n " + }, + { + "type":"JSXElement", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":3,"column":8}}, + "range":[9,23], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":7}}, + "range":[9,14], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":6}}, + "range":[10,13], + "name":"bar" + }, + "attributes":[], + "selfClosing":false + }, + "closingElement":{ + "type":"JSXClosingElement", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":8}}, + "range":[17,23], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":7}}, + "range":[19,22], + "name":"baz" + } + }, + "children":[ + { + "type":"JSXText", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":3,"column":2}}, + "range":[14,17], + "value":"\n ", + "raw":"\n " + } + ] + }, + { + "type":"JSXText", + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":4,"column":0}}, + "range":[23,24], + "value":"\n", + "raw":"\n" + } + ] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/JSX/partial_closing_tag.js b/lib/test/flow/JSX/partial_closing_tag.js new file mode 100644 index 0000000..d04e658 --- /dev/null +++ b/lib/test/flow/JSX/partial_closing_tag.js @@ -0,0 +1,3 @@ +( +
) diff --git a/lib/test/flow/JSX/partial_closing_tag.tree.json b/lib/test/flow/JSX/partial_closing_tag.tree.json new file mode 100644 index 0000000..646db58 --- /dev/null +++ b/lib/test/flow/JSX/partial_closing_tag.tree.json @@ -0,0 +1,99 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":1}}, + "message":"Unexpected token `<`, expected the token `>`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":3,"column":0}}, + "message":"Expected corresponding JSX closing tag for bar" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":7}}, + "range":[0,25], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":7}}, + "range":[0,25], + "expression":{ + "type":"JSXElement", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":3,"column":6}}, + "range":[1,24], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "range":[1,6], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, + "range":[2,5], + "name":"foo" + }, + "attributes":[], + "selfClosing":false + }, + "closingElement":{ + "type":"JSXClosingElement", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":6}}, + "range":[18,24], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":5}}, + "range":[20,23], + "name":"foo" + } + }, + "children":[ + { + "type":"JSXText", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":2,"column":2}}, + "range":[6,9], + "value":"\n ", + "raw":"\n " + }, + { + "type":"JSXElement", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":10}}, + "range":[9,17], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":7}}, + "range":[9,14], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":6}}, + "range":[10,13], + "name":"bar" + }, + "attributes":[], + "selfClosing":false + }, + "closingElement":{ + "type":"JSXClosingElement", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":10}}, + "range":[14,17], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, + "range":[16,17], + "name":"b" + } + }, + "children":[] + }, + { + "type":"JSXText", + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":3,"column":0}}, + "range":[17,18], + "value":"\n", + "raw":"\n" + } + ] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/JSX/partial_opening_tag.js b/lib/test/flow/JSX/partial_opening_tag.js new file mode 100644 index 0000000..98affbe --- /dev/null +++ b/lib/test/flow/JSX/partial_opening_tag.js @@ -0,0 +1,3 @@ +( + ) diff --git a/lib/test/flow/JSX/partial_opening_tag.tree.json b/lib/test/flow/JSX/partial_opening_tag.tree.json new file mode 100644 index 0000000..88fb559 --- /dev/null +++ b/lib/test/flow/JSX/partial_opening_tag.tree.json @@ -0,0 +1,85 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":1}}, + "message":"Unexpected token `<`, expected the token `>`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":7}}, + "range":[0,19], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":7}}, + "range":[0,19], + "expression":{ + "type":"JSXElement", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":3,"column":6}}, + "range":[1,18], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "range":[1,6], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, + "range":[2,5], + "name":"foo" + }, + "attributes":[], + "selfClosing":false + }, + "closingElement":{ + "type":"JSXClosingElement", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":6}}, + "range":[12,18], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":5}}, + "range":[14,17], + "name":"foo" + } + }, + "children":[ + { + "type":"JSXText", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":2,"column":2}}, + "range":[6,9], + "value":"\n ", + "raw":"\n " + }, + { + "type":"JSXElement", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "range":[9,11], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "range":[9,11], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":4}}, + "range":[10,11], + "name":"b" + }, + "attributes":[], + "selfClosing":false + }, + "closingElement":null, + "children":[] + }, + { + "type":"JSXText", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":3,"column":0}}, + "range":[11,12], + "value":"\n", + "raw":"\n" + } + ] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/JSX/partial_opening_tag_frag.js b/lib/test/flow/JSX/partial_opening_tag_frag.js new file mode 100644 index 0000000..9d52300 --- /dev/null +++ b/lib/test/flow/JSX/partial_opening_tag_frag.js @@ -0,0 +1,3 @@ +( + < +) diff --git a/lib/test/flow/JSX/partial_opening_tag_frag.tree.json b/lib/test/flow/JSX/partial_opening_tag_frag.tree.json new file mode 100644 index 0000000..f6c9837 --- /dev/null +++ b/lib/test/flow/JSX/partial_opening_tag_frag.tree.json @@ -0,0 +1,81 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":1}}, + "message":"Unexpected token `<`, expected the token `>`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":7}}, + "range":[0,18], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":7}}, + "range":[0,18], + "expression":{ + "type":"JSXElement", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":3,"column":6}}, + "range":[1,17], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "range":[1,6], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, + "range":[2,5], + "name":"foo" + }, + "attributes":[], + "selfClosing":false + }, + "closingElement":{ + "type":"JSXClosingElement", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":6}}, + "range":[11,17], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":5}}, + "range":[13,16], + "name":"foo" + } + }, + "children":[ + { + "type":"JSXText", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":2,"column":2}}, + "range":[6,9], + "value":"\n ", + "raw":"\n " + }, + { + "type":"JSXFragment", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[9,10], + "openingFragment":{ + "type":"JSXOpeningFragment", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[9,10] + }, + "children":[], + "closingFragment":{ + "type":"JSXClosingFragment", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[9,10] + } + }, + { + "type":"JSXText", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":3,"column":0}}, + "range":[10,11], + "value":"\n", + "raw":"\n" + } + ] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/JSX/rcurly_in_attribute.js b/lib/test/flow/JSX/rcurly_in_attribute.js new file mode 100644 index 0000000..1e8745b --- /dev/null +++ b/lib/test/flow/JSX/rcurly_in_attribute.js @@ -0,0 +1 @@ +() diff --git a/lib/test/flow/JSX/rcurly_in_attribute.tree.json b/lib/test/flow/JSX/rcurly_in_attribute.tree.json new file mode 100644 index 0000000..a850f78 --- /dev/null +++ b/lib/test/flow/JSX/rcurly_in_attribute.tree.json @@ -0,0 +1,53 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "expression":{ + "type":"JSXElement", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":16}}, + "range":[1,16], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":16}}, + "range":[1,16], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, + "range":[2,5], + "name":"foo" + }, + "attributes":[ + { + "type":"JSXAttribute", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":13}}, + "range":[6,13], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "name":"bar" + }, + "value":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, + "range":[10,13], + "value":"}", + "raw":"\"}\"" + } + } + ], + "selfClosing":true + }, + "closingElement":null, + "children":[] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/JSX_invalid/migrated_0000.js b/lib/test/flow/JSX_invalid/migrated_0000.js new file mode 100644 index 0000000..6387570 --- /dev/null +++ b/lib/test/flow/JSX_invalid/migrated_0000.js @@ -0,0 +1 @@ +(
) < x; diff --git a/lib/test/flow/JSX_invalid/migrated_0000.tree.json b/lib/test/flow/JSX_invalid/migrated_0000.tree.json new file mode 100644 index 0000000..3354b5d --- /dev/null +++ b/lib/test/flow/JSX_invalid/migrated_0000.tree.json @@ -0,0 +1,54 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "message":"Unexpected token <. Remember, adjacent JSX elements must be wrapped in an enclosing parent tag" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "expression":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "operator":"<", + "left":{ + "type":"JSXElement", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, + "range":[1,8], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, + "range":[1,8], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, + "range":[2,5], + "name":"div" + }, + "attributes":[], + "selfClosing":true + }, + "closingElement":null, + "children":[] + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "name":"x", + "typeAnnotation":null, + "optional":false + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/JSX_invalid/migrated_0001.js b/lib/test/flow/JSX_invalid/migrated_0001.js new file mode 100644 index 0000000..42058da --- /dev/null +++ b/lib/test/flow/JSX_invalid/migrated_0001.js @@ -0,0 +1 @@ +var x =
one
two
; diff --git a/lib/test/flow/JSX_invalid/migrated_0001.tree.json b/lib/test/flow/JSX_invalid/migrated_0001.tree.json new file mode 100644 index 0000000..a555323 --- /dev/null +++ b/lib/test/flow/JSX_invalid/migrated_0001.tree.json @@ -0,0 +1,119 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, + "message":"Unexpected token <. Remember, adjacent JSX elements must be wrapped in an enclosing parent tag" + }, + { + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":38}}, + "message":"Invalid regular expression: missing /" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,38], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,38], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":2,"column":0}}, + "range":[4,38], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":2,"column":0}}, + "range":[8,38], + "operator":"<", + "left":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":30}}, + "range":[8,30], + "operator":">", + "left":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":26}}, + "range":[8,26], + "operator":"<", + "left":{ + "type":"JSXElement", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":22}}, + "range":[8,22], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, + "range":[8,13], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"div" + }, + "attributes":[], + "selfClosing":false + }, + "closingElement":{ + "type":"JSXClosingElement", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":22}}, + "range":[16,22], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, + "range":[18,21], + "name":"div" + } + }, + "children":[ + { + "type":"JSXText", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, + "range":[13,16], + "value":"one", + "raw":"one" + } + ] + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":26}}, + "range":[23,26], + "name":"div", + "typeAnnotation":null, + "optional":false + } + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":30}}, + "range":[27,30], + "name":"two", + "typeAnnotation":null, + "optional":false + } + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":2,"column":0}}, + "range":[31,38], + "value":null, + "raw":"/div>;/", + "regex":{"pattern":"div>;","flags":""} + } + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/JSX_invalid/migrated_0002.js b/lib/test/flow/JSX_invalid/migrated_0002.js new file mode 100644 index 0000000..e9d4a5b --- /dev/null +++ b/lib/test/flow/JSX_invalid/migrated_0002.js @@ -0,0 +1 @@ +var x =
one
/* intervening comment */
two
; diff --git a/lib/test/flow/JSX_invalid/migrated_0002.tree.json b/lib/test/flow/JSX_invalid/migrated_0002.tree.json new file mode 100644 index 0000000..4249be8 --- /dev/null +++ b/lib/test/flow/JSX_invalid/migrated_0002.tree.json @@ -0,0 +1,126 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":49},"end":{"line":1,"column":50}}, + "message":"Unexpected token <. Remember, adjacent JSX elements must be wrapped in an enclosing parent tag" + }, + { + "loc":{"source":null,"start":{"line":1,"column":64},"end":{"line":1,"column":65}}, + "message":"Invalid regular expression: missing /" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,65], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,65], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":2,"column":0}}, + "range":[4,65], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":2,"column":0}}, + "range":[8,65], + "operator":"<", + "left":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":57}}, + "range":[8,57], + "operator":">", + "left":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":53}}, + "range":[8,53], + "operator":"<", + "left":{ + "type":"JSXElement", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":22}}, + "range":[8,22], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, + "range":[8,13], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"div" + }, + "attributes":[], + "selfClosing":false + }, + "closingElement":{ + "type":"JSXClosingElement", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":22}}, + "range":[16,22], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, + "range":[18,21], + "name":"div" + } + }, + "children":[ + { + "type":"JSXText", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, + "range":[13,16], + "value":"one", + "raw":"one" + } + ] + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":50},"end":{"line":1,"column":53}}, + "range":[50,53], + "name":"div", + "typeAnnotation":null, + "optional":false + } + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":54},"end":{"line":1,"column":57}}, + "range":[54,57], + "name":"two", + "typeAnnotation":null, + "optional":false + } + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":58},"end":{"line":2,"column":0}}, + "range":[58,65], + "value":null, + "raw":"/div>;/", + "regex":{"pattern":"div>;","flags":""} + } + } + } + ], + "kind":"var" + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":48}}, + "range":[23,48], + "value":" intervening comment " + } + ] +} diff --git a/lib/test/flow/array_literal_spreads/migrated_0000.js b/lib/test/flow/array_literal_spreads/migrated_0000.js new file mode 100644 index 0000000..47a9c1d --- /dev/null +++ b/lib/test/flow/array_literal_spreads/migrated_0000.js @@ -0,0 +1 @@ +[1, ...rest] diff --git a/lib/test/flow/array_literal_spreads/migrated_0000.tree.json b/lib/test/flow/array_literal_spreads/migrated_0000.tree.json new file mode 100644 index 0000000..8a8c79c --- /dev/null +++ b/lib/test/flow/array_literal_spreads/migrated_0000.tree.json @@ -0,0 +1,41 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "expression":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "elements":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, + "range":[1,2], + "value":1, + "raw":"1" + }, + { + "type":"SpreadElement", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, + "range":[4,11], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, + "range":[7,11], + "name":"rest", + "typeAnnotation":null, + "optional":false + } + } + ] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/array_literal_spreads/migrated_0001.js b/lib/test/flow/array_literal_spreads/migrated_0001.js new file mode 100644 index 0000000..9608920 --- /dev/null +++ b/lib/test/flow/array_literal_spreads/migrated_0001.js @@ -0,0 +1 @@ +[1, ...rest,] diff --git a/lib/test/flow/array_literal_spreads/migrated_0001.tree.json b/lib/test/flow/array_literal_spreads/migrated_0001.tree.json new file mode 100644 index 0000000..34ed4d4 --- /dev/null +++ b/lib/test/flow/array_literal_spreads/migrated_0001.tree.json @@ -0,0 +1,41 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "elements":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, + "range":[1,2], + "value":1, + "raw":"1" + }, + { + "type":"SpreadElement", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, + "range":[4,11], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, + "range":[7,11], + "name":"rest", + "typeAnnotation":null, + "optional":false + } + } + ] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/array_literal_spreads/migrated_0002.js b/lib/test/flow/array_literal_spreads/migrated_0002.js new file mode 100644 index 0000000..6f5de44 --- /dev/null +++ b/lib/test/flow/array_literal_spreads/migrated_0002.js @@ -0,0 +1 @@ +[...rest, 1] diff --git a/lib/test/flow/array_literal_spreads/migrated_0002.tree.json b/lib/test/flow/array_literal_spreads/migrated_0002.tree.json new file mode 100644 index 0000000..026f1fe --- /dev/null +++ b/lib/test/flow/array_literal_spreads/migrated_0002.tree.json @@ -0,0 +1,41 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "expression":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "elements":[ + { + "type":"SpreadElement", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, + "range":[1,8], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":8}}, + "range":[4,8], + "name":"rest", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "value":1, + "raw":"1" + } + ] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/array_literal_spreads/migrated_0003.js b/lib/test/flow/array_literal_spreads/migrated_0003.js new file mode 100644 index 0000000..a773c38 --- /dev/null +++ b/lib/test/flow/array_literal_spreads/migrated_0003.js @@ -0,0 +1 @@ +[...rest, ,1] diff --git a/lib/test/flow/array_literal_spreads/migrated_0003.tree.json b/lib/test/flow/array_literal_spreads/migrated_0003.tree.json new file mode 100644 index 0000000..e712a64 --- /dev/null +++ b/lib/test/flow/array_literal_spreads/migrated_0003.tree.json @@ -0,0 +1,42 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "elements":[ + { + "type":"SpreadElement", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, + "range":[1,8], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":8}}, + "range":[4,8], + "name":"rest", + "typeAnnotation":null, + "optional":false + } + }, + null, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "value":1, + "raw":"1" + } + ] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/arrow_function/migrated_0000.js b/lib/test/flow/arrow_function/migrated_0000.js new file mode 100644 index 0000000..f5c92a4 --- /dev/null +++ b/lib/test/flow/arrow_function/migrated_0000.js @@ -0,0 +1 @@ +(x => 123) diff --git a/lib/test/flow/arrow_function/migrated_0000.tree.json b/lib/test/flow/arrow_function/migrated_0000.tree.json new file mode 100644 index 0000000..6110f23 --- /dev/null +++ b/lib/test/flow/arrow_function/migrated_0000.tree.json @@ -0,0 +1,43 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "expression":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":9}}, + "range":[1,9], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, + "range":[1,2], + "name":"x", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "value":123, + "raw":"123" + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":null, + "typeParameters":null + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/arrow_function/migrated_0001.js b/lib/test/flow/arrow_function/migrated_0001.js new file mode 100644 index 0000000..bfa0dff --- /dev/null +++ b/lib/test/flow/arrow_function/migrated_0001.js @@ -0,0 +1 @@ +((x) => 123) diff --git a/lib/test/flow/arrow_function/migrated_0001.tree.json b/lib/test/flow/arrow_function/migrated_0001.tree.json new file mode 100644 index 0000000..44862f0 --- /dev/null +++ b/lib/test/flow/arrow_function/migrated_0001.tree.json @@ -0,0 +1,43 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "expression":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":11}}, + "range":[1,11], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "range":[2,3], + "name":"x", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":11}}, + "range":[8,11], + "value":123, + "raw":"123" + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":null, + "typeParameters":null + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/arrow_function/migrated_0002.js b/lib/test/flow/arrow_function/migrated_0002.js new file mode 100644 index 0000000..2a062f4 --- /dev/null +++ b/lib/test/flow/arrow_function/migrated_0002.js @@ -0,0 +1 @@ +(([x]) => 123) diff --git a/lib/test/flow/arrow_function/migrated_0002.tree.json b/lib/test/flow/arrow_function/migrated_0002.tree.json new file mode 100644 index 0000000..3d449a3 --- /dev/null +++ b/lib/test/flow/arrow_function/migrated_0002.tree.json @@ -0,0 +1,51 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "expression":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":13}}, + "range":[1,13], + "id":null, + "params":[ + { + "type":"ArrayPattern", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, + "range":[2,5], + "elements":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":4}}, + "range":[3,4], + "name":"x", + "typeAnnotation":null, + "optional":false + } + ], + "typeAnnotation":null + } + ], + "body":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, + "range":[10,13], + "value":123, + "raw":"123" + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":null, + "typeParameters":null + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/arrow_function/migrated_0003.js b/lib/test/flow/arrow_function/migrated_0003.js new file mode 100644 index 0000000..a42bd2e --- /dev/null +++ b/lib/test/flow/arrow_function/migrated_0003.js @@ -0,0 +1 @@ +(({x}) => 123) diff --git a/lib/test/flow/arrow_function/migrated_0003.tree.json b/lib/test/flow/arrow_function/migrated_0003.tree.json new file mode 100644 index 0000000..2389cca --- /dev/null +++ b/lib/test/flow/arrow_function/migrated_0003.tree.json @@ -0,0 +1,68 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "expression":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":13}}, + "range":[1,13], + "id":null, + "params":[ + { + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, + "range":[2,5], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":4}}, + "range":[3,4], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":4}}, + "range":[3,4], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":4}}, + "range":[3,4], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ], + "typeAnnotation":null + } + ], + "body":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, + "range":[10,13], + "value":123, + "raw":"123" + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":null, + "typeParameters":null + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/arrow_function/migrated_0004.js b/lib/test/flow/arrow_function/migrated_0004.js new file mode 100644 index 0000000..ca5a2a6 --- /dev/null +++ b/lib/test/flow/arrow_function/migrated_0004.js @@ -0,0 +1 @@ +(({x: y}) => 123) diff --git a/lib/test/flow/arrow_function/migrated_0004.tree.json b/lib/test/flow/arrow_function/migrated_0004.tree.json new file mode 100644 index 0000000..42ea851 --- /dev/null +++ b/lib/test/flow/arrow_function/migrated_0004.tree.json @@ -0,0 +1,68 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "expression":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":16}}, + "range":[1,16], + "id":null, + "params":[ + { + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":8}}, + "range":[2,8], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":7}}, + "range":[3,7], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":4}}, + "range":[3,4], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":false, + "computed":false + } + ], + "typeAnnotation":null + } + ], + "body":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, + "range":[13,16], + "value":123, + "raw":"123" + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":null, + "typeParameters":null + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/arrow_function/migrated_0005.js b/lib/test/flow/arrow_function/migrated_0005.js new file mode 100644 index 0000000..ef8ffb8 --- /dev/null +++ b/lib/test/flow/arrow_function/migrated_0005.js @@ -0,0 +1 @@ +(x: number): number => x diff --git a/lib/test/flow/arrow_function/migrated_0005.tree.json b/lib/test/flow/arrow_function/migrated_0005.tree.json new file mode 100644 index 0000000..dda6b35 --- /dev/null +++ b/lib/test/flow/arrow_function/migrated_0005.tree.json @@ -0,0 +1,62 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "expression":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":10}}, + "range":[1,10], + "name":"x", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":10}}, + "range":[2,10], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, + "range":[4,10] + } + }, + "optional":false + } + ], + "body":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, + "range":[23,24], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":19}}, + "range":[11,19], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":19}}, + "range":[13,19] + } + }, + "typeParameters":null + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/arrow_function/migrated_0006.js b/lib/test/flow/arrow_function/migrated_0006.js new file mode 100644 index 0000000..41a5299 --- /dev/null +++ b/lib/test/flow/arrow_function/migrated_0006.js @@ -0,0 +1 @@ +(x: T): T => x diff --git a/lib/test/flow/arrow_function/migrated_0006.tree.json b/lib/test/flow/arrow_function/migrated_0006.tree.json new file mode 100644 index 0000000..9b80f0b --- /dev/null +++ b/lib/test/flow/arrow_function/migrated_0006.tree.json @@ -0,0 +1,95 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "expression":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":8}}, + "range":[4,8], + "name":"x", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, + "range":[5,8], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "range":[7,8], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "range":[7,8], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + "optional":false + } + ], + "body":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "range":[16,17], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, + "range":[1,2], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/arrow_function/object_return_type.js b/lib/test/flow/arrow_function/object_return_type.js new file mode 100644 index 0000000..228220c --- /dev/null +++ b/lib/test/flow/arrow_function/object_return_type.js @@ -0,0 +1 @@ +(): { x: string => void } => {} diff --git a/lib/test/flow/arrow_function/object_return_type.tree.json b/lib/test/flow/arrow_function/object_return_type.tree.json new file mode 100644 index 0000000..2881329 --- /dev/null +++ b/lib/test/flow/arrow_function/object_return_type.tree.json @@ -0,0 +1,94 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "expression":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, + "range":[29,31], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":25}}, + "range":[2,25], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":25}}, + "range":[4,25], + "inexact":false, + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":23}}, + "range":[6,23], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":23}}, + "range":[9,23], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "range":[9,15], + "name":null, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "range":[9,15] + }, + "optional":false + } + ], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":23}}, + "range":[19,23] + }, + "rest":null, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + "typeParameters":null + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/arrow_function/param-dflt-yield-expr.js b/lib/test/flow/arrow_function/param-dflt-yield-expr.js new file mode 100644 index 0000000..6e306fd --- /dev/null +++ b/lib/test/flow/arrow_function/param-dflt-yield-expr.js @@ -0,0 +1,3 @@ +function *g() { + (x = yield) => {}; +} diff --git a/lib/test/flow/arrow_function/param-dflt-yield-expr.tree.json b/lib/test/flow/arrow_function/param-dflt-yield-expr.tree.json new file mode 100644 index 0000000..fcef977 --- /dev/null +++ b/lib/test/flow/arrow_function/param-dflt-yield-expr.tree.json @@ -0,0 +1,87 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":12}}, + "message":"Yield expression not allowed in formal parameter" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,38], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,38], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"g", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":3,"column":1}}, + "range":[14,38], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":20}}, + "range":[18,36], + "expression":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":19}}, + "range":[18,35], + "id":null, + "params":[ + { + "type":"AssignmentPattern", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":12}}, + "range":[19,28], + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":4}}, + "range":[19,20], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"YieldExpression", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":12}}, + "range":[23,28], + "argument":null, + "delegate":false + } + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":19}}, + "range":[33,35], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "directive":null + } + ] + }, + "async":false, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/arrow_function/param-dflt-yield-id.js b/lib/test/flow/arrow_function/param-dflt-yield-id.js new file mode 100644 index 0000000..7430b7e --- /dev/null +++ b/lib/test/flow/arrow_function/param-dflt-yield-id.js @@ -0,0 +1,3 @@ +function g() { + (x = yield) => {}; +} diff --git a/lib/test/flow/arrow_function/param-dflt-yield-id.tree.json b/lib/test/flow/arrow_function/param-dflt-yield-id.tree.json new file mode 100644 index 0000000..050d8d4 --- /dev/null +++ b/lib/test/flow/arrow_function/param-dflt-yield-id.tree.json @@ -0,0 +1,82 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,37], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,37], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "name":"g", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":3,"column":1}}, + "range":[13,37], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":20}}, + "range":[17,35], + "expression":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":19}}, + "range":[17,34], + "id":null, + "params":[ + { + "type":"AssignmentPattern", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":12}}, + "range":[18,27], + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":4}}, + "range":[18,19], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":12}}, + "range":[22,27], + "name":"yield", + "typeAnnotation":null, + "optional":false + } + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":19}}, + "range":[32,34], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/arrow_function/tuple_return_type.js b/lib/test/flow/arrow_function/tuple_return_type.js new file mode 100644 index 0000000..c730add --- /dev/null +++ b/lib/test/flow/arrow_function/tuple_return_type.js @@ -0,0 +1 @@ +(): [number => void] => {} diff --git a/lib/test/flow/arrow_function/tuple_return_type.tree.json b/lib/test/flow/arrow_function/tuple_return_type.tree.json new file mode 100644 index 0000000..d528bcc --- /dev/null +++ b/lib/test/flow/arrow_function/tuple_return_type.tree.json @@ -0,0 +1,70 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "expression":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, + "range":[24,26], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":20}}, + "range":[2,20], + "typeAnnotation":{ + "type":"TupleTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":20}}, + "range":[4,20], + "types":[ + { + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":19}}, + "range":[5,19], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, + "range":[5,11], + "name":null, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, + "range":[5,11] + }, + "optional":false + } + ], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":19}}, + "range":[15,19] + }, + "rest":null, + "typeParameters":null + } + ] + } + }, + "typeParameters":null + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/arrow_function_invalid/migrated_0000.js b/lib/test/flow/arrow_function_invalid/migrated_0000.js new file mode 100644 index 0000000..96b45b6 --- /dev/null +++ b/lib/test/flow/arrow_function_invalid/migrated_0000.js @@ -0,0 +1 @@ +var f = x: number => 42 diff --git a/lib/test/flow/arrow_function_invalid/migrated_0000.tree.json b/lib/test/flow/arrow_function_invalid/migrated_0000.tree.json new file mode 100644 index 0000000..52bdecc --- /dev/null +++ b/lib/test/flow/arrow_function_invalid/migrated_0000.tree.json @@ -0,0 +1,82 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "message":"Unexpected token `:`, expected the token `;`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "message":"Unexpected token `:`, expected the start of a statement" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "range":[0,9], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, + "range":[4,9], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "name":"x", + "typeAnnotation":null, + "optional":false + } + } + ], + "kind":"var" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":23}}, + "range":[11,23], + "expression":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":23}}, + "range":[11,23], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":17}}, + "range":[11,17], + "name":"number", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, + "range":[21,23], + "value":42, + "raw":"42" + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":null, + "typeParameters":null + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/arrow_function_invalid/migrated_0001.js b/lib/test/flow/arrow_function_invalid/migrated_0001.js new file mode 100644 index 0000000..459bf47 --- /dev/null +++ b/lib/test/flow/arrow_function_invalid/migrated_0001.js @@ -0,0 +1 @@ +label: typeThatIsActuallyAnParam => 42 diff --git a/lib/test/flow/arrow_function_invalid/migrated_0001.tree.json b/lib/test/flow/arrow_function_invalid/migrated_0001.tree.json new file mode 100644 index 0000000..82118d9 --- /dev/null +++ b/lib/test/flow/arrow_function_invalid/migrated_0001.tree.json @@ -0,0 +1,56 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "body":[ + { + "type":"LabeledStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "label":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "range":[0,5], + "name":"label", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":38}}, + "range":[7,38], + "expression":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":38}}, + "range":[7,38], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":32}}, + "range":[7,32], + "name":"typeThatIsActuallyAnParam", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":38}}, + "range":[36,38], + "value":42, + "raw":"42" + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":null, + "typeParameters":null + }, + "directive":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/arrow_function_invalid/migrated_0002.js b/lib/test/flow/arrow_function_invalid/migrated_0002.js new file mode 100644 index 0000000..67ee3b4 --- /dev/null +++ b/lib/test/flow/arrow_function_invalid/migrated_0002.js @@ -0,0 +1 @@ +x => 42 diff --git a/lib/test/flow/arrow_function_invalid/migrated_0002.tree.json b/lib/test/flow/arrow_function_invalid/migrated_0002.tree.json new file mode 100644 index 0000000..5cccc78 --- /dev/null +++ b/lib/test/flow/arrow_function_invalid/migrated_0002.tree.json @@ -0,0 +1,52 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected token ILLEGAL" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,11], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,11], + "expression":{ + "type":"JSXElement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, + "range":[1,2], + "name":"T" + }, + "attributes":[], + "selfClosing":false + }, + "closingElement":null, + "children":[ + { + "type":"JSXText", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":2,"column":0}}, + "range":[3,11], + "value":"x => 42\n", + "raw":"x => 42\n" + } + ] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/arrow_function_invalid/migrated_0003.js b/lib/test/flow/arrow_function_invalid/migrated_0003.js new file mode 100644 index 0000000..592deb5 --- /dev/null +++ b/lib/test/flow/arrow_function_invalid/migrated_0003.js @@ -0,0 +1 @@ +*x => x diff --git a/lib/test/flow/arrow_function_invalid/migrated_0003.tree.json b/lib/test/flow/arrow_function_invalid/migrated_0003.tree.json new file mode 100644 index 0000000..9b68787 --- /dev/null +++ b/lib/test/flow/arrow_function_invalid/migrated_0003.tree.json @@ -0,0 +1,63 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "message":"Unexpected token `*`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":5}}, + "message":"Unexpected token `=>`, expected the end of an expression statement (`;`)" + }, + { + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":5}}, + "message":"Unexpected token `=>`, expected the start of a statement" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "range":[0,2], + "expression":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "range":[0,2], + "operator":"*", + "left":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "value":null, + "raw":"null" + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, + "range":[1,2], + "name":"x", + "typeAnnotation":null, + "optional":false + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/arrow_function_invalid/migrated_0004.js b/lib/test/flow/arrow_function_invalid/migrated_0004.js new file mode 100644 index 0000000..2608ed5 --- /dev/null +++ b/lib/test/flow/arrow_function_invalid/migrated_0004.js @@ -0,0 +1 @@ +*(x) => x diff --git a/lib/test/flow/arrow_function_invalid/migrated_0004.tree.json b/lib/test/flow/arrow_function_invalid/migrated_0004.tree.json new file mode 100644 index 0000000..b0631ca --- /dev/null +++ b/lib/test/flow/arrow_function_invalid/migrated_0004.tree.json @@ -0,0 +1,63 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "message":"Unexpected token `*`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, + "message":"Unexpected token `=>`, expected the end of an expression statement (`;`)" + }, + { + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, + "message":"Unexpected token `=>`, expected the start of a statement" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "range":[0,9], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "expression":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "operator":"*", + "left":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "value":null, + "raw":"null" + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "range":[2,3], + "name":"x", + "typeAnnotation":null, + "optional":false + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_arrow_functions/migrated_0000.js b/lib/test/flow/async_arrow_functions/migrated_0000.js new file mode 100644 index 0000000..e758dd0 --- /dev/null +++ b/lib/test/flow/async_arrow_functions/migrated_0000.js @@ -0,0 +1 @@ +var x = async () => await promise; diff --git a/lib/test/flow/async_arrow_functions/migrated_0000.tree.json b/lib/test/flow/async_arrow_functions/migrated_0000.tree.json new file mode 100644 index 0000000..ab6109e --- /dev/null +++ b/lib/test/flow/async_arrow_functions/migrated_0000.tree.json @@ -0,0 +1,55 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "range":[0,34], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "range":[0,34], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":33}}, + "range":[4,33], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":33}}, + "range":[8,33], + "id":null, + "params":[], + "body":{ + "type":"AwaitExpression", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":33}}, + "range":[20,33], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":33}}, + "range":[26,33], + "name":"promise", + "typeAnnotation":null, + "optional":false + } + }, + "async":true, + "generator":false, + "predicate":null, + "expression":true, + "returnType":null, + "typeParameters":null + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_arrow_functions/migrated_0001.js b/lib/test/flow/async_arrow_functions/migrated_0001.js new file mode 100644 index 0000000..c1c1540 --- /dev/null +++ b/lib/test/flow/async_arrow_functions/migrated_0001.js @@ -0,0 +1 @@ +var x = async (a) => await a; diff --git a/lib/test/flow/async_arrow_functions/migrated_0001.tree.json b/lib/test/flow/async_arrow_functions/migrated_0001.tree.json new file mode 100644 index 0000000..4f7b56e --- /dev/null +++ b/lib/test/flow/async_arrow_functions/migrated_0001.tree.json @@ -0,0 +1,64 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":28}}, + "range":[4,28], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":28}}, + "range":[8,28], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"a", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"AwaitExpression", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":28}}, + "range":[21,28], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, + "range":[27,28], + "name":"a", + "typeAnnotation":null, + "optional":false + } + }, + "async":true, + "generator":false, + "predicate":null, + "expression":true, + "returnType":null, + "typeParameters":null + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_arrow_functions/migrated_0002.js b/lib/test/flow/async_arrow_functions/migrated_0002.js new file mode 100644 index 0000000..b98ad2e --- /dev/null +++ b/lib/test/flow/async_arrow_functions/migrated_0002.js @@ -0,0 +1 @@ +var x = async a => await a; diff --git a/lib/test/flow/async_arrow_functions/migrated_0002.tree.json b/lib/test/flow/async_arrow_functions/migrated_0002.tree.json new file mode 100644 index 0000000..37c573a --- /dev/null +++ b/lib/test/flow/async_arrow_functions/migrated_0002.tree.json @@ -0,0 +1,64 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":26}}, + "range":[4,26], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":26}}, + "range":[8,26], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"a", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"AwaitExpression", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":26}}, + "range":[19,26], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, + "range":[25,26], + "name":"a", + "typeAnnotation":null, + "optional":false + } + }, + "async":true, + "generator":false, + "predicate":null, + "expression":true, + "returnType":null, + "typeParameters":null + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_arrow_functions/migrated_0003.js b/lib/test/flow/async_arrow_functions/migrated_0003.js new file mode 100644 index 0000000..f841c5f --- /dev/null +++ b/lib/test/flow/async_arrow_functions/migrated_0003.js @@ -0,0 +1 @@ +var x = async => async + 1; diff --git a/lib/test/flow/async_arrow_functions/migrated_0003.tree.json b/lib/test/flow/async_arrow_functions/migrated_0003.tree.json new file mode 100644 index 0000000..5df6c0c --- /dev/null +++ b/lib/test/flow/async_arrow_functions/migrated_0003.tree.json @@ -0,0 +1,72 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":26}}, + "range":[4,26], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":26}}, + "range":[8,26], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, + "range":[8,13], + "name":"async", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":26}}, + "range":[17,26], + "operator":"+", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":22}}, + "range":[17,22], + "name":"async", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, + "range":[25,26], + "value":1, + "raw":"1" + } + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":null, + "typeParameters":null + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_arrow_functions/migrated_0004.js b/lib/test/flow/async_arrow_functions/migrated_0004.js new file mode 100644 index 0000000..b76a214 --- /dev/null +++ b/lib/test/flow/async_arrow_functions/migrated_0004.js @@ -0,0 +1 @@ +var x = async (a => a + 1); diff --git a/lib/test/flow/async_arrow_functions/migrated_0004.tree.json b/lib/test/flow/async_arrow_functions/migrated_0004.tree.json new file mode 100644 index 0000000..963bf80 --- /dev/null +++ b/lib/test/flow/async_arrow_functions/migrated_0004.tree.json @@ -0,0 +1,87 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":26}}, + "range":[4,26], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":26}}, + "range":[8,26], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, + "range":[8,13], + "name":"async", + "typeAnnotation":null, + "optional":false + }, + "arguments":[ + { + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":25}}, + "range":[15,25], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"a", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":25}}, + "range":[20,25], + "operator":"+", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, + "range":[24,25], + "value":1, + "raw":"1" + } + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":null, + "typeParameters":null + } + ] + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_arrow_functions/migrated_0005.js b/lib/test/flow/async_arrow_functions/migrated_0005.js new file mode 100644 index 0000000..e2233a8 --- /dev/null +++ b/lib/test/flow/async_arrow_functions/migrated_0005.js @@ -0,0 +1 @@ +var x = async(x) diff --git a/lib/test/flow/async_arrow_functions/migrated_0005.tree.json b/lib/test/flow/async_arrow_functions/migrated_0005.tree.json new file mode 100644 index 0000000..83acca5 --- /dev/null +++ b/lib/test/flow/async_arrow_functions/migrated_0005.tree.json @@ -0,0 +1,52 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, + "range":[4,16], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":16}}, + "range":[8,16], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, + "range":[8,13], + "name":"async", + "typeAnnotation":null, + "optional":false + }, + "arguments":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"x", + "typeAnnotation":null, + "optional":false + } + ] + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_arrow_functions/migrated_0006.js b/lib/test/flow/async_arrow_functions/migrated_0006.js new file mode 100644 index 0000000..be995ec --- /dev/null +++ b/lib/test/flow/async_arrow_functions/migrated_0006.js @@ -0,0 +1 @@ +var x = async (a, b) => await a + b; diff --git a/lib/test/flow/async_arrow_functions/migrated_0006.tree.json b/lib/test/flow/async_arrow_functions/migrated_0006.tree.json new file mode 100644 index 0000000..08c03d2 --- /dev/null +++ b/lib/test/flow/async_arrow_functions/migrated_0006.tree.json @@ -0,0 +1,86 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":35}}, + "range":[4,35], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":35}}, + "range":[8,35], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "name":"b", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":35}}, + "range":[24,35], + "operator":"+", + "left":{ + "type":"AwaitExpression", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":31}}, + "range":[24,31], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":31}}, + "range":[30,31], + "name":"a", + "typeAnnotation":null, + "optional":false + } + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, + "range":[34,35], + "name":"b", + "typeAnnotation":null, + "optional":false + } + }, + "async":true, + "generator":false, + "predicate":null, + "expression":true, + "returnType":null, + "typeParameters":null + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_arrow_functions/migrated_0007.js b/lib/test/flow/async_arrow_functions/migrated_0007.js new file mode 100644 index 0000000..fec479d --- /dev/null +++ b/lib/test/flow/async_arrow_functions/migrated_0007.js @@ -0,0 +1 @@ +var x = async (a, b, c, d, e, f, g) => await a + await b + c + d + e + f + g; diff --git a/lib/test/flow/async_arrow_functions/migrated_0007.tree.json b/lib/test/flow/async_arrow_functions/migrated_0007.tree.json new file mode 100644 index 0000000..72e610b --- /dev/null +++ b/lib/test/flow/async_arrow_functions/migrated_0007.tree.json @@ -0,0 +1,201 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":77}}, + "range":[0,77], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":77}}, + "range":[0,77], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":76}}, + "range":[4,76], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":76}}, + "range":[8,76], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "name":"c", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, + "range":[24,25], + "name":"d", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, + "range":[27,28], + "name":"e", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":31}}, + "range":[30,31], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":34}}, + "range":[33,34], + "name":"g", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":76}}, + "range":[39,76], + "operator":"+", + "left":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":72}}, + "range":[39,72], + "operator":"+", + "left":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":68}}, + "range":[39,68], + "operator":"+", + "left":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":64}}, + "range":[39,64], + "operator":"+", + "left":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":60}}, + "range":[39,60], + "operator":"+", + "left":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":56}}, + "range":[39,56], + "operator":"+", + "left":{ + "type":"AwaitExpression", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":46}}, + "range":[39,46], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":45},"end":{"line":1,"column":46}}, + "range":[45,46], + "name":"a", + "typeAnnotation":null, + "optional":false + } + }, + "right":{ + "type":"AwaitExpression", + "loc":{"source":null,"start":{"line":1,"column":49},"end":{"line":1,"column":56}}, + "range":[49,56], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":55},"end":{"line":1,"column":56}}, + "range":[55,56], + "name":"b", + "typeAnnotation":null, + "optional":false + } + } + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":59},"end":{"line":1,"column":60}}, + "range":[59,60], + "name":"c", + "typeAnnotation":null, + "optional":false + } + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":63},"end":{"line":1,"column":64}}, + "range":[63,64], + "name":"d", + "typeAnnotation":null, + "optional":false + } + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":67},"end":{"line":1,"column":68}}, + "range":[67,68], + "name":"e", + "typeAnnotation":null, + "optional":false + } + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":71},"end":{"line":1,"column":72}}, + "range":[71,72], + "name":"f", + "typeAnnotation":null, + "optional":false + } + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":75},"end":{"line":1,"column":76}}, + "range":[75,76], + "name":"g", + "typeAnnotation":null, + "optional":false + } + }, + "async":true, + "generator":false, + "predicate":null, + "expression":true, + "returnType":null, + "typeParameters":null + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_arrow_functions/migrated_0008.js b/lib/test/flow/async_arrow_functions/migrated_0008.js new file mode 100644 index 0000000..a04016e --- /dev/null +++ b/lib/test/flow/async_arrow_functions/migrated_0008.js @@ -0,0 +1 @@ +var x = 1 y => y diff --git a/lib/test/flow/async_arrow_functions/migrated_0008.tree.json b/lib/test/flow/async_arrow_functions/migrated_0008.tree.json new file mode 100644 index 0000000..62be93c --- /dev/null +++ b/lib/test/flow/async_arrow_functions/migrated_0008.tree.json @@ -0,0 +1,78 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "message":"Unexpected identifier, expected the token `;`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "range":[0,9], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, + "range":[4,9], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "value":1, + "raw":"1" + } + } + ], + "kind":"var" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, + "range":[10,16], + "expression":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, + "range":[10,16], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"y", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":null, + "typeParameters":null + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_arrow_functions/migrated_0009.js b/lib/test/flow/async_arrow_functions/migrated_0009.js new file mode 100644 index 0000000..ef12478 --- /dev/null +++ b/lib/test/flow/async_arrow_functions/migrated_0009.js @@ -0,0 +1,2 @@ +var x = async +y => y diff --git a/lib/test/flow/async_arrow_functions/migrated_0009.tree.json b/lib/test/flow/async_arrow_functions/migrated_0009.tree.json new file mode 100644 index 0000000..e889141 --- /dev/null +++ b/lib/test/flow/async_arrow_functions/migrated_0009.tree.json @@ -0,0 +1,73 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, + "range":[0,20], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, + "range":[4,13], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, + "range":[8,13], + "name":"async", + "typeAnnotation":null, + "optional":false + } + } + ], + "kind":"var" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":6}}, + "range":[14,20], + "expression":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":6}}, + "range":[14,20], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":1}}, + "range":[14,15], + "name":"y", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":6}}, + "range":[19,20], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":null, + "typeParameters":null + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_arrow_functions/with_type_parameters.js b/lib/test/flow/async_arrow_functions/with_type_parameters.js new file mode 100644 index 0000000..724ed66 --- /dev/null +++ b/lib/test/flow/async_arrow_functions/with_type_parameters.js @@ -0,0 +1,7 @@ +const f = async ( + x: T, + y: R, + z: S, +) => { + return null; +}; diff --git a/lib/test/flow/async_arrow_functions/with_type_parameters.tree.json b/lib/test/flow/async_arrow_functions/with_type_parameters.tree.json new file mode 100644 index 0000000..c05f969 --- /dev/null +++ b/lib/test/flow/async_arrow_functions/with_type_parameters.tree.json @@ -0,0 +1,173 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":7,"column":2}}, + "range":[0,75], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":7,"column":2}}, + "range":[0,75], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":7,"column":1}}, + "range":[6,74], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":7,"column":1}}, + "range":[10,74], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":6}}, + "range":[29,33], + "name":"x", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":6}}, + "range":[30,33], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":6}}, + "range":[32,33], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":6}}, + "range":[32,33], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":6}}, + "range":[37,41], + "name":"y", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":3},"end":{"line":3,"column":6}}, + "range":[38,41], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":5},"end":{"line":3,"column":6}}, + "range":[40,41], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":5},"end":{"line":3,"column":6}}, + "range":[40,41], + "name":"R", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":6}}, + "range":[45,49], + "name":"z", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":3},"end":{"line":4,"column":6}}, + "range":[46,49], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":5},"end":{"line":4,"column":6}}, + "range":[48,49], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":5},"end":{"line":4,"column":6}}, + "range":[48,49], + "name":"S", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":5,"column":5},"end":{"line":7,"column":1}}, + "range":[56,74], + "body":[ + { + "type":"ReturnStatement", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":14}}, + "range":[60,72], + "argument":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":6,"column":9},"end":{"line":6,"column":13}}, + "range":[67,71], + "value":null, + "raw":"null" + } + } + ] + }, + "async":true, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":25}}, + "range":[16,25], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "range":[17,18], + "name":"T", + "bound":null, + "variance":null, + "default":null + }, + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "name":"R", + "bound":null, + "variance":null, + "default":null + }, + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, + "range":[23,24], + "name":"S", + "bound":null, + "variance":null, + "default":null + } + ] + } + } + } + ], + "kind":"const" + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_arrow_functions/with_type_parameters_types_disabled.js b/lib/test/flow/async_arrow_functions/with_type_parameters_types_disabled.js new file mode 100644 index 0000000..724ed66 --- /dev/null +++ b/lib/test/flow/async_arrow_functions/with_type_parameters_types_disabled.js @@ -0,0 +1,7 @@ +const f = async ( + x: T, + y: R, + z: S, +) => { + return null; +}; diff --git a/lib/test/flow/async_arrow_functions/with_type_parameters_types_disabled.options.json b/lib/test/flow/async_arrow_functions/with_type_parameters_types_disabled.options.json new file mode 100644 index 0000000..5a7dde3 --- /dev/null +++ b/lib/test/flow/async_arrow_functions/with_type_parameters_types_disabled.options.json @@ -0,0 +1,3 @@ +{ + "types": false +} diff --git a/lib/test/flow/async_arrow_functions/with_type_parameters_types_disabled.tree.json b/lib/test/flow/async_arrow_functions/with_type_parameters_types_disabled.tree.json new file mode 100644 index 0000000..3a6911c --- /dev/null +++ b/lib/test/flow/async_arrow_functions/with_type_parameters_types_disabled.tree.json @@ -0,0 +1,274 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, + "message":"Unexpected token `>`, expected the token `;`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "message":"Const must be initialized" + }, + { + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, + "message":"Const must be initialized" + }, + { + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, + "message":"Unexpected token `>`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":4}}, + "message":"Type annotations are not allowed in untyped mode" + }, + { + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, + "message":"Unexpected token `,`, expected the token `)`" + }, + { + "loc":{"source":null,"start":{"line":4,"column":3},"end":{"line":4,"column":4}}, + "message":"Unexpected token `:`, expected the end of an expression statement (`;`)" + }, + { + "loc":{"source":null,"start":{"line":4,"column":3},"end":{"line":4,"column":4}}, + "message":"Unexpected token `:`, expected the start of a statement" + }, + { + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":1}}, + "message":"Unexpected token `)`" + }, + { + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":1}}, + "message":"Unexpected token `)`, expected the start of a statement" + }, + { + "loc":{"source":null,"start":{"line":5,"column":2},"end":{"line":5,"column":4}}, + "message":"Unexpected token `=>`, expected the start of a statement" + }, + { + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":8}}, + "message":"Illegal return statement" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":7,"column":2}}, + "range":[0,75], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":18}}, + "range":[6,18], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":18}}, + "range":[10,18], + "operator":"<", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, + "range":[10,15], + "name":"async", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "range":[17,18], + "name":"T", + "typeAnnotation":null, + "optional":false + } + } + }, + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "name":"R", + "typeAnnotation":null, + "optional":false + }, + "init":null + }, + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, + "range":[23,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, + "range":[23,24], + "name":"S", + "typeAnnotation":null, + "optional":false + }, + "init":null + } + ], + "kind":"const" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":2,"column":7}}, + "range":[24,34], + "expression":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":2,"column":7}}, + "range":[24,34], + "operator":">", + "left":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, + "range":[24,25], + "value":null, + "raw":"null" + }, + "right":{ + "type":"TypeCastExpression", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":2,"column":7}}, + "range":[25,34], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[29,30], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":6}}, + "range":[30,33], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":6}}, + "range":[32,33], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":6}}, + "range":[32,33], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + } + }, + "directive":null + }, + { + "type":"LabeledStatement", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":4,"column":3}}, + "range":[37,46], + "label":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "range":[37,38], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":3,"column":5},"end":{"line":4,"column":3}}, + "range":[40,46], + "expression":{ + "type":"SequenceExpression", + "loc":{"source":null,"start":{"line":3,"column":5},"end":{"line":4,"column":3}}, + "range":[40,46], + "expressions":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":5},"end":{"line":3,"column":6}}, + "range":[40,41], + "name":"R", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":3}}, + "range":[45,46], + "name":"z", + "typeAnnotation":null, + "optional":false + } + ] + }, + "directive":null + } + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":4,"column":5},"end":{"line":4,"column":7}}, + "range":[48,50], + "expression":{ + "type":"SequenceExpression", + "loc":{"source":null,"start":{"line":4,"column":5},"end":{"line":4,"column":7}}, + "range":[48,50], + "expressions":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":5},"end":{"line":4,"column":6}}, + "range":[48,49], + "name":"S", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":1}}, + "range":[51,52], + "value":null, + "raw":"null" + } + ] + }, + "directive":null + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":5,"column":5},"end":{"line":7,"column":1}}, + "range":[56,74], + "body":[ + { + "type":"ReturnStatement", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":14}}, + "range":[60,72], + "argument":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":6,"column":9},"end":{"line":6,"column":13}}, + "range":[67,71], + "value":null, + "raw":"null" + } + } + ] + }, + { + "type":"EmptyStatement", + "loc":{"source":null,"start":{"line":7,"column":1},"end":{"line":7,"column":2}}, + "range":[74,75] + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_await/async_computed_method.js b/lib/test/flow/async_await/async_computed_method.js new file mode 100644 index 0000000..a2bd088 --- /dev/null +++ b/lib/test/flow/async_await/async_computed_method.js @@ -0,0 +1 @@ +({ async [foo]() {} }) diff --git a/lib/test/flow/async_await/async_computed_method.tree.json b/lib/test/flow/async_await/async_computed_method.tree.json new file mode 100644 index 0000000..52bbd6e --- /dev/null +++ b/lib/test/flow/async_await/async_computed_method.tree.json @@ -0,0 +1,57 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "expression":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":21}}, + "range":[1,21], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":19}}, + "range":[3,19], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, + "range":[10,13], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, + "range":[14,19], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, + "range":[17,19], + "body":[] + }, + "async":true, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"init", + "method":true, + "shorthand":false, + "computed":true + } + ] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_await/async_generic_method.js b/lib/test/flow/async_await/async_generic_method.js new file mode 100644 index 0000000..1bae340 --- /dev/null +++ b/lib/test/flow/async_await/async_generic_method.js @@ -0,0 +1 @@ +({ async() {} }); diff --git a/lib/test/flow/async_await/async_generic_method.tree.json b/lib/test/flow/async_await/async_generic_method.tree.json new file mode 100644 index 0000000..7f2fe66 --- /dev/null +++ b/lib/test/flow/async_await/async_generic_method.tree.json @@ -0,0 +1,72 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "expression":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":18}}, + "range":[1,18], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":16}}, + "range":[3,16], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":8}}, + "range":[3,8], + "name":"async", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":16}}, + "range":[8,16], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, + "range":[14,16], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":11}}, + "range":[8,11], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "kind":"init", + "method":true, + "shorthand":false, + "computed":false + } + ] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_await/migrated_0000.js b/lib/test/flow/async_await/migrated_0000.js new file mode 100644 index 0000000..f04f5e0 --- /dev/null +++ b/lib/test/flow/async_await/migrated_0000.js @@ -0,0 +1 @@ +async: while (async) { continue async; } diff --git a/lib/test/flow/async_await/migrated_0000.tree.json b/lib/test/flow/async_await/migrated_0000.tree.json new file mode 100644 index 0000000..ba71b32 --- /dev/null +++ b/lib/test/flow/async_await/migrated_0000.tree.json @@ -0,0 +1,54 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "range":[0,40], + "body":[ + { + "type":"LabeledStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "range":[0,40], + "label":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "range":[0,5], + "name":"async", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"WhileStatement", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":40}}, + "range":[7,40], + "test":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, + "range":[14,19], + "name":"async", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":40}}, + "range":[21,40], + "body":[ + { + "type":"ContinueStatement", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":38}}, + "range":[23,38], + "label":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":37}}, + "range":[32,37], + "name":"async", + "typeAnnotation":null, + "optional":false + } + } + ] + } + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_await/migrated_0001.js b/lib/test/flow/async_await/migrated_0001.js new file mode 100644 index 0000000..eaff54f --- /dev/null +++ b/lib/test/flow/async_await/migrated_0001.js @@ -0,0 +1 @@ +await: while (await) { continue await; } diff --git a/lib/test/flow/async_await/migrated_0001.tree.json b/lib/test/flow/async_await/migrated_0001.tree.json new file mode 100644 index 0000000..fc546cc --- /dev/null +++ b/lib/test/flow/async_await/migrated_0001.tree.json @@ -0,0 +1,54 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "range":[0,40], + "body":[ + { + "type":"LabeledStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "range":[0,40], + "label":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "range":[0,5], + "name":"await", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"WhileStatement", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":40}}, + "range":[7,40], + "test":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, + "range":[14,19], + "name":"await", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":40}}, + "range":[21,40], + "body":[ + { + "type":"ContinueStatement", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":38}}, + "range":[23,38], + "label":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":37}}, + "range":[32,37], + "name":"await", + "typeAnnotation":null, + "optional":false + } + } + ] + } + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_await/migrated_0002.js b/lib/test/flow/async_await/migrated_0002.js new file mode 100644 index 0000000..40cc392 --- /dev/null +++ b/lib/test/flow/async_await/migrated_0002.js @@ -0,0 +1 @@ +var await = { await } diff --git a/lib/test/flow/async_await/migrated_0002.tree.json b/lib/test/flow/async_await/migrated_0002.tree.json new file mode 100644 index 0000000..85080e4 --- /dev/null +++ b/lib/test/flow/async_await/migrated_0002.tree.json @@ -0,0 +1,61 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":21}}, + "range":[4,21], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, + "range":[4,9], + "name":"await", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":21}}, + "range":[12,21], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, + "range":[14,19], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, + "range":[14,19], + "name":"await", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, + "range":[14,19], + "name":"await", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ] + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_await/migrated_0003.js b/lib/test/flow/async_await/migrated_0003.js new file mode 100644 index 0000000..e961c73 --- /dev/null +++ b/lib/test/flow/async_await/migrated_0003.js @@ -0,0 +1 @@ +var async = { async } diff --git a/lib/test/flow/async_await/migrated_0003.tree.json b/lib/test/flow/async_await/migrated_0003.tree.json new file mode 100644 index 0000000..e56a1cd --- /dev/null +++ b/lib/test/flow/async_await/migrated_0003.tree.json @@ -0,0 +1,61 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":21}}, + "range":[4,21], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, + "range":[4,9], + "name":"async", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":21}}, + "range":[12,21], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, + "range":[14,19], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, + "range":[14,19], + "name":"async", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, + "range":[14,19], + "name":"async", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ] + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_await/migrated_0004.js b/lib/test/flow/async_await/migrated_0004.js new file mode 100644 index 0000000..2cc4b2f --- /dev/null +++ b/lib/test/flow/async_await/migrated_0004.js @@ -0,0 +1 @@ +var async = { async : foo } diff --git a/lib/test/flow/async_await/migrated_0004.tree.json b/lib/test/flow/async_await/migrated_0004.tree.json new file mode 100644 index 0000000..2aac19a --- /dev/null +++ b/lib/test/flow/async_await/migrated_0004.tree.json @@ -0,0 +1,61 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":27}}, + "range":[4,27], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, + "range":[4,9], + "name":"async", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":27}}, + "range":[12,27], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":25}}, + "range":[14,25], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, + "range":[14,19], + "name":"async", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":25}}, + "range":[22,25], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":false, + "computed":false + } + ] + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_await/migrated_0005.js b/lib/test/flow/async_await/migrated_0005.js new file mode 100644 index 0000000..2c34f52 --- /dev/null +++ b/lib/test/flow/async_await/migrated_0005.js @@ -0,0 +1 @@ +class async { async: number; } diff --git a/lib/test/flow/async_await/migrated_0005.tree.json b/lib/test/flow/async_await/migrated_0005.tree.json new file mode 100644 index 0000000..de21bdf --- /dev/null +++ b/lib/test/flow/async_await/migrated_0005.tree.json @@ -0,0 +1,60 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":11}}, + "range":[6,11], + "name":"async", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":30}}, + "range":[12,30], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":28}}, + "range":[14,28], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, + "range":[14,19], + "name":"async", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, + "range":[19,27], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "range":[21,27] + } + }, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_await/migrated_0006.js b/lib/test/flow/async_await/migrated_0006.js new file mode 100644 index 0000000..ac62c5f --- /dev/null +++ b/lib/test/flow/async_await/migrated_0006.js @@ -0,0 +1 @@ +async function f() { var await = { await : async function foo() {} } } diff --git a/lib/test/flow/async_await/migrated_0006.tree.json b/lib/test/flow/async_await/migrated_0006.tree.json new file mode 100644 index 0000000..de9419f --- /dev/null +++ b/lib/test/flow/async_await/migrated_0006.tree.json @@ -0,0 +1,112 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":30}}, + "message":"Unexpected reserved word" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":70}}, + "range":[0,70], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":70}}, + "range":[0,70], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":70}}, + "range":[19,70], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":68}}, + "range":[21,68], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":68}}, + "range":[25,68], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":30}}, + "range":[25,30], + "name":"await", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":68}}, + "range":[33,68], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":66}}, + "range":[35,66], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":40}}, + "range":[35,40], + "name":"await", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":43},"end":{"line":1,"column":66}}, + "range":[43,66], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":58},"end":{"line":1,"column":61}}, + "range":[58,61], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":64},"end":{"line":1,"column":66}}, + "range":[64,66], + "body":[] + }, + "async":true, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"init", + "method":false, + "shorthand":false, + "computed":false + } + ] + } + } + ], + "kind":"var" + } + ] + }, + "async":true, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_await/migrated_0007.js b/lib/test/flow/async_await/migrated_0007.js new file mode 100644 index 0000000..2627cf4 --- /dev/null +++ b/lib/test/flow/async_await/migrated_0007.js @@ -0,0 +1 @@ +async function f(async, await) { var x = await async; return x; } diff --git a/lib/test/flow/async_await/migrated_0007.tree.json b/lib/test/flow/async_await/migrated_0007.tree.json new file mode 100644 index 0000000..2212d01 --- /dev/null +++ b/lib/test/flow/async_await/migrated_0007.tree.json @@ -0,0 +1,105 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":29}}, + "message":"Unexpected reserved word" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":65}}, + "range":[0,65], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":65}}, + "range":[0,65], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":22}}, + "range":[17,22], + "name":"async", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":29}}, + "range":[24,29], + "name":"await", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":65}}, + "range":[31,65], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":53}}, + "range":[33,53], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":52}}, + "range":[37,52], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":38}}, + "range":[37,38], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"AwaitExpression", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":52}}, + "range":[41,52], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":47},"end":{"line":1,"column":52}}, + "range":[47,52], + "name":"async", + "typeAnnotation":null, + "optional":false + } + } + } + ], + "kind":"var" + }, + { + "type":"ReturnStatement", + "loc":{"source":null,"start":{"line":1,"column":54},"end":{"line":1,"column":63}}, + "range":[54,63], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":61},"end":{"line":1,"column":62}}, + "range":[61,62], + "name":"x", + "typeAnnotation":null, + "optional":false + } + } + ] + }, + "async":true, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_await/migrated_0008.js b/lib/test/flow/async_await/migrated_0008.js new file mode 100644 index 0000000..97e876e --- /dev/null +++ b/lib/test/flow/async_await/migrated_0008.js @@ -0,0 +1 @@ +function f() { return await; } diff --git a/lib/test/flow/async_await/migrated_0008.tree.json b/lib/test/flow/async_await/migrated_0008.tree.json new file mode 100644 index 0000000..71735d8 --- /dev/null +++ b/lib/test/flow/async_await/migrated_0008.tree.json @@ -0,0 +1,48 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":30}}, + "range":[13,30], + "body":[ + { + "type":"ReturnStatement", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":28}}, + "range":[15,28], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":27}}, + "range":[22,27], + "name":"await", + "typeAnnotation":null, + "optional":false + } + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_await/migrated_0009.js b/lib/test/flow/async_await/migrated_0009.js new file mode 100644 index 0000000..dc3af90 --- /dev/null +++ b/lib/test/flow/async_await/migrated_0009.js @@ -0,0 +1,2 @@ +// inside an async function, await is considered a keyword +async function f() { return await; } diff --git a/lib/test/flow/async_await/migrated_0009.tree.json b/lib/test/flow/async_await/migrated_0009.tree.json new file mode 100644 index 0000000..1fd1188 --- /dev/null +++ b/lib/test/flow/async_await/migrated_0009.tree.json @@ -0,0 +1,65 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":33},"end":{"line":2,"column":34}}, + "message":"Unexpected token `;`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":36}}, + "range":[59,95], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":36}}, + "range":[59,95], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":15},"end":{"line":2,"column":16}}, + "range":[74,75], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":36}}, + "range":[78,95], + "body":[ + { + "type":"ReturnStatement", + "loc":{"source":null,"start":{"line":2,"column":21},"end":{"line":2,"column":34}}, + "range":[80,93], + "argument":{ + "type":"AwaitExpression", + "loc":{"source":null,"start":{"line":2,"column":28},"end":{"line":2,"column":33}}, + "range":[87,92], + "argument":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":33},"end":{"line":2,"column":34}}, + "range":[92,93], + "value":null, + "raw":"null" + } + } + } + ] + }, + "async":true, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "range":[0,58], + "value":" inside an async function, await is considered a keyword" + } + ] +} diff --git a/lib/test/flow/async_await/migrated_0010.js b/lib/test/flow/async_await/migrated_0010.js new file mode 100644 index 0000000..3cbea2e --- /dev/null +++ b/lib/test/flow/async_await/migrated_0010.js @@ -0,0 +1 @@ +function f(x: async) : async { return x; } diff --git a/lib/test/flow/async_await/migrated_0010.tree.json b/lib/test/flow/async_await/migrated_0010.tree.json new file mode 100644 index 0000000..feb602c --- /dev/null +++ b/lib/test/flow/async_await/migrated_0010.tree.json @@ -0,0 +1,93 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "range":[0,42], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "range":[0,42], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":19}}, + "range":[11,19], + "name":"x", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":19}}, + "range":[12,19], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, + "range":[14,19], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, + "range":[14,19], + "name":"async", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":42}}, + "range":[29,42], + "body":[ + { + "type":"ReturnStatement", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":40}}, + "range":[31,40], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":39}}, + "range":[38,39], + "name":"x", + "typeAnnotation":null, + "optional":false + } + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":28}}, + "range":[21,28], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":28}}, + "range":[23,28], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":28}}, + "range":[23,28], + "name":"async", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_await/migrated_0011.js b/lib/test/flow/async_await/migrated_0011.js new file mode 100644 index 0000000..df2a678 --- /dev/null +++ b/lib/test/flow/async_await/migrated_0011.js @@ -0,0 +1 @@ +declare async function foo() : T diff --git a/lib/test/flow/async_await/migrated_0011.tree.json b/lib/test/flow/async_await/migrated_0011.tree.json new file mode 100644 index 0000000..e0f8d7a --- /dev/null +++ b/lib/test/flow/async_await/migrated_0011.tree.json @@ -0,0 +1,54 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, + "message":"async is an implementation detail and isn't necessary for your declare function statement. It is sufficient for your declare function to just have a Promise return type." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "body":[ + { + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":32}}, + "range":[23,32], + "name":"foo", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":32}}, + "range":[26,32], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":32}}, + "range":[26,32], + "params":[], + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":32}}, + "range":[31,32], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":32}}, + "range":[31,32], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_await/migrated_0012.js b/lib/test/flow/async_await/migrated_0012.js new file mode 100644 index 0000000..35f423a --- /dev/null +++ b/lib/test/flow/async_await/migrated_0012.js @@ -0,0 +1 @@ +declare async function async(async : async) : async diff --git a/lib/test/flow/async_await/migrated_0012.tree.json b/lib/test/flow/async_await/migrated_0012.tree.json new file mode 100644 index 0000000..abce9db --- /dev/null +++ b/lib/test/flow/async_await/migrated_0012.tree.json @@ -0,0 +1,83 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, + "message":"async is an implementation detail and isn't necessary for your declare function statement. It is sufficient for your declare function to just have a Promise return type." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, + "range":[0,51], + "body":[ + { + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, + "range":[0,51], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":51}}, + "range":[23,51], + "name":"async", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":51}}, + "range":[28,51], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":51}}, + "range":[28,51], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":42}}, + "range":[29,42], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":34}}, + "range":[29,34], + "name":"async", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":42}}, + "range":[37,42], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":42}}, + "range":[37,42], + "name":"async", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "optional":false + } + ], + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":46},"end":{"line":1,"column":51}}, + "range":[46,51], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":46},"end":{"line":1,"column":51}}, + "range":[46,51], + "name":"async", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_await/migrated_0013.js b/lib/test/flow/async_await/migrated_0013.js new file mode 100644 index 0000000..10cd276 --- /dev/null +++ b/lib/test/flow/async_await/migrated_0013.js @@ -0,0 +1 @@ +declare async function await(await : await) : await diff --git a/lib/test/flow/async_await/migrated_0013.tree.json b/lib/test/flow/async_await/migrated_0013.tree.json new file mode 100644 index 0000000..a5fdb37 --- /dev/null +++ b/lib/test/flow/async_await/migrated_0013.tree.json @@ -0,0 +1,83 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, + "message":"async is an implementation detail and isn't necessary for your declare function statement. It is sufficient for your declare function to just have a Promise return type." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, + "range":[0,51], + "body":[ + { + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, + "range":[0,51], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":51}}, + "range":[23,51], + "name":"await", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":51}}, + "range":[28,51], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":51}}, + "range":[28,51], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":42}}, + "range":[29,42], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":34}}, + "range":[29,34], + "name":"await", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":42}}, + "range":[37,42], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":42}}, + "range":[37,42], + "name":"await", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "optional":false + } + ], + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":46},"end":{"line":1,"column":51}}, + "range":[46,51], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":46},"end":{"line":1,"column":51}}, + "range":[46,51], + "name":"await", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_await/migrated_0014.js b/lib/test/flow/async_await/migrated_0014.js new file mode 100644 index 0000000..c693f6e --- /dev/null +++ b/lib/test/flow/async_await/migrated_0014.js @@ -0,0 +1 @@ +declare function foo() : Promise diff --git a/lib/test/flow/async_await/migrated_0014.tree.json b/lib/test/flow/async_await/migrated_0014.tree.json new file mode 100644 index 0000000..4736673 --- /dev/null +++ b/lib/test/flow/async_await/migrated_0014.tree.json @@ -0,0 +1,68 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "range":[0,39], + "body":[ + { + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "range":[0,39], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":39}}, + "range":[17,39], + "name":"foo", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":39}}, + "range":[20,39], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":39}}, + "range":[20,39], + "params":[], + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":39}}, + "range":[25,39], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":32}}, + "range":[25,32], + "name":"Promise", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":39}}, + "range":[32,39], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":38}}, + "range":[33,38], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":38}}, + "range":[33,38], + "name":"async", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_await/migrated_0015.js b/lib/test/flow/async_await/migrated_0015.js new file mode 100644 index 0000000..1c6ec2e --- /dev/null +++ b/lib/test/flow/async_await/migrated_0015.js @@ -0,0 +1 @@ +declare function foo() : Promise diff --git a/lib/test/flow/async_await/migrated_0015.tree.json b/lib/test/flow/async_await/migrated_0015.tree.json new file mode 100644 index 0000000..1e4d88b --- /dev/null +++ b/lib/test/flow/async_await/migrated_0015.tree.json @@ -0,0 +1,68 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "range":[0,39], + "body":[ + { + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "range":[0,39], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":39}}, + "range":[17,39], + "name":"foo", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":39}}, + "range":[20,39], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":39}}, + "range":[20,39], + "params":[], + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":39}}, + "range":[25,39], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":32}}, + "range":[25,32], + "name":"Promise", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":39}}, + "range":[32,39], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":38}}, + "range":[33,38], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":38}}, + "range":[33,38], + "name":"await", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_await/migrated_0016.js b/lib/test/flow/async_await/migrated_0016.js new file mode 100644 index 0000000..f2411dc --- /dev/null +++ b/lib/test/flow/async_await/migrated_0016.js @@ -0,0 +1 @@ +declare function async() : bar diff --git a/lib/test/flow/async_await/migrated_0016.tree.json b/lib/test/flow/async_await/migrated_0016.tree.json new file mode 100644 index 0000000..17df841 --- /dev/null +++ b/lib/test/flow/async_await/migrated_0016.tree.json @@ -0,0 +1,48 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "body":[ + { + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":30}}, + "range":[17,30], + "name":"async", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":30}}, + "range":[22,30], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":30}}, + "range":[22,30], + "params":[], + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":30}}, + "range":[27,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":30}}, + "range":[27,30], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_await/migrated_0017.js b/lib/test/flow/async_await/migrated_0017.js new file mode 100644 index 0000000..f1ac380 --- /dev/null +++ b/lib/test/flow/async_await/migrated_0017.js @@ -0,0 +1 @@ +async function foo() { var await = 4; } diff --git a/lib/test/flow/async_await/migrated_0017.tree.json b/lib/test/flow/async_await/migrated_0017.tree.json new file mode 100644 index 0000000..5b83684 --- /dev/null +++ b/lib/test/flow/async_await/migrated_0017.tree.json @@ -0,0 +1,69 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":32}}, + "message":"Unexpected reserved word" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "range":[0,39], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "range":[0,39], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, + "range":[15,18], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":39}}, + "range":[21,39], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":37}}, + "range":[23,37], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":36}}, + "range":[27,36], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":32}}, + "range":[27,32], + "name":"await", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":36}}, + "range":[35,36], + "value":4, + "raw":"4" + } + } + ], + "kind":"var" + } + ] + }, + "async":true, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_await/migrated_0018.js b/lib/test/flow/async_await/migrated_0018.js new file mode 100644 index 0000000..1adaf7d --- /dev/null +++ b/lib/test/flow/async_await/migrated_0018.js @@ -0,0 +1 @@ +async function foo() { var await = 4; return await; } diff --git a/lib/test/flow/async_await/migrated_0018.tree.json b/lib/test/flow/async_await/migrated_0018.tree.json new file mode 100644 index 0000000..5c59920 --- /dev/null +++ b/lib/test/flow/async_await/migrated_0018.tree.json @@ -0,0 +1,90 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":32}}, + "message":"Unexpected reserved word" + }, + { + "loc":{"source":null,"start":{"line":1,"column":50},"end":{"line":1,"column":51}}, + "message":"Unexpected token `;`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "range":[0,53], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "range":[0,53], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, + "range":[15,18], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":53}}, + "range":[21,53], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":37}}, + "range":[23,37], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":36}}, + "range":[27,36], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":32}}, + "range":[27,32], + "name":"await", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":36}}, + "range":[35,36], + "value":4, + "raw":"4" + } + } + ], + "kind":"var" + }, + { + "type":"ReturnStatement", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":51}}, + "range":[38,51], + "argument":{ + "type":"AwaitExpression", + "loc":{"source":null,"start":{"line":1,"column":45},"end":{"line":1,"column":50}}, + "range":[45,50], + "argument":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":50},"end":{"line":1,"column":51}}, + "range":[50,51], + "value":null, + "raw":"null" + } + } + } + ] + }, + "async":true, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_await/migrated_0019.js b/lib/test/flow/async_await/migrated_0019.js new file mode 100644 index 0000000..dd5868d --- /dev/null +++ b/lib/test/flow/async_await/migrated_0019.js @@ -0,0 +1,2 @@ +// esprima chokes on this +export const async = 5 diff --git a/lib/test/flow/async_await/migrated_0019.tree.json b/lib/test/flow/async_await/migrated_0019.tree.json new file mode 100644 index 0000000..ed86b6f --- /dev/null +++ b/lib/test/flow/async_await/migrated_0019.tree.json @@ -0,0 +1,51 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":22}}, + "range":[26,48], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":22}}, + "range":[26,48], + "declaration":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":22}}, + "range":[33,48], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":22}}, + "range":[39,48], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":18}}, + "range":[39,44], + "name":"async", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":21},"end":{"line":2,"column":22}}, + "range":[47,48], + "value":5, + "raw":"5" + } + } + ], + "kind":"const" + }, + "specifiers":[], + "source":null, + "exportKind":"value" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "value":" esprima chokes on this" + } + ] +} diff --git a/lib/test/flow/async_await/migrated_0020.js b/lib/test/flow/async_await/migrated_0020.js new file mode 100644 index 0000000..7bddfd4 --- /dev/null +++ b/lib/test/flow/async_await/migrated_0020.js @@ -0,0 +1,2 @@ +// esprima chokes on this +export const await = 5 diff --git a/lib/test/flow/async_await/migrated_0020.tree.json b/lib/test/flow/async_await/migrated_0020.tree.json new file mode 100644 index 0000000..6b30cfe --- /dev/null +++ b/lib/test/flow/async_await/migrated_0020.tree.json @@ -0,0 +1,51 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":22}}, + "range":[26,48], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":22}}, + "range":[26,48], + "declaration":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":22}}, + "range":[33,48], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":22}}, + "range":[39,48], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":18}}, + "range":[39,44], + "name":"await", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":21},"end":{"line":2,"column":22}}, + "range":[47,48], + "value":5, + "raw":"5" + } + } + ], + "kind":"const" + }, + "specifiers":[], + "source":null, + "exportKind":"value" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "value":" esprima chokes on this" + } + ] +} diff --git a/lib/test/flow/async_await/migrated_0021.js b/lib/test/flow/async_await/migrated_0021.js new file mode 100644 index 0000000..ee7bc1a --- /dev/null +++ b/lib/test/flow/async_await/migrated_0021.js @@ -0,0 +1,2 @@ +// esprima chokes on this +export const foo = async function() { } diff --git a/lib/test/flow/async_await/migrated_0021.tree.json b/lib/test/flow/async_await/migrated_0021.tree.json new file mode 100644 index 0000000..9c1edca --- /dev/null +++ b/lib/test/flow/async_await/migrated_0021.tree.json @@ -0,0 +1,63 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":39}}, + "range":[26,65], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":39}}, + "range":[26,65], + "declaration":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":39}}, + "range":[33,65], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":39}}, + "range":[39,65], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":16}}, + "range":[39,42], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":39}}, + "range":[45,65], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":36},"end":{"line":2,"column":39}}, + "range":[62,65], + "body":[] + }, + "async":true, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + } + ], + "kind":"const" + }, + "specifiers":[], + "source":null, + "exportKind":"value" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "value":" esprima chokes on this" + } + ] +} diff --git a/lib/test/flow/async_await/migrated_0022.js b/lib/test/flow/async_await/migrated_0022.js new file mode 100644 index 0000000..ec816de --- /dev/null +++ b/lib/test/flow/async_await/migrated_0022.js @@ -0,0 +1,2 @@ +// esprima chokes on this +export const foo = async () => y diff --git a/lib/test/flow/async_await/migrated_0022.tree.json b/lib/test/flow/async_await/migrated_0022.tree.json new file mode 100644 index 0000000..4003983 --- /dev/null +++ b/lib/test/flow/async_await/migrated_0022.tree.json @@ -0,0 +1,65 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":32}}, + "range":[26,58], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":32}}, + "range":[26,58], + "declaration":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":32}}, + "range":[33,58], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":32}}, + "range":[39,58], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":16}}, + "range":[39,42], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":32}}, + "range":[45,58], + "id":null, + "params":[], + "body":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":31},"end":{"line":2,"column":32}}, + "range":[57,58], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "async":true, + "generator":false, + "predicate":null, + "expression":true, + "returnType":null, + "typeParameters":null + } + } + ], + "kind":"const" + }, + "specifiers":[], + "source":null, + "exportKind":"value" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "value":" esprima chokes on this" + } + ] +} diff --git a/lib/test/flow/async_await/migrated_0023.js b/lib/test/flow/async_await/migrated_0023.js new file mode 100644 index 0000000..f6039f5 --- /dev/null +++ b/lib/test/flow/async_await/migrated_0023.js @@ -0,0 +1,2 @@ +// esprima chokes on this +export function async() { } diff --git a/lib/test/flow/async_await/migrated_0023.tree.json b/lib/test/flow/async_await/migrated_0023.tree.json new file mode 100644 index 0000000..fa20702 --- /dev/null +++ b/lib/test/flow/async_await/migrated_0023.tree.json @@ -0,0 +1,49 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":27}}, + "range":[26,53], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":27}}, + "range":[26,53], + "declaration":{ + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":27}}, + "range":[33,53], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":21}}, + "range":[42,47], + "name":"async", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":24},"end":{"line":2,"column":27}}, + "range":[50,53], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "specifiers":[], + "source":null, + "exportKind":"value" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "value":" esprima chokes on this" + } + ] +} diff --git a/lib/test/flow/async_await/migrated_0024.js b/lib/test/flow/async_await/migrated_0024.js new file mode 100644 index 0000000..b03b436 --- /dev/null +++ b/lib/test/flow/async_await/migrated_0024.js @@ -0,0 +1,2 @@ +// esprima chokes on this +export function await() { } diff --git a/lib/test/flow/async_await/migrated_0024.tree.json b/lib/test/flow/async_await/migrated_0024.tree.json new file mode 100644 index 0000000..71d1356 --- /dev/null +++ b/lib/test/flow/async_await/migrated_0024.tree.json @@ -0,0 +1,49 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":27}}, + "range":[26,53], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":27}}, + "range":[26,53], + "declaration":{ + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":27}}, + "range":[33,53], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":21}}, + "range":[42,47], + "name":"await", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":24},"end":{"line":2,"column":27}}, + "range":[50,53], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "specifiers":[], + "source":null, + "exportKind":"value" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "value":" esprima chokes on this" + } + ] +} diff --git a/lib/test/flow/async_await/migrated_0025.js b/lib/test/flow/async_await/migrated_0025.js new file mode 100644 index 0000000..e77bda5 --- /dev/null +++ b/lib/test/flow/async_await/migrated_0025.js @@ -0,0 +1,2 @@ +// esprima chokes on this +export async function foo(x) { await x; } diff --git a/lib/test/flow/async_await/migrated_0025.tree.json b/lib/test/flow/async_await/migrated_0025.tree.json new file mode 100644 index 0000000..5ae2983 --- /dev/null +++ b/lib/test/flow/async_await/migrated_0025.tree.json @@ -0,0 +1,78 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":41}}, + "range":[26,67], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":41}}, + "range":[26,67], + "declaration":{ + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":41}}, + "range":[33,67], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":22},"end":{"line":2,"column":25}}, + "range":[48,51], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":26},"end":{"line":2,"column":27}}, + "range":[52,53], + "name":"x", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":29},"end":{"line":2,"column":41}}, + "range":[55,67], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":31},"end":{"line":2,"column":39}}, + "range":[57,65], + "expression":{ + "type":"AwaitExpression", + "loc":{"source":null,"start":{"line":2,"column":31},"end":{"line":2,"column":38}}, + "range":[57,64], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":37},"end":{"line":2,"column":38}}, + "range":[63,64], + "name":"x", + "typeAnnotation":null, + "optional":false + } + }, + "directive":null + } + ] + }, + "async":true, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "specifiers":[], + "source":null, + "exportKind":"value" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "value":" esprima chokes on this" + } + ] +} diff --git a/lib/test/flow/async_await/migrated_0026.js b/lib/test/flow/async_await/migrated_0026.js new file mode 100644 index 0000000..0b6e0b6 --- /dev/null +++ b/lib/test/flow/async_await/migrated_0026.js @@ -0,0 +1,2 @@ +// esprima chokes on this +import async from 'foo' diff --git a/lib/test/flow/async_await/migrated_0026.tree.json b/lib/test/flow/async_await/migrated_0026.tree.json new file mode 100644 index 0000000..15a933a --- /dev/null +++ b/lib/test/flow/async_await/migrated_0026.tree.json @@ -0,0 +1,43 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":23}}, + "range":[26,49], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":23}}, + "range":[26,49], + "specifiers":[ + { + "type":"ImportDefaultSpecifier", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":12}}, + "range":[33,38], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":12}}, + "range":[33,38], + "name":"async", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":18},"end":{"line":2,"column":23}}, + "range":[44,49], + "value":"foo", + "raw":"'foo'" + }, + "importKind":"value" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "value":" esprima chokes on this" + } + ] +} diff --git a/lib/test/flow/async_await/migrated_0027.js b/lib/test/flow/async_await/migrated_0027.js new file mode 100644 index 0000000..d6f5676 --- /dev/null +++ b/lib/test/flow/async_await/migrated_0027.js @@ -0,0 +1,2 @@ +// esprima chokes on this +import await from 'foo' diff --git a/lib/test/flow/async_await/migrated_0027.tree.json b/lib/test/flow/async_await/migrated_0027.tree.json new file mode 100644 index 0000000..f6015c4 --- /dev/null +++ b/lib/test/flow/async_await/migrated_0027.tree.json @@ -0,0 +1,43 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":23}}, + "range":[26,49], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":23}}, + "range":[26,49], + "specifiers":[ + { + "type":"ImportDefaultSpecifier", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":12}}, + "range":[33,38], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":12}}, + "range":[33,38], + "name":"await", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":18},"end":{"line":2,"column":23}}, + "range":[44,49], + "value":"foo", + "raw":"'foo'" + }, + "importKind":"value" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "value":" esprima chokes on this" + } + ] +} diff --git a/lib/test/flow/async_generators/migrated_0000.js b/lib/test/flow/async_generators/migrated_0000.js new file mode 100644 index 0000000..8cc84fe --- /dev/null +++ b/lib/test/flow/async_generators/migrated_0000.js @@ -0,0 +1 @@ +async function *foo() {} diff --git a/lib/test/flow/async_generators/migrated_0000.tree.json b/lib/test/flow/async_generators/migrated_0000.tree.json new file mode 100644 index 0000000..2a6dde0 --- /dev/null +++ b/lib/test/flow/async_generators/migrated_0000.tree.json @@ -0,0 +1,34 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":19}}, + "range":[16,19], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, + "range":[22,24], + "body":[] + }, + "async":true, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_generators/migrated_0001.js b/lib/test/flow/async_generators/migrated_0001.js new file mode 100644 index 0000000..7f7377f --- /dev/null +++ b/lib/test/flow/async_generators/migrated_0001.js @@ -0,0 +1 @@ +async function *ft(a: T) {} diff --git a/lib/test/flow/async_generators/migrated_0001.tree.json b/lib/test/flow/async_generators/migrated_0001.tree.json new file mode 100644 index 0000000..cd753a9 --- /dev/null +++ b/lib/test/flow/async_generators/migrated_0001.tree.json @@ -0,0 +1,76 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, + "range":[16,18], + "name":"ft", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":26}}, + "range":[22,26], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":26}}, + "range":[23,26], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, + "range":[25,26], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, + "range":[25,26], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, + "range":[28,30], + "body":[] + }, + "async":true, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, + "range":[18,21], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "range":[19,20], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_generators/migrated_0002.js b/lib/test/flow/async_generators/migrated_0002.js new file mode 100644 index 0000000..fafb9af --- /dev/null +++ b/lib/test/flow/async_generators/migrated_0002.js @@ -0,0 +1 @@ +class C { async *m() {} } diff --git a/lib/test/flow/async_generators/migrated_0002.tree.json b/lib/test/flow/async_generators/migrated_0002.tree.json new file mode 100644 index 0000000..ac236f9 --- /dev/null +++ b/lib/test/flow/async_generators/migrated_0002.tree.json @@ -0,0 +1,69 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":25}}, + "range":[8,25], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":23}}, + "range":[10,23], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "range":[17,18], + "name":"m", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, + "range":[18,23], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, + "range":[21,23], + "body":[] + }, + "async":true, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_generators/migrated_0003.js b/lib/test/flow/async_generators/migrated_0003.js new file mode 100644 index 0000000..37bea77 --- /dev/null +++ b/lib/test/flow/async_generators/migrated_0003.js @@ -0,0 +1 @@ +class C { async *mt(a: T) {} } diff --git a/lib/test/flow/async_generators/migrated_0003.tree.json b/lib/test/flow/async_generators/migrated_0003.tree.json new file mode 100644 index 0000000..bfd0b29 --- /dev/null +++ b/lib/test/flow/async_generators/migrated_0003.tree.json @@ -0,0 +1,111 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":33}}, + "range":[8,33], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":31}}, + "range":[10,31], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, + "range":[17,19], + "name":"mt", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "range":[19,31], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":27}}, + "range":[23,27], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":27}}, + "range":[24,27], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, + "range":[26,27], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, + "range":[26,27], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, + "range":[29,31], + "body":[] + }, + "async":true, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, + "range":[19,22], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_generators/migrated_0004.js b/lib/test/flow/async_generators/migrated_0004.js new file mode 100644 index 0000000..3de5b9c --- /dev/null +++ b/lib/test/flow/async_generators/migrated_0004.js @@ -0,0 +1 @@ +class C { static async *m(a) {} } diff --git a/lib/test/flow/async_generators/migrated_0004.tree.json b/lib/test/flow/async_generators/migrated_0004.tree.json new file mode 100644 index 0000000..2a5c385 --- /dev/null +++ b/lib/test/flow/async_generators/migrated_0004.tree.json @@ -0,0 +1,78 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":33}}, + "range":[8,33], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":31}}, + "range":[10,31], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, + "range":[24,25], + "name":"m", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":31}}, + "range":[25,31], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, + "range":[26,27], + "name":"a", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, + "range":[29,31], + "body":[] + }, + "async":true, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":true, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_generators/migrated_0005.js b/lib/test/flow/async_generators/migrated_0005.js new file mode 100644 index 0000000..fe746f5 --- /dev/null +++ b/lib/test/flow/async_generators/migrated_0005.js @@ -0,0 +1 @@ +class C { static async *mt(a: T) {} } diff --git a/lib/test/flow/async_generators/migrated_0005.tree.json b/lib/test/flow/async_generators/migrated_0005.tree.json new file mode 100644 index 0000000..ea4ac89 --- /dev/null +++ b/lib/test/flow/async_generators/migrated_0005.tree.json @@ -0,0 +1,111 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "range":[0,40], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "range":[0,40], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":40}}, + "range":[8,40], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":38}}, + "range":[10,38], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, + "range":[24,26], + "name":"mt", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":38}}, + "range":[26,38], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":34}}, + "range":[30,34], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":34}}, + "range":[31,34], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":34}}, + "range":[33,34], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":34}}, + "range":[33,34], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":38}}, + "range":[36,38], + "body":[] + }, + "async":true, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":29}}, + "range":[26,29], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, + "range":[27,28], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "kind":"method", + "static":true, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_generators/migrated_0006.js b/lib/test/flow/async_generators/migrated_0006.js new file mode 100644 index 0000000..43d7805 --- /dev/null +++ b/lib/test/flow/async_generators/migrated_0006.js @@ -0,0 +1 @@ +var e = async function *() {}; diff --git a/lib/test/flow/async_generators/migrated_0006.tree.json b/lib/test/flow/async_generators/migrated_0006.tree.json new file mode 100644 index 0000000..db78927 --- /dev/null +++ b/lib/test/flow/async_generators/migrated_0006.tree.json @@ -0,0 +1,48 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":29}}, + "range":[4,29], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"e", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":29}}, + "range":[8,29], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, + "range":[27,29], + "body":[] + }, + "async":true, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_generators/migrated_0007.js b/lib/test/flow/async_generators/migrated_0007.js new file mode 100644 index 0000000..d6e372b --- /dev/null +++ b/lib/test/flow/async_generators/migrated_0007.js @@ -0,0 +1 @@ +var et = async function* (a: T) {}; diff --git a/lib/test/flow/async_generators/migrated_0007.tree.json b/lib/test/flow/async_generators/migrated_0007.tree.json new file mode 100644 index 0000000..5e178d4 --- /dev/null +++ b/lib/test/flow/async_generators/migrated_0007.tree.json @@ -0,0 +1,90 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":37}}, + "range":[4,37], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, + "range":[4,6], + "name":"et", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":37}}, + "range":[9,37], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":33}}, + "range":[29,33], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":33}}, + "range":[30,33], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, + "range":[32,33], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, + "range":[32,33], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":37}}, + "range":[35,37], + "body":[] + }, + "async":true, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":27}}, + "range":[24,27], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, + "range":[25,26], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/async_generators/migrated_0008.js b/lib/test/flow/async_generators/migrated_0008.js new file mode 100644 index 0000000..a54e1ca --- /dev/null +++ b/lib/test/flow/async_generators/migrated_0008.js @@ -0,0 +1 @@ +var n = new async function*() {}; diff --git a/lib/test/flow/async_generators/migrated_0008.tree.json b/lib/test/flow/async_generators/migrated_0008.tree.json new file mode 100644 index 0000000..8979e95 --- /dev/null +++ b/lib/test/flow/async_generators/migrated_0008.tree.json @@ -0,0 +1,54 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":32}}, + "range":[4,32], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"n", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"NewExpression", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":32}}, + "range":[8,32], + "callee":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":32}}, + "range":[12,32], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":32}}, + "range":[30,32], + "body":[] + }, + "async":true, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "arguments":[] + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/bigint/binary-invalid-digit.js b/lib/test/flow/bigint/binary-invalid-digit.js new file mode 100644 index 0000000..34c5497 --- /dev/null +++ b/lib/test/flow/bigint/binary-invalid-digit.js @@ -0,0 +1 @@ +0b2n; \ No newline at end of file diff --git a/lib/test/flow/bigint/binary-invalid-digit.tree.json b/lib/test/flow/bigint/binary-invalid-digit.tree.json new file mode 100644 index 0000000..d83ba07 --- /dev/null +++ b/lib/test/flow/bigint/binary-invalid-digit.tree.json @@ -0,0 +1,45 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "message":"Unexpected token ILLEGAL" + }, + { + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "message":"Unexpected identifier, expected the end of an expression statement (`;`)" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "range":[0,5], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "value":0, + "raw":"0" + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "range":[1,5], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "range":[1,4], + "name":"b2n", + "typeAnnotation":null, + "optional":false + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/bigint/binary-invalid-word.js b/lib/test/flow/bigint/binary-invalid-word.js new file mode 100644 index 0000000..9960053 --- /dev/null +++ b/lib/test/flow/bigint/binary-invalid-word.js @@ -0,0 +1 @@ +0b101011101nhello; diff --git a/lib/test/flow/bigint/binary-invalid-word.tree.json b/lib/test/flow/bigint/binary-invalid-word.tree.json new file mode 100644 index 0000000..be1cb17 --- /dev/null +++ b/lib/test/flow/bigint/binary-invalid-word.tree.json @@ -0,0 +1,45 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "message":"Unexpected token ILLEGAL" + }, + { + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":17}}, + "message":"Unexpected identifier, expected the end of an expression statement (`;`)" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "expression":{ + "type":"BigIntLiteral", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "value":null, + "bigint":"0b101011101n" + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":18}}, + "range":[12,18], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":17}}, + "range":[12,17], + "name":"hello", + "typeAnnotation":null, + "optional":false + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/bigint/exponent-part.js b/lib/test/flow/bigint/exponent-part.js new file mode 100644 index 0000000..3f17a45 --- /dev/null +++ b/lib/test/flow/bigint/exponent-part.js @@ -0,0 +1 @@ +0e0n; \ No newline at end of file diff --git a/lib/test/flow/bigint/exponent-part.tree.json b/lib/test/flow/bigint/exponent-part.tree.json new file mode 100644 index 0000000..c5ea175 --- /dev/null +++ b/lib/test/flow/bigint/exponent-part.tree.json @@ -0,0 +1,27 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "message":"A bigint literal cannot use exponential notation" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "range":[0,5], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "range":[0,5], + "expression":{ + "type":"BigIntLiteral", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "value":null, + "bigint":"0e0n" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/bigint/float-invalid-dot-dot.js b/lib/test/flow/bigint/float-invalid-dot-dot.js new file mode 100644 index 0000000..5a5bec5 --- /dev/null +++ b/lib/test/flow/bigint/float-invalid-dot-dot.js @@ -0,0 +1 @@ +1..n; diff --git a/lib/test/flow/bigint/float-invalid-dot-dot.tree.json b/lib/test/flow/bigint/float-invalid-dot-dot.tree.json new file mode 100644 index 0000000..085bde5 --- /dev/null +++ b/lib/test/flow/bigint/float-invalid-dot-dot.tree.json @@ -0,0 +1,35 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "range":[0,5], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "range":[0,5], + "expression":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "object":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "range":[0,2], + "value":1, + "raw":"1." + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":4}}, + "range":[3,4], + "name":"n", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/bigint/float-invalid-dot.js b/lib/test/flow/bigint/float-invalid-dot.js new file mode 100644 index 0000000..b70823f --- /dev/null +++ b/lib/test/flow/bigint/float-invalid-dot.js @@ -0,0 +1 @@ +.1n; \ No newline at end of file diff --git a/lib/test/flow/bigint/float-invalid-dot.tree.json b/lib/test/flow/bigint/float-invalid-dot.tree.json new file mode 100644 index 0000000..27d5b6e --- /dev/null +++ b/lib/test/flow/bigint/float-invalid-dot.tree.json @@ -0,0 +1,27 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "message":"A bigint literal must be an integer" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "expression":{ + "type":"BigIntLiteral", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "value":null, + "bigint":".1n" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/bigint/float-invalid-without-fractional-digits.js b/lib/test/flow/bigint/float-invalid-without-fractional-digits.js new file mode 100644 index 0000000..8bd0646 --- /dev/null +++ b/lib/test/flow/bigint/float-invalid-without-fractional-digits.js @@ -0,0 +1 @@ +1.n; \ No newline at end of file diff --git a/lib/test/flow/bigint/float-invalid-without-fractional-digits.tree.json b/lib/test/flow/bigint/float-invalid-without-fractional-digits.tree.json new file mode 100644 index 0000000..cb68c63 --- /dev/null +++ b/lib/test/flow/bigint/float-invalid-without-fractional-digits.tree.json @@ -0,0 +1,27 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "message":"A bigint literal must be an integer" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "expression":{ + "type":"BigIntLiteral", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "value":null, + "bigint":"1.n" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/bigint/float-invalid.js b/lib/test/flow/bigint/float-invalid.js new file mode 100644 index 0000000..6a7194c --- /dev/null +++ b/lib/test/flow/bigint/float-invalid.js @@ -0,0 +1 @@ +1.0n; \ No newline at end of file diff --git a/lib/test/flow/bigint/float-invalid.tree.json b/lib/test/flow/bigint/float-invalid.tree.json new file mode 100644 index 0000000..ca7f202 --- /dev/null +++ b/lib/test/flow/bigint/float-invalid.tree.json @@ -0,0 +1,27 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "message":"A bigint literal must be an integer" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "range":[0,5], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "range":[0,5], + "expression":{ + "type":"BigIntLiteral", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "value":null, + "bigint":"1.0n" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/bigint/hex-invalid-word.js b/lib/test/flow/bigint/hex-invalid-word.js new file mode 100644 index 0000000..bc999b4 --- /dev/null +++ b/lib/test/flow/bigint/hex-invalid-word.js @@ -0,0 +1 @@ +0xfff123nhello; \ No newline at end of file diff --git a/lib/test/flow/bigint/hex-invalid-word.tree.json b/lib/test/flow/bigint/hex-invalid-word.tree.json new file mode 100644 index 0000000..ef328df --- /dev/null +++ b/lib/test/flow/bigint/hex-invalid-word.tree.json @@ -0,0 +1,45 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "message":"Unexpected token ILLEGAL" + }, + { + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "message":"Unexpected identifier, expected the end of an expression statement (`;`)" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "range":[0,9], + "expression":{ + "type":"BigIntLiteral", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "range":[0,9], + "value":null, + "bigint":"0xfff123n" + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "range":[9,15], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "range":[9,14], + "name":"hello", + "typeAnnotation":null, + "optional":false + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/bigint/hexadecimal-invalid-digit.js b/lib/test/flow/bigint/hexadecimal-invalid-digit.js new file mode 100644 index 0000000..8227cd1 --- /dev/null +++ b/lib/test/flow/bigint/hexadecimal-invalid-digit.js @@ -0,0 +1 @@ +0xgn; \ No newline at end of file diff --git a/lib/test/flow/bigint/hexadecimal-invalid-digit.tree.json b/lib/test/flow/bigint/hexadecimal-invalid-digit.tree.json new file mode 100644 index 0000000..2722524 --- /dev/null +++ b/lib/test/flow/bigint/hexadecimal-invalid-digit.tree.json @@ -0,0 +1,45 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "message":"Unexpected token ILLEGAL" + }, + { + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "message":"Unexpected identifier, expected the end of an expression statement (`;`)" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "range":[0,5], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "value":0, + "raw":"0" + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "range":[1,5], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "range":[1,4], + "name":"xgn", + "typeAnnotation":null, + "optional":false + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/bigint/legacy-octal-invalid.js b/lib/test/flow/bigint/legacy-octal-invalid.js new file mode 100644 index 0000000..213d49a --- /dev/null +++ b/lib/test/flow/bigint/legacy-octal-invalid.js @@ -0,0 +1 @@ +0123n; diff --git a/lib/test/flow/bigint/legacy-octal-invalid.tree.json b/lib/test/flow/bigint/legacy-octal-invalid.tree.json new file mode 100644 index 0000000..e445054 --- /dev/null +++ b/lib/test/flow/bigint/legacy-octal-invalid.tree.json @@ -0,0 +1,45 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "message":"Unexpected token ILLEGAL" + }, + { + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "message":"Unexpected identifier, expected the end of an expression statement (`;`)" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "value":83, + "raw":"0123" + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, + "range":[4,6], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"n", + "typeAnnotation":null, + "optional":false + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/bigint/octal-new-invalid-word.js b/lib/test/flow/bigint/octal-new-invalid-word.js new file mode 100644 index 0000000..2fe4907 --- /dev/null +++ b/lib/test/flow/bigint/octal-new-invalid-word.js @@ -0,0 +1 @@ +0o16432nhello; \ No newline at end of file diff --git a/lib/test/flow/bigint/octal-new-invalid-word.tree.json b/lib/test/flow/bigint/octal-new-invalid-word.tree.json new file mode 100644 index 0000000..d169955 --- /dev/null +++ b/lib/test/flow/bigint/octal-new-invalid-word.tree.json @@ -0,0 +1,45 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "message":"Unexpected token ILLEGAL" + }, + { + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, + "message":"Unexpected identifier, expected the end of an expression statement (`;`)" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "range":[0,8], + "expression":{ + "type":"BigIntLiteral", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "range":[0,8], + "value":null, + "bigint":"0o16432n" + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, + "range":[8,14], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, + "range":[8,13], + "name":"hello", + "typeAnnotation":null, + "optional":false + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/bigint/small-invalid-word.js b/lib/test/flow/bigint/small-invalid-word.js new file mode 100644 index 0000000..b9f1706 --- /dev/null +++ b/lib/test/flow/bigint/small-invalid-word.js @@ -0,0 +1 @@ +100nhello; \ No newline at end of file diff --git a/lib/test/flow/bigint/small-invalid-word.tree.json b/lib/test/flow/bigint/small-invalid-word.tree.json new file mode 100644 index 0000000..e1c37d6 --- /dev/null +++ b/lib/test/flow/bigint/small-invalid-word.tree.json @@ -0,0 +1,45 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "message":"Unexpected token ILLEGAL" + }, + { + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, + "message":"Unexpected identifier, expected the end of an expression statement (`;`)" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "expression":{ + "type":"BigIntLiteral", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "value":null, + "bigint":"100n" + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, + "range":[4,10], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, + "range":[4,9], + "name":"hello", + "typeAnnotation":null, + "optional":false + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/bigint/valid-binary.js b/lib/test/flow/bigint/valid-binary.js new file mode 100644 index 0000000..0283f39 --- /dev/null +++ b/lib/test/flow/bigint/valid-binary.js @@ -0,0 +1 @@ +0b101011101n; diff --git a/lib/test/flow/bigint/valid-binary.tree.json b/lib/test/flow/bigint/valid-binary.tree.json new file mode 100644 index 0000000..b2fdecb --- /dev/null +++ b/lib/test/flow/bigint/valid-binary.tree.json @@ -0,0 +1,21 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"BigIntLiteral", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "value":null, + "bigint":"0b101011101n" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/bigint/valid-hex.js b/lib/test/flow/bigint/valid-hex.js new file mode 100644 index 0000000..e475c48 --- /dev/null +++ b/lib/test/flow/bigint/valid-hex.js @@ -0,0 +1 @@ +0xfff123n; diff --git a/lib/test/flow/bigint/valid-hex.tree.json b/lib/test/flow/bigint/valid-hex.tree.json new file mode 100644 index 0000000..4f42c3f --- /dev/null +++ b/lib/test/flow/bigint/valid-hex.tree.json @@ -0,0 +1,21 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "expression":{ + "type":"BigIntLiteral", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "range":[0,9], + "value":null, + "bigint":"0xfff123n" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/bigint/valid-large.js b/lib/test/flow/bigint/valid-large.js new file mode 100644 index 0000000..0fbe10e --- /dev/null +++ b/lib/test/flow/bigint/valid-large.js @@ -0,0 +1 @@ +9223372036854775807n; \ No newline at end of file diff --git a/lib/test/flow/bigint/valid-large.tree.json b/lib/test/flow/bigint/valid-large.tree.json new file mode 100644 index 0000000..4e46c99 --- /dev/null +++ b/lib/test/flow/bigint/valid-large.tree.json @@ -0,0 +1,21 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "expression":{ + "type":"BigIntLiteral", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "value":null, + "bigint":"9223372036854775807n" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/bigint/valid-octal-new.js b/lib/test/flow/bigint/valid-octal-new.js new file mode 100644 index 0000000..115f405 --- /dev/null +++ b/lib/test/flow/bigint/valid-octal-new.js @@ -0,0 +1 @@ +0o16432n; diff --git a/lib/test/flow/bigint/valid-octal-new.tree.json b/lib/test/flow/bigint/valid-octal-new.tree.json new file mode 100644 index 0000000..1d3ea1a --- /dev/null +++ b/lib/test/flow/bigint/valid-octal-new.tree.json @@ -0,0 +1,21 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "range":[0,9], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "range":[0,9], + "expression":{ + "type":"BigIntLiteral", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "range":[0,8], + "value":null, + "bigint":"0o16432n" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/bigint/valid-small.js b/lib/test/flow/bigint/valid-small.js new file mode 100644 index 0000000..e96cca5 --- /dev/null +++ b/lib/test/flow/bigint/valid-small.js @@ -0,0 +1 @@ +100n; diff --git a/lib/test/flow/bigint/valid-small.tree.json b/lib/test/flow/bigint/valid-small.tree.json new file mode 100644 index 0000000..3871b91 --- /dev/null +++ b/lib/test/flow/bigint/valid-small.tree.json @@ -0,0 +1,21 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "range":[0,5], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "range":[0,5], + "expression":{ + "type":"BigIntLiteral", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "value":null, + "bigint":"100n" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/call_properties/migrated_0000.js b/lib/test/flow/call_properties/migrated_0000.js new file mode 100644 index 0000000..ff7151e --- /dev/null +++ b/lib/test/flow/call_properties/migrated_0000.js @@ -0,0 +1 @@ +var a : { (): number } diff --git a/lib/test/flow/call_properties/migrated_0000.tree.json b/lib/test/flow/call_properties/migrated_0000.tree.json new file mode 100644 index 0000000..4888729 --- /dev/null +++ b/lib/test/flow/call_properties/migrated_0000.tree.json @@ -0,0 +1,65 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":22}}, + "range":[4,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":22}}, + "range":[4,22], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":22}}, + "range":[6,22], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":22}}, + "range":[8,22], + "exact":false, + "inexact":false, + "properties":[], + "indexers":[], + "callProperties":[ + { + "type":"ObjectTypeCallProperty", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":20}}, + "range":[10,20], + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":20}}, + "range":[10,20], + "params":[], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":20}}, + "range":[14,20] + }, + "rest":null, + "typeParameters":null + }, + "static":false + } + ], + "internalSlots":[] + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/call_properties/migrated_0001.js b/lib/test/flow/call_properties/migrated_0001.js new file mode 100644 index 0000000..a8234ff --- /dev/null +++ b/lib/test/flow/call_properties/migrated_0001.js @@ -0,0 +1 @@ +var a : { (): number; } diff --git a/lib/test/flow/call_properties/migrated_0001.tree.json b/lib/test/flow/call_properties/migrated_0001.tree.json new file mode 100644 index 0000000..5893367 --- /dev/null +++ b/lib/test/flow/call_properties/migrated_0001.tree.json @@ -0,0 +1,65 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":23}}, + "range":[4,23], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":23}}, + "range":[4,23], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":23}}, + "range":[6,23], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":23}}, + "range":[8,23], + "exact":false, + "inexact":false, + "properties":[], + "indexers":[], + "callProperties":[ + { + "type":"ObjectTypeCallProperty", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":20}}, + "range":[10,20], + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":20}}, + "range":[10,20], + "params":[], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":20}}, + "range":[14,20] + }, + "rest":null, + "typeParameters":null + }, + "static":false + } + ], + "internalSlots":[] + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/call_properties/migrated_0002.js b/lib/test/flow/call_properties/migrated_0002.js new file mode 100644 index 0000000..45f4ade --- /dev/null +++ b/lib/test/flow/call_properties/migrated_0002.js @@ -0,0 +1 @@ +var a : { (): number; y: string; (x: string): string } diff --git a/lib/test/flow/call_properties/migrated_0002.tree.json b/lib/test/flow/call_properties/migrated_0002.tree.json new file mode 100644 index 0000000..a60ed92 --- /dev/null +++ b/lib/test/flow/call_properties/migrated_0002.tree.json @@ -0,0 +1,129 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, + "range":[0,54], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, + "range":[0,54], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":54}}, + "range":[4,54], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":54}}, + "range":[4,54], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":54}}, + "range":[6,54], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":54}}, + "range":[8,54], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":31}}, + "range":[22,31], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, + "range":[22,23], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":31}}, + "range":[25,31] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[ + { + "type":"ObjectTypeCallProperty", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":20}}, + "range":[10,20], + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":20}}, + "range":[10,20], + "params":[], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":20}}, + "range":[14,20] + }, + "rest":null, + "typeParameters":null + }, + "static":false + }, + { + "type":"ObjectTypeCallProperty", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":52}}, + "range":[33,52], + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":52}}, + "range":[33,52], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":43}}, + "range":[34,43], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, + "range":[34,35], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":43}}, + "range":[37,43] + }, + "optional":false + } + ], + "returnType":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":46},"end":{"line":1,"column":52}}, + "range":[46,52] + }, + "rest":null, + "typeParameters":null + }, + "static":false + } + ], + "internalSlots":[] + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/call_properties/migrated_0003.js b/lib/test/flow/call_properties/migrated_0003.js new file mode 100644 index 0000000..14e9c5a --- /dev/null +++ b/lib/test/flow/call_properties/migrated_0003.js @@ -0,0 +1 @@ +var a : { (x: T): number; } diff --git a/lib/test/flow/call_properties/migrated_0003.tree.json b/lib/test/flow/call_properties/migrated_0003.tree.json new file mode 100644 index 0000000..71da97b --- /dev/null +++ b/lib/test/flow/call_properties/migrated_0003.tree.json @@ -0,0 +1,109 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":30}}, + "range":[4,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":30}}, + "range":[4,30], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":30}}, + "range":[6,30], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":30}}, + "range":[8,30], + "exact":false, + "inexact":false, + "properties":[], + "indexers":[], + "callProperties":[ + { + "type":"ObjectTypeCallProperty", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":27}}, + "range":[10,27], + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":27}}, + "range":[10,27], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":18}}, + "range":[14,18], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "range":[17,18], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "range":[17,18], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "optional":false + } + ], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "range":[21,27] + }, + "rest":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, + "range":[10,13], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "static":false + } + ], + "internalSlots":[] + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/call_properties/migrated_0004.js b/lib/test/flow/call_properties/migrated_0004.js new file mode 100644 index 0000000..4ffdf29 --- /dev/null +++ b/lib/test/flow/call_properties/migrated_0004.js @@ -0,0 +1 @@ +interface A { (): number; } diff --git a/lib/test/flow/call_properties/migrated_0004.tree.json b/lib/test/flow/call_properties/migrated_0004.tree.json new file mode 100644 index 0000000..f871c18 --- /dev/null +++ b/lib/test/flow/call_properties/migrated_0004.tree.json @@ -0,0 +1,53 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "body":[ + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":27}}, + "range":[12,27], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[ + { + "type":"ObjectTypeCallProperty", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":24}}, + "range":[14,24], + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":24}}, + "range":[14,24], + "params":[], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":24}}, + "range":[18,24] + }, + "rest":null, + "typeParameters":null + }, + "static":false + } + ], + "internalSlots":[] + }, + "extends":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/call_properties_invalid/migrated_0000.js b/lib/test/flow/call_properties_invalid/migrated_0000.js new file mode 100644 index 0000000..dd2c707 --- /dev/null +++ b/lib/test/flow/call_properties_invalid/migrated_0000.js @@ -0,0 +1 @@ +var a : { () } diff --git a/lib/test/flow/call_properties_invalid/migrated_0000.tree.json b/lib/test/flow/call_properties_invalid/migrated_0000.tree.json new file mode 100644 index 0000000..6472942 --- /dev/null +++ b/lib/test/flow/call_properties_invalid/migrated_0000.tree.json @@ -0,0 +1,79 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "message":"Unexpected token `}`, expected the token `:`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the token `}`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,15], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,15], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":2,"column":0}}, + "range":[4,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":2,"column":0}}, + "range":[4,15], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":2,"column":0}}, + "range":[6,15], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":2,"column":0}}, + "range":[8,15], + "inexact":false, + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[ + { + "type":"ObjectTypeCallProperty", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, + "range":[10,14], + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, + "range":[10,14], + "params":[], + "returnType":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "range":[15,15] + }, + "rest":null, + "typeParameters":null + }, + "static":false + } + ], + "internalSlots":[] + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/catch/optional_catch_binding.js b/lib/test/flow/catch/optional_catch_binding.js new file mode 100644 index 0000000..0c6986f --- /dev/null +++ b/lib/test/flow/catch/optional_catch_binding.js @@ -0,0 +1 @@ +try {} catch {} diff --git a/lib/test/flow/catch/optional_catch_binding.tree.json b/lib/test/flow/catch/optional_catch_binding.tree.json new file mode 100644 index 0000000..224a0c7 --- /dev/null +++ b/lib/test/flow/catch/optional_catch_binding.tree.json @@ -0,0 +1,26 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "body":[ + { + "type":"TryStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "block":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, + "body":[] + }, + "handler":{ + "type":"CatchClause", + "loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":15}}, + "param":null, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, + "body":[] + } + } + } + ] +} diff --git a/lib/test/flow/class_expression/anonymous_implements.js b/lib/test/flow/class_expression/anonymous_implements.js new file mode 100644 index 0000000..daa31ad --- /dev/null +++ b/lib/test/flow/class_expression/anonymous_implements.js @@ -0,0 +1 @@ +(class implements C {}) diff --git a/lib/test/flow/class_expression/anonymous_implements.tree.json b/lib/test/flow/class_expression/anonymous_implements.tree.json new file mode 100644 index 0000000..ff4bd18 --- /dev/null +++ b/lib/test/flow/class_expression/anonymous_implements.tree.json @@ -0,0 +1,46 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "expression":{ + "type":"ClassExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":22}}, + "range":[1,22], + "id":null, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "range":[20,22], + "body":[] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[ + { + "type":"ClassImplements", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ], + "decorators":[] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_expression/anonymous_with_type_params.js b/lib/test/flow/class_expression/anonymous_with_type_params.js new file mode 100644 index 0000000..3fc5393 --- /dev/null +++ b/lib/test/flow/class_expression/anonymous_with_type_params.js @@ -0,0 +1 @@ +(class {}); diff --git a/lib/test/flow/class_expression/anonymous_with_type_params.tree.json b/lib/test/flow/class_expression/anonymous_with_type_params.tree.json new file mode 100644 index 0000000..9e1da09 --- /dev/null +++ b/lib/test/flow/class_expression/anonymous_with_type_params.tree.json @@ -0,0 +1,70 @@ +{ + "type": "Program", + "loc": { + "source": null, + "start": {"line": 1, "column": 0}, + "end": {"line": 1, "column": 15} + }, + "range": [0, 15], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "source": null, + "start": {"line": 1, "column": 0}, + "end": {"line": 1, "column": 15} + }, + "range": [0, 15], + "expression": { + "type": "ClassExpression", + "loc": { + "source": null, + "start": {"line": 1, "column": 1}, + "end": {"line": 1, "column": 13} + }, + "range": [1, 13], + "id": null, + "body": { + "type": "ClassBody", + "loc": { + "source": null, + "start": {"line": 1, "column": 11}, + "end": {"line": 1, "column": 13} + }, + "range": [11, 13], + "body": [] + }, + "typeParameters": { + "type": "TypeParameterDeclaration", + "loc": { + "source": null, + "start": {"line": 1, "column": 7}, + "end": {"line": 1, "column": 10} + }, + "range": [7, 10], + "params": [ + { + "type": "TypeParameter", + "loc": { + "source": null, + "start": {"line": 1, "column": 8}, + "end": {"line": 1, "column": 9} + }, + "range": [8, 9], + "name": "T", + "bound": null, + "variance": null, + "default": null + } + ] + }, + "superClass": null, + "superTypeParameters": null, + "implements": [], + "decorators": [] + }, + "directive": null + } + ], + "comments": [] +} diff --git a/lib/test/flow/class_method_kinds/async_as_id_tparams.js b/lib/test/flow/class_method_kinds/async_as_id_tparams.js new file mode 100644 index 0000000..3c15dcb --- /dev/null +++ b/lib/test/flow/class_method_kinds/async_as_id_tparams.js @@ -0,0 +1,3 @@ +class C { + async() {} +} diff --git a/lib/test/flow/class_method_kinds/async_as_id_tparams.tree.json b/lib/test/flow/class_method_kinds/async_as_id_tparams.tree.json new file mode 100644 index 0000000..f7f4635 --- /dev/null +++ b/lib/test/flow/class_method_kinds/async_as_id_tparams.tree.json @@ -0,0 +1,84 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,27], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,27], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "range":[8,27], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, + "range":[12,25], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":7}}, + "range":[12,17], + "name":"async", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":15}}, + "range":[17,25], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":15}}, + "range":[23,25], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":10}}, + "range":[17,20], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "range":[18,19], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_method_kinds/async_tparams.js b/lib/test/flow/class_method_kinds/async_tparams.js new file mode 100644 index 0000000..01998a7 --- /dev/null +++ b/lib/test/flow/class_method_kinds/async_tparams.js @@ -0,0 +1,3 @@ +class C { + async m() {} +} diff --git a/lib/test/flow/class_method_kinds/async_tparams.tree.json b/lib/test/flow/class_method_kinds/async_tparams.tree.json new file mode 100644 index 0000000..e955fcc --- /dev/null +++ b/lib/test/flow/class_method_kinds/async_tparams.tree.json @@ -0,0 +1,84 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,29], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,29], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "range":[8,29], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":17}}, + "range":[12,27], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "range":[18,19], + "name":"m", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":17}}, + "range":[19,27], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":15},"end":{"line":2,"column":17}}, + "range":[25,27], + "body":[] + }, + "async":true, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":12}}, + "range":[19,22], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, + "range":[20,21], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_method_kinds/get_as_id.js b/lib/test/flow/class_method_kinds/get_as_id.js new file mode 100644 index 0000000..79add1d --- /dev/null +++ b/lib/test/flow/class_method_kinds/get_as_id.js @@ -0,0 +1,3 @@ +class C { + get() {} +} diff --git a/lib/test/flow/class_method_kinds/get_as_id.tree.json b/lib/test/flow/class_method_kinds/get_as_id.tree.json new file mode 100644 index 0000000..92a267a --- /dev/null +++ b/lib/test/flow/class_method_kinds/get_as_id.tree.json @@ -0,0 +1,69 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,22], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "range":[8,22], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":10}}, + "range":[12,20], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "range":[12,15], + "name":"get", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":10}}, + "range":[15,20], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":10}}, + "range":[18,20], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_method_kinds/get_as_id_tparams.js b/lib/test/flow/class_method_kinds/get_as_id_tparams.js new file mode 100644 index 0000000..1286c36 --- /dev/null +++ b/lib/test/flow/class_method_kinds/get_as_id_tparams.js @@ -0,0 +1,3 @@ +class C { + get() {} +} diff --git a/lib/test/flow/class_method_kinds/get_as_id_tparams.tree.json b/lib/test/flow/class_method_kinds/get_as_id_tparams.tree.json new file mode 100644 index 0000000..8921e66 --- /dev/null +++ b/lib/test/flow/class_method_kinds/get_as_id_tparams.tree.json @@ -0,0 +1,84 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,25], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,25], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "range":[8,25], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, + "range":[12,23], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "range":[12,15], + "name":"get", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":13}}, + "range":[15,23], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":13}}, + "range":[21,23], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":8}}, + "range":[15,18], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, + "range":[16,17], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_method_kinds/migrated_0000.js b/lib/test/flow/class_method_kinds/migrated_0000.js new file mode 100644 index 0000000..c234977 --- /dev/null +++ b/lib/test/flow/class_method_kinds/migrated_0000.js @@ -0,0 +1 @@ +class Kind { foo() {} } diff --git a/lib/test/flow/class_method_kinds/migrated_0000.tree.json b/lib/test/flow/class_method_kinds/migrated_0000.tree.json new file mode 100644 index 0000000..4ac3857 --- /dev/null +++ b/lib/test/flow/class_method_kinds/migrated_0000.tree.json @@ -0,0 +1,69 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":10}}, + "range":[6,10], + "name":"Kind", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":23}}, + "range":[11,23], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":21}}, + "range":[13,21], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, + "range":[13,16], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, + "range":[16,21], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, + "range":[19,21], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_method_kinds/migrated_0001.js b/lib/test/flow/class_method_kinds/migrated_0001.js new file mode 100644 index 0000000..be488f3 --- /dev/null +++ b/lib/test/flow/class_method_kinds/migrated_0001.js @@ -0,0 +1 @@ +class Kind { "foo"() {} } diff --git a/lib/test/flow/class_method_kinds/migrated_0001.tree.json b/lib/test/flow/class_method_kinds/migrated_0001.tree.json new file mode 100644 index 0000000..5ca919e --- /dev/null +++ b/lib/test/flow/class_method_kinds/migrated_0001.tree.json @@ -0,0 +1,68 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":10}}, + "range":[6,10], + "name":"Kind", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":25}}, + "range":[11,25], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":23}}, + "range":[13,23], + "key":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":18}}, + "range":[13,18], + "value":"foo", + "raw":"\"foo\"" + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, + "range":[18,23], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, + "range":[21,23], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_method_kinds/migrated_0002.js b/lib/test/flow/class_method_kinds/migrated_0002.js new file mode 100644 index 0000000..bf4f91b --- /dev/null +++ b/lib/test/flow/class_method_kinds/migrated_0002.js @@ -0,0 +1 @@ +class Kind { constructor() {} } diff --git a/lib/test/flow/class_method_kinds/migrated_0002.tree.json b/lib/test/flow/class_method_kinds/migrated_0002.tree.json new file mode 100644 index 0000000..09d7fbb --- /dev/null +++ b/lib/test/flow/class_method_kinds/migrated_0002.tree.json @@ -0,0 +1,69 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":10}}, + "range":[6,10], + "name":"Kind", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":31}}, + "range":[11,31], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":29}}, + "range":[13,29], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":24}}, + "range":[13,24], + "name":"constructor", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":29}}, + "range":[24,29], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, + "range":[27,29], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"constructor", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_method_kinds/migrated_0003.js b/lib/test/flow/class_method_kinds/migrated_0003.js new file mode 100644 index 0000000..f331476 --- /dev/null +++ b/lib/test/flow/class_method_kinds/migrated_0003.js @@ -0,0 +1 @@ +class Kind { "constructor"() {} } diff --git a/lib/test/flow/class_method_kinds/migrated_0003.tree.json b/lib/test/flow/class_method_kinds/migrated_0003.tree.json new file mode 100644 index 0000000..9c2933d --- /dev/null +++ b/lib/test/flow/class_method_kinds/migrated_0003.tree.json @@ -0,0 +1,68 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":10}}, + "range":[6,10], + "name":"Kind", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":33}}, + "range":[11,33], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":31}}, + "range":[13,31], + "key":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":26}}, + "range":[13,26], + "value":"constructor", + "raw":"\"constructor\"" + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":31}}, + "range":[26,31], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, + "range":[29,31], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"constructor", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_method_kinds/migrated_0004.js b/lib/test/flow/class_method_kinds/migrated_0004.js new file mode 100644 index 0000000..f797230 --- /dev/null +++ b/lib/test/flow/class_method_kinds/migrated_0004.js @@ -0,0 +1 @@ +class Kind { get a() {} } diff --git a/lib/test/flow/class_method_kinds/migrated_0004.tree.json b/lib/test/flow/class_method_kinds/migrated_0004.tree.json new file mode 100644 index 0000000..7eb7d94 --- /dev/null +++ b/lib/test/flow/class_method_kinds/migrated_0004.tree.json @@ -0,0 +1,69 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":10}}, + "range":[6,10], + "name":"Kind", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":25}}, + "range":[11,25], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":23}}, + "range":[13,23], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "range":[17,18], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, + "range":[18,23], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, + "range":[21,23], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"get", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_method_kinds/migrated_0005.js b/lib/test/flow/class_method_kinds/migrated_0005.js new file mode 100644 index 0000000..94a541e --- /dev/null +++ b/lib/test/flow/class_method_kinds/migrated_0005.js @@ -0,0 +1 @@ +class Kind { get "a"() {} } diff --git a/lib/test/flow/class_method_kinds/migrated_0005.tree.json b/lib/test/flow/class_method_kinds/migrated_0005.tree.json new file mode 100644 index 0000000..207a096 --- /dev/null +++ b/lib/test/flow/class_method_kinds/migrated_0005.tree.json @@ -0,0 +1,68 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":10}}, + "range":[6,10], + "name":"Kind", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":27}}, + "range":[11,27], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":25}}, + "range":[13,25], + "key":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "value":"a", + "raw":"\"a\"" + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":25}}, + "range":[20,25], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, + "range":[23,25], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"get", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_method_kinds/migrated_0006.js b/lib/test/flow/class_method_kinds/migrated_0006.js new file mode 100644 index 0000000..5ce4473 --- /dev/null +++ b/lib/test/flow/class_method_kinds/migrated_0006.js @@ -0,0 +1 @@ +class Kind { set a(x) {} } diff --git a/lib/test/flow/class_method_kinds/migrated_0006.tree.json b/lib/test/flow/class_method_kinds/migrated_0006.tree.json new file mode 100644 index 0000000..cbd2d8f --- /dev/null +++ b/lib/test/flow/class_method_kinds/migrated_0006.tree.json @@ -0,0 +1,78 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":10}}, + "range":[6,10], + "name":"Kind", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":26}}, + "range":[11,26], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":24}}, + "range":[13,24], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "range":[17,18], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":24}}, + "range":[18,24], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "range":[19,20], + "name":"x", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, + "range":[22,24], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"set", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_method_kinds/migrated_0007.js b/lib/test/flow/class_method_kinds/migrated_0007.js new file mode 100644 index 0000000..76c06f6 --- /dev/null +++ b/lib/test/flow/class_method_kinds/migrated_0007.js @@ -0,0 +1 @@ +class Kind { set "a"(x) {} } diff --git a/lib/test/flow/class_method_kinds/migrated_0007.tree.json b/lib/test/flow/class_method_kinds/migrated_0007.tree.json new file mode 100644 index 0000000..70e7487 --- /dev/null +++ b/lib/test/flow/class_method_kinds/migrated_0007.tree.json @@ -0,0 +1,77 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":10}}, + "range":[6,10], + "name":"Kind", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":28}}, + "range":[11,28], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":26}}, + "range":[13,26], + "key":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "value":"a", + "raw":"\"a\"" + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":26}}, + "range":[20,26], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "name":"x", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, + "range":[24,26], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"set", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_method_kinds/multiple_constructors.js b/lib/test/flow/class_method_kinds/multiple_constructors.js new file mode 100644 index 0000000..d84f17c --- /dev/null +++ b/lib/test/flow/class_method_kinds/multiple_constructors.js @@ -0,0 +1,25 @@ +class Foo { + constructor() { } + constructor() { } // Error +} + +class Bar { + static constructor: number // Error +} + +class Baz { + constructor: number // Error +} + +class Static { + static constructor() { } + static constructor() { } // Fine +} + +class Proto { + prototype: number // Fine +} + +class ProtoBad { + static prototype: number // Error +} diff --git a/lib/test/flow/class_method_kinds/multiple_constructors.tree.json b/lib/test/flow/class_method_kinds/multiple_constructors.tree.json new file mode 100644 index 0000000..72a7847 --- /dev/null +++ b/lib/test/flow/class_method_kinds/multiple_constructors.tree.json @@ -0,0 +1,465 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":19}}, + "message":"Classes may only have one constructor" + }, + { + "loc":{"source":null,"start":{"line":7,"column":9},"end":{"line":7,"column":20}}, + "message":"Classes may not have static fields named `constructor`." + }, + { + "loc":{"source":null,"start":{"line":11,"column":2},"end":{"line":11,"column":13}}, + "message":"Classes may not have fields named `constructor`." + }, + { + "loc":{"source":null,"start":{"line":24,"column":9},"end":{"line":24,"column":18}}, + "message":"Classes may not have static fields named `prototype`." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":25,"column":1}}, + "range":[0,342], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,62], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":4,"column":1}}, + "range":[10,62], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":19}}, + "range":[14,31], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, + "range":[14,25], + "name":"constructor", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":19}}, + "range":[25,31], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":19}}, + "range":[28,31], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"constructor", + "static":false, + "computed":false, + "decorators":[] + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":19}}, + "range":[34,51], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":13}}, + "range":[34,45], + "name":"constructor", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":3,"column":13},"end":{"line":3,"column":19}}, + "range":[45,51], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":16},"end":{"line":3,"column":19}}, + "range":[48,51], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"constructor", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":6,"column":0},"end":{"line":8,"column":1}}, + "range":[64,115], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":6},"end":{"line":6,"column":9}}, + "range":[70,73], + "name":"Bar", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":6,"column":10},"end":{"line":8,"column":1}}, + "range":[74,115], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":7,"column":2},"end":{"line":7,"column":28}}, + "range":[78,104], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":9},"end":{"line":7,"column":20}}, + "range":[85,96], + "name":"constructor", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":20},"end":{"line":7,"column":28}}, + "range":[96,104], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":22},"end":{"line":7,"column":28}}, + "range":[98,104] + } + }, + "computed":false, + "static":true, + "variance":null + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":10,"column":0},"end":{"line":12,"column":1}}, + "range":[117,161], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":10,"column":6},"end":{"line":10,"column":9}}, + "range":[123,126], + "name":"Baz", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":10,"column":10},"end":{"line":12,"column":1}}, + "range":[127,161], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":11,"column":2},"end":{"line":11,"column":21}}, + "range":[131,150], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":11,"column":2},"end":{"line":11,"column":13}}, + "range":[131,142], + "name":"constructor", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":11,"column":13},"end":{"line":11,"column":21}}, + "range":[142,150], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":11,"column":15},"end":{"line":11,"column":21}}, + "range":[144,150] + } + }, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":14,"column":0},"end":{"line":17,"column":1}}, + "range":[163,241], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":14,"column":6},"end":{"line":14,"column":12}}, + "range":[169,175], + "name":"Static", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":14,"column":13},"end":{"line":17,"column":1}}, + "range":[176,241], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":15,"column":2},"end":{"line":15,"column":26}}, + "range":[180,204], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":15,"column":9},"end":{"line":15,"column":20}}, + "range":[187,198], + "name":"constructor", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":15,"column":20},"end":{"line":15,"column":26}}, + "range":[198,204], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":15,"column":23},"end":{"line":15,"column":26}}, + "range":[201,204], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":true, + "computed":false, + "decorators":[] + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":16,"column":2},"end":{"line":16,"column":26}}, + "range":[207,231], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":16,"column":9},"end":{"line":16,"column":20}}, + "range":[214,225], + "name":"constructor", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":16,"column":20},"end":{"line":16,"column":26}}, + "range":[225,231], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":16,"column":23},"end":{"line":16,"column":26}}, + "range":[228,231], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":true, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":19,"column":0},"end":{"line":21,"column":1}}, + "range":[243,286], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":19,"column":6},"end":{"line":19,"column":11}}, + "range":[249,254], + "name":"Proto", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":19,"column":12},"end":{"line":21,"column":1}}, + "range":[255,286], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":20,"column":2},"end":{"line":20,"column":19}}, + "range":[259,276], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":20,"column":2},"end":{"line":20,"column":11}}, + "range":[259,268], + "name":"prototype", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":20,"column":11},"end":{"line":20,"column":19}}, + "range":[268,276], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":20,"column":13},"end":{"line":20,"column":19}}, + "range":[270,276] + } + }, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":23,"column":0},"end":{"line":25,"column":1}}, + "range":[288,342], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":23,"column":6},"end":{"line":23,"column":14}}, + "range":[294,302], + "name":"ProtoBad", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":23,"column":15},"end":{"line":25,"column":1}}, + "range":[303,342], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":24,"column":2},"end":{"line":24,"column":26}}, + "range":[307,331], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":24,"column":9},"end":{"line":24,"column":18}}, + "range":[314,323], + "name":"prototype", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":24,"column":18},"end":{"line":24,"column":26}}, + "range":[323,331], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":24,"column":20},"end":{"line":24,"column":26}}, + "range":[325,331] + } + }, + "computed":false, + "static":true, + "variance":null + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":3,"column":20},"end":{"line":3,"column":28}}, + "range":[52,60], + "value":" Error" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":7,"column":29},"end":{"line":7,"column":37}}, + "range":[105,113], + "value":" Error" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":11,"column":22},"end":{"line":11,"column":30}}, + "range":[151,159], + "value":" Error" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":16,"column":27},"end":{"line":16,"column":34}}, + "range":[232,239], + "value":" Fine" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":20,"column":20},"end":{"line":20,"column":27}}, + "range":[277,284], + "value":" Fine" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":24,"column":27},"end":{"line":24,"column":35}}, + "range":[332,340], + "value":" Error" + } + ] +} diff --git a/lib/test/flow/class_method_kinds/polymorphic_getter.js b/lib/test/flow/class_method_kinds/polymorphic_getter.js new file mode 100644 index 0000000..ab03b5f --- /dev/null +++ b/lib/test/flow/class_method_kinds/polymorphic_getter.js @@ -0,0 +1 @@ +class Foo { get bar() { } } diff --git a/lib/test/flow/class_method_kinds/polymorphic_getter.tree.json b/lib/test/flow/class_method_kinds/polymorphic_getter.tree.json new file mode 100644 index 0000000..aa7b496 --- /dev/null +++ b/lib/test/flow/class_method_kinds/polymorphic_getter.tree.json @@ -0,0 +1,104 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "message":"Unexpected token `<`, expected the token `(`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "message":"Unexpected token `>`, expected the token `,`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, + "message":"Unexpected token `(`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":19}}, + "message":"Getter should have zero parameters" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":30}}, + "range":[10,30], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":28}}, + "range":[12,28], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":19}}, + "range":[16,19], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":28}}, + "range":[19,28], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, + "range":[22,23], + "name":"", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":28}}, + "range":[25,28], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"get", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_method_kinds/static_async.js b/lib/test/flow/class_method_kinds/static_async.js new file mode 100644 index 0000000..7425e4e --- /dev/null +++ b/lib/test/flow/class_method_kinds/static_async.js @@ -0,0 +1,3 @@ +class C { + static async m() {} +} diff --git a/lib/test/flow/class_method_kinds/static_async.tree.json b/lib/test/flow/class_method_kinds/static_async.tree.json new file mode 100644 index 0000000..fbf4bbc --- /dev/null +++ b/lib/test/flow/class_method_kinds/static_async.tree.json @@ -0,0 +1,69 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,33], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,33], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "range":[8,33], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":21}}, + "range":[12,31], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":15},"end":{"line":2,"column":16}}, + "range":[25,26], + "name":"m", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":21}}, + "range":[26,31], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":21}}, + "range":[29,31], + "body":[] + }, + "async":true, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":true, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_method_kinds/static_async_as_id.js b/lib/test/flow/class_method_kinds/static_async_as_id.js new file mode 100644 index 0000000..05fc9c1 --- /dev/null +++ b/lib/test/flow/class_method_kinds/static_async_as_id.js @@ -0,0 +1,3 @@ +class C { + static async() {} +} diff --git a/lib/test/flow/class_method_kinds/static_async_as_id.tree.json b/lib/test/flow/class_method_kinds/static_async_as_id.tree.json new file mode 100644 index 0000000..03468e4 --- /dev/null +++ b/lib/test/flow/class_method_kinds/static_async_as_id.tree.json @@ -0,0 +1,69 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,31], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "range":[8,31], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":19}}, + "range":[12,29], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":14}}, + "range":[19,24], + "name":"async", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":19}}, + "range":[24,29], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":19}}, + "range":[27,29], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":true, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/async.js b/lib/test/flow/class_properties/async.js new file mode 100644 index 0000000..e08f7f8 --- /dev/null +++ b/lib/test/flow/class_properties/async.js @@ -0,0 +1,3 @@ +class C { + async +} diff --git a/lib/test/flow/class_properties/async.tree.json b/lib/test/flow/class_properties/async.tree.json new file mode 100644 index 0000000..f9c5fc0 --- /dev/null +++ b/lib/test/flow/class_properties/async.tree.json @@ -0,0 +1,51 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,19], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,19], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "range":[8,19], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":7}}, + "range":[12,17], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":7}}, + "range":[12,17], + "name":"async", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":null, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/async_annotated.js b/lib/test/flow/class_properties/async_annotated.js new file mode 100644 index 0000000..5fa04ea --- /dev/null +++ b/lib/test/flow/class_properties/async_annotated.js @@ -0,0 +1,3 @@ +class C { + async: boolean +} diff --git a/lib/test/flow/class_properties/async_annotated.tree.json b/lib/test/flow/class_properties/async_annotated.tree.json new file mode 100644 index 0000000..f6d0347 --- /dev/null +++ b/lib/test/flow/class_properties/async_annotated.tree.json @@ -0,0 +1,60 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,28], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,28], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "range":[8,28], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "range":[12,26], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":7}}, + "range":[12,17], + "name":"async", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":16}}, + "range":[17,26], + "typeAnnotation":{ + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":16}}, + "range":[19,26] + } + }, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/async_asi.js b/lib/test/flow/class_properties/async_asi.js new file mode 100644 index 0000000..a21bfeb --- /dev/null +++ b/lib/test/flow/class_properties/async_asi.js @@ -0,0 +1,4 @@ +class C { + async + foo() {} // not async +} diff --git a/lib/test/flow/class_properties/async_asi.tree.json b/lib/test/flow/class_properties/async_asi.tree.json new file mode 100644 index 0000000..c659f46 --- /dev/null +++ b/lib/test/flow/class_properties/async_asi.tree.json @@ -0,0 +1,94 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,43], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,43], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "range":[8,43], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":7}}, + "range":[12,17], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":7}}, + "range":[12,17], + "name":"async", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":null, + "computed":false, + "static":false, + "variance":null + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":10}}, + "range":[20,28], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":5}}, + "range":[20,23], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":3,"column":5},"end":{"line":3,"column":10}}, + "range":[23,28], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":10}}, + "range":[26,28], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":3,"column":11},"end":{"line":3,"column":23}}, + "range":[29,41], + "value":" not async" + } + ] +} diff --git a/lib/test/flow/class_properties/async_initializer.js b/lib/test/flow/class_properties/async_initializer.js new file mode 100644 index 0000000..b812501 --- /dev/null +++ b/lib/test/flow/class_properties/async_initializer.js @@ -0,0 +1,3 @@ +class C { + async = false +} diff --git a/lib/test/flow/class_properties/async_initializer.options.json b/lib/test/flow/class_properties/async_initializer.options.json new file mode 100644 index 0000000..a327656 --- /dev/null +++ b/lib/test/flow/class_properties/async_initializer.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_class_instance_fields": true +} diff --git a/lib/test/flow/class_properties/async_initializer.tree.json b/lib/test/flow/class_properties/async_initializer.tree.json new file mode 100644 index 0000000..06bd9e3 --- /dev/null +++ b/lib/test/flow/class_properties/async_initializer.tree.json @@ -0,0 +1,57 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,27], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,27], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "range":[8,27], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, + "range":[12,25], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":7}}, + "range":[12,17], + "name":"async", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":15}}, + "range":[20,25], + "value":false, + "raw":"false" + }, + "typeAnnotation":null, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/computed.js b/lib/test/flow/class_properties/computed.js new file mode 100644 index 0000000..4542553 --- /dev/null +++ b/lib/test/flow/class_properties/computed.js @@ -0,0 +1,3 @@ +class C { + ["foo"] +} diff --git a/lib/test/flow/class_properties/computed.tree.json b/lib/test/flow/class_properties/computed.tree.json new file mode 100644 index 0000000..e8643dd --- /dev/null +++ b/lib/test/flow/class_properties/computed.tree.json @@ -0,0 +1,50 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,21], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,21], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "range":[8,21], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "range":[12,19], + "key":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":8}}, + "range":[13,18], + "value":"foo", + "raw":"\"foo\"" + }, + "value":null, + "typeAnnotation":null, + "computed":true, + "static":false, + "variance":null + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/get.js b/lib/test/flow/class_properties/get.js new file mode 100644 index 0000000..fbb3726 --- /dev/null +++ b/lib/test/flow/class_properties/get.js @@ -0,0 +1,3 @@ +class C { + get +} diff --git a/lib/test/flow/class_properties/get.tree.json b/lib/test/flow/class_properties/get.tree.json new file mode 100644 index 0000000..1311a9a --- /dev/null +++ b/lib/test/flow/class_properties/get.tree.json @@ -0,0 +1,51 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,17], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,17], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "range":[8,17], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "range":[12,15], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "range":[12,15], + "name":"get", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":null, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/migrated_0000.js b/lib/test/flow/class_properties/migrated_0000.js new file mode 100644 index 0000000..cd7653d --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0000.js @@ -0,0 +1 @@ +class Properties { x; } diff --git a/lib/test/flow/class_properties/migrated_0000.tree.json b/lib/test/flow/class_properties/migrated_0000.tree.json new file mode 100644 index 0000000..5b8aaba --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0000.tree.json @@ -0,0 +1,51 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, + "range":[6,16], + "name":"Properties", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":23}}, + "range":[17,23], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, + "range":[19,21], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "range":[19,20], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":null, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/migrated_0001.js b/lib/test/flow/class_properties/migrated_0001.js new file mode 100644 index 0000000..d6ec380 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0001.js @@ -0,0 +1 @@ +class Properties { x: string; } diff --git a/lib/test/flow/class_properties/migrated_0001.tree.json b/lib/test/flow/class_properties/migrated_0001.tree.json new file mode 100644 index 0000000..64f69ea --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0001.tree.json @@ -0,0 +1,60 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, + "range":[6,16], + "name":"Properties", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":31}}, + "range":[17,31], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":29}}, + "range":[19,29], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "range":[19,20], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, + "range":[20,28], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":28}}, + "range":[22,28] + } + }, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/migrated_0002.js b/lib/test/flow/class_properties/migrated_0002.js new file mode 100644 index 0000000..a5e3ee1 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0002.js @@ -0,0 +1 @@ +class Properties { x = "hello"; } diff --git a/lib/test/flow/class_properties/migrated_0002.options.json b/lib/test/flow/class_properties/migrated_0002.options.json new file mode 100644 index 0000000..6a29154 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0002.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_class_instance_fields": true +} \ No newline at end of file diff --git a/lib/test/flow/class_properties/migrated_0002.tree.json b/lib/test/flow/class_properties/migrated_0002.tree.json new file mode 100644 index 0000000..6a219c0 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0002.tree.json @@ -0,0 +1,57 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, + "range":[6,16], + "name":"Properties", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":33}}, + "range":[17,33], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "range":[19,31], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "range":[19,20], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":30}}, + "range":[23,30], + "value":"hello", + "raw":"\"hello\"" + }, + "typeAnnotation":null, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/migrated_0003.js b/lib/test/flow/class_properties/migrated_0003.js new file mode 100644 index 0000000..74eb702 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0003.js @@ -0,0 +1 @@ +class Properties { x = "hi mom"; } diff --git a/lib/test/flow/class_properties/migrated_0003.options.json b/lib/test/flow/class_properties/migrated_0003.options.json new file mode 100644 index 0000000..65169ba --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0003.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_class_instance_fields": false +} \ No newline at end of file diff --git a/lib/test/flow/class_properties/migrated_0003.tree.json b/lib/test/flow/class_properties/migrated_0003.tree.json new file mode 100644 index 0000000..0ba85e4 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0003.tree.json @@ -0,0 +1,130 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "message":"Unexpected token `=`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":31}}, + "message":"Unexpected string, expected the token `(`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":32}}, + "message":"Unexpected token `;`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":34}}, + "message":"Unexpected token `}`, expected the token `,`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Rest parameter must be final parameter of an argument list" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the token `)`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the token `{`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the token `}`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,35], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,35], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, + "range":[6,16], + "name":"Properties", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":2,"column":0}}, + "range":[17,35], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "range":[19,20], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "range":[19,20], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":null, + "computed":false, + "static":false, + "variance":null + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":2,"column":0}}, + "range":[21,35], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":2,"column":0}}, + "range":[23,35], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":32}}, + "range":[31,32], + "name":"", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "range":[35,35], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/migrated_0004.js b/lib/test/flow/class_properties/migrated_0004.js new file mode 100644 index 0000000..662a9ff --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0004.js @@ -0,0 +1 @@ +class Properties { x: string = "hello"; } diff --git a/lib/test/flow/class_properties/migrated_0004.options.json b/lib/test/flow/class_properties/migrated_0004.options.json new file mode 100644 index 0000000..6a29154 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0004.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_class_instance_fields": true +} \ No newline at end of file diff --git a/lib/test/flow/class_properties/migrated_0004.tree.json b/lib/test/flow/class_properties/migrated_0004.tree.json new file mode 100644 index 0000000..7bbff11 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0004.tree.json @@ -0,0 +1,66 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "range":[0,41], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "range":[0,41], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, + "range":[6,16], + "name":"Properties", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":41}}, + "range":[17,41], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":39}}, + "range":[19,39], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "range":[19,20], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":38}}, + "range":[31,38], + "value":"hello", + "raw":"\"hello\"" + }, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, + "range":[20,28], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":28}}, + "range":[22,28] + } + }, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/migrated_0005.js b/lib/test/flow/class_properties/migrated_0005.js new file mode 100644 index 0000000..4bad090 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0005.js @@ -0,0 +1 @@ +class Properties { static x; } diff --git a/lib/test/flow/class_properties/migrated_0005.tree.json b/lib/test/flow/class_properties/migrated_0005.tree.json new file mode 100644 index 0000000..cbfc38f --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0005.tree.json @@ -0,0 +1,51 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, + "range":[6,16], + "name":"Properties", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":30}}, + "range":[17,30], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":28}}, + "range":[19,28], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, + "range":[26,27], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":null, + "computed":false, + "static":true, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/migrated_0006.js b/lib/test/flow/class_properties/migrated_0006.js new file mode 100644 index 0000000..510896c --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0006.js @@ -0,0 +1 @@ +class Properties { static x: string; } diff --git a/lib/test/flow/class_properties/migrated_0006.tree.json b/lib/test/flow/class_properties/migrated_0006.tree.json new file mode 100644 index 0000000..53e818a --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0006.tree.json @@ -0,0 +1,60 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, + "range":[6,16], + "name":"Properties", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":38}}, + "range":[17,38], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":36}}, + "range":[19,36], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, + "range":[26,27], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":35}}, + "range":[27,35], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":35}}, + "range":[29,35] + } + }, + "computed":false, + "static":true, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/migrated_0007.js b/lib/test/flow/class_properties/migrated_0007.js new file mode 100644 index 0000000..393ade5 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0007.js @@ -0,0 +1 @@ +class Properties { static x = "hello"; } diff --git a/lib/test/flow/class_properties/migrated_0007.options.json b/lib/test/flow/class_properties/migrated_0007.options.json new file mode 100644 index 0000000..bc69feb --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0007.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_class_static_fields": true +} \ No newline at end of file diff --git a/lib/test/flow/class_properties/migrated_0007.tree.json b/lib/test/flow/class_properties/migrated_0007.tree.json new file mode 100644 index 0000000..7a84095 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0007.tree.json @@ -0,0 +1,57 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "range":[0,40], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "range":[0,40], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, + "range":[6,16], + "name":"Properties", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":40}}, + "range":[17,40], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":38}}, + "range":[19,38], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, + "range":[26,27], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":37}}, + "range":[30,37], + "value":"hello", + "raw":"\"hello\"" + }, + "typeAnnotation":null, + "computed":false, + "static":true, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/migrated_0008.js b/lib/test/flow/class_properties/migrated_0008.js new file mode 100644 index 0000000..6c7af11 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0008.js @@ -0,0 +1 @@ +class Properties { static x = "hi mom"; } diff --git a/lib/test/flow/class_properties/migrated_0008.options.json b/lib/test/flow/class_properties/migrated_0008.options.json new file mode 100644 index 0000000..8552c65 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0008.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_class_static_fields": false +} \ No newline at end of file diff --git a/lib/test/flow/class_properties/migrated_0008.tree.json b/lib/test/flow/class_properties/migrated_0008.tree.json new file mode 100644 index 0000000..7d1727e --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0008.tree.json @@ -0,0 +1,130 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":29}}, + "message":"Unexpected token `=`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":38}}, + "message":"Unexpected string, expected the token `(`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":39}}, + "message":"Unexpected token `;`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":1,"column":40},"end":{"line":1,"column":41}}, + "message":"Unexpected token `}`, expected the token `,`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Rest parameter must be final parameter of an argument list" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the token `)`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the token `{`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the token `}`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,42], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,42], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, + "range":[6,16], + "name":"Properties", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":2,"column":0}}, + "range":[17,42], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, + "range":[19,27], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, + "range":[26,27], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":null, + "computed":false, + "static":true, + "variance":null + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":2,"column":0}}, + "range":[28,42], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":29}}, + "range":[28,29], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":2,"column":0}}, + "range":[30,42], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":39}}, + "range":[38,39], + "name":"", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "range":[42,42], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/migrated_0009.js b/lib/test/flow/class_properties/migrated_0009.js new file mode 100644 index 0000000..e0a9f1e --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0009.js @@ -0,0 +1 @@ +class Properties { static x: string = "hello"; } diff --git a/lib/test/flow/class_properties/migrated_0009.options.json b/lib/test/flow/class_properties/migrated_0009.options.json new file mode 100644 index 0000000..bc69feb --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0009.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_class_static_fields": true +} \ No newline at end of file diff --git a/lib/test/flow/class_properties/migrated_0009.tree.json b/lib/test/flow/class_properties/migrated_0009.tree.json new file mode 100644 index 0000000..433500f --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0009.tree.json @@ -0,0 +1,66 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "range":[0,48], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "range":[0,48], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, + "range":[6,16], + "name":"Properties", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":48}}, + "range":[17,48], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":46}}, + "range":[19,46], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, + "range":[26,27], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":45}}, + "range":[38,45], + "value":"hello", + "raw":"\"hello\"" + }, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":35}}, + "range":[27,35], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":35}}, + "range":[29,35] + } + }, + "computed":false, + "static":true, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/migrated_0010.js b/lib/test/flow/class_properties/migrated_0010.js new file mode 100644 index 0000000..afe9de7 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0010.js @@ -0,0 +1 @@ +class Properties { static [x]: string = "hello"; } diff --git a/lib/test/flow/class_properties/migrated_0010.options.json b/lib/test/flow/class_properties/migrated_0010.options.json new file mode 100644 index 0000000..bc69feb --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0010.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_class_static_fields": true +} \ No newline at end of file diff --git a/lib/test/flow/class_properties/migrated_0010.tree.json b/lib/test/flow/class_properties/migrated_0010.tree.json new file mode 100644 index 0000000..afb5668 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0010.tree.json @@ -0,0 +1,66 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "range":[0,50], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "range":[0,50], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, + "range":[6,16], + "name":"Properties", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":50}}, + "range":[17,50], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":48}}, + "range":[19,48], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, + "range":[27,28], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":40},"end":{"line":1,"column":47}}, + "range":[40,47], + "value":"hello", + "raw":"\"hello\"" + }, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":37}}, + "range":[29,37], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":37}}, + "range":[31,37] + } + }, + "computed":true, + "static":true, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/migrated_0011.js b/lib/test/flow/class_properties/migrated_0011.js new file mode 100644 index 0000000..1b9db01 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0011.js @@ -0,0 +1 @@ +class Properties { get; } diff --git a/lib/test/flow/class_properties/migrated_0011.tree.json b/lib/test/flow/class_properties/migrated_0011.tree.json new file mode 100644 index 0000000..28cdaa7 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0011.tree.json @@ -0,0 +1,51 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, + "range":[6,16], + "name":"Properties", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":25}}, + "range":[17,25], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":23}}, + "range":[19,23], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, + "range":[19,22], + "name":"get", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":null, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/migrated_0012.js b/lib/test/flow/class_properties/migrated_0012.js new file mode 100644 index 0000000..fa63b2d --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0012.js @@ -0,0 +1 @@ +class Properties { get: string; } diff --git a/lib/test/flow/class_properties/migrated_0012.tree.json b/lib/test/flow/class_properties/migrated_0012.tree.json new file mode 100644 index 0000000..3db626d --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0012.tree.json @@ -0,0 +1,60 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, + "range":[6,16], + "name":"Properties", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":33}}, + "range":[17,33], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "range":[19,31], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, + "range":[19,22], + "name":"get", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":30}}, + "range":[22,30], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":30}}, + "range":[24,30] + } + }, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/migrated_0013.js b/lib/test/flow/class_properties/migrated_0013.js new file mode 100644 index 0000000..ed53a4b --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0013.js @@ -0,0 +1 @@ +class Properties { get = 123; } diff --git a/lib/test/flow/class_properties/migrated_0013.options.json b/lib/test/flow/class_properties/migrated_0013.options.json new file mode 100644 index 0000000..6a29154 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0013.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_class_instance_fields": true +} \ No newline at end of file diff --git a/lib/test/flow/class_properties/migrated_0013.tree.json b/lib/test/flow/class_properties/migrated_0013.tree.json new file mode 100644 index 0000000..ddf84a4 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0013.tree.json @@ -0,0 +1,57 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, + "range":[6,16], + "name":"Properties", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":31}}, + "range":[17,31], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":29}}, + "range":[19,29], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, + "range":[19,22], + "name":"get", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":28}}, + "range":[25,28], + "value":123, + "raw":"123" + }, + "typeAnnotation":null, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/migrated_0014.js b/lib/test/flow/class_properties/migrated_0014.js new file mode 100644 index 0000000..8c6078e --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0014.js @@ -0,0 +1 @@ +class Properties { get() {} } diff --git a/lib/test/flow/class_properties/migrated_0014.tree.json b/lib/test/flow/class_properties/migrated_0014.tree.json new file mode 100644 index 0000000..ab4a4fa --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0014.tree.json @@ -0,0 +1,84 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, + "range":[6,16], + "name":"Properties", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":32}}, + "range":[17,32], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":30}}, + "range":[19,30], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, + "range":[19,22], + "name":"get", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":30}}, + "range":[22,30], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, + "range":[28,30], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":25}}, + "range":[22,25], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, + "range":[23,24], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/migrated_0015.js b/lib/test/flow/class_properties/migrated_0015.js new file mode 100644 index 0000000..629024f --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0015.js @@ -0,0 +1 @@ +class Properties { get() {} } diff --git a/lib/test/flow/class_properties/migrated_0015.tree.json b/lib/test/flow/class_properties/migrated_0015.tree.json new file mode 100644 index 0000000..3ebab32 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0015.tree.json @@ -0,0 +1,69 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, + "range":[6,16], + "name":"Properties", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":29}}, + "range":[17,29], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, + "range":[19,27], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, + "range":[19,22], + "name":"get", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":27}}, + "range":[22,27], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, + "range":[25,27], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/migrated_0016.js b/lib/test/flow/class_properties/migrated_0016.js new file mode 100644 index 0000000..a2773be --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0016.js @@ -0,0 +1 @@ +class Properties { set; } diff --git a/lib/test/flow/class_properties/migrated_0016.tree.json b/lib/test/flow/class_properties/migrated_0016.tree.json new file mode 100644 index 0000000..673d24f --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0016.tree.json @@ -0,0 +1,51 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, + "range":[6,16], + "name":"Properties", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":25}}, + "range":[17,25], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":23}}, + "range":[19,23], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, + "range":[19,22], + "name":"set", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":null, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/migrated_0017.js b/lib/test/flow/class_properties/migrated_0017.js new file mode 100644 index 0000000..7cd77c2 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0017.js @@ -0,0 +1 @@ +class Properties { set: string; } diff --git a/lib/test/flow/class_properties/migrated_0017.tree.json b/lib/test/flow/class_properties/migrated_0017.tree.json new file mode 100644 index 0000000..0df7580 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0017.tree.json @@ -0,0 +1,60 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, + "range":[6,16], + "name":"Properties", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":33}}, + "range":[17,33], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "range":[19,31], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, + "range":[19,22], + "name":"set", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":30}}, + "range":[22,30], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":30}}, + "range":[24,30] + } + }, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/migrated_0018.js b/lib/test/flow/class_properties/migrated_0018.js new file mode 100644 index 0000000..a94eda0 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0018.js @@ -0,0 +1 @@ +class Properties { set = 123; } diff --git a/lib/test/flow/class_properties/migrated_0018.options.json b/lib/test/flow/class_properties/migrated_0018.options.json new file mode 100644 index 0000000..6a29154 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0018.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_class_instance_fields": true +} \ No newline at end of file diff --git a/lib/test/flow/class_properties/migrated_0018.tree.json b/lib/test/flow/class_properties/migrated_0018.tree.json new file mode 100644 index 0000000..91774b7 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0018.tree.json @@ -0,0 +1,57 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, + "range":[6,16], + "name":"Properties", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":31}}, + "range":[17,31], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":29}}, + "range":[19,29], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, + "range":[19,22], + "name":"set", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":28}}, + "range":[25,28], + "value":123, + "raw":"123" + }, + "typeAnnotation":null, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/migrated_0019.js b/lib/test/flow/class_properties/migrated_0019.js new file mode 100644 index 0000000..03acdf0 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0019.js @@ -0,0 +1 @@ +class Properties { set() {} } diff --git a/lib/test/flow/class_properties/migrated_0019.tree.json b/lib/test/flow/class_properties/migrated_0019.tree.json new file mode 100644 index 0000000..b129361 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0019.tree.json @@ -0,0 +1,84 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, + "range":[6,16], + "name":"Properties", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":32}}, + "range":[17,32], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":30}}, + "range":[19,30], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, + "range":[19,22], + "name":"set", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":30}}, + "range":[22,30], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, + "range":[28,30], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":25}}, + "range":[22,25], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, + "range":[23,24], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/migrated_0020.js b/lib/test/flow/class_properties/migrated_0020.js new file mode 100644 index 0000000..7eebdb5 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0020.js @@ -0,0 +1 @@ +class Properties { set() {} } diff --git a/lib/test/flow/class_properties/migrated_0020.tree.json b/lib/test/flow/class_properties/migrated_0020.tree.json new file mode 100644 index 0000000..cbbe37a --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0020.tree.json @@ -0,0 +1,69 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, + "range":[6,16], + "name":"Properties", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":29}}, + "range":[17,29], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, + "range":[19,27], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, + "range":[19,22], + "name":"set", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":27}}, + "range":[22,27], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, + "range":[25,27], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/migrated_0021.js b/lib/test/flow/class_properties/migrated_0021.js new file mode 100644 index 0000000..1dfe66c --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0021.js @@ -0,0 +1 @@ +class Properties { x: string y: number; } diff --git a/lib/test/flow/class_properties/migrated_0021.tree.json b/lib/test/flow/class_properties/migrated_0021.tree.json new file mode 100644 index 0000000..5b665bf --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0021.tree.json @@ -0,0 +1,87 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "range":[0,41], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "range":[0,41], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, + "range":[6,16], + "name":"Properties", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":41}}, + "range":[17,41], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":28}}, + "range":[19,28], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "range":[19,20], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, + "range":[20,28], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":28}}, + "range":[22,28] + } + }, + "computed":false, + "static":false, + "variance":null + }, + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":39}}, + "range":[29,39], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, + "range":[29,30], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":38}}, + "range":[30,38], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":38}}, + "range":[32,38] + } + }, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/migrated_0022.js b/lib/test/flow/class_properties/migrated_0022.js new file mode 100644 index 0000000..840f00b --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0022.js @@ -0,0 +1 @@ +class Properties { x: string; [y]: number; } diff --git a/lib/test/flow/class_properties/migrated_0022.tree.json b/lib/test/flow/class_properties/migrated_0022.tree.json new file mode 100644 index 0000000..1b35df7 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0022.tree.json @@ -0,0 +1,87 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, + "range":[0,44], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, + "range":[0,44], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, + "range":[6,16], + "name":"Properties", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":44}}, + "range":[17,44], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":29}}, + "range":[19,29], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "range":[19,20], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, + "range":[20,28], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":28}}, + "range":[22,28] + } + }, + "computed":false, + "static":false, + "variance":null + }, + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":42}}, + "range":[30,42], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":32}}, + "range":[31,32], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":41}}, + "range":[33,41], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":41}}, + "range":[35,41] + } + }, + "computed":true, + "static":false, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/migrated_0023.js b/lib/test/flow/class_properties/migrated_0023.js new file mode 100644 index 0000000..32f8dfa --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0023.js @@ -0,0 +1,4 @@ +class X { + x = "y" + foo() {} +} diff --git a/lib/test/flow/class_properties/migrated_0023.options.json b/lib/test/flow/class_properties/migrated_0023.options.json new file mode 100644 index 0000000..6a29154 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0023.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_class_instance_fields": true +} \ No newline at end of file diff --git a/lib/test/flow/class_properties/migrated_0023.tree.json b/lib/test/flow/class_properties/migrated_0023.tree.json new file mode 100644 index 0000000..154bec7 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0023.tree.json @@ -0,0 +1,93 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,32], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,32], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "range":[8,32], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "range":[12,19], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[12,13], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":9}}, + "range":[16,19], + "value":"y", + "raw":"\"y\"" + }, + "typeAnnotation":null, + "computed":false, + "static":false, + "variance":null + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":10}}, + "range":[22,30], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":5}}, + "range":[22,25], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":3,"column":5},"end":{"line":3,"column":10}}, + "range":[25,30], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":10}}, + "range":[28,30], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/migrated_0024.js b/lib/test/flow/class_properties/migrated_0024.js new file mode 100644 index 0000000..90c063c --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0024.js @@ -0,0 +1,4 @@ +class X { + x = "y" + [computed] = "z" +} diff --git a/lib/test/flow/class_properties/migrated_0024.options.json b/lib/test/flow/class_properties/migrated_0024.options.json new file mode 100644 index 0000000..6a29154 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0024.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_class_instance_fields": true +} \ No newline at end of file diff --git a/lib/test/flow/class_properties/migrated_0024.tree.json b/lib/test/flow/class_properties/migrated_0024.tree.json new file mode 100644 index 0000000..be15440 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0024.tree.json @@ -0,0 +1,84 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,40], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,40], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "range":[8,40], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":3,"column":18}}, + "range":[12,38], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[12,13], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":3,"column":18}}, + "range":[16,38], + "operator":"=", + "left":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":3,"column":12}}, + "range":[16,32], + "object":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":9}}, + "range":[16,19], + "value":"y", + "raw":"\"y\"" + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":3},"end":{"line":3,"column":11}}, + "range":[23,31], + "name":"computed", + "typeAnnotation":null, + "optional":false + }, + "computed":true + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":15},"end":{"line":3,"column":18}}, + "range":[35,38], + "value":"z", + "raw":"\"z\"" + } + }, + "typeAnnotation":null, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/migrated_0025.js b/lib/test/flow/class_properties/migrated_0025.js new file mode 100644 index 0000000..bf57c58 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0025.js @@ -0,0 +1,4 @@ +class X { + x = "y" + [computed]: string +} diff --git a/lib/test/flow/class_properties/migrated_0025.options.json b/lib/test/flow/class_properties/migrated_0025.options.json new file mode 100644 index 0000000..6a29154 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0025.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_class_instance_fields": true +} \ No newline at end of file diff --git a/lib/test/flow/class_properties/migrated_0025.tree.json b/lib/test/flow/class_properties/migrated_0025.tree.json new file mode 100644 index 0000000..2983b8f --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0025.tree.json @@ -0,0 +1,150 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":3,"column":12},"end":{"line":3,"column":13}}, + "message":"Unexpected token `:`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":3,"column":14},"end":{"line":3,"column":20}}, + "message":"Unexpected identifier, expected the token `(`" + }, + { + "loc":{"source":null,"start":{"line":4,"column":0},"end":{"line":4,"column":1}}, + "message":"Unexpected token `}`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":0}}, + "message":"Unexpected end of input, expected the token `,`" + }, + { + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":0}}, + "message":"Rest parameter must be final parameter of an argument list" + }, + { + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":0}}, + "message":"Unexpected end of input, expected the token `)`" + }, + { + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":0}}, + "message":"Unexpected end of input, expected the token `{`" + }, + { + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":0}}, + "message":"Unexpected end of input, expected the token `}`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":5,"column":0}}, + "range":[0,43], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":5,"column":0}}, + "range":[0,43], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":5,"column":0}}, + "range":[8,43], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":3,"column":12}}, + "range":[12,32], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[12,13], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":3,"column":12}}, + "range":[16,32], + "object":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":9}}, + "range":[16,19], + "value":"y", + "raw":"\"y\"" + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":3},"end":{"line":3,"column":11}}, + "range":[23,31], + "name":"computed", + "typeAnnotation":null, + "optional":false + }, + "computed":true + }, + "typeAnnotation":null, + "computed":false, + "static":false, + "variance":null + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":3,"column":12},"end":{"line":5,"column":0}}, + "range":[32,43], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":12},"end":{"line":3,"column":13}}, + "range":[32,33], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":3,"column":14},"end":{"line":5,"column":0}}, + "range":[34,43], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":0},"end":{"line":4,"column":1}}, + "range":[41,42], + "name":"", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":0}}, + "range":[43,43], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/migrated_0026.js b/lib/test/flow/class_properties/migrated_0026.js new file mode 100644 index 0000000..75ebefd --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0026.js @@ -0,0 +1,4 @@ +class X { + x: string + [computed]: string +} diff --git a/lib/test/flow/class_properties/migrated_0026.tree.json b/lib/test/flow/class_properties/migrated_0026.tree.json new file mode 100644 index 0000000..8ebd0b8 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0026.tree.json @@ -0,0 +1,93 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "message":"Unexpected token `[`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,44], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,44], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "range":[8,44], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":11}}, + "range":[12,21], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[12,13], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":11}}, + "range":[13,21], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":11}}, + "range":[15,21] + } + }, + "computed":false, + "static":false, + "variance":null + }, + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":20}}, + "range":[24,42], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":3},"end":{"line":3,"column":11}}, + "range":[25,33], + "name":"computed", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":12},"end":{"line":3,"column":20}}, + "range":[34,42], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":14},"end":{"line":3,"column":20}}, + "range":[36,42] + } + }, + "computed":true, + "static":false, + "variance":null + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/migrated_0027.js b/lib/test/flow/class_properties/migrated_0027.js new file mode 100644 index 0000000..c2407d1 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0027.js @@ -0,0 +1,4 @@ +class X { + x: string + foo(): void {} +} diff --git a/lib/test/flow/class_properties/migrated_0027.tree.json b/lib/test/flow/class_properties/migrated_0027.tree.json new file mode 100644 index 0000000..48046de --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0027.tree.json @@ -0,0 +1,105 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,40], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,40], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "range":[8,40], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":11}}, + "range":[12,21], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[12,13], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":11}}, + "range":[13,21], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":11}}, + "range":[15,21] + } + }, + "computed":false, + "static":false, + "variance":null + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":16}}, + "range":[24,38], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":5}}, + "range":[24,27], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":3,"column":5},"end":{"line":3,"column":16}}, + "range":[27,38], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":14},"end":{"line":3,"column":16}}, + "range":[36,38], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":7},"end":{"line":3,"column":13}}, + "range":[29,35], + "typeAnnotation":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":9},"end":{"line":3,"column":13}}, + "range":[31,35] + } + }, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/migrated_0028.js b/lib/test/flow/class_properties/migrated_0028.js new file mode 100644 index 0000000..36e10b6 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0028.js @@ -0,0 +1,4 @@ +class X { + x = () => {} + y(): void {} +} diff --git a/lib/test/flow/class_properties/migrated_0028.options.json b/lib/test/flow/class_properties/migrated_0028.options.json new file mode 100644 index 0000000..6a29154 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0028.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_class_instance_fields": true +} \ No newline at end of file diff --git a/lib/test/flow/class_properties/migrated_0028.tree.json b/lib/test/flow/class_properties/migrated_0028.tree.json new file mode 100644 index 0000000..9403c43 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0028.tree.json @@ -0,0 +1,114 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,41], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,41], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "range":[8,41], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, + "range":[12,24], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[12,13], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":14}}, + "range":[16,24], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, + "range":[22,24], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "typeAnnotation":null, + "computed":false, + "static":false, + "variance":null + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":14}}, + "range":[27,39], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "range":[27,28], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":3,"column":3},"end":{"line":3,"column":14}}, + "range":[28,39], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":12},"end":{"line":3,"column":14}}, + "range":[37,39], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":5},"end":{"line":3,"column":11}}, + "range":[30,36], + "typeAnnotation":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":7},"end":{"line":3,"column":11}}, + "range":[32,36] + } + }, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/migrated_0029.js b/lib/test/flow/class_properties/migrated_0029.js new file mode 100644 index 0000000..22613b8 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0029.js @@ -0,0 +1 @@ +class X {x?:T} {} diff --git a/lib/test/flow/class_properties/migrated_0029.tree.json b/lib/test/flow/class_properties/migrated_0029.tree.json new file mode 100644 index 0000000..d3856b5 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0029.tree.json @@ -0,0 +1,81 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "message":"Unexpected token `?`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, + "range":[8,14], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, + "range":[9,13], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, + "range":[11,13], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, + "range":[15,17], + "body":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/migrated_0030.js b/lib/test/flow/class_properties/migrated_0030.js new file mode 100644 index 0000000..108fde5 --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0030.js @@ -0,0 +1 @@ +class X {+x?:T} {} diff --git a/lib/test/flow/class_properties/migrated_0030.tree.json b/lib/test/flow/class_properties/migrated_0030.tree.json new file mode 100644 index 0000000..6f05bff --- /dev/null +++ b/lib/test/flow/class_properties/migrated_0030.tree.json @@ -0,0 +1,86 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "message":"Unexpected token `?`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":15}}, + "range":[8,15], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "range":[9,14], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, + "range":[12,14], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + "computed":false, + "static":false, + "variance":{ + "type":"Variance", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "kind":"plus" + } + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, + "range":[16,18], + "body":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/super-call-in-arrow.js b/lib/test/flow/class_properties/super-call-in-arrow.js new file mode 100644 index 0000000..be784ff --- /dev/null +++ b/lib/test/flow/class_properties/super-call-in-arrow.js @@ -0,0 +1,3 @@ +class C { + x = () => super() +} diff --git a/lib/test/flow/class_properties/super-call-in-arrow.options.json b/lib/test/flow/class_properties/super-call-in-arrow.options.json new file mode 100644 index 0000000..a327656 --- /dev/null +++ b/lib/test/flow/class_properties/super-call-in-arrow.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_class_instance_fields": true +} diff --git a/lib/test/flow/class_properties/super-call-in-arrow.tree.json b/lib/test/flow/class_properties/super-call-in-arrow.tree.json new file mode 100644 index 0000000..31f14b8 --- /dev/null +++ b/lib/test/flow/class_properties/super-call-in-arrow.tree.json @@ -0,0 +1,83 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":17}}, + "message":"`super()` is only valid in a class constructor" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,31], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "range":[8,31], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":19}}, + "range":[12,29], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[12,13], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":19}}, + "range":[16,29], + "id":null, + "params":[], + "body":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":19}}, + "range":[22,29], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":17}}, + "range":[22,27], + "name":"super", + "typeAnnotation":null, + "optional":false + }, + "arguments":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":null, + "typeParameters":null + }, + "typeAnnotation":null, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/super-prop-in-arrow.js b/lib/test/flow/class_properties/super-prop-in-arrow.js new file mode 100644 index 0000000..862a5c2 --- /dev/null +++ b/lib/test/flow/class_properties/super-prop-in-arrow.js @@ -0,0 +1,3 @@ +class C { + x = () => super.prop +} diff --git a/lib/test/flow/class_properties/super-prop-in-arrow.options.json b/lib/test/flow/class_properties/super-prop-in-arrow.options.json new file mode 100644 index 0000000..a327656 --- /dev/null +++ b/lib/test/flow/class_properties/super-prop-in-arrow.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_class_instance_fields": true +} diff --git a/lib/test/flow/class_properties/super-prop-in-arrow.tree.json b/lib/test/flow/class_properties/super-prop-in-arrow.tree.json new file mode 100644 index 0000000..34f52a9 --- /dev/null +++ b/lib/test/flow/class_properties/super-prop-in-arrow.tree.json @@ -0,0 +1,82 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,34], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,34], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "range":[8,34], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":22}}, + "range":[12,32], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[12,13], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":22}}, + "range":[16,32], + "id":null, + "params":[], + "body":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":22}}, + "range":[22,32], + "object":{ + "type":"Super", + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":17}}, + "range":[22,27] + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":18},"end":{"line":2,"column":22}}, + "range":[28,32], + "name":"prop", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":null, + "typeParameters":null + }, + "typeAnnotation":null, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/super-prop-in-prop.js b/lib/test/flow/class_properties/super-prop-in-prop.js new file mode 100644 index 0000000..69fc0b1 --- /dev/null +++ b/lib/test/flow/class_properties/super-prop-in-prop.js @@ -0,0 +1,3 @@ +class C { + x = super.y +} diff --git a/lib/test/flow/class_properties/super-prop-in-prop.options.json b/lib/test/flow/class_properties/super-prop-in-prop.options.json new file mode 100644 index 0000000..a327656 --- /dev/null +++ b/lib/test/flow/class_properties/super-prop-in-prop.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_class_instance_fields": true +} diff --git a/lib/test/flow/class_properties/super-prop-in-prop.tree.json b/lib/test/flow/class_properties/super-prop-in-prop.tree.json new file mode 100644 index 0000000..6f61c8d --- /dev/null +++ b/lib/test/flow/class_properties/super-prop-in-prop.tree.json @@ -0,0 +1,69 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,25], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,25], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "range":[8,25], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, + "range":[12,23], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[12,13], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":13}}, + "range":[16,23], + "object":{ + "type":"Super", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":11}}, + "range":[16,21] + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":13}}, + "range":[22,23], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "typeAnnotation":null, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/super-prop.js b/lib/test/flow/class_properties/super-prop.js new file mode 100644 index 0000000..1e58d06 --- /dev/null +++ b/lib/test/flow/class_properties/super-prop.js @@ -0,0 +1,3 @@ +class C { + super; +} diff --git a/lib/test/flow/class_properties/super-prop.options.json b/lib/test/flow/class_properties/super-prop.options.json new file mode 100644 index 0000000..a327656 --- /dev/null +++ b/lib/test/flow/class_properties/super-prop.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_class_instance_fields": true +} diff --git a/lib/test/flow/class_properties/super-prop.tree.json b/lib/test/flow/class_properties/super-prop.tree.json new file mode 100644 index 0000000..a09e9e2 --- /dev/null +++ b/lib/test/flow/class_properties/super-prop.tree.json @@ -0,0 +1,51 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,20], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,20], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "range":[8,20], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":8}}, + "range":[12,18], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":7}}, + "range":[12,17], + "name":"super", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":null, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/unannotated.js b/lib/test/flow/class_properties/unannotated.js new file mode 100644 index 0000000..58a224e --- /dev/null +++ b/lib/test/flow/class_properties/unannotated.js @@ -0,0 +1,3 @@ +class C { + foo +} diff --git a/lib/test/flow/class_properties/unannotated.tree.json b/lib/test/flow/class_properties/unannotated.tree.json new file mode 100644 index 0000000..459e7c2 --- /dev/null +++ b/lib/test/flow/class_properties/unannotated.tree.json @@ -0,0 +1,51 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,17], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,17], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "range":[8,17], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "range":[12,15], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "range":[12,15], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":null, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/class_properties/unannotated_asi.js b/lib/test/flow/class_properties/unannotated_asi.js new file mode 100644 index 0000000..7eb4df5 --- /dev/null +++ b/lib/test/flow/class_properties/unannotated_asi.js @@ -0,0 +1,4 @@ +class C { + foo + bar +} diff --git a/lib/test/flow/class_properties/unannotated_asi.tree.json b/lib/test/flow/class_properties/unannotated_asi.tree.json new file mode 100644 index 0000000..6cae45c --- /dev/null +++ b/lib/test/flow/class_properties/unannotated_asi.tree.json @@ -0,0 +1,69 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,23], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,23], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "range":[8,23], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "range":[12,15], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "range":[12,15], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":null, + "computed":false, + "static":false, + "variance":null + }, + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":5}}, + "range":[18,21], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":5}}, + "range":[18,21], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":null, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/comment_interning/array.js b/lib/test/flow/comment_interning/array.js new file mode 100644 index 0000000..7c80806 --- /dev/null +++ b/lib/test/flow/comment_interning/array.js @@ -0,0 +1,12 @@ + +const arr1 = /* 1.1 pre */ [1, 2, 3] /* 1.2 post */; + +const arr2 = /* 2.1 pre */ [1, 2, 3]; + +const arr3 = [1, 2, 3] /* 3.1 post */; + +[/* 4.1 T spread */ ... /* 4.2 L array */ [] /* 4.3 T array */]; + +[/* 5.1 I array */]; + +[1, /* 6.1 I array */]; diff --git a/lib/test/flow/comment_interning/array.options.json b/lib/test/flow/comment_interning/array.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/array.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/array.tree.json b/lib/test/flow/comment_interning/array.tree.json new file mode 100644 index 0000000..0870091 --- /dev/null +++ b/lib/test/flow/comment_interning/array.tree.json @@ -0,0 +1,338 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":12,"column":23}}, + "range":[1,245], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":52}}, + "range":[1,53], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":36}}, + "range":[7,37], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":10}}, + "range":[7,11], + "name":"arr1", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ArrayExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":37},"end":{"line":2,"column":51}}, + "range":[38,52], + "value":" 1.2 post " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":26}}, + "range":[14,27], + "value":" 1.1 pre " + } + ], + "loc":{"source":null,"start":{"line":2,"column":27},"end":{"line":2,"column":36}}, + "range":[28,37], + "elements":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":28},"end":{"line":2,"column":29}}, + "range":[29,30], + "value":1, + "raw":"1" + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":31},"end":{"line":2,"column":32}}, + "range":[32,33], + "value":2, + "raw":"2" + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":34},"end":{"line":2,"column":35}}, + "range":[35,36], + "value":3, + "raw":"3" + } + ] + } + } + ], + "kind":"const" + }, + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":4,"column":0},"end":{"line":4,"column":37}}, + "range":[55,92], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":4,"column":6},"end":{"line":4,"column":36}}, + "range":[61,91], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":6},"end":{"line":4,"column":10}}, + "range":[61,65], + "name":"arr2", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ArrayExpression", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":13},"end":{"line":4,"column":26}}, + "range":[68,81], + "value":" 2.1 pre " + } + ], + "loc":{"source":null,"start":{"line":4,"column":27},"end":{"line":4,"column":36}}, + "range":[82,91], + "elements":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":4,"column":28},"end":{"line":4,"column":29}}, + "range":[83,84], + "value":1, + "raw":"1" + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":4,"column":31},"end":{"line":4,"column":32}}, + "range":[86,87], + "value":2, + "raw":"2" + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":4,"column":34},"end":{"line":4,"column":35}}, + "range":[89,90], + "value":3, + "raw":"3" + } + ] + } + } + ], + "kind":"const" + }, + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":6,"column":0},"end":{"line":6,"column":38}}, + "range":[94,132], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":6,"column":6},"end":{"line":6,"column":22}}, + "range":[100,116], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":6},"end":{"line":6,"column":10}}, + "range":[100,104], + "name":"arr3", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ArrayExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":23},"end":{"line":6,"column":37}}, + "range":[117,131], + "value":" 3.1 post " + } + ], + "loc":{"source":null,"start":{"line":6,"column":13},"end":{"line":6,"column":22}}, + "range":[107,116], + "elements":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":6,"column":14},"end":{"line":6,"column":15}}, + "range":[108,109], + "value":1, + "raw":"1" + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":6,"column":17},"end":{"line":6,"column":18}}, + "range":[111,112], + "value":2, + "raw":"2" + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":6,"column":20},"end":{"line":6,"column":21}}, + "range":[114,115], + "value":3, + "raw":"3" + } + ] + } + } + ], + "kind":"const" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":8,"column":0},"end":{"line":8,"column":64}}, + "range":[134,198], + "expression":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":8,"column":0},"end":{"line":8,"column":63}}, + "range":[134,197], + "elements":[ + { + "type":"SpreadElement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":1},"end":{"line":8,"column":19}}, + "range":[135,153], + "value":" 4.1 T spread " + } + ], + "loc":{"source":null,"start":{"line":8,"column":20},"end":{"line":8,"column":44}}, + "range":[154,178], + "argument":{ + "type":"ArrayExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":45},"end":{"line":8,"column":62}}, + "range":[179,196], + "value":" 4.3 T array " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":24},"end":{"line":8,"column":41}}, + "range":[158,175], + "value":" 4.2 L array " + } + ], + "loc":{"source":null,"start":{"line":8,"column":42},"end":{"line":8,"column":44}}, + "range":[176,178], + "elements":[] + } + } + ] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":10,"column":0},"end":{"line":10,"column":20}}, + "range":[200,220], + "expression":{ + "type":"ArrayExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":1},"end":{"line":10,"column":18}}, + "range":[201,218], + "value":" 5.1 I array " + } + ], + "loc":{"source":null,"start":{"line":10,"column":0},"end":{"line":10,"column":19}}, + "range":[200,219], + "elements":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":12,"column":0},"end":{"line":12,"column":23}}, + "range":[222,245], + "expression":{ + "type":"ArrayExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":4},"end":{"line":12,"column":21}}, + "range":[226,243], + "value":" 6.1 I array " + } + ], + "loc":{"source":null,"start":{"line":12,"column":0},"end":{"line":12,"column":22}}, + "range":[222,244], + "elements":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":12,"column":1},"end":{"line":12,"column":2}}, + "range":[223,224], + "value":1, + "raw":"1" + } + ] + }, + "directive":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":26}}, + "range":[14,27], + "value":" 1.1 pre " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":37},"end":{"line":2,"column":51}}, + "range":[38,52], + "value":" 1.2 post " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":13},"end":{"line":4,"column":26}}, + "range":[68,81], + "value":" 2.1 pre " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":23},"end":{"line":6,"column":37}}, + "range":[117,131], + "value":" 3.1 post " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":1},"end":{"line":8,"column":19}}, + "range":[135,153], + "value":" 4.1 T spread " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":24},"end":{"line":8,"column":41}}, + "range":[158,175], + "value":" 4.2 L array " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":45},"end":{"line":8,"column":62}}, + "range":[179,196], + "value":" 4.3 T array " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":1},"end":{"line":10,"column":18}}, + "range":[201,218], + "value":" 5.1 I array " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":4},"end":{"line":12,"column":21}}, + "range":[226,243], + "value":" 6.1 I array " + } + ] +} diff --git a/lib/test/flow/comment_interning/array_pattern.js b/lib/test/flow/comment_interning/array_pattern.js new file mode 100644 index 0000000..cbbc044 --- /dev/null +++ b/lib/test/flow/comment_interning/array_pattern.js @@ -0,0 +1,12 @@ + +const /* 1.1 pre */ [x1, x2] /* 1.2 post */ = [1, 2]; + +const /* 2.1 pre */ [y1, y2] = [1, 2]; + +const [z1, z2] /* 3.1 post */ = [1, 2]; + +const [/* 4.1 L rest */ ... /* 4.2 L id */ rest /* 4.3 T id */] = []; + +const [/* 5.1 I array */] = []; + +const [a, /* 6.1 I array */] = []; diff --git a/lib/test/flow/comment_interning/array_pattern.options.json b/lib/test/flow/comment_interning/array_pattern.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/array_pattern.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/array_pattern.tree.json b/lib/test/flow/comment_interning/array_pattern.tree.json new file mode 100644 index 0000000..e8b4619 --- /dev/null +++ b/lib/test/flow/comment_interning/array_pattern.tree.json @@ -0,0 +1,410 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":12,"column":34}}, + "range":[1,275], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":53}}, + "range":[1,54], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":2,"column":20},"end":{"line":2,"column":52}}, + "range":[21,53], + "id":{ + "type":"ArrayPattern", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":29},"end":{"line":2,"column":43}}, + "range":[30,44], + "value":" 1.2 post " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":19}}, + "range":[7,20], + "value":" 1.1 pre " + } + ], + "loc":{"source":null,"start":{"line":2,"column":20},"end":{"line":2,"column":28}}, + "range":[21,29], + "elements":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":21},"end":{"line":2,"column":23}}, + "range":[22,24], + "name":"x1", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":25},"end":{"line":2,"column":27}}, + "range":[26,28], + "name":"x2", + "typeAnnotation":null, + "optional":false + } + ], + "typeAnnotation":null + }, + "init":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":2,"column":46},"end":{"line":2,"column":52}}, + "range":[47,53], + "elements":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":47},"end":{"line":2,"column":48}}, + "range":[48,49], + "value":1, + "raw":"1" + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":50},"end":{"line":2,"column":51}}, + "range":[51,52], + "value":2, + "raw":"2" + } + ] + } + } + ], + "kind":"const" + }, + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":4,"column":0},"end":{"line":4,"column":38}}, + "range":[56,94], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":4,"column":20},"end":{"line":4,"column":37}}, + "range":[76,93], + "id":{ + "type":"ArrayPattern", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":6},"end":{"line":4,"column":19}}, + "range":[62,75], + "value":" 2.1 pre " + } + ], + "loc":{"source":null,"start":{"line":4,"column":20},"end":{"line":4,"column":28}}, + "range":[76,84], + "elements":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":21},"end":{"line":4,"column":23}}, + "range":[77,79], + "name":"y1", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":25},"end":{"line":4,"column":27}}, + "range":[81,83], + "name":"y2", + "typeAnnotation":null, + "optional":false + } + ], + "typeAnnotation":null + }, + "init":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":4,"column":31},"end":{"line":4,"column":37}}, + "range":[87,93], + "elements":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":4,"column":32},"end":{"line":4,"column":33}}, + "range":[88,89], + "value":1, + "raw":"1" + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":4,"column":35},"end":{"line":4,"column":36}}, + "range":[91,92], + "value":2, + "raw":"2" + } + ] + } + } + ], + "kind":"const" + }, + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":6,"column":0},"end":{"line":6,"column":39}}, + "range":[96,135], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":6,"column":6},"end":{"line":6,"column":38}}, + "range":[102,134], + "id":{ + "type":"ArrayPattern", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":15},"end":{"line":6,"column":29}}, + "range":[111,125], + "value":" 3.1 post " + } + ], + "loc":{"source":null,"start":{"line":6,"column":6},"end":{"line":6,"column":14}}, + "range":[102,110], + "elements":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":7},"end":{"line":6,"column":9}}, + "range":[103,105], + "name":"z1", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":11},"end":{"line":6,"column":13}}, + "range":[107,109], + "name":"z2", + "typeAnnotation":null, + "optional":false + } + ], + "typeAnnotation":null + }, + "init":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":6,"column":32},"end":{"line":6,"column":38}}, + "range":[128,134], + "elements":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":6,"column":33},"end":{"line":6,"column":34}}, + "range":[129,130], + "value":1, + "raw":"1" + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":6,"column":36},"end":{"line":6,"column":37}}, + "range":[132,133], + "value":2, + "raw":"2" + } + ] + } + } + ], + "kind":"const" + }, + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":8,"column":0},"end":{"line":8,"column":69}}, + "range":[137,206], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":8,"column":6},"end":{"line":8,"column":68}}, + "range":[143,205], + "id":{ + "type":"ArrayPattern", + "loc":{"source":null,"start":{"line":8,"column":6},"end":{"line":8,"column":63}}, + "range":[143,200], + "elements":[ + { + "type":"RestElement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":7},"end":{"line":8,"column":23}}, + "range":[144,160], + "value":" 4.1 L rest " + } + ], + "loc":{"source":null,"start":{"line":8,"column":24},"end":{"line":8,"column":47}}, + "range":[161,184], + "argument":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":48},"end":{"line":8,"column":62}}, + "range":[185,199], + "value":" 4.3 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":28},"end":{"line":8,"column":42}}, + "range":[165,179], + "value":" 4.2 L id " + } + ], + "loc":{"source":null,"start":{"line":8,"column":43},"end":{"line":8,"column":47}}, + "range":[180,184], + "name":"rest", + "typeAnnotation":null, + "optional":false + } + } + ], + "typeAnnotation":null + }, + "init":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":8,"column":66},"end":{"line":8,"column":68}}, + "range":[203,205], + "elements":[] + } + } + ], + "kind":"const" + }, + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":10,"column":0},"end":{"line":10,"column":31}}, + "range":[208,239], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":10,"column":6},"end":{"line":10,"column":30}}, + "range":[214,238], + "id":{ + "type":"ArrayPattern", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":7},"end":{"line":10,"column":24}}, + "range":[215,232], + "value":" 5.1 I array " + } + ], + "loc":{"source":null,"start":{"line":10,"column":6},"end":{"line":10,"column":25}}, + "range":[214,233], + "elements":[], + "typeAnnotation":null + }, + "init":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":10,"column":28},"end":{"line":10,"column":30}}, + "range":[236,238], + "elements":[] + } + } + ], + "kind":"const" + }, + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":12,"column":0},"end":{"line":12,"column":34}}, + "range":[241,275], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":12,"column":6},"end":{"line":12,"column":33}}, + "range":[247,274], + "id":{ + "type":"ArrayPattern", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":10},"end":{"line":12,"column":27}}, + "range":[251,268], + "value":" 6.1 I array " + } + ], + "loc":{"source":null,"start":{"line":12,"column":6},"end":{"line":12,"column":28}}, + "range":[247,269], + "elements":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":12,"column":7},"end":{"line":12,"column":8}}, + "range":[248,249], + "name":"a", + "typeAnnotation":null, + "optional":false + } + ], + "typeAnnotation":null + }, + "init":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":12,"column":31},"end":{"line":12,"column":33}}, + "range":[272,274], + "elements":[] + } + } + ], + "kind":"const" + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":19}}, + "range":[7,20], + "value":" 1.1 pre " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":29},"end":{"line":2,"column":43}}, + "range":[30,44], + "value":" 1.2 post " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":6},"end":{"line":4,"column":19}}, + "range":[62,75], + "value":" 2.1 pre " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":15},"end":{"line":6,"column":29}}, + "range":[111,125], + "value":" 3.1 post " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":7},"end":{"line":8,"column":23}}, + "range":[144,160], + "value":" 4.1 L rest " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":28},"end":{"line":8,"column":42}}, + "range":[165,179], + "value":" 4.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":48},"end":{"line":8,"column":62}}, + "range":[185,199], + "value":" 4.3 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":7},"end":{"line":10,"column":24}}, + "range":[215,232], + "value":" 5.1 I array " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":10},"end":{"line":12,"column":27}}, + "range":[251,268], + "value":" 6.1 I array " + } + ] +} diff --git a/lib/test/flow/comment_interning/arrow_function.js b/lib/test/flow/comment_interning/arrow_function.js new file mode 100644 index 0000000..044cb64 --- /dev/null +++ b/lib/test/flow/comment_interning/arrow_function.js @@ -0,0 +1,12 @@ +/* 1.1 L arrow */ async /* 1.2 L params */ () /* 1.3 T params */ => /* 1.4 L block */ {} /* 1.5 T block */; + +/* 2.1 L arrow */ async () => /* 2.2 L num */ 1 /* 2.3 T num */; + +/* 3.1 L id */ x /* 3.2 T id */ => {}; + +/* 4.1 L tparams */ /* 4.2 L params */ () /* 4.3 T params */ => {}; + +/* 5.1 L params */ () /* 5.2 T params */ : /* 5.3 L any */ any /* 5.4 T any */ => {} + +/* 6.1 L tparams */ /* 6.2 T tparams */ + /* 6.3 L params */ () /* 6.4 T params */ => {} diff --git a/lib/test/flow/comment_interning/arrow_function.options.json b/lib/test/flow/comment_interning/arrow_function.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/arrow_function.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/arrow_function.tree.json b/lib/test/flow/comment_interning/arrow_function.tree.json new file mode 100644 index 0000000..b0da76a --- /dev/null +++ b/lib/test/flow/comment_interning/arrow_function.tree.json @@ -0,0 +1,500 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":12,"column":48}}, + "range":[18,466], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":107}}, + "range":[18,107], + "expression":{ + "type":"ArrowFunctionExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":46},"end":{"line":1,"column":64}}, + "range":[46,64], + "value":" 1.3 T params " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "value":" 1.1 L arrow " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":42}}, + "range":[24,42], + "value":" 1.2 L params " + } + ], + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":88}}, + "range":[18,88], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":89},"end":{"line":1,"column":106}}, + "range":[89,106], + "value":" 1.5 T block " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":68},"end":{"line":1,"column":85}}, + "range":[68,85], + "value":" 1.4 L block " + } + ], + "loc":{"source":null,"start":{"line":1,"column":86},"end":{"line":1,"column":88}}, + "range":[86,88], + "body":[] + }, + "async":true, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":3,"column":18},"end":{"line":3,"column":64}}, + "range":[127,173], + "expression":{ + "type":"ArrowFunctionExpression", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":17}}, + "range":[109,126], + "value":" 2.1 L arrow " + } + ], + "loc":{"source":null,"start":{"line":3,"column":18},"end":{"line":3,"column":47}}, + "range":[127,156], + "id":null, + "params":[], + "body":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":48},"end":{"line":3,"column":63}}, + "range":[157,172], + "value":" 2.3 T num " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":30},"end":{"line":3,"column":45}}, + "range":[139,154], + "value":" 2.2 L num " + } + ], + "loc":{"source":null,"start":{"line":3,"column":46},"end":{"line":3,"column":47}}, + "range":[155,156], + "value":1, + "raw":"1" + }, + "async":true, + "generator":false, + "predicate":null, + "expression":true, + "returnType":null, + "typeParameters":null + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":5,"column":15},"end":{"line":5,"column":38}}, + "range":[190,213], + "expression":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":5,"column":15},"end":{"line":5,"column":37}}, + "range":[190,212], + "id":null, + "params":[ + { + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":17},"end":{"line":5,"column":31}}, + "range":[192,206], + "value":" 3.2 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":14}}, + "range":[175,189], + "value":" 3.1 L id " + } + ], + "loc":{"source":null,"start":{"line":5,"column":15},"end":{"line":5,"column":16}}, + "range":[190,191], + "name":"x", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":5,"column":35},"end":{"line":5,"column":37}}, + "range":[210,212], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":7,"column":20},"end":{"line":7,"column":71}}, + "range":[235,286], + "expression":{ + "type":"ArrowFunctionExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":46},"end":{"line":7,"column":64}}, + "range":[261,279], + "value":" 4.3 T params " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":24},"end":{"line":7,"column":42}}, + "range":[239,257], + "value":" 4.2 L params " + } + ], + "loc":{"source":null,"start":{"line":7,"column":20},"end":{"line":7,"column":70}}, + "range":[235,285], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":7,"column":68},"end":{"line":7,"column":70}}, + "range":[283,285], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":19}}, + "range":[215,234], + "value":" 4.1 L tparams " + } + ], + "loc":{"source":null,"start":{"line":7,"column":20},"end":{"line":7,"column":23}}, + "range":[235,238], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":7,"column":21},"end":{"line":7,"column":22}}, + "range":[236,237], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":9,"column":19},"end":{"line":9,"column":84}}, + "range":[307,372], + "expression":{ + "type":"ArrowFunctionExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":22},"end":{"line":9,"column":40}}, + "range":[310,328], + "value":" 5.2 T params " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":9,"column":18}}, + "range":[288,306], + "value":" 5.1 L params " + } + ], + "loc":{"source":null,"start":{"line":9,"column":19},"end":{"line":9,"column":84}}, + "range":[307,372], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":9,"column":82},"end":{"line":9,"column":84}}, + "range":[370,372], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":9,"column":41},"end":{"line":9,"column":62}}, + "range":[329,350], + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":63},"end":{"line":9,"column":78}}, + "range":[351,366], + "value":" 5.4 T any " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":43},"end":{"line":9,"column":58}}, + "range":[331,346], + "value":" 5.3 L any " + } + ], + "loc":{"source":null,"start":{"line":9,"column":59},"end":{"line":9,"column":62}}, + "range":[347,350] + } + }, + "typeParameters":null + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":11,"column":20},"end":{"line":12,"column":48}}, + "range":[394,466], + "expression":{ + "type":"ArrowFunctionExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":24},"end":{"line":12,"column":42}}, + "range":[442,460], + "value":" 6.4 T params " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":2},"end":{"line":12,"column":20}}, + "range":[420,438], + "value":" 6.3 L params " + } + ], + "loc":{"source":null,"start":{"line":11,"column":20},"end":{"line":12,"column":48}}, + "range":[394,466], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":12,"column":46},"end":{"line":12,"column":48}}, + "range":[464,466], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":24},"end":{"line":11,"column":43}}, + "range":[398,417], + "value":" 6.2 T tparams " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":11,"column":19}}, + "range":[374,393], + "value":" 6.1 L tparams " + } + ], + "loc":{"source":null,"start":{"line":11,"column":20},"end":{"line":11,"column":23}}, + "range":[394,397], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":11,"column":21},"end":{"line":11,"column":22}}, + "range":[395,396], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "directive":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "value":" 1.1 L arrow " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":42}}, + "range":[24,42], + "value":" 1.2 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":46},"end":{"line":1,"column":64}}, + "range":[46,64], + "value":" 1.3 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":68},"end":{"line":1,"column":85}}, + "range":[68,85], + "value":" 1.4 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":89},"end":{"line":1,"column":106}}, + "range":[89,106], + "value":" 1.5 T block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":17}}, + "range":[109,126], + "value":" 2.1 L arrow " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":30},"end":{"line":3,"column":45}}, + "range":[139,154], + "value":" 2.2 L num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":48},"end":{"line":3,"column":63}}, + "range":[157,172], + "value":" 2.3 T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":14}}, + "range":[175,189], + "value":" 3.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":17},"end":{"line":5,"column":31}}, + "range":[192,206], + "value":" 3.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":19}}, + "range":[215,234], + "value":" 4.1 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":24},"end":{"line":7,"column":42}}, + "range":[239,257], + "value":" 4.2 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":46},"end":{"line":7,"column":64}}, + "range":[261,279], + "value":" 4.3 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":9,"column":18}}, + "range":[288,306], + "value":" 5.1 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":22},"end":{"line":9,"column":40}}, + "range":[310,328], + "value":" 5.2 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":43},"end":{"line":9,"column":58}}, + "range":[331,346], + "value":" 5.3 L any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":63},"end":{"line":9,"column":78}}, + "range":[351,366], + "value":" 5.4 T any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":11,"column":19}}, + "range":[374,393], + "value":" 6.1 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":24},"end":{"line":11,"column":43}}, + "range":[398,417], + "value":" 6.2 T tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":2},"end":{"line":12,"column":20}}, + "range":[420,438], + "value":" 6.3 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":24},"end":{"line":12,"column":42}}, + "range":[442,460], + "value":" 6.4 T params " + } + ] +} diff --git a/lib/test/flow/comment_interning/assignment.js b/lib/test/flow/comment_interning/assignment.js new file mode 100644 index 0000000..2f74340 --- /dev/null +++ b/lib/test/flow/comment_interning/assignment.js @@ -0,0 +1,5 @@ +let x = 1; + +/* 1.1 Leading on left */ x /* 1.2 Trailing on left */ = /* 1.3 Leading on right */ 1 /* 1.4 Trailing on right */; + +/* 2.1 Leading on assign */ (/* 2.2 Leading on left */ x = 1 /* 2.3 Trailing on right */) /* 2.4 Trailing on assign */; diff --git a/lib/test/flow/comment_interning/assignment.options.json b/lib/test/flow/comment_interning/assignment.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/assignment.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/assignment.tree.json b/lib/test/flow/comment_interning/assignment.tree.json new file mode 100644 index 0000000..3305523 --- /dev/null +++ b/lib/test/flow/comment_interning/assignment.tree.json @@ -0,0 +1,203 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":5,"column":119}}, + "range":[0,247], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, + "range":[4,9], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "value":1, + "raw":"1" + } + } + ], + "kind":"let" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":3,"column":26},"end":{"line":3,"column":114}}, + "range":[38,126], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":3,"column":26},"end":{"line":3,"column":85}}, + "range":[38,97], + "operator":"=", + "left":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":28},"end":{"line":3,"column":54}}, + "range":[40,66], + "value":" 1.2 Trailing on left " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":25}}, + "range":[12,37], + "value":" 1.1 Leading on left " + } + ], + "loc":{"source":null,"start":{"line":3,"column":26},"end":{"line":3,"column":27}}, + "range":[38,39], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":86},"end":{"line":3,"column":113}}, + "range":[98,125], + "value":" 1.4 Trailing on right " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":57},"end":{"line":3,"column":83}}, + "range":[69,95], + "value":" 1.3 Leading on right " + } + ], + "loc":{"source":null,"start":{"line":3,"column":84},"end":{"line":3,"column":85}}, + "range":[96,97], + "value":1, + "raw":"1" + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":5,"column":28},"end":{"line":5,"column":119}}, + "range":[156,247], + "expression":{ + "type":"AssignmentExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":90},"end":{"line":5,"column":118}}, + "range":[218,246], + "value":" 2.4 Trailing on assign " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":27}}, + "range":[128,155], + "value":" 2.1 Leading on assign " + } + ], + "loc":{"source":null,"start":{"line":5,"column":55},"end":{"line":5,"column":60}}, + "range":[183,188], + "operator":"=", + "left":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":29},"end":{"line":5,"column":54}}, + "range":[157,182], + "value":" 2.2 Leading on left " + } + ], + "loc":{"source":null,"start":{"line":5,"column":55},"end":{"line":5,"column":56}}, + "range":[183,184], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":61},"end":{"line":5,"column":88}}, + "range":[189,216], + "value":" 2.3 Trailing on right " + } + ], + "loc":{"source":null,"start":{"line":5,"column":59},"end":{"line":5,"column":60}}, + "range":[187,188], + "value":1, + "raw":"1" + } + }, + "directive":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":25}}, + "range":[12,37], + "value":" 1.1 Leading on left " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":28},"end":{"line":3,"column":54}}, + "range":[40,66], + "value":" 1.2 Trailing on left " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":57},"end":{"line":3,"column":83}}, + "range":[69,95], + "value":" 1.3 Leading on right " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":86},"end":{"line":3,"column":113}}, + "range":[98,125], + "value":" 1.4 Trailing on right " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":27}}, + "range":[128,155], + "value":" 2.1 Leading on assign " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":29},"end":{"line":5,"column":54}}, + "range":[157,182], + "value":" 2.2 Leading on left " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":61},"end":{"line":5,"column":88}}, + "range":[189,216], + "value":" 2.3 Trailing on right " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":90},"end":{"line":5,"column":118}}, + "range":[218,246], + "value":" 2.4 Trailing on assign " + } + ] +} diff --git a/lib/test/flow/comment_interning/binary.js b/lib/test/flow/comment_interning/binary.js new file mode 100644 index 0000000..35510a9 --- /dev/null +++ b/lib/test/flow/comment_interning/binary.js @@ -0,0 +1,3 @@ +/* 1.1 Leading on left */ 1 /* 1.2 Trailing on left */ + /* 1.3 Leading on right */ 2 /* 1.4 Trailing on right */; + +/* 2.1 Leading on binary */ (/* 2.2 Leading on left */ 1 + 2 /* 2.3 Trailing on right */) /* 2.4 Trailing on binary */; diff --git a/lib/test/flow/comment_interning/binary.options.json b/lib/test/flow/comment_interning/binary.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/binary.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/binary.tree.json b/lib/test/flow/comment_interning/binary.tree.json new file mode 100644 index 0000000..b14b294 --- /dev/null +++ b/lib/test/flow/comment_interning/binary.tree.json @@ -0,0 +1,173 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":3,"column":119}}, + "range":[26,235], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":114}}, + "range":[26,114], + "expression":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":85}}, + "range":[26,85], + "operator":"+", + "left":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":54}}, + "range":[28,54], + "value":" 1.2 Trailing on left " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "value":" 1.1 Leading on left " + } + ], + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, + "range":[26,27], + "value":1, + "raw":"1" + }, + "right":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":86},"end":{"line":1,"column":113}}, + "range":[86,113], + "value":" 1.4 Trailing on right " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":57},"end":{"line":1,"column":83}}, + "range":[57,83], + "value":" 1.3 Leading on right " + } + ], + "loc":{"source":null,"start":{"line":1,"column":84},"end":{"line":1,"column":85}}, + "range":[84,85], + "value":2, + "raw":"2" + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":3,"column":28},"end":{"line":3,"column":119}}, + "range":[144,235], + "expression":{ + "type":"BinaryExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":90},"end":{"line":3,"column":118}}, + "range":[206,234], + "value":" 2.4 Trailing on binary " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":27}}, + "range":[116,143], + "value":" 2.1 Leading on binary " + } + ], + "loc":{"source":null,"start":{"line":3,"column":55},"end":{"line":3,"column":60}}, + "range":[171,176], + "operator":"+", + "left":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":29},"end":{"line":3,"column":54}}, + "range":[145,170], + "value":" 2.2 Leading on left " + } + ], + "loc":{"source":null,"start":{"line":3,"column":55},"end":{"line":3,"column":56}}, + "range":[171,172], + "value":1, + "raw":"1" + }, + "right":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":61},"end":{"line":3,"column":88}}, + "range":[177,204], + "value":" 2.3 Trailing on right " + } + ], + "loc":{"source":null,"start":{"line":3,"column":59},"end":{"line":3,"column":60}}, + "range":[175,176], + "value":2, + "raw":"2" + } + }, + "directive":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "value":" 1.1 Leading on left " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":54}}, + "range":[28,54], + "value":" 1.2 Trailing on left " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":57},"end":{"line":1,"column":83}}, + "range":[57,83], + "value":" 1.3 Leading on right " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":86},"end":{"line":1,"column":113}}, + "range":[86,113], + "value":" 1.4 Trailing on right " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":27}}, + "range":[116,143], + "value":" 2.1 Leading on binary " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":29},"end":{"line":3,"column":54}}, + "range":[145,170], + "value":" 2.2 Leading on left " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":61},"end":{"line":3,"column":88}}, + "range":[177,204], + "value":" 2.3 Trailing on right " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":90},"end":{"line":3,"column":118}}, + "range":[206,234], + "value":" 2.4 Trailing on binary " + } + ] +} diff --git a/lib/test/flow/comment_interning/block.js b/lib/test/flow/comment_interning/block.js new file mode 100644 index 0000000..2668077 --- /dev/null +++ b/lib/test/flow/comment_interning/block.js @@ -0,0 +1,13 @@ +function leadingOnly() { + /* 1.1 Leading */ {} +} + +function trailingOnly() { + {} /* 2.1 Trailing */ +} + +function leadingAndTrialing() { + /* 3.1 Leading */ {} /* Trailing */ +} + +{ /* 4.1 I block */ } diff --git a/lib/test/flow/comment_interning/block.options.json b/lib/test/flow/comment_interning/block.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/block.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/block.tree.json b/lib/test/flow/comment_interning/block.tree.json new file mode 100644 index 0000000..94f63cd --- /dev/null +++ b/lib/test/flow/comment_interning/block.tree.json @@ -0,0 +1,184 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":13,"column":21}}, + "range":[0,204], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,51], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":20}}, + "range":[9,20], + "name":"leadingOnly", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":3,"column":1}}, + "range":[23,51], + "body":[ + { + "type":"BlockStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":21}}, + "range":[29,46], + "value":" 1.1 Leading " + } + ], + "loc":{"source":null,"start":{"line":2,"column":22},"end":{"line":2,"column":24}}, + "range":[47,49], + "body":[] + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":7,"column":1}}, + "range":[53,106], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":9},"end":{"line":5,"column":21}}, + "range":[62,74], + "name":"trailingOnly", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":5,"column":24},"end":{"line":7,"column":1}}, + "range":[77,106], + "body":[ + { + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":7},"end":{"line":6,"column":25}}, + "range":[86,104], + "value":" 2.1 Trailing " + } + ], + "loc":{"source":null,"start":{"line":6,"column":4},"end":{"line":6,"column":6}}, + "range":[83,85], + "body":[] + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":11,"column":1}}, + "range":[108,181], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":9},"end":{"line":9,"column":27}}, + "range":[117,135], + "name":"leadingAndTrialing", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":9,"column":30},"end":{"line":11,"column":1}}, + "range":[138,181], + "body":[ + { + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":25},"end":{"line":10,"column":39}}, + "range":[165,179], + "value":" Trailing " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":4},"end":{"line":10,"column":21}}, + "range":[144,161], + "value":" 3.1 Leading " + } + ], + "loc":{"source":null,"start":{"line":10,"column":22},"end":{"line":10,"column":24}}, + "range":[162,164], + "body":[] + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":2},"end":{"line":13,"column":19}}, + "range":[185,202], + "value":" 4.1 I block " + } + ], + "loc":{"source":null,"start":{"line":13,"column":0},"end":{"line":13,"column":21}}, + "range":[183,204], + "body":[] + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":21}}, + "range":[29,46], + "value":" 1.1 Leading " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":7},"end":{"line":6,"column":25}}, + "range":[86,104], + "value":" 2.1 Trailing " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":4},"end":{"line":10,"column":21}}, + "range":[144,161], + "value":" 3.1 Leading " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":25},"end":{"line":10,"column":39}}, + "range":[165,179], + "value":" Trailing " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":2},"end":{"line":13,"column":19}}, + "range":[185,202], + "value":" 4.1 I block " + } + ] +} diff --git a/lib/test/flow/comment_interning/break.js b/lib/test/flow/comment_interning/break.js new file mode 100644 index 0000000..b72cb57 --- /dev/null +++ b/lib/test/flow/comment_interning/break.js @@ -0,0 +1,28 @@ +function break_with_label() { + foo: for (;;) { + /* 1.1 leading on break */ + break /* 1.2 leading on label */ foo /* 1.3 trailing on label */; + /* 1.4 trailing */ + } +} + +function break_without_label() { + for (;;) { + /* 2.1 leading */ + break /* 2.2 internal */; + /* 2.3 trailing */ + } +} + +function implicit_semicolon() { + label: for (;;) { + { + break /* 3.1 T break */ + /* 3.2 L break */ break /* 3.3 T break */ + } + { + break label /* 3.4 T id */ + /* 3.5 L break */ break label /* 3.6 T id */ + } + } +} diff --git a/lib/test/flow/comment_interning/break.options.json b/lib/test/flow/comment_interning/break.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/break.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/break.tree.json b/lib/test/flow/comment_interning/break.tree.json new file mode 100644 index 0000000..4039da6 --- /dev/null +++ b/lib/test/flow/comment_interning/break.tree.json @@ -0,0 +1,406 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":28,"column":1}}, + "range":[0,550], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "range":[0,177], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":25}}, + "range":[9,25], + "name":"break_with_label", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":7,"column":1}}, + "range":[28,177], + "body":[ + { + "type":"LabeledStatement", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":6,"column":3}}, + "range":[32,175], + "label":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "range":[32,35], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ForStatement", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":6,"column":3}}, + "range":[37,175], + "init":null, + "test":null, + "update":null, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":6,"column":3}}, + "range":[46,175], + "body":[ + { + "type":"BreakStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":4},"end":{"line":5,"column":22}}, + "range":[153,171], + "value":" 1.4 trailing " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":30}}, + "range":[52,78], + "value":" 1.1 leading on break " + } + ], + "loc":{"source":null,"start":{"line":4,"column":4},"end":{"line":4,"column":69}}, + "range":[83,148], + "label":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":41},"end":{"line":4,"column":68}}, + "range":[120,147], + "value":" 1.3 trailing on label " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":10},"end":{"line":4,"column":36}}, + "range":[89,115], + "value":" 1.2 leading on label " + } + ], + "loc":{"source":null,"start":{"line":4,"column":37},"end":{"line":4,"column":40}}, + "range":[116,119], + "name":"foo", + "typeAnnotation":null, + "optional":false + } + } + ] + } + } + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":15,"column":1}}, + "range":[179,305], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":9},"end":{"line":9,"column":28}}, + "range":[188,207], + "name":"break_without_label", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":9,"column":31},"end":{"line":15,"column":1}}, + "range":[210,305], + "body":[ + { + "type":"ForStatement", + "loc":{"source":null,"start":{"line":10,"column":2},"end":{"line":14,"column":3}}, + "range":[214,303], + "init":null, + "test":null, + "update":null, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":10,"column":11},"end":{"line":14,"column":3}}, + "range":[223,303], + "body":[ + { + "type":"BreakStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":4},"end":{"line":13,"column":22}}, + "range":[281,299], + "value":" 2.3 trailing " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":4},"end":{"line":11,"column":21}}, + "range":[229,246], + "value":" 2.1 leading " + } + ], + "loc":{"source":null,"start":{"line":12,"column":4},"end":{"line":12,"column":29}}, + "range":[251,276], + "label":null + } + ] + } + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":17,"column":0},"end":{"line":28,"column":1}}, + "range":[307,550], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":17,"column":9},"end":{"line":17,"column":27}}, + "range":[316,334], + "name":"implicit_semicolon", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":17,"column":30},"end":{"line":28,"column":1}}, + "range":[337,550], + "body":[ + { + "type":"LabeledStatement", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":27,"column":3}}, + "range":[341,548], + "label":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":18,"column":7}}, + "range":[341,346], + "name":"label", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ForStatement", + "loc":{"source":null,"start":{"line":18,"column":9},"end":{"line":27,"column":3}}, + "range":[348,548], + "init":null, + "test":null, + "update":null, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":18,"column":18},"end":{"line":27,"column":3}}, + "range":[357,548], + "body":[ + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":19,"column":4},"end":{"line":22,"column":5}}, + "range":[363,448], + "body":[ + { + "type":"BreakStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":12},"end":{"line":20,"column":29}}, + "range":[377,394], + "value":" 3.1 T break " + } + ], + "loc":{"source":null,"start":{"line":20,"column":6},"end":{"line":20,"column":11}}, + "range":[371,376], + "label":null + }, + { + "type":"BreakStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":30},"end":{"line":21,"column":47}}, + "range":[425,442], + "value":" 3.3 T break " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":6},"end":{"line":21,"column":23}}, + "range":[401,418], + "value":" 3.2 L break " + } + ], + "loc":{"source":null,"start":{"line":21,"column":24},"end":{"line":21,"column":29}}, + "range":[419,424], + "label":null + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":23,"column":4},"end":{"line":26,"column":5}}, + "range":[453,544], + "body":[ + { + "type":"BreakStatement", + "loc":{"source":null,"start":{"line":24,"column":6},"end":{"line":24,"column":17}}, + "range":[461,472], + "label":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":18},"end":{"line":24,"column":32}}, + "range":[473,487], + "value":" 3.4 T id " + } + ], + "loc":{"source":null,"start":{"line":24,"column":12},"end":{"line":24,"column":17}}, + "range":[467,472], + "name":"label", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"BreakStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":6},"end":{"line":25,"column":23}}, + "range":[494,511], + "value":" 3.5 L break " + } + ], + "loc":{"source":null,"start":{"line":25,"column":24},"end":{"line":25,"column":35}}, + "range":[512,523], + "label":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":36},"end":{"line":25,"column":50}}, + "range":[524,538], + "value":" 3.6 T id " + } + ], + "loc":{"source":null,"start":{"line":25,"column":30},"end":{"line":25,"column":35}}, + "range":[518,523], + "name":"label", + "typeAnnotation":null, + "optional":false + } + } + ] + } + ] + } + } + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":30}}, + "range":[52,78], + "value":" 1.1 leading on break " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":10},"end":{"line":4,"column":36}}, + "range":[89,115], + "value":" 1.2 leading on label " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":41},"end":{"line":4,"column":68}}, + "range":[120,147], + "value":" 1.3 trailing on label " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":4},"end":{"line":5,"column":22}}, + "range":[153,171], + "value":" 1.4 trailing " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":4},"end":{"line":11,"column":21}}, + "range":[229,246], + "value":" 2.1 leading " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":10},"end":{"line":12,"column":28}}, + "range":[257,275], + "value":" 2.2 internal " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":4},"end":{"line":13,"column":22}}, + "range":[281,299], + "value":" 2.3 trailing " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":12},"end":{"line":20,"column":29}}, + "range":[377,394], + "value":" 3.1 T break " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":6},"end":{"line":21,"column":23}}, + "range":[401,418], + "value":" 3.2 L break " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":30},"end":{"line":21,"column":47}}, + "range":[425,442], + "value":" 3.3 T break " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":18},"end":{"line":24,"column":32}}, + "range":[473,487], + "value":" 3.4 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":6},"end":{"line":25,"column":23}}, + "range":[494,511], + "value":" 3.5 L break " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":36},"end":{"line":25,"column":50}}, + "range":[524,538], + "value":" 3.6 T id " + } + ] +} diff --git a/lib/test/flow/comment_interning/call.js b/lib/test/flow/comment_interning/call.js new file mode 100644 index 0000000..c49cdb2 --- /dev/null +++ b/lib/test/flow/comment_interning/call.js @@ -0,0 +1,18 @@ +/* 1.1 L id */ foo /* 1.2 L targs */ /* 1.3 L args */ (/* 1.4 L num */ 1 /* 1.5 T num */) /* 1.6 T args */; + +foo(); + +/* 3.1 L id */ foo /* 3.2 T id */ + /* 3.3 L args */ () /* 3.4 T args */ + +/* 4.1 L id */ foo /* 4.2 T id */ + /* 4.3 L targs */ /* 4.4 T targs */ + /* 4.5 L args */ () /* 4.6 T args */ + +foo(/* 5.1 I args */); + +foo(a, /* 6.1 I args */); + +foo(); + +foo(); diff --git a/lib/test/flow/comment_interning/call.options.json b/lib/test/flow/comment_interning/call.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/call.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/call.tree.json b/lib/test/flow/comment_interning/call.tree.json new file mode 100644 index 0000000..c40bf69 --- /dev/null +++ b/lib/test/flow/comment_interning/call.tree.json @@ -0,0 +1,620 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":18,"column":28}}, + "range":[15,499], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":111}}, + "range":[15,111], + "expression":{ + "type":"CallExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":94},"end":{"line":1,"column":110}}, + "range":[94,110], + "value":" 1.6 T args " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":57}}, + "range":[41,57], + "value":" 1.3 L args " + } + ], + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":93}}, + "range":[15,93], + "callee":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "value":" 1.1 L id " + } + ], + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, + "range":[15,18], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":{ + "type":"TypeParameterInstantiation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":36}}, + "range":[19,36], + "value":" 1.2 L targs " + } + ], + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":40}}, + "range":[37,40], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":39}}, + "range":[38,39], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":39}}, + "range":[38,39], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + }, + "arguments":[ + { + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":77},"end":{"line":1,"column":92}}, + "range":[77,92], + "value":" 1.5 T num " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":59},"end":{"line":1,"column":74}}, + "range":[59,74], + "value":" 1.4 L num " + } + ], + "loc":{"source":null,"start":{"line":1,"column":75},"end":{"line":1,"column":76}}, + "range":[75,76], + "value":1, + "raw":"1" + } + ] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":88}}, + "range":[113,201], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":87}}, + "range":[113,200], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":3}}, + "range":[113,116], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":3,"column":3},"end":{"line":3,"column":85}}, + "range":[116,198], + "params":[ + { + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":24},"end":{"line":3,"column":39}}, + "range":[137,152], + "value":" 2.2 T any " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":19}}, + "range":[117,132], + "value":" 2.1 L any " + } + ], + "loc":{"source":null,"start":{"line":3,"column":20},"end":{"line":3,"column":23}}, + "range":[133,136] + }, + { + "type":"GenericTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":64},"end":{"line":3,"column":84}}, + "range":[177,197], + "value":" 2.4 T implicit " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":41},"end":{"line":3,"column":61}}, + "range":[154,174], + "value":" 2.3 L implicit " + } + ], + "loc":{"source":null,"start":{"line":3,"column":62},"end":{"line":3,"column":63}}, + "range":[175,176], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":62},"end":{"line":3,"column":63}}, + "range":[175,176], + "name":"_", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + }, + "arguments":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":5,"column":15},"end":{"line":6,"column":21}}, + "range":[218,258], + "expression":{ + "type":"CallExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":22},"end":{"line":6,"column":38}}, + "range":[259,275], + "value":" 3.4 T args " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":18}}, + "range":[239,255], + "value":" 3.3 L args " + } + ], + "loc":{"source":null,"start":{"line":5,"column":15},"end":{"line":6,"column":21}}, + "range":[218,258], + "callee":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":19},"end":{"line":5,"column":33}}, + "range":[222,236], + "value":" 3.2 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":14}}, + "range":[203,217], + "value":" 3.1 L id " + } + ], + "loc":{"source":null,"start":{"line":5,"column":15},"end":{"line":5,"column":18}}, + "range":[218,221], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":8,"column":15},"end":{"line":10,"column":21}}, + "range":[292,374], + "expression":{ + "type":"CallExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":22},"end":{"line":10,"column":38}}, + "range":[375,391], + "value":" 4.6 T args " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":2},"end":{"line":10,"column":18}}, + "range":[355,371], + "value":" 4.5 L args " + } + ], + "loc":{"source":null,"start":{"line":8,"column":15},"end":{"line":10,"column":21}}, + "range":[292,374], + "callee":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":19},"end":{"line":8,"column":33}}, + "range":[296,310], + "value":" 4.2 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":0},"end":{"line":8,"column":14}}, + "range":[277,291], + "value":" 4.1 L id " + } + ], + "loc":{"source":null,"start":{"line":8,"column":15},"end":{"line":8,"column":18}}, + "range":[292,295], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":{ + "type":"TypeParameterInstantiation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":24},"end":{"line":9,"column":41}}, + "range":[335,352], + "value":" 4.4 T targs " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":2},"end":{"line":9,"column":19}}, + "range":[313,330], + "value":" 4.3 L targs " + } + ], + "loc":{"source":null,"start":{"line":9,"column":20},"end":{"line":9,"column":23}}, + "range":[331,334], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":9,"column":21},"end":{"line":9,"column":22}}, + "range":[332,333], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":21},"end":{"line":9,"column":22}}, + "range":[332,333], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + }, + "arguments":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":12,"column":0},"end":{"line":12,"column":22}}, + "range":[393,415], + "expression":{ + "type":"CallExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":4},"end":{"line":12,"column":20}}, + "range":[397,413], + "value":" 5.1 I args " + } + ], + "loc":{"source":null,"start":{"line":12,"column":0},"end":{"line":12,"column":21}}, + "range":[393,414], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":12,"column":0},"end":{"line":12,"column":3}}, + "range":[393,396], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":14,"column":0},"end":{"line":14,"column":25}}, + "range":[417,442], + "expression":{ + "type":"CallExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":7},"end":{"line":14,"column":23}}, + "range":[424,440], + "value":" 6.1 I args " + } + ], + "loc":{"source":null,"start":{"line":14,"column":0},"end":{"line":14,"column":24}}, + "range":[417,441], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":14,"column":0},"end":{"line":14,"column":3}}, + "range":[417,420], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":14,"column":4},"end":{"line":14,"column":5}}, + "range":[421,422], + "name":"a", + "typeAnnotation":null, + "optional":false + } + ] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":16,"column":0},"end":{"line":16,"column":25}}, + "range":[444,469], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":16,"column":0},"end":{"line":16,"column":24}}, + "range":[444,468], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":16,"column":0},"end":{"line":16,"column":3}}, + "range":[444,447], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":{ + "type":"TypeParameterInstantiation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":4},"end":{"line":16,"column":21}}, + "range":[448,465], + "value":" 7.1 I targs " + } + ], + "loc":{"source":null,"start":{"line":16,"column":3},"end":{"line":16,"column":22}}, + "range":[447,466], + "params":[] + }, + "arguments":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":18,"column":0},"end":{"line":18,"column":28}}, + "range":[471,499], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":18,"column":0},"end":{"line":18,"column":27}}, + "range":[471,498], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":18,"column":0},"end":{"line":18,"column":3}}, + "range":[471,474], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":{ + "type":"TypeParameterInstantiation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":7},"end":{"line":18,"column":24}}, + "range":[478,495], + "value":" 8.1 I targs " + } + ], + "loc":{"source":null,"start":{"line":18,"column":3},"end":{"line":18,"column":25}}, + "range":[474,496], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":18,"column":4},"end":{"line":18,"column":5}}, + "range":[475,476], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":18,"column":4},"end":{"line":18,"column":5}}, + "range":[475,476], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + }, + "arguments":[] + }, + "directive":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "value":" 1.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":36}}, + "range":[19,36], + "value":" 1.2 L targs " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":57}}, + "range":[41,57], + "value":" 1.3 L args " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":59},"end":{"line":1,"column":74}}, + "range":[59,74], + "value":" 1.4 L num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":77},"end":{"line":1,"column":92}}, + "range":[77,92], + "value":" 1.5 T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":94},"end":{"line":1,"column":110}}, + "range":[94,110], + "value":" 1.6 T args " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":19}}, + "range":[117,132], + "value":" 2.1 L any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":24},"end":{"line":3,"column":39}}, + "range":[137,152], + "value":" 2.2 T any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":41},"end":{"line":3,"column":61}}, + "range":[154,174], + "value":" 2.3 L implicit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":64},"end":{"line":3,"column":84}}, + "range":[177,197], + "value":" 2.4 T implicit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":14}}, + "range":[203,217], + "value":" 3.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":19},"end":{"line":5,"column":33}}, + "range":[222,236], + "value":" 3.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":18}}, + "range":[239,255], + "value":" 3.3 L args " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":22},"end":{"line":6,"column":38}}, + "range":[259,275], + "value":" 3.4 T args " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":0},"end":{"line":8,"column":14}}, + "range":[277,291], + "value":" 4.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":19},"end":{"line":8,"column":33}}, + "range":[296,310], + "value":" 4.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":2},"end":{"line":9,"column":19}}, + "range":[313,330], + "value":" 4.3 L targs " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":24},"end":{"line":9,"column":41}}, + "range":[335,352], + "value":" 4.4 T targs " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":2},"end":{"line":10,"column":18}}, + "range":[355,371], + "value":" 4.5 L args " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":22},"end":{"line":10,"column":38}}, + "range":[375,391], + "value":" 4.6 T args " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":4},"end":{"line":12,"column":20}}, + "range":[397,413], + "value":" 5.1 I args " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":7},"end":{"line":14,"column":23}}, + "range":[424,440], + "value":" 6.1 I args " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":4},"end":{"line":16,"column":21}}, + "range":[448,465], + "value":" 7.1 I targs " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":7},"end":{"line":18,"column":24}}, + "range":[478,495], + "value":" 8.1 I targs " + } + ] +} diff --git a/lib/test/flow/comment_interning/catch.js b/lib/test/flow/comment_interning/catch.js new file mode 100644 index 0000000..13d1bc1 --- /dev/null +++ b/lib/test/flow/comment_interning/catch.js @@ -0,0 +1,35 @@ +function onlyLeading() { + /* Not leading 1 */ + const z = 0; + try { + const x = 1; + /* Not leading 2 */ + } + // 1.1 Leading A + /* 1.2 Leading B */ + catch (e1) { + console.log(1); + } +} + +function onlyTrailing() { + try { + const y = 2; + } catch /* 2.1 Trailing */ (e2) /* 2.2 Not trailing */ { + /* 2.3 Not trailing */ + console.log(2); + } + /* 2.4 Not Trailing */ +} + +function leadingAndTrailing() { + try { + const y = 2; + } + // 3.1 Leading + catch /* 3.2 Trailing */ (e3) /* 3.3 Not trailing */ { + /* 3.4 Not trailing */ + console.log(3); + } + /* 3.5 Not Trailing */ +} diff --git a/lib/test/flow/comment_interning/catch.options.json b/lib/test/flow/comment_interning/catch.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/catch.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/catch.tree.json b/lib/test/flow/comment_interning/catch.tree.json new file mode 100644 index 0000000..4820253 --- /dev/null +++ b/lib/test/flow/comment_interning/catch.tree.json @@ -0,0 +1,610 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":35,"column":1}}, + "range":[0,600], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":13,"column":1}}, + "range":[0,196], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":20}}, + "range":[9,20], + "name":"onlyLeading", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":13,"column":1}}, + "range":[23,196], + "body":[ + { + "type":"VariableDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":21}}, + "range":[27,46], + "value":" Not leading 1 " + } + ], + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":14}}, + "range":[49,61], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":13}}, + "range":[55,60], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":9}}, + "range":[55,56], + "name":"z", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":12},"end":{"line":3,"column":13}}, + "range":[59,60], + "value":0, + "raw":"0" + } + } + ], + "kind":"const" + }, + { + "type":"TryStatement", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":12,"column":3}}, + "range":[64,194], + "block":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":4,"column":6},"end":{"line":7,"column":3}}, + "range":[68,114], + "body":[ + { + "type":"VariableDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":4},"end":{"line":6,"column":23}}, + "range":[91,110], + "value":" Not leading 2 " + } + ], + "loc":{"source":null,"start":{"line":5,"column":4},"end":{"line":5,"column":16}}, + "range":[74,86], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":5,"column":10},"end":{"line":5,"column":15}}, + "range":[80,85], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":10},"end":{"line":5,"column":11}}, + "range":[80,81], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":5,"column":14},"end":{"line":5,"column":15}}, + "range":[84,85], + "value":1, + "raw":"1" + } + } + ], + "kind":"const" + } + ] + }, + "handler":{ + "type":"CatchClause", + "leadingComments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":8,"column":2},"end":{"line":8,"column":18}}, + "range":[117,133], + "value":" 1.1 Leading A" + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":2},"end":{"line":9,"column":21}}, + "range":[136,155], + "value":" 1.2 Leading B " + } + ], + "loc":{"source":null,"start":{"line":10,"column":2},"end":{"line":12,"column":3}}, + "range":[158,194], + "param":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":10,"column":9},"end":{"line":10,"column":11}}, + "range":[165,167], + "name":"e1", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":10,"column":13},"end":{"line":12,"column":3}}, + "range":[169,194], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":11,"column":4},"end":{"line":11,"column":19}}, + "range":[175,190], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":11,"column":4},"end":{"line":11,"column":18}}, + "range":[175,189], + "callee":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":11,"column":4},"end":{"line":11,"column":15}}, + "range":[175,186], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":11,"column":4},"end":{"line":11,"column":11}}, + "range":[175,182], + "name":"console", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":11,"column":12},"end":{"line":11,"column":15}}, + "range":[183,186], + "name":"log", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "typeArguments":null, + "arguments":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":11,"column":16},"end":{"line":11,"column":17}}, + "range":[187,188], + "value":1, + "raw":"1" + } + ] + }, + "directive":null + } + ] + } + }, + "finalizer":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":15,"column":0},"end":{"line":23,"column":1}}, + "range":[198,385], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":15,"column":9},"end":{"line":15,"column":21}}, + "range":[207,219], + "name":"onlyTrailing", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":15,"column":24},"end":{"line":23,"column":1}}, + "range":[222,385], + "body":[ + { + "type":"TryStatement", + "loc":{"source":null,"start":{"line":16,"column":2},"end":{"line":21,"column":3}}, + "range":[226,358], + "block":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":16,"column":6},"end":{"line":18,"column":3}}, + "range":[230,252], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":17,"column":4},"end":{"line":17,"column":16}}, + "range":[236,248], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":17,"column":10},"end":{"line":17,"column":15}}, + "range":[242,247], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":17,"column":10},"end":{"line":17,"column":11}}, + "range":[242,243], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":17,"column":14},"end":{"line":17,"column":15}}, + "range":[246,247], + "value":2, + "raw":"2" + } + } + ], + "kind":"const" + } + ] + }, + "handler":{ + "type":"CatchClause", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":10},"end":{"line":18,"column":28}}, + "range":[259,277], + "value":" 2.1 Trailing " + } + ], + "loc":{"source":null,"start":{"line":18,"column":4},"end":{"line":21,"column":3}}, + "range":[253,358], + "param":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":18,"column":30},"end":{"line":18,"column":32}}, + "range":[279,281], + "name":"e2", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":2},"end":{"line":22,"column":24}}, + "range":[361,383], + "value":" 2.4 Not Trailing " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":34},"end":{"line":18,"column":56}}, + "range":[283,305], + "value":" 2.2 Not trailing " + } + ], + "loc":{"source":null,"start":{"line":18,"column":57},"end":{"line":21,"column":3}}, + "range":[306,358], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":20,"column":4},"end":{"line":20,"column":19}}, + "range":[339,354], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":20,"column":4},"end":{"line":20,"column":18}}, + "range":[339,353], + "callee":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":20,"column":4},"end":{"line":20,"column":15}}, + "range":[339,350], + "object":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":4},"end":{"line":19,"column":26}}, + "range":[312,334], + "value":" 2.3 Not trailing " + } + ], + "loc":{"source":null,"start":{"line":20,"column":4},"end":{"line":20,"column":11}}, + "range":[339,346], + "name":"console", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":20,"column":12},"end":{"line":20,"column":15}}, + "range":[347,350], + "name":"log", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "typeArguments":null, + "arguments":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":20,"column":16},"end":{"line":20,"column":17}}, + "range":[351,352], + "value":2, + "raw":"2" + } + ] + }, + "directive":null + } + ] + } + }, + "finalizer":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":25,"column":0},"end":{"line":35,"column":1}}, + "range":[387,600], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":25,"column":9},"end":{"line":25,"column":27}}, + "range":[396,414], + "name":"leadingAndTrailing", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":25,"column":30},"end":{"line":35,"column":1}}, + "range":[417,600], + "body":[ + { + "type":"TryStatement", + "loc":{"source":null,"start":{"line":26,"column":2},"end":{"line":33,"column":3}}, + "range":[421,573], + "block":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":26,"column":6},"end":{"line":28,"column":3}}, + "range":[425,447], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":27,"column":4},"end":{"line":27,"column":16}}, + "range":[431,443], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":27,"column":10},"end":{"line":27,"column":15}}, + "range":[437,442], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":27,"column":10},"end":{"line":27,"column":11}}, + "range":[437,438], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":27,"column":14},"end":{"line":27,"column":15}}, + "range":[441,442], + "value":2, + "raw":"2" + } + } + ], + "kind":"const" + } + ] + }, + "handler":{ + "type":"CatchClause", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":8},"end":{"line":30,"column":26}}, + "range":[473,491], + "value":" 3.2 Trailing " + } + ], + "leadingComments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":29,"column":2},"end":{"line":29,"column":16}}, + "range":[450,464], + "value":" 3.1 Leading" + } + ], + "loc":{"source":null,"start":{"line":30,"column":2},"end":{"line":33,"column":3}}, + "range":[467,573], + "param":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":30,"column":28},"end":{"line":30,"column":30}}, + "range":[493,495], + "name":"e3", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":2},"end":{"line":34,"column":24}}, + "range":[576,598], + "value":" 3.5 Not Trailing " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":32},"end":{"line":30,"column":54}}, + "range":[497,519], + "value":" 3.3 Not trailing " + } + ], + "loc":{"source":null,"start":{"line":30,"column":56},"end":{"line":33,"column":3}}, + "range":[521,573], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":32,"column":4},"end":{"line":32,"column":19}}, + "range":[554,569], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":32,"column":4},"end":{"line":32,"column":18}}, + "range":[554,568], + "callee":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":32,"column":4},"end":{"line":32,"column":15}}, + "range":[554,565], + "object":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":4},"end":{"line":31,"column":26}}, + "range":[527,549], + "value":" 3.4 Not trailing " + } + ], + "loc":{"source":null,"start":{"line":32,"column":4},"end":{"line":32,"column":11}}, + "range":[554,561], + "name":"console", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":32,"column":12},"end":{"line":32,"column":15}}, + "range":[562,565], + "name":"log", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "typeArguments":null, + "arguments":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":32,"column":16},"end":{"line":32,"column":17}}, + "range":[566,567], + "value":3, + "raw":"3" + } + ] + }, + "directive":null + } + ] + } + }, + "finalizer":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":21}}, + "range":[27,46], + "value":" Not leading 1 " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":4},"end":{"line":6,"column":23}}, + "range":[91,110], + "value":" Not leading 2 " + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":8,"column":2},"end":{"line":8,"column":18}}, + "range":[117,133], + "value":" 1.1 Leading A" + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":2},"end":{"line":9,"column":21}}, + "range":[136,155], + "value":" 1.2 Leading B " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":10},"end":{"line":18,"column":28}}, + "range":[259,277], + "value":" 2.1 Trailing " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":34},"end":{"line":18,"column":56}}, + "range":[283,305], + "value":" 2.2 Not trailing " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":4},"end":{"line":19,"column":26}}, + "range":[312,334], + "value":" 2.3 Not trailing " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":2},"end":{"line":22,"column":24}}, + "range":[361,383], + "value":" 2.4 Not Trailing " + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":29,"column":2},"end":{"line":29,"column":16}}, + "range":[450,464], + "value":" 3.1 Leading" + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":8},"end":{"line":30,"column":26}}, + "range":[473,491], + "value":" 3.2 Trailing " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":32},"end":{"line":30,"column":54}}, + "range":[497,519], + "value":" 3.3 Not trailing " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":4},"end":{"line":31,"column":26}}, + "range":[527,549], + "value":" 3.4 Not trailing " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":2},"end":{"line":34,"column":24}}, + "range":[576,598], + "value":" 3.5 Not Trailing " + } + ] +} diff --git a/lib/test/flow/comment_interning/class_declaration.js b/lib/test/flow/comment_interning/class_declaration.js new file mode 100644 index 0000000..eff57b0 --- /dev/null +++ b/lib/test/flow/comment_interning/class_declaration.js @@ -0,0 +1,35 @@ +/* 1.1 L class */ class /* 1.2 L id */ C1 /* 1.3 L body */ {} /* 1.4 T body */ + +/* 2.1 L class */ class /* 2.2 L id */ C2 /* 2.3 L tparams */ /* 2.4 L body */ {} /* 2.5 T body */ + +/* 3.1 L class */ class /* 3.2 L id */ C3 /* 3.3 L implements */ implements /* 3.4 L id */ A /* 3.5 L targs */ /* 3.6 L body */ {} /* 3.7 T body */ + +/* 4.1 L class */ class /* 4.2 L id */ C4 /* 4.3 L extends */ extends /* 4.4 L id */ A /* 4.5 L targs */ /* 4.6 L body */ {} /* 4.7 T body */ + +export default /* 5.1 L class */ class /* 5.2 L body */ {} /* 5.3 T body */ + +export default class /* 6.1 L tparams */ /* 6.2 L body */ {} + +export default class /* 7.1 L extends */ extends /* 7.2 L id */ Super /* 7.3 L body */ {} + +export default class /* 8.1 L implements */ implements /* 8.2 L id */ Interface /* 8.3 L body */ {} + +{ + /* 9.1 L class */ class C {} /* 9.2 T body */ + /* 9.3 L class */ class C {} + /* 9.4 T body */ +} + +class C extends A /* 10.1 T id */ + /* 10.2 L targs */ /* 10.3 T targs */ + /* 10.4 L implements */ implements B /* 10.5 T id */ + /* 10.6 L targs */ /* 10.7 T targs */ + /* 10.8 L body */ {} + +class /* 11.1 L id */ C /* 11.2 T id */ + /* 11.3 L tparams */ /* 11.4 T tparams */ + /* 11.5 L extends */ extends A /* 11.6 T id */ + /* 11.7 L implements */ implements B /* 11.8 T id */ + /* 11.9 L body */ {} /* 11.10 T body */ + +class C /* 12.1 L tparams */ /* 12.2 L extends */ extends A /* 12.3 L implements */ implements B /* 12.4 L body */ {} diff --git a/lib/test/flow/comment_interning/class_declaration.options.json b/lib/test/flow/comment_interning/class_declaration.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/class_declaration.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/class_declaration.tree.json b/lib/test/flow/comment_interning/class_declaration.tree.json new file mode 100644 index 0000000..03d1059 --- /dev/null +++ b/lib/test/flow/comment_interning/class_declaration.tree.json @@ -0,0 +1,1420 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":11,"column":20}}, + "message":"Duplicate export for `default`" + }, + { + "loc":{"source":null,"start":{"line":13,"column":0},"end":{"line":13,"column":20}}, + "message":"Duplicate export for `default`" + }, + { + "loc":{"source":null,"start":{"line":15,"column":0},"end":{"line":15,"column":20}}, + "message":"Duplicate export for `default`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":35,"column":121}}, + "range":[18,1479], + "body":[ + { + "type":"ClassDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "value":" 1.1 L class " + } + ], + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":61}}, + "range":[18,61], + "id":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":38}}, + "range":[24,38], + "value":" 1.2 L id " + } + ], + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":41}}, + "range":[39,41], + "name":"C1", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":62},"end":{"line":1,"column":78}}, + "range":[62,78], + "value":" 1.4 T body " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":42},"end":{"line":1,"column":58}}, + "range":[42,58], + "value":" 1.3 L body " + } + ], + "loc":{"source":null,"start":{"line":1,"column":59},"end":{"line":1,"column":61}}, + "range":[59,61], + "body":[] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + { + "type":"ClassDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":17}}, + "range":[80,97], + "value":" 2.1 L class " + } + ], + "loc":{"source":null,"start":{"line":3,"column":18},"end":{"line":3,"column":85}}, + "range":[98,165], + "id":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":24},"end":{"line":3,"column":38}}, + "range":[104,118], + "value":" 2.2 L id " + } + ], + "loc":{"source":null,"start":{"line":3,"column":39},"end":{"line":3,"column":41}}, + "range":[119,121], + "name":"C2", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":86},"end":{"line":3,"column":102}}, + "range":[166,182], + "value":" 2.5 T body " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":66},"end":{"line":3,"column":82}}, + "range":[146,162], + "value":" 2.4 L body " + } + ], + "loc":{"source":null,"start":{"line":3,"column":83},"end":{"line":3,"column":85}}, + "range":[163,165], + "body":[] + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":42},"end":{"line":3,"column":61}}, + "range":[122,141], + "value":" 2.3 L tparams " + } + ], + "loc":{"source":null,"start":{"line":3,"column":62},"end":{"line":3,"column":65}}, + "range":[142,145], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":3,"column":63},"end":{"line":3,"column":64}}, + "range":[143,144], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + { + "type":"ClassDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":17}}, + "range":[184,201], + "value":" 3.1 L class " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":42},"end":{"line":5,"column":64}}, + "range":[226,248], + "value":" 3.3 L implements " + } + ], + "loc":{"source":null,"start":{"line":5,"column":18},"end":{"line":5,"column":134}}, + "range":[202,318], + "id":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":24},"end":{"line":5,"column":38}}, + "range":[208,222], + "value":" 3.2 L id " + } + ], + "loc":{"source":null,"start":{"line":5,"column":39},"end":{"line":5,"column":41}}, + "range":[223,225], + "name":"C3", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":135},"end":{"line":5,"column":151}}, + "range":[319,335], + "value":" 3.7 T body " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":115},"end":{"line":5,"column":131}}, + "range":[299,315], + "value":" 3.6 L body " + } + ], + "loc":{"source":null,"start":{"line":5,"column":132},"end":{"line":5,"column":134}}, + "range":[316,318], + "body":[] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[ + { + "type":"ClassImplements", + "loc":{"source":null,"start":{"line":5,"column":91},"end":{"line":5,"column":114}}, + "range":[275,298], + "id":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":76},"end":{"line":5,"column":90}}, + "range":[260,274], + "value":" 3.4 L id " + } + ], + "loc":{"source":null,"start":{"line":5,"column":91},"end":{"line":5,"column":92}}, + "range":[275,276], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":93},"end":{"line":5,"column":110}}, + "range":[277,294], + "value":" 3.5 L targs " + } + ], + "loc":{"source":null,"start":{"line":5,"column":111},"end":{"line":5,"column":114}}, + "range":[295,298], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":112},"end":{"line":5,"column":113}}, + "range":[296,297], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":112},"end":{"line":5,"column":113}}, + "range":[296,297], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + } + ], + "decorators":[] + }, + { + "type":"ClassDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":17}}, + "range":[337,354], + "value":" 4.1 L class " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":42},"end":{"line":7,"column":61}}, + "range":[379,398], + "value":" 4.3 L extends " + } + ], + "loc":{"source":null,"start":{"line":7,"column":18},"end":{"line":7,"column":128}}, + "range":[355,465], + "id":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":24},"end":{"line":7,"column":38}}, + "range":[361,375], + "value":" 4.2 L id " + } + ], + "loc":{"source":null,"start":{"line":7,"column":39},"end":{"line":7,"column":41}}, + "range":[376,378], + "name":"C4", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":129},"end":{"line":7,"column":145}}, + "range":[466,482], + "value":" 4.7 T body " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":109},"end":{"line":7,"column":125}}, + "range":[446,462], + "value":" 4.6 L body " + } + ], + "loc":{"source":null,"start":{"line":7,"column":126},"end":{"line":7,"column":128}}, + "range":[463,465], + "body":[] + }, + "typeParameters":null, + "superClass":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":70},"end":{"line":7,"column":84}}, + "range":[407,421], + "value":" 4.4 L id " + } + ], + "loc":{"source":null,"start":{"line":7,"column":85},"end":{"line":7,"column":86}}, + "range":[422,423], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "superTypeParameters":{ + "type":"TypeParameterInstantiation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":87},"end":{"line":7,"column":104}}, + "range":[424,441], + "value":" 4.5 L targs " + } + ], + "loc":{"source":null,"start":{"line":7,"column":105},"end":{"line":7,"column":108}}, + "range":[442,445], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":106},"end":{"line":7,"column":107}}, + "range":[443,444], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":106},"end":{"line":7,"column":107}}, + "range":[443,444], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + }, + "implements":[], + "decorators":[] + }, + { + "type":"ExportDefaultDeclaration", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":9,"column":58}}, + "range":[484,542], + "declaration":{ + "type":"ClassDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":15},"end":{"line":9,"column":32}}, + "range":[499,516], + "value":" 5.1 L class " + } + ], + "loc":{"source":null,"start":{"line":9,"column":33},"end":{"line":9,"column":58}}, + "range":[517,542], + "id":null, + "body":{ + "type":"ClassBody", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":59},"end":{"line":9,"column":75}}, + "range":[543,559], + "value":" 5.3 T body " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":39},"end":{"line":9,"column":55}}, + "range":[523,539], + "value":" 5.2 L body " + } + ], + "loc":{"source":null,"start":{"line":9,"column":56},"end":{"line":9,"column":58}}, + "range":[540,542], + "body":[] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + "exportKind":"value" + }, + { + "type":"ExportDefaultDeclaration", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":11,"column":64}}, + "range":[561,625], + "declaration":{ + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":11,"column":15},"end":{"line":11,"column":64}}, + "range":[576,625], + "id":null, + "body":{ + "type":"ClassBody", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":45},"end":{"line":11,"column":61}}, + "range":[606,622], + "value":" 6.2 L body " + } + ], + "loc":{"source":null,"start":{"line":11,"column":62},"end":{"line":11,"column":64}}, + "range":[623,625], + "body":[] + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":21},"end":{"line":11,"column":40}}, + "range":[582,601], + "value":" 6.1 L tparams " + } + ], + "loc":{"source":null,"start":{"line":11,"column":41},"end":{"line":11,"column":44}}, + "range":[602,605], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":11,"column":42},"end":{"line":11,"column":43}}, + "range":[603,604], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + "exportKind":"value" + }, + { + "type":"ExportDefaultDeclaration", + "loc":{"source":null,"start":{"line":13,"column":0},"end":{"line":13,"column":89}}, + "range":[627,716], + "declaration":{ + "type":"ClassDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":21},"end":{"line":13,"column":40}}, + "range":[648,667], + "value":" 7.1 L extends " + } + ], + "loc":{"source":null,"start":{"line":13,"column":15},"end":{"line":13,"column":89}}, + "range":[642,716], + "id":null, + "body":{ + "type":"ClassBody", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":70},"end":{"line":13,"column":86}}, + "range":[697,713], + "value":" 7.3 L body " + } + ], + "loc":{"source":null,"start":{"line":13,"column":87},"end":{"line":13,"column":89}}, + "range":[714,716], + "body":[] + }, + "typeParameters":null, + "superClass":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":49},"end":{"line":13,"column":63}}, + "range":[676,690], + "value":" 7.2 L id " + } + ], + "loc":{"source":null,"start":{"line":13,"column":64},"end":{"line":13,"column":69}}, + "range":[691,696], + "name":"Super", + "typeAnnotation":null, + "optional":false + }, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + "exportKind":"value" + }, + { + "type":"ExportDefaultDeclaration", + "loc":{"source":null,"start":{"line":15,"column":0},"end":{"line":15,"column":99}}, + "range":[718,817], + "declaration":{ + "type":"ClassDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":21},"end":{"line":15,"column":43}}, + "range":[739,761], + "value":" 8.1 L implements " + } + ], + "loc":{"source":null,"start":{"line":15,"column":15},"end":{"line":15,"column":99}}, + "range":[733,817], + "id":null, + "body":{ + "type":"ClassBody", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":80},"end":{"line":15,"column":96}}, + "range":[798,814], + "value":" 8.3 L body " + } + ], + "loc":{"source":null,"start":{"line":15,"column":97},"end":{"line":15,"column":99}}, + "range":[815,817], + "body":[] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[ + { + "type":"ClassImplements", + "loc":{"source":null,"start":{"line":15,"column":70},"end":{"line":15,"column":79}}, + "range":[788,797], + "id":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":55},"end":{"line":15,"column":69}}, + "range":[773,787], + "value":" 8.2 L id " + } + ], + "loc":{"source":null,"start":{"line":15,"column":70},"end":{"line":15,"column":79}}, + "range":[788,797], + "name":"Interface", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ], + "decorators":[] + }, + "exportKind":"value" + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":17,"column":0},"end":{"line":21,"column":1}}, + "range":[819,920], + "body":[ + { + "type":"ClassDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":18,"column":19}}, + "range":[823,840], + "value":" 9.1 L class " + } + ], + "loc":{"source":null,"start":{"line":18,"column":20},"end":{"line":18,"column":30}}, + "range":[841,851], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":18,"column":26},"end":{"line":18,"column":27}}, + "range":[847,848], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":31},"end":{"line":18,"column":47}}, + "range":[852,868], + "value":" 9.2 T body " + } + ], + "loc":{"source":null,"start":{"line":18,"column":28},"end":{"line":18,"column":30}}, + "range":[849,851], + "body":[] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + { + "type":"ClassDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":2},"end":{"line":19,"column":19}}, + "range":[871,888], + "value":" 9.3 L class " + } + ], + "loc":{"source":null,"start":{"line":19,"column":20},"end":{"line":19,"column":30}}, + "range":[889,899], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":19,"column":26},"end":{"line":19,"column":27}}, + "range":[895,896], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":2},"end":{"line":20,"column":18}}, + "range":[902,918], + "value":" 9.4 T body " + } + ], + "loc":{"source":null,"start":{"line":19,"column":28},"end":{"line":19,"column":30}}, + "range":[897,899], + "body":[] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ] + }, + { + "type":"ClassDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":2},"end":{"line":25,"column":25}}, + "range":[1002,1025], + "value":" 10.4 L implements " + } + ], + "loc":{"source":null,"start":{"line":23,"column":0},"end":{"line":27,"column":22}}, + "range":[922,1121], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":23,"column":6},"end":{"line":23,"column":7}}, + "range":[928,929], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":27,"column":2},"end":{"line":27,"column":19}}, + "range":[1101,1118], + "value":" 10.8 L body " + } + ], + "loc":{"source":null,"start":{"line":27,"column":20},"end":{"line":27,"column":22}}, + "range":[1119,1121], + "body":[] + }, + "typeParameters":null, + "superClass":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":18},"end":{"line":23,"column":33}}, + "range":[940,955], + "value":" 10.1 T id " + } + ], + "loc":{"source":null,"start":{"line":23,"column":16},"end":{"line":23,"column":17}}, + "range":[938,939], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "superTypeParameters":{ + "type":"TypeParameterInstantiation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":25},"end":{"line":24,"column":43}}, + "range":[981,999], + "value":" 10.3 T targs " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":2},"end":{"line":24,"column":20}}, + "range":[958,976], + "value":" 10.2 L targs " + } + ], + "loc":{"source":null,"start":{"line":24,"column":21},"end":{"line":24,"column":24}}, + "range":[977,980], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":24,"column":22},"end":{"line":24,"column":23}}, + "range":[978,979], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":24,"column":22},"end":{"line":24,"column":23}}, + "range":[978,979], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + }, + "implements":[ + { + "type":"ClassImplements", + "loc":{"source":null,"start":{"line":25,"column":37},"end":{"line":26,"column":24}}, + "range":[1037,1079], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":39},"end":{"line":25,"column":54}}, + "range":[1039,1054], + "value":" 10.5 T id " + } + ], + "loc":{"source":null,"start":{"line":25,"column":37},"end":{"line":25,"column":38}}, + "range":[1037,1038], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":25},"end":{"line":26,"column":43}}, + "range":[1080,1098], + "value":" 10.7 T targs " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":2},"end":{"line":26,"column":20}}, + "range":[1057,1075], + "value":" 10.6 L targs " + } + ], + "loc":{"source":null,"start":{"line":26,"column":21},"end":{"line":26,"column":24}}, + "range":[1076,1079], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":26,"column":22},"end":{"line":26,"column":23}}, + "range":[1077,1078], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":26,"column":22},"end":{"line":26,"column":23}}, + "range":[1077,1078], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + } + ], + "decorators":[] + }, + { + "type":"ClassDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":2},"end":{"line":31,"column":22}}, + "range":[1213,1233], + "value":" 11.5 L extends " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":2},"end":{"line":32,"column":25}}, + "range":[1262,1285], + "value":" 11.7 L implements " + } + ], + "loc":{"source":null,"start":{"line":29,"column":0},"end":{"line":33,"column":22}}, + "range":[1123,1337], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":24},"end":{"line":29,"column":39}}, + "range":[1147,1162], + "value":" 11.2 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":6},"end":{"line":29,"column":21}}, + "range":[1129,1144], + "value":" 11.1 L id " + } + ], + "loc":{"source":null,"start":{"line":29,"column":22},"end":{"line":29,"column":23}}, + "range":[1145,1146], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":33,"column":23},"end":{"line":33,"column":41}}, + "range":[1338,1356], + "value":" 11.10 T body " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":33,"column":2},"end":{"line":33,"column":19}}, + "range":[1317,1334], + "value":" 11.9 L body " + } + ], + "loc":{"source":null,"start":{"line":33,"column":20},"end":{"line":33,"column":22}}, + "range":[1335,1337], + "body":[] + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":27},"end":{"line":30,"column":47}}, + "range":[1190,1210], + "value":" 11.4 T tparams " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":2},"end":{"line":30,"column":22}}, + "range":[1165,1185], + "value":" 11.3 L tparams " + } + ], + "loc":{"source":null,"start":{"line":30,"column":23},"end":{"line":30,"column":26}}, + "range":[1186,1189], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":30,"column":24},"end":{"line":30,"column":25}}, + "range":[1187,1188], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "superClass":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":33},"end":{"line":31,"column":48}}, + "range":[1244,1259], + "value":" 11.6 T id " + } + ], + "loc":{"source":null,"start":{"line":31,"column":31},"end":{"line":31,"column":32}}, + "range":[1242,1243], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "superTypeParameters":null, + "implements":[ + { + "type":"ClassImplements", + "loc":{"source":null,"start":{"line":32,"column":37},"end":{"line":32,"column":38}}, + "range":[1297,1298], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":39},"end":{"line":32,"column":54}}, + "range":[1299,1314], + "value":" 11.8 T id " + } + ], + "loc":{"source":null,"start":{"line":32,"column":37},"end":{"line":32,"column":38}}, + "range":[1297,1298], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ], + "decorators":[] + }, + { + "type":"ClassDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":33},"end":{"line":35,"column":53}}, + "range":[1391,1411], + "value":" 12.2 L extends " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":64},"end":{"line":35,"column":87}}, + "range":[1422,1445], + "value":" 12.3 L implements " + } + ], + "loc":{"source":null,"start":{"line":35,"column":0},"end":{"line":35,"column":121}}, + "range":[1358,1479], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":35,"column":6},"end":{"line":35,"column":7}}, + "range":[1364,1365], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":101},"end":{"line":35,"column":118}}, + "range":[1459,1476], + "value":" 12.4 L body " + } + ], + "loc":{"source":null,"start":{"line":35,"column":119},"end":{"line":35,"column":121}}, + "range":[1477,1479], + "body":[] + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":8},"end":{"line":35,"column":28}}, + "range":[1366,1386], + "value":" 12.1 L tparams " + } + ], + "loc":{"source":null,"start":{"line":35,"column":29},"end":{"line":35,"column":32}}, + "range":[1387,1390], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":35,"column":30},"end":{"line":35,"column":31}}, + "range":[1388,1389], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "superClass":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":35,"column":62},"end":{"line":35,"column":63}}, + "range":[1420,1421], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "superTypeParameters":null, + "implements":[ + { + "type":"ClassImplements", + "loc":{"source":null,"start":{"line":35,"column":99},"end":{"line":35,"column":100}}, + "range":[1457,1458], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":35,"column":99},"end":{"line":35,"column":100}}, + "range":[1457,1458], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ], + "decorators":[] + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "value":" 1.1 L class " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":38}}, + "range":[24,38], + "value":" 1.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":42},"end":{"line":1,"column":58}}, + "range":[42,58], + "value":" 1.3 L body " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":62},"end":{"line":1,"column":78}}, + "range":[62,78], + "value":" 1.4 T body " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":17}}, + "range":[80,97], + "value":" 2.1 L class " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":24},"end":{"line":3,"column":38}}, + "range":[104,118], + "value":" 2.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":42},"end":{"line":3,"column":61}}, + "range":[122,141], + "value":" 2.3 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":66},"end":{"line":3,"column":82}}, + "range":[146,162], + "value":" 2.4 L body " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":86},"end":{"line":3,"column":102}}, + "range":[166,182], + "value":" 2.5 T body " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":17}}, + "range":[184,201], + "value":" 3.1 L class " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":24},"end":{"line":5,"column":38}}, + "range":[208,222], + "value":" 3.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":42},"end":{"line":5,"column":64}}, + "range":[226,248], + "value":" 3.3 L implements " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":76},"end":{"line":5,"column":90}}, + "range":[260,274], + "value":" 3.4 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":93},"end":{"line":5,"column":110}}, + "range":[277,294], + "value":" 3.5 L targs " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":115},"end":{"line":5,"column":131}}, + "range":[299,315], + "value":" 3.6 L body " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":135},"end":{"line":5,"column":151}}, + "range":[319,335], + "value":" 3.7 T body " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":17}}, + "range":[337,354], + "value":" 4.1 L class " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":24},"end":{"line":7,"column":38}}, + "range":[361,375], + "value":" 4.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":42},"end":{"line":7,"column":61}}, + "range":[379,398], + "value":" 4.3 L extends " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":70},"end":{"line":7,"column":84}}, + "range":[407,421], + "value":" 4.4 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":87},"end":{"line":7,"column":104}}, + "range":[424,441], + "value":" 4.5 L targs " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":109},"end":{"line":7,"column":125}}, + "range":[446,462], + "value":" 4.6 L body " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":129},"end":{"line":7,"column":145}}, + "range":[466,482], + "value":" 4.7 T body " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":15},"end":{"line":9,"column":32}}, + "range":[499,516], + "value":" 5.1 L class " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":39},"end":{"line":9,"column":55}}, + "range":[523,539], + "value":" 5.2 L body " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":59},"end":{"line":9,"column":75}}, + "range":[543,559], + "value":" 5.3 T body " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":21},"end":{"line":11,"column":40}}, + "range":[582,601], + "value":" 6.1 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":45},"end":{"line":11,"column":61}}, + "range":[606,622], + "value":" 6.2 L body " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":21},"end":{"line":13,"column":40}}, + "range":[648,667], + "value":" 7.1 L extends " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":49},"end":{"line":13,"column":63}}, + "range":[676,690], + "value":" 7.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":70},"end":{"line":13,"column":86}}, + "range":[697,713], + "value":" 7.3 L body " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":21},"end":{"line":15,"column":43}}, + "range":[739,761], + "value":" 8.1 L implements " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":55},"end":{"line":15,"column":69}}, + "range":[773,787], + "value":" 8.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":80},"end":{"line":15,"column":96}}, + "range":[798,814], + "value":" 8.3 L body " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":18,"column":19}}, + "range":[823,840], + "value":" 9.1 L class " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":31},"end":{"line":18,"column":47}}, + "range":[852,868], + "value":" 9.2 T body " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":2},"end":{"line":19,"column":19}}, + "range":[871,888], + "value":" 9.3 L class " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":2},"end":{"line":20,"column":18}}, + "range":[902,918], + "value":" 9.4 T body " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":18},"end":{"line":23,"column":33}}, + "range":[940,955], + "value":" 10.1 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":2},"end":{"line":24,"column":20}}, + "range":[958,976], + "value":" 10.2 L targs " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":25},"end":{"line":24,"column":43}}, + "range":[981,999], + "value":" 10.3 T targs " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":2},"end":{"line":25,"column":25}}, + "range":[1002,1025], + "value":" 10.4 L implements " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":39},"end":{"line":25,"column":54}}, + "range":[1039,1054], + "value":" 10.5 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":2},"end":{"line":26,"column":20}}, + "range":[1057,1075], + "value":" 10.6 L targs " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":25},"end":{"line":26,"column":43}}, + "range":[1080,1098], + "value":" 10.7 T targs " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":27,"column":2},"end":{"line":27,"column":19}}, + "range":[1101,1118], + "value":" 10.8 L body " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":6},"end":{"line":29,"column":21}}, + "range":[1129,1144], + "value":" 11.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":24},"end":{"line":29,"column":39}}, + "range":[1147,1162], + "value":" 11.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":2},"end":{"line":30,"column":22}}, + "range":[1165,1185], + "value":" 11.3 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":27},"end":{"line":30,"column":47}}, + "range":[1190,1210], + "value":" 11.4 T tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":2},"end":{"line":31,"column":22}}, + "range":[1213,1233], + "value":" 11.5 L extends " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":33},"end":{"line":31,"column":48}}, + "range":[1244,1259], + "value":" 11.6 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":2},"end":{"line":32,"column":25}}, + "range":[1262,1285], + "value":" 11.7 L implements " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":39},"end":{"line":32,"column":54}}, + "range":[1299,1314], + "value":" 11.8 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":33,"column":2},"end":{"line":33,"column":19}}, + "range":[1317,1334], + "value":" 11.9 L body " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":33,"column":23},"end":{"line":33,"column":41}}, + "range":[1338,1356], + "value":" 11.10 T body " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":8},"end":{"line":35,"column":28}}, + "range":[1366,1386], + "value":" 12.1 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":33},"end":{"line":35,"column":53}}, + "range":[1391,1411], + "value":" 12.2 L extends " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":64},"end":{"line":35,"column":87}}, + "range":[1422,1445], + "value":" 12.3 L implements " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":101},"end":{"line":35,"column":118}}, + "range":[1459,1476], + "value":" 12.4 L body " + } + ] +} diff --git a/lib/test/flow/comment_interning/class_expression.js b/lib/test/flow/comment_interning/class_expression.js new file mode 100644 index 0000000..6982c30 --- /dev/null +++ b/lib/test/flow/comment_interning/class_expression.js @@ -0,0 +1,5 @@ +/* @flow */ + +(/* 0.1 L class */ class /* 0.2 L id */ ClassName /* 0.3 L tparams */ /* 0.4 L body */ {} /* 0.5 T body */); /* 0.6 T expr stmt */ + +(/* 1.1 L class */ class /* 1.2 L tparams */ /* 1.3 L body */ {} /* 1.4 T body */); /* 1.5 T expr stmt */ diff --git a/lib/test/flow/comment_interning/class_expression.options.json b/lib/test/flow/comment_interning/class_expression.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/class_expression.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/class_expression.tree.json b/lib/test/flow/comment_interning/class_expression.tree.json new file mode 100644 index 0000000..0c34bba --- /dev/null +++ b/lib/test/flow/comment_interning/class_expression.tree.json @@ -0,0 +1,260 @@ +{ + "type":"Program", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "value":" @flow " + } + ], + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":5,"column":87}}, + "range":[13,236], + "body":[ + { + "type":"ExpressionStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":113},"end":{"line":3,"column":134}}, + "range":[126,147], + "value":" 0.6 T expr stmt " + } + ], + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":112}}, + "range":[13,125], + "expression":{ + "type":"ClassExpression", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":1},"end":{"line":3,"column":18}}, + "range":[14,31], + "value":" 0.1 L class " + } + ], + "loc":{"source":null,"start":{"line":3,"column":19},"end":{"line":3,"column":93}}, + "range":[32,106], + "id":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":25},"end":{"line":3,"column":39}}, + "range":[38,52], + "value":" 0.2 L id " + } + ], + "loc":{"source":null,"start":{"line":3,"column":40},"end":{"line":3,"column":49}}, + "range":[53,62], + "name":"ClassName", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":94},"end":{"line":3,"column":110}}, + "range":[107,123], + "value":" 0.5 T body " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":74},"end":{"line":3,"column":90}}, + "range":[87,103], + "value":" 0.4 L body " + } + ], + "loc":{"source":null,"start":{"line":3,"column":91},"end":{"line":3,"column":93}}, + "range":[104,106], + "body":[] + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":50},"end":{"line":3,"column":69}}, + "range":[63,82], + "value":" 0.3 L tparams " + } + ], + "loc":{"source":null,"start":{"line":3,"column":70},"end":{"line":3,"column":73}}, + "range":[83,86], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":3,"column":71},"end":{"line":3,"column":72}}, + "range":[84,85], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":88},"end":{"line":5,"column":109}}, + "range":[237,258], + "value":" 1.5 T expr stmt " + } + ], + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":87}}, + "range":[149,236], + "expression":{ + "type":"ClassExpression", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":1},"end":{"line":5,"column":18}}, + "range":[150,167], + "value":" 1.1 L class " + } + ], + "loc":{"source":null,"start":{"line":5,"column":19},"end":{"line":5,"column":68}}, + "range":[168,217], + "id":null, + "body":{ + "type":"ClassBody", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":69},"end":{"line":5,"column":85}}, + "range":[218,234], + "value":" 1.4 T body " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":49},"end":{"line":5,"column":65}}, + "range":[198,214], + "value":" 1.3 L body " + } + ], + "loc":{"source":null,"start":{"line":5,"column":66},"end":{"line":5,"column":68}}, + "range":[215,217], + "body":[] + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":25},"end":{"line":5,"column":44}}, + "range":[174,193], + "value":" 1.2 L tparams " + } + ], + "loc":{"source":null,"start":{"line":5,"column":45},"end":{"line":5,"column":48}}, + "range":[194,197], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":5,"column":46},"end":{"line":5,"column":47}}, + "range":[195,196], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + "directive":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "value":" @flow " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":1},"end":{"line":3,"column":18}}, + "range":[14,31], + "value":" 0.1 L class " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":25},"end":{"line":3,"column":39}}, + "range":[38,52], + "value":" 0.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":50},"end":{"line":3,"column":69}}, + "range":[63,82], + "value":" 0.3 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":74},"end":{"line":3,"column":90}}, + "range":[87,103], + "value":" 0.4 L body " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":94},"end":{"line":3,"column":110}}, + "range":[107,123], + "value":" 0.5 T body " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":113},"end":{"line":3,"column":134}}, + "range":[126,147], + "value":" 0.6 T expr stmt " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":1},"end":{"line":5,"column":18}}, + "range":[150,167], + "value":" 1.1 L class " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":25},"end":{"line":5,"column":44}}, + "range":[174,193], + "value":" 1.2 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":49},"end":{"line":5,"column":65}}, + "range":[198,214], + "value":" 1.3 L body " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":69},"end":{"line":5,"column":85}}, + "range":[218,234], + "value":" 1.4 T body " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":88},"end":{"line":5,"column":109}}, + "range":[237,258], + "value":" 1.5 T expr stmt " + } + ] +} diff --git a/lib/test/flow/comment_interning/class_method.js b/lib/test/flow/comment_interning/class_method.js new file mode 100644 index 0000000..eb110ab --- /dev/null +++ b/lib/test/flow/comment_interning/class_method.js @@ -0,0 +1,42 @@ +class C { + /* 1.1 L id */ method /* 1.2 L tparams */ /* 1.3 L params */ () /* 1.4 L block */ {} /* 1.5 T block */ + + /* 2.1 L meth */ static /* 2.2 L meth */ async /* 2.3 L meth */ * /* 2.4 L id */ method(){} + + /* 3.1 L meth */ get /* 3.2 L id */ getter /* 3.3 L params */ () /* 3.4 L block */ {} /* 3.5 T block */ + /* 4.1 L meth */ set /* 4.2 L id */ setter /* 4.3 L params */ (x) /* 4.4 L block */ {} /* 4.5 T block */ + + /* 5.1 L meth */ static /* 5.2 L meth */ get /* 5.3 L id */ getter() {} + /* 6.1 L meth */ static /* 6.2 L meth */ set /* 6.3 L id */ setter(x) {} +} + +class C { method(){} /* 7.1 L id */ method(){} /* 7.2 T block */ } + +class C { + /* 8.1 L id */ method(){} /* 8.2 T block */ + /* 8.3 L id */ method(){} /* 8.4 T block */ + /* 8.5 T block */ +} + +class C { + method /* 9.1 L tparams */ /* 9.2 L params */ () /* 9.3 T params */ : /* 9.4 L any */ any /* 9.5 L block */ {} + + method /* 10.1 L tparams */ /* 10.2 T tparams */ + /* 10.3 L params */ () /* 10.4 T params */ + : /* 10.5 L any */ any /* 10.6 T any */ + /* 10.7 L block */ {} + + method /* 11.1 L params */ () /* 11.2 T params */ + /* 11.3 L block */ {} + + get getter /* 12.1 L params */ () /* 12.2 T params */ : /* 12.3 L any */ any /* 12.4 L block */ {} + + get getter /* 13.1 T id */ + /* 13.2 L params */ () /* 13.3 T params */ + : /* 13.4 L any */ any /* 13.5 T any */ + /* 13.6 L block */ {} + + get getter /* 14.1 T id */ + /* 14.2 L params */ () /* 14.3 T params */ + /* 14.4 L block */ {} +} diff --git a/lib/test/flow/comment_interning/class_method.options.json b/lib/test/flow/comment_interning/class_method.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/class_method.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/class_method.tree.json b/lib/test/flow/comment_interning/class_method.tree.json new file mode 100644 index 0000000..3c063d1 --- /dev/null +++ b/lib/test/flow/comment_interning/class_method.tree.json @@ -0,0 +1,1628 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":42,"column":1}}, + "range":[0,1506], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":11,"column":1}}, + "range":[0,579], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":11,"column":1}}, + "range":[8,579], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":90}}, + "range":[27,100], + "key":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "range":[12,26], + "value":" 1.1 L id " + } + ], + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":23}}, + "range":[27,33], + "name":"method", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":48},"end":{"line":2,"column":66}}, + "range":[58,76], + "value":" 1.3 L params " + } + ], + "loc":{"source":null,"start":{"line":2,"column":44},"end":{"line":2,"column":90}}, + "range":[54,100], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":91},"end":{"line":2,"column":108}}, + "range":[101,118], + "value":" 1.5 T block " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":70},"end":{"line":2,"column":87}}, + "range":[80,97], + "value":" 1.4 L block " + } + ], + "loc":{"source":null,"start":{"line":2,"column":88},"end":{"line":2,"column":90}}, + "range":[98,100], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":24},"end":{"line":2,"column":43}}, + "range":[34,53], + "value":" 1.2 L tparams " + } + ], + "loc":{"source":null,"start":{"line":2,"column":44},"end":{"line":2,"column":47}}, + "range":[54,57], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":2,"column":45},"end":{"line":2,"column":46}}, + "range":[55,56], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + }, + { + "type":"MethodDefinition", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":18}}, + "range":[122,138], + "value":" 2.1 L meth " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":26},"end":{"line":4,"column":42}}, + "range":[146,162], + "value":" 2.2 L meth " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":49},"end":{"line":4,"column":65}}, + "range":[169,185], + "value":" 2.3 L meth " + } + ], + "loc":{"source":null,"start":{"line":4,"column":19},"end":{"line":4,"column":93}}, + "range":[139,213], + "key":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":68},"end":{"line":4,"column":82}}, + "range":[188,202], + "value":" 2.4 L id " + } + ], + "loc":{"source":null,"start":{"line":4,"column":83},"end":{"line":4,"column":89}}, + "range":[203,209], + "name":"method", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":4,"column":89},"end":{"line":4,"column":93}}, + "range":[209,213], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":4,"column":91},"end":{"line":4,"column":93}}, + "range":[211,213], + "body":[] + }, + "async":true, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":true, + "computed":false, + "decorators":[] + }, + { + "type":"MethodDefinition", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":18}}, + "range":[217,233], + "value":" 3.1 L meth " + } + ], + "loc":{"source":null,"start":{"line":6,"column":19},"end":{"line":6,"column":87}}, + "range":[234,302], + "key":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":23},"end":{"line":6,"column":37}}, + "range":[238,252], + "value":" 3.2 L id " + } + ], + "loc":{"source":null,"start":{"line":6,"column":38},"end":{"line":6,"column":44}}, + "range":[253,259], + "name":"getter", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":45},"end":{"line":6,"column":63}}, + "range":[260,278], + "value":" 3.3 L params " + } + ], + "loc":{"source":null,"start":{"line":6,"column":64},"end":{"line":6,"column":87}}, + "range":[279,302], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":88},"end":{"line":6,"column":105}}, + "range":[303,320], + "value":" 3.5 T block " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":67},"end":{"line":6,"column":84}}, + "range":[282,299], + "value":" 3.4 L block " + } + ], + "loc":{"source":null,"start":{"line":6,"column":85},"end":{"line":6,"column":87}}, + "range":[300,302], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"get", + "static":false, + "computed":false, + "decorators":[] + }, + { + "type":"MethodDefinition", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":2},"end":{"line":7,"column":18}}, + "range":[323,339], + "value":" 4.1 L meth " + } + ], + "loc":{"source":null,"start":{"line":7,"column":19},"end":{"line":7,"column":88}}, + "range":[340,409], + "key":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":23},"end":{"line":7,"column":37}}, + "range":[344,358], + "value":" 4.2 L id " + } + ], + "loc":{"source":null,"start":{"line":7,"column":38},"end":{"line":7,"column":44}}, + "range":[359,365], + "name":"setter", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":45},"end":{"line":7,"column":63}}, + "range":[366,384], + "value":" 4.3 L params " + } + ], + "loc":{"source":null,"start":{"line":7,"column":64},"end":{"line":7,"column":88}}, + "range":[385,409], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":65},"end":{"line":7,"column":66}}, + "range":[386,387], + "name":"x", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":89},"end":{"line":7,"column":106}}, + "range":[410,427], + "value":" 4.5 T block " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":68},"end":{"line":7,"column":85}}, + "range":[389,406], + "value":" 4.4 L block " + } + ], + "loc":{"source":null,"start":{"line":7,"column":86},"end":{"line":7,"column":88}}, + "range":[407,409], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"set", + "static":false, + "computed":false, + "decorators":[] + }, + { + "type":"MethodDefinition", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":2},"end":{"line":9,"column":18}}, + "range":[431,447], + "value":" 5.1 L meth " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":26},"end":{"line":9,"column":42}}, + "range":[455,471], + "value":" 5.2 L meth " + } + ], + "loc":{"source":null,"start":{"line":9,"column":19},"end":{"line":9,"column":73}}, + "range":[448,502], + "key":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":47},"end":{"line":9,"column":61}}, + "range":[476,490], + "value":" 5.3 L id " + } + ], + "loc":{"source":null,"start":{"line":9,"column":62},"end":{"line":9,"column":68}}, + "range":[491,497], + "name":"getter", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":9,"column":68},"end":{"line":9,"column":73}}, + "range":[497,502], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":9,"column":71},"end":{"line":9,"column":73}}, + "range":[500,502], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"get", + "static":true, + "computed":false, + "decorators":[] + }, + { + "type":"MethodDefinition", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":2},"end":{"line":10,"column":18}}, + "range":[505,521], + "value":" 6.1 L meth " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":26},"end":{"line":10,"column":42}}, + "range":[529,545], + "value":" 6.2 L meth " + } + ], + "loc":{"source":null,"start":{"line":10,"column":19},"end":{"line":10,"column":74}}, + "range":[522,577], + "key":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":47},"end":{"line":10,"column":61}}, + "range":[550,564], + "value":" 6.3 L id " + } + ], + "loc":{"source":null,"start":{"line":10,"column":62},"end":{"line":10,"column":68}}, + "range":[565,571], + "name":"setter", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":10,"column":68},"end":{"line":10,"column":74}}, + "range":[571,577], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":10,"column":69},"end":{"line":10,"column":70}}, + "range":[572,573], + "name":"x", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":10,"column":72},"end":{"line":10,"column":74}}, + "range":[575,577], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"set", + "static":true, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":13,"column":0},"end":{"line":13,"column":66}}, + "range":[581,647], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":13,"column":6},"end":{"line":13,"column":7}}, + "range":[587,588], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":13,"column":8},"end":{"line":13,"column":66}}, + "range":[589,647], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":13,"column":10},"end":{"line":13,"column":20}}, + "range":[591,601], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":13,"column":10},"end":{"line":13,"column":16}}, + "range":[591,597], + "name":"method", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":13,"column":16},"end":{"line":13,"column":20}}, + "range":[597,601], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":13,"column":18},"end":{"line":13,"column":20}}, + "range":[599,601], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":13,"column":36},"end":{"line":13,"column":46}}, + "range":[617,627], + "key":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":21},"end":{"line":13,"column":35}}, + "range":[602,616], + "value":" 7.1 L id " + } + ], + "loc":{"source":null,"start":{"line":13,"column":36},"end":{"line":13,"column":42}}, + "range":[617,623], + "name":"method", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":13,"column":42},"end":{"line":13,"column":46}}, + "range":[623,627], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":47},"end":{"line":13,"column":64}}, + "range":[628,645], + "value":" 7.2 T block " + } + ], + "loc":{"source":null,"start":{"line":13,"column":44},"end":{"line":13,"column":46}}, + "range":[625,627], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":15,"column":0},"end":{"line":19,"column":1}}, + "range":[649,772], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":15,"column":6},"end":{"line":15,"column":7}}, + "range":[655,656], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":15,"column":8},"end":{"line":19,"column":1}}, + "range":[657,772], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":16,"column":17},"end":{"line":16,"column":27}}, + "range":[676,686], + "key":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":2},"end":{"line":16,"column":16}}, + "range":[661,675], + "value":" 8.1 L id " + } + ], + "loc":{"source":null,"start":{"line":16,"column":17},"end":{"line":16,"column":23}}, + "range":[676,682], + "name":"method", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":16,"column":23},"end":{"line":16,"column":27}}, + "range":[682,686], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":28},"end":{"line":16,"column":45}}, + "range":[687,704], + "value":" 8.2 T block " + } + ], + "loc":{"source":null,"start":{"line":16,"column":25},"end":{"line":16,"column":27}}, + "range":[684,686], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":17,"column":17},"end":{"line":17,"column":27}}, + "range":[722,732], + "key":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":2},"end":{"line":17,"column":16}}, + "range":[707,721], + "value":" 8.3 L id " + } + ], + "loc":{"source":null,"start":{"line":17,"column":17},"end":{"line":17,"column":23}}, + "range":[722,728], + "name":"method", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":17,"column":23},"end":{"line":17,"column":27}}, + "range":[728,732], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":28},"end":{"line":17,"column":45}}, + "range":[733,750], + "value":" 8.4 T block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":18,"column":19}}, + "range":[753,770], + "value":" 8.5 T block " + } + ], + "loc":{"source":null,"start":{"line":17,"column":25},"end":{"line":17,"column":27}}, + "range":[730,732], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":21,"column":0},"end":{"line":42,"column":1}}, + "range":[774,1506], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":21,"column":6},"end":{"line":21,"column":7}}, + "range":[780,781], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":21,"column":8},"end":{"line":42,"column":1}}, + "range":[782,1506], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":22,"column":2},"end":{"line":22,"column":116}}, + "range":[786,900], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":22,"column":2},"end":{"line":22,"column":8}}, + "range":[786,792], + "name":"method", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":55},"end":{"line":22,"column":73}}, + "range":[839,857], + "value":" 9.3 T params " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":33},"end":{"line":22,"column":51}}, + "range":[817,835], + "value":" 9.2 L params " + } + ], + "loc":{"source":null,"start":{"line":22,"column":29},"end":{"line":22,"column":116}}, + "range":[813,900], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":96},"end":{"line":22,"column":113}}, + "range":[880,897], + "value":" 9.5 L block " + } + ], + "loc":{"source":null,"start":{"line":22,"column":114},"end":{"line":22,"column":116}}, + "range":[898,900], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":22,"column":74},"end":{"line":22,"column":95}}, + "range":[858,879], + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":76},"end":{"line":22,"column":91}}, + "range":[860,875], + "value":" 9.4 L any " + } + ], + "loc":{"source":null,"start":{"line":22,"column":92},"end":{"line":22,"column":95}}, + "range":[876,879] + } + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":9},"end":{"line":22,"column":28}}, + "range":[793,812], + "value":" 9.1 L tparams " + } + ], + "loc":{"source":null,"start":{"line":22,"column":29},"end":{"line":22,"column":32}}, + "range":[813,816], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":22,"column":30},"end":{"line":22,"column":31}}, + "range":[814,815], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":24,"column":2},"end":{"line":27,"column":25}}, + "range":[904,1073], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":24,"column":2},"end":{"line":24,"column":8}}, + "range":[904,910], + "name":"method", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":27},"end":{"line":25,"column":46}}, + "range":[984,1003], + "value":" 10.4 T params " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":4},"end":{"line":25,"column":23}}, + "range":[961,980], + "value":" 10.3 L params " + } + ], + "loc":{"source":null,"start":{"line":24,"column":30},"end":{"line":27,"column":25}}, + "range":[932,1073], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":27,"column":4},"end":{"line":27,"column":22}}, + "range":[1052,1070], + "value":" 10.7 L block " + } + ], + "loc":{"source":null,"start":{"line":27,"column":23},"end":{"line":27,"column":25}}, + "range":[1071,1073], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":26,"column":4},"end":{"line":26,"column":26}}, + "range":[1008,1030], + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":27},"end":{"line":26,"column":43}}, + "range":[1031,1047], + "value":" 10.6 T any " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":6},"end":{"line":26,"column":22}}, + "range":[1010,1026], + "value":" 10.5 L any " + } + ], + "loc":{"source":null,"start":{"line":26,"column":23},"end":{"line":26,"column":26}}, + "range":[1027,1030] + } + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":34},"end":{"line":24,"column":54}}, + "range":[936,956], + "value":" 10.2 T tparams " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":9},"end":{"line":24,"column":29}}, + "range":[911,931], + "value":" 10.1 L tparams " + } + ], + "loc":{"source":null,"start":{"line":24,"column":30},"end":{"line":24,"column":33}}, + "range":[932,935], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":24,"column":31},"end":{"line":24,"column":32}}, + "range":[933,934], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":29,"column":2},"end":{"line":30,"column":25}}, + "range":[1077,1152], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":29,"column":2},"end":{"line":29,"column":8}}, + "range":[1077,1083], + "name":"method", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":32},"end":{"line":29,"column":51}}, + "range":[1107,1126], + "value":" 11.2 T params " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":9},"end":{"line":29,"column":28}}, + "range":[1084,1103], + "value":" 11.1 L params " + } + ], + "loc":{"source":null,"start":{"line":29,"column":29},"end":{"line":30,"column":25}}, + "range":[1104,1152], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":4},"end":{"line":30,"column":22}}, + "range":[1131,1149], + "value":" 11.3 L block " + } + ], + "loc":{"source":null,"start":{"line":30,"column":23},"end":{"line":30,"column":25}}, + "range":[1150,1152], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":32,"column":2},"end":{"line":32,"column":100}}, + "range":[1156,1254], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":32,"column":6},"end":{"line":32,"column":12}}, + "range":[1160,1166], + "name":"getter", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":36},"end":{"line":32,"column":55}}, + "range":[1190,1209], + "value":" 12.2 T params " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":13},"end":{"line":32,"column":32}}, + "range":[1167,1186], + "value":" 12.1 L params " + } + ], + "loc":{"source":null,"start":{"line":32,"column":33},"end":{"line":32,"column":100}}, + "range":[1187,1254], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":79},"end":{"line":32,"column":97}}, + "range":[1233,1251], + "value":" 12.4 L block " + } + ], + "loc":{"source":null,"start":{"line":32,"column":98},"end":{"line":32,"column":100}}, + "range":[1252,1254], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":32,"column":56},"end":{"line":32,"column":78}}, + "range":[1210,1232], + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":58},"end":{"line":32,"column":74}}, + "range":[1212,1228], + "value":" 12.3 L any " + } + ], + "loc":{"source":null,"start":{"line":32,"column":75},"end":{"line":32,"column":78}}, + "range":[1229,1232] + } + }, + "typeParameters":null + }, + "kind":"get", + "static":false, + "computed":false, + "decorators":[] + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":34,"column":2},"end":{"line":37,"column":25}}, + "range":[1258,1401], + "key":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":13},"end":{"line":34,"column":28}}, + "range":[1269,1284], + "value":" 13.1 T id " + } + ], + "loc":{"source":null,"start":{"line":34,"column":6},"end":{"line":34,"column":12}}, + "range":[1262,1268], + "name":"getter", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":27},"end":{"line":35,"column":46}}, + "range":[1312,1331], + "value":" 13.3 T params " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":4},"end":{"line":35,"column":23}}, + "range":[1289,1308], + "value":" 13.2 L params " + } + ], + "loc":{"source":null,"start":{"line":35,"column":24},"end":{"line":37,"column":25}}, + "range":[1309,1401], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":37,"column":4},"end":{"line":37,"column":22}}, + "range":[1380,1398], + "value":" 13.6 L block " + } + ], + "loc":{"source":null,"start":{"line":37,"column":23},"end":{"line":37,"column":25}}, + "range":[1399,1401], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":36,"column":4},"end":{"line":36,"column":26}}, + "range":[1336,1358], + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":27},"end":{"line":36,"column":43}}, + "range":[1359,1375], + "value":" 13.5 T any " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":6},"end":{"line":36,"column":22}}, + "range":[1338,1354], + "value":" 13.4 L any " + } + ], + "loc":{"source":null,"start":{"line":36,"column":23},"end":{"line":36,"column":26}}, + "range":[1355,1358] + } + }, + "typeParameters":null + }, + "kind":"get", + "static":false, + "computed":false, + "decorators":[] + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":39,"column":2},"end":{"line":41,"column":25}}, + "range":[1405,1504], + "key":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":39,"column":13},"end":{"line":39,"column":28}}, + "range":[1416,1431], + "value":" 14.1 T id " + } + ], + "loc":{"source":null,"start":{"line":39,"column":6},"end":{"line":39,"column":12}}, + "range":[1409,1415], + "name":"getter", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":40,"column":27},"end":{"line":40,"column":46}}, + "range":[1459,1478], + "value":" 14.3 T params " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":40,"column":4},"end":{"line":40,"column":23}}, + "range":[1436,1455], + "value":" 14.2 L params " + } + ], + "loc":{"source":null,"start":{"line":40,"column":24},"end":{"line":41,"column":25}}, + "range":[1456,1504], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":41,"column":4},"end":{"line":41,"column":22}}, + "range":[1483,1501], + "value":" 14.4 L block " + } + ], + "loc":{"source":null,"start":{"line":41,"column":23},"end":{"line":41,"column":25}}, + "range":[1502,1504], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"get", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "range":[12,26], + "value":" 1.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":24},"end":{"line":2,"column":43}}, + "range":[34,53], + "value":" 1.2 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":48},"end":{"line":2,"column":66}}, + "range":[58,76], + "value":" 1.3 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":70},"end":{"line":2,"column":87}}, + "range":[80,97], + "value":" 1.4 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":91},"end":{"line":2,"column":108}}, + "range":[101,118], + "value":" 1.5 T block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":18}}, + "range":[122,138], + "value":" 2.1 L meth " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":26},"end":{"line":4,"column":42}}, + "range":[146,162], + "value":" 2.2 L meth " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":49},"end":{"line":4,"column":65}}, + "range":[169,185], + "value":" 2.3 L meth " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":68},"end":{"line":4,"column":82}}, + "range":[188,202], + "value":" 2.4 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":18}}, + "range":[217,233], + "value":" 3.1 L meth " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":23},"end":{"line":6,"column":37}}, + "range":[238,252], + "value":" 3.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":45},"end":{"line":6,"column":63}}, + "range":[260,278], + "value":" 3.3 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":67},"end":{"line":6,"column":84}}, + "range":[282,299], + "value":" 3.4 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":88},"end":{"line":6,"column":105}}, + "range":[303,320], + "value":" 3.5 T block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":2},"end":{"line":7,"column":18}}, + "range":[323,339], + "value":" 4.1 L meth " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":23},"end":{"line":7,"column":37}}, + "range":[344,358], + "value":" 4.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":45},"end":{"line":7,"column":63}}, + "range":[366,384], + "value":" 4.3 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":68},"end":{"line":7,"column":85}}, + "range":[389,406], + "value":" 4.4 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":89},"end":{"line":7,"column":106}}, + "range":[410,427], + "value":" 4.5 T block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":2},"end":{"line":9,"column":18}}, + "range":[431,447], + "value":" 5.1 L meth " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":26},"end":{"line":9,"column":42}}, + "range":[455,471], + "value":" 5.2 L meth " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":47},"end":{"line":9,"column":61}}, + "range":[476,490], + "value":" 5.3 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":2},"end":{"line":10,"column":18}}, + "range":[505,521], + "value":" 6.1 L meth " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":26},"end":{"line":10,"column":42}}, + "range":[529,545], + "value":" 6.2 L meth " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":47},"end":{"line":10,"column":61}}, + "range":[550,564], + "value":" 6.3 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":21},"end":{"line":13,"column":35}}, + "range":[602,616], + "value":" 7.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":47},"end":{"line":13,"column":64}}, + "range":[628,645], + "value":" 7.2 T block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":2},"end":{"line":16,"column":16}}, + "range":[661,675], + "value":" 8.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":28},"end":{"line":16,"column":45}}, + "range":[687,704], + "value":" 8.2 T block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":2},"end":{"line":17,"column":16}}, + "range":[707,721], + "value":" 8.3 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":28},"end":{"line":17,"column":45}}, + "range":[733,750], + "value":" 8.4 T block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":18,"column":19}}, + "range":[753,770], + "value":" 8.5 T block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":9},"end":{"line":22,"column":28}}, + "range":[793,812], + "value":" 9.1 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":33},"end":{"line":22,"column":51}}, + "range":[817,835], + "value":" 9.2 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":55},"end":{"line":22,"column":73}}, + "range":[839,857], + "value":" 9.3 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":76},"end":{"line":22,"column":91}}, + "range":[860,875], + "value":" 9.4 L any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":96},"end":{"line":22,"column":113}}, + "range":[880,897], + "value":" 9.5 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":9},"end":{"line":24,"column":29}}, + "range":[911,931], + "value":" 10.1 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":34},"end":{"line":24,"column":54}}, + "range":[936,956], + "value":" 10.2 T tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":4},"end":{"line":25,"column":23}}, + "range":[961,980], + "value":" 10.3 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":27},"end":{"line":25,"column":46}}, + "range":[984,1003], + "value":" 10.4 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":6},"end":{"line":26,"column":22}}, + "range":[1010,1026], + "value":" 10.5 L any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":27},"end":{"line":26,"column":43}}, + "range":[1031,1047], + "value":" 10.6 T any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":27,"column":4},"end":{"line":27,"column":22}}, + "range":[1052,1070], + "value":" 10.7 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":9},"end":{"line":29,"column":28}}, + "range":[1084,1103], + "value":" 11.1 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":32},"end":{"line":29,"column":51}}, + "range":[1107,1126], + "value":" 11.2 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":4},"end":{"line":30,"column":22}}, + "range":[1131,1149], + "value":" 11.3 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":13},"end":{"line":32,"column":32}}, + "range":[1167,1186], + "value":" 12.1 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":36},"end":{"line":32,"column":55}}, + "range":[1190,1209], + "value":" 12.2 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":58},"end":{"line":32,"column":74}}, + "range":[1212,1228], + "value":" 12.3 L any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":79},"end":{"line":32,"column":97}}, + "range":[1233,1251], + "value":" 12.4 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":13},"end":{"line":34,"column":28}}, + "range":[1269,1284], + "value":" 13.1 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":4},"end":{"line":35,"column":23}}, + "range":[1289,1308], + "value":" 13.2 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":27},"end":{"line":35,"column":46}}, + "range":[1312,1331], + "value":" 13.3 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":6},"end":{"line":36,"column":22}}, + "range":[1338,1354], + "value":" 13.4 L any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":27},"end":{"line":36,"column":43}}, + "range":[1359,1375], + "value":" 13.5 T any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":37,"column":4},"end":{"line":37,"column":22}}, + "range":[1380,1398], + "value":" 13.6 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":39,"column":13},"end":{"line":39,"column":28}}, + "range":[1416,1431], + "value":" 14.1 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":40,"column":4},"end":{"line":40,"column":23}}, + "range":[1436,1455], + "value":" 14.2 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":40,"column":27},"end":{"line":40,"column":46}}, + "range":[1459,1478], + "value":" 14.3 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":41,"column":4},"end":{"line":41,"column":22}}, + "range":[1483,1501], + "value":" 14.4 L block " + } + ] +} diff --git a/lib/test/flow/comment_interning/class_property.js b/lib/test/flow/comment_interning/class_property.js new file mode 100644 index 0000000..332cb03 --- /dev/null +++ b/lib/test/flow/comment_interning/class_property.js @@ -0,0 +1,37 @@ +class Test { + /* 1.1 L id */ prop /* 1.2 T id */; /* 1.3 T prop */ + + /* 2.1 L prop */ declare /* 2.2 L prop */ static /* 2.3 L variance */ + /* 2.4 L id */ prop /* 2.5 T id */; /* 2.6 T prop */ + + /* 3.1 L private prop */ declare /* 3.2 L private prop */ static /* 3.3 L variance */ + /* 3.4 L private */ #private1 /* 3.5 T id */; /* 3.6 T private prop */ + + /* 4.1 L id */ prop /* 4.2 T id */ = /* 4.3 L num */ 1 /* 4.4 T num */; /* 4.5 T prop */ + + /* 5.1 L private */ #private2 /* 5.2 T id */ = /* 5.3 L num */ 1 /* 5.4 T num */; /* 5.5 T private prop */ + + /* 6.1 L computed */ [prop] /* 6.2 T computed */ = /* 6.3 L num */ 1 /* 6.4 T num */; /* 6.5 T prop */ +} + +class Test { + /* 7.1 L computed */ [prop] /* 7.2 T computed */ + + /* 7.3 L id */ prop /* 7.4 T id */ + + /* 7.5 L private */ #prop /* 7.6 T id */ + + /* 7.7 L str */ "prop" /* 7.8 T str */ + + /* 7.9 L id */ prop: any /* 7.10 T any */ + + /* 7.11 L id */ prop = 1 /* 7.12 T num */ + + /* 7.13 L id */ prop /* 7.14 T id */ + + /* 7.15 T id */ +} + +class Test { + prop; /* 8.1 L id */ prop; /* 8.2 T prop */ + + /* 8.3 T prop */ +} diff --git a/lib/test/flow/comment_interning/class_property.options.json b/lib/test/flow/comment_interning/class_property.options.json new file mode 100644 index 0000000..77b85d8 --- /dev/null +++ b/lib/test/flow/comment_interning/class_property.options.json @@ -0,0 +1,4 @@ +{ + "intern_comments": true, + "esproposal_class_instance_fields": true +} diff --git a/lib/test/flow/comment_interning/class_property.tree.json b/lib/test/flow/comment_interning/class_property.tree.json new file mode 100644 index 0000000..6656bb0 --- /dev/null +++ b/lib/test/flow/comment_interning/class_property.tree.json @@ -0,0 +1,1055 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":37,"column":1}}, + "range":[0,1121], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":13,"column":1}}, + "range":[0,679], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":10}}, + "range":[6,10], + "name":"Test", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":13,"column":1}}, + "range":[11,679], + "body":[ + { + "type":"ClassProperty", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":40},"end":{"line":2,"column":56}}, + "range":[53,69], + "value":" 1.3 T prop " + } + ], + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":39}}, + "range":[32,52], + "key":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":24},"end":{"line":2,"column":38}}, + "range":[37,51], + "value":" 1.2 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":18}}, + "range":[17,31], + "value":" 1.1 L id " + } + ], + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":23}}, + "range":[32,36], + "name":"prop", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":null, + "computed":false, + "static":false, + "variance":null + }, + { + "type":"ClassProperty", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":112},"end":{"line":4,"column":128}}, + "range":[183,199], + "value":" 2.6 T prop " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":4},"end":{"line":4,"column":20}}, + "range":[75,91], + "value":" 2.1 L prop " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":29},"end":{"line":4,"column":45}}, + "range":[100,116], + "value":" 2.2 L prop " + } + ], + "loc":{"source":null,"start":{"line":4,"column":21},"end":{"line":4,"column":111}}, + "range":[92,182], + "key":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":96},"end":{"line":4,"column":110}}, + "range":[167,181], + "value":" 2.5 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":76},"end":{"line":4,"column":90}}, + "range":[147,161], + "value":" 2.4 L id " + } + ], + "loc":{"source":null,"start":{"line":4,"column":91},"end":{"line":4,"column":95}}, + "range":[162,166], + "name":"prop", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":null, + "computed":false, + "static":true, + "variance":{ + "type":"Variance", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":53},"end":{"line":4,"column":73}}, + "range":[124,144], + "value":" 2.3 L variance " + } + ], + "loc":{"source":null,"start":{"line":4,"column":74},"end":{"line":4,"column":75}}, + "range":[145,146], + "kind":"plus" + }, + "declare":true + }, + { + "type":"ClassPrivateProperty", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":138},"end":{"line":6,"column":162}}, + "range":[339,363], + "value":" 3.6 T private prop " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":4},"end":{"line":6,"column":28}}, + "range":[205,229], + "value":" 3.1 L private prop " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":37},"end":{"line":6,"column":61}}, + "range":[238,262], + "value":" 3.2 L private prop " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":92},"end":{"line":6,"column":111}}, + "range":[293,312], + "value":" 3.4 L private " + } + ], + "loc":{"source":null,"start":{"line":6,"column":29},"end":{"line":6,"column":137}}, + "range":[230,338], + "key":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":122},"end":{"line":6,"column":136}}, + "range":[323,337], + "value":" 3.5 T id " + } + ], + "loc":{"source":null,"start":{"line":6,"column":113},"end":{"line":6,"column":121}}, + "range":[314,322], + "name":"private1", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":null, + "static":true, + "variance":{ + "type":"Variance", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":69},"end":{"line":6,"column":89}}, + "range":[270,290], + "value":" 3.3 L variance " + } + ], + "loc":{"source":null,"start":{"line":6,"column":90},"end":{"line":6,"column":91}}, + "range":[291,292], + "kind":"plus" + }, + "declare":true + }, + { + "type":"ClassProperty", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":76},"end":{"line":8,"column":92}}, + "range":[441,457], + "value":" 4.5 T prop " + } + ], + "loc":{"source":null,"start":{"line":8,"column":19},"end":{"line":8,"column":75}}, + "range":[384,440], + "key":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":24},"end":{"line":8,"column":38}}, + "range":[389,403], + "value":" 4.2 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":4},"end":{"line":8,"column":18}}, + "range":[369,383], + "value":" 4.1 L id " + } + ], + "loc":{"source":null,"start":{"line":8,"column":19},"end":{"line":8,"column":23}}, + "range":[384,388], + "name":"prop", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":59},"end":{"line":8,"column":74}}, + "range":[424,439], + "value":" 4.4 T num " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":41},"end":{"line":8,"column":56}}, + "range":[406,421], + "value":" 4.3 L num " + } + ], + "loc":{"source":null,"start":{"line":8,"column":57},"end":{"line":8,"column":58}}, + "range":[422,423], + "value":1, + "raw":"1" + }, + "typeAnnotation":null, + "computed":false, + "static":false, + "variance":null + }, + { + "type":"ClassPrivateProperty", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":86},"end":{"line":10,"column":110}}, + "range":[545,569], + "value":" 5.5 T private prop " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":4},"end":{"line":10,"column":23}}, + "range":[463,482], + "value":" 5.1 L private " + } + ], + "loc":{"source":null,"start":{"line":10,"column":24},"end":{"line":10,"column":85}}, + "range":[483,544], + "key":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":34},"end":{"line":10,"column":48}}, + "range":[493,507], + "value":" 5.2 T id " + } + ], + "loc":{"source":null,"start":{"line":10,"column":25},"end":{"line":10,"column":33}}, + "range":[484,492], + "name":"private2", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":69},"end":{"line":10,"column":84}}, + "range":[528,543], + "value":" 5.4 T num " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":51},"end":{"line":10,"column":66}}, + "range":[510,525], + "value":" 5.3 L num " + } + ], + "loc":{"source":null,"start":{"line":10,"column":67},"end":{"line":10,"column":68}}, + "range":[526,527], + "value":1, + "raw":"1" + }, + "typeAnnotation":null, + "static":false, + "variance":null + }, + { + "type":"ClassProperty", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":32},"end":{"line":12,"column":52}}, + "range":[603,623], + "value":" 6.2 T computed " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":90},"end":{"line":12,"column":106}}, + "range":[661,677], + "value":" 6.5 T prop " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":4},"end":{"line":12,"column":24}}, + "range":[575,595], + "value":" 6.1 L computed " + } + ], + "loc":{"source":null,"start":{"line":12,"column":25},"end":{"line":12,"column":89}}, + "range":[596,660], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":12,"column":26},"end":{"line":12,"column":30}}, + "range":[597,601], + "name":"prop", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":73},"end":{"line":12,"column":88}}, + "range":[644,659], + "value":" 6.4 T num " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":55},"end":{"line":12,"column":70}}, + "range":[626,641], + "value":" 6.3 L num " + } + ], + "loc":{"source":null,"start":{"line":12,"column":71},"end":{"line":12,"column":72}}, + "range":[642,643], + "value":1, + "raw":"1" + }, + "typeAnnotation":null, + "computed":true, + "static":false, + "variance":null + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":15,"column":0},"end":{"line":31,"column":1}}, + "range":[681,1035], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":15,"column":6},"end":{"line":15,"column":10}}, + "range":[687,691], + "name":"Test", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":15,"column":11},"end":{"line":31,"column":1}}, + "range":[692,1035], + "body":[ + { + "type":"ClassProperty", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":32},"end":{"line":16,"column":52}}, + "range":[726,746], + "value":" 7.2 T computed " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":4},"end":{"line":16,"column":24}}, + "range":[698,718], + "value":" 7.1 L computed " + } + ], + "loc":{"source":null,"start":{"line":16,"column":25},"end":{"line":16,"column":31}}, + "range":[719,725], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":16,"column":26},"end":{"line":16,"column":30}}, + "range":[720,724], + "name":"prop", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":null, + "computed":true, + "static":false, + "variance":null + }, + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":18,"column":19},"end":{"line":18,"column":23}}, + "range":[767,771], + "key":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":24},"end":{"line":18,"column":38}}, + "range":[772,786], + "value":" 7.4 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":4},"end":{"line":18,"column":18}}, + "range":[752,766], + "value":" 7.3 L id " + } + ], + "loc":{"source":null,"start":{"line":18,"column":19},"end":{"line":18,"column":23}}, + "range":[767,771], + "name":"prop", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":null, + "computed":false, + "static":false, + "variance":null + }, + { + "type":"ClassPrivateProperty", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":4},"end":{"line":20,"column":23}}, + "range":[792,811], + "value":" 7.5 L private " + } + ], + "loc":{"source":null,"start":{"line":20,"column":24},"end":{"line":20,"column":29}}, + "range":[812,817], + "key":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":30},"end":{"line":20,"column":44}}, + "range":[818,832], + "value":" 7.6 T id " + } + ], + "loc":{"source":null,"start":{"line":20,"column":25},"end":{"line":20,"column":29}}, + "range":[813,817], + "name":"prop", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":null, + "static":false, + "variance":null + }, + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":22,"column":20},"end":{"line":22,"column":26}}, + "range":[854,860], + "key":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":27},"end":{"line":22,"column":42}}, + "range":[861,876], + "value":" 7.8 T str " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":4},"end":{"line":22,"column":19}}, + "range":[838,853], + "value":" 7.7 L str " + } + ], + "loc":{"source":null,"start":{"line":22,"column":20},"end":{"line":22,"column":26}}, + "range":[854,860], + "value":"prop", + "raw":"\"prop\"" + }, + "value":null, + "typeAnnotation":null, + "computed":false, + "static":false, + "variance":null + }, + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":24,"column":19},"end":{"line":24,"column":28}}, + "range":[897,906], + "key":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":4},"end":{"line":24,"column":18}}, + "range":[882,896], + "value":" 7.9 L id " + } + ], + "loc":{"source":null,"start":{"line":24,"column":19},"end":{"line":24,"column":23}}, + "range":[897,901], + "name":"prop", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":24,"column":23},"end":{"line":24,"column":28}}, + "range":[901,906], + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":29},"end":{"line":24,"column":45}}, + "range":[907,923], + "value":" 7.10 T any " + } + ], + "loc":{"source":null,"start":{"line":24,"column":25},"end":{"line":24,"column":28}}, + "range":[903,906] + } + }, + "computed":false, + "static":false, + "variance":null + }, + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":26,"column":20},"end":{"line":26,"column":28}}, + "range":[945,953], + "key":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":4},"end":{"line":26,"column":19}}, + "range":[929,944], + "value":" 7.11 L id " + } + ], + "loc":{"source":null,"start":{"line":26,"column":20},"end":{"line":26,"column":24}}, + "range":[945,949], + "name":"prop", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":29},"end":{"line":26,"column":45}}, + "range":[954,970], + "value":" 7.12 T num " + } + ], + "loc":{"source":null,"start":{"line":26,"column":27},"end":{"line":26,"column":28}}, + "range":[952,953], + "value":1, + "raw":"1" + }, + "typeAnnotation":null, + "computed":false, + "static":false, + "variance":null + }, + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":28,"column":20},"end":{"line":28,"column":24}}, + "range":[992,996], + "key":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":28,"column":25},"end":{"line":28,"column":40}}, + "range":[997,1012], + "value":" 7.14 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":4},"end":{"line":30,"column":19}}, + "range":[1018,1033], + "value":" 7.15 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":28,"column":4},"end":{"line":28,"column":19}}, + "range":[976,991], + "value":" 7.13 L id " + } + ], + "loc":{"source":null,"start":{"line":28,"column":20},"end":{"line":28,"column":24}}, + "range":[992,996], + "name":"prop", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":null, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":33,"column":0},"end":{"line":37,"column":1}}, + "range":[1037,1121], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":33,"column":6},"end":{"line":33,"column":10}}, + "range":[1043,1047], + "name":"Test", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":33,"column":11},"end":{"line":37,"column":1}}, + "range":[1048,1121], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":34,"column":4},"end":{"line":34,"column":9}}, + "range":[1054,1059], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":34,"column":4},"end":{"line":34,"column":8}}, + "range":[1054,1058], + "name":"prop", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":null, + "computed":false, + "static":false, + "variance":null + }, + { + "type":"ClassProperty", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":31},"end":{"line":34,"column":47}}, + "range":[1081,1097], + "value":" 8.2 T prop " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":4},"end":{"line":36,"column":20}}, + "range":[1103,1119], + "value":" 8.3 T prop " + } + ], + "loc":{"source":null,"start":{"line":34,"column":25},"end":{"line":34,"column":30}}, + "range":[1075,1080], + "key":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":10},"end":{"line":34,"column":24}}, + "range":[1060,1074], + "value":" 8.1 L id " + } + ], + "loc":{"source":null,"start":{"line":34,"column":25},"end":{"line":34,"column":29}}, + "range":[1075,1079], + "name":"prop", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":null, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":18}}, + "range":[17,31], + "value":" 1.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":24},"end":{"line":2,"column":38}}, + "range":[37,51], + "value":" 1.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":40},"end":{"line":2,"column":56}}, + "range":[53,69], + "value":" 1.3 T prop " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":4},"end":{"line":4,"column":20}}, + "range":[75,91], + "value":" 2.1 L prop " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":29},"end":{"line":4,"column":45}}, + "range":[100,116], + "value":" 2.2 L prop " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":53},"end":{"line":4,"column":73}}, + "range":[124,144], + "value":" 2.3 L variance " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":76},"end":{"line":4,"column":90}}, + "range":[147,161], + "value":" 2.4 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":96},"end":{"line":4,"column":110}}, + "range":[167,181], + "value":" 2.5 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":112},"end":{"line":4,"column":128}}, + "range":[183,199], + "value":" 2.6 T prop " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":4},"end":{"line":6,"column":28}}, + "range":[205,229], + "value":" 3.1 L private prop " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":37},"end":{"line":6,"column":61}}, + "range":[238,262], + "value":" 3.2 L private prop " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":69},"end":{"line":6,"column":89}}, + "range":[270,290], + "value":" 3.3 L variance " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":92},"end":{"line":6,"column":111}}, + "range":[293,312], + "value":" 3.4 L private " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":122},"end":{"line":6,"column":136}}, + "range":[323,337], + "value":" 3.5 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":138},"end":{"line":6,"column":162}}, + "range":[339,363], + "value":" 3.6 T private prop " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":4},"end":{"line":8,"column":18}}, + "range":[369,383], + "value":" 4.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":24},"end":{"line":8,"column":38}}, + "range":[389,403], + "value":" 4.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":41},"end":{"line":8,"column":56}}, + "range":[406,421], + "value":" 4.3 L num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":59},"end":{"line":8,"column":74}}, + "range":[424,439], + "value":" 4.4 T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":76},"end":{"line":8,"column":92}}, + "range":[441,457], + "value":" 4.5 T prop " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":4},"end":{"line":10,"column":23}}, + "range":[463,482], + "value":" 5.1 L private " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":34},"end":{"line":10,"column":48}}, + "range":[493,507], + "value":" 5.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":51},"end":{"line":10,"column":66}}, + "range":[510,525], + "value":" 5.3 L num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":69},"end":{"line":10,"column":84}}, + "range":[528,543], + "value":" 5.4 T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":86},"end":{"line":10,"column":110}}, + "range":[545,569], + "value":" 5.5 T private prop " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":4},"end":{"line":12,"column":24}}, + "range":[575,595], + "value":" 6.1 L computed " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":32},"end":{"line":12,"column":52}}, + "range":[603,623], + "value":" 6.2 T computed " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":55},"end":{"line":12,"column":70}}, + "range":[626,641], + "value":" 6.3 L num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":73},"end":{"line":12,"column":88}}, + "range":[644,659], + "value":" 6.4 T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":90},"end":{"line":12,"column":106}}, + "range":[661,677], + "value":" 6.5 T prop " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":4},"end":{"line":16,"column":24}}, + "range":[698,718], + "value":" 7.1 L computed " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":32},"end":{"line":16,"column":52}}, + "range":[726,746], + "value":" 7.2 T computed " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":4},"end":{"line":18,"column":18}}, + "range":[752,766], + "value":" 7.3 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":24},"end":{"line":18,"column":38}}, + "range":[772,786], + "value":" 7.4 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":4},"end":{"line":20,"column":23}}, + "range":[792,811], + "value":" 7.5 L private " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":30},"end":{"line":20,"column":44}}, + "range":[818,832], + "value":" 7.6 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":4},"end":{"line":22,"column":19}}, + "range":[838,853], + "value":" 7.7 L str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":27},"end":{"line":22,"column":42}}, + "range":[861,876], + "value":" 7.8 T str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":4},"end":{"line":24,"column":18}}, + "range":[882,896], + "value":" 7.9 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":29},"end":{"line":24,"column":45}}, + "range":[907,923], + "value":" 7.10 T any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":4},"end":{"line":26,"column":19}}, + "range":[929,944], + "value":" 7.11 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":29},"end":{"line":26,"column":45}}, + "range":[954,970], + "value":" 7.12 T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":28,"column":4},"end":{"line":28,"column":19}}, + "range":[976,991], + "value":" 7.13 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":28,"column":25},"end":{"line":28,"column":40}}, + "range":[997,1012], + "value":" 7.14 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":4},"end":{"line":30,"column":19}}, + "range":[1018,1033], + "value":" 7.15 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":10},"end":{"line":34,"column":24}}, + "range":[1060,1074], + "value":" 8.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":31},"end":{"line":34,"column":47}}, + "range":[1081,1097], + "value":" 8.2 T prop " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":4},"end":{"line":36,"column":20}}, + "range":[1103,1119], + "value":" 8.3 T prop " + } + ] +} diff --git a/lib/test/flow/comment_interning/conditional.js b/lib/test/flow/comment_interning/conditional.js new file mode 100644 index 0000000..cfaf2a3 --- /dev/null +++ b/lib/test/flow/comment_interning/conditional.js @@ -0,0 +1,3 @@ +/* 1.1 L bool */ true /* 1.2 T bool */ ? /* 1.3 L num */ 1 /* 1.4 T num */ : /* 1.5 L num */ 2 /* 1.6 T num */; + +/* 2.1 L conditional */ (/* 2.2 L bool */ true ? 1 : 2 /* 2.3 T num */) /* 2.4 T conditional */; diff --git a/lib/test/flow/comment_interning/conditional.options.json b/lib/test/flow/comment_interning/conditional.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/conditional.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/conditional.tree.json b/lib/test/flow/comment_interning/conditional.tree.json new file mode 100644 index 0000000..f83847c --- /dev/null +++ b/lib/test/flow/comment_interning/conditional.tree.json @@ -0,0 +1,213 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":3,"column":96}}, + "range":[17,209], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":111}}, + "range":[17,111], + "expression":{ + "type":"ConditionalExpression", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":94}}, + "range":[17,94], + "test":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":38}}, + "range":[22,38], + "value":" 1.2 T bool " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "value":" 1.1 L bool " + } + ], + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":21}}, + "range":[17,21], + "value":true, + "raw":"true" + }, + "consequent":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":59},"end":{"line":1,"column":74}}, + "range":[59,74], + "value":" 1.4 T num " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":56}}, + "range":[41,56], + "value":" 1.3 L num " + } + ], + "loc":{"source":null,"start":{"line":1,"column":57},"end":{"line":1,"column":58}}, + "range":[57,58], + "value":1, + "raw":"1" + }, + "alternate":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":95},"end":{"line":1,"column":110}}, + "range":[95,110], + "value":" 1.6 T num " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":77},"end":{"line":1,"column":92}}, + "range":[77,92], + "value":" 1.5 L num " + } + ], + "loc":{"source":null,"start":{"line":1,"column":93},"end":{"line":1,"column":94}}, + "range":[93,94], + "value":2, + "raw":"2" + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":3,"column":24},"end":{"line":3,"column":96}}, + "range":[137,209], + "expression":{ + "type":"ConditionalExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":72},"end":{"line":3,"column":95}}, + "range":[185,208], + "value":" 2.4 T conditional " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":23}}, + "range":[113,136], + "value":" 2.1 L conditional " + } + ], + "loc":{"source":null,"start":{"line":3,"column":42},"end":{"line":3,"column":54}}, + "range":[155,167], + "test":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":25},"end":{"line":3,"column":41}}, + "range":[138,154], + "value":" 2.2 L bool " + } + ], + "loc":{"source":null,"start":{"line":3,"column":42},"end":{"line":3,"column":46}}, + "range":[155,159], + "value":true, + "raw":"true" + }, + "consequent":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":49},"end":{"line":3,"column":50}}, + "range":[162,163], + "value":1, + "raw":"1" + }, + "alternate":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":55},"end":{"line":3,"column":70}}, + "range":[168,183], + "value":" 2.3 T num " + } + ], + "loc":{"source":null,"start":{"line":3,"column":53},"end":{"line":3,"column":54}}, + "range":[166,167], + "value":2, + "raw":"2" + } + }, + "directive":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "value":" 1.1 L bool " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":38}}, + "range":[22,38], + "value":" 1.2 T bool " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":56}}, + "range":[41,56], + "value":" 1.3 L num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":59},"end":{"line":1,"column":74}}, + "range":[59,74], + "value":" 1.4 T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":77},"end":{"line":1,"column":92}}, + "range":[77,92], + "value":" 1.5 L num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":95},"end":{"line":1,"column":110}}, + "range":[95,110], + "value":" 1.6 T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":23}}, + "range":[113,136], + "value":" 2.1 L conditional " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":25},"end":{"line":3,"column":41}}, + "range":[138,154], + "value":" 2.2 L bool " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":55},"end":{"line":3,"column":70}}, + "range":[168,183], + "value":" 2.3 T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":72},"end":{"line":3,"column":95}}, + "range":[185,208], + "value":" 2.4 T conditional " + } + ] +} diff --git a/lib/test/flow/comment_interning/continue.js b/lib/test/flow/comment_interning/continue.js new file mode 100644 index 0000000..3660be8 --- /dev/null +++ b/lib/test/flow/comment_interning/continue.js @@ -0,0 +1,28 @@ +function continue_with_label() { + foo: for (;;) { + /* 1.1 leading on continue */ + continue /* 1.2 leading on label */ foo /* 1.3 trailing */; + /* 1.4 trailing */ + } +} + +function continue_without_label() { + for (;;) { + /* 2.1 leading */ + continue /* 2.2 internal */; + /* 2.3 trailing */ + } +} + +function implicit_semicolon() { + label: for (;;) { + { + continue /* 3.1 T continue */ + /* 3.2 L continue */ continue /* 3.3 T continue */ + } + { + continue label /* 3.4 T id */ + /* 3.5 L continue */ continue label /* 3.6 T id */ + } + } +} diff --git a/lib/test/flow/comment_interning/continue.options.json b/lib/test/flow/comment_interning/continue.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/continue.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/continue.tree.json b/lib/test/flow/comment_interning/continue.tree.json new file mode 100644 index 0000000..2926e2a --- /dev/null +++ b/lib/test/flow/comment_interning/continue.tree.json @@ -0,0 +1,406 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":28,"column":1}}, + "range":[0,580], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "range":[0,177], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":28}}, + "range":[9,28], + "name":"continue_with_label", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":7,"column":1}}, + "range":[31,177], + "body":[ + { + "type":"LabeledStatement", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":6,"column":3}}, + "range":[35,175], + "label":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "range":[35,38], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ForStatement", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":6,"column":3}}, + "range":[40,175], + "init":null, + "test":null, + "update":null, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":6,"column":3}}, + "range":[49,175], + "body":[ + { + "type":"ContinueStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":4},"end":{"line":5,"column":22}}, + "range":[153,171], + "value":" 1.4 trailing " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":33}}, + "range":[55,84], + "value":" 1.1 leading on continue " + } + ], + "loc":{"source":null,"start":{"line":4,"column":4},"end":{"line":4,"column":63}}, + "range":[89,148], + "label":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":44},"end":{"line":4,"column":62}}, + "range":[129,147], + "value":" 1.3 trailing " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":13},"end":{"line":4,"column":39}}, + "range":[98,124], + "value":" 1.2 leading on label " + } + ], + "loc":{"source":null,"start":{"line":4,"column":40},"end":{"line":4,"column":43}}, + "range":[125,128], + "name":"foo", + "typeAnnotation":null, + "optional":false + } + } + ] + } + } + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":15,"column":1}}, + "range":[179,311], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":9},"end":{"line":9,"column":31}}, + "range":[188,210], + "name":"continue_without_label", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":9,"column":34},"end":{"line":15,"column":1}}, + "range":[213,311], + "body":[ + { + "type":"ForStatement", + "loc":{"source":null,"start":{"line":10,"column":2},"end":{"line":14,"column":3}}, + "range":[217,309], + "init":null, + "test":null, + "update":null, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":10,"column":11},"end":{"line":14,"column":3}}, + "range":[226,309], + "body":[ + { + "type":"ContinueStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":4},"end":{"line":13,"column":22}}, + "range":[287,305], + "value":" 2.3 trailing " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":4},"end":{"line":11,"column":21}}, + "range":[232,249], + "value":" 2.1 leading " + } + ], + "loc":{"source":null,"start":{"line":12,"column":4},"end":{"line":12,"column":32}}, + "range":[254,282], + "label":null + } + ] + } + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":17,"column":0},"end":{"line":28,"column":1}}, + "range":[313,580], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":17,"column":9},"end":{"line":17,"column":27}}, + "range":[322,340], + "name":"implicit_semicolon", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":17,"column":30},"end":{"line":28,"column":1}}, + "range":[343,580], + "body":[ + { + "type":"LabeledStatement", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":27,"column":3}}, + "range":[347,578], + "label":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":18,"column":7}}, + "range":[347,352], + "name":"label", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ForStatement", + "loc":{"source":null,"start":{"line":18,"column":9},"end":{"line":27,"column":3}}, + "range":[354,578], + "init":null, + "test":null, + "update":null, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":18,"column":18},"end":{"line":27,"column":3}}, + "range":[363,578], + "body":[ + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":19,"column":4},"end":{"line":22,"column":5}}, + "range":[369,469], + "body":[ + { + "type":"ContinueStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":15},"end":{"line":20,"column":35}}, + "range":[386,406], + "value":" 3.1 T continue " + } + ], + "loc":{"source":null,"start":{"line":20,"column":6},"end":{"line":20,"column":14}}, + "range":[377,385], + "label":null + }, + { + "type":"ContinueStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":36},"end":{"line":21,"column":56}}, + "range":[443,463], + "value":" 3.3 T continue " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":6},"end":{"line":21,"column":26}}, + "range":[413,433], + "value":" 3.2 L continue " + } + ], + "loc":{"source":null,"start":{"line":21,"column":27},"end":{"line":21,"column":35}}, + "range":[434,442], + "label":null + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":23,"column":4},"end":{"line":26,"column":5}}, + "range":[474,574], + "body":[ + { + "type":"ContinueStatement", + "loc":{"source":null,"start":{"line":24,"column":6},"end":{"line":24,"column":20}}, + "range":[482,496], + "label":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":21},"end":{"line":24,"column":35}}, + "range":[497,511], + "value":" 3.4 T id " + } + ], + "loc":{"source":null,"start":{"line":24,"column":15},"end":{"line":24,"column":20}}, + "range":[491,496], + "name":"label", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ContinueStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":6},"end":{"line":25,"column":26}}, + "range":[518,538], + "value":" 3.5 L continue " + } + ], + "loc":{"source":null,"start":{"line":25,"column":27},"end":{"line":25,"column":41}}, + "range":[539,553], + "label":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":42},"end":{"line":25,"column":56}}, + "range":[554,568], + "value":" 3.6 T id " + } + ], + "loc":{"source":null,"start":{"line":25,"column":36},"end":{"line":25,"column":41}}, + "range":[548,553], + "name":"label", + "typeAnnotation":null, + "optional":false + } + } + ] + } + ] + } + } + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":33}}, + "range":[55,84], + "value":" 1.1 leading on continue " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":13},"end":{"line":4,"column":39}}, + "range":[98,124], + "value":" 1.2 leading on label " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":44},"end":{"line":4,"column":62}}, + "range":[129,147], + "value":" 1.3 trailing " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":4},"end":{"line":5,"column":22}}, + "range":[153,171], + "value":" 1.4 trailing " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":4},"end":{"line":11,"column":21}}, + "range":[232,249], + "value":" 2.1 leading " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":13},"end":{"line":12,"column":31}}, + "range":[263,281], + "value":" 2.2 internal " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":4},"end":{"line":13,"column":22}}, + "range":[287,305], + "value":" 2.3 trailing " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":15},"end":{"line":20,"column":35}}, + "range":[386,406], + "value":" 3.1 T continue " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":6},"end":{"line":21,"column":26}}, + "range":[413,433], + "value":" 3.2 L continue " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":36},"end":{"line":21,"column":56}}, + "range":[443,463], + "value":" 3.3 T continue " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":21},"end":{"line":24,"column":35}}, + "range":[497,511], + "value":" 3.4 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":6},"end":{"line":25,"column":26}}, + "range":[518,538], + "value":" 3.5 L continue " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":42},"end":{"line":25,"column":56}}, + "range":[554,568], + "value":" 3.6 T id " + } + ] +} diff --git a/lib/test/flow/comment_interning/debugger.js b/lib/test/flow/comment_interning/debugger.js new file mode 100644 index 0000000..7f1f1a7 --- /dev/null +++ b/lib/test/flow/comment_interning/debugger.js @@ -0,0 +1,24 @@ +function onlyLeading() { + /* Not leading 1 */ + const z = 0; + // 1.1 Leading A + /* 1.2 Leading B */ + debugger; +} + +function onlyTrailing() { + debugger /* 2.1 trailing */ ; /* 2.2 Trailing */ + /* 2.3 Trailing */ +} + +function leadingAndTrailing() { + // 3.1 Leading A + /* 3.2 Leading B */ + debugger /* 3.3 trailing */ ; + // 3.4 Trailing +} + +function implicitSemicolon() { + debugger /* 4.1 Trailing */ + /* 4.2 Leading */ debugger /* 4.3 Trailing */ +} diff --git a/lib/test/flow/comment_interning/debugger.options.json b/lib/test/flow/comment_interning/debugger.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/debugger.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/debugger.tree.json b/lib/test/flow/comment_interning/debugger.tree.json new file mode 100644 index 0000000..00042ec --- /dev/null +++ b/lib/test/flow/comment_interning/debugger.tree.json @@ -0,0 +1,342 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":24,"column":1}}, + "range":[0,455], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "range":[0,116], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":20}}, + "range":[9,20], + "name":"onlyLeading", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":7,"column":1}}, + "range":[23,116], + "body":[ + { + "type":"VariableDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":21}}, + "range":[27,46], + "value":" Not leading 1 " + } + ], + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":14}}, + "range":[49,61], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":13}}, + "range":[55,60], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":9}}, + "range":[55,56], + "name":"z", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":12},"end":{"line":3,"column":13}}, + "range":[59,60], + "value":0, + "raw":"0" + } + } + ], + "kind":"const" + }, + { + "type":"DebuggerStatement", + "leadingComments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":18}}, + "range":[64,80], + "value":" 1.1 Leading A" + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":2},"end":{"line":5,"column":21}}, + "range":[83,102], + "value":" 1.2 Leading B " + } + ], + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":11}}, + "range":[105,114] + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":12,"column":1}}, + "range":[118,217], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":9},"end":{"line":9,"column":21}}, + "range":[127,139], + "name":"onlyTrailing", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":9,"column":24},"end":{"line":12,"column":1}}, + "range":[142,217], + "body":[ + { + "type":"DebuggerStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":11},"end":{"line":10,"column":29}}, + "range":[155,173], + "value":" 2.1 trailing " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":32},"end":{"line":10,"column":50}}, + "range":[176,194], + "value":" 2.2 Trailing " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":2},"end":{"line":11,"column":20}}, + "range":[197,215], + "value":" 2.3 Trailing " + } + ], + "loc":{"source":null,"start":{"line":10,"column":2},"end":{"line":10,"column":31}}, + "range":[146,175] + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":14,"column":0},"end":{"line":19,"column":1}}, + "range":[219,343], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":14,"column":9},"end":{"line":14,"column":27}}, + "range":[228,246], + "name":"leadingAndTrailing", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":14,"column":30},"end":{"line":19,"column":1}}, + "range":[249,343], + "body":[ + { + "type":"DebuggerStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":11},"end":{"line":17,"column":29}}, + "range":[303,321], + "value":" 3.3 trailing " + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":18,"column":17}}, + "range":[326,341], + "value":" 3.4 Trailing" + } + ], + "leadingComments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":15,"column":2},"end":{"line":15,"column":18}}, + "range":[253,269], + "value":" 3.1 Leading A" + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":2},"end":{"line":16,"column":21}}, + "range":[272,291], + "value":" 3.2 Leading B " + } + ], + "loc":{"source":null,"start":{"line":17,"column":2},"end":{"line":17,"column":31}}, + "range":[294,323] + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":21,"column":0},"end":{"line":24,"column":1}}, + "range":[345,455], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":21,"column":9},"end":{"line":21,"column":26}}, + "range":[354,371], + "name":"implicitSemicolon", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":21,"column":29},"end":{"line":24,"column":1}}, + "range":[374,455], + "body":[ + { + "type":"DebuggerStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":11},"end":{"line":22,"column":29}}, + "range":[387,405], + "value":" 4.1 Trailing " + } + ], + "loc":{"source":null,"start":{"line":22,"column":2},"end":{"line":22,"column":10}}, + "range":[378,386] + }, + { + "type":"DebuggerStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":29},"end":{"line":23,"column":47}}, + "range":[435,453], + "value":" 4.3 Trailing " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":2},"end":{"line":23,"column":19}}, + "range":[408,425], + "value":" 4.2 Leading " + } + ], + "loc":{"source":null,"start":{"line":23,"column":20},"end":{"line":23,"column":28}}, + "range":[426,434] + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":21}}, + "range":[27,46], + "value":" Not leading 1 " + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":18}}, + "range":[64,80], + "value":" 1.1 Leading A" + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":2},"end":{"line":5,"column":21}}, + "range":[83,102], + "value":" 1.2 Leading B " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":11},"end":{"line":10,"column":29}}, + "range":[155,173], + "value":" 2.1 trailing " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":32},"end":{"line":10,"column":50}}, + "range":[176,194], + "value":" 2.2 Trailing " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":2},"end":{"line":11,"column":20}}, + "range":[197,215], + "value":" 2.3 Trailing " + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":15,"column":2},"end":{"line":15,"column":18}}, + "range":[253,269], + "value":" 3.1 Leading A" + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":2},"end":{"line":16,"column":21}}, + "range":[272,291], + "value":" 3.2 Leading B " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":11},"end":{"line":17,"column":29}}, + "range":[303,321], + "value":" 3.3 trailing " + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":18,"column":17}}, + "range":[326,341], + "value":" 3.4 Trailing" + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":11},"end":{"line":22,"column":29}}, + "range":[387,405], + "value":" 4.1 Trailing " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":2},"end":{"line":23,"column":19}}, + "range":[408,425], + "value":" 4.2 Leading " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":29},"end":{"line":23,"column":47}}, + "range":[435,453], + "value":" 4.3 Trailing " + } + ] +} diff --git a/lib/test/flow/comment_interning/declare_class.js b/lib/test/flow/comment_interning/declare_class.js new file mode 100644 index 0000000..63414c6 --- /dev/null +++ b/lib/test/flow/comment_interning/declare_class.js @@ -0,0 +1,31 @@ +/* 1.1 L decl class */ declare /* 1.2 L decl class */ class Class {} /* 1.3 T obj type */ + +declare class /* 2.1 L id */ Class /* 2.2 L tparams */ /* 2.3 L obj type */ {} + +declare class Class /* 3.1 T id */ extends /* 3.2 L id */ Super /* 3.3 L obj type */ {} + +declare class Class /* 4.1 T id */ implements /* 4.2 L id */ Interface /* 4.3 L obj type */ {} + +declare class Class /* 5.1 T id */ mixins /* 5.2 L id */ Mixin /* 5.3 L obj type */ {} + +{ + /* 6.1 L decl */ declare class Class {} /* 6.2 T obj type */ + /* 6.3 L decl */ declare class Class {} + /* 6.4 T obj type */ +} + +declare class Class /* 7.1 T id */ + /* 7.2 L tparams */ /* 7.3 T tparams */ + /* 7.4 L obj type */ {} + +declare class Class /* 8.1 T id */ + /* 8.2 L obj type */ {} + +declare class Class extends Super /* 9.1 T id */ + /* 9.2 L obj type */ {} + +declare class Class implements Interface /* 10.1 T id */ + /* 10.2 L obj type */ {} + +declare class Class mixins Mixin /* 11.1 T id */ + /* 11.2 L obj type */ {} diff --git a/lib/test/flow/comment_interning/declare_class.options.json b/lib/test/flow/comment_interning/declare_class.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/declare_class.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/declare_class.tree.json b/lib/test/flow/comment_interning/declare_class.tree.json new file mode 100644 index 0000000..7d3d0e4 --- /dev/null +++ b/lib/test/flow/comment_interning/declare_class.tree.json @@ -0,0 +1,892 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":31,"column":26}}, + "range":[23,987], + "body":[ + { + "type":"DeclareClass", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "value":" 1.1 L decl class " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":53}}, + "range":[31,53], + "value":" 1.2 L decl class " + } + ], + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":68}}, + "range":[23,68], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":60},"end":{"line":1,"column":65}}, + "range":[60,65], + "name":"Class", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":69},"end":{"line":1,"column":89}}, + "range":[69,89], + "value":" 1.3 T obj type " + } + ], + "loc":{"source":null,"start":{"line":1,"column":66},"end":{"line":1,"column":68}}, + "range":[66,68], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + }, + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":82}}, + "range":[91,173], + "id":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":14},"end":{"line":3,"column":28}}, + "range":[105,119], + "value":" 2.1 L id " + } + ], + "loc":{"source":null,"start":{"line":3,"column":29},"end":{"line":3,"column":34}}, + "range":[120,125], + "name":"Class", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":35},"end":{"line":3,"column":54}}, + "range":[126,145], + "value":" 2.2 L tparams " + } + ], + "loc":{"source":null,"start":{"line":3,"column":55},"end":{"line":3,"column":58}}, + "range":[146,149], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":3,"column":56},"end":{"line":3,"column":57}}, + "range":[147,148], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "body":{ + "type":"ObjectTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":59},"end":{"line":3,"column":79}}, + "range":[150,170], + "value":" 2.3 L obj type " + } + ], + "loc":{"source":null,"start":{"line":3,"column":80},"end":{"line":3,"column":82}}, + "range":[171,173], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + }, + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":87}}, + "range":[175,262], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":20},"end":{"line":5,"column":34}}, + "range":[195,209], + "value":" 3.1 T id " + } + ], + "loc":{"source":null,"start":{"line":5,"column":14},"end":{"line":5,"column":19}}, + "range":[189,194], + "name":"Class", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":64},"end":{"line":5,"column":84}}, + "range":[239,259], + "value":" 3.3 L obj type " + } + ], + "loc":{"source":null,"start":{"line":5,"column":85},"end":{"line":5,"column":87}}, + "range":[260,262], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[ + { + "type":"InterfaceExtends", + "loc":{"source":null,"start":{"line":5,"column":58},"end":{"line":5,"column":63}}, + "range":[233,238], + "id":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":43},"end":{"line":5,"column":57}}, + "range":[218,232], + "value":" 3.2 L id " + } + ], + "loc":{"source":null,"start":{"line":5,"column":58},"end":{"line":5,"column":63}}, + "range":[233,238], + "name":"Super", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ], + "implements":[], + "mixins":[] + }, + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":94}}, + "range":[264,358], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":20},"end":{"line":7,"column":34}}, + "range":[284,298], + "value":" 4.1 T id " + } + ], + "loc":{"source":null,"start":{"line":7,"column":14},"end":{"line":7,"column":19}}, + "range":[278,283], + "name":"Class", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":71},"end":{"line":7,"column":91}}, + "range":[335,355], + "value":" 4.3 L obj type " + } + ], + "loc":{"source":null,"start":{"line":7,"column":92},"end":{"line":7,"column":94}}, + "range":[356,358], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[ + { + "type":"ClassImplements", + "loc":{"source":null,"start":{"line":7,"column":61},"end":{"line":7,"column":70}}, + "range":[325,334], + "id":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":46},"end":{"line":7,"column":60}}, + "range":[310,324], + "value":" 4.2 L id " + } + ], + "loc":{"source":null,"start":{"line":7,"column":61},"end":{"line":7,"column":70}}, + "range":[325,334], + "name":"Interface", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ], + "mixins":[] + }, + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":9,"column":86}}, + "range":[360,446], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":20},"end":{"line":9,"column":34}}, + "range":[380,394], + "value":" 5.1 T id " + } + ], + "loc":{"source":null,"start":{"line":9,"column":14},"end":{"line":9,"column":19}}, + "range":[374,379], + "name":"Class", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":63},"end":{"line":9,"column":83}}, + "range":[423,443], + "value":" 5.3 L obj type " + } + ], + "loc":{"source":null,"start":{"line":9,"column":84},"end":{"line":9,"column":86}}, + "range":[444,446], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[ + { + "type":"InterfaceExtends", + "loc":{"source":null,"start":{"line":9,"column":57},"end":{"line":9,"column":62}}, + "range":[417,422], + "id":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":42},"end":{"line":9,"column":56}}, + "range":[402,416], + "value":" 5.2 L id " + } + ], + "loc":{"source":null,"start":{"line":9,"column":57},"end":{"line":9,"column":62}}, + "range":[417,422], + "name":"Mixin", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":15,"column":1}}, + "range":[448,579], + "body":[ + { + "type":"DeclareClass", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":2},"end":{"line":12,"column":18}}, + "range":[452,468], + "value":" 6.1 L decl " + } + ], + "loc":{"source":null,"start":{"line":12,"column":19},"end":{"line":12,"column":41}}, + "range":[469,491], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":12,"column":33},"end":{"line":12,"column":38}}, + "range":[483,488], + "name":"Class", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":42},"end":{"line":12,"column":62}}, + "range":[492,512], + "value":" 6.2 T obj type " + } + ], + "loc":{"source":null,"start":{"line":12,"column":39},"end":{"line":12,"column":41}}, + "range":[489,491], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + }, + { + "type":"DeclareClass", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":2},"end":{"line":13,"column":18}}, + "range":[515,531], + "value":" 6.3 L decl " + } + ], + "loc":{"source":null,"start":{"line":13,"column":19},"end":{"line":13,"column":41}}, + "range":[532,554], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":13,"column":33},"end":{"line":13,"column":38}}, + "range":[546,551], + "name":"Class", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":2},"end":{"line":14,"column":22}}, + "range":[557,577], + "value":" 6.4 T obj type " + } + ], + "loc":{"source":null,"start":{"line":13,"column":39},"end":{"line":13,"column":41}}, + "range":[552,554], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ] + }, + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":17,"column":0},"end":{"line":19,"column":25}}, + "range":[581,687], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":20},"end":{"line":17,"column":34}}, + "range":[601,615], + "value":" 7.1 T id " + } + ], + "loc":{"source":null,"start":{"line":17,"column":14},"end":{"line":17,"column":19}}, + "range":[595,600], + "name":"Class", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":26},"end":{"line":18,"column":45}}, + "range":[642,661], + "value":" 7.3 T tparams " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":18,"column":21}}, + "range":[618,637], + "value":" 7.2 L tparams " + } + ], + "loc":{"source":null,"start":{"line":18,"column":22},"end":{"line":18,"column":25}}, + "range":[638,641], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":18,"column":23},"end":{"line":18,"column":24}}, + "range":[639,640], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "body":{ + "type":"ObjectTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":2},"end":{"line":19,"column":22}}, + "range":[664,684], + "value":" 7.4 L obj type " + } + ], + "loc":{"source":null,"start":{"line":19,"column":23},"end":{"line":19,"column":25}}, + "range":[685,687], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + }, + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":21,"column":0},"end":{"line":22,"column":25}}, + "range":[689,749], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":20},"end":{"line":21,"column":34}}, + "range":[709,723], + "value":" 8.1 T id " + } + ], + "loc":{"source":null,"start":{"line":21,"column":14},"end":{"line":21,"column":19}}, + "range":[703,708], + "name":"Class", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":2},"end":{"line":22,"column":22}}, + "range":[726,746], + "value":" 8.2 L obj type " + } + ], + "loc":{"source":null,"start":{"line":22,"column":23},"end":{"line":22,"column":25}}, + "range":[747,749], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + }, + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":24,"column":0},"end":{"line":25,"column":25}}, + "range":[751,825], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":24,"column":14},"end":{"line":24,"column":19}}, + "range":[765,770], + "name":"Class", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":2},"end":{"line":25,"column":22}}, + "range":[802,822], + "value":" 9.2 L obj type " + } + ], + "loc":{"source":null,"start":{"line":25,"column":23},"end":{"line":25,"column":25}}, + "range":[823,825], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[ + { + "type":"InterfaceExtends", + "loc":{"source":null,"start":{"line":24,"column":28},"end":{"line":24,"column":33}}, + "range":[779,784], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":34},"end":{"line":24,"column":48}}, + "range":[785,799], + "value":" 9.1 T id " + } + ], + "loc":{"source":null,"start":{"line":24,"column":28},"end":{"line":24,"column":33}}, + "range":[779,784], + "name":"Super", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ], + "implements":[], + "mixins":[] + }, + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":27,"column":0},"end":{"line":28,"column":26}}, + "range":[827,910], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":27,"column":14},"end":{"line":27,"column":19}}, + "range":[841,846], + "name":"Class", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":28,"column":2},"end":{"line":28,"column":23}}, + "range":[886,907], + "value":" 10.2 L obj type " + } + ], + "loc":{"source":null,"start":{"line":28,"column":24},"end":{"line":28,"column":26}}, + "range":[908,910], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[ + { + "type":"ClassImplements", + "loc":{"source":null,"start":{"line":27,"column":31},"end":{"line":27,"column":40}}, + "range":[858,867], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":27,"column":41},"end":{"line":27,"column":56}}, + "range":[868,883], + "value":" 10.1 T id " + } + ], + "loc":{"source":null,"start":{"line":27,"column":31},"end":{"line":27,"column":40}}, + "range":[858,867], + "name":"Interface", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ], + "mixins":[] + }, + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":30,"column":0},"end":{"line":31,"column":26}}, + "range":[912,987], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":30,"column":14},"end":{"line":30,"column":19}}, + "range":[926,931], + "name":"Class", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":2},"end":{"line":31,"column":23}}, + "range":[963,984], + "value":" 11.2 L obj type " + } + ], + "loc":{"source":null,"start":{"line":31,"column":24},"end":{"line":31,"column":26}}, + "range":[985,987], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[ + { + "type":"InterfaceExtends", + "loc":{"source":null,"start":{"line":30,"column":27},"end":{"line":30,"column":32}}, + "range":[939,944], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":33},"end":{"line":30,"column":48}}, + "range":[945,960], + "value":" 11.1 T id " + } + ], + "loc":{"source":null,"start":{"line":30,"column":27},"end":{"line":30,"column":32}}, + "range":[939,944], + "name":"Mixin", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "value":" 1.1 L decl class " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":53}}, + "range":[31,53], + "value":" 1.2 L decl class " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":69},"end":{"line":1,"column":89}}, + "range":[69,89], + "value":" 1.3 T obj type " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":14},"end":{"line":3,"column":28}}, + "range":[105,119], + "value":" 2.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":35},"end":{"line":3,"column":54}}, + "range":[126,145], + "value":" 2.2 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":59},"end":{"line":3,"column":79}}, + "range":[150,170], + "value":" 2.3 L obj type " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":20},"end":{"line":5,"column":34}}, + "range":[195,209], + "value":" 3.1 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":43},"end":{"line":5,"column":57}}, + "range":[218,232], + "value":" 3.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":64},"end":{"line":5,"column":84}}, + "range":[239,259], + "value":" 3.3 L obj type " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":20},"end":{"line":7,"column":34}}, + "range":[284,298], + "value":" 4.1 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":46},"end":{"line":7,"column":60}}, + "range":[310,324], + "value":" 4.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":71},"end":{"line":7,"column":91}}, + "range":[335,355], + "value":" 4.3 L obj type " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":20},"end":{"line":9,"column":34}}, + "range":[380,394], + "value":" 5.1 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":42},"end":{"line":9,"column":56}}, + "range":[402,416], + "value":" 5.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":63},"end":{"line":9,"column":83}}, + "range":[423,443], + "value":" 5.3 L obj type " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":2},"end":{"line":12,"column":18}}, + "range":[452,468], + "value":" 6.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":42},"end":{"line":12,"column":62}}, + "range":[492,512], + "value":" 6.2 T obj type " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":2},"end":{"line":13,"column":18}}, + "range":[515,531], + "value":" 6.3 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":2},"end":{"line":14,"column":22}}, + "range":[557,577], + "value":" 6.4 T obj type " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":20},"end":{"line":17,"column":34}}, + "range":[601,615], + "value":" 7.1 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":18,"column":21}}, + "range":[618,637], + "value":" 7.2 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":26},"end":{"line":18,"column":45}}, + "range":[642,661], + "value":" 7.3 T tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":2},"end":{"line":19,"column":22}}, + "range":[664,684], + "value":" 7.4 L obj type " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":20},"end":{"line":21,"column":34}}, + "range":[709,723], + "value":" 8.1 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":2},"end":{"line":22,"column":22}}, + "range":[726,746], + "value":" 8.2 L obj type " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":34},"end":{"line":24,"column":48}}, + "range":[785,799], + "value":" 9.1 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":2},"end":{"line":25,"column":22}}, + "range":[802,822], + "value":" 9.2 L obj type " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":27,"column":41},"end":{"line":27,"column":56}}, + "range":[868,883], + "value":" 10.1 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":28,"column":2},"end":{"line":28,"column":23}}, + "range":[886,907], + "value":" 10.2 L obj type " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":33},"end":{"line":30,"column":48}}, + "range":[945,960], + "value":" 11.1 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":2},"end":{"line":31,"column":23}}, + "range":[963,984], + "value":" 11.2 L obj type " + } + ] +} diff --git a/lib/test/flow/comment_interning/declare_export_declaration.js b/lib/test/flow/comment_interning/declare_export_declaration.js new file mode 100644 index 0000000..c70d699 --- /dev/null +++ b/lib/test/flow/comment_interning/declare_export_declaration.js @@ -0,0 +1,47 @@ +/* 1.1 L decl */ declare /* 1.2 L decl */ export /* 1.3 L decl */ default /* 1.4 L func */ function foo(): any /* 1.5 T any */ + +/* 2.1 L decl */ declare /* 2.2 L decl */ export /* 2.3 L decl */ default /* 2.4 L class */ class Foo {} /* 2.5 T obj type */ + +/* 3.1 L decl */ declare /* 3.2 L decl */ export /* 3.3 L decl */ default /* 3.4 L any */ any; /* 3.5 T decl */ + +/* 4.1 L decl */ declare /* 4.2 L decl */ export /* 4.3 L func */ function foo(): any /* 4.4 T any */ + +/* 5.1 L decl */ declare /* 5.2 L decl */ export /* 5.3 L class */ class Foo {} /* 5.4 T obj type */ + +/* 6.1 L decl */ declare /* 6.2 L decl */ export /* 6.3 decl var */ var x: any; /* 6.4 T decl var */ + +/* 7.1 L decl */ declare /* 7.2 L decl */ export * from /* 7.3 L str */ 'source' /* 7.4 T str */; /* 7.5 T decl */ + +declare module Module { + /* 8.1 L decl */ declare /* 8.2 L decl */ export /* 8.3 L alias */ type Foo = any; /* 8.4 T alias */ + + /* 9.1 L decl */ declare /* 9.2 L decl */ export /* 9.3 L opaque */ opaque type Foo; /* 9.4 T opaque */ + + /* 10.1 L decl */ declare /* 10.2 L decl */ export /* 10.3 L interface */ interface Foo {} /* 10.4 T obj type */ +} + +/* 11.1 L decl */ declare /* 11.2 L decl */ export { /* 11.3 L id */ Foo /* 11.4 T id */ } from /* 11.5 L str */ 'source' /* 11.6 T str */ ; /* 11.7 T decl */ + +declare module Module { + /* 12.1 L decl */ declare export default any /* 12.2 T any */ + /* 12.3 L decl */ declare export default any + /* 12.4 T any */ +} + +declare module Module { + /* 13.1 L decl */ declare export * from 'source' /* 13.2 T str */ + /* 13.3 L decl */ declare export * from 'source' + /* 13.4 T str */ +} + +declare module Module { + /* 14.1 L decl */ declare export { Foo1 } /* 14.2 T decl */ + /* 14.3 L decl */ declare export { Foo2 } + /* 14.4 T decl */ +} + +declare module Module { + /* 15.1 L decl */ declare export { Foo3 } from 'source' /* 15.2 T str */ + /* 15.3 L decl */ declare export { Foo4 } from 'source' + /* 15.4 T str */ +} diff --git a/lib/test/flow/comment_interning/declare_export_declaration.options.json b/lib/test/flow/comment_interning/declare_export_declaration.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/declare_export_declaration.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/declare_export_declaration.tree.json b/lib/test/flow/comment_interning/declare_export_declaration.tree.json new file mode 100644 index 0000000..90001a4 --- /dev/null +++ b/lib/test/flow/comment_interning/declare_export_declaration.tree.json @@ -0,0 +1,1550 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":47,"column":1}}, + "range":[17,1956], + "body":[ + { + "type":"DeclareExportDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "value":" 1.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":41}}, + "range":[25,41], + "value":" 1.2 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":49},"end":{"line":1,"column":65}}, + "range":[49,65], + "value":" 1.3 L decl " + } + ], + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":110}}, + "range":[17,110], + "default":true, + "declaration":{ + "type":"DeclareFunction", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":74},"end":{"line":1,"column":90}}, + "range":[74,90], + "value":" 1.4 L func " + } + ], + "loc":{"source":null,"start":{"line":1,"column":91},"end":{"line":1,"column":110}}, + "range":[91,110], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":100},"end":{"line":1,"column":110}}, + "range":[100,110], + "name":"foo", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":103},"end":{"line":1,"column":110}}, + "range":[103,110], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":103},"end":{"line":1,"column":110}}, + "range":[103,110], + "params":[], + "returnType":{ + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":111},"end":{"line":1,"column":126}}, + "range":[111,126], + "value":" 1.5 T any " + } + ], + "loc":{"source":null,"start":{"line":1,"column":107},"end":{"line":1,"column":110}}, + "range":[107,110] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + }, + "specifiers":[], + "source":null + }, + { + "type":"DeclareExportDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":16}}, + "range":[128,144], + "value":" 2.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":25},"end":{"line":3,"column":41}}, + "range":[153,169], + "value":" 2.2 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":49},"end":{"line":3,"column":65}}, + "range":[177,193], + "value":" 2.3 L decl " + } + ], + "loc":{"source":null,"start":{"line":3,"column":17},"end":{"line":3,"column":104}}, + "range":[145,232], + "default":true, + "declaration":{ + "type":"DeclareClass", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":74},"end":{"line":3,"column":91}}, + "range":[202,219], + "value":" 2.4 L class " + } + ], + "loc":{"source":null,"start":{"line":3,"column":92},"end":{"line":3,"column":104}}, + "range":[220,232], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":98},"end":{"line":3,"column":101}}, + "range":[226,229], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":105},"end":{"line":3,"column":125}}, + "range":[233,253], + "value":" 2.5 T obj type " + } + ], + "loc":{"source":null,"start":{"line":3,"column":102},"end":{"line":3,"column":104}}, + "range":[230,232], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + }, + "specifiers":[], + "source":null + }, + { + "type":"DeclareExportDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":95},"end":{"line":5,"column":111}}, + "range":[350,366], + "value":" 3.5 T decl " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":16}}, + "range":[255,271], + "value":" 3.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":25},"end":{"line":5,"column":41}}, + "range":[280,296], + "value":" 3.2 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":49},"end":{"line":5,"column":65}}, + "range":[304,320], + "value":" 3.3 L decl " + } + ], + "loc":{"source":null,"start":{"line":5,"column":17},"end":{"line":5,"column":94}}, + "range":[272,349], + "default":true, + "declaration":{ + "type":"AnyTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":74},"end":{"line":5,"column":89}}, + "range":[329,344], + "value":" 3.4 L any " + } + ], + "loc":{"source":null,"start":{"line":5,"column":90},"end":{"line":5,"column":93}}, + "range":[345,348] + }, + "specifiers":[], + "source":null + }, + { + "type":"DeclareExportDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":16}}, + "range":[368,384], + "value":" 4.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":25},"end":{"line":7,"column":41}}, + "range":[393,409], + "value":" 4.2 L decl " + } + ], + "loc":{"source":null,"start":{"line":7,"column":17},"end":{"line":7,"column":85}}, + "range":[385,453], + "default":false, + "declaration":{ + "type":"DeclareFunction", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":49},"end":{"line":7,"column":65}}, + "range":[417,433], + "value":" 4.3 L func " + } + ], + "loc":{"source":null,"start":{"line":7,"column":66},"end":{"line":7,"column":85}}, + "range":[434,453], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":75},"end":{"line":7,"column":85}}, + "range":[443,453], + "name":"foo", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":78},"end":{"line":7,"column":85}}, + "range":[446,453], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":78},"end":{"line":7,"column":85}}, + "range":[446,453], + "params":[], + "returnType":{ + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":86},"end":{"line":7,"column":101}}, + "range":[454,469], + "value":" 4.4 T any " + } + ], + "loc":{"source":null,"start":{"line":7,"column":82},"end":{"line":7,"column":85}}, + "range":[450,453] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + }, + "specifiers":[], + "source":null + }, + { + "type":"DeclareExportDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":9,"column":16}}, + "range":[471,487], + "value":" 5.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":25},"end":{"line":9,"column":41}}, + "range":[496,512], + "value":" 5.2 L decl " + } + ], + "loc":{"source":null,"start":{"line":9,"column":17},"end":{"line":9,"column":79}}, + "range":[488,550], + "default":false, + "declaration":{ + "type":"DeclareClass", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":49},"end":{"line":9,"column":66}}, + "range":[520,537], + "value":" 5.3 L class " + } + ], + "loc":{"source":null,"start":{"line":9,"column":67},"end":{"line":9,"column":79}}, + "range":[538,550], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":73},"end":{"line":9,"column":76}}, + "range":[544,547], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":80},"end":{"line":9,"column":100}}, + "range":[551,571], + "value":" 5.4 T obj type " + } + ], + "loc":{"source":null,"start":{"line":9,"column":77},"end":{"line":9,"column":79}}, + "range":[548,550], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + }, + "specifiers":[], + "source":null + }, + { + "type":"DeclareExportDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":11,"column":16}}, + "range":[573,589], + "value":" 6.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":25},"end":{"line":11,"column":41}}, + "range":[598,614], + "value":" 6.2 L decl " + } + ], + "loc":{"source":null,"start":{"line":11,"column":17},"end":{"line":11,"column":79}}, + "range":[590,652], + "default":false, + "declaration":{ + "type":"DeclareVariable", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":80},"end":{"line":11,"column":100}}, + "range":[653,673], + "value":" 6.4 T decl var " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":49},"end":{"line":11,"column":67}}, + "range":[622,640], + "value":" 6.3 decl var " + } + ], + "loc":{"source":null,"start":{"line":11,"column":68},"end":{"line":11,"column":79}}, + "range":[641,652], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":11,"column":72},"end":{"line":11,"column":78}}, + "range":[645,651], + "name":"x", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":11,"column":73},"end":{"line":11,"column":78}}, + "range":[646,651], + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":11,"column":75},"end":{"line":11,"column":78}}, + "range":[648,651] + } + }, + "optional":false + } + }, + "specifiers":[], + "source":null + }, + { + "type":"DeclareExportAllDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":98},"end":{"line":13,"column":114}}, + "range":[773,789], + "value":" 7.5 T decl " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":0},"end":{"line":13,"column":16}}, + "range":[675,691], + "value":" 7.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":25},"end":{"line":13,"column":41}}, + "range":[700,716], + "value":" 7.2 L decl " + } + ], + "loc":{"source":null,"start":{"line":13,"column":17},"end":{"line":13,"column":97}}, + "range":[692,772], + "source":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":81},"end":{"line":13,"column":96}}, + "range":[756,771], + "value":" 7.4 T str " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":56},"end":{"line":13,"column":71}}, + "range":[731,746], + "value":" 7.3 L str " + } + ], + "loc":{"source":null,"start":{"line":13,"column":72},"end":{"line":13,"column":80}}, + "range":[747,755], + "value":"source", + "raw":"'source'" + } + }, + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":15,"column":0},"end":{"line":21,"column":1}}, + "range":[791,1142], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":15,"column":15},"end":{"line":15,"column":21}}, + "range":[806,812], + "name":"Module", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":15,"column":22},"end":{"line":21,"column":1}}, + "range":[813,1142], + "body":[ + { + "type":"DeclareExportDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":2},"end":{"line":16,"column":18}}, + "range":[817,833], + "value":" 8.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":27},"end":{"line":16,"column":43}}, + "range":[842,858], + "value":" 8.2 L decl " + } + ], + "loc":{"source":null,"start":{"line":16,"column":19},"end":{"line":16,"column":84}}, + "range":[834,899], + "default":false, + "declaration":{ + "type":"TypeAlias", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":85},"end":{"line":16,"column":102}}, + "range":[900,917], + "value":" 8.4 T alias " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":51},"end":{"line":16,"column":68}}, + "range":[866,883], + "value":" 8.3 L alias " + } + ], + "loc":{"source":null,"start":{"line":16,"column":69},"end":{"line":16,"column":84}}, + "range":[884,899], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":16,"column":74},"end":{"line":16,"column":77}}, + "range":[889,892], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":16,"column":80},"end":{"line":16,"column":83}}, + "range":[895,898] + } + }, + "specifiers":[], + "source":null + }, + { + "type":"DeclareExportDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":18,"column":18}}, + "range":[921,937], + "value":" 9.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":27},"end":{"line":18,"column":43}}, + "range":[946,962], + "value":" 9.2 L decl " + } + ], + "loc":{"source":null,"start":{"line":18,"column":19},"end":{"line":18,"column":86}}, + "range":[938,1005], + "default":false, + "declaration":{ + "type":"DeclareOpaqueType", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":87},"end":{"line":18,"column":105}}, + "range":[1006,1024], + "value":" 9.4 T opaque " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":51},"end":{"line":18,"column":69}}, + "range":[970,988], + "value":" 9.3 L opaque " + } + ], + "loc":{"source":null,"start":{"line":18,"column":70},"end":{"line":18,"column":86}}, + "range":[989,1005], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":18,"column":82},"end":{"line":18,"column":85}}, + "range":[1001,1004], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "impltype":null, + "supertype":null + }, + "specifiers":[], + "source":null + }, + { + "type":"DeclareExportDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":2},"end":{"line":20,"column":19}}, + "range":[1028,1045], + "value":" 10.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":28},"end":{"line":20,"column":45}}, + "range":[1054,1071], + "value":" 10.2 L decl " + } + ], + "loc":{"source":null,"start":{"line":20,"column":20},"end":{"line":20,"column":92}}, + "range":[1046,1118], + "default":false, + "declaration":{ + "type":"InterfaceDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":53},"end":{"line":20,"column":75}}, + "range":[1079,1101], + "value":" 10.3 L interface " + } + ], + "loc":{"source":null,"start":{"line":20,"column":76},"end":{"line":20,"column":92}}, + "range":[1102,1118], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":20,"column":86},"end":{"line":20,"column":89}}, + "range":[1112,1115], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":93},"end":{"line":20,"column":114}}, + "range":[1119,1140], + "value":" 10.4 T obj type " + } + ], + "loc":{"source":null,"start":{"line":20,"column":90},"end":{"line":20,"column":92}}, + "range":[1116,1118], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + }, + "specifiers":[], + "source":null + } + ] + }, + "kind":"ES" + }, + { + "type":"DeclareExportDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":141},"end":{"line":23,"column":158}}, + "range":[1285,1302], + "value":" 11.7 T decl " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":0},"end":{"line":23,"column":17}}, + "range":[1144,1161], + "value":" 11.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":26},"end":{"line":23,"column":43}}, + "range":[1170,1187], + "value":" 11.2 L decl " + } + ], + "loc":{"source":null,"start":{"line":23,"column":18},"end":{"line":23,"column":140}}, + "range":[1162,1284], + "default":false, + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":23,"column":69},"end":{"line":23,"column":72}}, + "range":[1213,1216], + "local":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":73},"end":{"line":23,"column":88}}, + "range":[1217,1232], + "value":" 11.4 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":53},"end":{"line":23,"column":68}}, + "range":[1197,1212], + "value":" 11.3 L id " + } + ], + "loc":{"source":null,"start":{"line":23,"column":69},"end":{"line":23,"column":72}}, + "range":[1213,1216], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":73},"end":{"line":23,"column":88}}, + "range":[1217,1232], + "value":" 11.4 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":53},"end":{"line":23,"column":68}}, + "range":[1197,1212], + "value":" 11.3 L id " + } + ], + "loc":{"source":null,"start":{"line":23,"column":69},"end":{"line":23,"column":72}}, + "range":[1213,1216], + "name":"Foo", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":122},"end":{"line":23,"column":138}}, + "range":[1266,1282], + "value":" 11.6 T str " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":96},"end":{"line":23,"column":112}}, + "range":[1240,1256], + "value":" 11.5 L str " + } + ], + "loc":{"source":null,"start":{"line":23,"column":113},"end":{"line":23,"column":121}}, + "range":[1257,1265], + "value":"source", + "raw":"'source'" + } + }, + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":25,"column":0},"end":{"line":29,"column":1}}, + "range":[1304,1459], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":25,"column":15},"end":{"line":25,"column":21}}, + "range":[1319,1325], + "name":"Module", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":25,"column":22},"end":{"line":29,"column":1}}, + "range":[1326,1459], + "body":[ + { + "type":"DeclareExportDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":2},"end":{"line":26,"column":19}}, + "range":[1330,1347], + "value":" 12.1 L decl " + } + ], + "loc":{"source":null,"start":{"line":26,"column":20},"end":{"line":26,"column":46}}, + "range":[1348,1374], + "default":true, + "declaration":{ + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":47},"end":{"line":26,"column":63}}, + "range":[1375,1391], + "value":" 12.2 T any " + } + ], + "loc":{"source":null,"start":{"line":26,"column":43},"end":{"line":26,"column":46}}, + "range":[1371,1374] + }, + "specifiers":[], + "source":null + }, + { + "type":"DeclareExportDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":27,"column":2},"end":{"line":27,"column":19}}, + "range":[1394,1411], + "value":" 12.3 L decl " + } + ], + "loc":{"source":null,"start":{"line":27,"column":20},"end":{"line":27,"column":46}}, + "range":[1412,1438], + "default":true, + "declaration":{ + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":28,"column":2},"end":{"line":28,"column":18}}, + "range":[1441,1457], + "value":" 12.4 T any " + } + ], + "loc":{"source":null,"start":{"line":27,"column":43},"end":{"line":27,"column":46}}, + "range":[1435,1438] + }, + "specifiers":[], + "source":null + } + ] + }, + "kind":"ES" + }, + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":31,"column":0},"end":{"line":35,"column":1}}, + "range":[1461,1624], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":31,"column":15},"end":{"line":31,"column":21}}, + "range":[1476,1482], + "name":"Module", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":31,"column":22},"end":{"line":35,"column":1}}, + "range":[1483,1624], + "body":[ + { + "type":"DeclareExportAllDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":2},"end":{"line":32,"column":19}}, + "range":[1487,1504], + "value":" 13.1 L decl " + } + ], + "loc":{"source":null,"start":{"line":32,"column":20},"end":{"line":32,"column":50}}, + "range":[1505,1535], + "source":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":51},"end":{"line":32,"column":67}}, + "range":[1536,1552], + "value":" 13.2 T str " + } + ], + "loc":{"source":null,"start":{"line":32,"column":42},"end":{"line":32,"column":50}}, + "range":[1527,1535], + "value":"source", + "raw":"'source'" + } + }, + { + "type":"DeclareExportAllDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":33,"column":2},"end":{"line":33,"column":19}}, + "range":[1555,1572], + "value":" 13.3 L decl " + } + ], + "loc":{"source":null,"start":{"line":33,"column":20},"end":{"line":33,"column":50}}, + "range":[1573,1603], + "source":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":2},"end":{"line":34,"column":18}}, + "range":[1606,1622], + "value":" 13.4 T str " + } + ], + "loc":{"source":null,"start":{"line":33,"column":42},"end":{"line":33,"column":50}}, + "range":[1595,1603], + "value":"source", + "raw":"'source'" + } + } + ] + }, + "kind":"ES" + }, + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":37,"column":0},"end":{"line":41,"column":1}}, + "range":[1626,1777], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":37,"column":15},"end":{"line":37,"column":21}}, + "range":[1641,1647], + "name":"Module", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":37,"column":22},"end":{"line":41,"column":1}}, + "range":[1648,1777], + "body":[ + { + "type":"DeclareExportDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":38,"column":44},"end":{"line":38,"column":61}}, + "range":[1694,1711], + "value":" 14.2 T decl " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":38,"column":2},"end":{"line":38,"column":19}}, + "range":[1652,1669], + "value":" 14.1 L decl " + } + ], + "loc":{"source":null,"start":{"line":38,"column":20},"end":{"line":38,"column":43}}, + "range":[1670,1693], + "default":false, + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":38,"column":37},"end":{"line":38,"column":41}}, + "range":[1687,1691], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":38,"column":37},"end":{"line":38,"column":41}}, + "range":[1687,1691], + "name":"Foo1", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":38,"column":37},"end":{"line":38,"column":41}}, + "range":[1687,1691], + "name":"Foo1", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":null + }, + { + "type":"DeclareExportDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":40,"column":2},"end":{"line":40,"column":19}}, + "range":[1758,1775], + "value":" 14.4 T decl " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":39,"column":2},"end":{"line":39,"column":19}}, + "range":[1714,1731], + "value":" 14.3 L decl " + } + ], + "loc":{"source":null,"start":{"line":39,"column":20},"end":{"line":39,"column":43}}, + "range":[1732,1755], + "default":false, + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":39,"column":37},"end":{"line":39,"column":41}}, + "range":[1749,1753], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":39,"column":37},"end":{"line":39,"column":41}}, + "range":[1749,1753], + "name":"Foo2", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":39,"column":37},"end":{"line":39,"column":41}}, + "range":[1749,1753], + "name":"Foo2", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":null + } + ] + }, + "kind":"ES" + }, + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":43,"column":0},"end":{"line":47,"column":1}}, + "range":[1779,1956], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":43,"column":15},"end":{"line":43,"column":21}}, + "range":[1794,1800], + "name":"Module", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":43,"column":22},"end":{"line":47,"column":1}}, + "range":[1801,1956], + "body":[ + { + "type":"DeclareExportDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":44,"column":2},"end":{"line":44,"column":19}}, + "range":[1805,1822], + "value":" 15.1 L decl " + } + ], + "loc":{"source":null,"start":{"line":44,"column":20},"end":{"line":44,"column":57}}, + "range":[1823,1860], + "default":false, + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":44,"column":37},"end":{"line":44,"column":41}}, + "range":[1840,1844], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":44,"column":37},"end":{"line":44,"column":41}}, + "range":[1840,1844], + "name":"Foo3", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":44,"column":37},"end":{"line":44,"column":41}}, + "range":[1840,1844], + "name":"Foo3", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":44,"column":58},"end":{"line":44,"column":74}}, + "range":[1861,1877], + "value":" 15.2 T str " + } + ], + "loc":{"source":null,"start":{"line":44,"column":49},"end":{"line":44,"column":57}}, + "range":[1852,1860], + "value":"source", + "raw":"'source'" + } + }, + { + "type":"DeclareExportDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":45,"column":2},"end":{"line":45,"column":19}}, + "range":[1880,1897], + "value":" 15.3 L decl " + } + ], + "loc":{"source":null,"start":{"line":45,"column":20},"end":{"line":45,"column":57}}, + "range":[1898,1935], + "default":false, + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":45,"column":37},"end":{"line":45,"column":41}}, + "range":[1915,1919], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":45,"column":37},"end":{"line":45,"column":41}}, + "range":[1915,1919], + "name":"Foo4", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":45,"column":37},"end":{"line":45,"column":41}}, + "range":[1915,1919], + "name":"Foo4", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":46,"column":2},"end":{"line":46,"column":18}}, + "range":[1938,1954], + "value":" 15.4 T str " + } + ], + "loc":{"source":null,"start":{"line":45,"column":49},"end":{"line":45,"column":57}}, + "range":[1927,1935], + "value":"source", + "raw":"'source'" + } + } + ] + }, + "kind":"ES" + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "value":" 1.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":41}}, + "range":[25,41], + "value":" 1.2 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":49},"end":{"line":1,"column":65}}, + "range":[49,65], + "value":" 1.3 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":74},"end":{"line":1,"column":90}}, + "range":[74,90], + "value":" 1.4 L func " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":111},"end":{"line":1,"column":126}}, + "range":[111,126], + "value":" 1.5 T any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":16}}, + "range":[128,144], + "value":" 2.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":25},"end":{"line":3,"column":41}}, + "range":[153,169], + "value":" 2.2 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":49},"end":{"line":3,"column":65}}, + "range":[177,193], + "value":" 2.3 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":74},"end":{"line":3,"column":91}}, + "range":[202,219], + "value":" 2.4 L class " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":105},"end":{"line":3,"column":125}}, + "range":[233,253], + "value":" 2.5 T obj type " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":16}}, + "range":[255,271], + "value":" 3.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":25},"end":{"line":5,"column":41}}, + "range":[280,296], + "value":" 3.2 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":49},"end":{"line":5,"column":65}}, + "range":[304,320], + "value":" 3.3 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":74},"end":{"line":5,"column":89}}, + "range":[329,344], + "value":" 3.4 L any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":95},"end":{"line":5,"column":111}}, + "range":[350,366], + "value":" 3.5 T decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":16}}, + "range":[368,384], + "value":" 4.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":25},"end":{"line":7,"column":41}}, + "range":[393,409], + "value":" 4.2 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":49},"end":{"line":7,"column":65}}, + "range":[417,433], + "value":" 4.3 L func " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":86},"end":{"line":7,"column":101}}, + "range":[454,469], + "value":" 4.4 T any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":9,"column":16}}, + "range":[471,487], + "value":" 5.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":25},"end":{"line":9,"column":41}}, + "range":[496,512], + "value":" 5.2 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":49},"end":{"line":9,"column":66}}, + "range":[520,537], + "value":" 5.3 L class " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":80},"end":{"line":9,"column":100}}, + "range":[551,571], + "value":" 5.4 T obj type " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":11,"column":16}}, + "range":[573,589], + "value":" 6.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":25},"end":{"line":11,"column":41}}, + "range":[598,614], + "value":" 6.2 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":49},"end":{"line":11,"column":67}}, + "range":[622,640], + "value":" 6.3 decl var " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":80},"end":{"line":11,"column":100}}, + "range":[653,673], + "value":" 6.4 T decl var " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":0},"end":{"line":13,"column":16}}, + "range":[675,691], + "value":" 7.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":25},"end":{"line":13,"column":41}}, + "range":[700,716], + "value":" 7.2 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":56},"end":{"line":13,"column":71}}, + "range":[731,746], + "value":" 7.3 L str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":81},"end":{"line":13,"column":96}}, + "range":[756,771], + "value":" 7.4 T str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":98},"end":{"line":13,"column":114}}, + "range":[773,789], + "value":" 7.5 T decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":2},"end":{"line":16,"column":18}}, + "range":[817,833], + "value":" 8.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":27},"end":{"line":16,"column":43}}, + "range":[842,858], + "value":" 8.2 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":51},"end":{"line":16,"column":68}}, + "range":[866,883], + "value":" 8.3 L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":85},"end":{"line":16,"column":102}}, + "range":[900,917], + "value":" 8.4 T alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":18,"column":18}}, + "range":[921,937], + "value":" 9.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":27},"end":{"line":18,"column":43}}, + "range":[946,962], + "value":" 9.2 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":51},"end":{"line":18,"column":69}}, + "range":[970,988], + "value":" 9.3 L opaque " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":87},"end":{"line":18,"column":105}}, + "range":[1006,1024], + "value":" 9.4 T opaque " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":2},"end":{"line":20,"column":19}}, + "range":[1028,1045], + "value":" 10.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":28},"end":{"line":20,"column":45}}, + "range":[1054,1071], + "value":" 10.2 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":53},"end":{"line":20,"column":75}}, + "range":[1079,1101], + "value":" 10.3 L interface " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":93},"end":{"line":20,"column":114}}, + "range":[1119,1140], + "value":" 10.4 T obj type " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":0},"end":{"line":23,"column":17}}, + "range":[1144,1161], + "value":" 11.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":26},"end":{"line":23,"column":43}}, + "range":[1170,1187], + "value":" 11.2 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":53},"end":{"line":23,"column":68}}, + "range":[1197,1212], + "value":" 11.3 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":73},"end":{"line":23,"column":88}}, + "range":[1217,1232], + "value":" 11.4 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":96},"end":{"line":23,"column":112}}, + "range":[1240,1256], + "value":" 11.5 L str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":122},"end":{"line":23,"column":138}}, + "range":[1266,1282], + "value":" 11.6 T str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":141},"end":{"line":23,"column":158}}, + "range":[1285,1302], + "value":" 11.7 T decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":2},"end":{"line":26,"column":19}}, + "range":[1330,1347], + "value":" 12.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":47},"end":{"line":26,"column":63}}, + "range":[1375,1391], + "value":" 12.2 T any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":27,"column":2},"end":{"line":27,"column":19}}, + "range":[1394,1411], + "value":" 12.3 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":28,"column":2},"end":{"line":28,"column":18}}, + "range":[1441,1457], + "value":" 12.4 T any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":2},"end":{"line":32,"column":19}}, + "range":[1487,1504], + "value":" 13.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":51},"end":{"line":32,"column":67}}, + "range":[1536,1552], + "value":" 13.2 T str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":33,"column":2},"end":{"line":33,"column":19}}, + "range":[1555,1572], + "value":" 13.3 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":2},"end":{"line":34,"column":18}}, + "range":[1606,1622], + "value":" 13.4 T str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":38,"column":2},"end":{"line":38,"column":19}}, + "range":[1652,1669], + "value":" 14.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":38,"column":44},"end":{"line":38,"column":61}}, + "range":[1694,1711], + "value":" 14.2 T decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":39,"column":2},"end":{"line":39,"column":19}}, + "range":[1714,1731], + "value":" 14.3 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":40,"column":2},"end":{"line":40,"column":19}}, + "range":[1758,1775], + "value":" 14.4 T decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":44,"column":2},"end":{"line":44,"column":19}}, + "range":[1805,1822], + "value":" 15.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":44,"column":58},"end":{"line":44,"column":74}}, + "range":[1861,1877], + "value":" 15.2 T str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":45,"column":2},"end":{"line":45,"column":19}}, + "range":[1880,1897], + "value":" 15.3 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":46,"column":2},"end":{"line":46,"column":18}}, + "range":[1938,1954], + "value":" 15.4 T str " + } + ] +} diff --git a/lib/test/flow/comment_interning/declare_function.js b/lib/test/flow/comment_interning/declare_function.js new file mode 100644 index 0000000..7903ff0 --- /dev/null +++ b/lib/test/flow/comment_interning/declare_function.js @@ -0,0 +1,22 @@ +/* 1.1 func decl */ declare /* 1.2 func decl */ function name(): void; /* 1.3 T func decl */ + +declare function /* 2.1 L id */ name /* 2.2 L tparams */ /* 2.3 L params */ () /* 2.4 T params */ : /* 2.5 T void */ void /* 2.6 T void */; + +{ + /* 3.1 L decl */ declare function name(): void /* 3.2 T void */ + /* 3.3 L decl */ declare function name(): void + /* 3.4 T void */ +} + +{ + /* 4.1 L decl */ declare function name(): void %checks /* 4.2 T pred */ + /* 4.3 L decl */ declare function name(): void %checks + /* 4.4 T pred */ +} + +declare function Foo /* 5.1 T id */ + /* 5.2 L tparams */ /* 5.3 T tparams */ + /* 5.4 L params */ (): void; + +declare function Foo(): void /* 6.1 T void */ + /* 6.2 L pred */ %checks; diff --git a/lib/test/flow/comment_interning/declare_function.options.json b/lib/test/flow/comment_interning/declare_function.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/declare_function.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/declare_function.tree.json b/lib/test/flow/comment_interning/declare_function.tree.json new file mode 100644 index 0000000..a681e88 --- /dev/null +++ b/lib/test/flow/comment_interning/declare_function.tree.json @@ -0,0 +1,633 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":22,"column":27}}, + "range":[20,720], + "body":[ + { + "type":"DeclareFunction", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":71},"end":{"line":1,"column":92}}, + "range":[71,92], + "value":" 1.3 T func decl " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "range":[0,19], + "value":" 1.1 func decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":47}}, + "range":[28,47], + "value":" 1.2 func decl " + } + ], + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":70}}, + "range":[20,70], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":57},"end":{"line":1,"column":69}}, + "range":[57,69], + "name":"name", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":61},"end":{"line":1,"column":69}}, + "range":[61,69], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":61},"end":{"line":1,"column":69}}, + "range":[61,69], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":65},"end":{"line":1,"column":69}}, + "range":[65,69] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + }, + { + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":143}}, + "range":[94,237], + "id":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":17},"end":{"line":3,"column":31}}, + "range":[111,125], + "value":" 2.1 L id " + } + ], + "loc":{"source":null,"start":{"line":3,"column":32},"end":{"line":3,"column":125}}, + "range":[126,219], + "name":"name", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":57},"end":{"line":3,"column":125}}, + "range":[151,219], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":83},"end":{"line":3,"column":101}}, + "range":[177,195], + "value":" 2.4 T params " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":61},"end":{"line":3,"column":79}}, + "range":[155,173], + "value":" 2.3 L params " + } + ], + "loc":{"source":null,"start":{"line":3,"column":57},"end":{"line":3,"column":125}}, + "range":[151,219], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":126},"end":{"line":3,"column":142}}, + "range":[220,236], + "value":" 2.6 T void " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":104},"end":{"line":3,"column":120}}, + "range":[198,214], + "value":" 2.5 T void " + } + ], + "loc":{"source":null,"start":{"line":3,"column":121},"end":{"line":3,"column":125}}, + "range":[215,219] + }, + "rest":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":37},"end":{"line":3,"column":56}}, + "range":[131,150], + "value":" 2.2 L tparams " + } + ], + "loc":{"source":null,"start":{"line":3,"column":57},"end":{"line":3,"column":60}}, + "range":[151,154], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":3,"column":58},"end":{"line":3,"column":59}}, + "range":[152,153], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + } + }, + "optional":false + }, + "predicate":null + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":9,"column":1}}, + "range":[239,376], + "body":[ + { + "type":"DeclareFunction", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":18}}, + "range":[243,259], + "value":" 3.1 L decl " + } + ], + "loc":{"source":null,"start":{"line":6,"column":19},"end":{"line":6,"column":48}}, + "range":[260,289], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":36},"end":{"line":6,"column":48}}, + "range":[277,289], + "name":"name", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":6,"column":40},"end":{"line":6,"column":48}}, + "range":[281,289], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":6,"column":40},"end":{"line":6,"column":48}}, + "range":[281,289], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":49},"end":{"line":6,"column":65}}, + "range":[290,306], + "value":" 3.2 T void " + } + ], + "loc":{"source":null,"start":{"line":6,"column":44},"end":{"line":6,"column":48}}, + "range":[285,289] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + }, + { + "type":"DeclareFunction", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":2},"end":{"line":7,"column":18}}, + "range":[309,325], + "value":" 3.3 L decl " + } + ], + "loc":{"source":null,"start":{"line":7,"column":19},"end":{"line":7,"column":48}}, + "range":[326,355], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":36},"end":{"line":7,"column":48}}, + "range":[343,355], + "name":"name", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":40},"end":{"line":7,"column":48}}, + "range":[347,355], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":40},"end":{"line":7,"column":48}}, + "range":[347,355], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":2},"end":{"line":8,"column":18}}, + "range":[358,374], + "value":" 3.4 T void " + } + ], + "loc":{"source":null,"start":{"line":7,"column":44},"end":{"line":7,"column":48}}, + "range":[351,355] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":15,"column":1}}, + "range":[378,531], + "body":[ + { + "type":"DeclareFunction", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":2},"end":{"line":12,"column":18}}, + "range":[382,398], + "value":" 4.1 L decl " + } + ], + "loc":{"source":null,"start":{"line":12,"column":19},"end":{"line":12,"column":56}}, + "range":[399,436], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":12,"column":36},"end":{"line":12,"column":48}}, + "range":[416,428], + "name":"name", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":12,"column":40},"end":{"line":12,"column":48}}, + "range":[420,428], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":12,"column":40},"end":{"line":12,"column":48}}, + "range":[420,428], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":12,"column":44},"end":{"line":12,"column":48}}, + "range":[424,428] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":{ + "type":"InferredPredicate", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":57},"end":{"line":12,"column":73}}, + "range":[437,453], + "value":" 4.2 T pred " + } + ], + "loc":{"source":null,"start":{"line":12,"column":49},"end":{"line":12,"column":56}}, + "range":[429,436] + } + }, + { + "type":"DeclareFunction", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":2},"end":{"line":13,"column":18}}, + "range":[456,472], + "value":" 4.3 L decl " + } + ], + "loc":{"source":null,"start":{"line":13,"column":19},"end":{"line":13,"column":56}}, + "range":[473,510], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":13,"column":36},"end":{"line":13,"column":48}}, + "range":[490,502], + "name":"name", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":13,"column":40},"end":{"line":13,"column":48}}, + "range":[494,502], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":13,"column":40},"end":{"line":13,"column":48}}, + "range":[494,502], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":13,"column":44},"end":{"line":13,"column":48}}, + "range":[498,502] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":{ + "type":"InferredPredicate", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":2},"end":{"line":14,"column":18}}, + "range":[513,529], + "value":" 4.4 T pred " + } + ], + "loc":{"source":null,"start":{"line":13,"column":49},"end":{"line":13,"column":56}}, + "range":[503,510] + } + } + ] + }, + { + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":17,"column":0},"end":{"line":19,"column":30}}, + "range":[533,645], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":21},"end":{"line":17,"column":35}}, + "range":[554,568], + "value":" 5.1 T id " + } + ], + "loc":{"source":null,"start":{"line":17,"column":17},"end":{"line":19,"column":29}}, + "range":[550,644], + "name":"Foo", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":18,"column":22},"end":{"line":19,"column":29}}, + "range":[591,644], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":2},"end":{"line":19,"column":20}}, + "range":[617,635], + "value":" 5.4 L params " + } + ], + "loc":{"source":null,"start":{"line":18,"column":22},"end":{"line":19,"column":29}}, + "range":[591,644], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":19,"column":25},"end":{"line":19,"column":29}}, + "range":[640,644] + }, + "rest":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":26},"end":{"line":18,"column":45}}, + "range":[595,614], + "value":" 5.3 T tparams " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":18,"column":21}}, + "range":[571,590], + "value":" 5.2 L tparams " + } + ], + "loc":{"source":null,"start":{"line":18,"column":22},"end":{"line":18,"column":25}}, + "range":[591,594], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":18,"column":23},"end":{"line":18,"column":24}}, + "range":[592,593], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + } + }, + "optional":false + }, + "predicate":null + }, + { + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":21,"column":0},"end":{"line":22,"column":27}}, + "range":[647,720], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":21,"column":17},"end":{"line":21,"column":28}}, + "range":[664,675], + "name":"Foo", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":21,"column":20},"end":{"line":21,"column":28}}, + "range":[667,675], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":21,"column":20},"end":{"line":21,"column":28}}, + "range":[667,675], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":29},"end":{"line":21,"column":45}}, + "range":[676,692], + "value":" 6.1 T void " + } + ], + "loc":{"source":null,"start":{"line":21,"column":24},"end":{"line":21,"column":28}}, + "range":[671,675] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":{ + "type":"InferredPredicate", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":2},"end":{"line":22,"column":18}}, + "range":[695,711], + "value":" 6.2 L pred " + } + ], + "loc":{"source":null,"start":{"line":22,"column":19},"end":{"line":22,"column":26}}, + "range":[712,719] + } + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "range":[0,19], + "value":" 1.1 func decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":47}}, + "range":[28,47], + "value":" 1.2 func decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":71},"end":{"line":1,"column":92}}, + "range":[71,92], + "value":" 1.3 T func decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":17},"end":{"line":3,"column":31}}, + "range":[111,125], + "value":" 2.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":37},"end":{"line":3,"column":56}}, + "range":[131,150], + "value":" 2.2 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":61},"end":{"line":3,"column":79}}, + "range":[155,173], + "value":" 2.3 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":83},"end":{"line":3,"column":101}}, + "range":[177,195], + "value":" 2.4 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":104},"end":{"line":3,"column":120}}, + "range":[198,214], + "value":" 2.5 T void " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":126},"end":{"line":3,"column":142}}, + "range":[220,236], + "value":" 2.6 T void " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":18}}, + "range":[243,259], + "value":" 3.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":49},"end":{"line":6,"column":65}}, + "range":[290,306], + "value":" 3.2 T void " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":2},"end":{"line":7,"column":18}}, + "range":[309,325], + "value":" 3.3 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":2},"end":{"line":8,"column":18}}, + "range":[358,374], + "value":" 3.4 T void " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":2},"end":{"line":12,"column":18}}, + "range":[382,398], + "value":" 4.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":57},"end":{"line":12,"column":73}}, + "range":[437,453], + "value":" 4.2 T pred " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":2},"end":{"line":13,"column":18}}, + "range":[456,472], + "value":" 4.3 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":2},"end":{"line":14,"column":18}}, + "range":[513,529], + "value":" 4.4 T pred " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":21},"end":{"line":17,"column":35}}, + "range":[554,568], + "value":" 5.1 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":18,"column":21}}, + "range":[571,590], + "value":" 5.2 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":26},"end":{"line":18,"column":45}}, + "range":[595,614], + "value":" 5.3 T tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":2},"end":{"line":19,"column":20}}, + "range":[617,635], + "value":" 5.4 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":29},"end":{"line":21,"column":45}}, + "range":[676,692], + "value":" 6.1 T void " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":2},"end":{"line":22,"column":18}}, + "range":[695,711], + "value":" 6.2 L pred " + } + ] +} diff --git a/lib/test/flow/comment_interning/declare_interface.js b/lib/test/flow/comment_interning/declare_interface.js new file mode 100644 index 0000000..7c02e6b --- /dev/null +++ b/lib/test/flow/comment_interning/declare_interface.js @@ -0,0 +1,7 @@ +/* 1.1 L interface */ declare /* 1.2 L interface */ interface Foo {} /* 1.3 T obj type */ + +{ + /* 2.1 L interface */ declare interface Foo {} /* 2.2 T obj type */ + /* 2.3 L interface */ declare interface Foo {} + /* 2.4 T obj type */ +} diff --git a/lib/test/flow/comment_interning/declare_interface.options.json b/lib/test/flow/comment_interning/declare_interface.options.json new file mode 100644 index 0000000..b202fd5 --- /dev/null +++ b/lib/test/flow/comment_interning/declare_interface.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/declare_interface.tree.json b/lib/test/flow/comment_interning/declare_interface.tree.json new file mode 100644 index 0000000..11f8eb7 --- /dev/null +++ b/lib/test/flow/comment_interning/declare_interface.tree.json @@ -0,0 +1,187 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":7,"column":1}}, + "range":[22,236], + "body":[ + { + "type":"DeclareInterface", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "value":" 1.1 L interface " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":51}}, + "range":[30,51], + "value":" 1.2 L interface " + } + ], + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":68}}, + "range":[22,68], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":62},"end":{"line":1,"column":65}}, + "range":[62,65], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":69},"end":{"line":1,"column":89}}, + "range":[69,89], + "value":" 1.3 T obj type " + } + ], + "loc":{"source":null,"start":{"line":1,"column":66},"end":{"line":1,"column":68}}, + "range":[66,68], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":7,"column":1}}, + "range":[91,236], + "body":[ + { + "type":"DeclareInterface", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":23}}, + "range":[95,116], + "value":" 2.1 L interface " + } + ], + "loc":{"source":null,"start":{"line":4,"column":24},"end":{"line":4,"column":48}}, + "range":[117,141], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":42},"end":{"line":4,"column":45}}, + "range":[135,138], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":49},"end":{"line":4,"column":69}}, + "range":[142,162], + "value":" 2.2 T obj type " + } + ], + "loc":{"source":null,"start":{"line":4,"column":46},"end":{"line":4,"column":48}}, + "range":[139,141], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + }, + { + "type":"DeclareInterface", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":2},"end":{"line":5,"column":23}}, + "range":[165,186], + "value":" 2.3 L interface " + } + ], + "loc":{"source":null,"start":{"line":5,"column":24},"end":{"line":5,"column":48}}, + "range":[187,211], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":42},"end":{"line":5,"column":45}}, + "range":[205,208], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":22}}, + "range":[214,234], + "value":" 2.4 T obj type " + } + ], + "loc":{"source":null,"start":{"line":5,"column":46},"end":{"line":5,"column":48}}, + "range":[209,211], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + } + ] + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "value":" 1.1 L interface " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":51}}, + "range":[30,51], + "value":" 1.2 L interface " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":69},"end":{"line":1,"column":89}}, + "range":[69,89], + "value":" 1.3 T obj type " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":23}}, + "range":[95,116], + "value":" 2.1 L interface " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":49},"end":{"line":4,"column":69}}, + "range":[142,162], + "value":" 2.2 T obj type " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":2},"end":{"line":5,"column":23}}, + "range":[165,186], + "value":" 2.3 L interface " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":22}}, + "range":[214,234], + "value":" 2.4 T obj type " + } + ] +} diff --git a/lib/test/flow/comment_interning/declare_module.js b/lib/test/flow/comment_interning/declare_module.js new file mode 100644 index 0000000..d54c7d1 --- /dev/null +++ b/lib/test/flow/comment_interning/declare_module.js @@ -0,0 +1,15 @@ +/* 1.1 L decl mod */ declare /* 1.2 L decl mod */ module /* 1.3 L id */ Foo /* 1.4 L block */ {} /* 1.5 T block */ + +{ + /* 2.1 L decl */ declare module Foo {} /* 2.2 T block */ + /* 2.3 L decl */ declare module Foo {} + /* 2.4 T block */ +} + +declare module Foo /* 3.1 T id */ + /* 3.2 L block */ {} + +declare module "Foo" /* 4.1 T str */ + /* 4.2 L block */ {} + +declare module Foo { /* 5.1 I block */ } diff --git a/lib/test/flow/comment_interning/declare_module.options.json b/lib/test/flow/comment_interning/declare_module.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/declare_module.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/declare_module.tree.json b/lib/test/flow/comment_interning/declare_module.tree.json new file mode 100644 index 0000000..226f81c --- /dev/null +++ b/lib/test/flow/comment_interning/declare_module.tree.json @@ -0,0 +1,329 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":15,"column":40}}, + "range":[21,400], + "body":[ + { + "type":"DeclareModule", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "value":" 1.1 L decl mod " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":49}}, + "range":[29,49], + "value":" 1.2 L decl mod " + } + ], + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":96}}, + "range":[21,96], + "id":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":57},"end":{"line":1,"column":71}}, + "range":[57,71], + "value":" 1.3 L id " + } + ], + "loc":{"source":null,"start":{"line":1,"column":72},"end":{"line":1,"column":75}}, + "range":[72,75], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":97},"end":{"line":1,"column":114}}, + "range":[97,114], + "value":" 1.5 T block " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":76},"end":{"line":1,"column":93}}, + "range":[76,93], + "value":" 1.4 L block " + } + ], + "loc":{"source":null,"start":{"line":1,"column":94},"end":{"line":1,"column":96}}, + "range":[94,96], + "body":[] + }, + "kind":"CommonJS" + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":7,"column":1}}, + "range":[116,239], + "body":[ + { + "type":"DeclareModule", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":18}}, + "range":[120,136], + "value":" 2.1 L decl " + } + ], + "loc":{"source":null,"start":{"line":4,"column":19},"end":{"line":4,"column":40}}, + "range":[137,158], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":34},"end":{"line":4,"column":37}}, + "range":[152,155], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":41},"end":{"line":4,"column":58}}, + "range":[159,176], + "value":" 2.2 T block " + } + ], + "loc":{"source":null,"start":{"line":4,"column":38},"end":{"line":4,"column":40}}, + "range":[156,158], + "body":[] + }, + "kind":"CommonJS" + }, + { + "type":"DeclareModule", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":2},"end":{"line":5,"column":18}}, + "range":[179,195], + "value":" 2.3 L decl " + } + ], + "loc":{"source":null,"start":{"line":5,"column":19},"end":{"line":5,"column":40}}, + "range":[196,217], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":34},"end":{"line":5,"column":37}}, + "range":[211,214], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":19}}, + "range":[220,237], + "value":" 2.4 T block " + } + ], + "loc":{"source":null,"start":{"line":5,"column":38},"end":{"line":5,"column":40}}, + "range":[215,217], + "body":[] + }, + "kind":"CommonJS" + } + ] + }, + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":10,"column":22}}, + "range":[241,297], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":19},"end":{"line":9,"column":33}}, + "range":[260,274], + "value":" 3.1 T id " + } + ], + "loc":{"source":null,"start":{"line":9,"column":15},"end":{"line":9,"column":18}}, + "range":[256,259], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":2},"end":{"line":10,"column":19}}, + "range":[277,294], + "value":" 3.2 L block " + } + ], + "loc":{"source":null,"start":{"line":10,"column":20},"end":{"line":10,"column":22}}, + "range":[295,297], + "body":[] + }, + "kind":"CommonJS" + }, + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":12,"column":0},"end":{"line":13,"column":22}}, + "range":[299,358], + "id":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":21},"end":{"line":12,"column":36}}, + "range":[320,335], + "value":" 4.1 T str " + } + ], + "loc":{"source":null,"start":{"line":12,"column":15},"end":{"line":12,"column":20}}, + "range":[314,319], + "value":"Foo", + "raw":"\"Foo\"" + }, + "body":{ + "type":"BlockStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":2},"end":{"line":13,"column":19}}, + "range":[338,355], + "value":" 4.2 L block " + } + ], + "loc":{"source":null,"start":{"line":13,"column":20},"end":{"line":13,"column":22}}, + "range":[356,358], + "body":[] + }, + "kind":"CommonJS" + }, + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":15,"column":0},"end":{"line":15,"column":40}}, + "range":[360,400], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":15,"column":15},"end":{"line":15,"column":18}}, + "range":[375,378], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":21},"end":{"line":15,"column":38}}, + "range":[381,398], + "value":" 5.1 I block " + } + ], + "loc":{"source":null,"start":{"line":15,"column":19},"end":{"line":15,"column":40}}, + "range":[379,400], + "body":[] + }, + "kind":"CommonJS" + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "value":" 1.1 L decl mod " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":49}}, + "range":[29,49], + "value":" 1.2 L decl mod " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":57},"end":{"line":1,"column":71}}, + "range":[57,71], + "value":" 1.3 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":76},"end":{"line":1,"column":93}}, + "range":[76,93], + "value":" 1.4 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":97},"end":{"line":1,"column":114}}, + "range":[97,114], + "value":" 1.5 T block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":18}}, + "range":[120,136], + "value":" 2.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":41},"end":{"line":4,"column":58}}, + "range":[159,176], + "value":" 2.2 T block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":2},"end":{"line":5,"column":18}}, + "range":[179,195], + "value":" 2.3 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":19}}, + "range":[220,237], + "value":" 2.4 T block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":19},"end":{"line":9,"column":33}}, + "range":[260,274], + "value":" 3.1 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":2},"end":{"line":10,"column":19}}, + "range":[277,294], + "value":" 3.2 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":21},"end":{"line":12,"column":36}}, + "range":[320,335], + "value":" 4.1 T str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":2},"end":{"line":13,"column":19}}, + "range":[338,355], + "value":" 4.2 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":21},"end":{"line":15,"column":38}}, + "range":[381,398], + "value":" 5.1 I block " + } + ] +} diff --git a/lib/test/flow/comment_interning/declare_module_exports.js b/lib/test/flow/comment_interning/declare_module_exports.js new file mode 100644 index 0000000..410cbdd --- /dev/null +++ b/lib/test/flow/comment_interning/declare_module_exports.js @@ -0,0 +1,7 @@ +/* 1.1 L export */ declare /* 1.2 L export */ module /* 1.3 L export */ . /* 1.4 L export */ exports /* 1.5 L export */ : /* 1.6 L any */ any /* 1.7 T any */ ; /* 1.8 T exports */ + +{ + /* 2.1 L export */ declare module.exports: any /* 2.2 T any */ + /* 2.3 L export */ declare module.exports: any + /* 2.4 T any */ +} diff --git a/lib/test/flow/comment_interning/declare_module_exports.options.json b/lib/test/flow/comment_interning/declare_module_exports.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/declare_module_exports.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/declare_module_exports.tree.json b/lib/test/flow/comment_interning/declare_module_exports.tree.json new file mode 100644 index 0000000..f919927 --- /dev/null +++ b/lib/test/flow/comment_interning/declare_module_exports.tree.json @@ -0,0 +1,221 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":7,"column":1}}, + "range":[19,316], + "body":[ + { + "type":"DeclareModuleExports", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":160},"end":{"line":1,"column":179}}, + "range":[160,179], + "value":" 1.8 T exports " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "value":" 1.1 L export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":45}}, + "range":[27,45], + "value":" 1.2 L export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":53},"end":{"line":1,"column":71}}, + "range":[53,71], + "value":" 1.3 L export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":74},"end":{"line":1,"column":92}}, + "range":[74,92], + "value":" 1.4 L export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":101},"end":{"line":1,"column":119}}, + "range":[101,119], + "value":" 1.5 L export " + } + ], + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":159}}, + "range":[19,159], + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":120},"end":{"line":1,"column":141}}, + "range":[120,141], + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":142},"end":{"line":1,"column":157}}, + "range":[142,157], + "value":" 1.7 T any " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":122},"end":{"line":1,"column":137}}, + "range":[122,137], + "value":" 1.6 L any " + } + ], + "loc":{"source":null,"start":{"line":1,"column":138},"end":{"line":1,"column":141}}, + "range":[138,141] + } + } + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":7,"column":1}}, + "range":[181,316], + "body":[ + { + "type":"DeclareModuleExports", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":20}}, + "range":[185,203], + "value":" 2.1 L export " + } + ], + "loc":{"source":null,"start":{"line":4,"column":21},"end":{"line":4,"column":48}}, + "range":[204,231], + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":43},"end":{"line":4,"column":48}}, + "range":[226,231], + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":49},"end":{"line":4,"column":64}}, + "range":[232,247], + "value":" 2.2 T any " + } + ], + "loc":{"source":null,"start":{"line":4,"column":45},"end":{"line":4,"column":48}}, + "range":[228,231] + } + } + }, + { + "type":"DeclareModuleExports", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":2},"end":{"line":5,"column":20}}, + "range":[250,268], + "value":" 2.3 L export " + } + ], + "loc":{"source":null,"start":{"line":5,"column":21},"end":{"line":5,"column":48}}, + "range":[269,296], + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":43},"end":{"line":5,"column":48}}, + "range":[291,296], + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":17}}, + "range":[299,314], + "value":" 2.4 T any " + } + ], + "loc":{"source":null,"start":{"line":5,"column":45},"end":{"line":5,"column":48}}, + "range":[293,296] + } + } + } + ] + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "value":" 1.1 L export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":45}}, + "range":[27,45], + "value":" 1.2 L export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":53},"end":{"line":1,"column":71}}, + "range":[53,71], + "value":" 1.3 L export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":74},"end":{"line":1,"column":92}}, + "range":[74,92], + "value":" 1.4 L export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":101},"end":{"line":1,"column":119}}, + "range":[101,119], + "value":" 1.5 L export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":122},"end":{"line":1,"column":137}}, + "range":[122,137], + "value":" 1.6 L any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":142},"end":{"line":1,"column":157}}, + "range":[142,157], + "value":" 1.7 T any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":160},"end":{"line":1,"column":179}}, + "range":[160,179], + "value":" 1.8 T exports " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":20}}, + "range":[185,203], + "value":" 2.1 L export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":49},"end":{"line":4,"column":64}}, + "range":[232,247], + "value":" 2.2 T any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":2},"end":{"line":5,"column":20}}, + "range":[250,268], + "value":" 2.3 L export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":17}}, + "range":[299,314], + "value":" 2.4 T any " + } + ] +} diff --git a/lib/test/flow/comment_interning/declare_type_alias.js b/lib/test/flow/comment_interning/declare_type_alias.js new file mode 100644 index 0000000..81432df --- /dev/null +++ b/lib/test/flow/comment_interning/declare_type_alias.js @@ -0,0 +1,27 @@ +/* 1.1 L alias */ declare /* 1.2 L alias */ type T = any; /* 1.3 T alias */ + +/* 2.1 L opaque */ declare /* 2.2 L opaque */ opaque type T; /* 2.3 T opaque */ + +{ + /* 3.1 L alias */ declare type T = any /* 3.2 T any */ + /* 3.3 L alias */ declare type T = any + /* 3.4 T any */ +} + +{ + /* 4.1 L alias */ declare opaque type T /* 4.2 T id */ + /* 4.3 L alias */ declare opaque type T + /* 4.4 T id */ +} + +{ + /* 5.1 L alias */ declare opaque type T /* 5.2 T tparams */ + /* 5.3 L alias */ declare opaque type T + /* 5.4 T tparams */ +} + +{ + /* 6.1 L alias */ declare opaque type T: Foo /* 6.2 T id */ + /* 6.3 L alias */ declare opaque type T: Foo + /* 6.4 T id */ +} diff --git a/lib/test/flow/comment_interning/declare_type_alias.options.json b/lib/test/flow/comment_interning/declare_type_alias.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/declare_type_alias.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/declare_type_alias.tree.json b/lib/test/flow/comment_interning/declare_type_alias.tree.json new file mode 100644 index 0000000..4c81ddd --- /dev/null +++ b/lib/test/flow/comment_interning/declare_type_alias.tree.json @@ -0,0 +1,566 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":27,"column":1}}, + "range":[18,666], + "body":[ + { + "type":"DeclareTypeAlias", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":58},"end":{"line":1,"column":75}}, + "range":[58,75], + "value":" 1.3 T alias " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "value":" 1.1 L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":43}}, + "range":[26,43], + "value":" 1.2 L alias " + } + ], + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":57}}, + "range":[18,57], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":49},"end":{"line":1,"column":50}}, + "range":[49,50], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":53},"end":{"line":1,"column":56}}, + "range":[53,56] + } + }, + { + "type":"DeclareOpaqueType", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":61},"end":{"line":3,"column":79}}, + "range":[138,156], + "value":" 2.3 T opaque " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":18}}, + "range":[77,95], + "value":" 2.1 L opaque " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":27},"end":{"line":3,"column":45}}, + "range":[104,122], + "value":" 2.2 L opaque " + } + ], + "loc":{"source":null,"start":{"line":3,"column":19},"end":{"line":3,"column":60}}, + "range":[96,137], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":58},"end":{"line":3,"column":59}}, + "range":[135,136], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "impltype":null, + "supertype":null + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":9,"column":1}}, + "range":[158,277], + "body":[ + { + "type":"DeclareTypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":19}}, + "range":[162,179], + "value":" 3.1 L alias " + } + ], + "loc":{"source":null,"start":{"line":6,"column":20},"end":{"line":6,"column":40}}, + "range":[180,200], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":33},"end":{"line":6,"column":34}}, + "range":[193,194], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":41},"end":{"line":6,"column":56}}, + "range":[201,216], + "value":" 3.2 T any " + } + ], + "loc":{"source":null,"start":{"line":6,"column":37},"end":{"line":6,"column":40}}, + "range":[197,200] + } + }, + { + "type":"DeclareTypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":2},"end":{"line":7,"column":19}}, + "range":[219,236], + "value":" 3.3 L alias " + } + ], + "loc":{"source":null,"start":{"line":7,"column":20},"end":{"line":7,"column":40}}, + "range":[237,257], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":33},"end":{"line":7,"column":34}}, + "range":[250,251], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":2},"end":{"line":8,"column":17}}, + "range":[260,275], + "value":" 3.4 T any " + } + ], + "loc":{"source":null,"start":{"line":7,"column":37},"end":{"line":7,"column":40}}, + "range":[254,257] + } + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":15,"column":1}}, + "range":[279,398], + "body":[ + { + "type":"DeclareOpaqueType", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":2},"end":{"line":12,"column":19}}, + "range":[283,300], + "value":" 4.1 L alias " + } + ], + "loc":{"source":null,"start":{"line":12,"column":20},"end":{"line":12,"column":41}}, + "range":[301,322], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":42},"end":{"line":12,"column":56}}, + "range":[323,337], + "value":" 4.2 T id " + } + ], + "loc":{"source":null,"start":{"line":12,"column":40},"end":{"line":12,"column":41}}, + "range":[321,322], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "impltype":null, + "supertype":null + }, + { + "type":"DeclareOpaqueType", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":2},"end":{"line":13,"column":19}}, + "range":[340,357], + "value":" 4.3 L alias " + } + ], + "loc":{"source":null,"start":{"line":13,"column":20},"end":{"line":13,"column":41}}, + "range":[358,379], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":2},"end":{"line":14,"column":16}}, + "range":[382,396], + "value":" 4.4 T id " + } + ], + "loc":{"source":null,"start":{"line":13,"column":40},"end":{"line":13,"column":41}}, + "range":[378,379], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "impltype":null, + "supertype":null + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":17,"column":0},"end":{"line":21,"column":1}}, + "range":[400,535], + "body":[ + { + "type":"DeclareOpaqueType", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":18,"column":19}}, + "range":[404,421], + "value":" 5.1 L alias " + } + ], + "loc":{"source":null,"start":{"line":18,"column":20},"end":{"line":18,"column":44}}, + "range":[422,446], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":18,"column":40},"end":{"line":18,"column":41}}, + "range":[442,443], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":45},"end":{"line":18,"column":64}}, + "range":[447,466], + "value":" 5.2 T tparams " + } + ], + "loc":{"source":null,"start":{"line":18,"column":41},"end":{"line":18,"column":44}}, + "range":[443,446], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":18,"column":42},"end":{"line":18,"column":43}}, + "range":[444,445], + "name":"U", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "impltype":null, + "supertype":null + }, + { + "type":"DeclareOpaqueType", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":2},"end":{"line":19,"column":19}}, + "range":[469,486], + "value":" 5.3 L alias " + } + ], + "loc":{"source":null,"start":{"line":19,"column":20},"end":{"line":19,"column":44}}, + "range":[487,511], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":19,"column":40},"end":{"line":19,"column":41}}, + "range":[507,508], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":2},"end":{"line":20,"column":21}}, + "range":[514,533], + "value":" 5.4 T tparams " + } + ], + "loc":{"source":null,"start":{"line":19,"column":41},"end":{"line":19,"column":44}}, + "range":[508,511], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":19,"column":42},"end":{"line":19,"column":43}}, + "range":[509,510], + "name":"U", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "impltype":null, + "supertype":null + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":23,"column":0},"end":{"line":27,"column":1}}, + "range":[537,666], + "body":[ + { + "type":"DeclareOpaqueType", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":2},"end":{"line":24,"column":19}}, + "range":[541,558], + "value":" 6.1 L alias " + } + ], + "loc":{"source":null,"start":{"line":24,"column":20},"end":{"line":24,"column":46}}, + "range":[559,585], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":24,"column":40},"end":{"line":24,"column":41}}, + "range":[579,580], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "impltype":null, + "supertype":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":24,"column":43},"end":{"line":24,"column":46}}, + "range":[582,585], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":47},"end":{"line":24,"column":61}}, + "range":[586,600], + "value":" 6.2 T id " + } + ], + "loc":{"source":null,"start":{"line":24,"column":43},"end":{"line":24,"column":46}}, + "range":[582,585], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + { + "type":"DeclareOpaqueType", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":2},"end":{"line":25,"column":19}}, + "range":[603,620], + "value":" 6.3 L alias " + } + ], + "loc":{"source":null,"start":{"line":25,"column":20},"end":{"line":25,"column":46}}, + "range":[621,647], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":25,"column":40},"end":{"line":25,"column":41}}, + "range":[641,642], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "impltype":null, + "supertype":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":25,"column":43},"end":{"line":25,"column":46}}, + "range":[644,647], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":2},"end":{"line":26,"column":16}}, + "range":[650,664], + "value":" 6.4 T id " + } + ], + "loc":{"source":null,"start":{"line":25,"column":43},"end":{"line":25,"column":46}}, + "range":[644,647], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + ] + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "value":" 1.1 L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":43}}, + "range":[26,43], + "value":" 1.2 L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":58},"end":{"line":1,"column":75}}, + "range":[58,75], + "value":" 1.3 T alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":18}}, + "range":[77,95], + "value":" 2.1 L opaque " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":27},"end":{"line":3,"column":45}}, + "range":[104,122], + "value":" 2.2 L opaque " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":61},"end":{"line":3,"column":79}}, + "range":[138,156], + "value":" 2.3 T opaque " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":19}}, + "range":[162,179], + "value":" 3.1 L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":41},"end":{"line":6,"column":56}}, + "range":[201,216], + "value":" 3.2 T any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":2},"end":{"line":7,"column":19}}, + "range":[219,236], + "value":" 3.3 L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":2},"end":{"line":8,"column":17}}, + "range":[260,275], + "value":" 3.4 T any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":2},"end":{"line":12,"column":19}}, + "range":[283,300], + "value":" 4.1 L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":42},"end":{"line":12,"column":56}}, + "range":[323,337], + "value":" 4.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":2},"end":{"line":13,"column":19}}, + "range":[340,357], + "value":" 4.3 L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":2},"end":{"line":14,"column":16}}, + "range":[382,396], + "value":" 4.4 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":18,"column":19}}, + "range":[404,421], + "value":" 5.1 L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":45},"end":{"line":18,"column":64}}, + "range":[447,466], + "value":" 5.2 T tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":2},"end":{"line":19,"column":19}}, + "range":[469,486], + "value":" 5.3 L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":2},"end":{"line":20,"column":21}}, + "range":[514,533], + "value":" 5.4 T tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":2},"end":{"line":24,"column":19}}, + "range":[541,558], + "value":" 6.1 L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":47},"end":{"line":24,"column":61}}, + "range":[586,600], + "value":" 6.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":2},"end":{"line":25,"column":19}}, + "range":[603,620], + "value":" 6.3 L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":2},"end":{"line":26,"column":16}}, + "range":[650,664], + "value":" 6.4 T id " + } + ] +} diff --git a/lib/test/flow/comment_interning/declare_variable.js b/lib/test/flow/comment_interning/declare_variable.js new file mode 100644 index 0000000..59dc2e9 --- /dev/null +++ b/lib/test/flow/comment_interning/declare_variable.js @@ -0,0 +1,13 @@ +/* 1.1 L decl var */ declare /* 1.2 L decl var */ var /* 1.3 L id */ x /* 1.4 T id */ : /* 1.5 L mixed */ mixed /* 1.6 T mixed */ ; /* 1.7 T decl var */ + +{ + /* 2.1 L decl */ declare var name: mixed /* 2.2 T mixed */ + /* 2.3 L decl */ declare var name: mixed + /* 2.4 T mixed */ +} + +{ + /* 3.1 L decl */ declare var name /* 3.2 T id */ + /* 3.3 L decl */ declare var name + /* 3.4 T id */ +} diff --git a/lib/test/flow/comment_interning/declare_variable.options.json b/lib/test/flow/comment_interning/declare_variable.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/declare_variable.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/declare_variable.tree.json b/lib/test/flow/comment_interning/declare_variable.tree.json new file mode 100644 index 0000000..3ef6380 --- /dev/null +++ b/lib/test/flow/comment_interning/declare_variable.tree.json @@ -0,0 +1,323 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":13,"column":1}}, + "range":[21,390], + "body":[ + { + "type":"DeclareVariable", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":132},"end":{"line":1,"column":152}}, + "range":[132,152], + "value":" 1.7 T decl var " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "value":" 1.1 L decl var " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":49}}, + "range":[29,49], + "value":" 1.2 L decl var " + } + ], + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":131}}, + "range":[21,131], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":71},"end":{"line":1,"column":85}}, + "range":[71,85], + "value":" 1.4 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":54},"end":{"line":1,"column":68}}, + "range":[54,68], + "value":" 1.3 L id " + } + ], + "loc":{"source":null,"start":{"line":1,"column":69},"end":{"line":1,"column":111}}, + "range":[69,111], + "name":"x", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":86},"end":{"line":1,"column":111}}, + "range":[86,111], + "typeAnnotation":{ + "type":"MixedTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":112},"end":{"line":1,"column":129}}, + "range":[112,129], + "value":" 1.6 T mixed " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":88},"end":{"line":1,"column":105}}, + "range":[88,105], + "value":" 1.5 L mixed " + } + ], + "loc":{"source":null,"start":{"line":1,"column":106},"end":{"line":1,"column":111}}, + "range":[106,111] + } + }, + "optional":false + } + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":7,"column":1}}, + "range":[154,281], + "body":[ + { + "type":"DeclareVariable", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":18}}, + "range":[158,174], + "value":" 2.1 L decl " + } + ], + "loc":{"source":null,"start":{"line":4,"column":19},"end":{"line":4,"column":42}}, + "range":[175,198], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":31},"end":{"line":4,"column":42}}, + "range":[187,198], + "name":"name", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":35},"end":{"line":4,"column":42}}, + "range":[191,198], + "typeAnnotation":{ + "type":"MixedTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":43},"end":{"line":4,"column":60}}, + "range":[199,216], + "value":" 2.2 T mixed " + } + ], + "loc":{"source":null,"start":{"line":4,"column":37},"end":{"line":4,"column":42}}, + "range":[193,198] + } + }, + "optional":false + } + }, + { + "type":"DeclareVariable", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":2},"end":{"line":5,"column":18}}, + "range":[219,235], + "value":" 2.3 L decl " + } + ], + "loc":{"source":null,"start":{"line":5,"column":19},"end":{"line":5,"column":42}}, + "range":[236,259], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":31},"end":{"line":5,"column":42}}, + "range":[248,259], + "name":"name", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":35},"end":{"line":5,"column":42}}, + "range":[252,259], + "typeAnnotation":{ + "type":"MixedTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":19}}, + "range":[262,279], + "value":" 2.4 T mixed " + } + ], + "loc":{"source":null,"start":{"line":5,"column":37},"end":{"line":5,"column":42}}, + "range":[254,259] + } + }, + "optional":false + } + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":13,"column":1}}, + "range":[283,390], + "body":[ + { + "type":"DeclareVariable", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":2},"end":{"line":10,"column":18}}, + "range":[287,303], + "value":" 3.1 L decl " + } + ], + "loc":{"source":null,"start":{"line":10,"column":19},"end":{"line":10,"column":35}}, + "range":[304,320], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":36},"end":{"line":10,"column":50}}, + "range":[321,335], + "value":" 3.2 T id " + } + ], + "loc":{"source":null,"start":{"line":10,"column":31},"end":{"line":10,"column":35}}, + "range":[316,320], + "name":"name", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"DeclareVariable", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":2},"end":{"line":11,"column":18}}, + "range":[338,354], + "value":" 3.3 L decl " + } + ], + "loc":{"source":null,"start":{"line":11,"column":19},"end":{"line":11,"column":35}}, + "range":[355,371], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":2},"end":{"line":12,"column":16}}, + "range":[374,388], + "value":" 3.4 T id " + } + ], + "loc":{"source":null,"start":{"line":11,"column":31},"end":{"line":11,"column":35}}, + "range":[367,371], + "name":"name", + "typeAnnotation":null, + "optional":false + } + } + ] + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "value":" 1.1 L decl var " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":49}}, + "range":[29,49], + "value":" 1.2 L decl var " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":54},"end":{"line":1,"column":68}}, + "range":[54,68], + "value":" 1.3 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":71},"end":{"line":1,"column":85}}, + "range":[71,85], + "value":" 1.4 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":88},"end":{"line":1,"column":105}}, + "range":[88,105], + "value":" 1.5 L mixed " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":112},"end":{"line":1,"column":129}}, + "range":[112,129], + "value":" 1.6 T mixed " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":132},"end":{"line":1,"column":152}}, + "range":[132,152], + "value":" 1.7 T decl var " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":18}}, + "range":[158,174], + "value":" 2.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":43},"end":{"line":4,"column":60}}, + "range":[199,216], + "value":" 2.2 T mixed " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":2},"end":{"line":5,"column":18}}, + "range":[219,235], + "value":" 2.3 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":19}}, + "range":[262,279], + "value":" 2.4 T mixed " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":2},"end":{"line":10,"column":18}}, + "range":[287,303], + "value":" 3.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":36},"end":{"line":10,"column":50}}, + "range":[321,335], + "value":" 3.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":2},"end":{"line":11,"column":18}}, + "range":[338,354], + "value":" 3.3 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":2},"end":{"line":12,"column":16}}, + "range":[374,388], + "value":" 3.4 T id " + } + ] +} diff --git a/lib/test/flow/comment_interning/decorator.js b/lib/test/flow/comment_interning/decorator.js new file mode 100644 index 0000000..dac6423 --- /dev/null +++ b/lib/test/flow/comment_interning/decorator.js @@ -0,0 +1,14 @@ +/* 1.1 L decorator */ @foo() /* 1.2 T args */ +/* 1.3 L decorator */ @bar() /* 1.4 T args */ +/* 1.5 L class */ class C {} + +/* 2.1 L decorator */ @foo() /* 2.2 L decorator */ @bar() /* 2.3 L class */ class C {} + +class C { + /* 3.1 L decorator */ @foo() /* 3.2 T args */ + /* 3.3 L id */ method(){} +} + +class C { + /* 4.1 L decorator */ @foo() /* 4.2 L decorator */ @bar() /* 4.3 L id */ method(){} +} diff --git a/lib/test/flow/comment_interning/decorator.options.json b/lib/test/flow/comment_interning/decorator.options.json new file mode 100644 index 0000000..21e5817 --- /dev/null +++ b/lib/test/flow/comment_interning/decorator.options.json @@ -0,0 +1,4 @@ +{ + "intern_comments": true, + "esproposal_decorators": true +} diff --git a/lib/test/flow/comment_interning/decorator.tree.json b/lib/test/flow/comment_interning/decorator.tree.json new file mode 100644 index 0000000..1896af3 --- /dev/null +++ b/lib/test/flow/comment_interning/decorator.tree.json @@ -0,0 +1,519 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":3,"column":18},"end":{"line":14,"column":1}}, + "range":[110,396], + "body":[ + { + "type":"ClassDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":17}}, + "range":[92,109], + "value":" 1.5 L class " + } + ], + "loc":{"source":null,"start":{"line":3,"column":18},"end":{"line":3,"column":28}}, + "range":[110,120], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":24},"end":{"line":3,"column":25}}, + "range":[116,117], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":3,"column":26},"end":{"line":3,"column":28}}, + "range":[118,120], + "body":[] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[ + { + "type":"Decorator", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "value":" 1.1 L decorator " + } + ], + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":28}}, + "range":[22,28], + "expression":{ + "type":"CallExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":45}}, + "range":[29,45], + "value":" 1.2 T args " + } + ], + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":28}}, + "range":[23,28], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":26}}, + "range":[23,26], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[] + } + }, + { + "type":"Decorator", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":21}}, + "range":[46,67], + "value":" 1.3 L decorator " + } + ], + "loc":{"source":null,"start":{"line":2,"column":22},"end":{"line":2,"column":28}}, + "range":[68,74], + "expression":{ + "type":"CallExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":29},"end":{"line":2,"column":45}}, + "range":[75,91], + "value":" 1.4 T args " + } + ], + "loc":{"source":null,"start":{"line":2,"column":23},"end":{"line":2,"column":28}}, + "range":[69,74], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":23},"end":{"line":2,"column":26}}, + "range":[69,72], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[] + } + } + ] + }, + { + "type":"ClassDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":58},"end":{"line":5,"column":75}}, + "range":[180,197], + "value":" 2.3 L class " + } + ], + "loc":{"source":null,"start":{"line":5,"column":76},"end":{"line":5,"column":86}}, + "range":[198,208], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":82},"end":{"line":5,"column":83}}, + "range":[204,205], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":5,"column":84},"end":{"line":5,"column":86}}, + "range":[206,208], + "body":[] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[ + { + "type":"Decorator", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":21}}, + "range":[122,143], + "value":" 2.1 L decorator " + } + ], + "loc":{"source":null,"start":{"line":5,"column":22},"end":{"line":5,"column":28}}, + "range":[144,150], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":5,"column":23},"end":{"line":5,"column":28}}, + "range":[145,150], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":23},"end":{"line":5,"column":26}}, + "range":[145,148], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[] + } + }, + { + "type":"Decorator", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":29},"end":{"line":5,"column":50}}, + "range":[151,172], + "value":" 2.2 L decorator " + } + ], + "loc":{"source":null,"start":{"line":5,"column":51},"end":{"line":5,"column":57}}, + "range":[173,179], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":5,"column":52},"end":{"line":5,"column":57}}, + "range":[174,179], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":52},"end":{"line":5,"column":55}}, + "range":[174,177], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[] + } + } + ] + }, + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":10,"column":1}}, + "range":[210,297], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":6},"end":{"line":7,"column":7}}, + "range":[216,217], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":7,"column":8},"end":{"line":10,"column":1}}, + "range":[218,297], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":8,"column":24},"end":{"line":9,"column":27}}, + "range":[244,295], + "key":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":2},"end":{"line":9,"column":16}}, + "range":[270,284], + "value":" 3.3 L id " + } + ], + "loc":{"source":null,"start":{"line":9,"column":17},"end":{"line":9,"column":23}}, + "range":[285,291], + "name":"method", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":9,"column":23},"end":{"line":9,"column":27}}, + "range":[291,295], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":9,"column":25},"end":{"line":9,"column":27}}, + "range":[293,295], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[ + { + "type":"Decorator", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":2},"end":{"line":8,"column":23}}, + "range":[222,243], + "value":" 3.1 L decorator " + } + ], + "loc":{"source":null,"start":{"line":8,"column":24},"end":{"line":8,"column":30}}, + "range":[244,250], + "expression":{ + "type":"CallExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":31},"end":{"line":8,"column":47}}, + "range":[251,267], + "value":" 3.2 T args " + } + ], + "loc":{"source":null,"start":{"line":8,"column":25},"end":{"line":8,"column":30}}, + "range":[245,250], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":8,"column":25},"end":{"line":8,"column":28}}, + "range":[245,248], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[] + } + } + ] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":12,"column":0},"end":{"line":14,"column":1}}, + "range":[299,396], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":12,"column":6},"end":{"line":12,"column":7}}, + "range":[305,306], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":12,"column":8},"end":{"line":14,"column":1}}, + "range":[307,396], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":13,"column":24},"end":{"line":13,"column":85}}, + "range":[333,394], + "key":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":60},"end":{"line":13,"column":74}}, + "range":[369,383], + "value":" 4.3 L id " + } + ], + "loc":{"source":null,"start":{"line":13,"column":75},"end":{"line":13,"column":81}}, + "range":[384,390], + "name":"method", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":13,"column":81},"end":{"line":13,"column":85}}, + "range":[390,394], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":13,"column":83},"end":{"line":13,"column":85}}, + "range":[392,394], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[ + { + "type":"Decorator", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":2},"end":{"line":13,"column":23}}, + "range":[311,332], + "value":" 4.1 L decorator " + } + ], + "loc":{"source":null,"start":{"line":13,"column":24},"end":{"line":13,"column":30}}, + "range":[333,339], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":13,"column":25},"end":{"line":13,"column":30}}, + "range":[334,339], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":13,"column":25},"end":{"line":13,"column":28}}, + "range":[334,337], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[] + } + }, + { + "type":"Decorator", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":31},"end":{"line":13,"column":52}}, + "range":[340,361], + "value":" 4.2 L decorator " + } + ], + "loc":{"source":null,"start":{"line":13,"column":53},"end":{"line":13,"column":59}}, + "range":[362,368], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":13,"column":54},"end":{"line":13,"column":59}}, + "range":[363,368], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":13,"column":54},"end":{"line":13,"column":57}}, + "range":[363,366], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[] + } + } + ] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "value":" 1.1 L decorator " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":45}}, + "range":[29,45], + "value":" 1.2 T args " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":21}}, + "range":[46,67], + "value":" 1.3 L decorator " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":29},"end":{"line":2,"column":45}}, + "range":[75,91], + "value":" 1.4 T args " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":17}}, + "range":[92,109], + "value":" 1.5 L class " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":21}}, + "range":[122,143], + "value":" 2.1 L decorator " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":29},"end":{"line":5,"column":50}}, + "range":[151,172], + "value":" 2.2 L decorator " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":58},"end":{"line":5,"column":75}}, + "range":[180,197], + "value":" 2.3 L class " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":2},"end":{"line":8,"column":23}}, + "range":[222,243], + "value":" 3.1 L decorator " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":31},"end":{"line":8,"column":47}}, + "range":[251,267], + "value":" 3.2 T args " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":2},"end":{"line":9,"column":16}}, + "range":[270,284], + "value":" 3.3 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":2},"end":{"line":13,"column":23}}, + "range":[311,332], + "value":" 4.1 L decorator " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":31},"end":{"line":13,"column":52}}, + "range":[340,361], + "value":" 4.2 L decorator " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":60},"end":{"line":13,"column":74}}, + "range":[369,383], + "value":" 4.3 L id " + } + ] +} diff --git a/lib/test/flow/comment_interning/do_while.js b/lib/test/flow/comment_interning/do_while.js new file mode 100644 index 0000000..94cdb18 --- /dev/null +++ b/lib/test/flow/comment_interning/do_while.js @@ -0,0 +1,32 @@ +function only_leading () { + // 1.0. unreachable leading comment + var i = 0; // 1.1. trailing var decl + // 1.2. leading comment + do { + i += 1; + } while (i < 3); +} + +function leading_n_trailing() { + var i = 0; + // 2.1. leading comment + do { + i += 1; + } while (i < 3) /* 2.2. trailing comment */; + + // 2.3. trailing comment +} + +function only_trailing() { + var i = 0; + do { + i += 1; + } /* 3.0. pre-keyword trailing comment */ while /* 3.1. pre-cond trailing comment */ (i< 3) /* 3.2. past-cond trailing comment */; /* 3.3 past semicolon trailing */ + + // 3.4. trailing comment +} + +function implicit_semicolon() { + do {} while (true) /* 4.1 Trailing */ + /* 4.2 Leading */ do {} while (true) /* 4.3 Trailing */ +} diff --git a/lib/test/flow/comment_interning/do_while.options.json b/lib/test/flow/comment_interning/do_while.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/do_while.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/do_while.tree.json b/lib/test/flow/comment_interning/do_while.tree.json new file mode 100644 index 0000000..6c24b33 --- /dev/null +++ b/lib/test/flow/comment_interning/do_while.tree.json @@ -0,0 +1,603 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":32,"column":1}}, + "range":[0,772], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":8,"column":1}}, + "range":[0,184], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":21}}, + "range":[9,21], + "name":"only_leading", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":8,"column":1}}, + "range":[25,184], + "body":[ + { + "type":"VariableDeclaration", + "trailingComments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":3,"column":16},"end":{"line":3,"column":41}}, + "range":[83,108], + "value":" 1.1. trailing var decl" + } + ], + "leadingComments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":39}}, + "range":[31,66], + "value":" 1.0. unreachable leading comment" + } + ], + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":14}}, + "range":[71,81], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":13}}, + "range":[75,80], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":9}}, + "range":[75,76], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":12},"end":{"line":3,"column":13}}, + "range":[79,80], + "value":0, + "raw":"0" + } + } + ], + "kind":"var" + }, + { + "type":"DoWhileStatement", + "leadingComments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":4,"column":4},"end":{"line":4,"column":27}}, + "range":[113,136], + "value":" 1.2. leading comment" + } + ], + "loc":{"source":null,"start":{"line":5,"column":4},"end":{"line":7,"column":20}}, + "range":[141,182], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":5,"column":7},"end":{"line":7,"column":5}}, + "range":[144,167], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":6,"column":8},"end":{"line":6,"column":15}}, + "range":[154,161], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":6,"column":8},"end":{"line":6,"column":14}}, + "range":[154,160], + "operator":"+=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":8},"end":{"line":6,"column":9}}, + "range":[154,155], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":6,"column":13},"end":{"line":6,"column":14}}, + "range":[159,160], + "value":1, + "raw":"1" + } + }, + "directive":null + } + ] + }, + "test":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":7,"column":13},"end":{"line":7,"column":18}}, + "range":[175,180], + "operator":"<", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":13},"end":{"line":7,"column":14}}, + "range":[175,176], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":7,"column":17},"end":{"line":7,"column":18}}, + "range":[179,180], + "value":3, + "raw":"3" + } + } + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":10,"column":0},"end":{"line":18,"column":1}}, + "range":[186,366], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":10,"column":9},"end":{"line":10,"column":27}}, + "range":[195,213], + "name":"leading_n_trailing", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":10,"column":30},"end":{"line":18,"column":1}}, + "range":[216,366], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":11,"column":4},"end":{"line":11,"column":14}}, + "range":[222,232], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":11,"column":8},"end":{"line":11,"column":13}}, + "range":[226,231], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":11,"column":8},"end":{"line":11,"column":9}}, + "range":[226,227], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":11,"column":12},"end":{"line":11,"column":13}}, + "range":[230,231], + "value":0, + "raw":"0" + } + } + ], + "kind":"var" + }, + { + "type":"DoWhileStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":20},"end":{"line":15,"column":47}}, + "range":[306,333], + "value":" 2.2. trailing comment " + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":17,"column":4},"end":{"line":17,"column":28}}, + "range":[340,364], + "value":" 2.3. trailing comment" + } + ], + "leadingComments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":12,"column":4},"end":{"line":12,"column":27}}, + "range":[237,260], + "value":" 2.1. leading comment" + } + ], + "loc":{"source":null,"start":{"line":13,"column":4},"end":{"line":15,"column":48}}, + "range":[265,334], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":13,"column":7},"end":{"line":15,"column":5}}, + "range":[268,291], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":14,"column":8},"end":{"line":14,"column":15}}, + "range":[278,285], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":14,"column":8},"end":{"line":14,"column":14}}, + "range":[278,284], + "operator":"+=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":14,"column":8},"end":{"line":14,"column":9}}, + "range":[278,279], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":14,"column":13},"end":{"line":14,"column":14}}, + "range":[283,284], + "value":1, + "raw":"1" + } + }, + "directive":null + } + ] + }, + "test":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":15,"column":13},"end":{"line":15,"column":18}}, + "range":[299,304], + "operator":"<", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":15,"column":13},"end":{"line":15,"column":14}}, + "range":[299,300], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":15,"column":17},"end":{"line":15,"column":18}}, + "range":[303,304], + "value":3, + "raw":"3" + } + } + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":20,"column":0},"end":{"line":27,"column":1}}, + "range":[368,635], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":20,"column":9},"end":{"line":20,"column":22}}, + "range":[377,390], + "name":"only_trailing", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":20,"column":25},"end":{"line":27,"column":1}}, + "range":[393,635], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":21,"column":4},"end":{"line":21,"column":14}}, + "range":[399,409], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":21,"column":8},"end":{"line":21,"column":13}}, + "range":[403,408], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":21,"column":8},"end":{"line":21,"column":9}}, + "range":[403,404], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":21,"column":12},"end":{"line":21,"column":13}}, + "range":[407,408], + "value":0, + "raw":"0" + } + } + ], + "kind":"var" + }, + { + "type":"DoWhileStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":6},"end":{"line":24,"column":45}}, + "range":[441,480], + "value":" 3.0. pre-keyword trailing comment " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":52},"end":{"line":24,"column":88}}, + "range":[487,523], + "value":" 3.1. pre-cond trailing comment " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":96},"end":{"line":24,"column":133}}, + "range":[531,568], + "value":" 3.2. past-cond trailing comment " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":135},"end":{"line":24,"column":168}}, + "range":[570,603], + "value":" 3.3 past semicolon trailing " + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":26,"column":4},"end":{"line":26,"column":28}}, + "range":[609,633], + "value":" 3.4. trailing comment" + } + ], + "loc":{"source":null,"start":{"line":22,"column":4},"end":{"line":24,"column":134}}, + "range":[414,569], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":22,"column":7},"end":{"line":24,"column":5}}, + "range":[417,440], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":23,"column":8},"end":{"line":23,"column":15}}, + "range":[427,434], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":23,"column":8},"end":{"line":23,"column":14}}, + "range":[427,433], + "operator":"+=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":23,"column":8},"end":{"line":23,"column":9}}, + "range":[427,428], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":23,"column":13},"end":{"line":23,"column":14}}, + "range":[432,433], + "value":1, + "raw":"1" + } + }, + "directive":null + } + ] + }, + "test":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":24,"column":90},"end":{"line":24,"column":94}}, + "range":[525,529], + "operator":"<", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":24,"column":90},"end":{"line":24,"column":91}}, + "range":[525,526], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":24,"column":93},"end":{"line":24,"column":94}}, + "range":[528,529], + "value":3, + "raw":"3" + } + } + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":29,"column":0},"end":{"line":32,"column":1}}, + "range":[637,772], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":29,"column":9},"end":{"line":29,"column":27}}, + "range":[646,664], + "name":"implicit_semicolon", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":29,"column":30},"end":{"line":32,"column":1}}, + "range":[667,772], + "body":[ + { + "type":"DoWhileStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":23},"end":{"line":30,"column":41}}, + "range":[692,710], + "value":" 4.1 Trailing " + } + ], + "loc":{"source":null,"start":{"line":30,"column":4},"end":{"line":30,"column":22}}, + "range":[673,691], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":30,"column":7},"end":{"line":30,"column":9}}, + "range":[676,678], + "body":[] + }, + "test":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":30,"column":17},"end":{"line":30,"column":21}}, + "range":[686,690], + "value":true, + "raw":"true" + } + }, + { + "type":"DoWhileStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":41},"end":{"line":31,"column":59}}, + "range":[752,770], + "value":" 4.3 Trailing " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":4},"end":{"line":31,"column":21}}, + "range":[715,732], + "value":" 4.2 Leading " + } + ], + "loc":{"source":null,"start":{"line":31,"column":22},"end":{"line":31,"column":40}}, + "range":[733,751], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":31,"column":25},"end":{"line":31,"column":27}}, + "range":[736,738], + "body":[] + }, + "test":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":31,"column":35},"end":{"line":31,"column":39}}, + "range":[746,750], + "value":true, + "raw":"true" + } + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":39}}, + "range":[31,66], + "value":" 1.0. unreachable leading comment" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":3,"column":16},"end":{"line":3,"column":41}}, + "range":[83,108], + "value":" 1.1. trailing var decl" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":4,"column":4},"end":{"line":4,"column":27}}, + "range":[113,136], + "value":" 1.2. leading comment" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":12,"column":4},"end":{"line":12,"column":27}}, + "range":[237,260], + "value":" 2.1. leading comment" + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":20},"end":{"line":15,"column":47}}, + "range":[306,333], + "value":" 2.2. trailing comment " + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":17,"column":4},"end":{"line":17,"column":28}}, + "range":[340,364], + "value":" 2.3. trailing comment" + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":6},"end":{"line":24,"column":45}}, + "range":[441,480], + "value":" 3.0. pre-keyword trailing comment " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":52},"end":{"line":24,"column":88}}, + "range":[487,523], + "value":" 3.1. pre-cond trailing comment " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":96},"end":{"line":24,"column":133}}, + "range":[531,568], + "value":" 3.2. past-cond trailing comment " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":135},"end":{"line":24,"column":168}}, + "range":[570,603], + "value":" 3.3 past semicolon trailing " + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":26,"column":4},"end":{"line":26,"column":28}}, + "range":[609,633], + "value":" 3.4. trailing comment" + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":23},"end":{"line":30,"column":41}}, + "range":[692,710], + "value":" 4.1 Trailing " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":4},"end":{"line":31,"column":21}}, + "range":[715,732], + "value":" 4.2 Leading " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":41},"end":{"line":31,"column":59}}, + "range":[752,770], + "value":" 4.3 Trailing " + } + ] +} diff --git a/lib/test/flow/comment_interning/empty_statement.js b/lib/test/flow/comment_interning/empty_statement.js new file mode 100644 index 0000000..2189486 --- /dev/null +++ b/lib/test/flow/comment_interning/empty_statement.js @@ -0,0 +1,2 @@ +/* 1.1 L empty */ ; /* 1.2 T empty */ +/* 1.3 L empty */ ; /* 1.4 T empty */ diff --git a/lib/test/flow/comment_interning/empty_statement.options.json b/lib/test/flow/comment_interning/empty_statement.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/empty_statement.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/empty_statement.tree.json b/lib/test/flow/comment_interning/empty_statement.tree.json new file mode 100644 index 0000000..a59d474 --- /dev/null +++ b/lib/test/flow/comment_interning/empty_statement.tree.json @@ -0,0 +1,75 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":2,"column":19}}, + "range":[18,57], + "body":[ + { + "type":"EmptyStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":37}}, + "range":[20,37], + "value":" 1.2 T empty " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "value":" 1.1 L empty " + } + ], + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19] + }, + { + "type":"EmptyStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":20},"end":{"line":2,"column":37}}, + "range":[58,75], + "value":" 1.4 T empty " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":17}}, + "range":[38,55], + "value":" 1.3 L empty " + } + ], + "loc":{"source":null,"start":{"line":2,"column":18},"end":{"line":2,"column":19}}, + "range":[56,57] + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "value":" 1.1 L empty " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":37}}, + "range":[20,37], + "value":" 1.2 T empty " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":17}}, + "range":[38,55], + "value":" 1.3 L empty " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":20},"end":{"line":2,"column":37}}, + "range":[58,75], + "value":" 1.4 T empty " + } + ] +} diff --git a/lib/test/flow/comment_interning/enum_declaration.js b/lib/test/flow/comment_interning/enum_declaration.js new file mode 100644 index 0000000..911b277 --- /dev/null +++ b/lib/test/flow/comment_interning/enum_declaration.js @@ -0,0 +1,21 @@ +/* 1.1 L enum */ enum /* 1.2 L id */ Foo /* 1.3 T id */ {} /* 1.4 T enum body */ + +/* 2.1 L enum */ enum /* 1.2 L id */ Foo /* 1.3 T id */ of string /* 1.4 L enum body */ {} /* 1.5 T enum body */ + +enum Foo { + /* 3.1 L id */ Bar /* 3.2 T id */, + /* 3.3 L id */ Baz /* 3.4 T id */, +} + +enum Foo { + /* 4.1 L id */ Bar /* 4.2 T id */ = /* 4.3 L num */ 10 /* 4.4 T num */, +} + +enum Foo { + /* 5.1 L id */ Bar /* 5.2 T id */ = /* 5.3 L bool */ true /* 5.4 T bool */, +} + +{ + /* 6.1 L enum */ enum Foo {} /* 6.2 L enum */ enum Foo {} /* 6.3 T enum body */ + /* 6.4 T enum body */ +} diff --git a/lib/test/flow/comment_interning/enum_declaration.options.json b/lib/test/flow/comment_interning/enum_declaration.options.json new file mode 100644 index 0000000..2a21f73 --- /dev/null +++ b/lib/test/flow/comment_interning/enum_declaration.options.json @@ -0,0 +1,4 @@ +{ + "enums": true, + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/enum_declaration.tree.json b/lib/test/flow/comment_interning/enum_declaration.tree.json new file mode 100644 index 0000000..4e2ca09 --- /dev/null +++ b/lib/test/flow/comment_interning/enum_declaration.tree.json @@ -0,0 +1,580 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":21,"column":1}}, + "range":[17,573], + "body":[ + { + "type":"EnumDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "value":" 1.1 L enum " + } + ], + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":58}}, + "range":[17,58], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":55}}, + "range":[41,55], + "value":" 1.3 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":36}}, + "range":[22,36], + "value":" 1.2 L id " + } + ], + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":40}}, + "range":[37,40], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":59},"end":{"line":1,"column":80}}, + "range":[59,80], + "value":" 1.4 T enum body " + } + ], + "loc":{"source":null,"start":{"line":1,"column":56},"end":{"line":1,"column":58}}, + "range":[56,58], + "members":[], + "explicitType":false, + "hasUnknownMembers":false + } + }, + { + "type":"EnumDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":16}}, + "range":[82,98], + "value":" 2.1 L enum " + } + ], + "loc":{"source":null,"start":{"line":3,"column":17},"end":{"line":3,"column":90}}, + "range":[99,172], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":41},"end":{"line":3,"column":55}}, + "range":[123,137], + "value":" 1.3 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":22},"end":{"line":3,"column":36}}, + "range":[104,118], + "value":" 1.2 L id " + } + ], + "loc":{"source":null,"start":{"line":3,"column":37},"end":{"line":3,"column":40}}, + "range":[119,122], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":91},"end":{"line":3,"column":112}}, + "range":[173,194], + "value":" 1.5 T enum body " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":66},"end":{"line":3,"column":87}}, + "range":[148,169], + "value":" 1.4 L enum body " + } + ], + "loc":{"source":null,"start":{"line":3,"column":56},"end":{"line":3,"column":90}}, + "range":[138,172], + "members":[], + "explicitType":true, + "hasUnknownMembers":false + } + }, + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":8,"column":1}}, + "range":[196,282], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":5},"end":{"line":5,"column":8}}, + "range":[201,204], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":5,"column":9},"end":{"line":8,"column":1}}, + "range":[205,282], + "members":[ + { + "type":"EnumDefaultedMember", + "loc":{"source":null,"start":{"line":6,"column":17},"end":{"line":6,"column":20}}, + "range":[224,227], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":21},"end":{"line":6,"column":35}}, + "range":[228,242], + "value":" 3.2 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":16}}, + "range":[209,223], + "value":" 3.1 L id " + } + ], + "loc":{"source":null,"start":{"line":6,"column":17},"end":{"line":6,"column":20}}, + "range":[224,227], + "name":"Bar", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"EnumDefaultedMember", + "loc":{"source":null,"start":{"line":7,"column":17},"end":{"line":7,"column":20}}, + "range":[261,264], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":21},"end":{"line":7,"column":35}}, + "range":[265,279], + "value":" 3.4 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":2},"end":{"line":7,"column":16}}, + "range":[246,260], + "value":" 3.3 L id " + } + ], + "loc":{"source":null,"start":{"line":7,"column":17},"end":{"line":7,"column":20}}, + "range":[261,264], + "name":"Baz", + "typeAnnotation":null, + "optional":false + } + } + ], + "explicitType":false, + "hasUnknownMembers":false + } + }, + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":10,"column":0},"end":{"line":12,"column":1}}, + "range":[284,370], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":10,"column":5},"end":{"line":10,"column":8}}, + "range":[289,292], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumNumberBody", + "loc":{"source":null,"start":{"line":10,"column":9},"end":{"line":12,"column":1}}, + "range":[293,370], + "members":[ + { + "type":"EnumNumberMember", + "loc":{"source":null,"start":{"line":11,"column":17},"end":{"line":11,"column":56}}, + "range":[312,351], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":21},"end":{"line":11,"column":35}}, + "range":[316,330], + "value":" 4.2 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":2},"end":{"line":11,"column":16}}, + "range":[297,311], + "value":" 4.1 L id " + } + ], + "loc":{"source":null,"start":{"line":11,"column":17},"end":{"line":11,"column":20}}, + "range":[312,315], + "name":"Bar", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":57},"end":{"line":11,"column":72}}, + "range":[352,367], + "value":" 4.4 T num " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":38},"end":{"line":11,"column":53}}, + "range":[333,348], + "value":" 4.3 L num " + } + ], + "loc":{"source":null,"start":{"line":11,"column":54},"end":{"line":11,"column":56}}, + "range":[349,351], + "value":10, + "raw":"10" + } + } + ], + "explicitType":false, + "hasUnknownMembers":false + } + }, + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":14,"column":0},"end":{"line":16,"column":1}}, + "range":[372,462], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":14,"column":5},"end":{"line":14,"column":8}}, + "range":[377,380], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumBooleanBody", + "loc":{"source":null,"start":{"line":14,"column":9},"end":{"line":16,"column":1}}, + "range":[381,462], + "members":[ + { + "type":"EnumBooleanMember", + "loc":{"source":null,"start":{"line":15,"column":17},"end":{"line":15,"column":59}}, + "range":[400,442], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":21},"end":{"line":15,"column":35}}, + "range":[404,418], + "value":" 5.2 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":2},"end":{"line":15,"column":16}}, + "range":[385,399], + "value":" 5.1 L id " + } + ], + "loc":{"source":null,"start":{"line":15,"column":17},"end":{"line":15,"column":20}}, + "range":[400,403], + "name":"Bar", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":60},"end":{"line":15,"column":76}}, + "range":[443,459], + "value":" 5.4 T bool " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":38},"end":{"line":15,"column":54}}, + "range":[421,437], + "value":" 5.3 L bool " + } + ], + "loc":{"source":null,"start":{"line":15,"column":55},"end":{"line":15,"column":59}}, + "range":[438,442], + "value":true, + "raw":"true" + } + } + ], + "explicitType":false, + "hasUnknownMembers":false + } + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":18,"column":0},"end":{"line":21,"column":1}}, + "range":[464,573], + "body":[ + { + "type":"EnumDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":2},"end":{"line":19,"column":18}}, + "range":[468,484], + "value":" 6.1 L enum " + } + ], + "loc":{"source":null,"start":{"line":19,"column":19},"end":{"line":19,"column":30}}, + "range":[485,496], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":19,"column":24},"end":{"line":19,"column":27}}, + "range":[490,493], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":19,"column":28},"end":{"line":19,"column":30}}, + "range":[494,496], + "members":[], + "explicitType":false, + "hasUnknownMembers":false + } + }, + { + "type":"EnumDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":31},"end":{"line":19,"column":47}}, + "range":[497,513], + "value":" 6.2 L enum " + } + ], + "loc":{"source":null,"start":{"line":19,"column":48},"end":{"line":19,"column":59}}, + "range":[514,525], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":19,"column":53},"end":{"line":19,"column":56}}, + "range":[519,522], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":60},"end":{"line":19,"column":81}}, + "range":[526,547], + "value":" 6.3 T enum body " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":2},"end":{"line":20,"column":23}}, + "range":[550,571], + "value":" 6.4 T enum body " + } + ], + "loc":{"source":null,"start":{"line":19,"column":57},"end":{"line":19,"column":59}}, + "range":[523,525], + "members":[], + "explicitType":false, + "hasUnknownMembers":false + } + } + ] + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "value":" 1.1 L enum " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":36}}, + "range":[22,36], + "value":" 1.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":55}}, + "range":[41,55], + "value":" 1.3 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":59},"end":{"line":1,"column":80}}, + "range":[59,80], + "value":" 1.4 T enum body " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":16}}, + "range":[82,98], + "value":" 2.1 L enum " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":22},"end":{"line":3,"column":36}}, + "range":[104,118], + "value":" 1.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":41},"end":{"line":3,"column":55}}, + "range":[123,137], + "value":" 1.3 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":66},"end":{"line":3,"column":87}}, + "range":[148,169], + "value":" 1.4 L enum body " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":91},"end":{"line":3,"column":112}}, + "range":[173,194], + "value":" 1.5 T enum body " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":16}}, + "range":[209,223], + "value":" 3.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":21},"end":{"line":6,"column":35}}, + "range":[228,242], + "value":" 3.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":2},"end":{"line":7,"column":16}}, + "range":[246,260], + "value":" 3.3 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":21},"end":{"line":7,"column":35}}, + "range":[265,279], + "value":" 3.4 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":2},"end":{"line":11,"column":16}}, + "range":[297,311], + "value":" 4.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":21},"end":{"line":11,"column":35}}, + "range":[316,330], + "value":" 4.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":38},"end":{"line":11,"column":53}}, + "range":[333,348], + "value":" 4.3 L num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":57},"end":{"line":11,"column":72}}, + "range":[352,367], + "value":" 4.4 T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":2},"end":{"line":15,"column":16}}, + "range":[385,399], + "value":" 5.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":21},"end":{"line":15,"column":35}}, + "range":[404,418], + "value":" 5.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":38},"end":{"line":15,"column":54}}, + "range":[421,437], + "value":" 5.3 L bool " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":60},"end":{"line":15,"column":76}}, + "range":[443,459], + "value":" 5.4 T bool " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":2},"end":{"line":19,"column":18}}, + "range":[468,484], + "value":" 6.1 L enum " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":31},"end":{"line":19,"column":47}}, + "range":[497,513], + "value":" 6.2 L enum " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":60},"end":{"line":19,"column":81}}, + "range":[526,547], + "value":" 6.3 T enum body " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":2},"end":{"line":20,"column":23}}, + "range":[550,571], + "value":" 6.4 T enum body " + } + ] +} diff --git a/lib/test/flow/comment_interning/export.js b/lib/test/flow/comment_interning/export.js new file mode 100644 index 0000000..e6daf9c --- /dev/null +++ b/lib/test/flow/comment_interning/export.js @@ -0,0 +1,29 @@ +/* 1.1 L export */ export /* 1.2 L export */ default /* 1.3 L num */ 1 /* 1.4 T num */ ; /* 1.5 T export */ + +/* 2.1 L export */ export /* 2.2 L export */ default /* 2.3 L func decl */ function() {} /* 2.4 T block */ + +/* 3.1 L export */ export {A}; /* 3.2 T export */ + +/* 4.1 L export */ export { /* 4.2 L id */ B /* 4.3 T id */ as /* 4.4 L id */ C /* 4.5 T id */ } from /* 4.6 L lit */ 'D' /* 4.7 T lit */; /* 4.8 T export */ + +/* 5.1 L export */ export * from 'Foo'; /* 5.2 T export */ + +/* 6.1 L export */ export type * from 'Foo'; /* 6.2 T export */ + +/* 7.1 L export */ export /* 7.2 L type alias */ type Foo = any; /* 7.3 T type alias */ + +/* 8.1 L export */ export /* 8.2 L class */ class Baz {} /* 8.3 T class body */ + +/* 9.1 L export */ export /* 9.2 L var decl */ const a = 1; /* 9.3 T var decl */ + +/* 10.1 L export */ export * from 'source' /* 10.2 T str lit */ + +/* 11.1 L export */ export type * from 'source' /* 11.2 T str lit */ + +/* 12.1 L export */ export { Foo1 } from 'source' /* 12.2 T str lit */ + +/* 13.1 L export */ export { Foo2 } /* 13.2 T export */ + +/* 14.1 L export */ export default 1 /* 14.2 T num */ + +/* Final L str */ 'end of tests'; diff --git a/lib/test/flow/comment_interning/export.options.json b/lib/test/flow/comment_interning/export.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/export.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/export.tree.json b/lib/test/flow/comment_interning/export.tree.json new file mode 100644 index 0000000..6910a06 --- /dev/null +++ b/lib/test/flow/comment_interning/export.tree.json @@ -0,0 +1,964 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":3,"column":19},"end":{"line":3,"column":83}}, + "message":"Duplicate export for `default`" + }, + { + "loc":{"source":null,"start":{"line":27,"column":20},"end":{"line":27,"column":36}}, + "message":"Duplicate export for `default`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":29,"column":33}}, + "range":[19,1156], + "body":[ + { + "type":"ExportDefaultDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":89},"end":{"line":1,"column":107}}, + "range":[89,107], + "value":" 1.5 T export " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "value":" 1.1 L export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":44}}, + "range":[26,44], + "value":" 1.2 L export " + } + ], + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":88}}, + "range":[19,88], + "declaration":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":71},"end":{"line":1,"column":86}}, + "range":[71,86], + "value":" 1.4 T num " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":53},"end":{"line":1,"column":68}}, + "range":[53,68], + "value":" 1.3 L num " + } + ], + "loc":{"source":null,"start":{"line":1,"column":69},"end":{"line":1,"column":70}}, + "range":[69,70], + "value":1, + "raw":"1" + }, + "exportKind":"value" + }, + { + "type":"ExportDefaultDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":18}}, + "range":[109,127], + "value":" 2.1 L export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":26},"end":{"line":3,"column":44}}, + "range":[135,153], + "value":" 2.2 L export " + } + ], + "loc":{"source":null,"start":{"line":3,"column":19},"end":{"line":3,"column":88}}, + "range":[128,197], + "declaration":{ + "type":"FunctionDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":53},"end":{"line":3,"column":74}}, + "range":[162,183], + "value":" 2.3 L func decl " + } + ], + "loc":{"source":null,"start":{"line":3,"column":75},"end":{"line":3,"column":88}}, + "range":[184,197], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":89},"end":{"line":3,"column":106}}, + "range":[198,215], + "value":" 2.4 T block " + } + ], + "loc":{"source":null,"start":{"line":3,"column":86},"end":{"line":3,"column":88}}, + "range":[195,197], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "exportKind":"value" + }, + { + "type":"ExportNamedDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":31},"end":{"line":5,"column":49}}, + "range":[248,266], + "value":" 3.2 T export " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":18}}, + "range":[217,235], + "value":" 3.1 L export " + } + ], + "loc":{"source":null,"start":{"line":5,"column":19},"end":{"line":5,"column":30}}, + "range":[236,247], + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":5,"column":27},"end":{"line":5,"column":28}}, + "range":[244,245], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":27},"end":{"line":5,"column":28}}, + "range":[244,245], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":27},"end":{"line":5,"column":28}}, + "range":[244,245], + "name":"A", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":null, + "exportKind":"value" + }, + { + "type":"ExportNamedDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":139},"end":{"line":7,"column":157}}, + "range":[407,425], + "value":" 4.8 T export " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":18}}, + "range":[268,286], + "value":" 4.1 L export " + } + ], + "loc":{"source":null,"start":{"line":7,"column":19},"end":{"line":7,"column":138}}, + "range":[287,406], + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":7,"column":43},"end":{"line":7,"column":79}}, + "range":[311,347], + "local":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":45},"end":{"line":7,"column":59}}, + "range":[313,327], + "value":" 4.3 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":28},"end":{"line":7,"column":42}}, + "range":[296,310], + "value":" 4.2 L id " + } + ], + "loc":{"source":null,"start":{"line":7,"column":43},"end":{"line":7,"column":44}}, + "range":[311,312], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":80},"end":{"line":7,"column":94}}, + "range":[348,362], + "value":" 4.5 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":63},"end":{"line":7,"column":77}}, + "range":[331,345], + "value":" 4.4 L id " + } + ], + "loc":{"source":null,"start":{"line":7,"column":78},"end":{"line":7,"column":79}}, + "range":[346,347], + "name":"C", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":122},"end":{"line":7,"column":137}}, + "range":[390,405], + "value":" 4.7 T lit " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":102},"end":{"line":7,"column":117}}, + "range":[370,385], + "value":" 4.6 L lit " + } + ], + "loc":{"source":null,"start":{"line":7,"column":118},"end":{"line":7,"column":121}}, + "range":[386,389], + "value":"D", + "raw":"'D'" + }, + "exportKind":"value" + }, + { + "type":"ExportAllDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":40},"end":{"line":9,"column":58}}, + "range":[467,485], + "value":" 5.2 T export " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":9,"column":18}}, + "range":[427,445], + "value":" 5.1 L export " + } + ], + "loc":{"source":null,"start":{"line":9,"column":19},"end":{"line":9,"column":39}}, + "range":[446,466], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":9,"column":33},"end":{"line":9,"column":38}}, + "range":[460,465], + "value":"Foo", + "raw":"'Foo'" + }, + "exportKind":"value" + }, + { + "type":"ExportAllDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":45},"end":{"line":11,"column":63}}, + "range":[532,550], + "value":" 6.2 T export " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":11,"column":18}}, + "range":[487,505], + "value":" 6.1 L export " + } + ], + "loc":{"source":null,"start":{"line":11,"column":19},"end":{"line":11,"column":44}}, + "range":[506,531], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":11,"column":38},"end":{"line":11,"column":43}}, + "range":[525,530], + "value":"Foo", + "raw":"'Foo'" + }, + "exportKind":"type" + }, + { + "type":"ExportNamedDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":0},"end":{"line":13,"column":18}}, + "range":[552,570], + "value":" 7.1 L export " + } + ], + "loc":{"source":null,"start":{"line":13,"column":19},"end":{"line":13,"column":64}}, + "range":[571,616], + "declaration":{ + "type":"TypeAlias", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":65},"end":{"line":13,"column":87}}, + "range":[617,639], + "value":" 7.3 T type alias " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":26},"end":{"line":13,"column":48}}, + "range":[578,600], + "value":" 7.2 L type alias " + } + ], + "loc":{"source":null,"start":{"line":13,"column":49},"end":{"line":13,"column":64}}, + "range":[601,616], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":13,"column":54},"end":{"line":13,"column":57}}, + "range":[606,609], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":13,"column":60},"end":{"line":13,"column":63}}, + "range":[612,615] + } + }, + "specifiers":[], + "source":null, + "exportKind":"type" + }, + { + "type":"ExportNamedDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":0},"end":{"line":15,"column":18}}, + "range":[641,659], + "value":" 8.1 L export " + } + ], + "loc":{"source":null,"start":{"line":15,"column":19},"end":{"line":15,"column":56}}, + "range":[660,697], + "declaration":{ + "type":"ClassDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":26},"end":{"line":15,"column":43}}, + "range":[667,684], + "value":" 8.2 L class " + } + ], + "loc":{"source":null,"start":{"line":15,"column":44},"end":{"line":15,"column":56}}, + "range":[685,697], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":15,"column":50},"end":{"line":15,"column":53}}, + "range":[691,694], + "name":"Baz", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":57},"end":{"line":15,"column":79}}, + "range":[698,720], + "value":" 8.3 T class body " + } + ], + "loc":{"source":null,"start":{"line":15,"column":54},"end":{"line":15,"column":56}}, + "range":[695,697], + "body":[] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + "specifiers":[], + "source":null, + "exportKind":"value" + }, + { + "type":"ExportNamedDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":0},"end":{"line":17,"column":18}}, + "range":[722,740], + "value":" 9.1 L export " + } + ], + "loc":{"source":null,"start":{"line":17,"column":19},"end":{"line":17,"column":59}}, + "range":[741,781], + "declaration":{ + "type":"VariableDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":60},"end":{"line":17,"column":80}}, + "range":[782,802], + "value":" 9.3 T var decl " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":26},"end":{"line":17,"column":46}}, + "range":[748,768], + "value":" 9.2 L var decl " + } + ], + "loc":{"source":null,"start":{"line":17,"column":47},"end":{"line":17,"column":59}}, + "range":[769,781], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":17,"column":53},"end":{"line":17,"column":58}}, + "range":[775,780], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":17,"column":53},"end":{"line":17,"column":54}}, + "range":[775,776], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":17,"column":57},"end":{"line":17,"column":58}}, + "range":[779,780], + "value":1, + "raw":"1" + } + } + ], + "kind":"const" + }, + "specifiers":[], + "source":null, + "exportKind":"value" + }, + { + "type":"ExportAllDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":0},"end":{"line":19,"column":19}}, + "range":[804,823], + "value":" 10.1 L export " + } + ], + "loc":{"source":null,"start":{"line":19,"column":20},"end":{"line":19,"column":42}}, + "range":[824,846], + "source":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":43},"end":{"line":19,"column":63}}, + "range":[847,867], + "value":" 10.2 T str lit " + } + ], + "loc":{"source":null,"start":{"line":19,"column":34},"end":{"line":19,"column":42}}, + "range":[838,846], + "value":"source", + "raw":"'source'" + }, + "exportKind":"value" + }, + { + "type":"ExportAllDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":0},"end":{"line":21,"column":19}}, + "range":[869,888], + "value":" 11.1 L export " + } + ], + "loc":{"source":null,"start":{"line":21,"column":20},"end":{"line":21,"column":47}}, + "range":[889,916], + "source":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":48},"end":{"line":21,"column":68}}, + "range":[917,937], + "value":" 11.2 T str lit " + } + ], + "loc":{"source":null,"start":{"line":21,"column":39},"end":{"line":21,"column":47}}, + "range":[908,916], + "value":"source", + "raw":"'source'" + }, + "exportKind":"type" + }, + { + "type":"ExportNamedDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":0},"end":{"line":23,"column":19}}, + "range":[939,958], + "value":" 12.1 L export " + } + ], + "loc":{"source":null,"start":{"line":23,"column":20},"end":{"line":23,"column":49}}, + "range":[959,988], + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":23,"column":29},"end":{"line":23,"column":33}}, + "range":[968,972], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":23,"column":29},"end":{"line":23,"column":33}}, + "range":[968,972], + "name":"Foo1", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":23,"column":29},"end":{"line":23,"column":33}}, + "range":[968,972], + "name":"Foo1", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":50},"end":{"line":23,"column":70}}, + "range":[989,1009], + "value":" 12.2 T str lit " + } + ], + "loc":{"source":null,"start":{"line":23,"column":41},"end":{"line":23,"column":49}}, + "range":[980,988], + "value":"source", + "raw":"'source'" + }, + "exportKind":"value" + }, + { + "type":"ExportNamedDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":36},"end":{"line":25,"column":55}}, + "range":[1047,1066], + "value":" 13.2 T export " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":0},"end":{"line":25,"column":19}}, + "range":[1011,1030], + "value":" 13.1 L export " + } + ], + "loc":{"source":null,"start":{"line":25,"column":20},"end":{"line":25,"column":35}}, + "range":[1031,1046], + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":25,"column":29},"end":{"line":25,"column":33}}, + "range":[1040,1044], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":25,"column":29},"end":{"line":25,"column":33}}, + "range":[1040,1044], + "name":"Foo2", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":25,"column":29},"end":{"line":25,"column":33}}, + "range":[1040,1044], + "name":"Foo2", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":null, + "exportKind":"value" + }, + { + "type":"ExportDefaultDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":27,"column":0},"end":{"line":27,"column":19}}, + "range":[1068,1087], + "value":" 14.1 L export " + } + ], + "loc":{"source":null,"start":{"line":27,"column":20},"end":{"line":27,"column":36}}, + "range":[1088,1104], + "declaration":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":27,"column":37},"end":{"line":27,"column":53}}, + "range":[1105,1121], + "value":" 14.2 T num " + } + ], + "loc":{"source":null,"start":{"line":27,"column":35},"end":{"line":27,"column":36}}, + "range":[1103,1104], + "value":1, + "raw":"1" + }, + "exportKind":"value" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":29,"column":18},"end":{"line":29,"column":33}}, + "range":[1141,1156], + "expression":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":0},"end":{"line":29,"column":17}}, + "range":[1123,1140], + "value":" Final L str " + } + ], + "loc":{"source":null,"start":{"line":29,"column":18},"end":{"line":29,"column":32}}, + "range":[1141,1155], + "value":"end of tests", + "raw":"'end of tests'" + }, + "directive":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "value":" 1.1 L export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":44}}, + "range":[26,44], + "value":" 1.2 L export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":53},"end":{"line":1,"column":68}}, + "range":[53,68], + "value":" 1.3 L num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":71},"end":{"line":1,"column":86}}, + "range":[71,86], + "value":" 1.4 T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":89},"end":{"line":1,"column":107}}, + "range":[89,107], + "value":" 1.5 T export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":18}}, + "range":[109,127], + "value":" 2.1 L export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":26},"end":{"line":3,"column":44}}, + "range":[135,153], + "value":" 2.2 L export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":53},"end":{"line":3,"column":74}}, + "range":[162,183], + "value":" 2.3 L func decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":89},"end":{"line":3,"column":106}}, + "range":[198,215], + "value":" 2.4 T block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":18}}, + "range":[217,235], + "value":" 3.1 L export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":31},"end":{"line":5,"column":49}}, + "range":[248,266], + "value":" 3.2 T export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":18}}, + "range":[268,286], + "value":" 4.1 L export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":28},"end":{"line":7,"column":42}}, + "range":[296,310], + "value":" 4.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":45},"end":{"line":7,"column":59}}, + "range":[313,327], + "value":" 4.3 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":63},"end":{"line":7,"column":77}}, + "range":[331,345], + "value":" 4.4 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":80},"end":{"line":7,"column":94}}, + "range":[348,362], + "value":" 4.5 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":102},"end":{"line":7,"column":117}}, + "range":[370,385], + "value":" 4.6 L lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":122},"end":{"line":7,"column":137}}, + "range":[390,405], + "value":" 4.7 T lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":139},"end":{"line":7,"column":157}}, + "range":[407,425], + "value":" 4.8 T export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":9,"column":18}}, + "range":[427,445], + "value":" 5.1 L export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":40},"end":{"line":9,"column":58}}, + "range":[467,485], + "value":" 5.2 T export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":11,"column":18}}, + "range":[487,505], + "value":" 6.1 L export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":45},"end":{"line":11,"column":63}}, + "range":[532,550], + "value":" 6.2 T export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":0},"end":{"line":13,"column":18}}, + "range":[552,570], + "value":" 7.1 L export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":26},"end":{"line":13,"column":48}}, + "range":[578,600], + "value":" 7.2 L type alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":65},"end":{"line":13,"column":87}}, + "range":[617,639], + "value":" 7.3 T type alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":0},"end":{"line":15,"column":18}}, + "range":[641,659], + "value":" 8.1 L export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":26},"end":{"line":15,"column":43}}, + "range":[667,684], + "value":" 8.2 L class " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":57},"end":{"line":15,"column":79}}, + "range":[698,720], + "value":" 8.3 T class body " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":0},"end":{"line":17,"column":18}}, + "range":[722,740], + "value":" 9.1 L export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":26},"end":{"line":17,"column":46}}, + "range":[748,768], + "value":" 9.2 L var decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":60},"end":{"line":17,"column":80}}, + "range":[782,802], + "value":" 9.3 T var decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":0},"end":{"line":19,"column":19}}, + "range":[804,823], + "value":" 10.1 L export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":43},"end":{"line":19,"column":63}}, + "range":[847,867], + "value":" 10.2 T str lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":0},"end":{"line":21,"column":19}}, + "range":[869,888], + "value":" 11.1 L export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":48},"end":{"line":21,"column":68}}, + "range":[917,937], + "value":" 11.2 T str lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":0},"end":{"line":23,"column":19}}, + "range":[939,958], + "value":" 12.1 L export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":50},"end":{"line":23,"column":70}}, + "range":[989,1009], + "value":" 12.2 T str lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":0},"end":{"line":25,"column":19}}, + "range":[1011,1030], + "value":" 13.1 L export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":36},"end":{"line":25,"column":55}}, + "range":[1047,1066], + "value":" 13.2 T export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":27,"column":0},"end":{"line":27,"column":19}}, + "range":[1068,1087], + "value":" 14.1 L export " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":27,"column":37},"end":{"line":27,"column":53}}, + "range":[1105,1121], + "value":" 14.2 T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":0},"end":{"line":29,"column":17}}, + "range":[1123,1140], + "value":" Final L str " + } + ] +} diff --git a/lib/test/flow/comment_interning/expression_statement.js b/lib/test/flow/comment_interning/expression_statement.js new file mode 100644 index 0000000..3e1eca1 --- /dev/null +++ b/lib/test/flow/comment_interning/expression_statement.js @@ -0,0 +1,22 @@ +/* 1.1 L num */ 1; /* 1.2 T expr stmt */ + +/* 2.1 L num */ +2; /* 2.2 T expr stmt */ + +/* 3.1 L num */ 3; /* 3.2 L num */ 3; /* 3.3 T expr stmt */ + +{ + 4; /* 4.1 T expr stmt */ + + /* 4.2 T expr stmt */ +} + +{ + /* 5.1 L num */ 5 /* 5.2 T num */ + /* 5.3 L num */ 5 + /* 5.4 T num */ +} + +6; /* 6.1 T expr stmt */ + +/* 6.2 T expr stmt */ diff --git a/lib/test/flow/comment_interning/expression_statement.options.json b/lib/test/flow/comment_interning/expression_statement.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/expression_statement.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/expression_statement.tree.json b/lib/test/flow/comment_interning/expression_statement.tree.json new file mode 100644 index 0000000..538dd9b --- /dev/null +++ b/lib/test/flow/comment_interning/expression_statement.tree.json @@ -0,0 +1,333 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":20,"column":2}}, + "range":[16,283], + "body":[ + { + "type":"ExpressionStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":40}}, + "range":[19,40], + "value":" 1.2 T expr stmt " + } + ], + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, + "range":[16,18], + "expression":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "value":" 1.1 L num " + } + ], + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "range":[16,17], + "value":1, + "raw":"1" + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":3},"end":{"line":4,"column":24}}, + "range":[61,82], + "value":" 2.2 T expr stmt " + } + ], + "loc":{"source":null,"start":{"line":4,"column":0},"end":{"line":4,"column":2}}, + "range":[58,60], + "expression":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":15}}, + "range":[42,57], + "value":" 2.1 L num " + } + ], + "loc":{"source":null,"start":{"line":4,"column":0},"end":{"line":4,"column":1}}, + "range":[58,59], + "value":2, + "raw":"2" + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":6,"column":16},"end":{"line":6,"column":18}}, + "range":[100,102], + "expression":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":0},"end":{"line":6,"column":15}}, + "range":[84,99], + "value":" 3.1 L num " + } + ], + "loc":{"source":null,"start":{"line":6,"column":16},"end":{"line":6,"column":17}}, + "range":[100,101], + "value":3, + "raw":"3" + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":38},"end":{"line":6,"column":59}}, + "range":[122,143], + "value":" 3.3 T expr stmt " + } + ], + "loc":{"source":null,"start":{"line":6,"column":35},"end":{"line":6,"column":37}}, + "range":[119,121], + "expression":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":19},"end":{"line":6,"column":34}}, + "range":[103,118], + "value":" 3.2 L num " + } + ], + "loc":{"source":null,"start":{"line":6,"column":35},"end":{"line":6,"column":36}}, + "range":[119,120], + "value":3, + "raw":"3" + }, + "directive":null + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":8,"column":0},"end":{"line":12,"column":1}}, + "range":[145,200], + "body":[ + { + "type":"ExpressionStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":5},"end":{"line":9,"column":26}}, + "range":[152,173], + "value":" 4.1 T expr stmt " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":2},"end":{"line":11,"column":23}}, + "range":[177,198], + "value":" 4.2 T expr stmt " + } + ], + "loc":{"source":null,"start":{"line":9,"column":2},"end":{"line":9,"column":4}}, + "range":[149,151], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":9,"column":2},"end":{"line":9,"column":3}}, + "range":[149,150], + "value":4, + "raw":"4" + }, + "directive":null + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":14,"column":0},"end":{"line":18,"column":1}}, + "range":[202,279], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":15,"column":18},"end":{"line":15,"column":19}}, + "range":[222,223], + "expression":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":20},"end":{"line":15,"column":35}}, + "range":[224,239], + "value":" 5.2 T num " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":2},"end":{"line":15,"column":17}}, + "range":[206,221], + "value":" 5.1 L num " + } + ], + "loc":{"source":null,"start":{"line":15,"column":18},"end":{"line":15,"column":19}}, + "range":[222,223], + "value":5, + "raw":"5" + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":16,"column":18},"end":{"line":16,"column":19}}, + "range":[258,259], + "expression":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":2},"end":{"line":17,"column":17}}, + "range":[262,277], + "value":" 5.4 T num " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":2},"end":{"line":16,"column":17}}, + "range":[242,257], + "value":" 5.3 L num " + } + ], + "loc":{"source":null,"start":{"line":16,"column":18},"end":{"line":16,"column":19}}, + "range":[258,259], + "value":5, + "raw":"5" + }, + "directive":null + } + ] + }, + { + "type":"ExpressionStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":3},"end":{"line":20,"column":24}}, + "range":[284,305], + "value":" 6.1 T expr stmt " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":0},"end":{"line":22,"column":21}}, + "range":[307,328], + "value":" 6.2 T expr stmt " + } + ], + "loc":{"source":null,"start":{"line":20,"column":0},"end":{"line":20,"column":2}}, + "range":[281,283], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":20,"column":0},"end":{"line":20,"column":1}}, + "range":[281,282], + "value":6, + "raw":"6" + }, + "directive":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "value":" 1.1 L num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":40}}, + "range":[19,40], + "value":" 1.2 T expr stmt " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":15}}, + "range":[42,57], + "value":" 2.1 L num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":3},"end":{"line":4,"column":24}}, + "range":[61,82], + "value":" 2.2 T expr stmt " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":0},"end":{"line":6,"column":15}}, + "range":[84,99], + "value":" 3.1 L num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":19},"end":{"line":6,"column":34}}, + "range":[103,118], + "value":" 3.2 L num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":38},"end":{"line":6,"column":59}}, + "range":[122,143], + "value":" 3.3 T expr stmt " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":5},"end":{"line":9,"column":26}}, + "range":[152,173], + "value":" 4.1 T expr stmt " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":2},"end":{"line":11,"column":23}}, + "range":[177,198], + "value":" 4.2 T expr stmt " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":2},"end":{"line":15,"column":17}}, + "range":[206,221], + "value":" 5.1 L num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":20},"end":{"line":15,"column":35}}, + "range":[224,239], + "value":" 5.2 T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":2},"end":{"line":16,"column":17}}, + "range":[242,257], + "value":" 5.3 L num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":2},"end":{"line":17,"column":17}}, + "range":[262,277], + "value":" 5.4 T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":3},"end":{"line":20,"column":24}}, + "range":[284,305], + "value":" 6.1 T expr stmt " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":0},"end":{"line":22,"column":21}}, + "range":[307,328], + "value":" 6.2 T expr stmt " + } + ] +} diff --git a/lib/test/flow/comment_interning/for.js b/lib/test/flow/comment_interning/for.js new file mode 100644 index 0000000..896f014 --- /dev/null +++ b/lib/test/flow/comment_interning/for.js @@ -0,0 +1,7 @@ +/* 1.1 L for */ for /* 1.2 L for */ (;;) /* 1.3 L block */ {} /* 1.4 T block */ + +for (/* 2.1 L var decl */ var x = 1 /* 2.2 T num */; /* 2.3 L bool */ true /* 2.4 T bool */; /* 2.5 L id */ x /* 2.6 T id */) {} + +/* 3.1 L for */ for /* 3.2 L for */ (/* 3.3 L id */ x /* 3.4 T id */ of /* 3.5 L arr */ [] /* 3.6 T arr */) /* 3.7 L block */ {} /* 3.8 T block */ + +/* 4.1 L for */ for /* 4.2 L for */ (/* 4.3 L id */ x /* 4.4 T id */ in /* 4.5 L obj */ {} /* 4.6 T obj */) /* 4.7 L block */ {} /* 4.8 T block */ diff --git a/lib/test/flow/comment_interning/for.options.json b/lib/test/flow/comment_interning/for.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/for.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/for.tree.json b/lib/test/flow/comment_interning/for.tree.json new file mode 100644 index 0000000..36537b1 --- /dev/null +++ b/lib/test/flow/comment_interning/for.tree.json @@ -0,0 +1,487 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":7,"column":128}}, + "range":[16,487], + "body":[ + { + "type":"ForStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "value":" 1.1 L for " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":35}}, + "range":[20,35], + "value":" 1.2 L for " + } + ], + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":61}}, + "range":[16,61], + "init":null, + "test":null, + "update":null, + "body":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":62},"end":{"line":1,"column":79}}, + "range":[62,79], + "value":" 1.4 T block " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":58}}, + "range":[41,58], + "value":" 1.3 L block " + } + ], + "loc":{"source":null,"start":{"line":1,"column":59},"end":{"line":1,"column":61}}, + "range":[59,61], + "body":[] + } + }, + { + "type":"ForStatement", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":128}}, + "range":[81,209], + "init":{ + "type":"VariableDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":5},"end":{"line":3,"column":25}}, + "range":[86,106], + "value":" 2.1 L var decl " + } + ], + "loc":{"source":null,"start":{"line":3,"column":26},"end":{"line":3,"column":35}}, + "range":[107,116], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":3,"column":30},"end":{"line":3,"column":35}}, + "range":[111,116], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":30},"end":{"line":3,"column":31}}, + "range":[111,112], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":36},"end":{"line":3,"column":51}}, + "range":[117,132], + "value":" 2.2 T num " + } + ], + "loc":{"source":null,"start":{"line":3,"column":34},"end":{"line":3,"column":35}}, + "range":[115,116], + "value":1, + "raw":"1" + } + } + ], + "kind":"var" + }, + "test":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":75},"end":{"line":3,"column":91}}, + "range":[156,172], + "value":" 2.4 T bool " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":53},"end":{"line":3,"column":69}}, + "range":[134,150], + "value":" 2.3 L bool " + } + ], + "loc":{"source":null,"start":{"line":3,"column":70},"end":{"line":3,"column":74}}, + "range":[151,155], + "value":true, + "raw":"true" + }, + "update":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":110},"end":{"line":3,"column":124}}, + "range":[191,205], + "value":" 2.6 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":93},"end":{"line":3,"column":107}}, + "range":[174,188], + "value":" 2.5 L id " + } + ], + "loc":{"source":null,"start":{"line":3,"column":108},"end":{"line":3,"column":109}}, + "range":[189,190], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":126},"end":{"line":3,"column":128}}, + "range":[207,209], + "body":[] + } + }, + { + "type":"ForOfStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":15}}, + "range":[211,226], + "value":" 3.1 L for " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":20},"end":{"line":5,"column":35}}, + "range":[231,246], + "value":" 3.2 L for " + } + ], + "loc":{"source":null,"start":{"line":5,"column":16},"end":{"line":5,"column":128}}, + "range":[227,339], + "left":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":54},"end":{"line":5,"column":68}}, + "range":[265,279], + "value":" 3.4 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":37},"end":{"line":5,"column":51}}, + "range":[248,262], + "value":" 3.3 L id " + } + ], + "loc":{"source":null,"start":{"line":5,"column":52},"end":{"line":5,"column":53}}, + "range":[263,264], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"ArrayExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":91},"end":{"line":5,"column":106}}, + "range":[302,317], + "value":" 3.6 T arr " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":72},"end":{"line":5,"column":87}}, + "range":[283,298], + "value":" 3.5 L arr " + } + ], + "loc":{"source":null,"start":{"line":5,"column":88},"end":{"line":5,"column":90}}, + "range":[299,301], + "elements":[] + }, + "body":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":129},"end":{"line":5,"column":146}}, + "range":[340,357], + "value":" 3.8 T block " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":108},"end":{"line":5,"column":125}}, + "range":[319,336], + "value":" 3.7 L block " + } + ], + "loc":{"source":null,"start":{"line":5,"column":126},"end":{"line":5,"column":128}}, + "range":[337,339], + "body":[] + }, + "await":false + }, + { + "type":"ForInStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":15}}, + "range":[359,374], + "value":" 4.1 L for " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":20},"end":{"line":7,"column":35}}, + "range":[379,394], + "value":" 4.2 L for " + } + ], + "loc":{"source":null,"start":{"line":7,"column":16},"end":{"line":7,"column":128}}, + "range":[375,487], + "left":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":54},"end":{"line":7,"column":68}}, + "range":[413,427], + "value":" 4.4 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":37},"end":{"line":7,"column":51}}, + "range":[396,410], + "value":" 4.3 L id " + } + ], + "loc":{"source":null,"start":{"line":7,"column":52},"end":{"line":7,"column":53}}, + "range":[411,412], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"ObjectExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":91},"end":{"line":7,"column":106}}, + "range":[450,465], + "value":" 4.6 T obj " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":72},"end":{"line":7,"column":87}}, + "range":[431,446], + "value":" 4.5 L obj " + } + ], + "loc":{"source":null,"start":{"line":7,"column":88},"end":{"line":7,"column":90}}, + "range":[447,449], + "properties":[] + }, + "body":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":129},"end":{"line":7,"column":146}}, + "range":[488,505], + "value":" 4.8 T block " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":108},"end":{"line":7,"column":125}}, + "range":[467,484], + "value":" 4.7 L block " + } + ], + "loc":{"source":null,"start":{"line":7,"column":126},"end":{"line":7,"column":128}}, + "range":[485,487], + "body":[] + }, + "each":false + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "value":" 1.1 L for " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":35}}, + "range":[20,35], + "value":" 1.2 L for " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":58}}, + "range":[41,58], + "value":" 1.3 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":62},"end":{"line":1,"column":79}}, + "range":[62,79], + "value":" 1.4 T block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":5},"end":{"line":3,"column":25}}, + "range":[86,106], + "value":" 2.1 L var decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":36},"end":{"line":3,"column":51}}, + "range":[117,132], + "value":" 2.2 T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":53},"end":{"line":3,"column":69}}, + "range":[134,150], + "value":" 2.3 L bool " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":75},"end":{"line":3,"column":91}}, + "range":[156,172], + "value":" 2.4 T bool " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":93},"end":{"line":3,"column":107}}, + "range":[174,188], + "value":" 2.5 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":110},"end":{"line":3,"column":124}}, + "range":[191,205], + "value":" 2.6 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":15}}, + "range":[211,226], + "value":" 3.1 L for " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":20},"end":{"line":5,"column":35}}, + "range":[231,246], + "value":" 3.2 L for " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":37},"end":{"line":5,"column":51}}, + "range":[248,262], + "value":" 3.3 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":54},"end":{"line":5,"column":68}}, + "range":[265,279], + "value":" 3.4 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":72},"end":{"line":5,"column":87}}, + "range":[283,298], + "value":" 3.5 L arr " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":91},"end":{"line":5,"column":106}}, + "range":[302,317], + "value":" 3.6 T arr " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":108},"end":{"line":5,"column":125}}, + "range":[319,336], + "value":" 3.7 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":129},"end":{"line":5,"column":146}}, + "range":[340,357], + "value":" 3.8 T block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":15}}, + "range":[359,374], + "value":" 4.1 L for " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":20},"end":{"line":7,"column":35}}, + "range":[379,394], + "value":" 4.2 L for " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":37},"end":{"line":7,"column":51}}, + "range":[396,410], + "value":" 4.3 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":54},"end":{"line":7,"column":68}}, + "range":[413,427], + "value":" 4.4 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":72},"end":{"line":7,"column":87}}, + "range":[431,446], + "value":" 4.5 L obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":91},"end":{"line":7,"column":106}}, + "range":[450,465], + "value":" 4.6 T obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":108},"end":{"line":7,"column":125}}, + "range":[467,484], + "value":" 4.7 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":129},"end":{"line":7,"column":146}}, + "range":[488,505], + "value":" 4.8 T block " + } + ] +} diff --git a/lib/test/flow/comment_interning/function_declaration.js b/lib/test/flow/comment_interning/function_declaration.js new file mode 100644 index 0000000..f0cce98 --- /dev/null +++ b/lib/test/flow/comment_interning/function_declaration.js @@ -0,0 +1,47 @@ +/* 1.1 L func */ async /* 1.2 L func */ function /* 1.3 L func */ * /* 1.4 L id */ test /* 1.5 L params */ () /* 1.6 L block */ {} /* 1.7 T block */ + +export default function /* 2.1 L params */ () /* 2.2 L block */ {} + +function /* 3.1 L id */ name /* 3.2 L tparams */ /* 3.3 L params */ () {} + +function name() /* 4.1 T params */ : /* 4.2 L any */ any /* 4.3 L block */ {} + +function name(): /* 5.1 L pred */ %checks /* 5.2 L block */ {} + +function name(): /* 6.1 L pred */ %checks /* 6.2 L pred */ (true) /* 6.3 L block */ {} + +function name(): boolean /* 7.1 L pred */ %checks /* 7.2 L block */ {} + +{ + /* 8.1 L func decl */ function name() {} /* 8.2 T block */ + /* 8.3 L func decl */ function name() {} + /* 8.4 T block */ +} + +function name() {} /* 9.1 L func */ function name() {} /* 9.2 T block */ + +function name(/* 10.1 L rest param */ ... /* 10.2 L id */ x /* 10.3 T id */ ) {} + +function /* 11.1 L id */ foo /* 11.2 L tparams */ /* 11.3 L params */ () /* 11.4 T params */ : /* 11.5 L any */ any /* 11.6 L block */ {} + +function /* 12.1 L id */ foo /* 12.2 T id */ + /* 12.3 L tparams */ /* 12.4 T tparams */ + /* 12.5 L params */ () /* 12.6 T params */ + /* 12.7 T params */ : /* 12.8 L any */ any /* 12.9 T any */ + /* 12.10 L pred */ %checks /* 12.11 T pred */ + /* 12.12 L block */ {} + +function /* 13.1 L id */ foo /* 13.2 T id */ + /* 13.3 L params */ () /* 13.4 T params */ + : /* 13.5 L any */ any /* 13.6 T any */ + /* 13.7 L block */ {} + +function /* 14.1 L id */ foo /* 14.2 T id */ + /* 14.3 L params */ () /* 14.4 T params */ + /* 14.5 L block */ {} + +function foo() { /* 15.1 I block */ } + +function foo(/* 16.1 I params */) {} + +function foo(a, /* 17.1 I params */) {} diff --git a/lib/test/flow/comment_interning/function_declaration.options.json b/lib/test/flow/comment_interning/function_declaration.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/function_declaration.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/function_declaration.tree.json b/lib/test/flow/comment_interning/function_declaration.tree.json new file mode 100644 index 0000000..140f4b3 --- /dev/null +++ b/lib/test/flow/comment_interning/function_declaration.tree.json @@ -0,0 +1,1531 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":47,"column":39}}, + "range":[17,1690], + "body":[ + { + "type":"FunctionDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "value":" 1.1 L func " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":39}}, + "range":[23,39], + "value":" 1.2 L func " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":49},"end":{"line":1,"column":65}}, + "range":[49,65], + "value":" 1.3 L func " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":88},"end":{"line":1,"column":106}}, + "range":[88,106], + "value":" 1.5 L params " + } + ], + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":130}}, + "range":[17,130], + "id":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":68},"end":{"line":1,"column":82}}, + "range":[68,82], + "value":" 1.4 L id " + } + ], + "loc":{"source":null,"start":{"line":1,"column":83},"end":{"line":1,"column":87}}, + "range":[83,87], + "name":"test", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":131},"end":{"line":1,"column":148}}, + "range":[131,148], + "value":" 1.7 T block " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":110},"end":{"line":1,"column":127}}, + "range":[110,127], + "value":" 1.6 L block " + } + ], + "loc":{"source":null,"start":{"line":1,"column":128},"end":{"line":1,"column":130}}, + "range":[128,130], + "body":[] + }, + "async":true, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"ExportDefaultDeclaration", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":66}}, + "range":[150,216], + "declaration":{ + "type":"FunctionDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":24},"end":{"line":3,"column":42}}, + "range":[174,192], + "value":" 2.1 L params " + } + ], + "loc":{"source":null,"start":{"line":3,"column":15},"end":{"line":3,"column":66}}, + "range":[165,216], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":46},"end":{"line":3,"column":63}}, + "range":[196,213], + "value":" 2.2 L block " + } + ], + "loc":{"source":null,"start":{"line":3,"column":64},"end":{"line":3,"column":66}}, + "range":[214,216], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "exportKind":"value" + }, + { + "type":"FunctionDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":53},"end":{"line":5,"column":71}}, + "range":[271,289], + "value":" 3.3 L params " + } + ], + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":77}}, + "range":[218,295], + "id":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":9},"end":{"line":5,"column":23}}, + "range":[227,241], + "value":" 3.1 L id " + } + ], + "loc":{"source":null,"start":{"line":5,"column":24},"end":{"line":5,"column":28}}, + "range":[242,246], + "name":"name", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":5,"column":75},"end":{"line":5,"column":77}}, + "range":[293,295], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":29},"end":{"line":5,"column":48}}, + "range":[247,266], + "value":" 3.2 L tparams " + } + ], + "loc":{"source":null,"start":{"line":5,"column":49},"end":{"line":5,"column":52}}, + "range":[267,270], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":5,"column":50},"end":{"line":5,"column":51}}, + "range":[268,269], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + { + "type":"FunctionDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":16},"end":{"line":7,"column":34}}, + "range":[313,331], + "value":" 4.1 T params " + } + ], + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":77}}, + "range":[297,374], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":9},"end":{"line":7,"column":13}}, + "range":[306,310], + "name":"name", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":57},"end":{"line":7,"column":74}}, + "range":[354,371], + "value":" 4.3 L block " + } + ], + "loc":{"source":null,"start":{"line":7,"column":75},"end":{"line":7,"column":77}}, + "range":[372,374], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":35},"end":{"line":7,"column":56}}, + "range":[332,353], + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":37},"end":{"line":7,"column":52}}, + "range":[334,349], + "value":" 4.2 L any " + } + ], + "loc":{"source":null,"start":{"line":7,"column":53},"end":{"line":7,"column":56}}, + "range":[350,353] + } + }, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":9,"column":62}}, + "range":[376,438], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":9},"end":{"line":9,"column":13}}, + "range":[385,389], + "name":"name", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":42},"end":{"line":9,"column":59}}, + "range":[418,435], + "value":" 5.2 L block " + } + ], + "loc":{"source":null,"start":{"line":9,"column":60},"end":{"line":9,"column":62}}, + "range":[436,438], + "body":[] + }, + "async":false, + "generator":false, + "predicate":{ + "type":"InferredPredicate", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":17},"end":{"line":9,"column":33}}, + "range":[393,409], + "value":" 5.1 L pred " + } + ], + "loc":{"source":null,"start":{"line":9,"column":34},"end":{"line":9,"column":41}}, + "range":[410,417] + }, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":11,"column":86}}, + "range":[440,526], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":11,"column":9},"end":{"line":11,"column":13}}, + "range":[449,453], + "name":"name", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":66},"end":{"line":11,"column":83}}, + "range":[506,523], + "value":" 6.3 L block " + } + ], + "loc":{"source":null,"start":{"line":11,"column":84},"end":{"line":11,"column":86}}, + "range":[524,526], + "body":[] + }, + "async":false, + "generator":false, + "predicate":{ + "type":"DeclaredPredicate", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":17},"end":{"line":11,"column":33}}, + "range":[457,473], + "value":" 6.1 L pred " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":42},"end":{"line":11,"column":58}}, + "range":[482,498], + "value":" 6.2 L pred " + } + ], + "loc":{"source":null,"start":{"line":11,"column":34},"end":{"line":11,"column":65}}, + "range":[474,505], + "value":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":11,"column":60},"end":{"line":11,"column":64}}, + "range":[500,504], + "value":true, + "raw":"true" + } + }, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":13,"column":0},"end":{"line":13,"column":70}}, + "range":[528,598], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":13,"column":9},"end":{"line":13,"column":13}}, + "range":[537,541], + "name":"name", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":50},"end":{"line":13,"column":67}}, + "range":[578,595], + "value":" 7.2 L block " + } + ], + "loc":{"source":null,"start":{"line":13,"column":68},"end":{"line":13,"column":70}}, + "range":[596,598], + "body":[] + }, + "async":false, + "generator":false, + "predicate":{ + "type":"InferredPredicate", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":25},"end":{"line":13,"column":41}}, + "range":[553,569], + "value":" 7.1 L pred " + } + ], + "loc":{"source":null,"start":{"line":13,"column":42},"end":{"line":13,"column":49}}, + "range":[570,577] + }, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":13,"column":15},"end":{"line":13,"column":24}}, + "range":[543,552], + "typeAnnotation":{ + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":13,"column":17},"end":{"line":13,"column":24}}, + "range":[545,552] + } + }, + "typeParameters":null + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":15,"column":0},"end":{"line":19,"column":1}}, + "range":[600,727], + "body":[ + { + "type":"FunctionDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":2},"end":{"line":16,"column":23}}, + "range":[604,625], + "value":" 8.1 L func decl " + } + ], + "loc":{"source":null,"start":{"line":16,"column":24},"end":{"line":16,"column":42}}, + "range":[626,644], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":16,"column":33},"end":{"line":16,"column":37}}, + "range":[635,639], + "name":"name", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":43},"end":{"line":16,"column":60}}, + "range":[645,662], + "value":" 8.2 T block " + } + ], + "loc":{"source":null,"start":{"line":16,"column":40},"end":{"line":16,"column":42}}, + "range":[642,644], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":2},"end":{"line":17,"column":23}}, + "range":[665,686], + "value":" 8.3 L func decl " + } + ], + "loc":{"source":null,"start":{"line":17,"column":24},"end":{"line":17,"column":42}}, + "range":[687,705], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":17,"column":33},"end":{"line":17,"column":37}}, + "range":[696,700], + "name":"name", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":18,"column":19}}, + "range":[708,725], + "value":" 8.4 T block " + } + ], + "loc":{"source":null,"start":{"line":17,"column":40},"end":{"line":17,"column":42}}, + "range":[703,705], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ] + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":21,"column":0},"end":{"line":21,"column":18}}, + "range":[729,747], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":21,"column":9},"end":{"line":21,"column":13}}, + "range":[738,742], + "name":"name", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":21,"column":16},"end":{"line":21,"column":18}}, + "range":[745,747], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":19},"end":{"line":21,"column":35}}, + "range":[748,764], + "value":" 9.1 L func " + } + ], + "loc":{"source":null,"start":{"line":21,"column":36},"end":{"line":21,"column":54}}, + "range":[765,783], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":21,"column":45},"end":{"line":21,"column":49}}, + "range":[774,778], + "name":"name", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":55},"end":{"line":21,"column":72}}, + "range":[784,801], + "value":" 9.2 T block " + } + ], + "loc":{"source":null,"start":{"line":21,"column":52},"end":{"line":21,"column":54}}, + "range":[781,783], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":23,"column":0},"end":{"line":23,"column":80}}, + "range":[803,883], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":23,"column":9},"end":{"line":23,"column":13}}, + "range":[812,816], + "name":"name", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"RestElement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":14},"end":{"line":23,"column":37}}, + "range":[817,840], + "value":" 10.1 L rest param " + } + ], + "loc":{"source":null,"start":{"line":23,"column":38},"end":{"line":23,"column":59}}, + "range":[841,862], + "argument":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":60},"end":{"line":23,"column":75}}, + "range":[863,878], + "value":" 10.3 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":42},"end":{"line":23,"column":57}}, + "range":[845,860], + "value":" 10.2 L id " + } + ], + "loc":{"source":null,"start":{"line":23,"column":58},"end":{"line":23,"column":59}}, + "range":[861,862], + "name":"x", + "typeAnnotation":null, + "optional":false + } + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":23,"column":78},"end":{"line":23,"column":80}}, + "range":[881,883], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":77},"end":{"line":25,"column":96}}, + "range":[962,981], + "value":" 11.4 T params " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":54},"end":{"line":25,"column":73}}, + "range":[939,958], + "value":" 11.3 L params " + } + ], + "loc":{"source":null,"start":{"line":25,"column":0},"end":{"line":25,"column":141}}, + "range":[885,1026], + "id":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":9},"end":{"line":25,"column":24}}, + "range":[894,909], + "value":" 11.1 L id " + } + ], + "loc":{"source":null,"start":{"line":25,"column":25},"end":{"line":25,"column":28}}, + "range":[910,913], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":120},"end":{"line":25,"column":138}}, + "range":[1005,1023], + "value":" 11.6 L block " + } + ], + "loc":{"source":null,"start":{"line":25,"column":139},"end":{"line":25,"column":141}}, + "range":[1024,1026], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":25,"column":97},"end":{"line":25,"column":119}}, + "range":[982,1004], + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":99},"end":{"line":25,"column":115}}, + "range":[984,1000], + "value":" 11.5 L any " + } + ], + "loc":{"source":null,"start":{"line":25,"column":116},"end":{"line":25,"column":119}}, + "range":[1001,1004] + } + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":29},"end":{"line":25,"column":49}}, + "range":[914,934], + "value":" 11.2 L tparams " + } + ], + "loc":{"source":null,"start":{"line":25,"column":50},"end":{"line":25,"column":53}}, + "range":[935,938], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":25,"column":51},"end":{"line":25,"column":52}}, + "range":[936,937], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + { + "type":"FunctionDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":25},"end":{"line":29,"column":44}}, + "range":[1146,1165], + "value":" 12.6 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":2},"end":{"line":30,"column":21}}, + "range":[1168,1187], + "value":" 12.7 T params " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":2},"end":{"line":29,"column":21}}, + "range":[1123,1142], + "value":" 12.5 L params " + } + ], + "loc":{"source":null,"start":{"line":27,"column":0},"end":{"line":32,"column":24}}, + "range":[1028,1300], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":27,"column":29},"end":{"line":27,"column":44}}, + "range":[1057,1072], + "value":" 12.2 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":27,"column":9},"end":{"line":27,"column":24}}, + "range":[1037,1052], + "value":" 12.1 L id " + } + ], + "loc":{"source":null,"start":{"line":27,"column":25},"end":{"line":27,"column":28}}, + "range":[1053,1056], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":2},"end":{"line":32,"column":21}}, + "range":[1278,1297], + "value":" 12.12 L block " + } + ], + "loc":{"source":null,"start":{"line":32,"column":22},"end":{"line":32,"column":24}}, + "range":[1298,1300], + "body":[] + }, + "async":false, + "generator":false, + "predicate":{ + "type":"InferredPredicate", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":29},"end":{"line":31,"column":47}}, + "range":[1257,1275], + "value":" 12.11 T pred " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":2},"end":{"line":31,"column":20}}, + "range":[1230,1248], + "value":" 12.10 L pred " + } + ], + "loc":{"source":null,"start":{"line":31,"column":21},"end":{"line":31,"column":28}}, + "range":[1249,1256] + }, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":30,"column":22},"end":{"line":30,"column":44}}, + "range":[1188,1210], + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":45},"end":{"line":30,"column":61}}, + "range":[1211,1227], + "value":" 12.9 T any " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":24},"end":{"line":30,"column":40}}, + "range":[1190,1206], + "value":" 12.8 L any " + } + ], + "loc":{"source":null,"start":{"line":30,"column":41},"end":{"line":30,"column":44}}, + "range":[1207,1210] + } + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":28,"column":27},"end":{"line":28,"column":47}}, + "range":[1100,1120], + "value":" 12.4 T tparams " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":28,"column":2},"end":{"line":28,"column":22}}, + "range":[1075,1095], + "value":" 12.3 L tparams " + } + ], + "loc":{"source":null,"start":{"line":28,"column":23},"end":{"line":28,"column":26}}, + "range":[1096,1099], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":28,"column":24},"end":{"line":28,"column":25}}, + "range":[1097,1098], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + { + "type":"FunctionDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":25},"end":{"line":35,"column":44}}, + "range":[1372,1391], + "value":" 13.4 T params " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":2},"end":{"line":35,"column":21}}, + "range":[1349,1368], + "value":" 13.3 L params " + } + ], + "loc":{"source":null,"start":{"line":34,"column":0},"end":{"line":37,"column":23}}, + "range":[1302,1457], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":29},"end":{"line":34,"column":44}}, + "range":[1331,1346], + "value":" 13.2 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":9},"end":{"line":34,"column":24}}, + "range":[1311,1326], + "value":" 13.1 L id " + } + ], + "loc":{"source":null,"start":{"line":34,"column":25},"end":{"line":34,"column":28}}, + "range":[1327,1330], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":37,"column":2},"end":{"line":37,"column":20}}, + "range":[1436,1454], + "value":" 13.7 L block " + } + ], + "loc":{"source":null,"start":{"line":37,"column":21},"end":{"line":37,"column":23}}, + "range":[1455,1457], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":36,"column":2},"end":{"line":36,"column":24}}, + "range":[1394,1416], + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":25},"end":{"line":36,"column":41}}, + "range":[1417,1433], + "value":" 13.6 T any " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":4},"end":{"line":36,"column":20}}, + "range":[1396,1412], + "value":" 13.5 L any " + } + ], + "loc":{"source":null,"start":{"line":36,"column":21},"end":{"line":36,"column":24}}, + "range":[1413,1416] + } + }, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":40,"column":25},"end":{"line":40,"column":44}}, + "range":[1529,1548], + "value":" 14.4 T params " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":40,"column":2},"end":{"line":40,"column":21}}, + "range":[1506,1525], + "value":" 14.3 L params " + } + ], + "loc":{"source":null,"start":{"line":39,"column":0},"end":{"line":41,"column":23}}, + "range":[1459,1572], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":39,"column":29},"end":{"line":39,"column":44}}, + "range":[1488,1503], + "value":" 14.2 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":39,"column":9},"end":{"line":39,"column":24}}, + "range":[1468,1483], + "value":" 14.1 L id " + } + ], + "loc":{"source":null,"start":{"line":39,"column":25},"end":{"line":39,"column":28}}, + "range":[1484,1487], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":41,"column":2},"end":{"line":41,"column":20}}, + "range":[1551,1569], + "value":" 14.5 L block " + } + ], + "loc":{"source":null,"start":{"line":41,"column":21},"end":{"line":41,"column":23}}, + "range":[1570,1572], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":43,"column":0},"end":{"line":43,"column":37}}, + "range":[1574,1611], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":43,"column":9},"end":{"line":43,"column":12}}, + "range":[1583,1586], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":43,"column":17},"end":{"line":43,"column":35}}, + "range":[1591,1609], + "value":" 15.1 I block " + } + ], + "loc":{"source":null,"start":{"line":43,"column":15},"end":{"line":43,"column":37}}, + "range":[1589,1611], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":45,"column":13},"end":{"line":45,"column":32}}, + "range":[1626,1645], + "value":" 16.1 I params " + } + ], + "loc":{"source":null,"start":{"line":45,"column":0},"end":{"line":45,"column":36}}, + "range":[1613,1649], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":45,"column":9},"end":{"line":45,"column":12}}, + "range":[1622,1625], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":45,"column":34},"end":{"line":45,"column":36}}, + "range":[1647,1649], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":47,"column":16},"end":{"line":47,"column":35}}, + "range":[1667,1686], + "value":" 17.1 I params " + } + ], + "loc":{"source":null,"start":{"line":47,"column":0},"end":{"line":47,"column":39}}, + "range":[1651,1690], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":47,"column":9},"end":{"line":47,"column":12}}, + "range":[1660,1663], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":47,"column":13},"end":{"line":47,"column":14}}, + "range":[1664,1665], + "name":"a", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":47,"column":37},"end":{"line":47,"column":39}}, + "range":[1688,1690], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "value":" 1.1 L func " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":39}}, + "range":[23,39], + "value":" 1.2 L func " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":49},"end":{"line":1,"column":65}}, + "range":[49,65], + "value":" 1.3 L func " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":68},"end":{"line":1,"column":82}}, + "range":[68,82], + "value":" 1.4 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":88},"end":{"line":1,"column":106}}, + "range":[88,106], + "value":" 1.5 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":110},"end":{"line":1,"column":127}}, + "range":[110,127], + "value":" 1.6 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":131},"end":{"line":1,"column":148}}, + "range":[131,148], + "value":" 1.7 T block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":24},"end":{"line":3,"column":42}}, + "range":[174,192], + "value":" 2.1 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":46},"end":{"line":3,"column":63}}, + "range":[196,213], + "value":" 2.2 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":9},"end":{"line":5,"column":23}}, + "range":[227,241], + "value":" 3.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":29},"end":{"line":5,"column":48}}, + "range":[247,266], + "value":" 3.2 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":53},"end":{"line":5,"column":71}}, + "range":[271,289], + "value":" 3.3 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":16},"end":{"line":7,"column":34}}, + "range":[313,331], + "value":" 4.1 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":37},"end":{"line":7,"column":52}}, + "range":[334,349], + "value":" 4.2 L any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":57},"end":{"line":7,"column":74}}, + "range":[354,371], + "value":" 4.3 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":17},"end":{"line":9,"column":33}}, + "range":[393,409], + "value":" 5.1 L pred " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":42},"end":{"line":9,"column":59}}, + "range":[418,435], + "value":" 5.2 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":17},"end":{"line":11,"column":33}}, + "range":[457,473], + "value":" 6.1 L pred " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":42},"end":{"line":11,"column":58}}, + "range":[482,498], + "value":" 6.2 L pred " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":66},"end":{"line":11,"column":83}}, + "range":[506,523], + "value":" 6.3 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":25},"end":{"line":13,"column":41}}, + "range":[553,569], + "value":" 7.1 L pred " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":50},"end":{"line":13,"column":67}}, + "range":[578,595], + "value":" 7.2 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":2},"end":{"line":16,"column":23}}, + "range":[604,625], + "value":" 8.1 L func decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":43},"end":{"line":16,"column":60}}, + "range":[645,662], + "value":" 8.2 T block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":2},"end":{"line":17,"column":23}}, + "range":[665,686], + "value":" 8.3 L func decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":18,"column":19}}, + "range":[708,725], + "value":" 8.4 T block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":19},"end":{"line":21,"column":35}}, + "range":[748,764], + "value":" 9.1 L func " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":55},"end":{"line":21,"column":72}}, + "range":[784,801], + "value":" 9.2 T block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":14},"end":{"line":23,"column":37}}, + "range":[817,840], + "value":" 10.1 L rest param " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":42},"end":{"line":23,"column":57}}, + "range":[845,860], + "value":" 10.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":60},"end":{"line":23,"column":75}}, + "range":[863,878], + "value":" 10.3 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":9},"end":{"line":25,"column":24}}, + "range":[894,909], + "value":" 11.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":29},"end":{"line":25,"column":49}}, + "range":[914,934], + "value":" 11.2 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":54},"end":{"line":25,"column":73}}, + "range":[939,958], + "value":" 11.3 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":77},"end":{"line":25,"column":96}}, + "range":[962,981], + "value":" 11.4 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":99},"end":{"line":25,"column":115}}, + "range":[984,1000], + "value":" 11.5 L any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":120},"end":{"line":25,"column":138}}, + "range":[1005,1023], + "value":" 11.6 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":27,"column":9},"end":{"line":27,"column":24}}, + "range":[1037,1052], + "value":" 12.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":27,"column":29},"end":{"line":27,"column":44}}, + "range":[1057,1072], + "value":" 12.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":28,"column":2},"end":{"line":28,"column":22}}, + "range":[1075,1095], + "value":" 12.3 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":28,"column":27},"end":{"line":28,"column":47}}, + "range":[1100,1120], + "value":" 12.4 T tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":2},"end":{"line":29,"column":21}}, + "range":[1123,1142], + "value":" 12.5 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":25},"end":{"line":29,"column":44}}, + "range":[1146,1165], + "value":" 12.6 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":2},"end":{"line":30,"column":21}}, + "range":[1168,1187], + "value":" 12.7 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":24},"end":{"line":30,"column":40}}, + "range":[1190,1206], + "value":" 12.8 L any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":45},"end":{"line":30,"column":61}}, + "range":[1211,1227], + "value":" 12.9 T any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":2},"end":{"line":31,"column":20}}, + "range":[1230,1248], + "value":" 12.10 L pred " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":29},"end":{"line":31,"column":47}}, + "range":[1257,1275], + "value":" 12.11 T pred " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":2},"end":{"line":32,"column":21}}, + "range":[1278,1297], + "value":" 12.12 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":9},"end":{"line":34,"column":24}}, + "range":[1311,1326], + "value":" 13.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":29},"end":{"line":34,"column":44}}, + "range":[1331,1346], + "value":" 13.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":2},"end":{"line":35,"column":21}}, + "range":[1349,1368], + "value":" 13.3 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":25},"end":{"line":35,"column":44}}, + "range":[1372,1391], + "value":" 13.4 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":4},"end":{"line":36,"column":20}}, + "range":[1396,1412], + "value":" 13.5 L any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":25},"end":{"line":36,"column":41}}, + "range":[1417,1433], + "value":" 13.6 T any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":37,"column":2},"end":{"line":37,"column":20}}, + "range":[1436,1454], + "value":" 13.7 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":39,"column":9},"end":{"line":39,"column":24}}, + "range":[1468,1483], + "value":" 14.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":39,"column":29},"end":{"line":39,"column":44}}, + "range":[1488,1503], + "value":" 14.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":40,"column":2},"end":{"line":40,"column":21}}, + "range":[1506,1525], + "value":" 14.3 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":40,"column":25},"end":{"line":40,"column":44}}, + "range":[1529,1548], + "value":" 14.4 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":41,"column":2},"end":{"line":41,"column":20}}, + "range":[1551,1569], + "value":" 14.5 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":43,"column":17},"end":{"line":43,"column":35}}, + "range":[1591,1609], + "value":" 15.1 I block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":45,"column":13},"end":{"line":45,"column":32}}, + "range":[1626,1645], + "value":" 16.1 I params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":47,"column":16},"end":{"line":47,"column":35}}, + "range":[1667,1686], + "value":" 17.1 I params " + } + ] +} diff --git a/lib/test/flow/comment_interning/function_expression.js b/lib/test/flow/comment_interning/function_expression.js new file mode 100644 index 0000000..7a0ffb0 --- /dev/null +++ b/lib/test/flow/comment_interning/function_expression.js @@ -0,0 +1,30 @@ +(/* 1.1 L func */ async /* 1.2 L func */ function /* 1.3 L func */ * /* 1.4 L id */ test /* 1.5 L params */ () /* 1.6 L block */ {} /* 1.7 T block */); + +(function /* 2.1 L params */ () /* 2.2 L block */ {}); + +(function /* 3.1 L id */ name /* 3.2 L tparams */ /* 3.3 L params */ () {}); + +(function name() /* 4.1 T params */ : any {}); + +(function /* 5.1 L tparams */ /* 5.2 L params */ () {}); + +(function () {} /* 6.1 T block */ +/* 6.2 T block */); + +(function /* 7.1 L id */ foo /* 7.2 L tparams */ /* 7.3 L params */ () /* 7.4 T params */ : /* 7.5 L any */ any /* 7.6 L block */ {}) + +(function /* 8.1 L id */ foo /* 8.2 T id */ + /* 8.3 L tparams */ /* 8.4 T tparams */ + /* 8.5 L params */ () /* 8.6 T params */ + /* 8.7 T params */ : /* 8.8 L any */ any /* 8.9 T any */ + /* 8.10 L pred */ %checks /* 8.11 T pred */ + /* 8.12 L block */ {}) + +(function /* 9.1 L id */ foo /* 9.2 T id */ + /* 9.3 L params */ () /* 9.4 T params */ + : /* 9.5 L any */ any /* 9.6 T any */ + /* 9.7 L block */ {}) + +(function /* 10.1 L id */ foo /* 10.2 T id */ + /* 10.3 L params */ () /* 10.4 T params */ + /* 10.5 L block */ {}) diff --git a/lib/test/flow/comment_interning/function_expression.options.json b/lib/test/flow/comment_interning/function_expression.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/function_expression.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/function_expression.tree.json b/lib/test/flow/comment_interning/function_expression.tree.json new file mode 100644 index 0000000..1f80ed8 --- /dev/null +++ b/lib/test/flow/comment_interning/function_expression.tree.json @@ -0,0 +1,1062 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":30,"column":24}}, + "range":[0,1126], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":151}}, + "range":[0,151], + "expression":{ + "type":"FunctionExpression", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":17}}, + "range":[1,17], + "value":" 1.1 L func " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":40}}, + "range":[24,40], + "value":" 1.2 L func " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":50},"end":{"line":1,"column":66}}, + "range":[50,66], + "value":" 1.3 L func " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":89},"end":{"line":1,"column":107}}, + "range":[89,107], + "value":" 1.5 L params " + } + ], + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":131}}, + "range":[18,131], + "id":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":69},"end":{"line":1,"column":83}}, + "range":[69,83], + "value":" 1.4 L id " + } + ], + "loc":{"source":null,"start":{"line":1,"column":84},"end":{"line":1,"column":88}}, + "range":[84,88], + "name":"test", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":132},"end":{"line":1,"column":149}}, + "range":[132,149], + "value":" 1.7 T block " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":111},"end":{"line":1,"column":128}}, + "range":[111,128], + "value":" 1.6 L block " + } + ], + "loc":{"source":null,"start":{"line":1,"column":129},"end":{"line":1,"column":131}}, + "range":[129,131], + "body":[] + }, + "async":true, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":54}}, + "range":[153,207], + "expression":{ + "type":"FunctionExpression", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":10},"end":{"line":3,"column":28}}, + "range":[163,181], + "value":" 2.1 L params " + } + ], + "loc":{"source":null,"start":{"line":3,"column":1},"end":{"line":3,"column":52}}, + "range":[154,205], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":32},"end":{"line":3,"column":49}}, + "range":[185,202], + "value":" 2.2 L block " + } + ], + "loc":{"source":null,"start":{"line":3,"column":50},"end":{"line":3,"column":52}}, + "range":[203,205], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":80}}, + "range":[209,289], + "expression":{ + "type":"FunctionExpression", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":54},"end":{"line":5,"column":72}}, + "range":[263,281], + "value":" 3.3 L params " + } + ], + "loc":{"source":null,"start":{"line":5,"column":1},"end":{"line":5,"column":78}}, + "range":[210,287], + "id":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":10},"end":{"line":5,"column":24}}, + "range":[219,233], + "value":" 3.1 L id " + } + ], + "loc":{"source":null,"start":{"line":5,"column":25},"end":{"line":5,"column":29}}, + "range":[234,238], + "name":"name", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":5,"column":76},"end":{"line":5,"column":78}}, + "range":[285,287], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":30},"end":{"line":5,"column":49}}, + "range":[239,258], + "value":" 3.2 L tparams " + } + ], + "loc":{"source":null,"start":{"line":5,"column":50},"end":{"line":5,"column":53}}, + "range":[259,262], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":5,"column":51},"end":{"line":5,"column":52}}, + "range":[260,261], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":46}}, + "range":[291,337], + "expression":{ + "type":"FunctionExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":17},"end":{"line":7,"column":35}}, + "range":[308,326], + "value":" 4.1 T params " + } + ], + "loc":{"source":null,"start":{"line":7,"column":1},"end":{"line":7,"column":44}}, + "range":[292,335], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":10},"end":{"line":7,"column":14}}, + "range":[301,305], + "name":"name", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":7,"column":42},"end":{"line":7,"column":44}}, + "range":[333,335], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":36},"end":{"line":7,"column":41}}, + "range":[327,332], + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":38},"end":{"line":7,"column":41}}, + "range":[329,332] + } + }, + "typeParameters":null + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":9,"column":60}}, + "range":[339,399], + "expression":{ + "type":"FunctionExpression", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":34},"end":{"line":9,"column":52}}, + "range":[373,391], + "value":" 5.2 L params " + } + ], + "loc":{"source":null,"start":{"line":9,"column":1},"end":{"line":9,"column":58}}, + "range":[340,397], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":9,"column":56},"end":{"line":9,"column":58}}, + "range":[395,397], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":10},"end":{"line":9,"column":29}}, + "range":[349,368], + "value":" 5.1 L tparams " + } + ], + "loc":{"source":null,"start":{"line":9,"column":30},"end":{"line":9,"column":33}}, + "range":[369,372], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":9,"column":31},"end":{"line":9,"column":32}}, + "range":[370,371], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":12,"column":19}}, + "range":[401,454], + "expression":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":11,"column":1},"end":{"line":11,"column":15}}, + "range":[402,416], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":16},"end":{"line":11,"column":33}}, + "range":[417,434], + "value":" 6.1 T block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":0},"end":{"line":12,"column":17}}, + "range":[435,452], + "value":" 6.2 T block " + } + ], + "loc":{"source":null,"start":{"line":11,"column":13},"end":{"line":11,"column":15}}, + "range":[414,416], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":14,"column":0},"end":{"line":30,"column":24}}, + "range":[456,1126], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":14,"column":0},"end":{"line":30,"column":24}}, + "range":[456,1126], + "callee":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":14,"column":0},"end":{"line":26,"column":23}}, + "range":[456,1009], + "callee":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":14,"column":0},"end":{"line":21,"column":24}}, + "range":[456,857], + "callee":{ + "type":"FunctionExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":75},"end":{"line":14,"column":93}}, + "range":[531,549], + "value":" 7.4 T params " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":53},"end":{"line":14,"column":71}}, + "range":[509,527], + "value":" 7.3 L params " + } + ], + "loc":{"source":null,"start":{"line":14,"column":1},"end":{"line":14,"column":136}}, + "range":[457,592], + "id":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":10},"end":{"line":14,"column":24}}, + "range":[466,480], + "value":" 7.1 L id " + } + ], + "loc":{"source":null,"start":{"line":14,"column":25},"end":{"line":14,"column":28}}, + "range":[481,484], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":116},"end":{"line":14,"column":133}}, + "range":[572,589], + "value":" 7.6 L block " + } + ], + "loc":{"source":null,"start":{"line":14,"column":134},"end":{"line":14,"column":136}}, + "range":[590,592], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":14,"column":94},"end":{"line":14,"column":115}}, + "range":[550,571], + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":96},"end":{"line":14,"column":111}}, + "range":[552,567], + "value":" 7.5 L any " + } + ], + "loc":{"source":null,"start":{"line":14,"column":112},"end":{"line":14,"column":115}}, + "range":[568,571] + } + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":29},"end":{"line":14,"column":48}}, + "range":[485,504], + "value":" 7.2 L tparams " + } + ], + "loc":{"source":null,"start":{"line":14,"column":49},"end":{"line":14,"column":52}}, + "range":[505,508], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":14,"column":50},"end":{"line":14,"column":51}}, + "range":[506,507], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "typeArguments":null, + "arguments":[ + { + "type":"FunctionExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":24},"end":{"line":18,"column":42}}, + "range":[709,727], + "value":" 8.6 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":2},"end":{"line":19,"column":20}}, + "range":[730,748], + "value":" 8.7 T params " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":18,"column":20}}, + "range":[687,705], + "value":" 8.5 L params " + } + ], + "loc":{"source":null,"start":{"line":16,"column":1},"end":{"line":21,"column":23}}, + "range":[596,856], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":29},"end":{"line":16,"column":43}}, + "range":[624,638], + "value":" 8.2 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":10},"end":{"line":16,"column":24}}, + "range":[605,619], + "value":" 8.1 L id " + } + ], + "loc":{"source":null,"start":{"line":16,"column":25},"end":{"line":16,"column":28}}, + "range":[620,623], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":2},"end":{"line":21,"column":20}}, + "range":[835,853], + "value":" 8.12 L block " + } + ], + "loc":{"source":null,"start":{"line":21,"column":21},"end":{"line":21,"column":23}}, + "range":[854,856], + "body":[] + }, + "async":false, + "generator":false, + "predicate":{ + "type":"InferredPredicate", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":28},"end":{"line":20,"column":45}}, + "range":[815,832], + "value":" 8.11 T pred " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":2},"end":{"line":20,"column":19}}, + "range":[789,806], + "value":" 8.10 L pred " + } + ], + "loc":{"source":null,"start":{"line":20,"column":20},"end":{"line":20,"column":27}}, + "range":[807,814] + }, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":19,"column":21},"end":{"line":19,"column":42}}, + "range":[749,770], + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":43},"end":{"line":19,"column":58}}, + "range":[771,786], + "value":" 8.9 T any " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":23},"end":{"line":19,"column":38}}, + "range":[751,766], + "value":" 8.8 L any " + } + ], + "loc":{"source":null,"start":{"line":19,"column":39},"end":{"line":19,"column":42}}, + "range":[767,770] + } + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":26},"end":{"line":17,"column":45}}, + "range":[665,684], + "value":" 8.4 T tparams " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":2},"end":{"line":17,"column":21}}, + "range":[641,660], + "value":" 8.3 L tparams " + } + ], + "loc":{"source":null,"start":{"line":17,"column":22},"end":{"line":17,"column":25}}, + "range":[661,664], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":17,"column":23},"end":{"line":17,"column":24}}, + "range":[662,663], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + } + ] + }, + "typeArguments":null, + "arguments":[ + { + "type":"FunctionExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":24},"end":{"line":24,"column":42}}, + "range":[927,945], + "value":" 9.4 T params " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":2},"end":{"line":24,"column":20}}, + "range":[905,923], + "value":" 9.3 L params " + } + ], + "loc":{"source":null,"start":{"line":23,"column":1},"end":{"line":26,"column":22}}, + "range":[860,1008], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":29},"end":{"line":23,"column":43}}, + "range":[888,902], + "value":" 9.2 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":10},"end":{"line":23,"column":24}}, + "range":[869,883], + "value":" 9.1 L id " + } + ], + "loc":{"source":null,"start":{"line":23,"column":25},"end":{"line":23,"column":28}}, + "range":[884,887], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":2},"end":{"line":26,"column":19}}, + "range":[988,1005], + "value":" 9.7 L block " + } + ], + "loc":{"source":null,"start":{"line":26,"column":20},"end":{"line":26,"column":22}}, + "range":[1006,1008], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":25,"column":2},"end":{"line":25,"column":23}}, + "range":[948,969], + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":24},"end":{"line":25,"column":39}}, + "range":[970,985], + "value":" 9.6 T any " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":4},"end":{"line":25,"column":19}}, + "range":[950,965], + "value":" 9.5 L any " + } + ], + "loc":{"source":null,"start":{"line":25,"column":20},"end":{"line":25,"column":23}}, + "range":[966,969] + } + }, + "typeParameters":null + } + ] + }, + "typeArguments":null, + "arguments":[ + { + "type":"FunctionExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":25},"end":{"line":29,"column":44}}, + "range":[1082,1101], + "value":" 10.4 T params " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":2},"end":{"line":29,"column":21}}, + "range":[1059,1078], + "value":" 10.3 L params " + } + ], + "loc":{"source":null,"start":{"line":28,"column":1},"end":{"line":30,"column":23}}, + "range":[1012,1125], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":28,"column":30},"end":{"line":28,"column":45}}, + "range":[1041,1056], + "value":" 10.2 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":28,"column":10},"end":{"line":28,"column":25}}, + "range":[1021,1036], + "value":" 10.1 L id " + } + ], + "loc":{"source":null,"start":{"line":28,"column":26},"end":{"line":28,"column":29}}, + "range":[1037,1040], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":2},"end":{"line":30,"column":20}}, + "range":[1104,1122], + "value":" 10.5 L block " + } + ], + "loc":{"source":null,"start":{"line":30,"column":21},"end":{"line":30,"column":23}}, + "range":[1123,1125], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ] + }, + "directive":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":17}}, + "range":[1,17], + "value":" 1.1 L func " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":40}}, + "range":[24,40], + "value":" 1.2 L func " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":50},"end":{"line":1,"column":66}}, + "range":[50,66], + "value":" 1.3 L func " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":69},"end":{"line":1,"column":83}}, + "range":[69,83], + "value":" 1.4 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":89},"end":{"line":1,"column":107}}, + "range":[89,107], + "value":" 1.5 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":111},"end":{"line":1,"column":128}}, + "range":[111,128], + "value":" 1.6 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":132},"end":{"line":1,"column":149}}, + "range":[132,149], + "value":" 1.7 T block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":10},"end":{"line":3,"column":28}}, + "range":[163,181], + "value":" 2.1 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":32},"end":{"line":3,"column":49}}, + "range":[185,202], + "value":" 2.2 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":10},"end":{"line":5,"column":24}}, + "range":[219,233], + "value":" 3.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":30},"end":{"line":5,"column":49}}, + "range":[239,258], + "value":" 3.2 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":54},"end":{"line":5,"column":72}}, + "range":[263,281], + "value":" 3.3 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":17},"end":{"line":7,"column":35}}, + "range":[308,326], + "value":" 4.1 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":10},"end":{"line":9,"column":29}}, + "range":[349,368], + "value":" 5.1 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":34},"end":{"line":9,"column":52}}, + "range":[373,391], + "value":" 5.2 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":16},"end":{"line":11,"column":33}}, + "range":[417,434], + "value":" 6.1 T block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":0},"end":{"line":12,"column":17}}, + "range":[435,452], + "value":" 6.2 T block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":10},"end":{"line":14,"column":24}}, + "range":[466,480], + "value":" 7.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":29},"end":{"line":14,"column":48}}, + "range":[485,504], + "value":" 7.2 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":53},"end":{"line":14,"column":71}}, + "range":[509,527], + "value":" 7.3 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":75},"end":{"line":14,"column":93}}, + "range":[531,549], + "value":" 7.4 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":96},"end":{"line":14,"column":111}}, + "range":[552,567], + "value":" 7.5 L any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":116},"end":{"line":14,"column":133}}, + "range":[572,589], + "value":" 7.6 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":10},"end":{"line":16,"column":24}}, + "range":[605,619], + "value":" 8.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":29},"end":{"line":16,"column":43}}, + "range":[624,638], + "value":" 8.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":2},"end":{"line":17,"column":21}}, + "range":[641,660], + "value":" 8.3 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":26},"end":{"line":17,"column":45}}, + "range":[665,684], + "value":" 8.4 T tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":18,"column":20}}, + "range":[687,705], + "value":" 8.5 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":24},"end":{"line":18,"column":42}}, + "range":[709,727], + "value":" 8.6 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":2},"end":{"line":19,"column":20}}, + "range":[730,748], + "value":" 8.7 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":23},"end":{"line":19,"column":38}}, + "range":[751,766], + "value":" 8.8 L any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":43},"end":{"line":19,"column":58}}, + "range":[771,786], + "value":" 8.9 T any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":2},"end":{"line":20,"column":19}}, + "range":[789,806], + "value":" 8.10 L pred " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":28},"end":{"line":20,"column":45}}, + "range":[815,832], + "value":" 8.11 T pred " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":2},"end":{"line":21,"column":20}}, + "range":[835,853], + "value":" 8.12 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":10},"end":{"line":23,"column":24}}, + "range":[869,883], + "value":" 9.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":29},"end":{"line":23,"column":43}}, + "range":[888,902], + "value":" 9.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":2},"end":{"line":24,"column":20}}, + "range":[905,923], + "value":" 9.3 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":24},"end":{"line":24,"column":42}}, + "range":[927,945], + "value":" 9.4 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":4},"end":{"line":25,"column":19}}, + "range":[950,965], + "value":" 9.5 L any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":24},"end":{"line":25,"column":39}}, + "range":[970,985], + "value":" 9.6 T any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":2},"end":{"line":26,"column":19}}, + "range":[988,1005], + "value":" 9.7 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":28,"column":10},"end":{"line":28,"column":25}}, + "range":[1021,1036], + "value":" 10.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":28,"column":30},"end":{"line":28,"column":45}}, + "range":[1041,1056], + "value":" 10.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":2},"end":{"line":29,"column":21}}, + "range":[1059,1078], + "value":" 10.3 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":25},"end":{"line":29,"column":44}}, + "range":[1082,1101], + "value":" 10.4 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":2},"end":{"line":30,"column":20}}, + "range":[1104,1122], + "value":" 10.5 L block " + } + ] +} diff --git a/lib/test/flow/comment_interning/function_type.js b/lib/test/flow/comment_interning/function_type.js new file mode 100644 index 0000000..f24e6ce --- /dev/null +++ b/lib/test/flow/comment_interning/function_type.js @@ -0,0 +1,14 @@ +type Test1 = /* 1.1 L generic */ X /* 1.2 T generic */ => /* 1.3 L generic */ Y /* 1.4 T generic */; + +type Test2 = /* 2.1 L params */ ( /* 2.2 L generic */ X /* 2.3 T generic */) /* 2.4 T params */ => /* 2.5 L generic */ Y /* 2.6 T generic */; + +type Test3 = /* 3.1 L tparams */ /* 3.2 L params */ (/* 3.3 T generic */ T /* 3.4 L generic */) /* 3.5 T params */ => T; + +type Test4 = (/* 4.1 L rest param */ ... /* 4.2 L id */ X /* 4.3 T id */) => void; + +type Test5 = /* 5.1 T tparams */ + /* 5.2 L params */ () => void; + +type Test6 = (/* 6.1 I params */) => void; + +type Test7 = (any, /* 7.1 I params */) => void; diff --git a/lib/test/flow/comment_interning/function_type.options.json b/lib/test/flow/comment_interning/function_type.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/function_type.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/function_type.tree.json b/lib/test/flow/comment_interning/function_type.tree.json new file mode 100644 index 0000000..988cb5e --- /dev/null +++ b/lib/test/flow/comment_interning/function_type.tree.json @@ -0,0 +1,662 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":14,"column":47}}, + "range":[0,617], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":100}}, + "range":[0,100], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, + "range":[5,10], + "name":"Test1", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":79}}, + "range":[33,79], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":34}}, + "range":[33,34], + "name":null, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":34}}, + "range":[33,34], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":54}}, + "range":[35,54], + "value":" 1.2 T generic " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":32}}, + "range":[13,32], + "value":" 1.1 L generic " + } + ], + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":34}}, + "range":[33,34], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "optional":false + } + ], + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":78},"end":{"line":1,"column":79}}, + "range":[78,79], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":80},"end":{"line":1,"column":99}}, + "range":[80,99], + "value":" 1.4 T generic " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":58},"end":{"line":1,"column":77}}, + "range":[58,77], + "value":" 1.3 L generic " + } + ], + "loc":{"source":null,"start":{"line":1,"column":78},"end":{"line":1,"column":79}}, + "range":[78,79], + "name":"Y", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "rest":null, + "typeParameters":null + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":141}}, + "range":[102,243], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":5},"end":{"line":3,"column":10}}, + "range":[107,112], + "name":"Test2", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":77},"end":{"line":3,"column":95}}, + "range":[179,197], + "value":" 2.4 T params " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":13},"end":{"line":3,"column":31}}, + "range":[115,133], + "value":" 2.1 L params " + } + ], + "loc":{"source":null,"start":{"line":3,"column":32},"end":{"line":3,"column":120}}, + "range":[134,222], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":3,"column":54},"end":{"line":3,"column":55}}, + "range":[156,157], + "name":null, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":54},"end":{"line":3,"column":55}}, + "range":[156,157], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":56},"end":{"line":3,"column":75}}, + "range":[158,177], + "value":" 2.3 T generic " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":34},"end":{"line":3,"column":53}}, + "range":[136,155], + "value":" 2.2 L generic " + } + ], + "loc":{"source":null,"start":{"line":3,"column":54},"end":{"line":3,"column":55}}, + "range":[156,157], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "optional":false + } + ], + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":119},"end":{"line":3,"column":120}}, + "range":[221,222], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":121},"end":{"line":3,"column":140}}, + "range":[223,242], + "value":" 2.6 T generic " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":99},"end":{"line":3,"column":118}}, + "range":[201,220], + "value":" 2.5 L generic " + } + ], + "loc":{"source":null,"start":{"line":3,"column":119},"end":{"line":3,"column":120}}, + "range":[221,222], + "name":"Y", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "rest":null, + "typeParameters":null + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":124}}, + "range":[245,369], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":5},"end":{"line":5,"column":10}}, + "range":[250,255], + "name":"Test3", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":100},"end":{"line":5,"column":118}}, + "range":[345,363], + "value":" 3.5 T params " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":37},"end":{"line":5,"column":55}}, + "range":[282,300], + "value":" 3.2 L params " + } + ], + "loc":{"source":null,"start":{"line":5,"column":33},"end":{"line":5,"column":123}}, + "range":[278,368], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":5,"column":77},"end":{"line":5,"column":78}}, + "range":[322,323], + "name":null, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":77},"end":{"line":5,"column":78}}, + "range":[322,323], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":79},"end":{"line":5,"column":98}}, + "range":[324,343], + "value":" 3.4 L generic " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":57},"end":{"line":5,"column":76}}, + "range":[302,321], + "value":" 3.3 T generic " + } + ], + "loc":{"source":null,"start":{"line":5,"column":77},"end":{"line":5,"column":78}}, + "range":[322,323], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "optional":false + } + ], + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":122},"end":{"line":5,"column":123}}, + "range":[367,368], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":122},"end":{"line":5,"column":123}}, + "range":[367,368], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "rest":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":13},"end":{"line":5,"column":32}}, + "range":[258,277], + "value":" 3.1 L tparams " + } + ], + "loc":{"source":null,"start":{"line":5,"column":33},"end":{"line":5,"column":36}}, + "range":[278,281], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":5,"column":34},"end":{"line":5,"column":35}}, + "range":[279,280], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":82}}, + "range":[371,453], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":5},"end":{"line":7,"column":10}}, + "range":[376,381], + "name":"Test4", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":13},"end":{"line":7,"column":81}}, + "range":[384,452], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":77},"end":{"line":7,"column":81}}, + "range":[448,452] + }, + "rest":{ + "type":"FunctionTypeParam", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":14},"end":{"line":7,"column":36}}, + "range":[385,407], + "value":" 4.1 L rest param " + } + ], + "loc":{"source":null,"start":{"line":7,"column":56},"end":{"line":7,"column":57}}, + "range":[427,428], + "name":null, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":56},"end":{"line":7,"column":57}}, + "range":[427,428], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":58},"end":{"line":7,"column":72}}, + "range":[429,443], + "value":" 4.3 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":41},"end":{"line":7,"column":55}}, + "range":[412,426], + "value":" 4.2 L id " + } + ], + "loc":{"source":null,"start":{"line":7,"column":56},"end":{"line":7,"column":57}}, + "range":[427,428], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "optional":false + }, + "typeParameters":null + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":10,"column":32}}, + "range":[455,524], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":5},"end":{"line":9,"column":10}}, + "range":[460,465], + "name":"Test5", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":2},"end":{"line":10,"column":20}}, + "range":[494,512], + "value":" 5.2 L params " + } + ], + "loc":{"source":null,"start":{"line":9,"column":13},"end":{"line":10,"column":31}}, + "range":[468,523], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":10,"column":27},"end":{"line":10,"column":31}}, + "range":[519,523] + }, + "rest":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":17},"end":{"line":9,"column":36}}, + "range":[472,491], + "value":" 5.1 T tparams " + } + ], + "loc":{"source":null,"start":{"line":9,"column":13},"end":{"line":9,"column":16}}, + "range":[468,471], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":9,"column":14},"end":{"line":9,"column":15}}, + "range":[469,470], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":12,"column":0},"end":{"line":12,"column":42}}, + "range":[526,568], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":12,"column":5},"end":{"line":12,"column":10}}, + "range":[531,536], + "name":"Test6", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":14},"end":{"line":12,"column":32}}, + "range":[540,558], + "value":" 6.1 I params " + } + ], + "loc":{"source":null,"start":{"line":12,"column":13},"end":{"line":12,"column":41}}, + "range":[539,567], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":12,"column":37},"end":{"line":12,"column":41}}, + "range":[563,567] + }, + "rest":null, + "typeParameters":null + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":14,"column":0},"end":{"line":14,"column":47}}, + "range":[570,617], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":14,"column":5},"end":{"line":14,"column":10}}, + "range":[575,580], + "name":"Test7", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":19},"end":{"line":14,"column":37}}, + "range":[589,607], + "value":" 7.1 I params " + } + ], + "loc":{"source":null,"start":{"line":14,"column":13},"end":{"line":14,"column":46}}, + "range":[583,616], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":14,"column":14},"end":{"line":14,"column":17}}, + "range":[584,587], + "name":null, + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":14,"column":14},"end":{"line":14,"column":17}}, + "range":[584,587] + }, + "optional":false + } + ], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":14,"column":42},"end":{"line":14,"column":46}}, + "range":[612,616] + }, + "rest":null, + "typeParameters":null + } + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":32}}, + "range":[13,32], + "value":" 1.1 L generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":54}}, + "range":[35,54], + "value":" 1.2 T generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":58},"end":{"line":1,"column":77}}, + "range":[58,77], + "value":" 1.3 L generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":80},"end":{"line":1,"column":99}}, + "range":[80,99], + "value":" 1.4 T generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":13},"end":{"line":3,"column":31}}, + "range":[115,133], + "value":" 2.1 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":34},"end":{"line":3,"column":53}}, + "range":[136,155], + "value":" 2.2 L generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":56},"end":{"line":3,"column":75}}, + "range":[158,177], + "value":" 2.3 T generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":77},"end":{"line":3,"column":95}}, + "range":[179,197], + "value":" 2.4 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":99},"end":{"line":3,"column":118}}, + "range":[201,220], + "value":" 2.5 L generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":121},"end":{"line":3,"column":140}}, + "range":[223,242], + "value":" 2.6 T generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":13},"end":{"line":5,"column":32}}, + "range":[258,277], + "value":" 3.1 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":37},"end":{"line":5,"column":55}}, + "range":[282,300], + "value":" 3.2 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":57},"end":{"line":5,"column":76}}, + "range":[302,321], + "value":" 3.3 T generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":79},"end":{"line":5,"column":98}}, + "range":[324,343], + "value":" 3.4 L generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":100},"end":{"line":5,"column":118}}, + "range":[345,363], + "value":" 3.5 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":14},"end":{"line":7,"column":36}}, + "range":[385,407], + "value":" 4.1 L rest param " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":41},"end":{"line":7,"column":55}}, + "range":[412,426], + "value":" 4.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":58},"end":{"line":7,"column":72}}, + "range":[429,443], + "value":" 4.3 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":17},"end":{"line":9,"column":36}}, + "range":[472,491], + "value":" 5.1 T tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":2},"end":{"line":10,"column":20}}, + "range":[494,512], + "value":" 5.2 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":14},"end":{"line":12,"column":32}}, + "range":[540,558], + "value":" 6.1 I params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":19},"end":{"line":14,"column":37}}, + "range":[589,607], + "value":" 7.1 I params " + } + ] +} diff --git a/lib/test/flow/comment_interning/if.js b/lib/test/flow/comment_interning/if.js new file mode 100644 index 0000000..4b01a96 --- /dev/null +++ b/lib/test/flow/comment_interning/if.js @@ -0,0 +1,8 @@ +/* 1.1 L if */ if /* 1.2 L if */ (/* 1.3 L bool */ true /* 1.4 T bool */) /* 1.5 L block */ {} /* 1.6 T block */ + +if (true) { +} /* 2.1 L altern */ else /* 2.2 L block */ { +} /* 2.3 T block */ + +if (true) {} /* 3.1 T block */ +/* 3.2 L altern */ else {} diff --git a/lib/test/flow/comment_interning/if.options.json b/lib/test/flow/comment_interning/if.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/if.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/if.tree.json b/lib/test/flow/comment_interning/if.tree.json new file mode 100644 index 0000000..151b6d4 --- /dev/null +++ b/lib/test/flow/comment_interning/if.tree.json @@ -0,0 +1,226 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":8,"column":26}}, + "range":[15,250], + "body":[ + { + "type":"IfStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "value":" 1.1 L if " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":32}}, + "range":[18,32], + "value":" 1.2 L if " + } + ], + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":94}}, + "range":[15,94], + "test":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":56},"end":{"line":1,"column":72}}, + "range":[56,72], + "value":" 1.4 T bool " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":50}}, + "range":[34,50], + "value":" 1.3 L bool " + } + ], + "loc":{"source":null,"start":{"line":1,"column":51},"end":{"line":1,"column":55}}, + "range":[51,55], + "value":true, + "raw":"true" + }, + "consequent":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":95},"end":{"line":1,"column":112}}, + "range":[95,112], + "value":" 1.6 T block " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":74},"end":{"line":1,"column":91}}, + "range":[74,91], + "value":" 1.5 L block " + } + ], + "loc":{"source":null,"start":{"line":1,"column":92},"end":{"line":1,"column":94}}, + "range":[92,94], + "body":[] + }, + "alternate":null + }, + { + "type":"IfStatement", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":5,"column":1}}, + "range":[114,173], + "test":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":8}}, + "range":[118,122], + "value":true, + "raw":"true" + }, + "consequent":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":10},"end":{"line":4,"column":1}}, + "range":[124,127], + "body":[] + }, + "alternate":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":2},"end":{"line":5,"column":19}}, + "range":[174,191], + "value":" 2.3 T block " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":20}}, + "range":[128,146], + "value":" 2.1 L altern " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":26},"end":{"line":4,"column":43}}, + "range":[152,169], + "value":" 2.2 L block " + } + ], + "loc":{"source":null,"start":{"line":4,"column":44},"end":{"line":5,"column":1}}, + "range":[170,173], + "body":[] + } + }, + { + "type":"IfStatement", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":8,"column":26}}, + "range":[193,250], + "test":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":7,"column":4},"end":{"line":7,"column":8}}, + "range":[197,201], + "value":true, + "raw":"true" + }, + "consequent":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":13},"end":{"line":7,"column":30}}, + "range":[206,223], + "value":" 3.1 T block " + } + ], + "loc":{"source":null,"start":{"line":7,"column":10},"end":{"line":7,"column":12}}, + "range":[203,205], + "body":[] + }, + "alternate":{ + "type":"BlockStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":0},"end":{"line":8,"column":18}}, + "range":[224,242], + "value":" 3.2 L altern " + } + ], + "loc":{"source":null,"start":{"line":8,"column":24},"end":{"line":8,"column":26}}, + "range":[248,250], + "body":[] + } + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "value":" 1.1 L if " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":32}}, + "range":[18,32], + "value":" 1.2 L if " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":50}}, + "range":[34,50], + "value":" 1.3 L bool " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":56},"end":{"line":1,"column":72}}, + "range":[56,72], + "value":" 1.4 T bool " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":74},"end":{"line":1,"column":91}}, + "range":[74,91], + "value":" 1.5 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":95},"end":{"line":1,"column":112}}, + "range":[95,112], + "value":" 1.6 T block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":20}}, + "range":[128,146], + "value":" 2.1 L altern " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":26},"end":{"line":4,"column":43}}, + "range":[152,169], + "value":" 2.2 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":2},"end":{"line":5,"column":19}}, + "range":[174,191], + "value":" 2.3 T block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":13},"end":{"line":7,"column":30}}, + "range":[206,223], + "value":" 3.1 T block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":0},"end":{"line":8,"column":18}}, + "range":[224,242], + "value":" 3.2 L altern " + } + ] +} diff --git a/lib/test/flow/comment_interning/import.js b/lib/test/flow/comment_interning/import.js new file mode 100644 index 0000000..bf42c52 --- /dev/null +++ b/lib/test/flow/comment_interning/import.js @@ -0,0 +1,15 @@ +/* 1.1 L import */ import('test') /* 1.2 T import*/; + +/* 2.1 L import */ import /* 2.2 L string */ (/* 2.3 L string */ 'test' /* 2.4 T string */) /* 2.5 T import */; + +/* 3.1 L import */ import Foo from 'Bar'; /* 3.2 T import */ + +/* 4.1 L import */ import { /* 4.2 L id */ Foo /* 4.3 T id */ as /* 4.4 L id */ Bar /* 4.5 T id */ } from /* 4.6 L lit */ 'Baz' /* 4.7 T lit */; /* 4.8 T import */ + +/* 5.1 L import */ import * as /* 5.2 L id */ Foo /* 5.3 T id */ from /* 5.4 L lit */ 'Bar' /* 5.5 T lit */; /* 5.6 T import */ + +import 'source' /* 6.1 T string lit */ + +import Foo from 'source' /* 7.1 T string lit */ + +import {Foo} from 'source' /* 8.1 T string lit */ diff --git a/lib/test/flow/comment_interning/import.options.json b/lib/test/flow/comment_interning/import.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/import.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/import.tree.json b/lib/test/flow/comment_interning/import.tree.json new file mode 100644 index 0000000..64fd56f --- /dev/null +++ b/lib/test/flow/comment_interning/import.tree.json @@ -0,0 +1,579 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":15,"column":26}}, + "range":[19,638], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":52}}, + "range":[19,52], + "expression":{ + "type":"ImportExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":51}}, + "range":[34,51], + "value":" 1.2 T import" + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "value":" 1.1 L import " + } + ], + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":33}}, + "range":[19,33], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":32}}, + "range":[26,32], + "value":"test", + "raw":"'test'" + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":3,"column":19},"end":{"line":3,"column":111}}, + "range":[73,165], + "expression":{ + "type":"ImportExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":92},"end":{"line":3,"column":110}}, + "range":[146,164], + "value":" 2.5 T import " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":18}}, + "range":[54,72], + "value":" 2.1 L import " + } + ], + "loc":{"source":null,"start":{"line":3,"column":19},"end":{"line":3,"column":91}}, + "range":[73,145], + "source":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":72},"end":{"line":3,"column":90}}, + "range":[126,144], + "value":" 2.4 T string " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":26},"end":{"line":3,"column":44}}, + "range":[80,98], + "value":" 2.2 L string " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":46},"end":{"line":3,"column":64}}, + "range":[100,118], + "value":" 2.3 L string " + } + ], + "loc":{"source":null,"start":{"line":3,"column":65},"end":{"line":3,"column":71}}, + "range":[119,125], + "value":"test", + "raw":"'test'" + } + }, + "directive":null + }, + { + "type":"ImportDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":42},"end":{"line":5,"column":60}}, + "range":[209,227], + "value":" 3.2 T import " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":18}}, + "range":[167,185], + "value":" 3.1 L import " + } + ], + "loc":{"source":null,"start":{"line":5,"column":19},"end":{"line":5,"column":41}}, + "range":[186,208], + "specifiers":[ + { + "type":"ImportDefaultSpecifier", + "loc":{"source":null,"start":{"line":5,"column":26},"end":{"line":5,"column":29}}, + "range":[193,196], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":26},"end":{"line":5,"column":29}}, + "range":[193,196], + "name":"Foo", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":5,"column":35},"end":{"line":5,"column":40}}, + "range":[202,207], + "value":"Bar", + "raw":"'Bar'" + }, + "importKind":"value" + }, + { + "type":"ImportDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":145},"end":{"line":7,"column":163}}, + "range":[374,392], + "value":" 4.8 T import " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":18}}, + "range":[229,247], + "value":" 4.1 L import " + } + ], + "loc":{"source":null,"start":{"line":7,"column":19},"end":{"line":7,"column":144}}, + "range":[248,373], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":7,"column":43},"end":{"line":7,"column":83}}, + "range":[272,312], + "imported":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":47},"end":{"line":7,"column":61}}, + "range":[276,290], + "value":" 4.3 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":28},"end":{"line":7,"column":42}}, + "range":[257,271], + "value":" 4.2 L id " + } + ], + "loc":{"source":null,"start":{"line":7,"column":43},"end":{"line":7,"column":46}}, + "range":[272,275], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":84},"end":{"line":7,"column":98}}, + "range":[313,327], + "value":" 4.5 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":65},"end":{"line":7,"column":79}}, + "range":[294,308], + "value":" 4.4 L id " + } + ], + "loc":{"source":null,"start":{"line":7,"column":80},"end":{"line":7,"column":83}}, + "range":[309,312], + "name":"Bar", + "typeAnnotation":null, + "optional":false + }, + "importKind":null + } + ], + "source":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":128},"end":{"line":7,"column":143}}, + "range":[357,372], + "value":" 4.7 T lit " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":106},"end":{"line":7,"column":121}}, + "range":[335,350], + "value":" 4.6 L lit " + } + ], + "loc":{"source":null,"start":{"line":7,"column":122},"end":{"line":7,"column":127}}, + "range":[351,356], + "value":"Baz", + "raw":"'Baz'" + }, + "importKind":"value" + }, + { + "type":"ImportDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":109},"end":{"line":9,"column":127}}, + "range":[503,521], + "value":" 5.6 T import " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":9,"column":18}}, + "range":[394,412], + "value":" 5.1 L import " + } + ], + "loc":{"source":null,"start":{"line":9,"column":19},"end":{"line":9,"column":108}}, + "range":[413,502], + "specifiers":[ + { + "type":"ImportNamespaceSpecifier", + "loc":{"source":null,"start":{"line":9,"column":26},"end":{"line":9,"column":49}}, + "range":[420,443], + "local":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":50},"end":{"line":9,"column":64}}, + "range":[444,458], + "value":" 5.3 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":31},"end":{"line":9,"column":45}}, + "range":[425,439], + "value":" 5.2 L id " + } + ], + "loc":{"source":null,"start":{"line":9,"column":46},"end":{"line":9,"column":49}}, + "range":[440,443], + "name":"Foo", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":92},"end":{"line":9,"column":107}}, + "range":[486,501], + "value":" 5.5 T lit " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":70},"end":{"line":9,"column":85}}, + "range":[464,479], + "value":" 5.4 L lit " + } + ], + "loc":{"source":null,"start":{"line":9,"column":86},"end":{"line":9,"column":91}}, + "range":[480,485], + "value":"Bar", + "raw":"'Bar'" + }, + "importKind":"value" + }, + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":11,"column":15}}, + "range":[523,538], + "specifiers":[], + "source":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":16},"end":{"line":11,"column":38}}, + "range":[539,561], + "value":" 6.1 T string lit " + } + ], + "loc":{"source":null,"start":{"line":11,"column":7},"end":{"line":11,"column":15}}, + "range":[530,538], + "value":"source", + "raw":"'source'" + }, + "importKind":"value" + }, + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":13,"column":0},"end":{"line":13,"column":24}}, + "range":[563,587], + "specifiers":[ + { + "type":"ImportDefaultSpecifier", + "loc":{"source":null,"start":{"line":13,"column":7},"end":{"line":13,"column":10}}, + "range":[570,573], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":13,"column":7},"end":{"line":13,"column":10}}, + "range":[570,573], + "name":"Foo", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":25},"end":{"line":13,"column":47}}, + "range":[588,610], + "value":" 7.1 T string lit " + } + ], + "loc":{"source":null,"start":{"line":13,"column":16},"end":{"line":13,"column":24}}, + "range":[579,587], + "value":"source", + "raw":"'source'" + }, + "importKind":"value" + }, + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":15,"column":0},"end":{"line":15,"column":26}}, + "range":[612,638], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":15,"column":8},"end":{"line":15,"column":11}}, + "range":[620,623], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":15,"column":8},"end":{"line":15,"column":11}}, + "range":[620,623], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":15,"column":8},"end":{"line":15,"column":11}}, + "range":[620,623], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "importKind":null + } + ], + "source":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":27},"end":{"line":15,"column":49}}, + "range":[639,661], + "value":" 8.1 T string lit " + } + ], + "loc":{"source":null,"start":{"line":15,"column":18},"end":{"line":15,"column":26}}, + "range":[630,638], + "value":"source", + "raw":"'source'" + }, + "importKind":"value" + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "value":" 1.1 L import " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":51}}, + "range":[34,51], + "value":" 1.2 T import" + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":18}}, + "range":[54,72], + "value":" 2.1 L import " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":26},"end":{"line":3,"column":44}}, + "range":[80,98], + "value":" 2.2 L string " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":46},"end":{"line":3,"column":64}}, + "range":[100,118], + "value":" 2.3 L string " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":72},"end":{"line":3,"column":90}}, + "range":[126,144], + "value":" 2.4 T string " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":92},"end":{"line":3,"column":110}}, + "range":[146,164], + "value":" 2.5 T import " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":18}}, + "range":[167,185], + "value":" 3.1 L import " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":42},"end":{"line":5,"column":60}}, + "range":[209,227], + "value":" 3.2 T import " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":18}}, + "range":[229,247], + "value":" 4.1 L import " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":28},"end":{"line":7,"column":42}}, + "range":[257,271], + "value":" 4.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":47},"end":{"line":7,"column":61}}, + "range":[276,290], + "value":" 4.3 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":65},"end":{"line":7,"column":79}}, + "range":[294,308], + "value":" 4.4 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":84},"end":{"line":7,"column":98}}, + "range":[313,327], + "value":" 4.5 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":106},"end":{"line":7,"column":121}}, + "range":[335,350], + "value":" 4.6 L lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":128},"end":{"line":7,"column":143}}, + "range":[357,372], + "value":" 4.7 T lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":145},"end":{"line":7,"column":163}}, + "range":[374,392], + "value":" 4.8 T import " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":9,"column":18}}, + "range":[394,412], + "value":" 5.1 L import " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":31},"end":{"line":9,"column":45}}, + "range":[425,439], + "value":" 5.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":50},"end":{"line":9,"column":64}}, + "range":[444,458], + "value":" 5.3 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":70},"end":{"line":9,"column":85}}, + "range":[464,479], + "value":" 5.4 L lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":92},"end":{"line":9,"column":107}}, + "range":[486,501], + "value":" 5.5 T lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":109},"end":{"line":9,"column":127}}, + "range":[503,521], + "value":" 5.6 T import " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":16},"end":{"line":11,"column":38}}, + "range":[539,561], + "value":" 6.1 T string lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":25},"end":{"line":13,"column":47}}, + "range":[588,610], + "value":" 7.1 T string lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":27},"end":{"line":15,"column":49}}, + "range":[639,661], + "value":" 8.1 T string lit " + } + ] +} diff --git a/lib/test/flow/comment_interning/interface.js b/lib/test/flow/comment_interning/interface.js new file mode 100644 index 0000000..abc01d4 --- /dev/null +++ b/lib/test/flow/comment_interning/interface.js @@ -0,0 +1,20 @@ +/* 1.1 L interface */ interface /* 1.2 L id */ name /* 1.3 L obj */ {} /* 1.4 T obj */ + +interface name /* 2.1 L tparams */ /* 2.2 L obj */ {} + +interface name /* 3.1 T id */ extends /* 3.2 L id */ super1 /* 3.3 T id */, /* 3.4 L id */ super2 /* 3.5 L obj */ {} + +{ + interface name {} /* 4.1 T obj */ + /* 4.2 L interface */ interface name {} /* 4.3 T obj */ +} + +interface name /* 5.1 T id */ + /* 5.2 L tparams */ /* 5.3 T tparams */ + /* 5.4 L obj */ {} + +interface name /* 6.1 T id */ + /* 6.2 L obj */ {} + +interface name extends Super /* 7.1 T id */ + /* 7.2 L obj */ {} diff --git a/lib/test/flow/comment_interning/interface.options.json b/lib/test/flow/comment_interning/interface.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/interface.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/interface.tree.json b/lib/test/flow/comment_interning/interface.tree.json new file mode 100644 index 0000000..d5648ac --- /dev/null +++ b/lib/test/flow/comment_interning/interface.tree.json @@ -0,0 +1,598 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":20,"column":20}}, + "range":[22,578], + "body":[ + { + "type":"InterfaceDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "value":" 1.1 L interface " + } + ], + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":70}}, + "range":[22,70], + "id":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":46}}, + "range":[32,46], + "value":" 1.2 L id " + } + ], + "loc":{"source":null,"start":{"line":1,"column":47},"end":{"line":1,"column":51}}, + "range":[47,51], + "name":"name", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":71},"end":{"line":1,"column":86}}, + "range":[71,86], + "value":" 1.4 T obj " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":52},"end":{"line":1,"column":67}}, + "range":[52,67], + "value":" 1.3 L obj " + } + ], + "loc":{"source":null,"start":{"line":1,"column":68},"end":{"line":1,"column":70}}, + "range":[68,70], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + }, + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":57}}, + "range":[88,145], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":10},"end":{"line":3,"column":14}}, + "range":[98,102], + "name":"name", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":15},"end":{"line":3,"column":34}}, + "range":[103,122], + "value":" 2.1 L tparams " + } + ], + "loc":{"source":null,"start":{"line":3,"column":35},"end":{"line":3,"column":38}}, + "range":[123,126], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":3,"column":36},"end":{"line":3,"column":37}}, + "range":[124,125], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "body":{ + "type":"ObjectTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":39},"end":{"line":3,"column":54}}, + "range":[127,142], + "value":" 2.2 L obj " + } + ], + "loc":{"source":null,"start":{"line":3,"column":55},"end":{"line":3,"column":57}}, + "range":[143,145], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + }, + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":116}}, + "range":[147,263], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":15},"end":{"line":5,"column":29}}, + "range":[162,176], + "value":" 3.1 T id " + } + ], + "loc":{"source":null,"start":{"line":5,"column":10},"end":{"line":5,"column":14}}, + "range":[157,161], + "name":"name", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":98},"end":{"line":5,"column":113}}, + "range":[245,260], + "value":" 3.5 L obj " + } + ], + "loc":{"source":null,"start":{"line":5,"column":114},"end":{"line":5,"column":116}}, + "range":[261,263], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[ + { + "type":"InterfaceExtends", + "loc":{"source":null,"start":{"line":5,"column":53},"end":{"line":5,"column":59}}, + "range":[200,206], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":60},"end":{"line":5,"column":74}}, + "range":[207,221], + "value":" 3.3 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":38},"end":{"line":5,"column":52}}, + "range":[185,199], + "value":" 3.2 L id " + } + ], + "loc":{"source":null,"start":{"line":5,"column":53},"end":{"line":5,"column":59}}, + "range":[200,206], + "name":"super1", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + { + "type":"InterfaceExtends", + "loc":{"source":null,"start":{"line":5,"column":91},"end":{"line":5,"column":97}}, + "range":[238,244], + "id":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":76},"end":{"line":5,"column":90}}, + "range":[223,237], + "value":" 3.4 L id " + } + ], + "loc":{"source":null,"start":{"line":5,"column":91},"end":{"line":5,"column":97}}, + "range":[238,244], + "name":"super2", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":10,"column":1}}, + "range":[265,362], + "body":[ + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":8,"column":2},"end":{"line":8,"column":19}}, + "range":[269,286], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":8,"column":12},"end":{"line":8,"column":16}}, + "range":[279,283], + "name":"name", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":20},"end":{"line":8,"column":35}}, + "range":[287,302], + "value":" 4.1 T obj " + } + ], + "loc":{"source":null,"start":{"line":8,"column":17},"end":{"line":8,"column":19}}, + "range":[284,286], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + }, + { + "type":"InterfaceDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":2},"end":{"line":9,"column":23}}, + "range":[305,326], + "value":" 4.2 L interface " + } + ], + "loc":{"source":null,"start":{"line":9,"column":24},"end":{"line":9,"column":41}}, + "range":[327,344], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":34},"end":{"line":9,"column":38}}, + "range":[337,341], + "name":"name", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":42},"end":{"line":9,"column":57}}, + "range":[345,360], + "value":" 4.3 T obj " + } + ], + "loc":{"source":null,"start":{"line":9,"column":39},"end":{"line":9,"column":41}}, + "range":[342,344], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + } + ] + }, + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":12,"column":0},"end":{"line":14,"column":20}}, + "range":[364,460], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":15},"end":{"line":12,"column":29}}, + "range":[379,393], + "value":" 5.1 T id " + } + ], + "loc":{"source":null,"start":{"line":12,"column":10},"end":{"line":12,"column":14}}, + "range":[374,378], + "name":"name", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":26},"end":{"line":13,"column":45}}, + "range":[420,439], + "value":" 5.3 T tparams " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":2},"end":{"line":13,"column":21}}, + "range":[396,415], + "value":" 5.2 L tparams " + } + ], + "loc":{"source":null,"start":{"line":13,"column":22},"end":{"line":13,"column":25}}, + "range":[416,419], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":13,"column":23},"end":{"line":13,"column":24}}, + "range":[417,418], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "body":{ + "type":"ObjectTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":2},"end":{"line":14,"column":17}}, + "range":[442,457], + "value":" 5.4 L obj " + } + ], + "loc":{"source":null,"start":{"line":14,"column":18},"end":{"line":14,"column":20}}, + "range":[458,460], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + }, + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":16,"column":0},"end":{"line":17,"column":20}}, + "range":[462,512], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":15},"end":{"line":16,"column":29}}, + "range":[477,491], + "value":" 6.1 T id " + } + ], + "loc":{"source":null,"start":{"line":16,"column":10},"end":{"line":16,"column":14}}, + "range":[472,476], + "name":"name", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":2},"end":{"line":17,"column":17}}, + "range":[494,509], + "value":" 6.2 L obj " + } + ], + "loc":{"source":null,"start":{"line":17,"column":18},"end":{"line":17,"column":20}}, + "range":[510,512], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + }, + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":19,"column":0},"end":{"line":20,"column":20}}, + "range":[514,578], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":19,"column":10},"end":{"line":19,"column":14}}, + "range":[524,528], + "name":"name", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":2},"end":{"line":20,"column":17}}, + "range":[560,575], + "value":" 7.2 L obj " + } + ], + "loc":{"source":null,"start":{"line":20,"column":18},"end":{"line":20,"column":20}}, + "range":[576,578], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[ + { + "type":"InterfaceExtends", + "loc":{"source":null,"start":{"line":19,"column":23},"end":{"line":19,"column":28}}, + "range":[537,542], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":29},"end":{"line":19,"column":43}}, + "range":[543,557], + "value":" 7.1 T id " + } + ], + "loc":{"source":null,"start":{"line":19,"column":23},"end":{"line":19,"column":28}}, + "range":[537,542], + "name":"Super", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "value":" 1.1 L interface " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":46}}, + "range":[32,46], + "value":" 1.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":52},"end":{"line":1,"column":67}}, + "range":[52,67], + "value":" 1.3 L obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":71},"end":{"line":1,"column":86}}, + "range":[71,86], + "value":" 1.4 T obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":15},"end":{"line":3,"column":34}}, + "range":[103,122], + "value":" 2.1 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":39},"end":{"line":3,"column":54}}, + "range":[127,142], + "value":" 2.2 L obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":15},"end":{"line":5,"column":29}}, + "range":[162,176], + "value":" 3.1 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":38},"end":{"line":5,"column":52}}, + "range":[185,199], + "value":" 3.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":60},"end":{"line":5,"column":74}}, + "range":[207,221], + "value":" 3.3 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":76},"end":{"line":5,"column":90}}, + "range":[223,237], + "value":" 3.4 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":98},"end":{"line":5,"column":113}}, + "range":[245,260], + "value":" 3.5 L obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":20},"end":{"line":8,"column":35}}, + "range":[287,302], + "value":" 4.1 T obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":2},"end":{"line":9,"column":23}}, + "range":[305,326], + "value":" 4.2 L interface " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":42},"end":{"line":9,"column":57}}, + "range":[345,360], + "value":" 4.3 T obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":15},"end":{"line":12,"column":29}}, + "range":[379,393], + "value":" 5.1 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":2},"end":{"line":13,"column":21}}, + "range":[396,415], + "value":" 5.2 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":26},"end":{"line":13,"column":45}}, + "range":[420,439], + "value":" 5.3 T tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":2},"end":{"line":14,"column":17}}, + "range":[442,457], + "value":" 5.4 L obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":15},"end":{"line":16,"column":29}}, + "range":[477,491], + "value":" 6.1 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":2},"end":{"line":17,"column":17}}, + "range":[494,509], + "value":" 6.2 L obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":29},"end":{"line":19,"column":43}}, + "range":[543,557], + "value":" 7.1 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":2},"end":{"line":20,"column":17}}, + "range":[560,575], + "value":" 7.2 L obj " + } + ] +} diff --git a/lib/test/flow/comment_interning/jsx_element.js b/lib/test/flow/comment_interning/jsx_element.js new file mode 100644 index 0000000..783216c --- /dev/null +++ b/lib/test/flow/comment_interning/jsx_element.js @@ -0,0 +1,32 @@ +/* 1.1 L JSX element */
test
/* 1.2 T JSX element */; + +test; + +; + +; + +
; + +
; + +
; + +
{/* 8.1 L JSX spread */ ... /* 8.2 L obj */ {} /* 8.3 T obj */}
; + +
; + +
; + +
; + +// Verify comments at boundary of JSX lex mode change are not duplicated +
; // 12.1 T +
; // 12.2 T + +
{/* 13.1 I */}
; diff --git a/lib/test/flow/comment_interning/jsx_element.options.json b/lib/test/flow/comment_interning/jsx_element.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/jsx_element.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/jsx_element.tree.json b/lib/test/flow/comment_interning/jsx_element.tree.json new file mode 100644 index 0000000..b2a9845 --- /dev/null +++ b/lib/test/flow/comment_interning/jsx_element.tree.json @@ -0,0 +1,1356 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":32,"column":26}}, + "range":[24,1237], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":64}}, + "range":[24,64], + "expression":{ + "type":"JSXElement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":40},"end":{"line":1,"column":63}}, + "range":[40,63], + "value":" 1.2 T JSX element " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "value":" 1.1 L JSX element " + } + ], + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":39}}, + "range":[24,39], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":29}}, + "range":[24,29], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":28}}, + "range":[25,28], + "name":"div" + }, + "attributes":[], + "selfClosing":false + }, + "closingElement":{ + "type":"JSXClosingElement", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":39}}, + "range":[33,39], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":38}}, + "range":[35,38], + "name":"div" + } + }, + "children":[ + { + "type":"JSXText", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":33}}, + "range":[29,33], + "value":"test", + "raw":"test" + } + ] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":93}}, + "range":[66,159], + "expression":{ + "type":"JSXElement", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":92}}, + "range":[66,158], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":43}}, + "range":[66,109], + "name":{ + "type":"JSXIdentifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":24},"end":{"line":3,"column":42}}, + "range":[90,108], + "value":" 2.2 T JSX id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":1},"end":{"line":3,"column":19}}, + "range":[67,85], + "value":" 2.1 L JSX id " + } + ], + "loc":{"source":null,"start":{"line":3,"column":20},"end":{"line":3,"column":23}}, + "range":[86,89], + "name":"div" + }, + "attributes":[], + "selfClosing":false + }, + "closingElement":{ + "type":"JSXClosingElement", + "loc":{"source":null,"start":{"line":3,"column":47},"end":{"line":3,"column":92}}, + "range":[113,158], + "name":{ + "type":"JSXIdentifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":73},"end":{"line":3,"column":91}}, + "range":[139,157], + "value":" 2.4 T JSX id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":50},"end":{"line":3,"column":68}}, + "range":[116,134], + "value":" 2.3 L JSX id " + } + ], + "loc":{"source":null,"start":{"line":3,"column":69},"end":{"line":3,"column":72}}, + "range":[135,138], + "name":"div" + } + }, + "children":[ + { + "type":"JSXText", + "loc":{"source":null,"start":{"line":3,"column":43},"end":{"line":3,"column":47}}, + "range":[109,113], + "value":"test", + "raw":"test" + } + ] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":91}}, + "range":[161,252], + "expression":{ + "type":"JSXElement", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":90}}, + "range":[161,251], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":90}}, + "range":[161,251], + "name":{ + "type":"JSXMemberExpression", + "loc":{"source":null,"start":{"line":5,"column":20},"end":{"line":5,"column":70}}, + "range":[181,231], + "object":{ + "type":"JSXIdentifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":27},"end":{"line":5,"column":45}}, + "range":[188,206], + "value":" 3.2 T JSX id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":1},"end":{"line":5,"column":19}}, + "range":[162,180], + "value":" 3.1 L JSX id " + } + ], + "loc":{"source":null,"start":{"line":5,"column":20},"end":{"line":5,"column":26}}, + "range":[181,187], + "name":"Member" + }, + "property":{ + "type":"JSXIdentifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":71},"end":{"line":5,"column":87}}, + "range":[232,248], + "value":" 3.4 JSX id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":48},"end":{"line":5,"column":66}}, + "range":[209,227], + "value":" 3.3 L JSX id " + } + ], + "loc":{"source":null,"start":{"line":5,"column":67},"end":{"line":5,"column":70}}, + "range":[228,231], + "name":"div" + } + }, + "attributes":[], + "selfClosing":true + }, + "closingElement":null, + "children":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":94}}, + "range":[254,348], + "expression":{ + "type":"JSXElement", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":93}}, + "range":[254,347], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":93}}, + "range":[254,347], + "name":{ + "type":"JSXNamespacedName", + "loc":{"source":null,"start":{"line":7,"column":20},"end":{"line":7,"column":73}}, + "range":[274,327], + "namespace":{ + "type":"JSXIdentifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":30},"end":{"line":7,"column":48}}, + "range":[284,302], + "value":" 4.2 T JSX id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":1},"end":{"line":7,"column":19}}, + "range":[255,273], + "value":" 4.1 L JSX id " + } + ], + "loc":{"source":null,"start":{"line":7,"column":20},"end":{"line":7,"column":29}}, + "range":[274,283], + "name":"Namespace" + }, + "name":{ + "type":"JSXIdentifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":74},"end":{"line":7,"column":90}}, + "range":[328,344], + "value":" 4.4 JSX id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":51},"end":{"line":7,"column":69}}, + "range":[305,323], + "value":" 4.3 L JSX id " + } + ], + "loc":{"source":null,"start":{"line":7,"column":70},"end":{"line":7,"column":73}}, + "range":[324,327], + "name":"div" + } + }, + "attributes":[], + "selfClosing":true + }, + "closingElement":null, + "children":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":9,"column":49}}, + "range":[350,399], + "expression":{ + "type":"JSXElement", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":9,"column":48}}, + "range":[350,398], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":9,"column":48}}, + "range":[350,398], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":9,"column":1},"end":{"line":9,"column":4}}, + "range":[351,354], + "name":"div" + }, + "attributes":[ + { + "type":"JSXAttribute", + "loc":{"source":null,"start":{"line":9,"column":24},"end":{"line":9,"column":28}}, + "range":[374,378], + "name":{ + "type":"JSXIdentifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":29},"end":{"line":9,"column":45}}, + "range":[379,395], + "value":" 5.2 JSX id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":5},"end":{"line":9,"column":23}}, + "range":[355,373], + "value":" 5.1 L JSX id " + } + ], + "loc":{"source":null,"start":{"line":9,"column":24},"end":{"line":9,"column":28}}, + "range":[374,378], + "name":"name" + }, + "value":null + } + ], + "selfClosing":true + }, + "closingElement":null, + "children":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":11,"column":90}}, + "range":[401,491], + "expression":{ + "type":"JSXElement", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":11,"column":89}}, + "range":[401,490], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":11,"column":89}}, + "range":[401,490], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":11,"column":1},"end":{"line":11,"column":4}}, + "range":[402,405], + "name":"div" + }, + "attributes":[ + { + "type":"JSXAttribute", + "loc":{"source":null,"start":{"line":11,"column":24},"end":{"line":11,"column":70}}, + "range":[425,471], + "name":{ + "type":"JSXIdentifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":29},"end":{"line":11,"column":47}}, + "range":[430,448], + "value":" 6.2 T JSX id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":5},"end":{"line":11,"column":23}}, + "range":[406,424], + "value":" 6.1 L JSX id " + } + ], + "loc":{"source":null,"start":{"line":11,"column":24},"end":{"line":11,"column":28}}, + "range":[425,429], + "name":"name" + }, + "value":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":71},"end":{"line":11,"column":86}}, + "range":[472,487], + "value":" 6.4 T lit " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":48},"end":{"line":11,"column":63}}, + "range":[449,464], + "value":" 6.3 L lit " + } + ], + "loc":{"source":null,"start":{"line":11,"column":64},"end":{"line":11,"column":70}}, + "range":[465,471], + "value":"test", + "raw":"\"test\"" + } + } + ], + "selfClosing":true + }, + "closingElement":null, + "children":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":13,"column":0},"end":{"line":13,"column":91}}, + "range":[493,584], + "expression":{ + "type":"JSXElement", + "loc":{"source":null,"start":{"line":13,"column":0},"end":{"line":13,"column":90}}, + "range":[493,583], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":13,"column":0},"end":{"line":13,"column":90}}, + "range":[493,583], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":13,"column":1},"end":{"line":13,"column":4}}, + "range":[494,497], + "name":"div" + }, + "attributes":[ + { + "type":"JSXAttribute", + "loc":{"source":null,"start":{"line":13,"column":5},"end":{"line":13,"column":66}}, + "range":[498,559], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":13,"column":5},"end":{"line":13,"column":9}}, + "range":[498,502], + "name":"name" + }, + "value":{ + "type":"JSXExpressionContainer", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":67},"end":{"line":13,"column":87}}, + "range":[560,580], + "value":" 7.4 T JSX expr " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":10},"end":{"line":13,"column":30}}, + "range":[503,523], + "value":" 7.1 L JSX expr " + } + ], + "loc":{"source":null,"start":{"line":13,"column":31},"end":{"line":13,"column":66}}, + "range":[524,559], + "expression":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":50},"end":{"line":13,"column":65}}, + "range":[543,558], + "value":" 7.3 T num " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":32},"end":{"line":13,"column":47}}, + "range":[525,540], + "value":" 7.2 L num " + } + ], + "loc":{"source":null,"start":{"line":13,"column":48},"end":{"line":13,"column":49}}, + "range":[541,542], + "value":1, + "raw":"1" + } + } + } + ], + "selfClosing":true + }, + "closingElement":null, + "children":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":15,"column":0},"end":{"line":15,"column":75}}, + "range":[586,661], + "expression":{ + "type":"JSXElement", + "loc":{"source":null,"start":{"line":15,"column":0},"end":{"line":15,"column":74}}, + "range":[586,660], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":15,"column":0},"end":{"line":15,"column":5}}, + "range":[586,591], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":15,"column":1},"end":{"line":15,"column":4}}, + "range":[587,590], + "name":"div" + }, + "attributes":[], + "selfClosing":false + }, + "closingElement":{ + "type":"JSXClosingElement", + "loc":{"source":null,"start":{"line":15,"column":68},"end":{"line":15,"column":74}}, + "range":[654,660], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":15,"column":70},"end":{"line":15,"column":73}}, + "range":[656,659], + "name":"div" + } + }, + "children":[ + { + "type":"JSXSpreadChild", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":6},"end":{"line":15,"column":28}}, + "range":[592,614], + "value":" 8.1 L JSX spread " + } + ], + "loc":{"source":null,"start":{"line":15,"column":5},"end":{"line":15,"column":68}}, + "range":[591,654], + "expression":{ + "type":"ObjectExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":52},"end":{"line":15,"column":67}}, + "range":[638,653], + "value":" 8.3 T obj " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":33},"end":{"line":15,"column":48}}, + "range":[619,634], + "value":" 8.2 L obj " + } + ], + "loc":{"source":null,"start":{"line":15,"column":49},"end":{"line":15,"column":51}}, + "range":[635,637], + "properties":[] + } + } + ] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":17,"column":0},"end":{"line":17,"column":94}}, + "range":[663,757], + "expression":{ + "type":"JSXElement", + "loc":{"source":null,"start":{"line":17,"column":0},"end":{"line":17,"column":93}}, + "range":[663,756], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":17,"column":0},"end":{"line":17,"column":93}}, + "range":[663,756], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":17,"column":1},"end":{"line":17,"column":4}}, + "range":[664,667], + "name":"div" + }, + "attributes":[ + { + "type":"JSXSpreadAttribute", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":68},"end":{"line":17,"column":90}}, + "range":[731,753], + "value":" 9.4 T JSX spread " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":5},"end":{"line":17,"column":27}}, + "range":[668,690], + "value":" 9.1 L JSX spread " + } + ], + "loc":{"source":null,"start":{"line":17,"column":27},"end":{"line":17,"column":67}}, + "range":[690,730], + "argument":{ + "type":"ObjectExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":51},"end":{"line":17,"column":66}}, + "range":[714,729], + "value":" 9.3 T obj " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":32},"end":{"line":17,"column":47}}, + "range":[695,710], + "value":" 9.2 L obj " + } + ], + "loc":{"source":null,"start":{"line":17,"column":48},"end":{"line":17,"column":50}}, + "range":[711,713], + "properties":[] + } + } + ], + "selfClosing":true + }, + "closingElement":null, + "children":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":19,"column":0},"end":{"line":19,"column":117}}, + "range":[759,876], + "expression":{ + "type":"JSXElement", + "loc":{"source":null,"start":{"line":19,"column":0},"end":{"line":19,"column":116}}, + "range":[759,875], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":19,"column":0},"end":{"line":19,"column":116}}, + "range":[759,875], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":19,"column":1},"end":{"line":19,"column":4}}, + "range":[760,763], + "name":"div" + }, + "attributes":[ + { + "type":"JSXAttribute", + "loc":{"source":null,"start":{"line":19,"column":21},"end":{"line":19,"column":25}}, + "range":[780,784], + "name":{ + "type":"JSXIdentifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":5},"end":{"line":19,"column":20}}, + "range":[764,779], + "value":" 10.1 L id " + } + ], + "loc":{"source":null,"start":{"line":19,"column":21},"end":{"line":19,"column":25}}, + "range":[780,784], + "name":"name" + }, + "value":null + }, + { + "type":"JSXAttribute", + "loc":{"source":null,"start":{"line":19,"column":42},"end":{"line":19,"column":54}}, + "range":[801,813], + "name":{ + "type":"JSXIdentifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":26},"end":{"line":19,"column":41}}, + "range":[785,800], + "value":" 10.2 L id " + } + ], + "loc":{"source":null,"start":{"line":19,"column":42},"end":{"line":19,"column":46}}, + "range":[801,805], + "name":"name" + }, + "value":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":19,"column":47},"end":{"line":19,"column":54}}, + "range":[806,813], + "value":"value", + "raw":"\"value\"" + } + }, + { + "type":"JSXAttribute", + "loc":{"source":null,"start":{"line":19,"column":71},"end":{"line":19,"column":85}}, + "range":[830,844], + "name":{ + "type":"JSXIdentifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":55},"end":{"line":19,"column":70}}, + "range":[814,829], + "value":" 10.3 L id " + } + ], + "loc":{"source":null,"start":{"line":19,"column":71},"end":{"line":19,"column":75}}, + "range":[830,834], + "name":"name" + }, + "value":{ + "type":"JSXExpressionContainer", + "loc":{"source":null,"start":{"line":19,"column":76},"end":{"line":19,"column":85}}, + "range":[835,844], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":19,"column":77},"end":{"line":19,"column":84}}, + "range":[836,843], + "value":"value", + "raw":"'value'" + } + } + }, + { + "type":"JSXSpreadAttribute", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":86},"end":{"line":19,"column":105}}, + "range":[845,864], + "value":" 10.4 L spread " + } + ], + "loc":{"source":null,"start":{"line":19,"column":106},"end":{"line":19,"column":113}}, + "range":[865,872], + "argument":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":19,"column":110},"end":{"line":19,"column":112}}, + "range":[869,871], + "properties":[] + } + } + ], + "selfClosing":true + }, + "closingElement":null, + "children":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":21,"column":0},"end":{"line":26,"column":10}}, + "range":[878,1097], + "expression":{ + "type":"JSXElement", + "loc":{"source":null,"start":{"line":21,"column":0},"end":{"line":26,"column":9}}, + "range":[878,1096], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":21,"column":0},"end":{"line":26,"column":9}}, + "range":[878,1096], + "name":{ + "type":"JSXIdentifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":5},"end":{"line":21,"column":20}}, + "range":[883,898], + "value":" 11.1 T id " + } + ], + "loc":{"source":null,"start":{"line":21,"column":1},"end":{"line":21,"column":4}}, + "range":[879,882], + "name":"div" + }, + "attributes":[ + { + "type":"JSXAttribute", + "loc":{"source":null,"start":{"line":22,"column":18},"end":{"line":22,"column":22}}, + "range":[917,921], + "name":{ + "type":"JSXIdentifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":23},"end":{"line":22,"column":38}}, + "range":[922,937], + "value":" 11.3 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":2},"end":{"line":22,"column":17}}, + "range":[901,916], + "value":" 11.2 L id " + } + ], + "loc":{"source":null,"start":{"line":22,"column":18},"end":{"line":22,"column":22}}, + "range":[917,921], + "name":"name" + }, + "value":null + }, + { + "type":"JSXAttribute", + "loc":{"source":null,"start":{"line":23,"column":18},"end":{"line":23,"column":30}}, + "range":[956,968], + "name":{ + "type":"JSXIdentifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":2},"end":{"line":23,"column":17}}, + "range":[940,955], + "value":" 11.4 L id " + } + ], + "loc":{"source":null,"start":{"line":23,"column":18},"end":{"line":23,"column":22}}, + "range":[956,960], + "name":"name" + }, + "value":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":31},"end":{"line":23,"column":47}}, + "range":[969,985], + "value":" 11.5 T lit " + } + ], + "loc":{"source":null,"start":{"line":23,"column":23},"end":{"line":23,"column":30}}, + "range":[961,968], + "value":"value", + "raw":"\"value\"" + } + }, + { + "type":"JSXAttribute", + "loc":{"source":null,"start":{"line":24,"column":18},"end":{"line":24,"column":32}}, + "range":[1004,1018], + "name":{ + "type":"JSXIdentifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":2},"end":{"line":24,"column":17}}, + "range":[988,1003], + "value":" 11.6 L id " + } + ], + "loc":{"source":null,"start":{"line":24,"column":18},"end":{"line":24,"column":22}}, + "range":[1004,1008], + "name":"name" + }, + "value":{ + "type":"JSXExpressionContainer", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":33},"end":{"line":24,"column":50}}, + "range":[1019,1036], + "value":" 11.7 T expr " + } + ], + "loc":{"source":null,"start":{"line":24,"column":23},"end":{"line":24,"column":32}}, + "range":[1009,1018], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":24,"column":24},"end":{"line":24,"column":31}}, + "range":[1010,1017], + "value":"value", + "raw":"'value'" + } + } + }, + { + "type":"JSXSpreadAttribute", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":30},"end":{"line":25,"column":49}}, + "range":[1067,1086], + "value":" 11.9 T spread " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":2},"end":{"line":25,"column":21}}, + "range":[1039,1058], + "value":" 11.8 L spread " + } + ], + "loc":{"source":null,"start":{"line":25,"column":22},"end":{"line":25,"column":29}}, + "range":[1059,1066], + "argument":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":25,"column":26},"end":{"line":25,"column":28}}, + "range":[1063,1065], + "properties":[] + } + }, + { + "type":"JSXAttribute", + "loc":{"source":null,"start":{"line":26,"column":2},"end":{"line":26,"column":6}}, + "range":[1089,1093], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":26,"column":2},"end":{"line":26,"column":6}}, + "range":[1089,1093], + "name":"name" + }, + "value":null + } + ], + "selfClosing":true + }, + "closingElement":null, + "children":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "trailingComments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":29,"column":9},"end":{"line":29,"column":18}}, + "range":[1181,1190], + "value":" 12.1 T" + } + ], + "loc":{"source":null,"start":{"line":29,"column":0},"end":{"line":29,"column":8}}, + "range":[1172,1180], + "expression":{ + "type":"JSXElement", + "leadingComments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":28,"column":0},"end":{"line":28,"column":72}}, + "range":[1099,1171], + "value":" Verify comments at boundary of JSX lex mode change are not duplicated" + } + ], + "loc":{"source":null,"start":{"line":29,"column":0},"end":{"line":29,"column":7}}, + "range":[1172,1179], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":29,"column":0},"end":{"line":29,"column":7}}, + "range":[1172,1179], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":29,"column":1},"end":{"line":29,"column":4}}, + "range":[1173,1176], + "name":"div" + }, + "attributes":[], + "selfClosing":true + }, + "closingElement":null, + "children":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "trailingComments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":30,"column":9},"end":{"line":30,"column":18}}, + "range":[1200,1209], + "value":" 12.2 T" + } + ], + "loc":{"source":null,"start":{"line":30,"column":0},"end":{"line":30,"column":8}}, + "range":[1191,1199], + "expression":{ + "type":"JSXElement", + "loc":{"source":null,"start":{"line":30,"column":0},"end":{"line":30,"column":7}}, + "range":[1191,1198], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":30,"column":0},"end":{"line":30,"column":7}}, + "range":[1191,1198], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":30,"column":1},"end":{"line":30,"column":4}}, + "range":[1192,1195], + "name":"div" + }, + "attributes":[], + "selfClosing":true + }, + "closingElement":null, + "children":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":32,"column":0},"end":{"line":32,"column":26}}, + "range":[1211,1237], + "expression":{ + "type":"JSXElement", + "loc":{"source":null,"start":{"line":32,"column":0},"end":{"line":32,"column":25}}, + "range":[1211,1236], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":32,"column":0},"end":{"line":32,"column":5}}, + "range":[1211,1216], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":32,"column":1},"end":{"line":32,"column":4}}, + "range":[1212,1215], + "name":"div" + }, + "attributes":[], + "selfClosing":false + }, + "closingElement":{ + "type":"JSXClosingElement", + "loc":{"source":null,"start":{"line":32,"column":19},"end":{"line":32,"column":25}}, + "range":[1230,1236], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":32,"column":21},"end":{"line":32,"column":24}}, + "range":[1232,1235], + "name":"div" + } + }, + "children":[ + { + "type":"JSXExpressionContainer", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":6},"end":{"line":32,"column":18}}, + "range":[1217,1229], + "value":" 13.1 I " + } + ], + "loc":{"source":null,"start":{"line":32,"column":5},"end":{"line":32,"column":19}}, + "range":[1216,1230], + "expression":{ + "type":"JSXEmptyExpression", + "loc":{"source":null,"start":{"line":32,"column":6},"end":{"line":32,"column":18}}, + "range":[1217,1229] + } + } + ] + }, + "directive":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "value":" 1.1 L JSX element " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":40},"end":{"line":1,"column":63}}, + "range":[40,63], + "value":" 1.2 T JSX element " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":1},"end":{"line":3,"column":19}}, + "range":[67,85], + "value":" 2.1 L JSX id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":24},"end":{"line":3,"column":42}}, + "range":[90,108], + "value":" 2.2 T JSX id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":50},"end":{"line":3,"column":68}}, + "range":[116,134], + "value":" 2.3 L JSX id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":73},"end":{"line":3,"column":91}}, + "range":[139,157], + "value":" 2.4 T JSX id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":1},"end":{"line":5,"column":19}}, + "range":[162,180], + "value":" 3.1 L JSX id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":27},"end":{"line":5,"column":45}}, + "range":[188,206], + "value":" 3.2 T JSX id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":48},"end":{"line":5,"column":66}}, + "range":[209,227], + "value":" 3.3 L JSX id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":71},"end":{"line":5,"column":87}}, + "range":[232,248], + "value":" 3.4 JSX id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":1},"end":{"line":7,"column":19}}, + "range":[255,273], + "value":" 4.1 L JSX id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":30},"end":{"line":7,"column":48}}, + "range":[284,302], + "value":" 4.2 T JSX id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":51},"end":{"line":7,"column":69}}, + "range":[305,323], + "value":" 4.3 L JSX id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":74},"end":{"line":7,"column":90}}, + "range":[328,344], + "value":" 4.4 JSX id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":5},"end":{"line":9,"column":23}}, + "range":[355,373], + "value":" 5.1 L JSX id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":29},"end":{"line":9,"column":45}}, + "range":[379,395], + "value":" 5.2 JSX id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":5},"end":{"line":11,"column":23}}, + "range":[406,424], + "value":" 6.1 L JSX id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":29},"end":{"line":11,"column":47}}, + "range":[430,448], + "value":" 6.2 T JSX id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":48},"end":{"line":11,"column":63}}, + "range":[449,464], + "value":" 6.3 L lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":71},"end":{"line":11,"column":86}}, + "range":[472,487], + "value":" 6.4 T lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":10},"end":{"line":13,"column":30}}, + "range":[503,523], + "value":" 7.1 L JSX expr " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":32},"end":{"line":13,"column":47}}, + "range":[525,540], + "value":" 7.2 L num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":50},"end":{"line":13,"column":65}}, + "range":[543,558], + "value":" 7.3 T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":67},"end":{"line":13,"column":87}}, + "range":[560,580], + "value":" 7.4 T JSX expr " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":6},"end":{"line":15,"column":28}}, + "range":[592,614], + "value":" 8.1 L JSX spread " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":33},"end":{"line":15,"column":48}}, + "range":[619,634], + "value":" 8.2 L obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":52},"end":{"line":15,"column":67}}, + "range":[638,653], + "value":" 8.3 T obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":5},"end":{"line":17,"column":27}}, + "range":[668,690], + "value":" 9.1 L JSX spread " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":32},"end":{"line":17,"column":47}}, + "range":[695,710], + "value":" 9.2 L obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":51},"end":{"line":17,"column":66}}, + "range":[714,729], + "value":" 9.3 T obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":68},"end":{"line":17,"column":90}}, + "range":[731,753], + "value":" 9.4 T JSX spread " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":5},"end":{"line":19,"column":20}}, + "range":[764,779], + "value":" 10.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":26},"end":{"line":19,"column":41}}, + "range":[785,800], + "value":" 10.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":55},"end":{"line":19,"column":70}}, + "range":[814,829], + "value":" 10.3 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":86},"end":{"line":19,"column":105}}, + "range":[845,864], + "value":" 10.4 L spread " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":5},"end":{"line":21,"column":20}}, + "range":[883,898], + "value":" 11.1 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":2},"end":{"line":22,"column":17}}, + "range":[901,916], + "value":" 11.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":23},"end":{"line":22,"column":38}}, + "range":[922,937], + "value":" 11.3 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":2},"end":{"line":23,"column":17}}, + "range":[940,955], + "value":" 11.4 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":31},"end":{"line":23,"column":47}}, + "range":[969,985], + "value":" 11.5 T lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":2},"end":{"line":24,"column":17}}, + "range":[988,1003], + "value":" 11.6 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":33},"end":{"line":24,"column":50}}, + "range":[1019,1036], + "value":" 11.7 T expr " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":2},"end":{"line":25,"column":21}}, + "range":[1039,1058], + "value":" 11.8 L spread " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":30},"end":{"line":25,"column":49}}, + "range":[1067,1086], + "value":" 11.9 T spread " + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":28,"column":0},"end":{"line":28,"column":72}}, + "range":[1099,1171], + "value":" Verify comments at boundary of JSX lex mode change are not duplicated" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":29,"column":9},"end":{"line":29,"column":18}}, + "range":[1181,1190], + "value":" 12.1 T" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":30,"column":9},"end":{"line":30,"column":18}}, + "range":[1200,1209], + "value":" 12.2 T" + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":6},"end":{"line":32,"column":18}}, + "range":[1217,1229], + "value":" 13.1 I " + } + ] +} diff --git a/lib/test/flow/comment_interning/jsx_fragment.js b/lib/test/flow/comment_interning/jsx_fragment.js new file mode 100644 index 0000000..63cff7a --- /dev/null +++ b/lib/test/flow/comment_interning/jsx_fragment.js @@ -0,0 +1 @@ +/* 1.1 L JSX fragment */ <>test /* 1.2 T JSX fragment */; diff --git a/lib/test/flow/comment_interning/jsx_fragment.options.json b/lib/test/flow/comment_interning/jsx_fragment.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/jsx_fragment.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/jsx_fragment.tree.json b/lib/test/flow/comment_interning/jsx_fragment.tree.json new file mode 100644 index 0000000..639566b --- /dev/null +++ b/lib/test/flow/comment_interning/jsx_fragment.tree.json @@ -0,0 +1,67 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":60}}, + "range":[25,60], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":60}}, + "range":[25,60], + "expression":{ + "type":"JSXFragment", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":59}}, + "range":[35,59], + "value":" 1.2 T JSX fragment " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "value":" 1.1 L JSX fragment " + } + ], + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":34}}, + "range":[25,34], + "openingFragment":{ + "type":"JSXOpeningFragment", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, + "range":[25,27] + }, + "children":[ + { + "type":"JSXText", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":31}}, + "range":[27,31], + "value":"test", + "raw":"test" + } + ], + "closingFragment":{ + "type":"JSXClosingFragment", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":34}}, + "range":[31,34] + } + }, + "directive":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "value":" 1.1 L JSX fragment " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":59}}, + "range":[35,59], + "value":" 1.2 T JSX fragment " + } + ] +} diff --git a/lib/test/flow/comment_interning/labeled.js b/lib/test/flow/comment_interning/labeled.js new file mode 100644 index 0000000..43ef70a --- /dev/null +++ b/lib/test/flow/comment_interning/labeled.js @@ -0,0 +1,7 @@ +function test() { + var i = 0; + // 1.1 Leading on label + /* 1.2 Leading on label */ foo: /* 1.3 Leading on for */ for (;;) { + i += 1; + } +} diff --git a/lib/test/flow/comment_interning/labeled.options.json b/lib/test/flow/comment_interning/labeled.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/labeled.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/labeled.tree.json b/lib/test/flow/comment_interning/labeled.tree.json new file mode 100644 index 0000000..18dab4c --- /dev/null +++ b/lib/test/flow/comment_interning/labeled.tree.json @@ -0,0 +1,173 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "range":[0,156], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "range":[0,156], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, + "range":[9,13], + "name":"test", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":7,"column":1}}, + "range":[16,156], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":14}}, + "range":[22,32], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":13}}, + "range":[26,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "range":[26,27], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":13}}, + "range":[30,31], + "value":0, + "raw":"0" + } + } + ], + "kind":"var" + }, + { + "type":"LabeledStatement", + "leadingComments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":27}}, + "range":[37,60], + "value":" 1.1 Leading on label" + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":4},"end":{"line":4,"column":30}}, + "range":[65,91], + "value":" 1.2 Leading on label " + } + ], + "loc":{"source":null,"start":{"line":4,"column":31},"end":{"line":6,"column":5}}, + "range":[92,154], + "label":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":27}}, + "range":[37,60], + "value":" 1.1 Leading on label" + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":4},"end":{"line":4,"column":30}}, + "range":[65,91], + "value":" 1.2 Leading on label " + } + ], + "loc":{"source":null,"start":{"line":4,"column":31},"end":{"line":4,"column":34}}, + "range":[92,95], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ForStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":36},"end":{"line":4,"column":60}}, + "range":[97,121], + "value":" 1.3 Leading on for " + } + ], + "loc":{"source":null,"start":{"line":4,"column":61},"end":{"line":6,"column":5}}, + "range":[122,154], + "init":null, + "test":null, + "update":null, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":4,"column":70},"end":{"line":6,"column":5}}, + "range":[131,154], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":5,"column":8},"end":{"line":5,"column":15}}, + "range":[141,148], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":5,"column":8},"end":{"line":5,"column":14}}, + "range":[141,147], + "operator":"+=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":8},"end":{"line":5,"column":9}}, + "range":[141,142], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":5,"column":13},"end":{"line":5,"column":14}}, + "range":[146,147], + "value":1, + "raw":"1" + } + }, + "directive":null + } + ] + } + } + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":27}}, + "range":[37,60], + "value":" 1.1 Leading on label" + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":4},"end":{"line":4,"column":30}}, + "range":[65,91], + "value":" 1.2 Leading on label " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":36},"end":{"line":4,"column":60}}, + "range":[97,121], + "value":" 1.3 Leading on for " + } + ] +} diff --git a/lib/test/flow/comment_interning/literal.js b/lib/test/flow/comment_interning/literal.js new file mode 100644 index 0000000..1e445c3 --- /dev/null +++ b/lib/test/flow/comment_interning/literal.js @@ -0,0 +1,11 @@ +/* 1.1 L num */ 1 /* 1.2 T num */; + +/* 2.1 L str */ "a" /* 2.2 T str */; + +/* 3.1 L bool */ true /* 3.2 T bool */; + +/* 4.1 L null */ null /* 4.2 T null */; + +/* 5.1 L regex */ /asdf/ /* 5.2 T regex */; + +/* 6.1 L bigint */ 1n /* 6.2 T bigint */; diff --git a/lib/test/flow/comment_interning/literal.options.json b/lib/test/flow/comment_interning/literal.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/literal.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/literal.tree.json b/lib/test/flow/comment_interning/literal.tree.json new file mode 100644 index 0000000..c71f0a9 --- /dev/null +++ b/lib/test/flow/comment_interning/literal.tree.json @@ -0,0 +1,256 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":11,"column":41}}, + "range":[16,242], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":34}}, + "range":[16,34], + "expression":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":33}}, + "range":[18,33], + "value":" 1.2 T num " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "value":" 1.1 L num " + } + ], + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "range":[16,17], + "value":1, + "raw":"1" + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":3,"column":16},"end":{"line":3,"column":36}}, + "range":[52,72], + "expression":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":20},"end":{"line":3,"column":35}}, + "range":[56,71], + "value":" 2.2 T str " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":15}}, + "range":[36,51], + "value":" 2.1 L str " + } + ], + "loc":{"source":null,"start":{"line":3,"column":16},"end":{"line":3,"column":19}}, + "range":[52,55], + "value":"a", + "raw":"\"a\"" + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":5,"column":17},"end":{"line":5,"column":39}}, + "range":[91,113], + "expression":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":22},"end":{"line":5,"column":38}}, + "range":[96,112], + "value":" 3.2 T bool " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":16}}, + "range":[74,90], + "value":" 3.1 L bool " + } + ], + "loc":{"source":null,"start":{"line":5,"column":17},"end":{"line":5,"column":21}}, + "range":[91,95], + "value":true, + "raw":"true" + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":7,"column":17},"end":{"line":7,"column":39}}, + "range":[132,154], + "expression":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":22},"end":{"line":7,"column":38}}, + "range":[137,153], + "value":" 4.2 T null " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":16}}, + "range":[115,131], + "value":" 4.1 L null " + } + ], + "loc":{"source":null,"start":{"line":7,"column":17},"end":{"line":7,"column":21}}, + "range":[132,136], + "value":null, + "raw":"null" + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":9,"column":18},"end":{"line":9,"column":43}}, + "range":[174,199], + "expression":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":25},"end":{"line":9,"column":42}}, + "range":[181,198], + "value":" 5.2 T regex " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":9,"column":17}}, + "range":[156,173], + "value":" 5.1 L regex " + } + ], + "loc":{"source":null,"start":{"line":9,"column":18},"end":{"line":9,"column":24}}, + "range":[174,180], + "value":null, + "raw":"/asdf/", + "regex":{"pattern":"asdf","flags":""} + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":11,"column":19},"end":{"line":11,"column":41}}, + "range":[220,242], + "expression":{ + "type":"BigIntLiteral", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":22},"end":{"line":11,"column":40}}, + "range":[223,241], + "value":" 6.2 T bigint " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":11,"column":18}}, + "range":[201,219], + "value":" 6.1 L bigint " + } + ], + "loc":{"source":null,"start":{"line":11,"column":19},"end":{"line":11,"column":21}}, + "range":[220,222], + "value":null, + "bigint":"1n" + }, + "directive":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "value":" 1.1 L num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":33}}, + "range":[18,33], + "value":" 1.2 T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":15}}, + "range":[36,51], + "value":" 2.1 L str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":20},"end":{"line":3,"column":35}}, + "range":[56,71], + "value":" 2.2 T str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":16}}, + "range":[74,90], + "value":" 3.1 L bool " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":22},"end":{"line":5,"column":38}}, + "range":[96,112], + "value":" 3.2 T bool " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":16}}, + "range":[115,131], + "value":" 4.1 L null " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":22},"end":{"line":7,"column":38}}, + "range":[137,153], + "value":" 4.2 T null " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":9,"column":17}}, + "range":[156,173], + "value":" 5.1 L regex " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":25},"end":{"line":9,"column":42}}, + "range":[181,198], + "value":" 5.2 T regex " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":11,"column":18}}, + "range":[201,219], + "value":" 6.1 L bigint " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":22},"end":{"line":11,"column":40}}, + "range":[223,241], + "value":" 6.2 T bigint " + } + ] +} diff --git a/lib/test/flow/comment_interning/member.js b/lib/test/flow/comment_interning/member.js new file mode 100644 index 0000000..491d198 --- /dev/null +++ b/lib/test/flow/comment_interning/member.js @@ -0,0 +1,20 @@ +const x = {y: 0}; + +function staticMemberExpression() { + /* 1.1 L id */ x /* 1.2 T id */ . /* 1.3 L id */ y /* 1.4 T id */; + + /* 2.1 L member */ (/* 2.2 L id */ x.y /* 2.3 T id */) /* 2.4 T member */; +} + +function dynamicMemberExpression() { + /* 3.1 L id */ x /* 3.2 T id */ [/* 3.3 L id */ y /* 3.4 T id */] /* 3.5 T member */; + + /* 4.1 L member */ (/* 4.2 L id */ x[y] /* 4.3 T member */) /* 4.4 T member */; +} + +class PrivateMemberExpression { + /* 5.1 L private */ #z /* 5.2 T id */; + constructor() { + /* 6.1 L this */ this /* 6.2 T this */ . /* 6.3 L private */ #z /* 6.4 T id */; + } +} diff --git a/lib/test/flow/comment_interning/member.options.json b/lib/test/flow/comment_interning/member.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/member.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/member.tree.json b/lib/test/flow/comment_interning/member.tree.json new file mode 100644 index 0000000..9779f8f --- /dev/null +++ b/lib/test/flow/comment_interning/member.tree.json @@ -0,0 +1,656 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":20,"column":1}}, + "range":[0,596], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, + "range":[6,16], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, + "range":[10,16], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":15}}, + "range":[11,15], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "value":0, + "raw":"0" + }, + "kind":"init", + "method":false, + "shorthand":false, + "computed":false + } + ] + } + } + ], + "kind":"const" + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":7,"column":1}}, + "range":[19,203], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":9},"end":{"line":3,"column":31}}, + "range":[28,50], + "name":"staticMemberExpression", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":34},"end":{"line":7,"column":1}}, + "range":[53,203], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":4,"column":17},"end":{"line":4,"column":68}}, + "range":[72,123], + "expression":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":4,"column":17},"end":{"line":4,"column":52}}, + "range":[72,107], + "object":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":19},"end":{"line":4,"column":33}}, + "range":[74,88], + "value":" 1.2 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":16}}, + "range":[57,71], + "value":" 1.1 L id " + } + ], + "loc":{"source":null,"start":{"line":4,"column":17},"end":{"line":4,"column":18}}, + "range":[72,73], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":53},"end":{"line":4,"column":67}}, + "range":[108,122], + "value":" 1.4 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":36},"end":{"line":4,"column":50}}, + "range":[91,105], + "value":" 1.3 L id " + } + ], + "loc":{"source":null,"start":{"line":4,"column":51},"end":{"line":4,"column":52}}, + "range":[106,107], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":6,"column":21},"end":{"line":6,"column":76}}, + "range":[146,201], + "expression":{ + "type":"MemberExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":57},"end":{"line":6,"column":75}}, + "range":[182,200], + "value":" 2.4 T member " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":20}}, + "range":[127,145], + "value":" 2.1 L member " + } + ], + "loc":{"source":null,"start":{"line":6,"column":37},"end":{"line":6,"column":40}}, + "range":[162,165], + "object":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":22},"end":{"line":6,"column":36}}, + "range":[147,161], + "value":" 2.2 L id " + } + ], + "loc":{"source":null,"start":{"line":6,"column":37},"end":{"line":6,"column":38}}, + "range":[162,163], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":41},"end":{"line":6,"column":55}}, + "range":[166,180], + "value":" 2.3 T id " + } + ], + "loc":{"source":null,"start":{"line":6,"column":39},"end":{"line":6,"column":40}}, + "range":[164,165], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":13,"column":1}}, + "range":[205,414], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":9},"end":{"line":9,"column":32}}, + "range":[214,237], + "name":"dynamicMemberExpression", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":9,"column":35},"end":{"line":13,"column":1}}, + "range":[240,414], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":10,"column":17},"end":{"line":10,"column":87}}, + "range":[259,329], + "expression":{ + "type":"MemberExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":68},"end":{"line":10,"column":86}}, + "range":[310,328], + "value":" 3.5 T member " + } + ], + "loc":{"source":null,"start":{"line":10,"column":17},"end":{"line":10,"column":67}}, + "range":[259,309], + "object":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":19},"end":{"line":10,"column":33}}, + "range":[261,275], + "value":" 3.2 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":2},"end":{"line":10,"column":16}}, + "range":[244,258], + "value":" 3.1 L id " + } + ], + "loc":{"source":null,"start":{"line":10,"column":17},"end":{"line":10,"column":18}}, + "range":[259,260], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":52},"end":{"line":10,"column":66}}, + "range":[294,308], + "value":" 3.4 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":35},"end":{"line":10,"column":49}}, + "range":[277,291], + "value":" 3.3 L id " + } + ], + "loc":{"source":null,"start":{"line":10,"column":50},"end":{"line":10,"column":51}}, + "range":[292,293], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "computed":true + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":12,"column":21},"end":{"line":12,"column":81}}, + "range":[352,412], + "expression":{ + "type":"MemberExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":42},"end":{"line":12,"column":60}}, + "range":[373,391], + "value":" 4.3 T member " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":62},"end":{"line":12,"column":80}}, + "range":[393,411], + "value":" 4.4 T member " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":2},"end":{"line":12,"column":20}}, + "range":[333,351], + "value":" 4.1 L member " + } + ], + "loc":{"source":null,"start":{"line":12,"column":37},"end":{"line":12,"column":41}}, + "range":[368,372], + "object":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":22},"end":{"line":12,"column":36}}, + "range":[353,367], + "value":" 4.2 L id " + } + ], + "loc":{"source":null,"start":{"line":12,"column":37},"end":{"line":12,"column":38}}, + "range":[368,369], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":12,"column":39},"end":{"line":12,"column":40}}, + "range":[370,371], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "computed":true + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":15,"column":0},"end":{"line":20,"column":1}}, + "range":[416,596], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":15,"column":6},"end":{"line":15,"column":29}}, + "range":[422,445], + "name":"PrivateMemberExpression", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":15,"column":30},"end":{"line":20,"column":1}}, + "range":[446,596], + "body":[ + { + "type":"ClassPrivateProperty", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":2},"end":{"line":16,"column":21}}, + "range":[450,469], + "value":" 5.1 L private " + } + ], + "loc":{"source":null,"start":{"line":16,"column":22},"end":{"line":16,"column":40}}, + "range":[470,488], + "key":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":25},"end":{"line":16,"column":39}}, + "range":[473,487], + "value":" 5.2 T id " + } + ], + "loc":{"source":null,"start":{"line":16,"column":23},"end":{"line":16,"column":24}}, + "range":[471,472], + "name":"z", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":null, + "static":false, + "variance":null + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":17,"column":2},"end":{"line":19,"column":3}}, + "range":[491,594], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":17,"column":2},"end":{"line":17,"column":13}}, + "range":[491,502], + "name":"constructor", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":17,"column":13},"end":{"line":19,"column":3}}, + "range":[502,594], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":17,"column":16},"end":{"line":19,"column":3}}, + "range":[505,594], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":18,"column":21},"end":{"line":18,"column":83}}, + "range":[528,590], + "expression":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":18,"column":21},"end":{"line":18,"column":67}}, + "range":[528,574], + "object":{ + "type":"ThisExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":26},"end":{"line":18,"column":42}}, + "range":[533,549], + "value":" 6.2 T this " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":4},"end":{"line":18,"column":20}}, + "range":[511,527], + "value":" 6.1 L this " + } + ], + "loc":{"source":null,"start":{"line":18,"column":21},"end":{"line":18,"column":25}}, + "range":[528,532] + }, + "property":{ + "type":"PrivateName", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":45},"end":{"line":18,"column":64}}, + "range":[552,571], + "value":" 6.3 L private " + } + ], + "loc":{"source":null,"start":{"line":18,"column":65},"end":{"line":18,"column":67}}, + "range":[572,574], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":68},"end":{"line":18,"column":82}}, + "range":[575,589], + "value":" 6.4 T id " + } + ], + "loc":{"source":null,"start":{"line":18,"column":66},"end":{"line":18,"column":67}}, + "range":[573,574], + "name":"z", + "typeAnnotation":null, + "optional":false + } + }, + "computed":false + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"constructor", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":16}}, + "range":[57,71], + "value":" 1.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":19},"end":{"line":4,"column":33}}, + "range":[74,88], + "value":" 1.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":36},"end":{"line":4,"column":50}}, + "range":[91,105], + "value":" 1.3 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":53},"end":{"line":4,"column":67}}, + "range":[108,122], + "value":" 1.4 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":20}}, + "range":[127,145], + "value":" 2.1 L member " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":22},"end":{"line":6,"column":36}}, + "range":[147,161], + "value":" 2.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":41},"end":{"line":6,"column":55}}, + "range":[166,180], + "value":" 2.3 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":57},"end":{"line":6,"column":75}}, + "range":[182,200], + "value":" 2.4 T member " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":2},"end":{"line":10,"column":16}}, + "range":[244,258], + "value":" 3.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":19},"end":{"line":10,"column":33}}, + "range":[261,275], + "value":" 3.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":35},"end":{"line":10,"column":49}}, + "range":[277,291], + "value":" 3.3 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":52},"end":{"line":10,"column":66}}, + "range":[294,308], + "value":" 3.4 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":68},"end":{"line":10,"column":86}}, + "range":[310,328], + "value":" 3.5 T member " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":2},"end":{"line":12,"column":20}}, + "range":[333,351], + "value":" 4.1 L member " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":22},"end":{"line":12,"column":36}}, + "range":[353,367], + "value":" 4.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":42},"end":{"line":12,"column":60}}, + "range":[373,391], + "value":" 4.3 T member " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":62},"end":{"line":12,"column":80}}, + "range":[393,411], + "value":" 4.4 T member " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":2},"end":{"line":16,"column":21}}, + "range":[450,469], + "value":" 5.1 L private " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":25},"end":{"line":16,"column":39}}, + "range":[473,487], + "value":" 5.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":4},"end":{"line":18,"column":20}}, + "range":[511,527], + "value":" 6.1 L this " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":26},"end":{"line":18,"column":42}}, + "range":[533,549], + "value":" 6.2 T this " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":45},"end":{"line":18,"column":64}}, + "range":[552,571], + "value":" 6.3 L private " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":68},"end":{"line":18,"column":82}}, + "range":[575,589], + "value":" 6.4 T id " + } + ] +} diff --git a/lib/test/flow/comment_interning/meta_property.js b/lib/test/flow/comment_interning/meta_property.js new file mode 100644 index 0000000..9b8f0b0 --- /dev/null +++ b/lib/test/flow/comment_interning/meta_property.js @@ -0,0 +1,5 @@ +function test() { + /* 1.1 L id */ new /* 1.2 T id */ . /* 1.3 L id */ target /* 1.4 T id */; + + /* 2.1 L meta */ (/* 2.2 L id */ new.target /* 2.3 T id */) /* 2.4 T meta */; +} diff --git a/lib/test/flow/comment_interning/meta_property.options.json b/lib/test/flow/comment_interning/meta_property.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/meta_property.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/meta_property.tree.json b/lib/test/flow/comment_interning/meta_property.tree.json new file mode 100644 index 0000000..2d47007 --- /dev/null +++ b/lib/test/flow/comment_interning/meta_property.tree.json @@ -0,0 +1,202 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "range":[0,176], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "range":[0,176], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, + "range":[9,13], + "name":"test", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":5,"column":1}}, + "range":[16,176], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":75}}, + "range":[35,93], + "expression":{ + "type":"MetaProperty", + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":59}}, + "range":[35,77], + "meta":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":21},"end":{"line":2,"column":35}}, + "range":[39,53], + "value":" 1.2 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "range":[20,34], + "value":" 1.1 L id " + } + ], + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":20}}, + "range":[35,38], + "name":"new", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":60},"end":{"line":2,"column":74}}, + "range":[78,92], + "value":" 1.4 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":38},"end":{"line":2,"column":52}}, + "range":[56,70], + "value":" 1.3 L id " + } + ], + "loc":{"source":null,"start":{"line":2,"column":53},"end":{"line":2,"column":59}}, + "range":[71,77], + "name":"target", + "typeAnnotation":null, + "optional":false + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":4,"column":19},"end":{"line":4,"column":79}}, + "range":[114,174], + "expression":{ + "type":"MetaProperty", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":62},"end":{"line":4,"column":78}}, + "range":[157,173], + "value":" 2.4 T meta " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":18}}, + "range":[97,113], + "value":" 2.1 L meta " + } + ], + "loc":{"source":null,"start":{"line":4,"column":35},"end":{"line":4,"column":45}}, + "range":[130,140], + "meta":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":20},"end":{"line":4,"column":34}}, + "range":[115,129], + "value":" 2.2 L id " + } + ], + "loc":{"source":null,"start":{"line":4,"column":35},"end":{"line":4,"column":38}}, + "range":[130,133], + "name":"new", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":46},"end":{"line":4,"column":60}}, + "range":[141,155], + "value":" 2.3 T id " + } + ], + "loc":{"source":null,"start":{"line":4,"column":39},"end":{"line":4,"column":45}}, + "range":[134,140], + "name":"target", + "typeAnnotation":null, + "optional":false + } + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "range":[20,34], + "value":" 1.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":21},"end":{"line":2,"column":35}}, + "range":[39,53], + "value":" 1.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":38},"end":{"line":2,"column":52}}, + "range":[56,70], + "value":" 1.3 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":60},"end":{"line":2,"column":74}}, + "range":[78,92], + "value":" 1.4 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":18}}, + "range":[97,113], + "value":" 2.1 L meta " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":20},"end":{"line":4,"column":34}}, + "range":[115,129], + "value":" 2.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":46},"end":{"line":4,"column":60}}, + "range":[141,155], + "value":" 2.3 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":62},"end":{"line":4,"column":78}}, + "range":[157,173], + "value":" 2.4 T meta " + } + ] +} diff --git a/lib/test/flow/comment_interning/new.js b/lib/test/flow/comment_interning/new.js new file mode 100644 index 0000000..48fc5d2 --- /dev/null +++ b/lib/test/flow/comment_interning/new.js @@ -0,0 +1,17 @@ +/* 1.1 L new */ new /* 1.2 L id */ Foo /* 1.3 L targs */ /* 1.4 L args */ () /* 1.5 T args */; + +new /* 2.1 L id */ Foo /* 2.2 T id */ + /* 2.3 L targs */ /* 2.4 T targs */ + /* 2.5 L args */ () /* 2.6 T args */ + /* 2.7 T args */; + +new /* 3.1 L id */ Foo /* 3.2 T id */ + /* 3.3 L targs */ /* 3.4 T targs */ + /* 3.5 T targs */; + +new /* 4.1 L id */ Foo /* 4.2 T id */ + /* 4.3 T id */; + +new Foo(/* 5.1 I args */); + +new Foo(a, /* 6.1 I args */); diff --git a/lib/test/flow/comment_interning/new.options.json b/lib/test/flow/comment_interning/new.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/new.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/new.tree.json b/lib/test/flow/comment_interning/new.tree.json new file mode 100644 index 0000000..071ca97 --- /dev/null +++ b/lib/test/flow/comment_interning/new.tree.json @@ -0,0 +1,504 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":17,"column":29}}, + "range":[16,456], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":98}}, + "range":[16,98], + "expression":{ + "type":"NewExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":81},"end":{"line":1,"column":97}}, + "range":[81,97], + "value":" 1.5 T args " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "value":" 1.1 L new " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":61},"end":{"line":1,"column":77}}, + "range":[61,77], + "value":" 1.4 L args " + } + ], + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":80}}, + "range":[16,80], + "callee":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":34}}, + "range":[20,34], + "value":" 1.2 L id " + } + ], + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":38}}, + "range":[35,38], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":{ + "type":"TypeParameterInstantiation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":56}}, + "range":[39,56], + "value":" 1.3 L targs " + } + ], + "loc":{"source":null,"start":{"line":1,"column":57},"end":{"line":1,"column":60}}, + "range":[57,60], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":58},"end":{"line":1,"column":59}}, + "range":[58,59], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":58},"end":{"line":1,"column":59}}, + "range":[58,59], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + }, + "arguments":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":6,"column":19}}, + "range":[100,238], + "expression":{ + "type":"NewExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":22},"end":{"line":5,"column":38}}, + "range":[202,218], + "value":" 2.6 T args " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":18}}, + "range":[221,237], + "value":" 2.7 T args " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":2},"end":{"line":5,"column":18}}, + "range":[182,198], + "value":" 2.5 L args " + } + ], + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":5,"column":21}}, + "range":[100,201], + "callee":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":23},"end":{"line":3,"column":37}}, + "range":[123,137], + "value":" 2.2 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":18}}, + "range":[104,118], + "value":" 2.1 L id " + } + ], + "loc":{"source":null,"start":{"line":3,"column":19},"end":{"line":3,"column":22}}, + "range":[119,122], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":{ + "type":"TypeParameterInstantiation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":24},"end":{"line":4,"column":41}}, + "range":[162,179], + "value":" 2.4 T targs " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":19}}, + "range":[140,157], + "value":" 2.3 L targs " + } + ], + "loc":{"source":null,"start":{"line":4,"column":20},"end":{"line":4,"column":23}}, + "range":[158,161], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":21},"end":{"line":4,"column":22}}, + "range":[159,160], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":21},"end":{"line":4,"column":22}}, + "range":[159,160], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + }, + "arguments":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":8,"column":0},"end":{"line":10,"column":20}}, + "range":[240,340], + "expression":{ + "type":"NewExpression", + "loc":{"source":null,"start":{"line":8,"column":0},"end":{"line":9,"column":23}}, + "range":[240,301], + "callee":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":23},"end":{"line":8,"column":37}}, + "range":[263,277], + "value":" 3.2 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":4},"end":{"line":8,"column":18}}, + "range":[244,258], + "value":" 3.1 L id " + } + ], + "loc":{"source":null,"start":{"line":8,"column":19},"end":{"line":8,"column":22}}, + "range":[259,262], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":{ + "type":"TypeParameterInstantiation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":24},"end":{"line":9,"column":41}}, + "range":[302,319], + "value":" 3.4 T targs " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":2},"end":{"line":10,"column":19}}, + "range":[322,339], + "value":" 3.5 T targs " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":2},"end":{"line":9,"column":19}}, + "range":[280,297], + "value":" 3.3 L targs " + } + ], + "loc":{"source":null,"start":{"line":9,"column":20},"end":{"line":9,"column":23}}, + "range":[298,301], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":9,"column":21},"end":{"line":9,"column":22}}, + "range":[299,300], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":21},"end":{"line":9,"column":22}}, + "range":[299,300], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + }, + "arguments":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":12,"column":0},"end":{"line":13,"column":17}}, + "range":[342,397], + "expression":{ + "type":"NewExpression", + "loc":{"source":null,"start":{"line":12,"column":0},"end":{"line":12,"column":22}}, + "range":[342,364], + "callee":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":23},"end":{"line":12,"column":37}}, + "range":[365,379], + "value":" 4.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":2},"end":{"line":13,"column":16}}, + "range":[382,396], + "value":" 4.3 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":4},"end":{"line":12,"column":18}}, + "range":[346,360], + "value":" 4.1 L id " + } + ], + "loc":{"source":null,"start":{"line":12,"column":19},"end":{"line":12,"column":22}}, + "range":[361,364], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":15,"column":0},"end":{"line":15,"column":26}}, + "range":[399,425], + "expression":{ + "type":"NewExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":8},"end":{"line":15,"column":24}}, + "range":[407,423], + "value":" 5.1 I args " + } + ], + "loc":{"source":null,"start":{"line":15,"column":0},"end":{"line":15,"column":25}}, + "range":[399,424], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":15,"column":4},"end":{"line":15,"column":7}}, + "range":[403,406], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":17,"column":0},"end":{"line":17,"column":29}}, + "range":[427,456], + "expression":{ + "type":"NewExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":11},"end":{"line":17,"column":27}}, + "range":[438,454], + "value":" 6.1 I args " + } + ], + "loc":{"source":null,"start":{"line":17,"column":0},"end":{"line":17,"column":28}}, + "range":[427,455], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":17,"column":4},"end":{"line":17,"column":7}}, + "range":[431,434], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":17,"column":8},"end":{"line":17,"column":9}}, + "range":[435,436], + "name":"a", + "typeAnnotation":null, + "optional":false + } + ] + }, + "directive":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "value":" 1.1 L new " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":34}}, + "range":[20,34], + "value":" 1.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":56}}, + "range":[39,56], + "value":" 1.3 L targs " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":61},"end":{"line":1,"column":77}}, + "range":[61,77], + "value":" 1.4 L args " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":81},"end":{"line":1,"column":97}}, + "range":[81,97], + "value":" 1.5 T args " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":18}}, + "range":[104,118], + "value":" 2.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":23},"end":{"line":3,"column":37}}, + "range":[123,137], + "value":" 2.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":19}}, + "range":[140,157], + "value":" 2.3 L targs " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":24},"end":{"line":4,"column":41}}, + "range":[162,179], + "value":" 2.4 T targs " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":2},"end":{"line":5,"column":18}}, + "range":[182,198], + "value":" 2.5 L args " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":22},"end":{"line":5,"column":38}}, + "range":[202,218], + "value":" 2.6 T args " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":18}}, + "range":[221,237], + "value":" 2.7 T args " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":4},"end":{"line":8,"column":18}}, + "range":[244,258], + "value":" 3.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":23},"end":{"line":8,"column":37}}, + "range":[263,277], + "value":" 3.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":2},"end":{"line":9,"column":19}}, + "range":[280,297], + "value":" 3.3 L targs " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":24},"end":{"line":9,"column":41}}, + "range":[302,319], + "value":" 3.4 T targs " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":2},"end":{"line":10,"column":19}}, + "range":[322,339], + "value":" 3.5 T targs " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":4},"end":{"line":12,"column":18}}, + "range":[346,360], + "value":" 4.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":23},"end":{"line":12,"column":37}}, + "range":[365,379], + "value":" 4.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":2},"end":{"line":13,"column":16}}, + "range":[382,396], + "value":" 4.3 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":8},"end":{"line":15,"column":24}}, + "range":[407,423], + "value":" 5.1 I args " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":11},"end":{"line":17,"column":27}}, + "range":[438,454], + "value":" 6.1 I args " + } + ] +} diff --git a/lib/test/flow/comment_interning/object.js b/lib/test/flow/comment_interning/object.js new file mode 100644 index 0000000..dd90876 --- /dev/null +++ b/lib/test/flow/comment_interning/object.js @@ -0,0 +1,44 @@ +(/* 1.1 L obj */ {a: 1} /* 1.2 T obj */); + +({ /* 2.1 L id */ a /* 2.2 T id */ : /* 2.3 L num */ 1 /* 2.4 T num */ }); + +({ /* 3.1 L computed */ [/* 3.2 L str */ 'a' /* 3.3 T str */] /* 3.4 T computed */ : 1 }); + +({ /* 4.1 L spread */ ... /* 4.2 L obj */ {} /* 4.3 T obj */ }); + +({ /* 5.1 L func */ async /* 5.2 L func */ * /* 5.3 L id */ method /* 5.4 L tparams */ /* 5.5 L params */ () /* 5.6 L block */ {} /* 5.7 L block */ }); + +({ /* 6.1 L getter */ get /* 6.2 L id */ getter(){} }); + +({ /* 7.1 L setter */ set /* 7.2 L id */ setter(x){} }); + +({ + method /* 8.1 L tparams */ /* 8.2 L params */ () /* 8.3 T params */ : /* 8.4 L any */ any /* 8.5 L block */ {}, + + method /* 9.1 L tparams */ /* 9.2 T tparams */ + /* 9.3 L params */ () /* 9.4 T params */ + : /* 9.5 L any */ any /* 9.6 T any */ + /* 9.7 L block */ {}, + + method /* 10.1 L params */ () /* 10.2 T params */ + /* 10.3 L block */ {}, + + get getter /* 11.1 L params */ () /* 11.2 T params */ : /* 11.3 L any */ any /* 11.4 L block */ {}, + + get getter /* 12.1 T id */ + /* 12.2 L params */ () /* 12.3 T params */ + : /* 12.4 L any */ any /* 12.5 T any */ + /* 12.6 L block */ {}, + + get getter /* 13.1 T id */ + /* 13.2 L params */ () /* 13.3 T params */ + /* 13.4 L block */ {} +}); + +({ /* 14.1 I obj */ }); + +({ a, /* 15.1 I obj */ }); + +({ /* 16.1 L id */ get(){} }); + +({ /* 17.1 L id */ set(){} }); diff --git a/lib/test/flow/comment_interning/object.options.json b/lib/test/flow/comment_interning/object.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/object.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/object.tree.json b/lib/test/flow/comment_interning/object.tree.json new file mode 100644 index 0000000..5940108 --- /dev/null +++ b/lib/test/flow/comment_interning/object.tree.json @@ -0,0 +1,1551 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":44,"column":30}}, + "range":[0,1391], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "range":[0,41], + "expression":{ + "type":"ObjectExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":39}}, + "range":[24,39], + "value":" 1.2 T obj " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":16}}, + "range":[1,16], + "value":" 1.1 L obj " + } + ], + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":23}}, + "range":[17,23], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":22}}, + "range":[18,22], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "value":1, + "raw":"1" + }, + "kind":"init", + "method":false, + "shorthand":false, + "computed":false + } + ] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":74}}, + "range":[43,117], + "expression":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":3,"column":1},"end":{"line":3,"column":72}}, + "range":[44,115], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":3,"column":18},"end":{"line":3,"column":54}}, + "range":[61,97], + "key":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":20},"end":{"line":3,"column":34}}, + "range":[63,77], + "value":" 2.2 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":3},"end":{"line":3,"column":17}}, + "range":[46,60], + "value":" 2.1 L id " + } + ], + "loc":{"source":null,"start":{"line":3,"column":18},"end":{"line":3,"column":19}}, + "range":[61,62], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":55},"end":{"line":3,"column":70}}, + "range":[98,113], + "value":" 2.4 T num " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":37},"end":{"line":3,"column":52}}, + "range":[80,95], + "value":" 2.3 L num " + } + ], + "loc":{"source":null,"start":{"line":3,"column":53},"end":{"line":3,"column":54}}, + "range":[96,97], + "value":1, + "raw":"1" + }, + "kind":"init", + "method":false, + "shorthand":false, + "computed":false + } + ] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":90}}, + "range":[119,209], + "expression":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":5,"column":1},"end":{"line":5,"column":88}}, + "range":[120,207], + "properties":[ + { + "type":"Property", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":62},"end":{"line":5,"column":82}}, + "range":[181,201], + "value":" 3.4 T computed " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":3},"end":{"line":5,"column":23}}, + "range":[122,142], + "value":" 3.1 L computed " + } + ], + "loc":{"source":null,"start":{"line":5,"column":24},"end":{"line":5,"column":86}}, + "range":[143,205], + "key":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":45},"end":{"line":5,"column":60}}, + "range":[164,179], + "value":" 3.3 T str " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":25},"end":{"line":5,"column":40}}, + "range":[144,159], + "value":" 3.2 L str " + } + ], + "loc":{"source":null,"start":{"line":5,"column":41},"end":{"line":5,"column":44}}, + "range":[160,163], + "value":"a", + "raw":"'a'" + }, + "value":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":5,"column":85},"end":{"line":5,"column":86}}, + "range":[204,205], + "value":1, + "raw":"1" + }, + "kind":"init", + "method":false, + "shorthand":false, + "computed":true + } + ] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":64}}, + "range":[211,275], + "expression":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":7,"column":1},"end":{"line":7,"column":62}}, + "range":[212,273], + "properties":[ + { + "type":"SpreadProperty", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":3},"end":{"line":7,"column":21}}, + "range":[214,232], + "value":" 4.1 L spread " + } + ], + "loc":{"source":null,"start":{"line":7,"column":22},"end":{"line":7,"column":44}}, + "range":[233,255], + "argument":{ + "type":"ObjectExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":45},"end":{"line":7,"column":60}}, + "range":[256,271], + "value":" 4.3 T obj " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":26},"end":{"line":7,"column":41}}, + "range":[237,252], + "value":" 4.2 L obj " + } + ], + "loc":{"source":null,"start":{"line":7,"column":42},"end":{"line":7,"column":44}}, + "range":[253,255], + "properties":[] + } + } + ] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":9,"column":155}}, + "range":[277,432], + "expression":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":9,"column":1},"end":{"line":9,"column":153}}, + "range":[278,430], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":9,"column":20},"end":{"line":9,"column":133}}, + "range":[297,410], + "key":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":45},"end":{"line":9,"column":59}}, + "range":[322,336], + "value":" 5.3 L id " + } + ], + "loc":{"source":null,"start":{"line":9,"column":60},"end":{"line":9,"column":66}}, + "range":[337,343], + "name":"method", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":3},"end":{"line":9,"column":19}}, + "range":[280,296], + "value":" 5.1 L func " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":26},"end":{"line":9,"column":42}}, + "range":[303,319], + "value":" 5.2 L func " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":91},"end":{"line":9,"column":109}}, + "range":[368,386], + "value":" 5.5 L params " + } + ], + "loc":{"source":null,"start":{"line":9,"column":87},"end":{"line":9,"column":133}}, + "range":[364,410], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":134},"end":{"line":9,"column":151}}, + "range":[411,428], + "value":" 5.7 L block " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":113},"end":{"line":9,"column":130}}, + "range":[390,407], + "value":" 5.6 L block " + } + ], + "loc":{"source":null,"start":{"line":9,"column":131},"end":{"line":9,"column":133}}, + "range":[408,410], + "body":[] + }, + "async":true, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":67},"end":{"line":9,"column":86}}, + "range":[344,363], + "value":" 5.4 L tparams " + } + ], + "loc":{"source":null,"start":{"line":9,"column":87},"end":{"line":9,"column":90}}, + "range":[364,367], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":9,"column":88},"end":{"line":9,"column":89}}, + "range":[365,366], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "kind":"init", + "method":true, + "shorthand":false, + "computed":false + } + ] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":11,"column":55}}, + "range":[434,489], + "expression":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":11,"column":1},"end":{"line":11,"column":53}}, + "range":[435,487], + "properties":[ + { + "type":"Property", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":3},"end":{"line":11,"column":21}}, + "range":[437,455], + "value":" 6.1 L getter " + } + ], + "loc":{"source":null,"start":{"line":11,"column":22},"end":{"line":11,"column":51}}, + "range":[456,485], + "key":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":26},"end":{"line":11,"column":40}}, + "range":[460,474], + "value":" 6.2 L id " + } + ], + "loc":{"source":null,"start":{"line":11,"column":41},"end":{"line":11,"column":47}}, + "range":[475,481], + "name":"getter", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":11,"column":47},"end":{"line":11,"column":51}}, + "range":[481,485], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":11,"column":49},"end":{"line":11,"column":51}}, + "range":[483,485], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"get", + "method":false, + "shorthand":false, + "computed":false + } + ] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":13,"column":0},"end":{"line":13,"column":56}}, + "range":[491,547], + "expression":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":13,"column":1},"end":{"line":13,"column":54}}, + "range":[492,545], + "properties":[ + { + "type":"Property", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":3},"end":{"line":13,"column":21}}, + "range":[494,512], + "value":" 7.1 L setter " + } + ], + "loc":{"source":null,"start":{"line":13,"column":22},"end":{"line":13,"column":52}}, + "range":[513,543], + "key":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":26},"end":{"line":13,"column":40}}, + "range":[517,531], + "value":" 7.2 L id " + } + ], + "loc":{"source":null,"start":{"line":13,"column":41},"end":{"line":13,"column":47}}, + "range":[532,538], + "name":"setter", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":13,"column":47},"end":{"line":13,"column":52}}, + "range":[538,543], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":13,"column":48},"end":{"line":13,"column":49}}, + "range":[539,540], + "name":"x", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":13,"column":50},"end":{"line":13,"column":52}}, + "range":[541,543], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"set", + "method":false, + "shorthand":false, + "computed":false + } + ] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":15,"column":0},"end":{"line":36,"column":3}}, + "range":[549,1274], + "expression":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":15,"column":1},"end":{"line":36,"column":1}}, + "range":[550,1272], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":16,"column":2},"end":{"line":16,"column":116}}, + "range":[554,668], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":16,"column":2},"end":{"line":16,"column":8}}, + "range":[554,560], + "name":"method", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":55},"end":{"line":16,"column":73}}, + "range":[607,625], + "value":" 8.3 T params " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":33},"end":{"line":16,"column":51}}, + "range":[585,603], + "value":" 8.2 L params " + } + ], + "loc":{"source":null,"start":{"line":16,"column":29},"end":{"line":16,"column":116}}, + "range":[581,668], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":96},"end":{"line":16,"column":113}}, + "range":[648,665], + "value":" 8.5 L block " + } + ], + "loc":{"source":null,"start":{"line":16,"column":114},"end":{"line":16,"column":116}}, + "range":[666,668], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":16,"column":74},"end":{"line":16,"column":95}}, + "range":[626,647], + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":76},"end":{"line":16,"column":91}}, + "range":[628,643], + "value":" 8.4 L any " + } + ], + "loc":{"source":null,"start":{"line":16,"column":92},"end":{"line":16,"column":95}}, + "range":[644,647] + } + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":9},"end":{"line":16,"column":28}}, + "range":[561,580], + "value":" 8.1 L tparams " + } + ], + "loc":{"source":null,"start":{"line":16,"column":29},"end":{"line":16,"column":32}}, + "range":[581,584], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":16,"column":30},"end":{"line":16,"column":31}}, + "range":[582,583], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "kind":"init", + "method":true, + "shorthand":false, + "computed":false + }, + { + "type":"Property", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":21,"column":24}}, + "range":[673,835], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":18,"column":8}}, + "range":[673,679], + "name":"method", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":26},"end":{"line":19,"column":44}}, + "range":[750,768], + "value":" 9.4 T params " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":4},"end":{"line":19,"column":22}}, + "range":[728,746], + "value":" 9.3 L params " + } + ], + "loc":{"source":null,"start":{"line":18,"column":29},"end":{"line":21,"column":24}}, + "range":[700,835], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":4},"end":{"line":21,"column":21}}, + "range":[815,832], + "value":" 9.7 L block " + } + ], + "loc":{"source":null,"start":{"line":21,"column":22},"end":{"line":21,"column":24}}, + "range":[833,835], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":20,"column":4},"end":{"line":20,"column":25}}, + "range":[773,794], + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":26},"end":{"line":20,"column":41}}, + "range":[795,810], + "value":" 9.6 T any " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":6},"end":{"line":20,"column":21}}, + "range":[775,790], + "value":" 9.5 L any " + } + ], + "loc":{"source":null,"start":{"line":20,"column":22},"end":{"line":20,"column":25}}, + "range":[791,794] + } + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":33},"end":{"line":18,"column":52}}, + "range":[704,723], + "value":" 9.2 T tparams " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":9},"end":{"line":18,"column":28}}, + "range":[680,699], + "value":" 9.1 L tparams " + } + ], + "loc":{"source":null,"start":{"line":18,"column":29},"end":{"line":18,"column":32}}, + "range":[700,703], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":18,"column":30},"end":{"line":18,"column":31}}, + "range":[701,702], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "kind":"init", + "method":true, + "shorthand":false, + "computed":false + }, + { + "type":"Property", + "loc":{"source":null,"start":{"line":23,"column":2},"end":{"line":24,"column":25}}, + "range":[840,915], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":23,"column":2},"end":{"line":23,"column":8}}, + "range":[840,846], + "name":"method", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":32},"end":{"line":23,"column":51}}, + "range":[870,889], + "value":" 10.2 T params " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":9},"end":{"line":23,"column":28}}, + "range":[847,866], + "value":" 10.1 L params " + } + ], + "loc":{"source":null,"start":{"line":23,"column":29},"end":{"line":24,"column":25}}, + "range":[867,915], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":4},"end":{"line":24,"column":22}}, + "range":[894,912], + "value":" 10.3 L block " + } + ], + "loc":{"source":null,"start":{"line":24,"column":23},"end":{"line":24,"column":25}}, + "range":[913,915], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"init", + "method":true, + "shorthand":false, + "computed":false + }, + { + "type":"Property", + "loc":{"source":null,"start":{"line":26,"column":2},"end":{"line":26,"column":100}}, + "range":[920,1018], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":26,"column":6},"end":{"line":26,"column":12}}, + "range":[924,930], + "name":"getter", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":36},"end":{"line":26,"column":55}}, + "range":[954,973], + "value":" 11.2 T params " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":13},"end":{"line":26,"column":32}}, + "range":[931,950], + "value":" 11.1 L params " + } + ], + "loc":{"source":null,"start":{"line":26,"column":33},"end":{"line":26,"column":100}}, + "range":[951,1018], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":79},"end":{"line":26,"column":97}}, + "range":[997,1015], + "value":" 11.4 L block " + } + ], + "loc":{"source":null,"start":{"line":26,"column":98},"end":{"line":26,"column":100}}, + "range":[1016,1018], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":26,"column":56},"end":{"line":26,"column":78}}, + "range":[974,996], + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":58},"end":{"line":26,"column":74}}, + "range":[976,992], + "value":" 11.3 L any " + } + ], + "loc":{"source":null,"start":{"line":26,"column":75},"end":{"line":26,"column":78}}, + "range":[993,996] + } + }, + "typeParameters":null + }, + "kind":"get", + "method":false, + "shorthand":false, + "computed":false + }, + { + "type":"Property", + "loc":{"source":null,"start":{"line":28,"column":2},"end":{"line":31,"column":25}}, + "range":[1023,1166], + "key":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":28,"column":13},"end":{"line":28,"column":28}}, + "range":[1034,1049], + "value":" 12.1 T id " + } + ], + "loc":{"source":null,"start":{"line":28,"column":6},"end":{"line":28,"column":12}}, + "range":[1027,1033], + "name":"getter", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":27},"end":{"line":29,"column":46}}, + "range":[1077,1096], + "value":" 12.3 T params " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":4},"end":{"line":29,"column":23}}, + "range":[1054,1073], + "value":" 12.2 L params " + } + ], + "loc":{"source":null,"start":{"line":29,"column":24},"end":{"line":31,"column":25}}, + "range":[1074,1166], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":4},"end":{"line":31,"column":22}}, + "range":[1145,1163], + "value":" 12.6 L block " + } + ], + "loc":{"source":null,"start":{"line":31,"column":23},"end":{"line":31,"column":25}}, + "range":[1164,1166], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":30,"column":4},"end":{"line":30,"column":26}}, + "range":[1101,1123], + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":27},"end":{"line":30,"column":43}}, + "range":[1124,1140], + "value":" 12.5 T any " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":6},"end":{"line":30,"column":22}}, + "range":[1103,1119], + "value":" 12.4 L any " + } + ], + "loc":{"source":null,"start":{"line":30,"column":23},"end":{"line":30,"column":26}}, + "range":[1120,1123] + } + }, + "typeParameters":null + }, + "kind":"get", + "method":false, + "shorthand":false, + "computed":false + }, + { + "type":"Property", + "loc":{"source":null,"start":{"line":33,"column":2},"end":{"line":35,"column":25}}, + "range":[1171,1270], + "key":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":33,"column":13},"end":{"line":33,"column":28}}, + "range":[1182,1197], + "value":" 13.1 T id " + } + ], + "loc":{"source":null,"start":{"line":33,"column":6},"end":{"line":33,"column":12}}, + "range":[1175,1181], + "name":"getter", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":27},"end":{"line":34,"column":46}}, + "range":[1225,1244], + "value":" 13.3 T params " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":4},"end":{"line":34,"column":23}}, + "range":[1202,1221], + "value":" 13.2 L params " + } + ], + "loc":{"source":null,"start":{"line":34,"column":24},"end":{"line":35,"column":25}}, + "range":[1222,1270], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":4},"end":{"line":35,"column":22}}, + "range":[1249,1267], + "value":" 13.4 L block " + } + ], + "loc":{"source":null,"start":{"line":35,"column":23},"end":{"line":35,"column":25}}, + "range":[1268,1270], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"get", + "method":false, + "shorthand":false, + "computed":false + } + ] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":38,"column":0},"end":{"line":38,"column":23}}, + "range":[1276,1299], + "expression":{ + "type":"ObjectExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":38,"column":3},"end":{"line":38,"column":19}}, + "range":[1279,1295], + "value":" 14.1 I obj " + } + ], + "loc":{"source":null,"start":{"line":38,"column":1},"end":{"line":38,"column":21}}, + "range":[1277,1297], + "properties":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":40,"column":0},"end":{"line":40,"column":26}}, + "range":[1301,1327], + "expression":{ + "type":"ObjectExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":40,"column":6},"end":{"line":40,"column":22}}, + "range":[1307,1323], + "value":" 15.1 I obj " + } + ], + "loc":{"source":null,"start":{"line":40,"column":1},"end":{"line":40,"column":24}}, + "range":[1302,1325], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":40,"column":3},"end":{"line":40,"column":4}}, + "range":[1304,1305], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":40,"column":3},"end":{"line":40,"column":4}}, + "range":[1304,1305], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":40,"column":3},"end":{"line":40,"column":4}}, + "range":[1304,1305], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":42,"column":0},"end":{"line":42,"column":30}}, + "range":[1329,1359], + "expression":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":42,"column":1},"end":{"line":42,"column":28}}, + "range":[1330,1357], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":42,"column":19},"end":{"line":42,"column":26}}, + "range":[1348,1355], + "key":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":42,"column":3},"end":{"line":42,"column":18}}, + "range":[1332,1347], + "value":" 16.1 L id " + } + ], + "loc":{"source":null,"start":{"line":42,"column":19},"end":{"line":42,"column":22}}, + "range":[1348,1351], + "name":"get", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":42,"column":22},"end":{"line":42,"column":26}}, + "range":[1351,1355], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":42,"column":24},"end":{"line":42,"column":26}}, + "range":[1353,1355], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"init", + "method":true, + "shorthand":false, + "computed":false + } + ] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":44,"column":0},"end":{"line":44,"column":30}}, + "range":[1361,1391], + "expression":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":44,"column":1},"end":{"line":44,"column":28}}, + "range":[1362,1389], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":44,"column":19},"end":{"line":44,"column":26}}, + "range":[1380,1387], + "key":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":44,"column":3},"end":{"line":44,"column":18}}, + "range":[1364,1379], + "value":" 17.1 L id " + } + ], + "loc":{"source":null,"start":{"line":44,"column":19},"end":{"line":44,"column":22}}, + "range":[1380,1383], + "name":"set", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":44,"column":22},"end":{"line":44,"column":26}}, + "range":[1383,1387], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":44,"column":24},"end":{"line":44,"column":26}}, + "range":[1385,1387], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"init", + "method":true, + "shorthand":false, + "computed":false + } + ] + }, + "directive":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":16}}, + "range":[1,16], + "value":" 1.1 L obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":39}}, + "range":[24,39], + "value":" 1.2 T obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":3},"end":{"line":3,"column":17}}, + "range":[46,60], + "value":" 2.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":20},"end":{"line":3,"column":34}}, + "range":[63,77], + "value":" 2.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":37},"end":{"line":3,"column":52}}, + "range":[80,95], + "value":" 2.3 L num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":55},"end":{"line":3,"column":70}}, + "range":[98,113], + "value":" 2.4 T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":3},"end":{"line":5,"column":23}}, + "range":[122,142], + "value":" 3.1 L computed " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":25},"end":{"line":5,"column":40}}, + "range":[144,159], + "value":" 3.2 L str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":45},"end":{"line":5,"column":60}}, + "range":[164,179], + "value":" 3.3 T str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":62},"end":{"line":5,"column":82}}, + "range":[181,201], + "value":" 3.4 T computed " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":3},"end":{"line":7,"column":21}}, + "range":[214,232], + "value":" 4.1 L spread " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":26},"end":{"line":7,"column":41}}, + "range":[237,252], + "value":" 4.2 L obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":45},"end":{"line":7,"column":60}}, + "range":[256,271], + "value":" 4.3 T obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":3},"end":{"line":9,"column":19}}, + "range":[280,296], + "value":" 5.1 L func " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":26},"end":{"line":9,"column":42}}, + "range":[303,319], + "value":" 5.2 L func " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":45},"end":{"line":9,"column":59}}, + "range":[322,336], + "value":" 5.3 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":67},"end":{"line":9,"column":86}}, + "range":[344,363], + "value":" 5.4 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":91},"end":{"line":9,"column":109}}, + "range":[368,386], + "value":" 5.5 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":113},"end":{"line":9,"column":130}}, + "range":[390,407], + "value":" 5.6 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":134},"end":{"line":9,"column":151}}, + "range":[411,428], + "value":" 5.7 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":3},"end":{"line":11,"column":21}}, + "range":[437,455], + "value":" 6.1 L getter " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":26},"end":{"line":11,"column":40}}, + "range":[460,474], + "value":" 6.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":3},"end":{"line":13,"column":21}}, + "range":[494,512], + "value":" 7.1 L setter " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":26},"end":{"line":13,"column":40}}, + "range":[517,531], + "value":" 7.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":9},"end":{"line":16,"column":28}}, + "range":[561,580], + "value":" 8.1 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":33},"end":{"line":16,"column":51}}, + "range":[585,603], + "value":" 8.2 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":55},"end":{"line":16,"column":73}}, + "range":[607,625], + "value":" 8.3 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":76},"end":{"line":16,"column":91}}, + "range":[628,643], + "value":" 8.4 L any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":96},"end":{"line":16,"column":113}}, + "range":[648,665], + "value":" 8.5 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":9},"end":{"line":18,"column":28}}, + "range":[680,699], + "value":" 9.1 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":33},"end":{"line":18,"column":52}}, + "range":[704,723], + "value":" 9.2 T tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":4},"end":{"line":19,"column":22}}, + "range":[728,746], + "value":" 9.3 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":26},"end":{"line":19,"column":44}}, + "range":[750,768], + "value":" 9.4 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":6},"end":{"line":20,"column":21}}, + "range":[775,790], + "value":" 9.5 L any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":26},"end":{"line":20,"column":41}}, + "range":[795,810], + "value":" 9.6 T any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":4},"end":{"line":21,"column":21}}, + "range":[815,832], + "value":" 9.7 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":9},"end":{"line":23,"column":28}}, + "range":[847,866], + "value":" 10.1 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":32},"end":{"line":23,"column":51}}, + "range":[870,889], + "value":" 10.2 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":4},"end":{"line":24,"column":22}}, + "range":[894,912], + "value":" 10.3 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":13},"end":{"line":26,"column":32}}, + "range":[931,950], + "value":" 11.1 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":36},"end":{"line":26,"column":55}}, + "range":[954,973], + "value":" 11.2 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":58},"end":{"line":26,"column":74}}, + "range":[976,992], + "value":" 11.3 L any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":79},"end":{"line":26,"column":97}}, + "range":[997,1015], + "value":" 11.4 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":28,"column":13},"end":{"line":28,"column":28}}, + "range":[1034,1049], + "value":" 12.1 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":4},"end":{"line":29,"column":23}}, + "range":[1054,1073], + "value":" 12.2 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":27},"end":{"line":29,"column":46}}, + "range":[1077,1096], + "value":" 12.3 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":6},"end":{"line":30,"column":22}}, + "range":[1103,1119], + "value":" 12.4 L any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":27},"end":{"line":30,"column":43}}, + "range":[1124,1140], + "value":" 12.5 T any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":4},"end":{"line":31,"column":22}}, + "range":[1145,1163], + "value":" 12.6 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":33,"column":13},"end":{"line":33,"column":28}}, + "range":[1182,1197], + "value":" 13.1 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":4},"end":{"line":34,"column":23}}, + "range":[1202,1221], + "value":" 13.2 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":27},"end":{"line":34,"column":46}}, + "range":[1225,1244], + "value":" 13.3 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":4},"end":{"line":35,"column":22}}, + "range":[1249,1267], + "value":" 13.4 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":38,"column":3},"end":{"line":38,"column":19}}, + "range":[1279,1295], + "value":" 14.1 I obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":40,"column":6},"end":{"line":40,"column":22}}, + "range":[1307,1323], + "value":" 15.1 I obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":42,"column":3},"end":{"line":42,"column":18}}, + "range":[1332,1347], + "value":" 16.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":44,"column":3},"end":{"line":44,"column":18}}, + "range":[1364,1379], + "value":" 17.1 L id " + } + ] +} diff --git a/lib/test/flow/comment_interning/object_pattern.js b/lib/test/flow/comment_interning/object_pattern.js new file mode 100644 index 0000000..5c1134d --- /dev/null +++ b/lib/test/flow/comment_interning/object_pattern.js @@ -0,0 +1,5 @@ +const {/* 1.1 L rest */ ... /* 1.2 L id */ rest /* 1.3 T id */} = {}; + +const /* 2.1 L obj */ { /* 2.2 I obj */ } /* 2.3 T obj */ = {}; + +const { a, /* 3.1 I obj */ } = {}; diff --git a/lib/test/flow/comment_interning/object_pattern.options.json b/lib/test/flow/comment_interning/object_pattern.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/object_pattern.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/object_pattern.tree.json b/lib/test/flow/comment_interning/object_pattern.tree.json new file mode 100644 index 0000000..040f055 --- /dev/null +++ b/lib/test/flow/comment_interning/object_pattern.tree.json @@ -0,0 +1,223 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":5,"column":34}}, + "range":[0,170], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":69}}, + "range":[0,69], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":68}}, + "range":[6,68], + "id":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":63}}, + "range":[6,63], + "properties":[ + { + "type":"RestElement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":23}}, + "range":[7,23], + "value":" 1.1 L rest " + } + ], + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":47}}, + "range":[24,47], + "argument":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":48},"end":{"line":1,"column":62}}, + "range":[48,62], + "value":" 1.3 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":42}}, + "range":[28,42], + "value":" 1.2 L id " + } + ], + "loc":{"source":null,"start":{"line":1,"column":43},"end":{"line":1,"column":47}}, + "range":[43,47], + "name":"rest", + "typeAnnotation":null, + "optional":false + } + } + ], + "typeAnnotation":null + }, + "init":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":1,"column":66},"end":{"line":1,"column":68}}, + "range":[66,68], + "properties":[] + } + } + ], + "kind":"const" + }, + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":63}}, + "range":[71,134], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":3,"column":22},"end":{"line":3,"column":62}}, + "range":[93,133], + "id":{ + "type":"ObjectPattern", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":24},"end":{"line":3,"column":39}}, + "range":[95,110], + "value":" 2.2 I obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":42},"end":{"line":3,"column":57}}, + "range":[113,128], + "value":" 2.3 T obj " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":6},"end":{"line":3,"column":21}}, + "range":[77,92], + "value":" 2.1 L obj " + } + ], + "loc":{"source":null,"start":{"line":3,"column":22},"end":{"line":3,"column":41}}, + "range":[93,112], + "properties":[], + "typeAnnotation":null + }, + "init":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":3,"column":60},"end":{"line":3,"column":62}}, + "range":[131,133], + "properties":[] + } + } + ], + "kind":"const" + }, + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":34}}, + "range":[136,170], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":5,"column":6},"end":{"line":5,"column":33}}, + "range":[142,169], + "id":{ + "type":"ObjectPattern", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":11},"end":{"line":5,"column":26}}, + "range":[147,162], + "value":" 3.1 I obj " + } + ], + "loc":{"source":null,"start":{"line":5,"column":6},"end":{"line":5,"column":28}}, + "range":[142,164], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":5,"column":8},"end":{"line":5,"column":9}}, + "range":[144,145], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":8},"end":{"line":5,"column":9}}, + "range":[144,145], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":8},"end":{"line":5,"column":9}}, + "range":[144,145], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ], + "typeAnnotation":null + }, + "init":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":5,"column":31},"end":{"line":5,"column":33}}, + "range":[167,169], + "properties":[] + } + } + ], + "kind":"const" + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":23}}, + "range":[7,23], + "value":" 1.1 L rest " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":42}}, + "range":[28,42], + "value":" 1.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":48},"end":{"line":1,"column":62}}, + "range":[48,62], + "value":" 1.3 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":6},"end":{"line":3,"column":21}}, + "range":[77,92], + "value":" 2.1 L obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":24},"end":{"line":3,"column":39}}, + "range":[95,110], + "value":" 2.2 I obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":42},"end":{"line":3,"column":57}}, + "range":[113,128], + "value":" 2.3 T obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":11},"end":{"line":5,"column":26}}, + "range":[147,162], + "value":" 3.1 I obj " + } + ] +} diff --git a/lib/test/flow/comment_interning/object_type.js b/lib/test/flow/comment_interning/object_type.js new file mode 100644 index 0000000..0cab7e7 --- /dev/null +++ b/lib/test/flow/comment_interning/object_type.js @@ -0,0 +1,65 @@ +type Test1 = /* 1.1 L obj */ {} /* 1.2 T obj */; + +type Test2 = {/* 2.1 L variance */ + /* 2.2 L id */ x /* 2.3 T id */: 1}; + +type Test3 = {/* 3.1 L indexer */ [ /* 3.2 L type */ string /* 3.3 T type */]: /* 3.4 L type */ string /* 3.5 T type */}; + +type Test4 = {/* 4.1 L variance */ + /* 4.2 L indexer */ [string] /* 4.3 T indexer */ : string }; + +type Test5 = {/* 5.1 L spread */ ... /* 5.2 L obj */ {} /* 5.3 T obj */}; + +type Test6 = {/* 6.1 L islot */ [[ /* 6.2 L id */ foo /* 6.3 T id */]] /* 6.4 T islot */ : /* 6.5 L type */ string /* 6.6 T type */}; + +type Test7 = {/* 7.1 L params */ (/* 7.2 L generic */ X /* 7.3 T generic */) /* 7.4 T params */ : /* 7.5 L generic */ Y /* 7.6 T generic */ }; + +type Test8 = {/* 8.1 L tparams */ /* 8.2 L params */ () /* 8.3 T params */: void}; + +type Test9 = {/* 9.1 L id */ method /* 9.2 L tparams */ /* 9.3 L params */ () /* 9.4 T params */: void}; + +type Test10 = {/* 10.1 L islot */ [[key]] /* 10.2 L tparams */ /* 10.3 L params */ () /* 10.4 T params */: void} + +declare class PrefixTests { + /* 11.1 L prop */ static /* 11.2 L id */ prop: any, + + /* 12.1 L prop */ proto /* 12.2 L id */ prop: any, + + /* 13.1 L id */ static: any; + + /* 14.1 L id */ proto: any; + + /* 15.1 L prop */ static /* 15.2 L prop */ get /* 15.3 L id */ getter /* 15.4 L params */ (): void, + + /* 16.1 L prop */ static /* 16.2 L prop */ set /* 16.3 L id */ setter /* 16.4 L params */ (any): void, + + /* 17.1 L prop */ static /* 17.2 L id */ method(): void, + + /* 18.1 L call prop */ static /* 18.2 L func */ (): void, + + /* 19.1 L indexer */ static /* 19.2 L indexer */ [string]: string, + + /* 20.1 L islot */ static /* 20.2 L islot */ [[prop]]: string, + + get getter /* 21.1 T id */ + /* 21.2 L params */ (): void +} + +type Test = { + method /* 22.1 T id */ + /* 22.2 L tparams */ /* 22.3 T tparams */ + /* 22.4 L params */ (): void, + + method /* 23.1 T id */ + /* 23.2 L params */ (): void, + + /* 24.1 T tparams */ + /* 24.2 L params */ (): void, + + [[key]] /* 25.1 T tparams */ + /* 25.2 L params */ (): void, +}; + +type Test = { /* 26.1 I obj */ }; + +type Test = { a: any, /* 27.1 I obj */ }; + +type Test = { a: any, /* 28.1 I obj */ ... /* 28.2 I obj */ }; diff --git a/lib/test/flow/comment_interning/object_type.options.json b/lib/test/flow/comment_interning/object_type.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/object_type.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/object_type.tree.json b/lib/test/flow/comment_interning/object_type.tree.json new file mode 100644 index 0000000..84e20e0 --- /dev/null +++ b/lib/test/flow/comment_interning/object_type.tree.json @@ -0,0 +1,2256 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":65,"column":62}}, + "range":[0,2206], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "range":[0,48], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, + "range":[5,10], + "name":"Test1", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":47}}, + "range":[32,47], + "value":" 1.2 T obj " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":28}}, + "range":[13,28], + "value":" 1.1 L obj " + } + ], + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, + "range":[29,31], + "inexact":false, + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":73}}, + "range":[50,123], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":5},"end":{"line":3,"column":10}}, + "range":[55,60], + "name":"Test2", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":13},"end":{"line":3,"column":72}}, + "range":[63,122], + "inexact":false, + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":3,"column":35},"end":{"line":3,"column":71}}, + "range":[85,121], + "key":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":54},"end":{"line":3,"column":68}}, + "range":[104,118], + "value":" 2.3 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":37},"end":{"line":3,"column":51}}, + "range":[87,101], + "value":" 2.2 L id " + } + ], + "loc":{"source":null,"start":{"line":3,"column":52},"end":{"line":3,"column":53}}, + "range":[102,103], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":70},"end":{"line":3,"column":71}}, + "range":[120,121], + "value":1, + "raw":"1" + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":{ + "type":"Variance", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":14},"end":{"line":3,"column":34}}, + "range":[64,84], + "value":" 2.1 L variance " + } + ], + "loc":{"source":null,"start":{"line":3,"column":35},"end":{"line":3,"column":36}}, + "range":[85,86], + "kind":"plus" + }, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":121}}, + "range":[125,246], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":5},"end":{"line":5,"column":10}}, + "range":[130,135], + "name":"Test3", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":13},"end":{"line":5,"column":120}}, + "range":[138,245], + "inexact":false, + "exact":false, + "properties":[], + "indexers":[ + { + "type":"ObjectTypeIndexer", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":14},"end":{"line":5,"column":33}}, + "range":[139,158], + "value":" 3.1 L indexer " + } + ], + "loc":{"source":null,"start":{"line":5,"column":34},"end":{"line":5,"column":102}}, + "range":[159,227], + "id":null, + "key":{ + "type":"StringTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":60},"end":{"line":5,"column":76}}, + "range":[185,201], + "value":" 3.3 T type " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":36},"end":{"line":5,"column":52}}, + "range":[161,177], + "value":" 3.2 L type " + } + ], + "loc":{"source":null,"start":{"line":5,"column":53},"end":{"line":5,"column":59}}, + "range":[178,184] + }, + "value":{ + "type":"StringTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":103},"end":{"line":5,"column":119}}, + "range":[228,244], + "value":" 3.5 T type " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":79},"end":{"line":5,"column":95}}, + "range":[204,220], + "value":" 3.4 L type " + } + ], + "loc":{"source":null,"start":{"line":5,"column":96},"end":{"line":5,"column":102}}, + "range":[221,227] + }, + "static":false, + "variance":null + } + ], + "callProperties":[], + "internalSlots":[] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":97}}, + "range":[248,345], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":5},"end":{"line":7,"column":10}}, + "range":[253,258], + "name":"Test4", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":13},"end":{"line":7,"column":96}}, + "range":[261,344], + "inexact":false, + "exact":false, + "properties":[], + "indexers":[ + { + "type":"ObjectTypeIndexer", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":66},"end":{"line":7,"column":85}}, + "range":[314,333], + "value":" 4.3 T indexer " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":37},"end":{"line":7,"column":56}}, + "range":[285,304], + "value":" 4.2 L indexer " + } + ], + "loc":{"source":null,"start":{"line":7,"column":35},"end":{"line":7,"column":94}}, + "range":[283,342], + "id":null, + "key":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":58},"end":{"line":7,"column":64}}, + "range":[306,312] + }, + "value":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":88},"end":{"line":7,"column":94}}, + "range":[336,342] + }, + "static":false, + "variance":{ + "type":"Variance", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":14},"end":{"line":7,"column":34}}, + "range":[262,282], + "value":" 4.1 L variance " + } + ], + "loc":{"source":null,"start":{"line":7,"column":35},"end":{"line":7,"column":36}}, + "range":[283,284], + "kind":"plus" + } + } + ], + "callProperties":[], + "internalSlots":[] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":9,"column":73}}, + "range":[347,420], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":5},"end":{"line":9,"column":10}}, + "range":[352,357], + "name":"Test5", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":9,"column":13},"end":{"line":9,"column":72}}, + "range":[360,419], + "inexact":false, + "exact":false, + "properties":[ + { + "type":"ObjectTypeSpreadProperty", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":14},"end":{"line":9,"column":32}}, + "range":[361,379], + "value":" 5.1 L spread " + } + ], + "loc":{"source":null,"start":{"line":9,"column":33},"end":{"line":9,"column":55}}, + "range":[380,402], + "argument":{ + "type":"ObjectTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":56},"end":{"line":9,"column":71}}, + "range":[403,418], + "value":" 5.3 T obj " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":37},"end":{"line":9,"column":52}}, + "range":[384,399], + "value":" 5.2 L obj " + } + ], + "loc":{"source":null,"start":{"line":9,"column":53},"end":{"line":9,"column":55}}, + "range":[400,402], + "inexact":false, + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":11,"column":133}}, + "range":[422,555], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":11,"column":5},"end":{"line":11,"column":10}}, + "range":[427,432], + "name":"Test6", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":11,"column":13},"end":{"line":11,"column":132}}, + "range":[435,554], + "inexact":false, + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[ + { + "type":"ObjectTypeInternalSlot", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":71},"end":{"line":11,"column":88}}, + "range":[493,510], + "value":" 6.4 T islot " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":14},"end":{"line":11,"column":31}}, + "range":[436,453], + "value":" 6.1 L islot " + } + ], + "loc":{"source":null,"start":{"line":11,"column":32},"end":{"line":11,"column":114}}, + "range":[454,536], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":54},"end":{"line":11,"column":68}}, + "range":[476,490], + "value":" 6.3 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":35},"end":{"line":11,"column":49}}, + "range":[457,471], + "value":" 6.2 L id " + } + ], + "loc":{"source":null,"start":{"line":11,"column":50},"end":{"line":11,"column":53}}, + "range":[472,475], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "optional":false, + "static":false, + "method":false, + "value":{ + "type":"StringTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":115},"end":{"line":11,"column":131}}, + "range":[537,553], + "value":" 6.6 T type " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":91},"end":{"line":11,"column":107}}, + "range":[513,529], + "value":" 6.5 L type " + } + ], + "loc":{"source":null,"start":{"line":11,"column":108},"end":{"line":11,"column":114}}, + "range":[530,536] + } + } + ] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":13,"column":0},"end":{"line":13,"column":142}}, + "range":[557,699], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":13,"column":5},"end":{"line":13,"column":10}}, + "range":[562,567], + "name":"Test7", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":13,"column":13},"end":{"line":13,"column":141}}, + "range":[570,698], + "inexact":false, + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[ + { + "type":"ObjectTypeCallProperty", + "loc":{"source":null,"start":{"line":13,"column":33},"end":{"line":13,"column":119}}, + "range":[590,676], + "value":{ + "type":"FunctionTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":77},"end":{"line":13,"column":95}}, + "range":[634,652], + "value":" 7.4 T params " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":14},"end":{"line":13,"column":32}}, + "range":[571,589], + "value":" 7.1 L params " + } + ], + "loc":{"source":null,"start":{"line":13,"column":33},"end":{"line":13,"column":119}}, + "range":[590,676], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":13,"column":54},"end":{"line":13,"column":55}}, + "range":[611,612], + "name":null, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":13,"column":54},"end":{"line":13,"column":55}}, + "range":[611,612], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":56},"end":{"line":13,"column":75}}, + "range":[613,632], + "value":" 7.3 T generic " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":34},"end":{"line":13,"column":53}}, + "range":[591,610], + "value":" 7.2 L generic " + } + ], + "loc":{"source":null,"start":{"line":13,"column":54},"end":{"line":13,"column":55}}, + "range":[611,612], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "optional":false + } + ], + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":13,"column":118},"end":{"line":13,"column":119}}, + "range":[675,676], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":120},"end":{"line":13,"column":139}}, + "range":[677,696], + "value":" 7.6 T generic " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":98},"end":{"line":13,"column":117}}, + "range":[655,674], + "value":" 7.5 L generic " + } + ], + "loc":{"source":null,"start":{"line":13,"column":118},"end":{"line":13,"column":119}}, + "range":[675,676], + "name":"Y", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "rest":null, + "typeParameters":null + }, + "static":false + } + ], + "internalSlots":[] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":15,"column":0},"end":{"line":15,"column":86}}, + "range":[701,787], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":15,"column":5},"end":{"line":15,"column":10}}, + "range":[706,711], + "name":"Test8", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":15,"column":13},"end":{"line":15,"column":85}}, + "range":[714,786], + "inexact":false, + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[ + { + "type":"ObjectTypeCallProperty", + "loc":{"source":null,"start":{"line":15,"column":34},"end":{"line":15,"column":84}}, + "range":[735,785], + "value":{ + "type":"FunctionTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":60},"end":{"line":15,"column":78}}, + "range":[761,779], + "value":" 8.3 T params " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":38},"end":{"line":15,"column":56}}, + "range":[739,757], + "value":" 8.2 L params " + } + ], + "loc":{"source":null,"start":{"line":15,"column":34},"end":{"line":15,"column":84}}, + "range":[735,785], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":15,"column":80},"end":{"line":15,"column":84}}, + "range":[781,785] + }, + "rest":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":14},"end":{"line":15,"column":33}}, + "range":[715,734], + "value":" 8.1 L tparams " + } + ], + "loc":{"source":null,"start":{"line":15,"column":34},"end":{"line":15,"column":37}}, + "range":[735,738], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":15,"column":35},"end":{"line":15,"column":36}}, + "range":[736,737], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "static":false + } + ], + "internalSlots":[] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":17,"column":0},"end":{"line":17,"column":108}}, + "range":[789,897], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":17,"column":5},"end":{"line":17,"column":10}}, + "range":[794,799], + "name":"Test9", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":17,"column":13},"end":{"line":17,"column":107}}, + "range":[802,896], + "inexact":false, + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":17,"column":29},"end":{"line":17,"column":106}}, + "range":[818,895], + "key":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":14},"end":{"line":17,"column":28}}, + "range":[803,817], + "value":" 9.1 L id " + } + ], + "loc":{"source":null,"start":{"line":17,"column":29},"end":{"line":17,"column":35}}, + "range":[818,824], + "name":"method", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":82},"end":{"line":17,"column":100}}, + "range":[871,889], + "value":" 9.4 T params " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":60},"end":{"line":17,"column":78}}, + "range":[849,867], + "value":" 9.3 L params " + } + ], + "loc":{"source":null,"start":{"line":17,"column":29},"end":{"line":17,"column":106}}, + "range":[818,895], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":17,"column":102},"end":{"line":17,"column":106}}, + "range":[891,895] + }, + "rest":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":36},"end":{"line":17,"column":55}}, + "range":[825,844], + "value":" 9.2 L tparams " + } + ], + "loc":{"source":null,"start":{"line":17,"column":56},"end":{"line":17,"column":59}}, + "range":[845,848], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":17,"column":57},"end":{"line":17,"column":58}}, + "range":[846,847], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":19,"column":0},"end":{"line":19,"column":116}}, + "range":[899,1015], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":19,"column":5},"end":{"line":19,"column":11}}, + "range":[904,910], + "name":"Test10", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":19,"column":14},"end":{"line":19,"column":116}}, + "range":[913,1015], + "inexact":false, + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[ + { + "type":"ObjectTypeInternalSlot", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":15},"end":{"line":19,"column":33}}, + "range":[914,932], + "value":" 10.1 L islot " + } + ], + "loc":{"source":null,"start":{"line":19,"column":34},"end":{"line":19,"column":115}}, + "range":[933,1014], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":19,"column":36},"end":{"line":19,"column":39}}, + "range":[935,938], + "name":"key", + "typeAnnotation":null, + "optional":false + }, + "optional":false, + "static":false, + "method":true, + "value":{ + "type":"FunctionTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":90},"end":{"line":19,"column":109}}, + "range":[989,1008], + "value":" 10.4 T params " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":67},"end":{"line":19,"column":86}}, + "range":[966,985], + "value":" 10.3 L params " + } + ], + "loc":{"source":null,"start":{"line":19,"column":34},"end":{"line":19,"column":115}}, + "range":[933,1014], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":19,"column":111},"end":{"line":19,"column":115}}, + "range":[1010,1014] + }, + "rest":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":42},"end":{"line":19,"column":62}}, + "range":[941,961], + "value":" 10.2 L tparams " + } + ], + "loc":{"source":null,"start":{"line":19,"column":63},"end":{"line":19,"column":66}}, + "range":[962,965], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":19,"column":64},"end":{"line":19,"column":65}}, + "range":[963,964], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + } + } + ] + } + }, + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":21,"column":0},"end":{"line":44,"column":1}}, + "range":[1017,1746], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":21,"column":14},"end":{"line":21,"column":25}}, + "range":[1031,1042], + "name":"PrefixTests", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":21,"column":26},"end":{"line":44,"column":1}}, + "range":[1043,1746], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":2},"end":{"line":22,"column":19}}, + "range":[1047,1064], + "value":" 11.1 L prop " + } + ], + "loc":{"source":null,"start":{"line":22,"column":20},"end":{"line":22,"column":52}}, + "range":[1065,1097], + "key":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":27},"end":{"line":22,"column":42}}, + "range":[1072,1087], + "value":" 11.2 L id " + } + ], + "loc":{"source":null,"start":{"line":22,"column":43},"end":{"line":22,"column":47}}, + "range":[1088,1092], + "name":"prop", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":22,"column":49},"end":{"line":22,"column":52}}, + "range":[1094,1097] + }, + "method":false, + "optional":false, + "static":true, + "proto":false, + "variance":null, + "kind":"init" + }, + { + "type":"ObjectTypeProperty", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":2},"end":{"line":24,"column":19}}, + "range":[1102,1119], + "value":" 12.1 L prop " + } + ], + "loc":{"source":null,"start":{"line":24,"column":20},"end":{"line":24,"column":51}}, + "range":[1120,1151], + "key":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":26},"end":{"line":24,"column":41}}, + "range":[1126,1141], + "value":" 12.2 L id " + } + ], + "loc":{"source":null,"start":{"line":24,"column":42},"end":{"line":24,"column":46}}, + "range":[1142,1146], + "name":"prop", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":24,"column":48},"end":{"line":24,"column":51}}, + "range":[1148,1151] + }, + "method":false, + "optional":false, + "static":false, + "proto":true, + "variance":null, + "kind":"init" + }, + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":26,"column":18},"end":{"line":26,"column":29}}, + "range":[1172,1183], + "key":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":2},"end":{"line":26,"column":17}}, + "range":[1156,1171], + "value":" 13.1 L id " + } + ], + "loc":{"source":null,"start":{"line":26,"column":18},"end":{"line":26,"column":24}}, + "range":[1172,1178], + "name":"static", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":26,"column":26},"end":{"line":26,"column":29}}, + "range":[1180,1183] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + }, + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":28,"column":18},"end":{"line":28,"column":28}}, + "range":[1204,1214], + "key":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":28,"column":2},"end":{"line":28,"column":17}}, + "range":[1188,1203], + "value":" 14.1 L id " + } + ], + "loc":{"source":null,"start":{"line":28,"column":18},"end":{"line":28,"column":23}}, + "range":[1204,1209], + "name":"proto", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":28,"column":25},"end":{"line":28,"column":28}}, + "range":[1211,1214] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + }, + { + "type":"ObjectTypeProperty", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":2},"end":{"line":30,"column":19}}, + "range":[1219,1236], + "value":" 15.1 L prop " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":27},"end":{"line":30,"column":44}}, + "range":[1244,1261], + "value":" 15.2 L prop " + } + ], + "loc":{"source":null,"start":{"line":30,"column":20},"end":{"line":30,"column":100}}, + "range":[1237,1317], + "key":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":49},"end":{"line":30,"column":64}}, + "range":[1266,1281], + "value":" 15.3 L id " + } + ], + "loc":{"source":null,"start":{"line":30,"column":65},"end":{"line":30,"column":71}}, + "range":[1282,1288], + "name":"getter", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":72},"end":{"line":30,"column":91}}, + "range":[1289,1308], + "value":" 15.4 L params " + } + ], + "loc":{"source":null,"start":{"line":30,"column":20},"end":{"line":30,"column":100}}, + "range":[1237,1317], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":30,"column":96},"end":{"line":30,"column":100}}, + "range":[1313,1317] + }, + "rest":null, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":true, + "proto":false, + "variance":null, + "kind":"get" + }, + { + "type":"ObjectTypeProperty", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":2},"end":{"line":32,"column":19}}, + "range":[1322,1339], + "value":" 16.1 L prop " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":27},"end":{"line":32,"column":44}}, + "range":[1347,1364], + "value":" 16.2 L prop " + } + ], + "loc":{"source":null,"start":{"line":32,"column":20},"end":{"line":32,"column":103}}, + "range":[1340,1423], + "key":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":49},"end":{"line":32,"column":64}}, + "range":[1369,1384], + "value":" 16.3 L id " + } + ], + "loc":{"source":null,"start":{"line":32,"column":65},"end":{"line":32,"column":71}}, + "range":[1385,1391], + "name":"setter", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":72},"end":{"line":32,"column":91}}, + "range":[1392,1411], + "value":" 16.4 L params " + } + ], + "loc":{"source":null,"start":{"line":32,"column":20},"end":{"line":32,"column":103}}, + "range":[1340,1423], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":32,"column":93},"end":{"line":32,"column":96}}, + "range":[1413,1416], + "name":null, + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":32,"column":93},"end":{"line":32,"column":96}}, + "range":[1413,1416] + }, + "optional":false + } + ], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":32,"column":99},"end":{"line":32,"column":103}}, + "range":[1419,1423] + }, + "rest":null, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":true, + "proto":false, + "variance":null, + "kind":"set" + }, + { + "type":"ObjectTypeProperty", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":2},"end":{"line":34,"column":19}}, + "range":[1428,1445], + "value":" 17.1 L prop " + } + ], + "loc":{"source":null,"start":{"line":34,"column":20},"end":{"line":34,"column":57}}, + "range":[1446,1483], + "key":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":27},"end":{"line":34,"column":42}}, + "range":[1453,1468], + "value":" 17.2 L id " + } + ], + "loc":{"source":null,"start":{"line":34,"column":43},"end":{"line":34,"column":49}}, + "range":[1469,1475], + "name":"method", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":34,"column":20},"end":{"line":34,"column":57}}, + "range":[1446,1483], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":34,"column":53},"end":{"line":34,"column":57}}, + "range":[1479,1483] + }, + "rest":null, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":true, + "proto":false, + "variance":null, + "kind":"init" + }, + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":42,"column":2},"end":{"line":43,"column":32}}, + "range":[1685,1744], + "key":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":42,"column":13},"end":{"line":42,"column":28}}, + "range":[1696,1711], + "value":" 21.1 T id " + } + ], + "loc":{"source":null,"start":{"line":42,"column":6},"end":{"line":42,"column":12}}, + "range":[1689,1695], + "name":"getter", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":43,"column":4},"end":{"line":43,"column":23}}, + "range":[1716,1735], + "value":" 21.2 L params " + } + ], + "loc":{"source":null,"start":{"line":42,"column":2},"end":{"line":43,"column":32}}, + "range":[1685,1744], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":43,"column":28},"end":{"line":43,"column":32}}, + "range":[1740,1744] + }, + "rest":null, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"get" + } + ], + "indexers":[ + { + "type":"ObjectTypeIndexer", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":38,"column":2},"end":{"line":38,"column":22}}, + "range":[1549,1569], + "value":" 19.1 L indexer " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":38,"column":30},"end":{"line":38,"column":50}}, + "range":[1577,1597], + "value":" 19.2 L indexer " + } + ], + "loc":{"source":null,"start":{"line":38,"column":23},"end":{"line":38,"column":67}}, + "range":[1570,1614], + "id":null, + "key":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":38,"column":52},"end":{"line":38,"column":58}}, + "range":[1599,1605] + }, + "value":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":38,"column":61},"end":{"line":38,"column":67}}, + "range":[1608,1614] + }, + "static":true, + "variance":null + } + ], + "callProperties":[ + { + "type":"ObjectTypeCallProperty", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":2},"end":{"line":36,"column":24}}, + "range":[1488,1510], + "value":" 18.1 L call prop " + } + ], + "loc":{"source":null,"start":{"line":36,"column":25},"end":{"line":36,"column":58}}, + "range":[1511,1544], + "value":{ + "type":"FunctionTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":32},"end":{"line":36,"column":49}}, + "range":[1518,1535], + "value":" 18.2 L func " + } + ], + "loc":{"source":null,"start":{"line":36,"column":50},"end":{"line":36,"column":58}}, + "range":[1536,1544], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":36,"column":54},"end":{"line":36,"column":58}}, + "range":[1540,1544] + }, + "rest":null, + "typeParameters":null + }, + "static":true + } + ], + "internalSlots":[ + { + "type":"ObjectTypeInternalSlot", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":40,"column":2},"end":{"line":40,"column":20}}, + "range":[1619,1637], + "value":" 20.1 L islot " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":40,"column":28},"end":{"line":40,"column":46}}, + "range":[1645,1663], + "value":" 20.2 L islot " + } + ], + "loc":{"source":null,"start":{"line":40,"column":21},"end":{"line":40,"column":63}}, + "range":[1638,1680], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":40,"column":49},"end":{"line":40,"column":53}}, + "range":[1666,1670], + "name":"prop", + "typeAnnotation":null, + "optional":false + }, + "optional":false, + "static":true, + "method":false, + "value":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":40,"column":57},"end":{"line":40,"column":63}}, + "range":[1674,1680] + } + } + ] + }, + "extends":[], + "implements":[], + "mixins":[] + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":46,"column":0},"end":{"line":59,"column":2}}, + "range":[1748,2064], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":46,"column":5},"end":{"line":46,"column":9}}, + "range":[1753,1757], + "name":"Test", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":46,"column":12},"end":{"line":59,"column":1}}, + "range":[1760,2063], + "inexact":false, + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":47,"column":2},"end":{"line":49,"column":32}}, + "range":[1764,1869], + "key":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":47,"column":9},"end":{"line":47,"column":24}}, + "range":[1771,1786], + "value":" 22.1 T id " + } + ], + "loc":{"source":null,"start":{"line":47,"column":2},"end":{"line":47,"column":8}}, + "range":[1764,1770], + "name":"method", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":49,"column":4},"end":{"line":49,"column":23}}, + "range":[1841,1860], + "value":" 22.4 L params " + } + ], + "loc":{"source":null,"start":{"line":47,"column":2},"end":{"line":49,"column":32}}, + "range":[1764,1869], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":49,"column":28},"end":{"line":49,"column":32}}, + "range":[1865,1869] + }, + "rest":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":48,"column":29},"end":{"line":48,"column":49}}, + "range":[1816,1836], + "value":" 22.3 T tparams " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":48,"column":4},"end":{"line":48,"column":24}}, + "range":[1791,1811], + "value":" 22.2 L tparams " + } + ], + "loc":{"source":null,"start":{"line":48,"column":25},"end":{"line":48,"column":28}}, + "range":[1812,1815], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":48,"column":26},"end":{"line":48,"column":27}}, + "range":[1813,1814], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + }, + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":51,"column":2},"end":{"line":52,"column":32}}, + "range":[1874,1929], + "key":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":51,"column":9},"end":{"line":51,"column":24}}, + "range":[1881,1896], + "value":" 23.1 T id " + } + ], + "loc":{"source":null,"start":{"line":51,"column":2},"end":{"line":51,"column":8}}, + "range":[1874,1880], + "name":"method", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":52,"column":4},"end":{"line":52,"column":23}}, + "range":[1901,1920], + "value":" 23.2 L params " + } + ], + "loc":{"source":null,"start":{"line":51,"column":2},"end":{"line":52,"column":32}}, + "range":[1874,1929], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":52,"column":28},"end":{"line":52,"column":32}}, + "range":[1925,1929] + }, + "rest":null, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[ + { + "type":"ObjectTypeCallProperty", + "loc":{"source":null,"start":{"line":54,"column":2},"end":{"line":55,"column":32}}, + "range":[1934,1991], + "value":{ + "type":"FunctionTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":55,"column":4},"end":{"line":55,"column":23}}, + "range":[1963,1982], + "value":" 24.2 L params " + } + ], + "loc":{"source":null,"start":{"line":54,"column":2},"end":{"line":55,"column":32}}, + "range":[1934,1991], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":55,"column":28},"end":{"line":55,"column":32}}, + "range":[1987,1991] + }, + "rest":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":54,"column":6},"end":{"line":54,"column":26}}, + "range":[1938,1958], + "value":" 24.1 T tparams " + } + ], + "loc":{"source":null,"start":{"line":54,"column":2},"end":{"line":54,"column":5}}, + "range":[1934,1937], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":54,"column":3},"end":{"line":54,"column":4}}, + "range":[1935,1936], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "static":false + } + ], + "internalSlots":[ + { + "type":"ObjectTypeInternalSlot", + "loc":{"source":null,"start":{"line":57,"column":2},"end":{"line":58,"column":32}}, + "range":[1996,2060], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":57,"column":4},"end":{"line":57,"column":7}}, + "range":[1998,2001], + "name":"key", + "typeAnnotation":null, + "optional":false + }, + "optional":false, + "static":false, + "method":true, + "value":{ + "type":"FunctionTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":58,"column":4},"end":{"line":58,"column":23}}, + "range":[2032,2051], + "value":" 25.2 L params " + } + ], + "loc":{"source":null,"start":{"line":57,"column":2},"end":{"line":58,"column":32}}, + "range":[1996,2060], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":58,"column":28},"end":{"line":58,"column":32}}, + "range":[2056,2060] + }, + "rest":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":57,"column":13},"end":{"line":57,"column":33}}, + "range":[2007,2027], + "value":" 25.1 T tparams " + } + ], + "loc":{"source":null,"start":{"line":57,"column":9},"end":{"line":57,"column":12}}, + "range":[2003,2006], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":57,"column":10},"end":{"line":57,"column":11}}, + "range":[2004,2005], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + } + } + ] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":61,"column":0},"end":{"line":61,"column":33}}, + "range":[2066,2099], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":61,"column":5},"end":{"line":61,"column":9}}, + "range":[2071,2075], + "name":"Test", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":61,"column":14},"end":{"line":61,"column":30}}, + "range":[2080,2096], + "value":" 26.1 I obj " + } + ], + "loc":{"source":null,"start":{"line":61,"column":12},"end":{"line":61,"column":32}}, + "range":[2078,2098], + "inexact":false, + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":63,"column":0},"end":{"line":63,"column":41}}, + "range":[2101,2142], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":63,"column":5},"end":{"line":63,"column":9}}, + "range":[2106,2110], + "name":"Test", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":63,"column":22},"end":{"line":63,"column":38}}, + "range":[2123,2139], + "value":" 27.1 I obj " + } + ], + "loc":{"source":null,"start":{"line":63,"column":12},"end":{"line":63,"column":40}}, + "range":[2113,2141], + "inexact":false, + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":63,"column":14},"end":{"line":63,"column":20}}, + "range":[2115,2121], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":63,"column":14},"end":{"line":63,"column":15}}, + "range":[2115,2116], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":63,"column":17},"end":{"line":63,"column":20}}, + "range":[2118,2121] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":65,"column":0},"end":{"line":65,"column":62}}, + "range":[2144,2206], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":65,"column":5},"end":{"line":65,"column":9}}, + "range":[2149,2153], + "name":"Test", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":65,"column":22},"end":{"line":65,"column":38}}, + "range":[2166,2182], + "value":" 28.1 I obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":65,"column":43},"end":{"line":65,"column":59}}, + "range":[2187,2203], + "value":" 28.2 I obj " + } + ], + "loc":{"source":null,"start":{"line":65,"column":12},"end":{"line":65,"column":61}}, + "range":[2156,2205], + "inexact":true, + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":65,"column":14},"end":{"line":65,"column":20}}, + "range":[2158,2164], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":65,"column":14},"end":{"line":65,"column":15}}, + "range":[2158,2159], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":65,"column":17},"end":{"line":65,"column":20}}, + "range":[2161,2164] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":28}}, + "range":[13,28], + "value":" 1.1 L obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":47}}, + "range":[32,47], + "value":" 1.2 T obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":14},"end":{"line":3,"column":34}}, + "range":[64,84], + "value":" 2.1 L variance " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":37},"end":{"line":3,"column":51}}, + "range":[87,101], + "value":" 2.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":54},"end":{"line":3,"column":68}}, + "range":[104,118], + "value":" 2.3 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":14},"end":{"line":5,"column":33}}, + "range":[139,158], + "value":" 3.1 L indexer " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":36},"end":{"line":5,"column":52}}, + "range":[161,177], + "value":" 3.2 L type " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":60},"end":{"line":5,"column":76}}, + "range":[185,201], + "value":" 3.3 T type " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":79},"end":{"line":5,"column":95}}, + "range":[204,220], + "value":" 3.4 L type " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":103},"end":{"line":5,"column":119}}, + "range":[228,244], + "value":" 3.5 T type " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":14},"end":{"line":7,"column":34}}, + "range":[262,282], + "value":" 4.1 L variance " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":37},"end":{"line":7,"column":56}}, + "range":[285,304], + "value":" 4.2 L indexer " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":66},"end":{"line":7,"column":85}}, + "range":[314,333], + "value":" 4.3 T indexer " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":14},"end":{"line":9,"column":32}}, + "range":[361,379], + "value":" 5.1 L spread " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":37},"end":{"line":9,"column":52}}, + "range":[384,399], + "value":" 5.2 L obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":56},"end":{"line":9,"column":71}}, + "range":[403,418], + "value":" 5.3 T obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":14},"end":{"line":11,"column":31}}, + "range":[436,453], + "value":" 6.1 L islot " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":35},"end":{"line":11,"column":49}}, + "range":[457,471], + "value":" 6.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":54},"end":{"line":11,"column":68}}, + "range":[476,490], + "value":" 6.3 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":71},"end":{"line":11,"column":88}}, + "range":[493,510], + "value":" 6.4 T islot " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":91},"end":{"line":11,"column":107}}, + "range":[513,529], + "value":" 6.5 L type " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":115},"end":{"line":11,"column":131}}, + "range":[537,553], + "value":" 6.6 T type " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":14},"end":{"line":13,"column":32}}, + "range":[571,589], + "value":" 7.1 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":34},"end":{"line":13,"column":53}}, + "range":[591,610], + "value":" 7.2 L generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":56},"end":{"line":13,"column":75}}, + "range":[613,632], + "value":" 7.3 T generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":77},"end":{"line":13,"column":95}}, + "range":[634,652], + "value":" 7.4 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":98},"end":{"line":13,"column":117}}, + "range":[655,674], + "value":" 7.5 L generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":120},"end":{"line":13,"column":139}}, + "range":[677,696], + "value":" 7.6 T generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":14},"end":{"line":15,"column":33}}, + "range":[715,734], + "value":" 8.1 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":38},"end":{"line":15,"column":56}}, + "range":[739,757], + "value":" 8.2 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":60},"end":{"line":15,"column":78}}, + "range":[761,779], + "value":" 8.3 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":14},"end":{"line":17,"column":28}}, + "range":[803,817], + "value":" 9.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":36},"end":{"line":17,"column":55}}, + "range":[825,844], + "value":" 9.2 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":60},"end":{"line":17,"column":78}}, + "range":[849,867], + "value":" 9.3 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":82},"end":{"line":17,"column":100}}, + "range":[871,889], + "value":" 9.4 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":15},"end":{"line":19,"column":33}}, + "range":[914,932], + "value":" 10.1 L islot " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":42},"end":{"line":19,"column":62}}, + "range":[941,961], + "value":" 10.2 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":67},"end":{"line":19,"column":86}}, + "range":[966,985], + "value":" 10.3 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":90},"end":{"line":19,"column":109}}, + "range":[989,1008], + "value":" 10.4 T params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":2},"end":{"line":22,"column":19}}, + "range":[1047,1064], + "value":" 11.1 L prop " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":27},"end":{"line":22,"column":42}}, + "range":[1072,1087], + "value":" 11.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":2},"end":{"line":24,"column":19}}, + "range":[1102,1119], + "value":" 12.1 L prop " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":26},"end":{"line":24,"column":41}}, + "range":[1126,1141], + "value":" 12.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":2},"end":{"line":26,"column":17}}, + "range":[1156,1171], + "value":" 13.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":28,"column":2},"end":{"line":28,"column":17}}, + "range":[1188,1203], + "value":" 14.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":2},"end":{"line":30,"column":19}}, + "range":[1219,1236], + "value":" 15.1 L prop " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":27},"end":{"line":30,"column":44}}, + "range":[1244,1261], + "value":" 15.2 L prop " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":49},"end":{"line":30,"column":64}}, + "range":[1266,1281], + "value":" 15.3 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":72},"end":{"line":30,"column":91}}, + "range":[1289,1308], + "value":" 15.4 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":2},"end":{"line":32,"column":19}}, + "range":[1322,1339], + "value":" 16.1 L prop " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":27},"end":{"line":32,"column":44}}, + "range":[1347,1364], + "value":" 16.2 L prop " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":49},"end":{"line":32,"column":64}}, + "range":[1369,1384], + "value":" 16.3 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":72},"end":{"line":32,"column":91}}, + "range":[1392,1411], + "value":" 16.4 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":2},"end":{"line":34,"column":19}}, + "range":[1428,1445], + "value":" 17.1 L prop " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":27},"end":{"line":34,"column":42}}, + "range":[1453,1468], + "value":" 17.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":2},"end":{"line":36,"column":24}}, + "range":[1488,1510], + "value":" 18.1 L call prop " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":32},"end":{"line":36,"column":49}}, + "range":[1518,1535], + "value":" 18.2 L func " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":38,"column":2},"end":{"line":38,"column":22}}, + "range":[1549,1569], + "value":" 19.1 L indexer " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":38,"column":30},"end":{"line":38,"column":50}}, + "range":[1577,1597], + "value":" 19.2 L indexer " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":40,"column":2},"end":{"line":40,"column":20}}, + "range":[1619,1637], + "value":" 20.1 L islot " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":40,"column":28},"end":{"line":40,"column":46}}, + "range":[1645,1663], + "value":" 20.2 L islot " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":42,"column":13},"end":{"line":42,"column":28}}, + "range":[1696,1711], + "value":" 21.1 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":43,"column":4},"end":{"line":43,"column":23}}, + "range":[1716,1735], + "value":" 21.2 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":47,"column":9},"end":{"line":47,"column":24}}, + "range":[1771,1786], + "value":" 22.1 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":48,"column":4},"end":{"line":48,"column":24}}, + "range":[1791,1811], + "value":" 22.2 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":48,"column":29},"end":{"line":48,"column":49}}, + "range":[1816,1836], + "value":" 22.3 T tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":49,"column":4},"end":{"line":49,"column":23}}, + "range":[1841,1860], + "value":" 22.4 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":51,"column":9},"end":{"line":51,"column":24}}, + "range":[1881,1896], + "value":" 23.1 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":52,"column":4},"end":{"line":52,"column":23}}, + "range":[1901,1920], + "value":" 23.2 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":54,"column":6},"end":{"line":54,"column":26}}, + "range":[1938,1958], + "value":" 24.1 T tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":55,"column":4},"end":{"line":55,"column":23}}, + "range":[1963,1982], + "value":" 24.2 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":57,"column":13},"end":{"line":57,"column":33}}, + "range":[2007,2027], + "value":" 25.1 T tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":58,"column":4},"end":{"line":58,"column":23}}, + "range":[2032,2051], + "value":" 25.2 L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":61,"column":14},"end":{"line":61,"column":30}}, + "range":[2080,2096], + "value":" 26.1 I obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":63,"column":22},"end":{"line":63,"column":38}}, + "range":[2123,2139], + "value":" 27.1 I obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":65,"column":22},"end":{"line":65,"column":38}}, + "range":[2166,2182], + "value":" 28.1 I obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":65,"column":43},"end":{"line":65,"column":59}}, + "range":[2187,2203], + "value":" 28.2 I obj " + } + ] +} diff --git a/lib/test/flow/comment_interning/parenthesized_expression.js b/lib/test/flow/comment_interning/parenthesized_expression.js new file mode 100644 index 0000000..fac5c84 --- /dev/null +++ b/lib/test/flow/comment_interning/parenthesized_expression.js @@ -0,0 +1,61 @@ +var i = 0; + +function foo() {} + +/* Nested leading 1 */ ( /* Nested leading 2 */ i /* Nested trailing 1 */ ) /* Nested trailing 2 */; + +/* Leading array */ ([]) /* Trailing array */; + +/* Leading arrow function */ (() => {}) /* Trailing arrow function */; + +/* Leading assign */ (i = 1) /* Trailing assign */; + +/* Leading binary */ (1 + 2) /* Trailing binary */; + +/* Leading call */ (foo()) /* Trailing call */; + +/* Leading class */ (class C {}) /* Trailing class */; + +/* Leading conditional */ (true ? 1 : 2) /* Trailing conditional */; + +/* Leading function */ (function(){}) /* Trailing function */; + +/* Leading identifier */ (i) /* Trailing identifier */; + +/* Leading import */ (import('test')) /* Trailing import */; + +/* Leading JSX element */ (
test
) /* Trailing JSX element */; + +/* Leading JSX fragment */ (<>test) /* Trailing JSX fragment */; + +/* Leading literal */ (1) /* Trailing literal */; + +/* Leading logical */ (false || true) /* Trailing logical */; + +/* Leading member */ (i.isNaN) /* Trailing member */; + +/* Leading new */ (new C()) /* Trailing new */; + +/* Leading object */ ({}) /* Trailing object */; + +/* Leading optional call */ (i?.isNaN()) /* Trailing optional call */; + +/* Leading optional member */ (i?.isNaN) /* Trailing optional member */; + +/* Leading template literal */ (`template`) /* Trailing template literal */; + +/* Leading tagged template */ (tag`template`) /* Trailing tagged template */; + +/* Leading this */ (this) /* Trailing this */; + +/* Leading unary */ (+1) /* Trailing unary */; + +/* Leading update */ (i++) /* Trailing update */; + +function metaProperty() { + /* Leading meta property */ (new.target) /* Trailing meta property */; +} + +function* generator() { + /* Leading yield */ (yield 1) /* Trailing yield */ +} diff --git a/lib/test/flow/comment_interning/parenthesized_expression.options.json b/lib/test/flow/comment_interning/parenthesized_expression.options.json new file mode 100644 index 0000000..d426f7e --- /dev/null +++ b/lib/test/flow/comment_interning/parenthesized_expression.options.json @@ -0,0 +1,4 @@ +{ + "intern_comments": true, + "esproposal_optional_chaining": true +} diff --git a/lib/test/flow/comment_interning/parenthesized_expression.tree.json b/lib/test/flow/comment_interning/parenthesized_expression.tree.json new file mode 100644 index 0000000..072c94b --- /dev/null +++ b/lib/test/flow/comment_interning/parenthesized_expression.tree.json @@ -0,0 +1,1534 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":61,"column":1}}, + "range":[0,1761], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, + "range":[4,9], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "value":0, + "raw":"0" + } + } + ], + "kind":"var" + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":17}}, + "range":[12,29], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":9},"end":{"line":3,"column":12}}, + "range":[21,24], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":15},"end":{"line":3,"column":17}}, + "range":[27,29], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":5,"column":23},"end":{"line":5,"column":100}}, + "range":[54,131], + "expression":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":50},"end":{"line":5,"column":73}}, + "range":[81,104], + "value":" Nested trailing 1 " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":76},"end":{"line":5,"column":99}}, + "range":[107,130], + "value":" Nested trailing 2 " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":22}}, + "range":[31,53], + "value":" Nested leading 1 " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":25},"end":{"line":5,"column":47}}, + "range":[56,78], + "value":" Nested leading 2 " + } + ], + "loc":{"source":null,"start":{"line":5,"column":48},"end":{"line":5,"column":49}}, + "range":[79,80], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":7,"column":20},"end":{"line":7,"column":46}}, + "range":[153,179], + "expression":{ + "type":"ArrayExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":25},"end":{"line":7,"column":45}}, + "range":[158,178], + "value":" Trailing array " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":19}}, + "range":[133,152], + "value":" Leading array " + } + ], + "loc":{"source":null,"start":{"line":7,"column":21},"end":{"line":7,"column":23}}, + "range":[154,156], + "elements":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":9,"column":29},"end":{"line":9,"column":70}}, + "range":[210,251], + "expression":{ + "type":"ArrowFunctionExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":40},"end":{"line":9,"column":69}}, + "range":[221,250], + "value":" Trailing arrow function " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":9,"column":28}}, + "range":[181,209], + "value":" Leading arrow function " + } + ], + "loc":{"source":null,"start":{"line":9,"column":30},"end":{"line":9,"column":38}}, + "range":[211,219], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":9,"column":36},"end":{"line":9,"column":38}}, + "range":[217,219], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":11,"column":21},"end":{"line":11,"column":51}}, + "range":[274,304], + "expression":{ + "type":"AssignmentExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":29},"end":{"line":11,"column":50}}, + "range":[282,303], + "value":" Trailing assign " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":11,"column":20}}, + "range":[253,273], + "value":" Leading assign " + } + ], + "loc":{"source":null,"start":{"line":11,"column":22},"end":{"line":11,"column":27}}, + "range":[275,280], + "operator":"=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":11,"column":22},"end":{"line":11,"column":23}}, + "range":[275,276], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":11,"column":26},"end":{"line":11,"column":27}}, + "range":[279,280], + "value":1, + "raw":"1" + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":13,"column":21},"end":{"line":13,"column":51}}, + "range":[327,357], + "expression":{ + "type":"BinaryExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":29},"end":{"line":13,"column":50}}, + "range":[335,356], + "value":" Trailing binary " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":0},"end":{"line":13,"column":20}}, + "range":[306,326], + "value":" Leading binary " + } + ], + "loc":{"source":null,"start":{"line":13,"column":22},"end":{"line":13,"column":27}}, + "range":[328,333], + "operator":"+", + "left":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":13,"column":22},"end":{"line":13,"column":23}}, + "range":[328,329], + "value":1, + "raw":"1" + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":13,"column":26},"end":{"line":13,"column":27}}, + "range":[332,333], + "value":2, + "raw":"2" + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":15,"column":19},"end":{"line":15,"column":47}}, + "range":[378,406], + "expression":{ + "type":"CallExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":27},"end":{"line":15,"column":46}}, + "range":[386,405], + "value":" Trailing call " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":0},"end":{"line":15,"column":18}}, + "range":[359,377], + "value":" Leading call " + } + ], + "loc":{"source":null,"start":{"line":15,"column":20},"end":{"line":15,"column":25}}, + "range":[379,384], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":15,"column":20},"end":{"line":15,"column":23}}, + "range":[379,382], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":17,"column":20},"end":{"line":17,"column":54}}, + "range":[428,462], + "expression":{ + "type":"ClassExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":33},"end":{"line":17,"column":53}}, + "range":[441,461], + "value":" Trailing class " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":0},"end":{"line":17,"column":19}}, + "range":[408,427], + "value":" Leading class " + } + ], + "loc":{"source":null,"start":{"line":17,"column":21},"end":{"line":17,"column":31}}, + "range":[429,439], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":17,"column":27},"end":{"line":17,"column":28}}, + "range":[435,436], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":17,"column":29},"end":{"line":17,"column":31}}, + "range":[437,439], + "body":[] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":19,"column":26},"end":{"line":19,"column":68}}, + "range":[490,532], + "expression":{ + "type":"ConditionalExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":41},"end":{"line":19,"column":67}}, + "range":[505,531], + "value":" Trailing conditional " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":0},"end":{"line":19,"column":25}}, + "range":[464,489], + "value":" Leading conditional " + } + ], + "loc":{"source":null,"start":{"line":19,"column":27},"end":{"line":19,"column":39}}, + "range":[491,503], + "test":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":19,"column":27},"end":{"line":19,"column":31}}, + "range":[491,495], + "value":true, + "raw":"true" + }, + "consequent":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":19,"column":34},"end":{"line":19,"column":35}}, + "range":[498,499], + "value":1, + "raw":"1" + }, + "alternate":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":19,"column":38},"end":{"line":19,"column":39}}, + "range":[502,503], + "value":2, + "raw":"2" + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":21,"column":23},"end":{"line":21,"column":62}}, + "range":[557,596], + "expression":{ + "type":"FunctionExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":38},"end":{"line":21,"column":61}}, + "range":[572,595], + "value":" Trailing function " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":0},"end":{"line":21,"column":22}}, + "range":[534,556], + "value":" Leading function " + } + ], + "loc":{"source":null,"start":{"line":21,"column":24},"end":{"line":21,"column":36}}, + "range":[558,570], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":21,"column":34},"end":{"line":21,"column":36}}, + "range":[568,570], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":23,"column":25},"end":{"line":23,"column":55}}, + "range":[623,653], + "expression":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":29},"end":{"line":23,"column":54}}, + "range":[627,652], + "value":" Trailing identifier " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":0},"end":{"line":23,"column":24}}, + "range":[598,622], + "value":" Leading identifier " + } + ], + "loc":{"source":null,"start":{"line":23,"column":26},"end":{"line":23,"column":27}}, + "range":[624,625], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":25,"column":21},"end":{"line":25,"column":60}}, + "range":[676,715], + "expression":{ + "type":"ImportExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":38},"end":{"line":25,"column":59}}, + "range":[693,714], + "value":" Trailing import " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":0},"end":{"line":25,"column":20}}, + "range":[655,675], + "value":" Leading import " + } + ], + "loc":{"source":null,"start":{"line":25,"column":22},"end":{"line":25,"column":36}}, + "range":[677,691], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":25,"column":29},"end":{"line":25,"column":35}}, + "range":[684,690], + "value":"test", + "raw":"'test'" + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":27,"column":26},"end":{"line":27,"column":71}}, + "range":[743,788], + "expression":{ + "type":"JSXElement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":27,"column":44},"end":{"line":27,"column":70}}, + "range":[761,787], + "value":" Trailing JSX element " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":27,"column":0},"end":{"line":27,"column":25}}, + "range":[717,742], + "value":" Leading JSX element " + } + ], + "loc":{"source":null,"start":{"line":27,"column":27},"end":{"line":27,"column":42}}, + "range":[744,759], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":27,"column":27},"end":{"line":27,"column":32}}, + "range":[744,749], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":27,"column":28},"end":{"line":27,"column":31}}, + "range":[745,748], + "name":"div" + }, + "attributes":[], + "selfClosing":false + }, + "closingElement":{ + "type":"JSXClosingElement", + "loc":{"source":null,"start":{"line":27,"column":36},"end":{"line":27,"column":42}}, + "range":[753,759], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":27,"column":38},"end":{"line":27,"column":41}}, + "range":[755,758], + "name":"div" + } + }, + "children":[ + { + "type":"JSXText", + "loc":{"source":null,"start":{"line":27,"column":32},"end":{"line":27,"column":36}}, + "range":[749,753], + "value":"test", + "raw":"test" + } + ] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":29,"column":27},"end":{"line":29,"column":67}}, + "range":[817,857], + "expression":{ + "type":"JSXFragment", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":39},"end":{"line":29,"column":66}}, + "range":[829,856], + "value":" Trailing JSX fragment " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":0},"end":{"line":29,"column":26}}, + "range":[790,816], + "value":" Leading JSX fragment " + } + ], + "loc":{"source":null,"start":{"line":29,"column":28},"end":{"line":29,"column":37}}, + "range":[818,827], + "openingFragment":{ + "type":"JSXOpeningFragment", + "loc":{"source":null,"start":{"line":29,"column":28},"end":{"line":29,"column":30}}, + "range":[818,820] + }, + "children":[ + { + "type":"JSXText", + "loc":{"source":null,"start":{"line":29,"column":30},"end":{"line":29,"column":34}}, + "range":[820,824], + "value":"test", + "raw":"test" + } + ], + "closingFragment":{ + "type":"JSXClosingFragment", + "loc":{"source":null,"start":{"line":29,"column":34},"end":{"line":29,"column":37}}, + "range":[824,827] + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":31,"column":22},"end":{"line":31,"column":49}}, + "range":[881,908], + "expression":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":26},"end":{"line":31,"column":48}}, + "range":[885,907], + "value":" Trailing literal " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":0},"end":{"line":31,"column":21}}, + "range":[859,880], + "value":" Leading literal " + } + ], + "loc":{"source":null,"start":{"line":31,"column":23},"end":{"line":31,"column":24}}, + "range":[882,883], + "value":1, + "raw":"1" + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":33,"column":22},"end":{"line":33,"column":61}}, + "range":[932,971], + "expression":{ + "type":"LogicalExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":33,"column":38},"end":{"line":33,"column":60}}, + "range":[948,970], + "value":" Trailing logical " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":33,"column":0},"end":{"line":33,"column":21}}, + "range":[910,931], + "value":" Leading logical " + } + ], + "loc":{"source":null,"start":{"line":33,"column":23},"end":{"line":33,"column":36}}, + "range":[933,946], + "operator":"||", + "left":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":33,"column":23},"end":{"line":33,"column":28}}, + "range":[933,938], + "value":false, + "raw":"false" + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":33,"column":32},"end":{"line":33,"column":36}}, + "range":[942,946], + "value":true, + "raw":"true" + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":35,"column":21},"end":{"line":35,"column":53}}, + "range":[994,1026], + "expression":{ + "type":"MemberExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":31},"end":{"line":35,"column":52}}, + "range":[1004,1025], + "value":" Trailing member " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":0},"end":{"line":35,"column":20}}, + "range":[973,993], + "value":" Leading member " + } + ], + "loc":{"source":null,"start":{"line":35,"column":22},"end":{"line":35,"column":29}}, + "range":[995,1002], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":35,"column":22},"end":{"line":35,"column":23}}, + "range":[995,996], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":35,"column":24},"end":{"line":35,"column":29}}, + "range":[997,1002], + "name":"isNaN", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":37,"column":18},"end":{"line":37,"column":47}}, + "range":[1046,1075], + "expression":{ + "type":"NewExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":37,"column":28},"end":{"line":37,"column":46}}, + "range":[1056,1074], + "value":" Trailing new " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":37,"column":0},"end":{"line":37,"column":17}}, + "range":[1028,1045], + "value":" Leading new " + } + ], + "loc":{"source":null,"start":{"line":37,"column":19},"end":{"line":37,"column":26}}, + "range":[1047,1054], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":37,"column":23},"end":{"line":37,"column":24}}, + "range":[1051,1052], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":39,"column":21},"end":{"line":39,"column":48}}, + "range":[1098,1125], + "expression":{ + "type":"ObjectExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":39,"column":26},"end":{"line":39,"column":47}}, + "range":[1103,1124], + "value":" Trailing object " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":39,"column":0},"end":{"line":39,"column":20}}, + "range":[1077,1097], + "value":" Leading object " + } + ], + "loc":{"source":null,"start":{"line":39,"column":22},"end":{"line":39,"column":24}}, + "range":[1099,1101], + "properties":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":41,"column":28},"end":{"line":41,"column":70}}, + "range":[1155,1197], + "expression":{ + "type":"OptionalCallExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":41,"column":41},"end":{"line":41,"column":69}}, + "range":[1168,1196], + "value":" Trailing optional call " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":41,"column":0},"end":{"line":41,"column":27}}, + "range":[1127,1154], + "value":" Leading optional call " + } + ], + "loc":{"source":null,"start":{"line":41,"column":29},"end":{"line":41,"column":39}}, + "range":[1156,1166], + "callee":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":41,"column":29},"end":{"line":41,"column":37}}, + "range":[1156,1164], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":41,"column":29},"end":{"line":41,"column":30}}, + "range":[1156,1157], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":41,"column":32},"end":{"line":41,"column":37}}, + "range":[1159,1164], + "name":"isNaN", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":true + }, + "typeArguments":null, + "arguments":[], + "optional":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":43,"column":30},"end":{"line":43,"column":72}}, + "range":[1229,1271], + "expression":{ + "type":"OptionalMemberExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":43,"column":41},"end":{"line":43,"column":71}}, + "range":[1240,1270], + "value":" Trailing optional member " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":43,"column":0},"end":{"line":43,"column":29}}, + "range":[1199,1228], + "value":" Leading optional member " + } + ], + "loc":{"source":null,"start":{"line":43,"column":31},"end":{"line":43,"column":39}}, + "range":[1230,1238], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":43,"column":31},"end":{"line":43,"column":32}}, + "range":[1230,1231], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":43,"column":34},"end":{"line":43,"column":39}}, + "range":[1233,1238], + "name":"isNaN", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":true + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":45,"column":31},"end":{"line":45,"column":76}}, + "range":[1304,1349], + "expression":{ + "type":"TemplateLiteral", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":45,"column":44},"end":{"line":45,"column":75}}, + "range":[1317,1348], + "value":" Trailing template literal " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":45,"column":0},"end":{"line":45,"column":30}}, + "range":[1273,1303], + "value":" Leading template literal " + } + ], + "loc":{"source":null,"start":{"line":45,"column":32},"end":{"line":45,"column":42}}, + "range":[1305,1315], + "quasis":[ + { + "type":"TemplateElement", + "loc":{"source":null,"start":{"line":45,"column":32},"end":{"line":45,"column":42}}, + "range":[1305,1315], + "value":{"raw":"template","cooked":"template"}, + "tail":true + } + ], + "expressions":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":47,"column":30},"end":{"line":47,"column":77}}, + "range":[1381,1428], + "expression":{ + "type":"TaggedTemplateExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":47,"column":46},"end":{"line":47,"column":76}}, + "range":[1397,1427], + "value":" Trailing tagged template " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":47,"column":0},"end":{"line":47,"column":29}}, + "range":[1351,1380], + "value":" Leading tagged template " + } + ], + "loc":{"source":null,"start":{"line":47,"column":31},"end":{"line":47,"column":44}}, + "range":[1382,1395], + "tag":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":47,"column":31},"end":{"line":47,"column":34}}, + "range":[1382,1385], + "name":"tag", + "typeAnnotation":null, + "optional":false + }, + "quasi":{ + "type":"TemplateLiteral", + "loc":{"source":null,"start":{"line":47,"column":34},"end":{"line":47,"column":44}}, + "range":[1385,1395], + "quasis":[ + { + "type":"TemplateElement", + "loc":{"source":null,"start":{"line":47,"column":34},"end":{"line":47,"column":44}}, + "range":[1385,1395], + "value":{"raw":"template","cooked":"template"}, + "tail":true + } + ], + "expressions":[] + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":49,"column":19},"end":{"line":49,"column":46}}, + "range":[1449,1476], + "expression":{ + "type":"ThisExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":49,"column":26},"end":{"line":49,"column":45}}, + "range":[1456,1475], + "value":" Trailing this " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":49,"column":0},"end":{"line":49,"column":18}}, + "range":[1430,1448], + "value":" Leading this " + } + ], + "loc":{"source":null,"start":{"line":49,"column":20},"end":{"line":49,"column":24}}, + "range":[1450,1454] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":51,"column":20},"end":{"line":51,"column":46}}, + "range":[1498,1524], + "expression":{ + "type":"UnaryExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":51,"column":25},"end":{"line":51,"column":45}}, + "range":[1503,1523], + "value":" Trailing unary " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":51,"column":0},"end":{"line":51,"column":19}}, + "range":[1478,1497], + "value":" Leading unary " + } + ], + "loc":{"source":null,"start":{"line":51,"column":21},"end":{"line":51,"column":23}}, + "range":[1499,1501], + "operator":"+", + "prefix":true, + "argument":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":51,"column":22},"end":{"line":51,"column":23}}, + "range":[1500,1501], + "value":1, + "raw":"1" + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":53,"column":21},"end":{"line":53,"column":49}}, + "range":[1547,1575], + "expression":{ + "type":"UpdateExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":53,"column":27},"end":{"line":53,"column":48}}, + "range":[1553,1574], + "value":" Trailing update " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":53,"column":0},"end":{"line":53,"column":20}}, + "range":[1526,1546], + "value":" Leading update " + } + ], + "loc":{"source":null,"start":{"line":53,"column":22},"end":{"line":53,"column":25}}, + "range":[1548,1551], + "operator":"++", + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":53,"column":22},"end":{"line":53,"column":23}}, + "range":[1548,1549], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "prefix":false + }, + "directive":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":55,"column":0},"end":{"line":57,"column":1}}, + "range":[1577,1679], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":55,"column":9},"end":{"line":55,"column":21}}, + "range":[1586,1598], + "name":"metaProperty", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":55,"column":24},"end":{"line":57,"column":1}}, + "range":[1601,1679], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":56,"column":32},"end":{"line":56,"column":74}}, + "range":[1635,1677], + "expression":{ + "type":"MetaProperty", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":56,"column":45},"end":{"line":56,"column":73}}, + "range":[1648,1676], + "value":" Trailing meta property " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":56,"column":4},"end":{"line":56,"column":31}}, + "range":[1607,1634], + "value":" Leading meta property " + } + ], + "loc":{"source":null,"start":{"line":56,"column":33},"end":{"line":56,"column":43}}, + "range":[1636,1646], + "meta":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":56,"column":33},"end":{"line":56,"column":36}}, + "range":[1636,1639], + "name":"new", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":56,"column":37},"end":{"line":56,"column":43}}, + "range":[1640,1646], + "name":"target", + "typeAnnotation":null, + "optional":false + } + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":59,"column":0},"end":{"line":61,"column":1}}, + "range":[1681,1761], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":59,"column":10},"end":{"line":59,"column":19}}, + "range":[1691,1700], + "name":"generator", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":59,"column":22},"end":{"line":61,"column":1}}, + "range":[1703,1761], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":60,"column":24},"end":{"line":60,"column":33}}, + "range":[1729,1738], + "expression":{ + "type":"YieldExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":60,"column":34},"end":{"line":60,"column":54}}, + "range":[1739,1759], + "value":" Trailing yield " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":60,"column":4},"end":{"line":60,"column":23}}, + "range":[1709,1728], + "value":" Leading yield " + } + ], + "loc":{"source":null,"start":{"line":60,"column":25},"end":{"line":60,"column":32}}, + "range":[1730,1737], + "argument":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":60,"column":31},"end":{"line":60,"column":32}}, + "range":[1736,1737], + "value":1, + "raw":"1" + }, + "delegate":false + }, + "directive":null + } + ] + }, + "async":false, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":22}}, + "range":[31,53], + "value":" Nested leading 1 " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":25},"end":{"line":5,"column":47}}, + "range":[56,78], + "value":" Nested leading 2 " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":50},"end":{"line":5,"column":73}}, + "range":[81,104], + "value":" Nested trailing 1 " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":76},"end":{"line":5,"column":99}}, + "range":[107,130], + "value":" Nested trailing 2 " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":19}}, + "range":[133,152], + "value":" Leading array " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":25},"end":{"line":7,"column":45}}, + "range":[158,178], + "value":" Trailing array " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":9,"column":28}}, + "range":[181,209], + "value":" Leading arrow function " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":40},"end":{"line":9,"column":69}}, + "range":[221,250], + "value":" Trailing arrow function " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":11,"column":20}}, + "range":[253,273], + "value":" Leading assign " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":29},"end":{"line":11,"column":50}}, + "range":[282,303], + "value":" Trailing assign " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":0},"end":{"line":13,"column":20}}, + "range":[306,326], + "value":" Leading binary " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":29},"end":{"line":13,"column":50}}, + "range":[335,356], + "value":" Trailing binary " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":0},"end":{"line":15,"column":18}}, + "range":[359,377], + "value":" Leading call " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":27},"end":{"line":15,"column":46}}, + "range":[386,405], + "value":" Trailing call " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":0},"end":{"line":17,"column":19}}, + "range":[408,427], + "value":" Leading class " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":33},"end":{"line":17,"column":53}}, + "range":[441,461], + "value":" Trailing class " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":0},"end":{"line":19,"column":25}}, + "range":[464,489], + "value":" Leading conditional " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":41},"end":{"line":19,"column":67}}, + "range":[505,531], + "value":" Trailing conditional " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":0},"end":{"line":21,"column":22}}, + "range":[534,556], + "value":" Leading function " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":38},"end":{"line":21,"column":61}}, + "range":[572,595], + "value":" Trailing function " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":0},"end":{"line":23,"column":24}}, + "range":[598,622], + "value":" Leading identifier " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":29},"end":{"line":23,"column":54}}, + "range":[627,652], + "value":" Trailing identifier " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":0},"end":{"line":25,"column":20}}, + "range":[655,675], + "value":" Leading import " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":38},"end":{"line":25,"column":59}}, + "range":[693,714], + "value":" Trailing import " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":27,"column":0},"end":{"line":27,"column":25}}, + "range":[717,742], + "value":" Leading JSX element " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":27,"column":44},"end":{"line":27,"column":70}}, + "range":[761,787], + "value":" Trailing JSX element " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":0},"end":{"line":29,"column":26}}, + "range":[790,816], + "value":" Leading JSX fragment " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":39},"end":{"line":29,"column":66}}, + "range":[829,856], + "value":" Trailing JSX fragment " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":0},"end":{"line":31,"column":21}}, + "range":[859,880], + "value":" Leading literal " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":26},"end":{"line":31,"column":48}}, + "range":[885,907], + "value":" Trailing literal " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":33,"column":0},"end":{"line":33,"column":21}}, + "range":[910,931], + "value":" Leading logical " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":33,"column":38},"end":{"line":33,"column":60}}, + "range":[948,970], + "value":" Trailing logical " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":0},"end":{"line":35,"column":20}}, + "range":[973,993], + "value":" Leading member " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":31},"end":{"line":35,"column":52}}, + "range":[1004,1025], + "value":" Trailing member " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":37,"column":0},"end":{"line":37,"column":17}}, + "range":[1028,1045], + "value":" Leading new " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":37,"column":28},"end":{"line":37,"column":46}}, + "range":[1056,1074], + "value":" Trailing new " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":39,"column":0},"end":{"line":39,"column":20}}, + "range":[1077,1097], + "value":" Leading object " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":39,"column":26},"end":{"line":39,"column":47}}, + "range":[1103,1124], + "value":" Trailing object " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":41,"column":0},"end":{"line":41,"column":27}}, + "range":[1127,1154], + "value":" Leading optional call " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":41,"column":41},"end":{"line":41,"column":69}}, + "range":[1168,1196], + "value":" Trailing optional call " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":43,"column":0},"end":{"line":43,"column":29}}, + "range":[1199,1228], + "value":" Leading optional member " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":43,"column":41},"end":{"line":43,"column":71}}, + "range":[1240,1270], + "value":" Trailing optional member " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":45,"column":0},"end":{"line":45,"column":30}}, + "range":[1273,1303], + "value":" Leading template literal " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":45,"column":44},"end":{"line":45,"column":75}}, + "range":[1317,1348], + "value":" Trailing template literal " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":47,"column":0},"end":{"line":47,"column":29}}, + "range":[1351,1380], + "value":" Leading tagged template " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":47,"column":46},"end":{"line":47,"column":76}}, + "range":[1397,1427], + "value":" Trailing tagged template " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":49,"column":0},"end":{"line":49,"column":18}}, + "range":[1430,1448], + "value":" Leading this " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":49,"column":26},"end":{"line":49,"column":45}}, + "range":[1456,1475], + "value":" Trailing this " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":51,"column":0},"end":{"line":51,"column":19}}, + "range":[1478,1497], + "value":" Leading unary " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":51,"column":25},"end":{"line":51,"column":45}}, + "range":[1503,1523], + "value":" Trailing unary " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":53,"column":0},"end":{"line":53,"column":20}}, + "range":[1526,1546], + "value":" Leading update " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":53,"column":27},"end":{"line":53,"column":48}}, + "range":[1553,1574], + "value":" Trailing update " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":56,"column":4},"end":{"line":56,"column":31}}, + "range":[1607,1634], + "value":" Leading meta property " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":56,"column":45},"end":{"line":56,"column":73}}, + "range":[1648,1676], + "value":" Trailing meta property " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":60,"column":4},"end":{"line":60,"column":23}}, + "range":[1709,1728], + "value":" Leading yield " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":60,"column":34},"end":{"line":60,"column":54}}, + "range":[1739,1759], + "value":" Trailing yield " + } + ] +} diff --git a/lib/test/flow/comment_interning/parenthesized_type.js b/lib/test/flow/comment_interning/parenthesized_type.js new file mode 100644 index 0000000..2dd6809 --- /dev/null +++ b/lib/test/flow/comment_interning/parenthesized_type.js @@ -0,0 +1,51 @@ +type Test1 = /* Nested leading 1 */ (/* Nested leading 2 */ any /* Nested trailing 1 */) /* Nested trailing 2 */; + +type Test2 = /* Leading any */ (any) /* Trailing any */; + +type Test3 = /* Leading mixed */ (mixed) /* Trailing mixed */; + +type Test4 = /* Leading empty */ (empty) /* Trailing empty */; + +type Test5 = /* Leading void */ (void) /* Trailing void */; + +type Test6 = /* Leading null */ (null) /* Trailing null */; + +type Test7 = /* Leading number */ (number) /* Trailing number */; + +type Test8 = /* Leading bigint */ (bigint) /* Trailing bigint */; + +type Test9 = /* Leading string */ (string) /* Trailing string */; + +type Test10 = /* Leading boolean */ (boolean) /* Trailing boolean */; + +type Test11 = /* Leading symbol */ (symbol) /* Trailing symbol */; + +type Test12 = /* Leading exists */ (*) /* Trailing exists */; + +type Test13 = /* Leading nullable */ (?any) /* Trailing nullable */; + +type Test14 = /* Leading function */ (any => any) /* Trailing function */; + +type Test15 = /* Leading object */ ({}) /* Trailing object */; + +type Test16 = /* Leading interface */ (interface {}) /* Trailing interface */; + +type Test17 = /* Leading array */ (any[]) /* Trailing array */; + +type Test18 = /* Leading union */ (any | any) /* Trailing union */; + +type Test19 = /* Leading intersection */ (any & any) /* Trailing intersection */; + +type Test20 = /* Leading typeof */ (typeof 1) /* Trailing typeof */; + +type Test21 = /* Leading tuple */ ([any, any]) /* Trailing any */; + +type Test22 = /* Leading string lit */ ("literal") /* Trailing string lit */; + +type Test23 = /* Leading number lit */ (1) /* Trailing number lit */; + +type Test24 = /* Leading bigint lit */ (1n) /* Trailing bigint lit */; + +type Test25 = /* Leading boolean lit */ (true) /* Trailing boolean lit */; + +type Test26 = /* Leading generic */ (Foo) /* Trailing generic */; diff --git a/lib/test/flow/comment_interning/parenthesized_type.options.json b/lib/test/flow/comment_interning/parenthesized_type.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/parenthesized_type.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/parenthesized_type.tree.json b/lib/test/flow/comment_interning/parenthesized_type.tree.json new file mode 100644 index 0000000..566a03d --- /dev/null +++ b/lib/test/flow/comment_interning/parenthesized_type.tree.json @@ -0,0 +1,1363 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":51,"column":65}}, + "range":[0,1834], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":113}}, + "range":[0,113], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, + "range":[5,10], + "name":"Test1", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":64},"end":{"line":1,"column":87}}, + "range":[64,87], + "value":" Nested trailing 1 " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":89},"end":{"line":1,"column":112}}, + "range":[89,112], + "value":" Nested trailing 2 " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":35}}, + "range":[13,35], + "value":" Nested leading 1 " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":59}}, + "range":[37,59], + "value":" Nested leading 2 " + } + ], + "loc":{"source":null,"start":{"line":1,"column":60},"end":{"line":1,"column":63}}, + "range":[60,63] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":56}}, + "range":[115,171], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":5},"end":{"line":3,"column":10}}, + "range":[120,125], + "name":"Test2", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":37},"end":{"line":3,"column":55}}, + "range":[152,170], + "value":" Trailing any " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":13},"end":{"line":3,"column":30}}, + "range":[128,145], + "value":" Leading any " + } + ], + "loc":{"source":null,"start":{"line":3,"column":32},"end":{"line":3,"column":35}}, + "range":[147,150] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":62}}, + "range":[173,235], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":5},"end":{"line":5,"column":10}}, + "range":[178,183], + "name":"Test3", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"MixedTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":41},"end":{"line":5,"column":61}}, + "range":[214,234], + "value":" Trailing mixed " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":13},"end":{"line":5,"column":32}}, + "range":[186,205], + "value":" Leading mixed " + } + ], + "loc":{"source":null,"start":{"line":5,"column":34},"end":{"line":5,"column":39}}, + "range":[207,212] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":62}}, + "range":[237,299], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":5},"end":{"line":7,"column":10}}, + "range":[242,247], + "name":"Test4", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"EmptyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":41},"end":{"line":7,"column":61}}, + "range":[278,298], + "value":" Trailing empty " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":13},"end":{"line":7,"column":32}}, + "range":[250,269], + "value":" Leading empty " + } + ], + "loc":{"source":null,"start":{"line":7,"column":34},"end":{"line":7,"column":39}}, + "range":[271,276] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":9,"column":59}}, + "range":[301,360], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":5},"end":{"line":9,"column":10}}, + "range":[306,311], + "name":"Test5", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"VoidTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":39},"end":{"line":9,"column":58}}, + "range":[340,359], + "value":" Trailing void " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":13},"end":{"line":9,"column":31}}, + "range":[314,332], + "value":" Leading void " + } + ], + "loc":{"source":null,"start":{"line":9,"column":33},"end":{"line":9,"column":37}}, + "range":[334,338] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":11,"column":59}}, + "range":[362,421], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":11,"column":5},"end":{"line":11,"column":10}}, + "range":[367,372], + "name":"Test6", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"NullLiteralTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":39},"end":{"line":11,"column":58}}, + "range":[401,420], + "value":" Trailing null " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":13},"end":{"line":11,"column":31}}, + "range":[375,393], + "value":" Leading null " + } + ], + "loc":{"source":null,"start":{"line":11,"column":33},"end":{"line":11,"column":37}}, + "range":[395,399] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":13,"column":0},"end":{"line":13,"column":65}}, + "range":[423,488], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":13,"column":5},"end":{"line":13,"column":10}}, + "range":[428,433], + "name":"Test7", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"NumberTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":43},"end":{"line":13,"column":64}}, + "range":[466,487], + "value":" Trailing number " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":13},"end":{"line":13,"column":33}}, + "range":[436,456], + "value":" Leading number " + } + ], + "loc":{"source":null,"start":{"line":13,"column":35},"end":{"line":13,"column":41}}, + "range":[458,464] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":15,"column":0},"end":{"line":15,"column":65}}, + "range":[490,555], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":15,"column":5},"end":{"line":15,"column":10}}, + "range":[495,500], + "name":"Test8", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"BigIntTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":43},"end":{"line":15,"column":64}}, + "range":[533,554], + "value":" Trailing bigint " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":13},"end":{"line":15,"column":33}}, + "range":[503,523], + "value":" Leading bigint " + } + ], + "loc":{"source":null,"start":{"line":15,"column":35},"end":{"line":15,"column":41}}, + "range":[525,531] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":17,"column":0},"end":{"line":17,"column":65}}, + "range":[557,622], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":17,"column":5},"end":{"line":17,"column":10}}, + "range":[562,567], + "name":"Test9", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"StringTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":43},"end":{"line":17,"column":64}}, + "range":[600,621], + "value":" Trailing string " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":13},"end":{"line":17,"column":33}}, + "range":[570,590], + "value":" Leading string " + } + ], + "loc":{"source":null,"start":{"line":17,"column":35},"end":{"line":17,"column":41}}, + "range":[592,598] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":19,"column":0},"end":{"line":19,"column":69}}, + "range":[624,693], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":19,"column":5},"end":{"line":19,"column":11}}, + "range":[629,635], + "name":"Test10", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"BooleanTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":46},"end":{"line":19,"column":68}}, + "range":[670,692], + "value":" Trailing boolean " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":14},"end":{"line":19,"column":35}}, + "range":[638,659], + "value":" Leading boolean " + } + ], + "loc":{"source":null,"start":{"line":19,"column":37},"end":{"line":19,"column":44}}, + "range":[661,668] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":21,"column":0},"end":{"line":21,"column":66}}, + "range":[695,761], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":21,"column":5},"end":{"line":21,"column":11}}, + "range":[700,706], + "name":"Test11", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"SymbolTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":44},"end":{"line":21,"column":65}}, + "range":[739,760], + "value":" Trailing symbol " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":14},"end":{"line":21,"column":34}}, + "range":[709,729], + "value":" Leading symbol " + } + ], + "loc":{"source":null,"start":{"line":21,"column":36},"end":{"line":21,"column":42}}, + "range":[731,737] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":23,"column":0},"end":{"line":23,"column":61}}, + "range":[763,824], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":23,"column":5},"end":{"line":23,"column":11}}, + "range":[768,774], + "name":"Test12", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ExistsTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":39},"end":{"line":23,"column":60}}, + "range":[802,823], + "value":" Trailing exists " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":14},"end":{"line":23,"column":34}}, + "range":[777,797], + "value":" Leading exists " + } + ], + "loc":{"source":null,"start":{"line":23,"column":36},"end":{"line":23,"column":37}}, + "range":[799,800] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":25,"column":0},"end":{"line":25,"column":68}}, + "range":[826,894], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":25,"column":5},"end":{"line":25,"column":11}}, + "range":[831,837], + "name":"Test13", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"NullableTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":44},"end":{"line":25,"column":67}}, + "range":[870,893], + "value":" Trailing nullable " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":14},"end":{"line":25,"column":36}}, + "range":[840,862], + "value":" Leading nullable " + } + ], + "loc":{"source":null,"start":{"line":25,"column":38},"end":{"line":25,"column":42}}, + "range":[864,868], + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":25,"column":39},"end":{"line":25,"column":42}}, + "range":[865,868] + } + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":27,"column":0},"end":{"line":27,"column":74}}, + "range":[896,970], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":27,"column":5},"end":{"line":27,"column":11}}, + "range":[901,907], + "name":"Test14", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":27,"column":50},"end":{"line":27,"column":73}}, + "range":[946,969], + "value":" Trailing function " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":27,"column":14},"end":{"line":27,"column":36}}, + "range":[910,932], + "value":" Leading function " + } + ], + "loc":{"source":null,"start":{"line":27,"column":38},"end":{"line":27,"column":48}}, + "range":[934,944], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":27,"column":38},"end":{"line":27,"column":41}}, + "range":[934,937], + "name":null, + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":27,"column":38},"end":{"line":27,"column":41}}, + "range":[934,937] + }, + "optional":false + } + ], + "returnType":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":27,"column":45},"end":{"line":27,"column":48}}, + "range":[941,944] + }, + "rest":null, + "typeParameters":null + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":29,"column":0},"end":{"line":29,"column":62}}, + "range":[972,1034], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":29,"column":5},"end":{"line":29,"column":11}}, + "range":[977,983], + "name":"Test15", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":40},"end":{"line":29,"column":61}}, + "range":[1012,1033], + "value":" Trailing object " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":14},"end":{"line":29,"column":34}}, + "range":[986,1006], + "value":" Leading object " + } + ], + "loc":{"source":null,"start":{"line":29,"column":36},"end":{"line":29,"column":38}}, + "range":[1008,1010], + "inexact":false, + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":31,"column":0},"end":{"line":31,"column":78}}, + "range":[1036,1114], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":31,"column":5},"end":{"line":31,"column":11}}, + "range":[1041,1047], + "name":"Test16", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"InterfaceTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":53},"end":{"line":31,"column":77}}, + "range":[1089,1113], + "value":" Trailing interface " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":14},"end":{"line":31,"column":37}}, + "range":[1050,1073], + "value":" Leading interface " + } + ], + "loc":{"source":null,"start":{"line":31,"column":39},"end":{"line":31,"column":51}}, + "range":[1075,1087], + "extends":[], + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":31,"column":49},"end":{"line":31,"column":51}}, + "range":[1085,1087], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":33,"column":0},"end":{"line":33,"column":63}}, + "range":[1116,1179], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":33,"column":5},"end":{"line":33,"column":11}}, + "range":[1121,1127], + "name":"Test17", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ArrayTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":33,"column":42},"end":{"line":33,"column":62}}, + "range":[1158,1178], + "value":" Trailing array " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":33,"column":14},"end":{"line":33,"column":33}}, + "range":[1130,1149], + "value":" Leading array " + } + ], + "loc":{"source":null,"start":{"line":33,"column":35},"end":{"line":33,"column":40}}, + "range":[1151,1156], + "elementType":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":33,"column":35},"end":{"line":33,"column":38}}, + "range":[1151,1154] + } + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":35,"column":0},"end":{"line":35,"column":67}}, + "range":[1181,1248], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":35,"column":5},"end":{"line":35,"column":11}}, + "range":[1186,1192], + "name":"Test18", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"UnionTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":46},"end":{"line":35,"column":66}}, + "range":[1227,1247], + "value":" Trailing union " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":14},"end":{"line":35,"column":33}}, + "range":[1195,1214], + "value":" Leading union " + } + ], + "loc":{"source":null,"start":{"line":35,"column":35},"end":{"line":35,"column":44}}, + "range":[1216,1225], + "types":[ + { + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":35,"column":35},"end":{"line":35,"column":38}}, + "range":[1216,1219] + }, + { + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":35,"column":41},"end":{"line":35,"column":44}}, + "range":[1222,1225] + } + ] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":37,"column":0},"end":{"line":37,"column":81}}, + "range":[1250,1331], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":37,"column":5},"end":{"line":37,"column":11}}, + "range":[1255,1261], + "name":"Test19", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"IntersectionTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":37,"column":53},"end":{"line":37,"column":80}}, + "range":[1303,1330], + "value":" Trailing intersection " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":37,"column":14},"end":{"line":37,"column":40}}, + "range":[1264,1290], + "value":" Leading intersection " + } + ], + "loc":{"source":null,"start":{"line":37,"column":42},"end":{"line":37,"column":51}}, + "range":[1292,1301], + "types":[ + { + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":37,"column":42},"end":{"line":37,"column":45}}, + "range":[1292,1295] + }, + { + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":37,"column":48},"end":{"line":37,"column":51}}, + "range":[1298,1301] + } + ] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":39,"column":0},"end":{"line":39,"column":68}}, + "range":[1333,1401], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":39,"column":5},"end":{"line":39,"column":11}}, + "range":[1338,1344], + "name":"Test20", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"TypeofTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":39,"column":46},"end":{"line":39,"column":67}}, + "range":[1379,1400], + "value":" Trailing typeof " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":39,"column":14},"end":{"line":39,"column":34}}, + "range":[1347,1367], + "value":" Leading typeof " + } + ], + "loc":{"source":null,"start":{"line":39,"column":36},"end":{"line":39,"column":44}}, + "range":[1369,1377], + "argument":{ + "type":"NumberLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":39,"column":43},"end":{"line":39,"column":44}}, + "range":[1376,1377], + "value":1, + "raw":"1" + } + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":41,"column":0},"end":{"line":41,"column":66}}, + "range":[1403,1469], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":41,"column":5},"end":{"line":41,"column":11}}, + "range":[1408,1414], + "name":"Test21", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"TupleTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":41,"column":47},"end":{"line":41,"column":65}}, + "range":[1450,1468], + "value":" Trailing any " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":41,"column":14},"end":{"line":41,"column":33}}, + "range":[1417,1436], + "value":" Leading tuple " + } + ], + "loc":{"source":null,"start":{"line":41,"column":35},"end":{"line":41,"column":45}}, + "range":[1438,1448], + "types":[ + { + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":41,"column":36},"end":{"line":41,"column":39}}, + "range":[1439,1442] + }, + { + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":41,"column":41},"end":{"line":41,"column":44}}, + "range":[1444,1447] + } + ] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":43,"column":0},"end":{"line":43,"column":77}}, + "range":[1471,1548], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":43,"column":5},"end":{"line":43,"column":11}}, + "range":[1476,1482], + "name":"Test22", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"StringLiteralTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":43,"column":51},"end":{"line":43,"column":76}}, + "range":[1522,1547], + "value":" Trailing string lit " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":43,"column":14},"end":{"line":43,"column":38}}, + "range":[1485,1509], + "value":" Leading string lit " + } + ], + "loc":{"source":null,"start":{"line":43,"column":40},"end":{"line":43,"column":49}}, + "range":[1511,1520], + "value":"literal", + "raw":"\"literal\"" + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":45,"column":0},"end":{"line":45,"column":69}}, + "range":[1550,1619], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":45,"column":5},"end":{"line":45,"column":11}}, + "range":[1555,1561], + "name":"Test23", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"NumberLiteralTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":45,"column":43},"end":{"line":45,"column":68}}, + "range":[1593,1618], + "value":" Trailing number lit " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":45,"column":14},"end":{"line":45,"column":38}}, + "range":[1564,1588], + "value":" Leading number lit " + } + ], + "loc":{"source":null,"start":{"line":45,"column":40},"end":{"line":45,"column":41}}, + "range":[1590,1591], + "value":1, + "raw":"1" + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":47,"column":0},"end":{"line":47,"column":70}}, + "range":[1621,1691], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":47,"column":5},"end":{"line":47,"column":11}}, + "range":[1626,1632], + "name":"Test24", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"BigIntLiteralTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":47,"column":44},"end":{"line":47,"column":69}}, + "range":[1665,1690], + "value":" Trailing bigint lit " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":47,"column":14},"end":{"line":47,"column":38}}, + "range":[1635,1659], + "value":" Leading bigint lit " + } + ], + "loc":{"source":null,"start":{"line":47,"column":40},"end":{"line":47,"column":42}}, + "range":[1661,1663], + "value":null, + "raw":"1n" + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":49,"column":0},"end":{"line":49,"column":74}}, + "range":[1693,1767], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":49,"column":5},"end":{"line":49,"column":11}}, + "range":[1698,1704], + "name":"Test25", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"BooleanLiteralTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":49,"column":47},"end":{"line":49,"column":73}}, + "range":[1740,1766], + "value":" Trailing boolean lit " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":49,"column":14},"end":{"line":49,"column":39}}, + "range":[1707,1732], + "value":" Leading boolean lit " + } + ], + "loc":{"source":null,"start":{"line":49,"column":41},"end":{"line":49,"column":45}}, + "range":[1734,1738], + "value":true, + "raw":"true" + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":51,"column":0},"end":{"line":51,"column":65}}, + "range":[1769,1834], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":51,"column":5},"end":{"line":51,"column":11}}, + "range":[1774,1780], + "name":"Test26", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"GenericTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":51,"column":42},"end":{"line":51,"column":64}}, + "range":[1811,1833], + "value":" Trailing generic " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":51,"column":14},"end":{"line":51,"column":35}}, + "range":[1783,1804], + "value":" Leading generic " + } + ], + "loc":{"source":null,"start":{"line":51,"column":37},"end":{"line":51,"column":40}}, + "range":[1806,1809], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":51,"column":37},"end":{"line":51,"column":40}}, + "range":[1806,1809], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":35}}, + "range":[13,35], + "value":" Nested leading 1 " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":59}}, + "range":[37,59], + "value":" Nested leading 2 " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":64},"end":{"line":1,"column":87}}, + "range":[64,87], + "value":" Nested trailing 1 " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":89},"end":{"line":1,"column":112}}, + "range":[89,112], + "value":" Nested trailing 2 " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":13},"end":{"line":3,"column":30}}, + "range":[128,145], + "value":" Leading any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":37},"end":{"line":3,"column":55}}, + "range":[152,170], + "value":" Trailing any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":13},"end":{"line":5,"column":32}}, + "range":[186,205], + "value":" Leading mixed " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":41},"end":{"line":5,"column":61}}, + "range":[214,234], + "value":" Trailing mixed " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":13},"end":{"line":7,"column":32}}, + "range":[250,269], + "value":" Leading empty " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":41},"end":{"line":7,"column":61}}, + "range":[278,298], + "value":" Trailing empty " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":13},"end":{"line":9,"column":31}}, + "range":[314,332], + "value":" Leading void " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":39},"end":{"line":9,"column":58}}, + "range":[340,359], + "value":" Trailing void " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":13},"end":{"line":11,"column":31}}, + "range":[375,393], + "value":" Leading null " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":39},"end":{"line":11,"column":58}}, + "range":[401,420], + "value":" Trailing null " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":13},"end":{"line":13,"column":33}}, + "range":[436,456], + "value":" Leading number " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":43},"end":{"line":13,"column":64}}, + "range":[466,487], + "value":" Trailing number " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":13},"end":{"line":15,"column":33}}, + "range":[503,523], + "value":" Leading bigint " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":43},"end":{"line":15,"column":64}}, + "range":[533,554], + "value":" Trailing bigint " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":13},"end":{"line":17,"column":33}}, + "range":[570,590], + "value":" Leading string " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":43},"end":{"line":17,"column":64}}, + "range":[600,621], + "value":" Trailing string " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":14},"end":{"line":19,"column":35}}, + "range":[638,659], + "value":" Leading boolean " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":46},"end":{"line":19,"column":68}}, + "range":[670,692], + "value":" Trailing boolean " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":14},"end":{"line":21,"column":34}}, + "range":[709,729], + "value":" Leading symbol " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":44},"end":{"line":21,"column":65}}, + "range":[739,760], + "value":" Trailing symbol " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":14},"end":{"line":23,"column":34}}, + "range":[777,797], + "value":" Leading exists " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":39},"end":{"line":23,"column":60}}, + "range":[802,823], + "value":" Trailing exists " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":14},"end":{"line":25,"column":36}}, + "range":[840,862], + "value":" Leading nullable " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":44},"end":{"line":25,"column":67}}, + "range":[870,893], + "value":" Trailing nullable " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":27,"column":14},"end":{"line":27,"column":36}}, + "range":[910,932], + "value":" Leading function " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":27,"column":50},"end":{"line":27,"column":73}}, + "range":[946,969], + "value":" Trailing function " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":14},"end":{"line":29,"column":34}}, + "range":[986,1006], + "value":" Leading object " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":40},"end":{"line":29,"column":61}}, + "range":[1012,1033], + "value":" Trailing object " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":14},"end":{"line":31,"column":37}}, + "range":[1050,1073], + "value":" Leading interface " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":53},"end":{"line":31,"column":77}}, + "range":[1089,1113], + "value":" Trailing interface " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":33,"column":14},"end":{"line":33,"column":33}}, + "range":[1130,1149], + "value":" Leading array " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":33,"column":42},"end":{"line":33,"column":62}}, + "range":[1158,1178], + "value":" Trailing array " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":14},"end":{"line":35,"column":33}}, + "range":[1195,1214], + "value":" Leading union " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":46},"end":{"line":35,"column":66}}, + "range":[1227,1247], + "value":" Trailing union " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":37,"column":14},"end":{"line":37,"column":40}}, + "range":[1264,1290], + "value":" Leading intersection " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":37,"column":53},"end":{"line":37,"column":80}}, + "range":[1303,1330], + "value":" Trailing intersection " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":39,"column":14},"end":{"line":39,"column":34}}, + "range":[1347,1367], + "value":" Leading typeof " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":39,"column":46},"end":{"line":39,"column":67}}, + "range":[1379,1400], + "value":" Trailing typeof " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":41,"column":14},"end":{"line":41,"column":33}}, + "range":[1417,1436], + "value":" Leading tuple " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":41,"column":47},"end":{"line":41,"column":65}}, + "range":[1450,1468], + "value":" Trailing any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":43,"column":14},"end":{"line":43,"column":38}}, + "range":[1485,1509], + "value":" Leading string lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":43,"column":51},"end":{"line":43,"column":76}}, + "range":[1522,1547], + "value":" Trailing string lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":45,"column":14},"end":{"line":45,"column":38}}, + "range":[1564,1588], + "value":" Leading number lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":45,"column":43},"end":{"line":45,"column":68}}, + "range":[1593,1618], + "value":" Trailing number lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":47,"column":14},"end":{"line":47,"column":38}}, + "range":[1635,1659], + "value":" Leading bigint lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":47,"column":44},"end":{"line":47,"column":69}}, + "range":[1665,1690], + "value":" Trailing bigint lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":49,"column":14},"end":{"line":49,"column":39}}, + "range":[1707,1732], + "value":" Leading boolean lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":49,"column":47},"end":{"line":49,"column":73}}, + "range":[1740,1766], + "value":" Trailing boolean lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":51,"column":14},"end":{"line":51,"column":35}}, + "range":[1783,1804], + "value":" Leading generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":51,"column":42},"end":{"line":51,"column":64}}, + "range":[1811,1833], + "value":" Trailing generic " + } + ] +} diff --git a/lib/test/flow/comment_interning/program_comment_block.js b/lib/test/flow/comment_interning/program_comment_block.js new file mode 100644 index 0000000..e98be2a --- /dev/null +++ b/lib/test/flow/comment_interning/program_comment_block.js @@ -0,0 +1,6 @@ +/** + * Program comment + */ + +// L first statement +type T = any; diff --git a/lib/test/flow/comment_interning/program_comment_block.options.json b/lib/test/flow/comment_interning/program_comment_block.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/program_comment_block.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/program_comment_block.tree.json b/lib/test/flow/comment_interning/program_comment_block.tree.json new file mode 100644 index 0000000..fc0e6c0 --- /dev/null +++ b/lib/test/flow/comment_interning/program_comment_block.tree.json @@ -0,0 +1,56 @@ +{ + "type":"Program", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":3}}, + "range":[0,26], + "value":"*\n * Program comment\n " + } + ], + "loc":{"source":null,"start":{"line":6,"column":0},"end":{"line":6,"column":13}}, + "range":[49,62], + "body":[ + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":20}}, + "range":[28,48], + "value":" L first statement" + } + ], + "loc":{"source":null,"start":{"line":6,"column":0},"end":{"line":6,"column":13}}, + "range":[49,62], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":5},"end":{"line":6,"column":6}}, + "range":[54,55], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":6,"column":9},"end":{"line":6,"column":12}}, + "range":[58,61] + } + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":3}}, + "range":[0,26], + "value":"*\n * Program comment\n " + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":20}}, + "range":[28,48], + "value":" L first statement" + } + ] +} diff --git a/lib/test/flow/comment_interning/program_comment_directive.js b/lib/test/flow/comment_interning/program_comment_directive.js new file mode 100644 index 0000000..00f6ebe --- /dev/null +++ b/lib/test/flow/comment_interning/program_comment_directive.js @@ -0,0 +1,8 @@ +/** + * @flow + */ + +// @flow + +// L first statement +type T = any; diff --git a/lib/test/flow/comment_interning/program_comment_directive.options.json b/lib/test/flow/comment_interning/program_comment_directive.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/program_comment_directive.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/program_comment_directive.tree.json b/lib/test/flow/comment_interning/program_comment_directive.tree.json new file mode 100644 index 0000000..591ea5c --- /dev/null +++ b/lib/test/flow/comment_interning/program_comment_directive.tree.json @@ -0,0 +1,68 @@ +{ + "type":"Program", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":3}}, + "range":[0,16], + "value":"*\n * @flow\n " + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":8}}, + "range":[18,26], + "value":" @flow" + } + ], + "loc":{"source":null,"start":{"line":8,"column":0},"end":{"line":8,"column":13}}, + "range":[49,62], + "body":[ + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":20}}, + "range":[28,48], + "value":" L first statement" + } + ], + "loc":{"source":null,"start":{"line":8,"column":0},"end":{"line":8,"column":13}}, + "range":[49,62], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":8,"column":5},"end":{"line":8,"column":6}}, + "range":[54,55], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":8,"column":9},"end":{"line":8,"column":12}}, + "range":[58,61] + } + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":3}}, + "range":[0,16], + "value":"*\n * @flow\n " + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":8}}, + "range":[18,26], + "value":" @flow" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":20}}, + "range":[28,48], + "value":" L first statement" + } + ] +} diff --git a/lib/test/flow/comment_interning/remove_expression_trailing_comments.js b/lib/test/flow/comment_interning/remove_expression_trailing_comments.js new file mode 100644 index 0000000..4f4c4f7 --- /dev/null +++ b/lib/test/flow/comment_interning/remove_expression_trailing_comments.js @@ -0,0 +1,152 @@ +{ + /* L array */ [] /* T array */ + /* L str */ 'end of array tests' +} + +{ + /* L params */ () => 1 /* T num */ + /* L str */ 'end of arrow tests' +} + +{ + /* L arrow */ (() => 1) /* T arrow */ + /* L str */ 'end of parenthesized arrow tests' +} + +{ + /* L assign */ (x = 1) /* T assign */ + /* L id */ x = 1 /* T num */ + /* L str */ 'end of assign tests' +} + +{ + /* L binary */ (1 + 1) /* T binary */ + /* L num */ 1 + 1 /* T num */ + /* L str */ 'end of binary tests' +} + +{ + /* L call */ (f()) /* T call */ + /* L id */ f() /* T args */ + /* L str */ 'end of call tests' +} + +{ + /* L class */ (class C {}) /* T class */ + /* L var decl */ let c = class C {} /* T class body */ + /* L str */ 'end of class tests' +} + +{ + /* L conditional */ (true ? 1 : 2) /* T conditional */ + /* L bool */ true ? 1 : 2 /* T num */ + /* L str */ 'end of conditional tests' +} + +{ + /* L func */ (function(){}) /* T func */ + /* L var decl */ let f = function(){} /* T block */ + /* L str */ 'end of function tests' +} + +{ + /* L id */ x /* T id */ + /* L str */ 'end of identifier tests' +} + +{ + /* L import */ import('') /* T import */ + /* L str */ 'end of import tests' +} + +{ + /* L JSX element */
/* T JSX element */ + /* L str */ 'end of JSX element tests' +} + +{ + /* L JSX fragment */ <>
/* T JSX fragment */ + /* L str */ 'end of JSX fragment tests' +} + +{ + /* L num */ 1 /* T num */ + /* L str */ 'end of literal tests' +} + +{ + /* L logical */ (true || false) /* T logical */ + /* L bool */ true || false /* T bool */ + /* L str */ 'end of logical tests' +} + +{ + /* L member */ (obj.prop) /* T member */ + /* L id */ obj.prop /* T id */ + /* L id */ obj[prop] /* T member */ + /* L str */ 'end of member tests' +} + +{ + /* L new */ new Test() /* T args */ + /* L str */ 'end of new tests' +} + +{ + /* L obj */ ({}) /* T obj */ + /* L str */ 'end of object tests' +} + +{ + /* L sequence */ (1, 1) /* T sequence */ + /* L num */ 1, 1 /* T num */ + /* L str */ 'end of sequence tests' +} + +{ + /* L template literal */ `template` /* T template literal */ + /* L str */ 'end of template literal tests' +} + +{ + /* L tagged template */ (tag`template`) /* T tagged template */ + /* L id */ tag`template` /* T template literal */ + /* L str */ 'end of tagged template tests' +} + +{ + /* L this */ this /* T this */ + /* L str */ 'end of this tests' +} + +{ + /* L type cast */ (1: number) /* T type cast */ + /* L str */ 'end of type cast tests' +} + +{ + /* L unary */ (!true) /* T unary */ + /* L unary */ !true /* T bool */ + /* L str */ 'end of unary tests' +} + +{ + /* L update */ (++x) /* T update */ + /* L update */ ++x /* T id */ + /* L id */ x++ /* T update */ + /* L str */ 'end of update tests' +} + +function metaProperty() { + /* L meta property */ (new.target) /* T meta property */ + /* L id */ new.target /* T id */ + + /* L str */ 'end of meta property tests' +} + +function* generator() { + /* Leading yield */ (yield 1) /* Trailing yield */ + /* L yield */ yield 1 /* T num */ + + /* L str */ 'end of yield tests' +} diff --git a/lib/test/flow/comment_interning/remove_expression_trailing_comments.options.json b/lib/test/flow/comment_interning/remove_expression_trailing_comments.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/remove_expression_trailing_comments.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/remove_expression_trailing_comments.tree.json b/lib/test/flow/comment_interning/remove_expression_trailing_comments.tree.json new file mode 100644 index 0000000..74a099d --- /dev/null +++ b/lib/test/flow/comment_interning/remove_expression_trailing_comments.tree.json @@ -0,0 +1,3247 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":152,"column":1}}, + "range":[0,2995], + "body":[ + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,71], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":18}}, + "range":[18,20], + "expression":{ + "type":"ArrayExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":32}}, + "range":[21,34], + "value":" T array " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, + "range":[4,17], + "value":" L array " + } + ], + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":18}}, + "range":[18,20], + "elements":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":3,"column":14},"end":{"line":3,"column":34}}, + "range":[49,69], + "expression":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":13}}, + "range":[37,48], + "value":" L str " + } + ], + "loc":{"source":null,"start":{"line":3,"column":14},"end":{"line":3,"column":34}}, + "range":[49,69], + "value":"end of array tests", + "raw":"'end of array tests'" + }, + "directive":null + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":6,"column":0},"end":{"line":9,"column":1}}, + "range":[73,148], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":7,"column":17},"end":{"line":7,"column":24}}, + "range":[92,99], + "expression":{ + "type":"ArrowFunctionExpression", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":2},"end":{"line":7,"column":16}}, + "range":[77,91], + "value":" L params " + } + ], + "loc":{"source":null,"start":{"line":7,"column":17},"end":{"line":7,"column":24}}, + "range":[92,99], + "id":null, + "params":[], + "body":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":25},"end":{"line":7,"column":36}}, + "range":[100,111], + "value":" T num " + } + ], + "loc":{"source":null,"start":{"line":7,"column":23},"end":{"line":7,"column":24}}, + "range":[98,99], + "value":1, + "raw":"1" + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":null, + "typeParameters":null + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":8,"column":14},"end":{"line":8,"column":34}}, + "range":[126,146], + "expression":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":2},"end":{"line":8,"column":13}}, + "range":[114,125], + "value":" L str " + } + ], + "loc":{"source":null,"start":{"line":8,"column":14},"end":{"line":8,"column":34}}, + "range":[126,146], + "value":"end of arrow tests", + "raw":"'end of arrow tests'" + }, + "directive":null + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":14,"column":1}}, + "range":[150,242], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":12,"column":16},"end":{"line":12,"column":25}}, + "range":[168,177], + "expression":{ + "type":"ArrowFunctionExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":26},"end":{"line":12,"column":39}}, + "range":[178,191], + "value":" T arrow " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":2},"end":{"line":12,"column":15}}, + "range":[154,167], + "value":" L arrow " + } + ], + "loc":{"source":null,"start":{"line":12,"column":17},"end":{"line":12,"column":24}}, + "range":[169,176], + "id":null, + "params":[], + "body":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":12,"column":23},"end":{"line":12,"column":24}}, + "range":[175,176], + "value":1, + "raw":"1" + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":null, + "typeParameters":null + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":13,"column":14},"end":{"line":13,"column":48}}, + "range":[206,240], + "expression":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":2},"end":{"line":13,"column":13}}, + "range":[194,205], + "value":" L str " + } + ], + "loc":{"source":null,"start":{"line":13,"column":14},"end":{"line":13,"column":48}}, + "range":[206,240], + "value":"end of parenthesized arrow tests", + "raw":"'end of parenthesized arrow tests'" + }, + "directive":null + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":16,"column":0},"end":{"line":20,"column":1}}, + "range":[244,354], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":17,"column":17},"end":{"line":17,"column":24}}, + "range":[263,270], + "expression":{ + "type":"AssignmentExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":25},"end":{"line":17,"column":39}}, + "range":[271,285], + "value":" T assign " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":2},"end":{"line":17,"column":16}}, + "range":[248,262], + "value":" L assign " + } + ], + "loc":{"source":null,"start":{"line":17,"column":18},"end":{"line":17,"column":23}}, + "range":[264,269], + "operator":"=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":17,"column":18},"end":{"line":17,"column":19}}, + "range":[264,265], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":17,"column":22},"end":{"line":17,"column":23}}, + "range":[268,269], + "value":1, + "raw":"1" + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":18,"column":13},"end":{"line":18,"column":18}}, + "range":[299,304], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":18,"column":13},"end":{"line":18,"column":18}}, + "range":[299,304], + "operator":"=", + "left":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":18,"column":12}}, + "range":[288,298], + "value":" L id " + } + ], + "loc":{"source":null,"start":{"line":18,"column":13},"end":{"line":18,"column":14}}, + "range":[299,300], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":19},"end":{"line":18,"column":30}}, + "range":[305,316], + "value":" T num " + } + ], + "loc":{"source":null,"start":{"line":18,"column":17},"end":{"line":18,"column":18}}, + "range":[303,304], + "value":1, + "raw":"1" + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":19,"column":14},"end":{"line":19,"column":35}}, + "range":[331,352], + "expression":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":2},"end":{"line":19,"column":13}}, + "range":[319,330], + "value":" L str " + } + ], + "loc":{"source":null,"start":{"line":19,"column":14},"end":{"line":19,"column":35}}, + "range":[331,352], + "value":"end of assign tests", + "raw":"'end of assign tests'" + }, + "directive":null + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":22,"column":0},"end":{"line":26,"column":1}}, + "range":[356,467], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":23,"column":17},"end":{"line":23,"column":24}}, + "range":[375,382], + "expression":{ + "type":"BinaryExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":25},"end":{"line":23,"column":39}}, + "range":[383,397], + "value":" T binary " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":2},"end":{"line":23,"column":16}}, + "range":[360,374], + "value":" L binary " + } + ], + "loc":{"source":null,"start":{"line":23,"column":18},"end":{"line":23,"column":23}}, + "range":[376,381], + "operator":"+", + "left":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":23,"column":18},"end":{"line":23,"column":19}}, + "range":[376,377], + "value":1, + "raw":"1" + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":23,"column":22},"end":{"line":23,"column":23}}, + "range":[380,381], + "value":1, + "raw":"1" + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":24,"column":14},"end":{"line":24,"column":19}}, + "range":[412,417], + "expression":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":24,"column":14},"end":{"line":24,"column":19}}, + "range":[412,417], + "operator":"+", + "left":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":2},"end":{"line":24,"column":13}}, + "range":[400,411], + "value":" L num " + } + ], + "loc":{"source":null,"start":{"line":24,"column":14},"end":{"line":24,"column":15}}, + "range":[412,413], + "value":1, + "raw":"1" + }, + "right":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":20},"end":{"line":24,"column":31}}, + "range":[418,429], + "value":" T num " + } + ], + "loc":{"source":null,"start":{"line":24,"column":18},"end":{"line":24,"column":19}}, + "range":[416,417], + "value":1, + "raw":"1" + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":25,"column":14},"end":{"line":25,"column":35}}, + "range":[444,465], + "expression":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":2},"end":{"line":25,"column":13}}, + "range":[432,443], + "value":" L str " + } + ], + "loc":{"source":null,"start":{"line":25,"column":14},"end":{"line":25,"column":35}}, + "range":[444,465], + "value":"end of binary tests", + "raw":"'end of binary tests'" + }, + "directive":null + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":28,"column":0},"end":{"line":32,"column":1}}, + "range":[469,570], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":29,"column":15},"end":{"line":29,"column":20}}, + "range":[486,491], + "expression":{ + "type":"CallExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":21},"end":{"line":29,"column":33}}, + "range":[492,504], + "value":" T call " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":2},"end":{"line":29,"column":14}}, + "range":[473,485], + "value":" L call " + } + ], + "loc":{"source":null,"start":{"line":29,"column":16},"end":{"line":29,"column":19}}, + "range":[487,490], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":29,"column":16},"end":{"line":29,"column":17}}, + "range":[487,488], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":30,"column":13},"end":{"line":30,"column":16}}, + "range":[518,521], + "expression":{ + "type":"CallExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":17},"end":{"line":30,"column":29}}, + "range":[522,534], + "value":" T args " + } + ], + "loc":{"source":null,"start":{"line":30,"column":13},"end":{"line":30,"column":16}}, + "range":[518,521], + "callee":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":2},"end":{"line":30,"column":12}}, + "range":[507,517], + "value":" L id " + } + ], + "loc":{"source":null,"start":{"line":30,"column":13},"end":{"line":30,"column":14}}, + "range":[518,519], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":31,"column":14},"end":{"line":31,"column":33}}, + "range":[549,568], + "expression":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":2},"end":{"line":31,"column":13}}, + "range":[537,548], + "value":" L str " + } + ], + "loc":{"source":null,"start":{"line":31,"column":14},"end":{"line":31,"column":33}}, + "range":[549,568], + "value":"end of call tests", + "raw":"'end of call tests'" + }, + "directive":null + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":34,"column":0},"end":{"line":38,"column":1}}, + "range":[572,710], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":35,"column":16},"end":{"line":35,"column":28}}, + "range":[590,602], + "expression":{ + "type":"ClassExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":29},"end":{"line":35,"column":42}}, + "range":[603,616], + "value":" T class " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":2},"end":{"line":35,"column":15}}, + "range":[576,589], + "value":" L class " + } + ], + "loc":{"source":null,"start":{"line":35,"column":17},"end":{"line":35,"column":27}}, + "range":[591,601], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":35,"column":23},"end":{"line":35,"column":24}}, + "range":[597,598], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":35,"column":25},"end":{"line":35,"column":27}}, + "range":[599,601], + "body":[] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + "directive":null + }, + { + "type":"VariableDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":2},"end":{"line":36,"column":18}}, + "range":[619,635], + "value":" L var decl " + } + ], + "loc":{"source":null,"start":{"line":36,"column":19},"end":{"line":36,"column":37}}, + "range":[636,654], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":36,"column":23},"end":{"line":36,"column":37}}, + "range":[640,654], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":36,"column":23},"end":{"line":36,"column":24}}, + "range":[640,641], + "name":"c", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ClassExpression", + "loc":{"source":null,"start":{"line":36,"column":27},"end":{"line":36,"column":37}}, + "range":[644,654], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":36,"column":33},"end":{"line":36,"column":34}}, + "range":[650,651], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":38},"end":{"line":36,"column":56}}, + "range":[655,673], + "value":" T class body " + } + ], + "loc":{"source":null,"start":{"line":36,"column":35},"end":{"line":36,"column":37}}, + "range":[652,654], + "body":[] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + } + ], + "kind":"let" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":37,"column":14},"end":{"line":37,"column":34}}, + "range":[688,708], + "expression":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":37,"column":2},"end":{"line":37,"column":13}}, + "range":[676,687], + "value":" L str " + } + ], + "loc":{"source":null,"start":{"line":37,"column":14},"end":{"line":37,"column":34}}, + "range":[688,708], + "value":"end of class tests", + "raw":"'end of class tests'" + }, + "directive":null + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":40,"column":0},"end":{"line":44,"column":1}}, + "range":[712,853], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":41,"column":22},"end":{"line":41,"column":36}}, + "range":[736,750], + "expression":{ + "type":"ConditionalExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":41,"column":37},"end":{"line":41,"column":56}}, + "range":[751,770], + "value":" T conditional " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":41,"column":2},"end":{"line":41,"column":21}}, + "range":[716,735], + "value":" L conditional " + } + ], + "loc":{"source":null,"start":{"line":41,"column":23},"end":{"line":41,"column":35}}, + "range":[737,749], + "test":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":41,"column":23},"end":{"line":41,"column":27}}, + "range":[737,741], + "value":true, + "raw":"true" + }, + "consequent":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":41,"column":30},"end":{"line":41,"column":31}}, + "range":[744,745], + "value":1, + "raw":"1" + }, + "alternate":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":41,"column":34},"end":{"line":41,"column":35}}, + "range":[748,749], + "value":2, + "raw":"2" + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":42,"column":15},"end":{"line":42,"column":27}}, + "range":[786,798], + "expression":{ + "type":"ConditionalExpression", + "loc":{"source":null,"start":{"line":42,"column":15},"end":{"line":42,"column":27}}, + "range":[786,798], + "test":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":42,"column":2},"end":{"line":42,"column":14}}, + "range":[773,785], + "value":" L bool " + } + ], + "loc":{"source":null,"start":{"line":42,"column":15},"end":{"line":42,"column":19}}, + "range":[786,790], + "value":true, + "raw":"true" + }, + "consequent":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":42,"column":22},"end":{"line":42,"column":23}}, + "range":[793,794], + "value":1, + "raw":"1" + }, + "alternate":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":42,"column":28},"end":{"line":42,"column":39}}, + "range":[799,810], + "value":" T num " + } + ], + "loc":{"source":null,"start":{"line":42,"column":26},"end":{"line":42,"column":27}}, + "range":[797,798], + "value":2, + "raw":"2" + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":43,"column":14},"end":{"line":43,"column":40}}, + "range":[825,851], + "expression":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":43,"column":2},"end":{"line":43,"column":13}}, + "range":[813,824], + "value":" L str " + } + ], + "loc":{"source":null,"start":{"line":43,"column":14},"end":{"line":43,"column":40}}, + "range":[825,851], + "value":"end of conditional tests", + "raw":"'end of conditional tests'" + }, + "directive":null + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":46,"column":0},"end":{"line":50,"column":1}}, + "range":[855,993], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":47,"column":15},"end":{"line":47,"column":29}}, + "range":[872,886], + "expression":{ + "type":"FunctionExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":47,"column":30},"end":{"line":47,"column":42}}, + "range":[887,899], + "value":" T func " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":47,"column":2},"end":{"line":47,"column":14}}, + "range":[859,871], + "value":" L func " + } + ], + "loc":{"source":null,"start":{"line":47,"column":16},"end":{"line":47,"column":28}}, + "range":[873,885], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":47,"column":26},"end":{"line":47,"column":28}}, + "range":[883,885], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "directive":null + }, + { + "type":"VariableDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":48,"column":2},"end":{"line":48,"column":18}}, + "range":[902,918], + "value":" L var decl " + } + ], + "loc":{"source":null,"start":{"line":48,"column":19},"end":{"line":48,"column":39}}, + "range":[919,939], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":48,"column":23},"end":{"line":48,"column":39}}, + "range":[923,939], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":48,"column":23},"end":{"line":48,"column":24}}, + "range":[923,924], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":48,"column":27},"end":{"line":48,"column":39}}, + "range":[927,939], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":48,"column":40},"end":{"line":48,"column":53}}, + "range":[940,953], + "value":" T block " + } + ], + "loc":{"source":null,"start":{"line":48,"column":37},"end":{"line":48,"column":39}}, + "range":[937,939], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + } + ], + "kind":"let" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":49,"column":14},"end":{"line":49,"column":37}}, + "range":[968,991], + "expression":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":49,"column":2},"end":{"line":49,"column":13}}, + "range":[956,967], + "value":" L str " + } + ], + "loc":{"source":null,"start":{"line":49,"column":14},"end":{"line":49,"column":37}}, + "range":[968,991], + "value":"end of function tests", + "raw":"'end of function tests'" + }, + "directive":null + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":52,"column":0},"end":{"line":55,"column":1}}, + "range":[995,1064], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":53,"column":13},"end":{"line":53,"column":14}}, + "range":[1010,1011], + "expression":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":53,"column":15},"end":{"line":53,"column":25}}, + "range":[1012,1022], + "value":" T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":53,"column":2},"end":{"line":53,"column":12}}, + "range":[999,1009], + "value":" L id " + } + ], + "loc":{"source":null,"start":{"line":53,"column":13},"end":{"line":53,"column":14}}, + "range":[1010,1011], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":54,"column":14},"end":{"line":54,"column":39}}, + "range":[1037,1062], + "expression":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":54,"column":2},"end":{"line":54,"column":13}}, + "range":[1025,1036], + "value":" L str " + } + ], + "loc":{"source":null,"start":{"line":54,"column":14},"end":{"line":54,"column":39}}, + "range":[1037,1062], + "value":"end of identifier tests", + "raw":"'end of identifier tests'" + }, + "directive":null + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":57,"column":0},"end":{"line":60,"column":1}}, + "range":[1066,1148], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":58,"column":17},"end":{"line":58,"column":27}}, + "range":[1085,1095], + "expression":{ + "type":"ImportExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":58,"column":28},"end":{"line":58,"column":42}}, + "range":[1096,1110], + "value":" T import " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":58,"column":2},"end":{"line":58,"column":16}}, + "range":[1070,1084], + "value":" L import " + } + ], + "loc":{"source":null,"start":{"line":58,"column":17},"end":{"line":58,"column":27}}, + "range":[1085,1095], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":58,"column":24},"end":{"line":58,"column":26}}, + "range":[1092,1094], + "value":"", + "raw":"''" + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":59,"column":14},"end":{"line":59,"column":35}}, + "range":[1125,1146], + "expression":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":59,"column":2},"end":{"line":59,"column":13}}, + "range":[1113,1124], + "value":" L str " + } + ], + "loc":{"source":null,"start":{"line":59,"column":14},"end":{"line":59,"column":35}}, + "range":[1125,1146], + "value":"end of import tests", + "raw":"'end of import tests'" + }, + "directive":null + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":62,"column":0},"end":{"line":65,"column":1}}, + "range":[1150,1244], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":63,"column":22},"end":{"line":63,"column":29}}, + "range":[1174,1181], + "expression":{ + "type":"JSXElement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":63,"column":30},"end":{"line":63,"column":49}}, + "range":[1182,1201], + "value":" T JSX element " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":63,"column":2},"end":{"line":63,"column":21}}, + "range":[1154,1173], + "value":" L JSX element " + } + ], + "loc":{"source":null,"start":{"line":63,"column":22},"end":{"line":63,"column":29}}, + "range":[1174,1181], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":63,"column":22},"end":{"line":63,"column":29}}, + "range":[1174,1181], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":63,"column":23},"end":{"line":63,"column":26}}, + "range":[1175,1178], + "name":"div" + }, + "attributes":[], + "selfClosing":true + }, + "closingElement":null, + "children":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":64,"column":14},"end":{"line":64,"column":40}}, + "range":[1216,1242], + "expression":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":64,"column":2},"end":{"line":64,"column":13}}, + "range":[1204,1215], + "value":" L str " + } + ], + "loc":{"source":null,"start":{"line":64,"column":14},"end":{"line":64,"column":40}}, + "range":[1216,1242], + "value":"end of JSX element tests", + "raw":"'end of JSX element tests'" + }, + "directive":null + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":67,"column":0},"end":{"line":70,"column":1}}, + "range":[1246,1348], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":68,"column":23},"end":{"line":68,"column":35}}, + "range":[1271,1283], + "expression":{ + "type":"JSXFragment", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":68,"column":36},"end":{"line":68,"column":56}}, + "range":[1284,1304], + "value":" T JSX fragment " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":68,"column":2},"end":{"line":68,"column":22}}, + "range":[1250,1270], + "value":" L JSX fragment " + } + ], + "loc":{"source":null,"start":{"line":68,"column":23},"end":{"line":68,"column":35}}, + "range":[1271,1283], + "openingFragment":{ + "type":"JSXOpeningFragment", + "loc":{"source":null,"start":{"line":68,"column":23},"end":{"line":68,"column":25}}, + "range":[1271,1273] + }, + "children":[ + { + "type":"JSXElement", + "loc":{"source":null,"start":{"line":68,"column":25},"end":{"line":68,"column":32}}, + "range":[1273,1280], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":68,"column":25},"end":{"line":68,"column":32}}, + "range":[1273,1280], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":68,"column":26},"end":{"line":68,"column":29}}, + "range":[1274,1277], + "name":"div" + }, + "attributes":[], + "selfClosing":true + }, + "closingElement":null, + "children":[] + } + ], + "closingFragment":{ + "type":"JSXClosingFragment", + "loc":{"source":null,"start":{"line":68,"column":32},"end":{"line":68,"column":35}}, + "range":[1280,1283] + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":69,"column":14},"end":{"line":69,"column":41}}, + "range":[1319,1346], + "expression":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":69,"column":2},"end":{"line":69,"column":13}}, + "range":[1307,1318], + "value":" L str " + } + ], + "loc":{"source":null,"start":{"line":69,"column":14},"end":{"line":69,"column":41}}, + "range":[1319,1346], + "value":"end of JSX fragment tests", + "raw":"'end of JSX fragment tests'" + }, + "directive":null + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":72,"column":0},"end":{"line":75,"column":1}}, + "range":[1350,1418], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":73,"column":14},"end":{"line":73,"column":15}}, + "range":[1366,1367], + "expression":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":73,"column":16},"end":{"line":73,"column":27}}, + "range":[1368,1379], + "value":" T num " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":73,"column":2},"end":{"line":73,"column":13}}, + "range":[1354,1365], + "value":" L num " + } + ], + "loc":{"source":null,"start":{"line":73,"column":14},"end":{"line":73,"column":15}}, + "range":[1366,1367], + "value":1, + "raw":"1" + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":74,"column":14},"end":{"line":74,"column":36}}, + "range":[1394,1416], + "expression":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":74,"column":2},"end":{"line":74,"column":13}}, + "range":[1382,1393], + "value":" L str " + } + ], + "loc":{"source":null,"start":{"line":74,"column":14},"end":{"line":74,"column":36}}, + "range":[1394,1416], + "value":"end of literal tests", + "raw":"'end of literal tests'" + }, + "directive":null + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":77,"column":0},"end":{"line":81,"column":1}}, + "range":[1420,1552], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":78,"column":18},"end":{"line":78,"column":33}}, + "range":[1440,1455], + "expression":{ + "type":"LogicalExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":78,"column":34},"end":{"line":78,"column":49}}, + "range":[1456,1471], + "value":" T logical " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":78,"column":2},"end":{"line":78,"column":17}}, + "range":[1424,1439], + "value":" L logical " + } + ], + "loc":{"source":null,"start":{"line":78,"column":19},"end":{"line":78,"column":32}}, + "range":[1441,1454], + "operator":"||", + "left":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":78,"column":19},"end":{"line":78,"column":23}}, + "range":[1441,1445], + "value":true, + "raw":"true" + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":78,"column":27},"end":{"line":78,"column":32}}, + "range":[1449,1454], + "value":false, + "raw":"false" + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":79,"column":15},"end":{"line":79,"column":28}}, + "range":[1487,1500], + "expression":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":79,"column":15},"end":{"line":79,"column":28}}, + "range":[1487,1500], + "operator":"||", + "left":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":79,"column":2},"end":{"line":79,"column":14}}, + "range":[1474,1486], + "value":" L bool " + } + ], + "loc":{"source":null,"start":{"line":79,"column":15},"end":{"line":79,"column":19}}, + "range":[1487,1491], + "value":true, + "raw":"true" + }, + "right":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":79,"column":29},"end":{"line":79,"column":41}}, + "range":[1501,1513], + "value":" T bool " + } + ], + "loc":{"source":null,"start":{"line":79,"column":23},"end":{"line":79,"column":28}}, + "range":[1495,1500], + "value":false, + "raw":"false" + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":80,"column":14},"end":{"line":80,"column":36}}, + "range":[1528,1550], + "expression":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":80,"column":2},"end":{"line":80,"column":13}}, + "range":[1516,1527], + "value":" L str " + } + ], + "loc":{"source":null,"start":{"line":80,"column":14},"end":{"line":80,"column":36}}, + "range":[1528,1550], + "value":"end of logical tests", + "raw":"'end of logical tests'" + }, + "directive":null + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":83,"column":0},"end":{"line":88,"column":1}}, + "range":[1554,1707], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":84,"column":17},"end":{"line":84,"column":27}}, + "range":[1573,1583], + "expression":{ + "type":"MemberExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":84,"column":28},"end":{"line":84,"column":42}}, + "range":[1584,1598], + "value":" T member " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":84,"column":2},"end":{"line":84,"column":16}}, + "range":[1558,1572], + "value":" L member " + } + ], + "loc":{"source":null,"start":{"line":84,"column":18},"end":{"line":84,"column":26}}, + "range":[1574,1582], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":84,"column":18},"end":{"line":84,"column":21}}, + "range":[1574,1577], + "name":"obj", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":84,"column":22},"end":{"line":84,"column":26}}, + "range":[1578,1582], + "name":"prop", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":85,"column":13},"end":{"line":85,"column":21}}, + "range":[1612,1620], + "expression":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":85,"column":13},"end":{"line":85,"column":21}}, + "range":[1612,1620], + "object":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":85,"column":2},"end":{"line":85,"column":12}}, + "range":[1601,1611], + "value":" L id " + } + ], + "loc":{"source":null,"start":{"line":85,"column":13},"end":{"line":85,"column":16}}, + "range":[1612,1615], + "name":"obj", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":85,"column":22},"end":{"line":85,"column":32}}, + "range":[1621,1631], + "value":" T id " + } + ], + "loc":{"source":null,"start":{"line":85,"column":17},"end":{"line":85,"column":21}}, + "range":[1616,1620], + "name":"prop", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":86,"column":13},"end":{"line":86,"column":22}}, + "range":[1645,1654], + "expression":{ + "type":"MemberExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":86,"column":23},"end":{"line":86,"column":37}}, + "range":[1655,1669], + "value":" T member " + } + ], + "loc":{"source":null,"start":{"line":86,"column":13},"end":{"line":86,"column":22}}, + "range":[1645,1654], + "object":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":86,"column":2},"end":{"line":86,"column":12}}, + "range":[1634,1644], + "value":" L id " + } + ], + "loc":{"source":null,"start":{"line":86,"column":13},"end":{"line":86,"column":16}}, + "range":[1645,1648], + "name":"obj", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":86,"column":17},"end":{"line":86,"column":21}}, + "range":[1649,1653], + "name":"prop", + "typeAnnotation":null, + "optional":false + }, + "computed":true + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":87,"column":14},"end":{"line":87,"column":35}}, + "range":[1684,1705], + "expression":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":87,"column":2},"end":{"line":87,"column":13}}, + "range":[1672,1683], + "value":" L str " + } + ], + "loc":{"source":null,"start":{"line":87,"column":14},"end":{"line":87,"column":35}}, + "range":[1684,1705], + "value":"end of member tests", + "raw":"'end of member tests'" + }, + "directive":null + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":90,"column":0},"end":{"line":93,"column":1}}, + "range":[1709,1783], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":91,"column":14},"end":{"line":91,"column":24}}, + "range":[1725,1735], + "expression":{ + "type":"NewExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":91,"column":25},"end":{"line":91,"column":37}}, + "range":[1736,1748], + "value":" T args " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":91,"column":2},"end":{"line":91,"column":13}}, + "range":[1713,1724], + "value":" L new " + } + ], + "loc":{"source":null,"start":{"line":91,"column":14},"end":{"line":91,"column":24}}, + "range":[1725,1735], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":91,"column":18},"end":{"line":91,"column":22}}, + "range":[1729,1733], + "name":"Test", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":92,"column":14},"end":{"line":92,"column":32}}, + "range":[1763,1781], + "expression":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":92,"column":2},"end":{"line":92,"column":13}}, + "range":[1751,1762], + "value":" L str " + } + ], + "loc":{"source":null,"start":{"line":92,"column":14},"end":{"line":92,"column":32}}, + "range":[1763,1781], + "value":"end of new tests", + "raw":"'end of new tests'" + }, + "directive":null + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":95,"column":0},"end":{"line":98,"column":1}}, + "range":[1785,1855], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":96,"column":14},"end":{"line":96,"column":18}}, + "range":[1801,1805], + "expression":{ + "type":"ObjectExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":96,"column":19},"end":{"line":96,"column":30}}, + "range":[1806,1817], + "value":" T obj " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":96,"column":2},"end":{"line":96,"column":13}}, + "range":[1789,1800], + "value":" L obj " + } + ], + "loc":{"source":null,"start":{"line":96,"column":15},"end":{"line":96,"column":17}}, + "range":[1802,1804], + "properties":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":97,"column":14},"end":{"line":97,"column":35}}, + "range":[1832,1853], + "expression":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":97,"column":2},"end":{"line":97,"column":13}}, + "range":[1820,1831], + "value":" L str " + } + ], + "loc":{"source":null,"start":{"line":97,"column":14},"end":{"line":97,"column":35}}, + "range":[1832,1853], + "value":"end of object tests", + "raw":"'end of object tests'" + }, + "directive":null + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":100,"column":0},"end":{"line":104,"column":1}}, + "range":[1857,1972], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":101,"column":19},"end":{"line":101,"column":25}}, + "range":[1878,1884], + "expression":{ + "type":"SequenceExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":101,"column":26},"end":{"line":101,"column":42}}, + "range":[1885,1901], + "value":" T sequence " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":101,"column":2},"end":{"line":101,"column":18}}, + "range":[1861,1877], + "value":" L sequence " + } + ], + "loc":{"source":null,"start":{"line":101,"column":20},"end":{"line":101,"column":24}}, + "range":[1879,1883], + "expressions":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":101,"column":20},"end":{"line":101,"column":21}}, + "range":[1879,1880], + "value":1, + "raw":"1" + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":101,"column":23},"end":{"line":101,"column":24}}, + "range":[1882,1883], + "value":1, + "raw":"1" + } + ] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":102,"column":14},"end":{"line":102,"column":18}}, + "range":[1916,1920], + "expression":{ + "type":"SequenceExpression", + "loc":{"source":null,"start":{"line":102,"column":14},"end":{"line":102,"column":18}}, + "range":[1916,1920], + "expressions":[ + { + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":102,"column":2},"end":{"line":102,"column":13}}, + "range":[1904,1915], + "value":" L num " + } + ], + "loc":{"source":null,"start":{"line":102,"column":14},"end":{"line":102,"column":15}}, + "range":[1916,1917], + "value":1, + "raw":"1" + }, + { + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":102,"column":19},"end":{"line":102,"column":30}}, + "range":[1921,1932], + "value":" T num " + } + ], + "loc":{"source":null,"start":{"line":102,"column":17},"end":{"line":102,"column":18}}, + "range":[1919,1920], + "value":1, + "raw":"1" + } + ] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":103,"column":14},"end":{"line":103,"column":37}}, + "range":[1947,1970], + "expression":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":103,"column":2},"end":{"line":103,"column":13}}, + "range":[1935,1946], + "value":" L str " + } + ], + "loc":{"source":null,"start":{"line":103,"column":14},"end":{"line":103,"column":37}}, + "range":[1947,1970], + "value":"end of sequence tests", + "raw":"'end of sequence tests'" + }, + "directive":null + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":106,"column":0},"end":{"line":109,"column":1}}, + "range":[1974,2086], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":107,"column":27},"end":{"line":107,"column":37}}, + "range":[2003,2013], + "expression":{ + "type":"TemplateLiteral", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":107,"column":38},"end":{"line":107,"column":62}}, + "range":[2014,2038], + "value":" T template literal " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":107,"column":2},"end":{"line":107,"column":26}}, + "range":[1978,2002], + "value":" L template literal " + } + ], + "loc":{"source":null,"start":{"line":107,"column":27},"end":{"line":107,"column":37}}, + "range":[2003,2013], + "quasis":[ + { + "type":"TemplateElement", + "loc":{"source":null,"start":{"line":107,"column":27},"end":{"line":107,"column":37}}, + "range":[2003,2013], + "value":{"raw":"template","cooked":"template"}, + "tail":true + } + ], + "expressions":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":108,"column":14},"end":{"line":108,"column":45}}, + "range":[2053,2084], + "expression":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":108,"column":2},"end":{"line":108,"column":13}}, + "range":[2041,2052], + "value":" L str " + } + ], + "loc":{"source":null,"start":{"line":108,"column":14},"end":{"line":108,"column":45}}, + "range":[2053,2084], + "value":"end of template literal tests", + "raw":"'end of template literal tests'" + }, + "directive":null + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":111,"column":0},"end":{"line":115,"column":1}}, + "range":[2088,2254], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":112,"column":26},"end":{"line":112,"column":41}}, + "range":[2116,2131], + "expression":{ + "type":"TaggedTemplateExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":112,"column":42},"end":{"line":112,"column":65}}, + "range":[2132,2155], + "value":" T tagged template " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":112,"column":2},"end":{"line":112,"column":25}}, + "range":[2092,2115], + "value":" L tagged template " + } + ], + "loc":{"source":null,"start":{"line":112,"column":27},"end":{"line":112,"column":40}}, + "range":[2117,2130], + "tag":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":112,"column":27},"end":{"line":112,"column":30}}, + "range":[2117,2120], + "name":"tag", + "typeAnnotation":null, + "optional":false + }, + "quasi":{ + "type":"TemplateLiteral", + "loc":{"source":null,"start":{"line":112,"column":30},"end":{"line":112,"column":40}}, + "range":[2120,2130], + "quasis":[ + { + "type":"TemplateElement", + "loc":{"source":null,"start":{"line":112,"column":30},"end":{"line":112,"column":40}}, + "range":[2120,2130], + "value":{"raw":"template","cooked":"template"}, + "tail":true + } + ], + "expressions":[] + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":113,"column":13},"end":{"line":113,"column":26}}, + "range":[2169,2182], + "expression":{ + "type":"TaggedTemplateExpression", + "loc":{"source":null,"start":{"line":113,"column":13},"end":{"line":113,"column":26}}, + "range":[2169,2182], + "tag":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":113,"column":2},"end":{"line":113,"column":12}}, + "range":[2158,2168], + "value":" L id " + } + ], + "loc":{"source":null,"start":{"line":113,"column":13},"end":{"line":113,"column":16}}, + "range":[2169,2172], + "name":"tag", + "typeAnnotation":null, + "optional":false + }, + "quasi":{ + "type":"TemplateLiteral", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":113,"column":27},"end":{"line":113,"column":51}}, + "range":[2183,2207], + "value":" T template literal " + } + ], + "loc":{"source":null,"start":{"line":113,"column":16},"end":{"line":113,"column":26}}, + "range":[2172,2182], + "quasis":[ + { + "type":"TemplateElement", + "loc":{"source":null,"start":{"line":113,"column":16},"end":{"line":113,"column":26}}, + "range":[2172,2182], + "value":{"raw":"template","cooked":"template"}, + "tail":true + } + ], + "expressions":[] + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":114,"column":14},"end":{"line":114,"column":44}}, + "range":[2222,2252], + "expression":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":114,"column":2},"end":{"line":114,"column":13}}, + "range":[2210,2221], + "value":" L str " + } + ], + "loc":{"source":null,"start":{"line":114,"column":14},"end":{"line":114,"column":44}}, + "range":[2222,2252], + "value":"end of tagged template tests", + "raw":"'end of tagged template tests'" + }, + "directive":null + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":117,"column":0},"end":{"line":120,"column":1}}, + "range":[2256,2326], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":118,"column":15},"end":{"line":118,"column":19}}, + "range":[2273,2277], + "expression":{ + "type":"ThisExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":118,"column":20},"end":{"line":118,"column":32}}, + "range":[2278,2290], + "value":" T this " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":118,"column":2},"end":{"line":118,"column":14}}, + "range":[2260,2272], + "value":" L this " + } + ], + "loc":{"source":null,"start":{"line":118,"column":15},"end":{"line":118,"column":19}}, + "range":[2273,2277] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":119,"column":14},"end":{"line":119,"column":33}}, + "range":[2305,2324], + "expression":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":119,"column":2},"end":{"line":119,"column":13}}, + "range":[2293,2304], + "value":" L str " + } + ], + "loc":{"source":null,"start":{"line":119,"column":14},"end":{"line":119,"column":33}}, + "range":[2305,2324], + "value":"end of this tests", + "raw":"'end of this tests'" + }, + "directive":null + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":122,"column":0},"end":{"line":125,"column":1}}, + "range":[2328,2420], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":123,"column":20},"end":{"line":123,"column":31}}, + "range":[2350,2361], + "expression":{ + "type":"TypeCastExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":123,"column":32},"end":{"line":123,"column":49}}, + "range":[2362,2379], + "value":" T type cast " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":123,"column":2},"end":{"line":123,"column":19}}, + "range":[2332,2349], + "value":" L type cast " + } + ], + "loc":{"source":null,"start":{"line":123,"column":20},"end":{"line":123,"column":31}}, + "range":[2350,2361], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":123,"column":21},"end":{"line":123,"column":22}}, + "range":[2351,2352], + "value":1, + "raw":"1" + }, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":123,"column":22},"end":{"line":123,"column":30}}, + "range":[2352,2360], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":123,"column":24},"end":{"line":123,"column":30}}, + "range":[2354,2360] + } + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":124,"column":14},"end":{"line":124,"column":38}}, + "range":[2394,2418], + "expression":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":124,"column":2},"end":{"line":124,"column":13}}, + "range":[2382,2393], + "value":" L str " + } + ], + "loc":{"source":null,"start":{"line":124,"column":14},"end":{"line":124,"column":38}}, + "range":[2394,2418], + "value":"end of type cast tests", + "raw":"'end of type cast tests'" + }, + "directive":null + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":127,"column":0},"end":{"line":131,"column":1}}, + "range":[2422,2533], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":128,"column":16},"end":{"line":128,"column":23}}, + "range":[2440,2447], + "expression":{ + "type":"UnaryExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":128,"column":24},"end":{"line":128,"column":37}}, + "range":[2448,2461], + "value":" T unary " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":128,"column":2},"end":{"line":128,"column":15}}, + "range":[2426,2439], + "value":" L unary " + } + ], + "loc":{"source":null,"start":{"line":128,"column":17},"end":{"line":128,"column":22}}, + "range":[2441,2446], + "operator":"!", + "prefix":true, + "argument":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":128,"column":18},"end":{"line":128,"column":22}}, + "range":[2442,2446], + "value":true, + "raw":"true" + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":129,"column":16},"end":{"line":129,"column":21}}, + "range":[2478,2483], + "expression":{ + "type":"UnaryExpression", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":129,"column":2},"end":{"line":129,"column":15}}, + "range":[2464,2477], + "value":" L unary " + } + ], + "loc":{"source":null,"start":{"line":129,"column":16},"end":{"line":129,"column":21}}, + "range":[2478,2483], + "operator":"!", + "prefix":true, + "argument":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":129,"column":22},"end":{"line":129,"column":34}}, + "range":[2484,2496], + "value":" T bool " + } + ], + "loc":{"source":null,"start":{"line":129,"column":17},"end":{"line":129,"column":21}}, + "range":[2479,2483], + "value":true, + "raw":"true" + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":130,"column":14},"end":{"line":130,"column":34}}, + "range":[2511,2531], + "expression":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":130,"column":2},"end":{"line":130,"column":13}}, + "range":[2499,2510], + "value":" L str " + } + ], + "loc":{"source":null,"start":{"line":130,"column":14},"end":{"line":130,"column":34}}, + "range":[2511,2531], + "value":"end of unary tests", + "raw":"'end of unary tests'" + }, + "directive":null + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":133,"column":0},"end":{"line":138,"column":1}}, + "range":[2535,2676], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":134,"column":17},"end":{"line":134,"column":22}}, + "range":[2554,2559], + "expression":{ + "type":"UpdateExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":134,"column":23},"end":{"line":134,"column":37}}, + "range":[2560,2574], + "value":" T update " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":134,"column":2},"end":{"line":134,"column":16}}, + "range":[2539,2553], + "value":" L update " + } + ], + "loc":{"source":null,"start":{"line":134,"column":18},"end":{"line":134,"column":21}}, + "range":[2555,2558], + "operator":"++", + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":134,"column":20},"end":{"line":134,"column":21}}, + "range":[2557,2558], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "prefix":true + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":135,"column":17},"end":{"line":135,"column":20}}, + "range":[2592,2595], + "expression":{ + "type":"UpdateExpression", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":135,"column":2},"end":{"line":135,"column":16}}, + "range":[2577,2591], + "value":" L update " + } + ], + "loc":{"source":null,"start":{"line":135,"column":17},"end":{"line":135,"column":20}}, + "range":[2592,2595], + "operator":"++", + "argument":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":135,"column":21},"end":{"line":135,"column":31}}, + "range":[2596,2606], + "value":" T id " + } + ], + "loc":{"source":null,"start":{"line":135,"column":19},"end":{"line":135,"column":20}}, + "range":[2594,2595], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "prefix":true + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":136,"column":13},"end":{"line":136,"column":16}}, + "range":[2620,2623], + "expression":{ + "type":"UpdateExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":136,"column":17},"end":{"line":136,"column":31}}, + "range":[2624,2638], + "value":" T update " + } + ], + "loc":{"source":null,"start":{"line":136,"column":13},"end":{"line":136,"column":16}}, + "range":[2620,2623], + "operator":"++", + "argument":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":136,"column":2},"end":{"line":136,"column":12}}, + "range":[2609,2619], + "value":" L id " + } + ], + "loc":{"source":null,"start":{"line":136,"column":13},"end":{"line":136,"column":14}}, + "range":[2620,2621], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "prefix":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":137,"column":14},"end":{"line":137,"column":35}}, + "range":[2653,2674], + "expression":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":137,"column":2},"end":{"line":137,"column":13}}, + "range":[2641,2652], + "value":" L str " + } + ], + "loc":{"source":null,"start":{"line":137,"column":14},"end":{"line":137,"column":35}}, + "range":[2653,2674], + "value":"end of update tests", + "raw":"'end of update tests'" + }, + "directive":null + } + ] + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":140,"column":0},"end":{"line":145,"column":1}}, + "range":[2678,2843], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":140,"column":9},"end":{"line":140,"column":21}}, + "range":[2687,2699], + "name":"metaProperty", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":140,"column":24},"end":{"line":145,"column":1}}, + "range":[2702,2843], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":141,"column":24},"end":{"line":141,"column":36}}, + "range":[2728,2740], + "expression":{ + "type":"MetaProperty", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":141,"column":37},"end":{"line":141,"column":58}}, + "range":[2741,2762], + "value":" T meta property " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":141,"column":2},"end":{"line":141,"column":23}}, + "range":[2706,2727], + "value":" L meta property " + } + ], + "loc":{"source":null,"start":{"line":141,"column":25},"end":{"line":141,"column":35}}, + "range":[2729,2739], + "meta":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":141,"column":25},"end":{"line":141,"column":28}}, + "range":[2729,2732], + "name":"new", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":141,"column":29},"end":{"line":141,"column":35}}, + "range":[2733,2739], + "name":"target", + "typeAnnotation":null, + "optional":false + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":142,"column":13},"end":{"line":142,"column":23}}, + "range":[2776,2786], + "expression":{ + "type":"MetaProperty", + "loc":{"source":null,"start":{"line":142,"column":13},"end":{"line":142,"column":23}}, + "range":[2776,2786], + "meta":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":142,"column":2},"end":{"line":142,"column":12}}, + "range":[2765,2775], + "value":" L id " + } + ], + "loc":{"source":null,"start":{"line":142,"column":13},"end":{"line":142,"column":16}}, + "range":[2776,2779], + "name":"new", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":142,"column":24},"end":{"line":142,"column":34}}, + "range":[2787,2797], + "value":" T id " + } + ], + "loc":{"source":null,"start":{"line":142,"column":17},"end":{"line":142,"column":23}}, + "range":[2780,2786], + "name":"target", + "typeAnnotation":null, + "optional":false + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":144,"column":14},"end":{"line":144,"column":42}}, + "range":[2813,2841], + "expression":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":144,"column":2},"end":{"line":144,"column":13}}, + "range":[2801,2812], + "value":" L str " + } + ], + "loc":{"source":null,"start":{"line":144,"column":14},"end":{"line":144,"column":42}}, + "range":[2813,2841], + "value":"end of meta property tests", + "raw":"'end of meta property tests'" + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":147,"column":0},"end":{"line":152,"column":1}}, + "range":[2845,2995], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":147,"column":10},"end":{"line":147,"column":19}}, + "range":[2855,2864], + "name":"generator", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":147,"column":22},"end":{"line":152,"column":1}}, + "range":[2867,2995], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":148,"column":22},"end":{"line":148,"column":31}}, + "range":[2891,2900], + "expression":{ + "type":"YieldExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":148,"column":32},"end":{"line":148,"column":52}}, + "range":[2901,2921], + "value":" Trailing yield " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":148,"column":2},"end":{"line":148,"column":21}}, + "range":[2871,2890], + "value":" Leading yield " + } + ], + "loc":{"source":null,"start":{"line":148,"column":23},"end":{"line":148,"column":30}}, + "range":[2892,2899], + "argument":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":148,"column":29},"end":{"line":148,"column":30}}, + "range":[2898,2899], + "value":1, + "raw":"1" + }, + "delegate":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":149,"column":16},"end":{"line":149,"column":23}}, + "range":[2938,2945], + "expression":{ + "type":"YieldExpression", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":149,"column":2},"end":{"line":149,"column":15}}, + "range":[2924,2937], + "value":" L yield " + } + ], + "loc":{"source":null,"start":{"line":149,"column":16},"end":{"line":149,"column":23}}, + "range":[2938,2945], + "argument":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":149,"column":24},"end":{"line":149,"column":35}}, + "range":[2946,2957], + "value":" T num " + } + ], + "loc":{"source":null,"start":{"line":149,"column":22},"end":{"line":149,"column":23}}, + "range":[2944,2945], + "value":1, + "raw":"1" + }, + "delegate":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":151,"column":14},"end":{"line":151,"column":34}}, + "range":[2973,2993], + "expression":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":151,"column":2},"end":{"line":151,"column":13}}, + "range":[2961,2972], + "value":" L str " + } + ], + "loc":{"source":null,"start":{"line":151,"column":14},"end":{"line":151,"column":34}}, + "range":[2973,2993], + "value":"end of yield tests", + "raw":"'end of yield tests'" + }, + "directive":null + } + ] + }, + "async":false, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, + "range":[4,17], + "value":" L array " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":32}}, + "range":[21,34], + "value":" T array " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":13}}, + "range":[37,48], + "value":" L str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":2},"end":{"line":7,"column":16}}, + "range":[77,91], + "value":" L params " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":25},"end":{"line":7,"column":36}}, + "range":[100,111], + "value":" T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":2},"end":{"line":8,"column":13}}, + "range":[114,125], + "value":" L str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":2},"end":{"line":12,"column":15}}, + "range":[154,167], + "value":" L arrow " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":26},"end":{"line":12,"column":39}}, + "range":[178,191], + "value":" T arrow " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":2},"end":{"line":13,"column":13}}, + "range":[194,205], + "value":" L str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":2},"end":{"line":17,"column":16}}, + "range":[248,262], + "value":" L assign " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":25},"end":{"line":17,"column":39}}, + "range":[271,285], + "value":" T assign " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":18,"column":12}}, + "range":[288,298], + "value":" L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":19},"end":{"line":18,"column":30}}, + "range":[305,316], + "value":" T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":2},"end":{"line":19,"column":13}}, + "range":[319,330], + "value":" L str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":2},"end":{"line":23,"column":16}}, + "range":[360,374], + "value":" L binary " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":25},"end":{"line":23,"column":39}}, + "range":[383,397], + "value":" T binary " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":2},"end":{"line":24,"column":13}}, + "range":[400,411], + "value":" L num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":20},"end":{"line":24,"column":31}}, + "range":[418,429], + "value":" T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":2},"end":{"line":25,"column":13}}, + "range":[432,443], + "value":" L str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":2},"end":{"line":29,"column":14}}, + "range":[473,485], + "value":" L call " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":21},"end":{"line":29,"column":33}}, + "range":[492,504], + "value":" T call " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":2},"end":{"line":30,"column":12}}, + "range":[507,517], + "value":" L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":17},"end":{"line":30,"column":29}}, + "range":[522,534], + "value":" T args " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":2},"end":{"line":31,"column":13}}, + "range":[537,548], + "value":" L str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":2},"end":{"line":35,"column":15}}, + "range":[576,589], + "value":" L class " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":29},"end":{"line":35,"column":42}}, + "range":[603,616], + "value":" T class " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":2},"end":{"line":36,"column":18}}, + "range":[619,635], + "value":" L var decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":38},"end":{"line":36,"column":56}}, + "range":[655,673], + "value":" T class body " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":37,"column":2},"end":{"line":37,"column":13}}, + "range":[676,687], + "value":" L str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":41,"column":2},"end":{"line":41,"column":21}}, + "range":[716,735], + "value":" L conditional " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":41,"column":37},"end":{"line":41,"column":56}}, + "range":[751,770], + "value":" T conditional " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":42,"column":2},"end":{"line":42,"column":14}}, + "range":[773,785], + "value":" L bool " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":42,"column":28},"end":{"line":42,"column":39}}, + "range":[799,810], + "value":" T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":43,"column":2},"end":{"line":43,"column":13}}, + "range":[813,824], + "value":" L str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":47,"column":2},"end":{"line":47,"column":14}}, + "range":[859,871], + "value":" L func " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":47,"column":30},"end":{"line":47,"column":42}}, + "range":[887,899], + "value":" T func " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":48,"column":2},"end":{"line":48,"column":18}}, + "range":[902,918], + "value":" L var decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":48,"column":40},"end":{"line":48,"column":53}}, + "range":[940,953], + "value":" T block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":49,"column":2},"end":{"line":49,"column":13}}, + "range":[956,967], + "value":" L str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":53,"column":2},"end":{"line":53,"column":12}}, + "range":[999,1009], + "value":" L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":53,"column":15},"end":{"line":53,"column":25}}, + "range":[1012,1022], + "value":" T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":54,"column":2},"end":{"line":54,"column":13}}, + "range":[1025,1036], + "value":" L str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":58,"column":2},"end":{"line":58,"column":16}}, + "range":[1070,1084], + "value":" L import " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":58,"column":28},"end":{"line":58,"column":42}}, + "range":[1096,1110], + "value":" T import " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":59,"column":2},"end":{"line":59,"column":13}}, + "range":[1113,1124], + "value":" L str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":63,"column":2},"end":{"line":63,"column":21}}, + "range":[1154,1173], + "value":" L JSX element " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":63,"column":30},"end":{"line":63,"column":49}}, + "range":[1182,1201], + "value":" T JSX element " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":64,"column":2},"end":{"line":64,"column":13}}, + "range":[1204,1215], + "value":" L str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":68,"column":2},"end":{"line":68,"column":22}}, + "range":[1250,1270], + "value":" L JSX fragment " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":68,"column":36},"end":{"line":68,"column":56}}, + "range":[1284,1304], + "value":" T JSX fragment " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":69,"column":2},"end":{"line":69,"column":13}}, + "range":[1307,1318], + "value":" L str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":73,"column":2},"end":{"line":73,"column":13}}, + "range":[1354,1365], + "value":" L num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":73,"column":16},"end":{"line":73,"column":27}}, + "range":[1368,1379], + "value":" T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":74,"column":2},"end":{"line":74,"column":13}}, + "range":[1382,1393], + "value":" L str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":78,"column":2},"end":{"line":78,"column":17}}, + "range":[1424,1439], + "value":" L logical " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":78,"column":34},"end":{"line":78,"column":49}}, + "range":[1456,1471], + "value":" T logical " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":79,"column":2},"end":{"line":79,"column":14}}, + "range":[1474,1486], + "value":" L bool " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":79,"column":29},"end":{"line":79,"column":41}}, + "range":[1501,1513], + "value":" T bool " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":80,"column":2},"end":{"line":80,"column":13}}, + "range":[1516,1527], + "value":" L str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":84,"column":2},"end":{"line":84,"column":16}}, + "range":[1558,1572], + "value":" L member " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":84,"column":28},"end":{"line":84,"column":42}}, + "range":[1584,1598], + "value":" T member " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":85,"column":2},"end":{"line":85,"column":12}}, + "range":[1601,1611], + "value":" L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":85,"column":22},"end":{"line":85,"column":32}}, + "range":[1621,1631], + "value":" T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":86,"column":2},"end":{"line":86,"column":12}}, + "range":[1634,1644], + "value":" L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":86,"column":23},"end":{"line":86,"column":37}}, + "range":[1655,1669], + "value":" T member " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":87,"column":2},"end":{"line":87,"column":13}}, + "range":[1672,1683], + "value":" L str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":91,"column":2},"end":{"line":91,"column":13}}, + "range":[1713,1724], + "value":" L new " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":91,"column":25},"end":{"line":91,"column":37}}, + "range":[1736,1748], + "value":" T args " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":92,"column":2},"end":{"line":92,"column":13}}, + "range":[1751,1762], + "value":" L str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":96,"column":2},"end":{"line":96,"column":13}}, + "range":[1789,1800], + "value":" L obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":96,"column":19},"end":{"line":96,"column":30}}, + "range":[1806,1817], + "value":" T obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":97,"column":2},"end":{"line":97,"column":13}}, + "range":[1820,1831], + "value":" L str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":101,"column":2},"end":{"line":101,"column":18}}, + "range":[1861,1877], + "value":" L sequence " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":101,"column":26},"end":{"line":101,"column":42}}, + "range":[1885,1901], + "value":" T sequence " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":102,"column":2},"end":{"line":102,"column":13}}, + "range":[1904,1915], + "value":" L num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":102,"column":19},"end":{"line":102,"column":30}}, + "range":[1921,1932], + "value":" T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":103,"column":2},"end":{"line":103,"column":13}}, + "range":[1935,1946], + "value":" L str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":107,"column":2},"end":{"line":107,"column":26}}, + "range":[1978,2002], + "value":" L template literal " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":107,"column":38},"end":{"line":107,"column":62}}, + "range":[2014,2038], + "value":" T template literal " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":108,"column":2},"end":{"line":108,"column":13}}, + "range":[2041,2052], + "value":" L str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":112,"column":2},"end":{"line":112,"column":25}}, + "range":[2092,2115], + "value":" L tagged template " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":112,"column":42},"end":{"line":112,"column":65}}, + "range":[2132,2155], + "value":" T tagged template " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":113,"column":2},"end":{"line":113,"column":12}}, + "range":[2158,2168], + "value":" L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":113,"column":27},"end":{"line":113,"column":51}}, + "range":[2183,2207], + "value":" T template literal " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":114,"column":2},"end":{"line":114,"column":13}}, + "range":[2210,2221], + "value":" L str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":118,"column":2},"end":{"line":118,"column":14}}, + "range":[2260,2272], + "value":" L this " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":118,"column":20},"end":{"line":118,"column":32}}, + "range":[2278,2290], + "value":" T this " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":119,"column":2},"end":{"line":119,"column":13}}, + "range":[2293,2304], + "value":" L str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":123,"column":2},"end":{"line":123,"column":19}}, + "range":[2332,2349], + "value":" L type cast " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":123,"column":32},"end":{"line":123,"column":49}}, + "range":[2362,2379], + "value":" T type cast " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":124,"column":2},"end":{"line":124,"column":13}}, + "range":[2382,2393], + "value":" L str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":128,"column":2},"end":{"line":128,"column":15}}, + "range":[2426,2439], + "value":" L unary " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":128,"column":24},"end":{"line":128,"column":37}}, + "range":[2448,2461], + "value":" T unary " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":129,"column":2},"end":{"line":129,"column":15}}, + "range":[2464,2477], + "value":" L unary " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":129,"column":22},"end":{"line":129,"column":34}}, + "range":[2484,2496], + "value":" T bool " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":130,"column":2},"end":{"line":130,"column":13}}, + "range":[2499,2510], + "value":" L str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":134,"column":2},"end":{"line":134,"column":16}}, + "range":[2539,2553], + "value":" L update " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":134,"column":23},"end":{"line":134,"column":37}}, + "range":[2560,2574], + "value":" T update " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":135,"column":2},"end":{"line":135,"column":16}}, + "range":[2577,2591], + "value":" L update " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":135,"column":21},"end":{"line":135,"column":31}}, + "range":[2596,2606], + "value":" T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":136,"column":2},"end":{"line":136,"column":12}}, + "range":[2609,2619], + "value":" L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":136,"column":17},"end":{"line":136,"column":31}}, + "range":[2624,2638], + "value":" T update " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":137,"column":2},"end":{"line":137,"column":13}}, + "range":[2641,2652], + "value":" L str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":141,"column":2},"end":{"line":141,"column":23}}, + "range":[2706,2727], + "value":" L meta property " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":141,"column":37},"end":{"line":141,"column":58}}, + "range":[2741,2762], + "value":" T meta property " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":142,"column":2},"end":{"line":142,"column":12}}, + "range":[2765,2775], + "value":" L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":142,"column":24},"end":{"line":142,"column":34}}, + "range":[2787,2797], + "value":" T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":144,"column":2},"end":{"line":144,"column":13}}, + "range":[2801,2812], + "value":" L str " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":148,"column":2},"end":{"line":148,"column":21}}, + "range":[2871,2890], + "value":" Leading yield " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":148,"column":32},"end":{"line":148,"column":52}}, + "range":[2901,2921], + "value":" Trailing yield " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":149,"column":2},"end":{"line":149,"column":15}}, + "range":[2924,2937], + "value":" L yield " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":149,"column":24},"end":{"line":149,"column":35}}, + "range":[2946,2957], + "value":" T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":151,"column":2},"end":{"line":151,"column":13}}, + "range":[2961,2972], + "value":" L str " + } + ] +} diff --git a/lib/test/flow/comment_interning/remove_type_trailing_comments.js b/lib/test/flow/comment_interning/remove_type_trailing_comments.js new file mode 100644 index 0000000..f2a328c --- /dev/null +++ b/lib/test/flow/comment_interning/remove_type_trailing_comments.js @@ -0,0 +1,60 @@ +/* L alias */ type T = any /* T any */ + +/* L alias */ type T = mixed /* T mixed */ + +/* L alias */ type T = empty /* T empty */ + +/* L alias */ type T = void /* T void */ + +/* L alias */ type T = null /* T null */ + +/* L alias */ type T = number /* T number */ + +/* L alias */ type T = bigint /* T bigint */ + +/* L alias */ type T = string /* T string */ + +/* L alias */ type T = boolean /* T boolean */ + +/* L alias */ type T = symbol /* T symbol */ + +/* L alias */ type T = * /* T exists */ + +/* L alias */ type T = (?any) /* T nullable */ +/* L alias */ type T = ?any /* T any */ + +/* L alias */ type T = (() => void) /* T func */ +/* L alias */ type T = () => void /* T void */ + +/* L alias */ type T = {} /* T obj */ + +/* L alias */ type T = (interface {}) /* T interface */ +/* L alias */ type T = interface {} /* T obj */ + +/* L alias */ type T = any[] /* T array */ + +/* L alias */ type T = (Foo) /* T generic */ +/* L alias */ type T = Foo /* T id */ +/* L alias */ type T = Foo.Bar /* T id */ +/* L alias */ type T = Foo /* T targs */ + +/* L alias */ type T = (string | number) /* T union */ +/* L alias */ type T = string | number /* T number */ +/* L alias */ type T = string | number | boolean | mixed /* T mixed */ + +/* L alias */ type T = (string & number) /* T intersection */ +/* L alias */ type T = string & number /* T number */ +/* L alias */ type T = string & number & boolean & mixed /* T mixed */ + +/* L alias */ type T = (typeof Foo) /* T typeof */ +/* L alias */ type T = typeof Foo /* T id */ + +/* L alias */ type T = [any] /* T tuple */ + +/* L alias */ type T = 'string' /* T str lit */ + +/* L alias */ type T = 1 /* T num lit */ + +/* L alias */ type T = 1n /* T bigint lit */ + +/* L alias */ type T = true /* T bool lit */ diff --git a/lib/test/flow/comment_interning/remove_type_trailing_comments.options.json b/lib/test/flow/comment_interning/remove_type_trailing_comments.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/remove_type_trailing_comments.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/remove_type_trailing_comments.tree.json b/lib/test/flow/comment_interning/remove_type_trailing_comments.tree.json new file mode 100644 index 0000000..06ceb56 --- /dev/null +++ b/lib/test/flow/comment_interning/remove_type_trailing_comments.tree.json @@ -0,0 +1,1964 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":60,"column":27}}, + "range":[14,1702], + "body":[ + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":26}}, + "range":[14,26], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "range":[19,20], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":38}}, + "range":[27,38], + "value":" T any " + } + ], + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":26}}, + "range":[23,26] + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":13}}, + "range":[40,53], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":3,"column":14},"end":{"line":3,"column":28}}, + "range":[54,68], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":19},"end":{"line":3,"column":20}}, + "range":[59,60], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"MixedTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":29},"end":{"line":3,"column":42}}, + "range":[69,82], + "value":" T mixed " + } + ], + "loc":{"source":null,"start":{"line":3,"column":23},"end":{"line":3,"column":28}}, + "range":[63,68] + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":13}}, + "range":[84,97], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":5,"column":14},"end":{"line":5,"column":28}}, + "range":[98,112], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":19},"end":{"line":5,"column":20}}, + "range":[103,104], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"EmptyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":29},"end":{"line":5,"column":42}}, + "range":[113,126], + "value":" T empty " + } + ], + "loc":{"source":null,"start":{"line":5,"column":23},"end":{"line":5,"column":28}}, + "range":[107,112] + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":13}}, + "range":[128,141], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":7,"column":14},"end":{"line":7,"column":27}}, + "range":[142,155], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":19},"end":{"line":7,"column":20}}, + "range":[147,148], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"VoidTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":28},"end":{"line":7,"column":40}}, + "range":[156,168], + "value":" T void " + } + ], + "loc":{"source":null,"start":{"line":7,"column":23},"end":{"line":7,"column":27}}, + "range":[151,155] + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":9,"column":13}}, + "range":[170,183], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":9,"column":14},"end":{"line":9,"column":27}}, + "range":[184,197], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":19},"end":{"line":9,"column":20}}, + "range":[189,190], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"NullLiteralTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":28},"end":{"line":9,"column":40}}, + "range":[198,210], + "value":" T null " + } + ], + "loc":{"source":null,"start":{"line":9,"column":23},"end":{"line":9,"column":27}}, + "range":[193,197] + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":11,"column":13}}, + "range":[212,225], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":11,"column":14},"end":{"line":11,"column":29}}, + "range":[226,241], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":11,"column":19},"end":{"line":11,"column":20}}, + "range":[231,232], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"NumberTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":30},"end":{"line":11,"column":44}}, + "range":[242,256], + "value":" T number " + } + ], + "loc":{"source":null,"start":{"line":11,"column":23},"end":{"line":11,"column":29}}, + "range":[235,241] + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":0},"end":{"line":13,"column":13}}, + "range":[258,271], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":13,"column":14},"end":{"line":13,"column":29}}, + "range":[272,287], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":13,"column":19},"end":{"line":13,"column":20}}, + "range":[277,278], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"BigIntTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":30},"end":{"line":13,"column":44}}, + "range":[288,302], + "value":" T bigint " + } + ], + "loc":{"source":null,"start":{"line":13,"column":23},"end":{"line":13,"column":29}}, + "range":[281,287] + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":0},"end":{"line":15,"column":13}}, + "range":[304,317], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":15,"column":14},"end":{"line":15,"column":29}}, + "range":[318,333], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":15,"column":19},"end":{"line":15,"column":20}}, + "range":[323,324], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"StringTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":30},"end":{"line":15,"column":44}}, + "range":[334,348], + "value":" T string " + } + ], + "loc":{"source":null,"start":{"line":15,"column":23},"end":{"line":15,"column":29}}, + "range":[327,333] + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":0},"end":{"line":17,"column":13}}, + "range":[350,363], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":17,"column":14},"end":{"line":17,"column":30}}, + "range":[364,380], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":17,"column":19},"end":{"line":17,"column":20}}, + "range":[369,370], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"BooleanTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":31},"end":{"line":17,"column":46}}, + "range":[381,396], + "value":" T boolean " + } + ], + "loc":{"source":null,"start":{"line":17,"column":23},"end":{"line":17,"column":30}}, + "range":[373,380] + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":0},"end":{"line":19,"column":13}}, + "range":[398,411], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":19,"column":14},"end":{"line":19,"column":29}}, + "range":[412,427], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":19,"column":19},"end":{"line":19,"column":20}}, + "range":[417,418], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"SymbolTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":30},"end":{"line":19,"column":44}}, + "range":[428,442], + "value":" T symbol " + } + ], + "loc":{"source":null,"start":{"line":19,"column":23},"end":{"line":19,"column":29}}, + "range":[421,427] + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":0},"end":{"line":21,"column":13}}, + "range":[444,457], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":21,"column":14},"end":{"line":21,"column":24}}, + "range":[458,468], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":21,"column":19},"end":{"line":21,"column":20}}, + "range":[463,464], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ExistsTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":25},"end":{"line":21,"column":39}}, + "range":[469,483], + "value":" T exists " + } + ], + "loc":{"source":null,"start":{"line":21,"column":23},"end":{"line":21,"column":24}}, + "range":[467,468] + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":0},"end":{"line":23,"column":13}}, + "range":[485,498], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":23,"column":14},"end":{"line":23,"column":29}}, + "range":[499,514], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":23,"column":19},"end":{"line":23,"column":20}}, + "range":[504,505], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"NullableTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":30},"end":{"line":23,"column":46}}, + "range":[515,531], + "value":" T nullable " + } + ], + "loc":{"source":null,"start":{"line":23,"column":24},"end":{"line":23,"column":28}}, + "range":[509,513], + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":23,"column":25},"end":{"line":23,"column":28}}, + "range":[510,513] + } + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":0},"end":{"line":24,"column":13}}, + "range":[532,545], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":24,"column":14},"end":{"line":24,"column":27}}, + "range":[546,559], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":24,"column":19},"end":{"line":24,"column":20}}, + "range":[551,552], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"NullableTypeAnnotation", + "loc":{"source":null,"start":{"line":24,"column":23},"end":{"line":24,"column":27}}, + "range":[555,559], + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":28},"end":{"line":24,"column":39}}, + "range":[560,571], + "value":" T any " + } + ], + "loc":{"source":null,"start":{"line":24,"column":24},"end":{"line":24,"column":27}}, + "range":[556,559] + } + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":0},"end":{"line":26,"column":13}}, + "range":[573,586], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":26,"column":14},"end":{"line":26,"column":35}}, + "range":[587,608], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":26,"column":19},"end":{"line":26,"column":20}}, + "range":[592,593], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":36},"end":{"line":26,"column":48}}, + "range":[609,621], + "value":" T func " + } + ], + "loc":{"source":null,"start":{"line":26,"column":24},"end":{"line":26,"column":34}}, + "range":[597,607], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":26,"column":30},"end":{"line":26,"column":34}}, + "range":[603,607] + }, + "rest":null, + "typeParameters":null + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":27,"column":0},"end":{"line":27,"column":13}}, + "range":[622,635], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":27,"column":14},"end":{"line":27,"column":33}}, + "range":[636,655], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":27,"column":19},"end":{"line":27,"column":20}}, + "range":[641,642], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":27,"column":23},"end":{"line":27,"column":33}}, + "range":[645,655], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":27,"column":34},"end":{"line":27,"column":46}}, + "range":[656,668], + "value":" T void " + } + ], + "loc":{"source":null,"start":{"line":27,"column":29},"end":{"line":27,"column":33}}, + "range":[651,655] + }, + "rest":null, + "typeParameters":null + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":0},"end":{"line":29,"column":13}}, + "range":[670,683], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":29,"column":14},"end":{"line":29,"column":25}}, + "range":[684,695], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":29,"column":19},"end":{"line":29,"column":20}}, + "range":[689,690], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":26},"end":{"line":29,"column":37}}, + "range":[696,707], + "value":" T obj " + } + ], + "loc":{"source":null,"start":{"line":29,"column":23},"end":{"line":29,"column":25}}, + "range":[693,695], + "inexact":false, + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":0},"end":{"line":31,"column":13}}, + "range":[709,722], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":31,"column":14},"end":{"line":31,"column":37}}, + "range":[723,746], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":31,"column":19},"end":{"line":31,"column":20}}, + "range":[728,729], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"InterfaceTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":38},"end":{"line":31,"column":55}}, + "range":[747,764], + "value":" T interface " + } + ], + "loc":{"source":null,"start":{"line":31,"column":24},"end":{"line":31,"column":36}}, + "range":[733,745], + "extends":[], + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":31,"column":34},"end":{"line":31,"column":36}}, + "range":[743,745], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":0},"end":{"line":32,"column":13}}, + "range":[765,778], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":32,"column":14},"end":{"line":32,"column":35}}, + "range":[779,800], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":32,"column":19},"end":{"line":32,"column":20}}, + "range":[784,785], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"InterfaceTypeAnnotation", + "loc":{"source":null,"start":{"line":32,"column":23},"end":{"line":32,"column":35}}, + "range":[788,800], + "extends":[], + "body":{ + "type":"ObjectTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":36},"end":{"line":32,"column":47}}, + "range":[801,812], + "value":" T obj " + } + ], + "loc":{"source":null,"start":{"line":32,"column":33},"end":{"line":32,"column":35}}, + "range":[798,800], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":0},"end":{"line":34,"column":13}}, + "range":[814,827], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":34,"column":14},"end":{"line":34,"column":28}}, + "range":[828,842], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":34,"column":19},"end":{"line":34,"column":20}}, + "range":[833,834], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ArrayTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":29},"end":{"line":34,"column":42}}, + "range":[843,856], + "value":" T array " + } + ], + "loc":{"source":null,"start":{"line":34,"column":23},"end":{"line":34,"column":28}}, + "range":[837,842], + "elementType":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":34,"column":23},"end":{"line":34,"column":26}}, + "range":[837,840] + } + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":0},"end":{"line":36,"column":13}}, + "range":[858,871], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":36,"column":14},"end":{"line":36,"column":28}}, + "range":[872,886], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":36,"column":19},"end":{"line":36,"column":20}}, + "range":[877,878], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"GenericTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":29},"end":{"line":36,"column":44}}, + "range":[887,902], + "value":" T generic " + } + ], + "loc":{"source":null,"start":{"line":36,"column":24},"end":{"line":36,"column":27}}, + "range":[882,885], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":36,"column":24},"end":{"line":36,"column":27}}, + "range":[882,885], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":37,"column":0},"end":{"line":37,"column":13}}, + "range":[903,916], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":37,"column":14},"end":{"line":37,"column":26}}, + "range":[917,929], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":37,"column":19},"end":{"line":37,"column":20}}, + "range":[922,923], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":37,"column":23},"end":{"line":37,"column":26}}, + "range":[926,929], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":37,"column":27},"end":{"line":37,"column":37}}, + "range":[930,940], + "value":" T id " + } + ], + "loc":{"source":null,"start":{"line":37,"column":23},"end":{"line":37,"column":26}}, + "range":[926,929], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":38,"column":0},"end":{"line":38,"column":13}}, + "range":[941,954], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":38,"column":14},"end":{"line":38,"column":30}}, + "range":[955,971], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":38,"column":19},"end":{"line":38,"column":20}}, + "range":[960,961], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":38,"column":23},"end":{"line":38,"column":30}}, + "range":[964,971], + "id":{ + "type":"QualifiedTypeIdentifier", + "loc":{"source":null,"start":{"line":38,"column":23},"end":{"line":38,"column":30}}, + "range":[964,971], + "qualification":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":38,"column":23},"end":{"line":38,"column":26}}, + "range":[964,967], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":38,"column":31},"end":{"line":38,"column":41}}, + "range":[972,982], + "value":" T id " + } + ], + "loc":{"source":null,"start":{"line":38,"column":27},"end":{"line":38,"column":30}}, + "range":[968,971], + "name":"Bar", + "typeAnnotation":null, + "optional":false + } + }, + "typeParameters":null + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":39,"column":0},"end":{"line":39,"column":13}}, + "range":[983,996], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":39,"column":14},"end":{"line":39,"column":29}}, + "range":[997,1012], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":39,"column":19},"end":{"line":39,"column":20}}, + "range":[1002,1003], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":39,"column":23},"end":{"line":39,"column":29}}, + "range":[1006,1012], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":39,"column":23},"end":{"line":39,"column":26}}, + "range":[1006,1009], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":39,"column":30},"end":{"line":39,"column":43}}, + "range":[1013,1026], + "value":" T targs " + } + ], + "loc":{"source":null,"start":{"line":39,"column":26},"end":{"line":39,"column":29}}, + "range":[1009,1012], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":39,"column":27},"end":{"line":39,"column":28}}, + "range":[1010,1011], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":39,"column":27},"end":{"line":39,"column":28}}, + "range":[1010,1011], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":41,"column":0},"end":{"line":41,"column":13}}, + "range":[1028,1041], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":41,"column":14},"end":{"line":41,"column":40}}, + "range":[1042,1068], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":41,"column":19},"end":{"line":41,"column":20}}, + "range":[1047,1048], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"UnionTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":41,"column":41},"end":{"line":41,"column":54}}, + "range":[1069,1082], + "value":" T union " + } + ], + "loc":{"source":null,"start":{"line":41,"column":24},"end":{"line":41,"column":39}}, + "range":[1052,1067], + "types":[ + { + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":41,"column":24},"end":{"line":41,"column":30}}, + "range":[1052,1058] + }, + { + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":41,"column":33},"end":{"line":41,"column":39}}, + "range":[1061,1067] + } + ] + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":42,"column":0},"end":{"line":42,"column":13}}, + "range":[1083,1096], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":42,"column":14},"end":{"line":42,"column":38}}, + "range":[1097,1121], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":42,"column":19},"end":{"line":42,"column":20}}, + "range":[1102,1103], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"UnionTypeAnnotation", + "loc":{"source":null,"start":{"line":42,"column":23},"end":{"line":42,"column":38}}, + "range":[1106,1121], + "types":[ + { + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":42,"column":23},"end":{"line":42,"column":29}}, + "range":[1106,1112] + }, + { + "type":"NumberTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":42,"column":39},"end":{"line":42,"column":53}}, + "range":[1122,1136], + "value":" T number " + } + ], + "loc":{"source":null,"start":{"line":42,"column":32},"end":{"line":42,"column":38}}, + "range":[1115,1121] + } + ] + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":43,"column":0},"end":{"line":43,"column":13}}, + "range":[1137,1150], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":43,"column":14},"end":{"line":43,"column":56}}, + "range":[1151,1193], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":43,"column":19},"end":{"line":43,"column":20}}, + "range":[1156,1157], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"UnionTypeAnnotation", + "loc":{"source":null,"start":{"line":43,"column":23},"end":{"line":43,"column":56}}, + "range":[1160,1193], + "types":[ + { + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":43,"column":23},"end":{"line":43,"column":29}}, + "range":[1160,1166] + }, + { + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":43,"column":32},"end":{"line":43,"column":38}}, + "range":[1169,1175] + }, + { + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":43,"column":41},"end":{"line":43,"column":48}}, + "range":[1178,1185] + }, + { + "type":"MixedTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":43,"column":57},"end":{"line":43,"column":70}}, + "range":[1194,1207], + "value":" T mixed " + } + ], + "loc":{"source":null,"start":{"line":43,"column":51},"end":{"line":43,"column":56}}, + "range":[1188,1193] + } + ] + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":45,"column":0},"end":{"line":45,"column":13}}, + "range":[1209,1222], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":45,"column":14},"end":{"line":45,"column":40}}, + "range":[1223,1249], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":45,"column":19},"end":{"line":45,"column":20}}, + "range":[1228,1229], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"IntersectionTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":45,"column":41},"end":{"line":45,"column":61}}, + "range":[1250,1270], + "value":" T intersection " + } + ], + "loc":{"source":null,"start":{"line":45,"column":24},"end":{"line":45,"column":39}}, + "range":[1233,1248], + "types":[ + { + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":45,"column":24},"end":{"line":45,"column":30}}, + "range":[1233,1239] + }, + { + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":45,"column":33},"end":{"line":45,"column":39}}, + "range":[1242,1248] + } + ] + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":46,"column":0},"end":{"line":46,"column":13}}, + "range":[1271,1284], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":46,"column":14},"end":{"line":46,"column":38}}, + "range":[1285,1309], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":46,"column":19},"end":{"line":46,"column":20}}, + "range":[1290,1291], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"IntersectionTypeAnnotation", + "loc":{"source":null,"start":{"line":46,"column":23},"end":{"line":46,"column":38}}, + "range":[1294,1309], + "types":[ + { + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":46,"column":23},"end":{"line":46,"column":29}}, + "range":[1294,1300] + }, + { + "type":"NumberTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":46,"column":39},"end":{"line":46,"column":53}}, + "range":[1310,1324], + "value":" T number " + } + ], + "loc":{"source":null,"start":{"line":46,"column":32},"end":{"line":46,"column":38}}, + "range":[1303,1309] + } + ] + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":47,"column":0},"end":{"line":47,"column":13}}, + "range":[1325,1338], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":47,"column":14},"end":{"line":47,"column":56}}, + "range":[1339,1381], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":47,"column":19},"end":{"line":47,"column":20}}, + "range":[1344,1345], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"IntersectionTypeAnnotation", + "loc":{"source":null,"start":{"line":47,"column":23},"end":{"line":47,"column":56}}, + "range":[1348,1381], + "types":[ + { + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":47,"column":23},"end":{"line":47,"column":29}}, + "range":[1348,1354] + }, + { + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":47,"column":32},"end":{"line":47,"column":38}}, + "range":[1357,1363] + }, + { + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":47,"column":41},"end":{"line":47,"column":48}}, + "range":[1366,1373] + }, + { + "type":"MixedTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":47,"column":57},"end":{"line":47,"column":70}}, + "range":[1382,1395], + "value":" T mixed " + } + ], + "loc":{"source":null,"start":{"line":47,"column":51},"end":{"line":47,"column":56}}, + "range":[1376,1381] + } + ] + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":49,"column":0},"end":{"line":49,"column":13}}, + "range":[1397,1410], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":49,"column":14},"end":{"line":49,"column":35}}, + "range":[1411,1432], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":49,"column":19},"end":{"line":49,"column":20}}, + "range":[1416,1417], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"TypeofTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":49,"column":36},"end":{"line":49,"column":50}}, + "range":[1433,1447], + "value":" T typeof " + } + ], + "loc":{"source":null,"start":{"line":49,"column":24},"end":{"line":49,"column":34}}, + "range":[1421,1431], + "argument":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":49,"column":31},"end":{"line":49,"column":34}}, + "range":[1428,1431], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":49,"column":31},"end":{"line":49,"column":34}}, + "range":[1428,1431], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":50,"column":0},"end":{"line":50,"column":13}}, + "range":[1448,1461], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":50,"column":14},"end":{"line":50,"column":33}}, + "range":[1462,1481], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":50,"column":19},"end":{"line":50,"column":20}}, + "range":[1467,1468], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"TypeofTypeAnnotation", + "loc":{"source":null,"start":{"line":50,"column":23},"end":{"line":50,"column":33}}, + "range":[1471,1481], + "argument":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":50,"column":30},"end":{"line":50,"column":33}}, + "range":[1478,1481], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":50,"column":34},"end":{"line":50,"column":44}}, + "range":[1482,1492], + "value":" T id " + } + ], + "loc":{"source":null,"start":{"line":50,"column":30},"end":{"line":50,"column":33}}, + "range":[1478,1481], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":52,"column":0},"end":{"line":52,"column":13}}, + "range":[1494,1507], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":52,"column":14},"end":{"line":52,"column":28}}, + "range":[1508,1522], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":52,"column":19},"end":{"line":52,"column":20}}, + "range":[1513,1514], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"TupleTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":52,"column":29},"end":{"line":52,"column":42}}, + "range":[1523,1536], + "value":" T tuple " + } + ], + "loc":{"source":null,"start":{"line":52,"column":23},"end":{"line":52,"column":28}}, + "range":[1517,1522], + "types":[ + { + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":52,"column":24},"end":{"line":52,"column":27}}, + "range":[1518,1521] + } + ] + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":54,"column":0},"end":{"line":54,"column":13}}, + "range":[1538,1551], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":54,"column":14},"end":{"line":54,"column":31}}, + "range":[1552,1569], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":54,"column":19},"end":{"line":54,"column":20}}, + "range":[1557,1558], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"StringLiteralTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":54,"column":32},"end":{"line":54,"column":47}}, + "range":[1570,1585], + "value":" T str lit " + } + ], + "loc":{"source":null,"start":{"line":54,"column":23},"end":{"line":54,"column":31}}, + "range":[1561,1569], + "value":"string", + "raw":"'string'" + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":56,"column":0},"end":{"line":56,"column":13}}, + "range":[1587,1600], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":56,"column":14},"end":{"line":56,"column":24}}, + "range":[1601,1611], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":56,"column":19},"end":{"line":56,"column":20}}, + "range":[1606,1607], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"NumberLiteralTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":56,"column":25},"end":{"line":56,"column":40}}, + "range":[1612,1627], + "value":" T num lit " + } + ], + "loc":{"source":null,"start":{"line":56,"column":23},"end":{"line":56,"column":24}}, + "range":[1610,1611], + "value":1, + "raw":"1" + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":58,"column":0},"end":{"line":58,"column":13}}, + "range":[1629,1642], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":58,"column":14},"end":{"line":58,"column":25}}, + "range":[1643,1654], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":58,"column":19},"end":{"line":58,"column":20}}, + "range":[1648,1649], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"BigIntLiteralTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":58,"column":26},"end":{"line":58,"column":44}}, + "range":[1655,1673], + "value":" T bigint lit " + } + ], + "loc":{"source":null,"start":{"line":58,"column":23},"end":{"line":58,"column":25}}, + "range":[1652,1654], + "value":null, + "raw":"1n" + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":60,"column":0},"end":{"line":60,"column":13}}, + "range":[1675,1688], + "value":" L alias " + } + ], + "loc":{"source":null,"start":{"line":60,"column":14},"end":{"line":60,"column":27}}, + "range":[1689,1702], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":60,"column":19},"end":{"line":60,"column":20}}, + "range":[1694,1695], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"BooleanLiteralTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":60,"column":28},"end":{"line":60,"column":44}}, + "range":[1703,1719], + "value":" T bool lit " + } + ], + "loc":{"source":null,"start":{"line":60,"column":23},"end":{"line":60,"column":27}}, + "range":[1698,1702], + "value":true, + "raw":"true" + } + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":38}}, + "range":[27,38], + "value":" T any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":13}}, + "range":[40,53], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":29},"end":{"line":3,"column":42}}, + "range":[69,82], + "value":" T mixed " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":13}}, + "range":[84,97], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":29},"end":{"line":5,"column":42}}, + "range":[113,126], + "value":" T empty " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":13}}, + "range":[128,141], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":28},"end":{"line":7,"column":40}}, + "range":[156,168], + "value":" T void " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":9,"column":13}}, + "range":[170,183], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":28},"end":{"line":9,"column":40}}, + "range":[198,210], + "value":" T null " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":11,"column":13}}, + "range":[212,225], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":30},"end":{"line":11,"column":44}}, + "range":[242,256], + "value":" T number " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":0},"end":{"line":13,"column":13}}, + "range":[258,271], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":30},"end":{"line":13,"column":44}}, + "range":[288,302], + "value":" T bigint " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":0},"end":{"line":15,"column":13}}, + "range":[304,317], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":30},"end":{"line":15,"column":44}}, + "range":[334,348], + "value":" T string " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":0},"end":{"line":17,"column":13}}, + "range":[350,363], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":31},"end":{"line":17,"column":46}}, + "range":[381,396], + "value":" T boolean " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":0},"end":{"line":19,"column":13}}, + "range":[398,411], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":30},"end":{"line":19,"column":44}}, + "range":[428,442], + "value":" T symbol " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":0},"end":{"line":21,"column":13}}, + "range":[444,457], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":25},"end":{"line":21,"column":39}}, + "range":[469,483], + "value":" T exists " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":0},"end":{"line":23,"column":13}}, + "range":[485,498], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":23,"column":30},"end":{"line":23,"column":46}}, + "range":[515,531], + "value":" T nullable " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":0},"end":{"line":24,"column":13}}, + "range":[532,545], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":28},"end":{"line":24,"column":39}}, + "range":[560,571], + "value":" T any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":0},"end":{"line":26,"column":13}}, + "range":[573,586], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":36},"end":{"line":26,"column":48}}, + "range":[609,621], + "value":" T func " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":27,"column":0},"end":{"line":27,"column":13}}, + "range":[622,635], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":27,"column":34},"end":{"line":27,"column":46}}, + "range":[656,668], + "value":" T void " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":0},"end":{"line":29,"column":13}}, + "range":[670,683], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":26},"end":{"line":29,"column":37}}, + "range":[696,707], + "value":" T obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":0},"end":{"line":31,"column":13}}, + "range":[709,722], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":38},"end":{"line":31,"column":55}}, + "range":[747,764], + "value":" T interface " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":0},"end":{"line":32,"column":13}}, + "range":[765,778], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":36},"end":{"line":32,"column":47}}, + "range":[801,812], + "value":" T obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":0},"end":{"line":34,"column":13}}, + "range":[814,827], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":29},"end":{"line":34,"column":42}}, + "range":[843,856], + "value":" T array " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":0},"end":{"line":36,"column":13}}, + "range":[858,871], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":29},"end":{"line":36,"column":44}}, + "range":[887,902], + "value":" T generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":37,"column":0},"end":{"line":37,"column":13}}, + "range":[903,916], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":37,"column":27},"end":{"line":37,"column":37}}, + "range":[930,940], + "value":" T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":38,"column":0},"end":{"line":38,"column":13}}, + "range":[941,954], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":38,"column":31},"end":{"line":38,"column":41}}, + "range":[972,982], + "value":" T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":39,"column":0},"end":{"line":39,"column":13}}, + "range":[983,996], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":39,"column":30},"end":{"line":39,"column":43}}, + "range":[1013,1026], + "value":" T targs " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":41,"column":0},"end":{"line":41,"column":13}}, + "range":[1028,1041], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":41,"column":41},"end":{"line":41,"column":54}}, + "range":[1069,1082], + "value":" T union " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":42,"column":0},"end":{"line":42,"column":13}}, + "range":[1083,1096], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":42,"column":39},"end":{"line":42,"column":53}}, + "range":[1122,1136], + "value":" T number " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":43,"column":0},"end":{"line":43,"column":13}}, + "range":[1137,1150], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":43,"column":57},"end":{"line":43,"column":70}}, + "range":[1194,1207], + "value":" T mixed " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":45,"column":0},"end":{"line":45,"column":13}}, + "range":[1209,1222], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":45,"column":41},"end":{"line":45,"column":61}}, + "range":[1250,1270], + "value":" T intersection " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":46,"column":0},"end":{"line":46,"column":13}}, + "range":[1271,1284], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":46,"column":39},"end":{"line":46,"column":53}}, + "range":[1310,1324], + "value":" T number " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":47,"column":0},"end":{"line":47,"column":13}}, + "range":[1325,1338], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":47,"column":57},"end":{"line":47,"column":70}}, + "range":[1382,1395], + "value":" T mixed " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":49,"column":0},"end":{"line":49,"column":13}}, + "range":[1397,1410], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":49,"column":36},"end":{"line":49,"column":50}}, + "range":[1433,1447], + "value":" T typeof " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":50,"column":0},"end":{"line":50,"column":13}}, + "range":[1448,1461], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":50,"column":34},"end":{"line":50,"column":44}}, + "range":[1482,1492], + "value":" T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":52,"column":0},"end":{"line":52,"column":13}}, + "range":[1494,1507], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":52,"column":29},"end":{"line":52,"column":42}}, + "range":[1523,1536], + "value":" T tuple " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":54,"column":0},"end":{"line":54,"column":13}}, + "range":[1538,1551], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":54,"column":32},"end":{"line":54,"column":47}}, + "range":[1570,1585], + "value":" T str lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":56,"column":0},"end":{"line":56,"column":13}}, + "range":[1587,1600], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":56,"column":25},"end":{"line":56,"column":40}}, + "range":[1612,1627], + "value":" T num lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":58,"column":0},"end":{"line":58,"column":13}}, + "range":[1629,1642], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":58,"column":26},"end":{"line":58,"column":44}}, + "range":[1655,1673], + "value":" T bigint lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":60,"column":0},"end":{"line":60,"column":13}}, + "range":[1675,1688], + "value":" L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":60,"column":28},"end":{"line":60,"column":44}}, + "range":[1703,1719], + "value":" T bool lit " + } + ] +} diff --git a/lib/test/flow/comment_interning/return.js b/lib/test/flow/comment_interning/return.js new file mode 100644 index 0000000..f421868 --- /dev/null +++ b/lib/test/flow/comment_interning/return.js @@ -0,0 +1,19 @@ +function withExpression() { + /* 1.1 Leading return */ return /* 1.2 Leading num */ 1 /* 1.3 Trailing num */; /* 1.4 Trailing return */ +} + +function withoutExpression() { + /* 2.1 Leading return */ return /* 2.2 Trailing return */ ; /* 2.3 Trailing return */ +} + +function implicitSemicolonWithExpression() { + /* 3.1 L return */ return 1 /* 3.2 T num */ + /* 3.3 L return */ return 1 + /* 3.4 T num */ +} + +function implicitSemicolonWithoutExpression() { + /* 4.1 L return */ return /* 4.2 T return */ + /* 4.3 L return */ return + /* 4.4 T return */ +} diff --git a/lib/test/flow/comment_interning/return.options.json b/lib/test/flow/comment_interning/return.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/return.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/return.tree.json b/lib/test/flow/comment_interning/return.tree.json new file mode 100644 index 0000000..6e32041 --- /dev/null +++ b/lib/test/flow/comment_interning/return.tree.json @@ -0,0 +1,379 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":19,"column":1}}, + "range":[0,548], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,137], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":23}}, + "range":[9,23], + "name":"withExpression", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":3,"column":1}}, + "range":[26,137], + "body":[ + { + "type":"ReturnStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":82},"end":{"line":2,"column":107}}, + "range":[110,135], + "value":" 1.4 Trailing return " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":26}}, + "range":[30,54], + "value":" 1.1 Leading return " + } + ], + "loc":{"source":null,"start":{"line":2,"column":27},"end":{"line":2,"column":81}}, + "range":[55,109], + "argument":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":58},"end":{"line":2,"column":80}}, + "range":[86,108], + "value":" 1.3 Trailing num " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":34},"end":{"line":2,"column":55}}, + "range":[62,83], + "value":" 1.2 Leading num " + } + ], + "loc":{"source":null,"start":{"line":2,"column":56},"end":{"line":2,"column":57}}, + "range":[84,85], + "value":1, + "raw":"1" + } + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":7,"column":1}}, + "range":[139,259], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":9},"end":{"line":5,"column":26}}, + "range":[148,165], + "name":"withoutExpression", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":5,"column":29},"end":{"line":7,"column":1}}, + "range":[168,259], + "body":[ + { + "type":"ReturnStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":34},"end":{"line":6,"column":59}}, + "range":[204,229], + "value":" 2.2 Trailing return " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":62},"end":{"line":6,"column":87}}, + "range":[232,257], + "value":" 2.3 Trailing return " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":26}}, + "range":[172,196], + "value":" 2.1 Leading return " + } + ], + "loc":{"source":null,"start":{"line":6,"column":27},"end":{"line":6,"column":61}}, + "range":[197,231], + "argument":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":13,"column":1}}, + "range":[261,401], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":9},"end":{"line":9,"column":40}}, + "range":[270,301], + "name":"implicitSemicolonWithExpression", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":9,"column":43},"end":{"line":13,"column":1}}, + "range":[304,401], + "body":[ + { + "type":"ReturnStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":2},"end":{"line":10,"column":20}}, + "range":[308,326], + "value":" 3.1 L return " + } + ], + "loc":{"source":null,"start":{"line":10,"column":21},"end":{"line":10,"column":29}}, + "range":[327,335], + "argument":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":30},"end":{"line":10,"column":45}}, + "range":[336,351], + "value":" 3.2 T num " + } + ], + "loc":{"source":null,"start":{"line":10,"column":28},"end":{"line":10,"column":29}}, + "range":[334,335], + "value":1, + "raw":"1" + } + }, + { + "type":"ReturnStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":2},"end":{"line":11,"column":20}}, + "range":[354,372], + "value":" 3.3 L return " + } + ], + "loc":{"source":null,"start":{"line":11,"column":21},"end":{"line":11,"column":29}}, + "range":[373,381], + "argument":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":2},"end":{"line":12,"column":17}}, + "range":[384,399], + "value":" 3.4 T num " + } + ], + "loc":{"source":null,"start":{"line":11,"column":28},"end":{"line":11,"column":29}}, + "range":[380,381], + "value":1, + "raw":"1" + } + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":15,"column":0},"end":{"line":19,"column":1}}, + "range":[403,548], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":15,"column":9},"end":{"line":15,"column":43}}, + "range":[412,446], + "name":"implicitSemicolonWithoutExpression", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":15,"column":46},"end":{"line":19,"column":1}}, + "range":[449,548], + "body":[ + { + "type":"ReturnStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":28},"end":{"line":16,"column":46}}, + "range":[479,497], + "value":" 4.2 T return " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":2},"end":{"line":16,"column":20}}, + "range":[453,471], + "value":" 4.1 L return " + } + ], + "loc":{"source":null,"start":{"line":16,"column":21},"end":{"line":16,"column":27}}, + "range":[472,478], + "argument":null + }, + { + "type":"ReturnStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":18,"column":20}}, + "range":[528,546], + "value":" 4.4 T return " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":2},"end":{"line":17,"column":20}}, + "range":[500,518], + "value":" 4.3 L return " + } + ], + "loc":{"source":null,"start":{"line":17,"column":21},"end":{"line":17,"column":27}}, + "range":[519,525], + "argument":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":26}}, + "range":[30,54], + "value":" 1.1 Leading return " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":34},"end":{"line":2,"column":55}}, + "range":[62,83], + "value":" 1.2 Leading num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":58},"end":{"line":2,"column":80}}, + "range":[86,108], + "value":" 1.3 Trailing num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":82},"end":{"line":2,"column":107}}, + "range":[110,135], + "value":" 1.4 Trailing return " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":26}}, + "range":[172,196], + "value":" 2.1 Leading return " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":34},"end":{"line":6,"column":59}}, + "range":[204,229], + "value":" 2.2 Trailing return " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":62},"end":{"line":6,"column":87}}, + "range":[232,257], + "value":" 2.3 Trailing return " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":2},"end":{"line":10,"column":20}}, + "range":[308,326], + "value":" 3.1 L return " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":30},"end":{"line":10,"column":45}}, + "range":[336,351], + "value":" 3.2 T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":2},"end":{"line":11,"column":20}}, + "range":[354,372], + "value":" 3.3 L return " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":2},"end":{"line":12,"column":17}}, + "range":[384,399], + "value":" 3.4 T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":2},"end":{"line":16,"column":20}}, + "range":[453,471], + "value":" 4.1 L return " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":28},"end":{"line":16,"column":46}}, + "range":[479,497], + "value":" 4.2 T return " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":2},"end":{"line":17,"column":20}}, + "range":[500,518], + "value":" 4.3 L return " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":18,"column":20}}, + "range":[528,546], + "value":" 4.4 T return " + } + ] +} diff --git a/lib/test/flow/comment_interning/sequence.js b/lib/test/flow/comment_interning/sequence.js new file mode 100644 index 0000000..95990e4 --- /dev/null +++ b/lib/test/flow/comment_interning/sequence.js @@ -0,0 +1,7 @@ +function parenthesizedSequence() { + /* 1.1 Leading seq */ (1, 1) /* 1.2 Trailing seq */; +} + +function unparenthesizedSequence() { + /* 2.1 Leading num */ 1, 1 /* 2.2 Trailing num */; +} diff --git a/lib/test/flow/comment_interning/sequence.options.json b/lib/test/flow/comment_interning/sequence.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/sequence.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/sequence.tree.json b/lib/test/flow/comment_interning/sequence.tree.json new file mode 100644 index 0000000..b995f55 --- /dev/null +++ b/lib/test/flow/comment_interning/sequence.tree.json @@ -0,0 +1,173 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "range":[0,188], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,93], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":30}}, + "range":[9,30], + "name":"parenthesizedSequence", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":3,"column":1}}, + "range":[33,93], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":26},"end":{"line":2,"column":56}}, + "range":[61,91], + "expression":{ + "type":"SequenceExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":33},"end":{"line":2,"column":55}}, + "range":[68,90], + "value":" 1.2 Trailing seq " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":25}}, + "range":[39,60], + "value":" 1.1 Leading seq " + } + ], + "loc":{"source":null,"start":{"line":2,"column":27},"end":{"line":2,"column":31}}, + "range":[62,66], + "expressions":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":27},"end":{"line":2,"column":28}}, + "range":[62,63], + "value":1, + "raw":"1" + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":30},"end":{"line":2,"column":31}}, + "range":[65,66], + "value":1, + "raw":"1" + } + ] + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":7,"column":1}}, + "range":[95,188], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":9},"end":{"line":5,"column":32}}, + "range":[104,127], + "name":"unparenthesizedSequence", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":5,"column":35},"end":{"line":7,"column":1}}, + "range":[130,188], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":6,"column":26},"end":{"line":6,"column":54}}, + "range":[158,186], + "expression":{ + "type":"SequenceExpression", + "loc":{"source":null,"start":{"line":6,"column":26},"end":{"line":6,"column":30}}, + "range":[158,162], + "expressions":[ + { + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":4},"end":{"line":6,"column":25}}, + "range":[136,157], + "value":" 2.1 Leading num " + } + ], + "loc":{"source":null,"start":{"line":6,"column":26},"end":{"line":6,"column":27}}, + "range":[158,159], + "value":1, + "raw":"1" + }, + { + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":31},"end":{"line":6,"column":53}}, + "range":[163,185], + "value":" 2.2 Trailing num " + } + ], + "loc":{"source":null,"start":{"line":6,"column":29},"end":{"line":6,"column":30}}, + "range":[161,162], + "value":1, + "raw":"1" + } + ] + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":25}}, + "range":[39,60], + "value":" 1.1 Leading seq " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":33},"end":{"line":2,"column":55}}, + "range":[68,90], + "value":" 1.2 Trailing seq " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":4},"end":{"line":6,"column":25}}, + "range":[136,157], + "value":" 2.1 Leading num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":31},"end":{"line":6,"column":53}}, + "range":[163,185], + "value":" 2.2 Trailing num " + } + ] +} diff --git a/lib/test/flow/comment_interning/super.js b/lib/test/flow/comment_interning/super.js new file mode 100644 index 0000000..b8e6965 --- /dev/null +++ b/lib/test/flow/comment_interning/super.js @@ -0,0 +1,19 @@ +class LeadingOnly { + constructor() { + /* 1.1 Leading */ super(); + } +} + +class TrailingOnly { + constructor() { + super /* 2.1 Trailing */ + (); + } +} + +class LeadingAndTrailing { + constructor() { + /* 3.1 Leading */ super /* 3.2 Trailing */ + (); + } +} diff --git a/lib/test/flow/comment_interning/super.options.json b/lib/test/flow/comment_interning/super.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/super.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/super.tree.json b/lib/test/flow/comment_interning/super.tree.json new file mode 100644 index 0000000..f418762 --- /dev/null +++ b/lib/test/flow/comment_interning/super.tree.json @@ -0,0 +1,305 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":19,"column":1}}, + "range":[0,268], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "range":[0,74], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":17}}, + "range":[6,17], + "name":"LeadingOnly", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":5,"column":1}}, + "range":[18,74], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":4,"column":3}}, + "range":[22,72], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, + "range":[22,33], + "name":"constructor", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":4,"column":3}}, + "range":[33,72], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":4,"column":3}}, + "range":[36,72], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":3,"column":22},"end":{"line":3,"column":30}}, + "range":[60,68], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":3,"column":22},"end":{"line":3,"column":29}}, + "range":[60,67], + "callee":{ + "type":"Super", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":21}}, + "range":[42,59], + "value":" 1.1 Leading " + } + ], + "loc":{"source":null,"start":{"line":3,"column":22},"end":{"line":3,"column":27}}, + "range":[60,65] + }, + "typeArguments":null, + "arguments":[] + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"constructor", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":12,"column":1}}, + "range":[76,159], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":6},"end":{"line":7,"column":18}}, + "range":[82,94], + "name":"TrailingOnly", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":7,"column":19},"end":{"line":12,"column":1}}, + "range":[95,159], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":8,"column":2},"end":{"line":11,"column":3}}, + "range":[99,157], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":8,"column":2},"end":{"line":8,"column":13}}, + "range":[99,110], + "name":"constructor", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":8,"column":13},"end":{"line":11,"column":3}}, + "range":[110,157], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":8,"column":16},"end":{"line":11,"column":3}}, + "range":[113,157], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":9,"column":4},"end":{"line":10,"column":9}}, + "range":[119,153], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":9,"column":4},"end":{"line":10,"column":8}}, + "range":[119,152], + "callee":{ + "type":"Super", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":10},"end":{"line":9,"column":28}}, + "range":[125,143], + "value":" 2.1 Trailing " + } + ], + "loc":{"source":null,"start":{"line":9,"column":4},"end":{"line":9,"column":9}}, + "range":[119,124] + }, + "typeArguments":null, + "arguments":[] + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"constructor", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":14,"column":0},"end":{"line":19,"column":1}}, + "range":[161,268], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":14,"column":6},"end":{"line":14,"column":24}}, + "range":[167,185], + "name":"LeadingAndTrailing", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":14,"column":25},"end":{"line":19,"column":1}}, + "range":[186,268], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":15,"column":2},"end":{"line":18,"column":3}}, + "range":[190,266], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":15,"column":2},"end":{"line":15,"column":13}}, + "range":[190,201], + "name":"constructor", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":15,"column":13},"end":{"line":18,"column":3}}, + "range":[201,266], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":15,"column":16},"end":{"line":18,"column":3}}, + "range":[204,266], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":16,"column":22},"end":{"line":17,"column":9}}, + "range":[228,262], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":16,"column":22},"end":{"line":17,"column":8}}, + "range":[228,261], + "callee":{ + "type":"Super", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":28},"end":{"line":16,"column":46}}, + "range":[234,252], + "value":" 3.2 Trailing " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":4},"end":{"line":16,"column":21}}, + "range":[210,227], + "value":" 3.1 Leading " + } + ], + "loc":{"source":null,"start":{"line":16,"column":22},"end":{"line":16,"column":27}}, + "range":[228,233] + }, + "typeArguments":null, + "arguments":[] + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"constructor", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":21}}, + "range":[42,59], + "value":" 1.1 Leading " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":10},"end":{"line":9,"column":28}}, + "range":[125,143], + "value":" 2.1 Trailing " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":4},"end":{"line":16,"column":21}}, + "range":[210,227], + "value":" 3.1 Leading " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":28},"end":{"line":16,"column":46}}, + "range":[234,252], + "value":" 3.2 Trailing " + } + ] +} diff --git a/lib/test/flow/comment_interning/switch.js b/lib/test/flow/comment_interning/switch.js new file mode 100644 index 0000000..7662acb --- /dev/null +++ b/lib/test/flow/comment_interning/switch.js @@ -0,0 +1,39 @@ +switch /* 1.1 Not attached to switch */ (1) /* 1.2 Not attached to switch */ { /* 1.3 Not attached to switch */ + default: + 1; +/* 1.4 Not attached to switch */ } + +/* 2.1 Leading on switch */ switch (1) { + default: + 1; +} + +switch (1) { + default: + 1; +} /* 3.1 Trailing on switch */ + +/* 4.1 Leading on switch */ switch (1) { + default: + 1; +} /* 4.2 Trailing on switch */ + +switch (1) { + /* 5.1 L case */ case /* 5.2 L num */ 1 /* 5.3 T num */ : /* 5.4 T case */ + 1; + /* 5.5 L case */ default /* 5.6 T case */ : /* 5.7 T case */ + 1; +} + +{ + switch (1) { default: 1; } /* 6.1 T switch */ + /* 6.2 L switch */ switch (1) { default: 1; } /* 6.3 T switch */ +} + +switch (1) { + /* 7.1 L case */ case 0: /* 7.2 T case */ + /* 7.3 L case */ case 1: /* 7.4 T case */ + /* 7.5 L break */ break; /* 7.6 T break */ + /* 7.7 L case */ default: /* 7.8 T case */ + /* 7.9 L break */ break; /* 7.10 T break */ +} diff --git a/lib/test/flow/comment_interning/switch.options.json b/lib/test/flow/comment_interning/switch.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/switch.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/switch.tree.json b/lib/test/flow/comment_interning/switch.tree.json new file mode 100644 index 0000000..6026b74 --- /dev/null +++ b/lib/test/flow/comment_interning/switch.tree.json @@ -0,0 +1,723 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":39,"column":1}}, + "range":[0,964], + "body":[ + { + "type":"SwitchStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":34}}, + "range":[0,170], + "discriminant":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":42}}, + "range":[41,42], + "value":1, + "raw":"1" + }, + "cases":[ + { + "type":"SwitchCase", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":79},"end":{"line":1,"column":111}}, + "range":[79,111], + "value":" 1.3 Not attached to switch " + } + ], + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":3,"column":10}}, + "range":[116,135], + "test":null, + "consequent":[ + { + "type":"ExpressionStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":0},"end":{"line":4,"column":32}}, + "range":[136,168], + "value":" 1.4 Not attached to switch " + } + ], + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":10}}, + "range":[133,135], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":9}}, + "range":[133,134], + "value":1, + "raw":"1" + }, + "directive":null + } + ] + } + ] + }, + { + "type":"SwitchStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":0},"end":{"line":6,"column":27}}, + "range":[172,199], + "value":" 2.1 Leading on switch " + } + ], + "loc":{"source":null,"start":{"line":6,"column":28},"end":{"line":9,"column":1}}, + "range":[200,238], + "discriminant":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":6,"column":36},"end":{"line":6,"column":37}}, + "range":[208,209], + "value":1, + "raw":"1" + }, + "cases":[ + { + "type":"SwitchCase", + "loc":{"source":null,"start":{"line":7,"column":4},"end":{"line":8,"column":10}}, + "range":[217,236], + "test":null, + "consequent":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":8,"column":8},"end":{"line":8,"column":10}}, + "range":[234,236], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":8,"column":8},"end":{"line":8,"column":9}}, + "range":[234,235], + "value":1, + "raw":"1" + }, + "directive":null + } + ] + } + ] + }, + { + "type":"SwitchStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":2},"end":{"line":14,"column":30}}, + "range":[279,307], + "value":" 3.1 Trailing on switch " + } + ], + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":14,"column":1}}, + "range":[240,278], + "discriminant":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":11,"column":8},"end":{"line":11,"column":9}}, + "range":[248,249], + "value":1, + "raw":"1" + }, + "cases":[ + { + "type":"SwitchCase", + "loc":{"source":null,"start":{"line":12,"column":4},"end":{"line":13,"column":10}}, + "range":[257,276], + "test":null, + "consequent":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":13,"column":8},"end":{"line":13,"column":10}}, + "range":[274,276], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":13,"column":8},"end":{"line":13,"column":9}}, + "range":[274,275], + "value":1, + "raw":"1" + }, + "directive":null + } + ] + } + ] + }, + { + "type":"SwitchStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":2},"end":{"line":19,"column":30}}, + "range":[376,404], + "value":" 4.2 Trailing on switch " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":0},"end":{"line":16,"column":27}}, + "range":[309,336], + "value":" 4.1 Leading on switch " + } + ], + "loc":{"source":null,"start":{"line":16,"column":28},"end":{"line":19,"column":1}}, + "range":[337,375], + "discriminant":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":16,"column":36},"end":{"line":16,"column":37}}, + "range":[345,346], + "value":1, + "raw":"1" + }, + "cases":[ + { + "type":"SwitchCase", + "loc":{"source":null,"start":{"line":17,"column":4},"end":{"line":18,"column":10}}, + "range":[354,373], + "test":null, + "consequent":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":18,"column":8},"end":{"line":18,"column":10}}, + "range":[371,373], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":18,"column":8},"end":{"line":18,"column":9}}, + "range":[371,372], + "value":1, + "raw":"1" + }, + "directive":null + } + ] + } + ] + }, + { + "type":"SwitchStatement", + "loc":{"source":null,"start":{"line":21,"column":0},"end":{"line":26,"column":1}}, + "range":[406,582], + "discriminant":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":21,"column":8},"end":{"line":21,"column":9}}, + "range":[414,415], + "value":1, + "raw":"1" + }, + "cases":[ + { + "type":"SwitchCase", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":62},"end":{"line":22,"column":78}}, + "range":[481,497], + "value":" 5.4 T case " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":4},"end":{"line":22,"column":20}}, + "range":[423,439], + "value":" 5.1 L case " + } + ], + "loc":{"source":null,"start":{"line":22,"column":21},"end":{"line":23,"column":8}}, + "range":[440,506], + "test":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":44},"end":{"line":22,"column":59}}, + "range":[463,478], + "value":" 5.3 T num " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":26},"end":{"line":22,"column":41}}, + "range":[445,460], + "value":" 5.2 L num " + } + ], + "loc":{"source":null,"start":{"line":22,"column":42},"end":{"line":22,"column":43}}, + "range":[461,462], + "value":1, + "raw":"1" + }, + "consequent":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":23,"column":6},"end":{"line":23,"column":8}}, + "range":[504,506], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":23,"column":6},"end":{"line":23,"column":7}}, + "range":[504,505], + "value":1, + "raw":"1" + }, + "directive":null + } + ] + }, + { + "type":"SwitchCase", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":29},"end":{"line":24,"column":45}}, + "range":[536,552], + "value":" 5.6 T case " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":48},"end":{"line":24,"column":64}}, + "range":[555,571], + "value":" 5.7 T case " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":4},"end":{"line":24,"column":20}}, + "range":[511,527], + "value":" 5.5 L case " + } + ], + "loc":{"source":null,"start":{"line":24,"column":21},"end":{"line":25,"column":8}}, + "range":[528,580], + "test":null, + "consequent":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":25,"column":6},"end":{"line":25,"column":8}}, + "range":[578,580], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":25,"column":6},"end":{"line":25,"column":7}}, + "range":[578,579], + "value":1, + "raw":"1" + }, + "directive":null + } + ] + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":28,"column":0},"end":{"line":31,"column":1}}, + "range":[584,706], + "body":[ + { + "type":"SwitchStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":31},"end":{"line":29,"column":49}}, + "range":[617,635], + "value":" 6.1 T switch " + } + ], + "loc":{"source":null,"start":{"line":29,"column":4},"end":{"line":29,"column":30}}, + "range":[590,616], + "discriminant":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":29,"column":12},"end":{"line":29,"column":13}}, + "range":[598,599], + "value":1, + "raw":"1" + }, + "cases":[ + { + "type":"SwitchCase", + "loc":{"source":null,"start":{"line":29,"column":17},"end":{"line":29,"column":28}}, + "range":[603,614], + "test":null, + "consequent":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":29,"column":26},"end":{"line":29,"column":28}}, + "range":[612,614], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":29,"column":26},"end":{"line":29,"column":27}}, + "range":[612,613], + "value":1, + "raw":"1" + }, + "directive":null + } + ] + } + ] + }, + { + "type":"SwitchStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":50},"end":{"line":30,"column":68}}, + "range":[686,704], + "value":" 6.3 T switch " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":4},"end":{"line":30,"column":22}}, + "range":[640,658], + "value":" 6.2 L switch " + } + ], + "loc":{"source":null,"start":{"line":30,"column":23},"end":{"line":30,"column":49}}, + "range":[659,685], + "discriminant":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":30,"column":31},"end":{"line":30,"column":32}}, + "range":[667,668], + "value":1, + "raw":"1" + }, + "cases":[ + { + "type":"SwitchCase", + "loc":{"source":null,"start":{"line":30,"column":36},"end":{"line":30,"column":47}}, + "range":[672,683], + "test":null, + "consequent":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":30,"column":45},"end":{"line":30,"column":47}}, + "range":[681,683], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":30,"column":45},"end":{"line":30,"column":46}}, + "range":[681,682], + "value":1, + "raw":"1" + }, + "directive":null + } + ] + } + ] + } + ] + }, + { + "type":"SwitchStatement", + "loc":{"source":null,"start":{"line":33,"column":0},"end":{"line":39,"column":1}}, + "range":[708,964], + "discriminant":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":33,"column":8},"end":{"line":33,"column":9}}, + "range":[716,717], + "value":1, + "raw":"1" + }, + "cases":[ + { + "type":"SwitchCase", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":29},"end":{"line":34,"column":45}}, + "range":[750,766], + "value":" 7.2 T case " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":4},"end":{"line":34,"column":20}}, + "range":[725,741], + "value":" 7.1 L case " + } + ], + "loc":{"source":null,"start":{"line":34,"column":21},"end":{"line":34,"column":28}}, + "range":[742,749], + "test":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":34,"column":26},"end":{"line":34,"column":27}}, + "range":[747,748], + "value":0, + "raw":"0" + }, + "consequent":[] + }, + { + "type":"SwitchCase", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":29},"end":{"line":35,"column":45}}, + "range":[796,812], + "value":" 7.4 T case " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":4},"end":{"line":35,"column":20}}, + "range":[771,787], + "value":" 7.3 L case " + } + ], + "loc":{"source":null,"start":{"line":35,"column":21},"end":{"line":36,"column":32}}, + "range":[788,845], + "test":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":35,"column":26},"end":{"line":35,"column":27}}, + "range":[793,794], + "value":1, + "raw":"1" + }, + "consequent":[ + { + "type":"BreakStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":33},"end":{"line":36,"column":50}}, + "range":[846,863], + "value":" 7.6 T break " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":8},"end":{"line":36,"column":25}}, + "range":[821,838], + "value":" 7.5 L break " + } + ], + "loc":{"source":null,"start":{"line":36,"column":26},"end":{"line":36,"column":32}}, + "range":[839,845], + "label":null + } + ] + }, + { + "type":"SwitchCase", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":37,"column":30},"end":{"line":37,"column":46}}, + "range":[894,910], + "value":" 7.8 T case " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":37,"column":4},"end":{"line":37,"column":20}}, + "range":[868,884], + "value":" 7.7 L case " + } + ], + "loc":{"source":null,"start":{"line":37,"column":21},"end":{"line":38,"column":32}}, + "range":[885,943], + "test":null, + "consequent":[ + { + "type":"BreakStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":38,"column":33},"end":{"line":38,"column":51}}, + "range":[944,962], + "value":" 7.10 T break " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":38,"column":8},"end":{"line":38,"column":25}}, + "range":[919,936], + "value":" 7.9 L break " + } + ], + "loc":{"source":null,"start":{"line":38,"column":26},"end":{"line":38,"column":32}}, + "range":[937,943], + "label":null + } + ] + } + ] + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":39}}, + "range":[7,39], + "value":" 1.1 Not attached to switch " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":44},"end":{"line":1,"column":76}}, + "range":[44,76], + "value":" 1.2 Not attached to switch " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":79},"end":{"line":1,"column":111}}, + "range":[79,111], + "value":" 1.3 Not attached to switch " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":0},"end":{"line":4,"column":32}}, + "range":[136,168], + "value":" 1.4 Not attached to switch " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":0},"end":{"line":6,"column":27}}, + "range":[172,199], + "value":" 2.1 Leading on switch " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":2},"end":{"line":14,"column":30}}, + "range":[279,307], + "value":" 3.1 Trailing on switch " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":16,"column":0},"end":{"line":16,"column":27}}, + "range":[309,336], + "value":" 4.1 Leading on switch " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":2},"end":{"line":19,"column":30}}, + "range":[376,404], + "value":" 4.2 Trailing on switch " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":4},"end":{"line":22,"column":20}}, + "range":[423,439], + "value":" 5.1 L case " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":26},"end":{"line":22,"column":41}}, + "range":[445,460], + "value":" 5.2 L num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":44},"end":{"line":22,"column":59}}, + "range":[463,478], + "value":" 5.3 T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":62},"end":{"line":22,"column":78}}, + "range":[481,497], + "value":" 5.4 T case " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":4},"end":{"line":24,"column":20}}, + "range":[511,527], + "value":" 5.5 L case " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":29},"end":{"line":24,"column":45}}, + "range":[536,552], + "value":" 5.6 T case " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":48},"end":{"line":24,"column":64}}, + "range":[555,571], + "value":" 5.7 T case " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":31},"end":{"line":29,"column":49}}, + "range":[617,635], + "value":" 6.1 T switch " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":4},"end":{"line":30,"column":22}}, + "range":[640,658], + "value":" 6.2 L switch " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":50},"end":{"line":30,"column":68}}, + "range":[686,704], + "value":" 6.3 T switch " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":4},"end":{"line":34,"column":20}}, + "range":[725,741], + "value":" 7.1 L case " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":29},"end":{"line":34,"column":45}}, + "range":[750,766], + "value":" 7.2 T case " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":4},"end":{"line":35,"column":20}}, + "range":[771,787], + "value":" 7.3 L case " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":29},"end":{"line":35,"column":45}}, + "range":[796,812], + "value":" 7.4 T case " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":8},"end":{"line":36,"column":25}}, + "range":[821,838], + "value":" 7.5 L break " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":33},"end":{"line":36,"column":50}}, + "range":[846,863], + "value":" 7.6 T break " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":37,"column":4},"end":{"line":37,"column":20}}, + "range":[868,884], + "value":" 7.7 L case " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":37,"column":30},"end":{"line":37,"column":46}}, + "range":[894,910], + "value":" 7.8 T case " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":38,"column":8},"end":{"line":38,"column":25}}, + "range":[919,936], + "value":" 7.9 L break " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":38,"column":33},"end":{"line":38,"column":51}}, + "range":[944,962], + "value":" 7.10 T break " + } + ] +} diff --git a/lib/test/flow/comment_interning/template.js b/lib/test/flow/comment_interning/template.js new file mode 100644 index 0000000..98a28a8 --- /dev/null +++ b/lib/test/flow/comment_interning/template.js @@ -0,0 +1,20 @@ +function leadingOnly() { + /* 1.1 Leading */ `template`; +} + +function trailingOnly() { + `template` /* 2.1 Trailing */; +} + +function leadingAndTrailing() { + /* 3.1 Leading */ `template` /* 3.2 Trailing */; +} + +function withExpressions() { + /* 4.1 Leading template */ `test ${/* 4.2 Leading num */ 1 /* 4.3 Trailing num */} test` /* 4.4 Trailing template */; +} + +/* 5.1 L id */ tag /* 5.2 L lit */ `literal` /* 5.3 T lit */; + +tag /* 6.1 T id */ + /* 6.2 L lit */ `literal`; diff --git a/lib/test/flow/comment_interning/template.options.json b/lib/test/flow/comment_interning/template.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/template.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/template.tree.json b/lib/test/flow/comment_interning/template.tree.json new file mode 100644 index 0000000..a9abb0b --- /dev/null +++ b/lib/test/flow/comment_interning/template.tree.json @@ -0,0 +1,466 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":20,"column":28}}, + "range":[0,470], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,58], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":20}}, + "range":[9,20], + "name":"leadingOnly", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":3,"column":1}}, + "range":[23,58], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":20},"end":{"line":2,"column":31}}, + "range":[45,56], + "expression":{ + "type":"TemplateLiteral", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":19}}, + "range":[27,44], + "value":" 1.1 Leading " + } + ], + "loc":{"source":null,"start":{"line":2,"column":20},"end":{"line":2,"column":30}}, + "range":[45,55], + "quasis":[ + { + "type":"TemplateElement", + "loc":{"source":null,"start":{"line":2,"column":20},"end":{"line":2,"column":30}}, + "range":[45,55], + "value":{"raw":"template","cooked":"template"}, + "tail":true + } + ], + "expressions":[] + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":7,"column":1}}, + "range":[60,120], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":9},"end":{"line":5,"column":21}}, + "range":[69,81], + "name":"trailingOnly", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":5,"column":24},"end":{"line":7,"column":1}}, + "range":[84,120], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":32}}, + "range":[88,118], + "expression":{ + "type":"TemplateLiteral", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":13},"end":{"line":6,"column":31}}, + "range":[99,117], + "value":" 2.1 Trailing " + } + ], + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":12}}, + "range":[88,98], + "quasis":[ + { + "type":"TemplateElement", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":12}}, + "range":[88,98], + "value":{"raw":"template","cooked":"template"}, + "tail":true + } + ], + "expressions":[] + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":11,"column":1}}, + "range":[122,206], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":9},"end":{"line":9,"column":27}}, + "range":[131,149], + "name":"leadingAndTrailing", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":9,"column":30},"end":{"line":11,"column":1}}, + "range":[152,206], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":10,"column":20},"end":{"line":10,"column":50}}, + "range":[174,204], + "expression":{ + "type":"TemplateLiteral", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":31},"end":{"line":10,"column":49}}, + "range":[185,203], + "value":" 3.2 Trailing " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":2},"end":{"line":10,"column":19}}, + "range":[156,173], + "value":" 3.1 Leading " + } + ], + "loc":{"source":null,"start":{"line":10,"column":20},"end":{"line":10,"column":30}}, + "range":[174,184], + "quasis":[ + { + "type":"TemplateElement", + "loc":{"source":null,"start":{"line":10,"column":20},"end":{"line":10,"column":30}}, + "range":[174,184], + "value":{"raw":"template","cooked":"template"}, + "tail":true + } + ], + "expressions":[] + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":13,"column":0},"end":{"line":15,"column":1}}, + "range":[208,358], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":13,"column":9},"end":{"line":13,"column":24}}, + "range":[217,232], + "name":"withExpressions", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":13,"column":27},"end":{"line":15,"column":1}}, + "range":[235,358], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":14,"column":29},"end":{"line":14,"column":119}}, + "range":[266,356], + "expression":{ + "type":"TemplateLiteral", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":91},"end":{"line":14,"column":118}}, + "range":[328,355], + "value":" 4.4 Trailing template " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":2},"end":{"line":14,"column":28}}, + "range":[239,265], + "value":" 4.1 Leading template " + } + ], + "loc":{"source":null,"start":{"line":14,"column":29},"end":{"line":14,"column":90}}, + "range":[266,327], + "quasis":[ + { + "type":"TemplateElement", + "loc":{"source":null,"start":{"line":14,"column":29},"end":{"line":14,"column":37}}, + "range":[266,274], + "value":{"raw":"test ","cooked":"test "}, + "tail":false + }, + { + "type":"TemplateElement", + "loc":{"source":null,"start":{"line":14,"column":83},"end":{"line":14,"column":90}}, + "range":[320,327], + "value":{"raw":" test","cooked":" test"}, + "tail":true + } + ], + "expressions":[ + { + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":61},"end":{"line":14,"column":83}}, + "range":[298,320], + "value":" 4.3 Trailing num " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":37},"end":{"line":14,"column":58}}, + "range":[274,295], + "value":" 4.2 Leading num " + } + ], + "loc":{"source":null,"start":{"line":14,"column":59},"end":{"line":14,"column":60}}, + "range":[296,297], + "value":1, + "raw":"1" + } + ] + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":17,"column":15},"end":{"line":17,"column":61}}, + "range":[375,421], + "expression":{ + "type":"TaggedTemplateExpression", + "loc":{"source":null,"start":{"line":17,"column":15},"end":{"line":17,"column":44}}, + "range":[375,404], + "tag":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":0},"end":{"line":17,"column":14}}, + "range":[360,374], + "value":" 5.1 L id " + } + ], + "loc":{"source":null,"start":{"line":17,"column":15},"end":{"line":17,"column":18}}, + "range":[375,378], + "name":"tag", + "typeAnnotation":null, + "optional":false + }, + "quasi":{ + "type":"TemplateLiteral", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":45},"end":{"line":17,"column":60}}, + "range":[405,420], + "value":" 5.3 T lit " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":19},"end":{"line":17,"column":34}}, + "range":[379,394], + "value":" 5.2 L lit " + } + ], + "loc":{"source":null,"start":{"line":17,"column":35},"end":{"line":17,"column":44}}, + "range":[395,404], + "quasis":[ + { + "type":"TemplateElement", + "loc":{"source":null,"start":{"line":17,"column":35},"end":{"line":17,"column":44}}, + "range":[395,404], + "value":{"raw":"literal","cooked":"literal"}, + "tail":true + } + ], + "expressions":[] + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":19,"column":0},"end":{"line":20,"column":28}}, + "range":[423,470], + "expression":{ + "type":"TaggedTemplateExpression", + "loc":{"source":null,"start":{"line":19,"column":0},"end":{"line":20,"column":27}}, + "range":[423,469], + "tag":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":4},"end":{"line":19,"column":18}}, + "range":[427,441], + "value":" 6.1 T id " + } + ], + "loc":{"source":null,"start":{"line":19,"column":0},"end":{"line":19,"column":3}}, + "range":[423,426], + "name":"tag", + "typeAnnotation":null, + "optional":false + }, + "quasi":{ + "type":"TemplateLiteral", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":2},"end":{"line":20,"column":17}}, + "range":[444,459], + "value":" 6.2 L lit " + } + ], + "loc":{"source":null,"start":{"line":20,"column":18},"end":{"line":20,"column":27}}, + "range":[460,469], + "quasis":[ + { + "type":"TemplateElement", + "loc":{"source":null,"start":{"line":20,"column":18},"end":{"line":20,"column":27}}, + "range":[460,469], + "value":{"raw":"literal","cooked":"literal"}, + "tail":true + } + ], + "expressions":[] + } + }, + "directive":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":19}}, + "range":[27,44], + "value":" 1.1 Leading " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":13},"end":{"line":6,"column":31}}, + "range":[99,117], + "value":" 2.1 Trailing " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":2},"end":{"line":10,"column":19}}, + "range":[156,173], + "value":" 3.1 Leading " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":31},"end":{"line":10,"column":49}}, + "range":[185,203], + "value":" 3.2 Trailing " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":2},"end":{"line":14,"column":28}}, + "range":[239,265], + "value":" 4.1 Leading template " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":37},"end":{"line":14,"column":58}}, + "range":[274,295], + "value":" 4.2 Leading num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":61},"end":{"line":14,"column":83}}, + "range":[298,320], + "value":" 4.3 Trailing num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":91},"end":{"line":14,"column":118}}, + "range":[328,355], + "value":" 4.4 Trailing template " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":0},"end":{"line":17,"column":14}}, + "range":[360,374], + "value":" 5.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":19},"end":{"line":17,"column":34}}, + "range":[379,394], + "value":" 5.2 L lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":45},"end":{"line":17,"column":60}}, + "range":[405,420], + "value":" 5.3 T lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":4},"end":{"line":19,"column":18}}, + "range":[427,441], + "value":" 6.1 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":2},"end":{"line":20,"column":17}}, + "range":[444,459], + "value":" 6.2 L lit " + } + ] +} diff --git a/lib/test/flow/comment_interning/this.js b/lib/test/flow/comment_interning/this.js new file mode 100644 index 0000000..cd0c921 --- /dev/null +++ b/lib/test/flow/comment_interning/this.js @@ -0,0 +1,11 @@ +function leadingOnly() { + /* 1.1 Leading */ this; +} + +function trailingOnly() { + this /* 2.1 Trailing */; +} + +function leadingAndTrailing() { + /* 3.1 Leading */ this /* 3.2 Trailing */; +} diff --git a/lib/test/flow/comment_interning/this.options.json b/lib/test/flow/comment_interning/this.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/this.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/this.tree.json b/lib/test/flow/comment_interning/this.tree.json new file mode 100644 index 0000000..5090eba --- /dev/null +++ b/lib/test/flow/comment_interning/this.tree.json @@ -0,0 +1,179 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":11,"column":1}}, + "range":[0,190], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,52], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":20}}, + "range":[9,20], + "name":"leadingOnly", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":3,"column":1}}, + "range":[23,52], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":20},"end":{"line":2,"column":25}}, + "range":[45,50], + "expression":{ + "type":"ThisExpression", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":19}}, + "range":[27,44], + "value":" 1.1 Leading " + } + ], + "loc":{"source":null,"start":{"line":2,"column":20},"end":{"line":2,"column":24}}, + "range":[45,49] + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":7,"column":1}}, + "range":[54,108], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":9},"end":{"line":5,"column":21}}, + "range":[63,75], + "name":"trailingOnly", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":5,"column":24},"end":{"line":7,"column":1}}, + "range":[78,108], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":26}}, + "range":[82,106], + "expression":{ + "type":"ThisExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":7},"end":{"line":6,"column":25}}, + "range":[87,105], + "value":" 2.1 Trailing " + } + ], + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":6}}, + "range":[82,86] + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":11,"column":1}}, + "range":[110,190], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":9},"end":{"line":9,"column":27}}, + "range":[119,137], + "name":"leadingAndTrailing", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":9,"column":30},"end":{"line":11,"column":1}}, + "range":[140,190], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":10,"column":22},"end":{"line":10,"column":46}}, + "range":[164,188], + "expression":{ + "type":"ThisExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":27},"end":{"line":10,"column":45}}, + "range":[169,187], + "value":" 3.2 Trailing " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":4},"end":{"line":10,"column":21}}, + "range":[146,163], + "value":" 3.1 Leading " + } + ], + "loc":{"source":null,"start":{"line":10,"column":22},"end":{"line":10,"column":26}}, + "range":[164,168] + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":19}}, + "range":[27,44], + "value":" 1.1 Leading " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":7},"end":{"line":6,"column":25}}, + "range":[87,105], + "value":" 2.1 Trailing " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":4},"end":{"line":10,"column":21}}, + "range":[146,163], + "value":" 3.1 Leading " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":27},"end":{"line":10,"column":45}}, + "range":[169,187], + "value":" 3.2 Trailing " + } + ] +} diff --git a/lib/test/flow/comment_interning/throw.js b/lib/test/flow/comment_interning/throw.js new file mode 100644 index 0000000..011fb3f --- /dev/null +++ b/lib/test/flow/comment_interning/throw.js @@ -0,0 +1,14 @@ +function test() { + // 1.1 Not a leading comment + var F = function(){}; + // 1.2 Leading comment + /* 1.3 Leading comment */ throw /* 1.4 Not a trailing comment */ new Error('Error') /* 1.5 Trailing new args */; +} + +/* 2.1 L throw */ throw new Error('') /* 2.2 T args */ ; /* 2.3 T throw */ + +{ + /* 3.1 L throw */ throw new Error('') /* 3.2 T args */ + /* 3.3 L throw */ throw new Error('') + /* 3.4 T args */ +} diff --git a/lib/test/flow/comment_interning/throw.options.json b/lib/test/flow/comment_interning/throw.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/throw.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/throw.tree.json b/lib/test/flow/comment_interning/throw.tree.json new file mode 100644 index 0000000..213bf08 --- /dev/null +++ b/lib/test/flow/comment_interning/throw.tree.json @@ -0,0 +1,361 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":14,"column":1}}, + "range":[0,425], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "range":[0,222], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, + "range":[9,13], + "name":"test", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":6,"column":1}}, + "range":[16,222], + "body":[ + { + "type":"VariableDeclaration", + "leadingComments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":32}}, + "range":[22,50], + "value":" 1.1 Not a leading comment" + } + ], + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":25}}, + "range":[55,76], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":24}}, + "range":[59,75], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":9}}, + "range":[59,60], + "name":"F", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":3,"column":12},"end":{"line":3,"column":24}}, + "range":[63,75], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":22},"end":{"line":3,"column":24}}, + "range":[73,75], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + } + ], + "kind":"var" + }, + { + "type":"ThrowStatement", + "leadingComments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":4,"column":4},"end":{"line":4,"column":26}}, + "range":[81,103], + "value":" 1.2 Leading comment" + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":4},"end":{"line":5,"column":29}}, + "range":[108,133], + "value":" 1.3 Leading comment " + } + ], + "loc":{"source":null,"start":{"line":5,"column":30},"end":{"line":5,"column":116}}, + "range":[134,220], + "argument":{ + "type":"NewExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":88},"end":{"line":5,"column":115}}, + "range":[192,219], + "value":" 1.5 Trailing new args " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":36},"end":{"line":5,"column":68}}, + "range":[140,172], + "value":" 1.4 Not a trailing comment " + } + ], + "loc":{"source":null,"start":{"line":5,"column":69},"end":{"line":5,"column":87}}, + "range":[173,191], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":73},"end":{"line":5,"column":78}}, + "range":[177,182], + "name":"Error", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":5,"column":79},"end":{"line":5,"column":86}}, + "range":[183,190], + "value":"Error", + "raw":"'Error'" + } + ] + } + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"ThrowStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":57},"end":{"line":8,"column":74}}, + "range":[281,298], + "value":" 2.3 T throw " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":0},"end":{"line":8,"column":17}}, + "range":[224,241], + "value":" 2.1 L throw " + } + ], + "loc":{"source":null,"start":{"line":8,"column":18},"end":{"line":8,"column":56}}, + "range":[242,280], + "argument":{ + "type":"NewExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":38},"end":{"line":8,"column":54}}, + "range":[262,278], + "value":" 2.2 T args " + } + ], + "loc":{"source":null,"start":{"line":8,"column":24},"end":{"line":8,"column":37}}, + "range":[248,261], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":8,"column":28},"end":{"line":8,"column":33}}, + "range":[252,257], + "name":"Error", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":8,"column":34},"end":{"line":8,"column":36}}, + "range":[258,260], + "value":"", + "raw":"''" + } + ] + } + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":10,"column":0},"end":{"line":14,"column":1}}, + "range":[300,425], + "body":[ + { + "type":"ThrowStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":4},"end":{"line":11,"column":21}}, + "range":[306,323], + "value":" 3.1 L throw " + } + ], + "loc":{"source":null,"start":{"line":11,"column":22},"end":{"line":11,"column":41}}, + "range":[324,343], + "argument":{ + "type":"NewExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":42},"end":{"line":11,"column":58}}, + "range":[344,360], + "value":" 3.2 T args " + } + ], + "loc":{"source":null,"start":{"line":11,"column":28},"end":{"line":11,"column":41}}, + "range":[330,343], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":11,"column":32},"end":{"line":11,"column":37}}, + "range":[334,339], + "name":"Error", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":11,"column":38},"end":{"line":11,"column":40}}, + "range":[340,342], + "value":"", + "raw":"''" + } + ] + } + }, + { + "type":"ThrowStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":4},"end":{"line":12,"column":21}}, + "range":[365,382], + "value":" 3.3 L throw " + } + ], + "loc":{"source":null,"start":{"line":12,"column":22},"end":{"line":12,"column":41}}, + "range":[383,402], + "argument":{ + "type":"NewExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":4},"end":{"line":13,"column":20}}, + "range":[407,423], + "value":" 3.4 T args " + } + ], + "loc":{"source":null,"start":{"line":12,"column":28},"end":{"line":12,"column":41}}, + "range":[389,402], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":12,"column":32},"end":{"line":12,"column":37}}, + "range":[393,398], + "name":"Error", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":12,"column":38},"end":{"line":12,"column":40}}, + "range":[399,401], + "value":"", + "raw":"''" + } + ] + } + } + ] + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":32}}, + "range":[22,50], + "value":" 1.1 Not a leading comment" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":4,"column":4},"end":{"line":4,"column":26}}, + "range":[81,103], + "value":" 1.2 Leading comment" + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":4},"end":{"line":5,"column":29}}, + "range":[108,133], + "value":" 1.3 Leading comment " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":36},"end":{"line":5,"column":68}}, + "range":[140,172], + "value":" 1.4 Not a trailing comment " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":88},"end":{"line":5,"column":115}}, + "range":[192,219], + "value":" 1.5 Trailing new args " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":0},"end":{"line":8,"column":17}}, + "range":[224,241], + "value":" 2.1 L throw " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":38},"end":{"line":8,"column":54}}, + "range":[262,278], + "value":" 2.2 T args " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":57},"end":{"line":8,"column":74}}, + "range":[281,298], + "value":" 2.3 T throw " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":4},"end":{"line":11,"column":21}}, + "range":[306,323], + "value":" 3.1 L throw " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":42},"end":{"line":11,"column":58}}, + "range":[344,360], + "value":" 3.2 T args " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":4},"end":{"line":12,"column":21}}, + "range":[365,382], + "value":" 3.3 L throw " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":4},"end":{"line":13,"column":20}}, + "range":[407,423], + "value":" 3.4 T args " + } + ] +} diff --git a/lib/test/flow/comment_interning/trailing_comma.js b/lib/test/flow/comment_interning/trailing_comma.js new file mode 100644 index 0000000..6873337 --- /dev/null +++ b/lib/test/flow/comment_interning/trailing_comma.js @@ -0,0 +1,42 @@ +function foo( + /* 1.1 L id */ a /* 1.2 T id */, /* 1.3 T id */ + /* 1.4 L id */ b /* 1.5 T id */, /* 1.6 T id */ +){} + +foo( + /* 2.1 L id */ a, /* 2.2 T id */ + /* 2.3 L id */ b, /* 2.4 T id */ +); + +[ + /* 3.1 L id */ a, /* 3.2 T id */ + /* 3.3 L id */ b, /* 3.4 T id */ +]; + +( + /* 4.1 L id */ a, /* 4.2 T id */ + /* 4.3 L id */ b /* 4.4 T id */ +); + +const /* 5.1 L id */ a = 1, /* 5.2 T num */ + /* 5.3 L id */ b = 2 /* 5.4 T num */; + +({ + /* 6.1 L id */ a: 1, /* 6.2 T num */ + /* 6.3 L id */ b: 2, /* 6.4 T num */ +}); + +foo< + /* 7.1 L id */ A, /* 7.2 T id */ + /* 7.3 L id */ B, /* 7.4 T id */ +>(); + +type Foo = { + /* 8.1 L id */ a: any, /* 8.2 T any */ + /* 8.3 L id */ b: any, /* 8.4 T any */ +}; + +enum Foo { + /* 9.1 L id */ A, /* 9.2 T id */ + /* 9.3 L id */ B, /* 9.4 T id */ +} diff --git a/lib/test/flow/comment_interning/trailing_comma.options.json b/lib/test/flow/comment_interning/trailing_comma.options.json new file mode 100644 index 0000000..2a21f73 --- /dev/null +++ b/lib/test/flow/comment_interning/trailing_comma.options.json @@ -0,0 +1,4 @@ +{ + "enums": true, + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/trailing_comma.tree.json b/lib/test/flow/comment_interning/trailing_comma.tree.json new file mode 100644 index 0000000..fbc9d57 --- /dev/null +++ b/lib/test/flow/comment_interning/trailing_comma.tree.json @@ -0,0 +1,962 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":42,"column":1}}, + "range":[0,782], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":3}}, + "range":[0,117], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":33}}, + "range":[33,47], + "value":" 1.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":35},"end":{"line":2,"column":49}}, + "range":[49,63], + "value":" 1.3 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "range":[16,30], + "value":" 1.1 L id " + } + ], + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":18}}, + "range":[31,32], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":19},"end":{"line":3,"column":33}}, + "range":[83,97], + "value":" 1.5 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":35},"end":{"line":3,"column":49}}, + "range":[99,113], + "value":" 1.6 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":16}}, + "range":[66,80], + "value":" 1.4 L id " + } + ], + "loc":{"source":null,"start":{"line":3,"column":17},"end":{"line":3,"column":18}}, + "range":[81,82], + "name":"b", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":4,"column":1},"end":{"line":4,"column":3}}, + "range":[115,117], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":6,"column":0},"end":{"line":9,"column":2}}, + "range":[119,196], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":6,"column":0},"end":{"line":9,"column":1}}, + "range":[119,195], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":0},"end":{"line":6,"column":3}}, + "range":[119,122], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[ + { + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":20},"end":{"line":7,"column":34}}, + "range":[144,158], + "value":" 2.2 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":2},"end":{"line":7,"column":16}}, + "range":[126,140], + "value":" 2.1 L id " + } + ], + "loc":{"source":null,"start":{"line":7,"column":17},"end":{"line":7,"column":18}}, + "range":[141,142], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":20},"end":{"line":8,"column":34}}, + "range":[179,193], + "value":" 2.4 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":2},"end":{"line":8,"column":16}}, + "range":[161,175], + "value":" 2.3 L id " + } + ], + "loc":{"source":null,"start":{"line":8,"column":17},"end":{"line":8,"column":18}}, + "range":[176,177], + "name":"b", + "typeAnnotation":null, + "optional":false + } + ] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":14,"column":2}}, + "range":[198,272], + "expression":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":14,"column":1}}, + "range":[198,271], + "elements":[ + { + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":20},"end":{"line":12,"column":34}}, + "range":[220,234], + "value":" 3.2 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":2},"end":{"line":12,"column":16}}, + "range":[202,216], + "value":" 3.1 L id " + } + ], + "loc":{"source":null,"start":{"line":12,"column":17},"end":{"line":12,"column":18}}, + "range":[217,218], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":20},"end":{"line":13,"column":34}}, + "range":[255,269], + "value":" 3.4 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":2},"end":{"line":13,"column":16}}, + "range":[237,251], + "value":" 3.3 L id " + } + ], + "loc":{"source":null,"start":{"line":13,"column":17},"end":{"line":13,"column":18}}, + "range":[252,253], + "name":"b", + "typeAnnotation":null, + "optional":false + } + ] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":16,"column":0},"end":{"line":19,"column":2}}, + "range":[274,347], + "expression":{ + "type":"SequenceExpression", + "loc":{"source":null,"start":{"line":17,"column":17},"end":{"line":18,"column":18}}, + "range":[293,329], + "expressions":[ + { + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":20},"end":{"line":17,"column":34}}, + "range":[296,310], + "value":" 4.2 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":2},"end":{"line":17,"column":16}}, + "range":[278,292], + "value":" 4.1 L id " + } + ], + "loc":{"source":null,"start":{"line":17,"column":17},"end":{"line":17,"column":18}}, + "range":[293,294], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":19},"end":{"line":18,"column":33}}, + "range":[330,344], + "value":" 4.4 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":18,"column":16}}, + "range":[313,327], + "value":" 4.3 L id " + } + ], + "loc":{"source":null,"start":{"line":18,"column":17},"end":{"line":18,"column":18}}, + "range":[328,329], + "name":"b", + "typeAnnotation":null, + "optional":false + } + ] + }, + "directive":null + }, + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":21,"column":0},"end":{"line":22,"column":39}}, + "range":[349,432], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":21,"column":21},"end":{"line":21,"column":26}}, + "range":[370,375], + "id":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":6},"end":{"line":21,"column":20}}, + "range":[355,369], + "value":" 5.1 L id " + } + ], + "loc":{"source":null,"start":{"line":21,"column":21},"end":{"line":21,"column":22}}, + "range":[370,371], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":28},"end":{"line":21,"column":43}}, + "range":[377,392], + "value":" 5.2 T num " + } + ], + "loc":{"source":null,"start":{"line":21,"column":25},"end":{"line":21,"column":26}}, + "range":[374,375], + "value":1, + "raw":"1" + } + }, + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":22,"column":17},"end":{"line":22,"column":22}}, + "range":[410,415], + "id":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":2},"end":{"line":22,"column":16}}, + "range":[395,409], + "value":" 5.3 L id " + } + ], + "loc":{"source":null,"start":{"line":22,"column":17},"end":{"line":22,"column":18}}, + "range":[410,411], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":23},"end":{"line":22,"column":38}}, + "range":[416,431], + "value":" 5.4 T num " + } + ], + "loc":{"source":null,"start":{"line":22,"column":21},"end":{"line":22,"column":22}}, + "range":[414,415], + "value":2, + "raw":"2" + } + } + ], + "kind":"const" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":24,"column":0},"end":{"line":27,"column":3}}, + "range":[434,518], + "expression":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":24,"column":1},"end":{"line":27,"column":1}}, + "range":[435,516], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":25,"column":17},"end":{"line":25,"column":21}}, + "range":[454,458], + "key":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":2},"end":{"line":25,"column":16}}, + "range":[439,453], + "value":" 6.1 L id " + } + ], + "loc":{"source":null,"start":{"line":25,"column":17},"end":{"line":25,"column":18}}, + "range":[454,455], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":23},"end":{"line":25,"column":38}}, + "range":[460,475], + "value":" 6.2 T num " + } + ], + "loc":{"source":null,"start":{"line":25,"column":20},"end":{"line":25,"column":21}}, + "range":[457,458], + "value":1, + "raw":"1" + }, + "kind":"init", + "method":false, + "shorthand":false, + "computed":false + }, + { + "type":"Property", + "loc":{"source":null,"start":{"line":26,"column":17},"end":{"line":26,"column":21}}, + "range":[493,497], + "key":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":2},"end":{"line":26,"column":16}}, + "range":[478,492], + "value":" 6.3 L id " + } + ], + "loc":{"source":null,"start":{"line":26,"column":17},"end":{"line":26,"column":18}}, + "range":[493,494], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":23},"end":{"line":26,"column":38}}, + "range":[499,514], + "value":" 6.4 T num " + } + ], + "loc":{"source":null,"start":{"line":26,"column":20},"end":{"line":26,"column":21}}, + "range":[496,497], + "value":2, + "raw":"2" + }, + "kind":"init", + "method":false, + "shorthand":false, + "computed":false + } + ] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":29,"column":0},"end":{"line":32,"column":4}}, + "range":[520,599], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":29,"column":0},"end":{"line":32,"column":3}}, + "range":[520,598], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":29,"column":0},"end":{"line":29,"column":3}}, + "range":[520,523], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":29,"column":3},"end":{"line":32,"column":1}}, + "range":[523,596], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":30,"column":17},"end":{"line":30,"column":18}}, + "range":[542,543], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":20},"end":{"line":30,"column":34}}, + "range":[545,559], + "value":" 7.2 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":2},"end":{"line":30,"column":16}}, + "range":[527,541], + "value":" 7.1 L id " + } + ], + "loc":{"source":null,"start":{"line":30,"column":17},"end":{"line":30,"column":18}}, + "range":[542,543], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":31,"column":17},"end":{"line":31,"column":18}}, + "range":[577,578], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":20},"end":{"line":31,"column":34}}, + "range":[580,594], + "value":" 7.4 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":2},"end":{"line":31,"column":16}}, + "range":[562,576], + "value":" 7.3 L id " + } + ], + "loc":{"source":null,"start":{"line":31,"column":17},"end":{"line":31,"column":18}}, + "range":[577,578], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + }, + "arguments":[] + }, + "directive":null + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":34,"column":0},"end":{"line":37,"column":2}}, + "range":[601,698], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":34,"column":5},"end":{"line":34,"column":8}}, + "range":[606,609], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":34,"column":11},"end":{"line":37,"column":1}}, + "range":[612,697], + "inexact":false, + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":35,"column":17},"end":{"line":35,"column":23}}, + "range":[631,637], + "key":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":2},"end":{"line":35,"column":16}}, + "range":[616,630], + "value":" 8.1 L id " + } + ], + "loc":{"source":null,"start":{"line":35,"column":17},"end":{"line":35,"column":18}}, + "range":[631,632], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":25},"end":{"line":35,"column":40}}, + "range":[639,654], + "value":" 8.2 T any " + } + ], + "loc":{"source":null,"start":{"line":35,"column":20},"end":{"line":35,"column":23}}, + "range":[634,637] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + }, + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":36,"column":17},"end":{"line":36,"column":23}}, + "range":[672,678], + "key":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":2},"end":{"line":36,"column":16}}, + "range":[657,671], + "value":" 8.3 L id " + } + ], + "loc":{"source":null,"start":{"line":36,"column":17},"end":{"line":36,"column":18}}, + "range":[672,673], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":25},"end":{"line":36,"column":40}}, + "range":[680,695], + "value":" 8.4 T any " + } + ], + "loc":{"source":null,"start":{"line":36,"column":20},"end":{"line":36,"column":23}}, + "range":[675,678] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":39,"column":0},"end":{"line":42,"column":1}}, + "range":[700,782], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":39,"column":5},"end":{"line":39,"column":8}}, + "range":[705,708], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":39,"column":9},"end":{"line":42,"column":1}}, + "range":[709,782], + "members":[ + { + "type":"EnumDefaultedMember", + "loc":{"source":null,"start":{"line":40,"column":17},"end":{"line":40,"column":18}}, + "range":[728,729], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":40,"column":20},"end":{"line":40,"column":34}}, + "range":[731,745], + "value":" 9.2 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":40,"column":2},"end":{"line":40,"column":16}}, + "range":[713,727], + "value":" 9.1 L id " + } + ], + "loc":{"source":null,"start":{"line":40,"column":17},"end":{"line":40,"column":18}}, + "range":[728,729], + "name":"A", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"EnumDefaultedMember", + "loc":{"source":null,"start":{"line":41,"column":17},"end":{"line":41,"column":18}}, + "range":[763,764], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":41,"column":20},"end":{"line":41,"column":34}}, + "range":[766,780], + "value":" 9.4 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":41,"column":2},"end":{"line":41,"column":16}}, + "range":[748,762], + "value":" 9.3 L id " + } + ], + "loc":{"source":null,"start":{"line":41,"column":17},"end":{"line":41,"column":18}}, + "range":[763,764], + "name":"B", + "typeAnnotation":null, + "optional":false + } + } + ], + "explicitType":false, + "hasUnknownMembers":false + } + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "range":[16,30], + "value":" 1.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":33}}, + "range":[33,47], + "value":" 1.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":35},"end":{"line":2,"column":49}}, + "range":[49,63], + "value":" 1.3 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":16}}, + "range":[66,80], + "value":" 1.4 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":19},"end":{"line":3,"column":33}}, + "range":[83,97], + "value":" 1.5 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":35},"end":{"line":3,"column":49}}, + "range":[99,113], + "value":" 1.6 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":2},"end":{"line":7,"column":16}}, + "range":[126,140], + "value":" 2.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":20},"end":{"line":7,"column":34}}, + "range":[144,158], + "value":" 2.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":2},"end":{"line":8,"column":16}}, + "range":[161,175], + "value":" 2.3 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":20},"end":{"line":8,"column":34}}, + "range":[179,193], + "value":" 2.4 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":2},"end":{"line":12,"column":16}}, + "range":[202,216], + "value":" 3.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":20},"end":{"line":12,"column":34}}, + "range":[220,234], + "value":" 3.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":2},"end":{"line":13,"column":16}}, + "range":[237,251], + "value":" 3.3 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":20},"end":{"line":13,"column":34}}, + "range":[255,269], + "value":" 3.4 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":2},"end":{"line":17,"column":16}}, + "range":[278,292], + "value":" 4.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":20},"end":{"line":17,"column":34}}, + "range":[296,310], + "value":" 4.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":18,"column":16}}, + "range":[313,327], + "value":" 4.3 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":19},"end":{"line":18,"column":33}}, + "range":[330,344], + "value":" 4.4 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":6},"end":{"line":21,"column":20}}, + "range":[355,369], + "value":" 5.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":28},"end":{"line":21,"column":43}}, + "range":[377,392], + "value":" 5.2 T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":2},"end":{"line":22,"column":16}}, + "range":[395,409], + "value":" 5.3 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":23},"end":{"line":22,"column":38}}, + "range":[416,431], + "value":" 5.4 T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":2},"end":{"line":25,"column":16}}, + "range":[439,453], + "value":" 6.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":23},"end":{"line":25,"column":38}}, + "range":[460,475], + "value":" 6.2 T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":2},"end":{"line":26,"column":16}}, + "range":[478,492], + "value":" 6.3 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":23},"end":{"line":26,"column":38}}, + "range":[499,514], + "value":" 6.4 T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":2},"end":{"line":30,"column":16}}, + "range":[527,541], + "value":" 7.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":20},"end":{"line":30,"column":34}}, + "range":[545,559], + "value":" 7.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":2},"end":{"line":31,"column":16}}, + "range":[562,576], + "value":" 7.3 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":20},"end":{"line":31,"column":34}}, + "range":[580,594], + "value":" 7.4 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":2},"end":{"line":35,"column":16}}, + "range":[616,630], + "value":" 8.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":25},"end":{"line":35,"column":40}}, + "range":[639,654], + "value":" 8.2 T any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":2},"end":{"line":36,"column":16}}, + "range":[657,671], + "value":" 8.3 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":25},"end":{"line":36,"column":40}}, + "range":[680,695], + "value":" 8.4 T any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":40,"column":2},"end":{"line":40,"column":16}}, + "range":[713,727], + "value":" 9.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":40,"column":20},"end":{"line":40,"column":34}}, + "range":[731,745], + "value":" 9.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":41,"column":2},"end":{"line":41,"column":16}}, + "range":[748,762], + "value":" 9.3 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":41,"column":20},"end":{"line":41,"column":34}}, + "range":[766,780], + "value":" 9.4 T id " + } + ] +} diff --git a/lib/test/flow/comment_interning/try.js b/lib/test/flow/comment_interning/try.js new file mode 100644 index 0000000..f8698ad --- /dev/null +++ b/lib/test/flow/comment_interning/try.js @@ -0,0 +1,41 @@ +function onlyLeading() { + /* Not leading */ + const z = 0; + // 1.1 Leading A + /* 1.2 Leading B */ try { + const x = 1; + } catch (e1) { + console.log(1); + } +} + +function onlyTrailing() { + try /* 2.1 Leading block */ { + /* 2.2 Not trailing */ + const y = 2; + } catch (e2) { + console.log(2); + } + /* 2.3 Trailing block */ +} + +function leadingAndTrailing() { + // 3.1 Leading + try /* 3.2 Leading block */ { + /* 3.3 Not trailing */ + const y = 2; + } finally { + console.log(3); + } + /* 3.4 Trailing block */ +} + +function trailingWithCatch() { + try {} catch {} /* 4.1 T block */ + /* 4.2 L try */ try {} catch {} /* 4.3 T block */ +} + +function trailingWithFinally() { + try {} finally {} /* 5.1 T block */ + /* 5.2 L try */ try {} finally {} /* 5.3 T block */ +} diff --git a/lib/test/flow/comment_interning/try.options.json b/lib/test/flow/comment_interning/try.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/try.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/try.tree.json b/lib/test/flow/comment_interning/try.tree.json new file mode 100644 index 0000000..c482c98 --- /dev/null +++ b/lib/test/flow/comment_interning/try.tree.json @@ -0,0 +1,777 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":41,"column":1}}, + "range":[0,782], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":10,"column":1}}, + "range":[0,166], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":20}}, + "range":[9,20], + "name":"onlyLeading", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":10,"column":1}}, + "range":[23,166], + "body":[ + { + "type":"VariableDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":19}}, + "range":[27,44], + "value":" Not leading " + } + ], + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":14}}, + "range":[47,59], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":13}}, + "range":[53,58], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":9}}, + "range":[53,54], + "name":"z", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":12},"end":{"line":3,"column":13}}, + "range":[57,58], + "value":0, + "raw":"0" + } + } + ], + "kind":"const" + }, + { + "type":"TryStatement", + "leadingComments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":18}}, + "range":[62,78], + "value":" 1.1 Leading A" + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":2},"end":{"line":5,"column":21}}, + "range":[81,100], + "value":" 1.2 Leading B " + } + ], + "loc":{"source":null,"start":{"line":5,"column":22},"end":{"line":9,"column":3}}, + "range":[101,164], + "block":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":5,"column":26},"end":{"line":7,"column":3}}, + "range":[105,127], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":6,"column":4},"end":{"line":6,"column":16}}, + "range":[111,123], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":6,"column":10},"end":{"line":6,"column":15}}, + "range":[117,122], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":10},"end":{"line":6,"column":11}}, + "range":[117,118], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":6,"column":14},"end":{"line":6,"column":15}}, + "range":[121,122], + "value":1, + "raw":"1" + } + } + ], + "kind":"const" + } + ] + }, + "handler":{ + "type":"CatchClause", + "loc":{"source":null,"start":{"line":7,"column":4},"end":{"line":9,"column":3}}, + "range":[128,164], + "param":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":11},"end":{"line":7,"column":13}}, + "range":[135,137], + "name":"e1", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":7,"column":15},"end":{"line":9,"column":3}}, + "range":[139,164], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":8,"column":4},"end":{"line":8,"column":19}}, + "range":[145,160], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":8,"column":4},"end":{"line":8,"column":18}}, + "range":[145,159], + "callee":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":8,"column":4},"end":{"line":8,"column":15}}, + "range":[145,156], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":8,"column":4},"end":{"line":8,"column":11}}, + "range":[145,152], + "name":"console", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":8,"column":12},"end":{"line":8,"column":15}}, + "range":[153,156], + "name":"log", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "typeArguments":null, + "arguments":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":8,"column":16},"end":{"line":8,"column":17}}, + "range":[157,158], + "value":1, + "raw":"1" + } + ] + }, + "directive":null + } + ] + } + }, + "finalizer":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":12,"column":0},"end":{"line":20,"column":1}}, + "range":[168,339], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":12,"column":9},"end":{"line":12,"column":21}}, + "range":[177,189], + "name":"onlyTrailing", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":12,"column":24},"end":{"line":20,"column":1}}, + "range":[192,339], + "body":[ + { + "type":"TryStatement", + "loc":{"source":null,"start":{"line":13,"column":2},"end":{"line":18,"column":3}}, + "range":[196,310], + "block":{ + "type":"BlockStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":6},"end":{"line":13,"column":29}}, + "range":[200,223], + "value":" 2.1 Leading block " + } + ], + "loc":{"source":null,"start":{"line":13,"column":30},"end":{"line":16,"column":3}}, + "range":[224,273], + "body":[ + { + "type":"VariableDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":4},"end":{"line":14,"column":26}}, + "range":[230,252], + "value":" 2.2 Not trailing " + } + ], + "loc":{"source":null,"start":{"line":15,"column":4},"end":{"line":15,"column":16}}, + "range":[257,269], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":15,"column":10},"end":{"line":15,"column":15}}, + "range":[263,268], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":15,"column":10},"end":{"line":15,"column":11}}, + "range":[263,264], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":15,"column":14},"end":{"line":15,"column":15}}, + "range":[267,268], + "value":2, + "raw":"2" + } + } + ], + "kind":"const" + } + ] + }, + "handler":{ + "type":"CatchClause", + "loc":{"source":null,"start":{"line":16,"column":4},"end":{"line":18,"column":3}}, + "range":[274,310], + "param":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":16,"column":11},"end":{"line":16,"column":13}}, + "range":[281,283], + "name":"e2", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":2},"end":{"line":19,"column":26}}, + "range":[313,337], + "value":" 2.3 Trailing block " + } + ], + "loc":{"source":null,"start":{"line":16,"column":15},"end":{"line":18,"column":3}}, + "range":[285,310], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":17,"column":4},"end":{"line":17,"column":19}}, + "range":[291,306], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":17,"column":4},"end":{"line":17,"column":18}}, + "range":[291,305], + "callee":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":17,"column":4},"end":{"line":17,"column":15}}, + "range":[291,302], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":17,"column":4},"end":{"line":17,"column":11}}, + "range":[291,298], + "name":"console", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":17,"column":12},"end":{"line":17,"column":15}}, + "range":[299,302], + "name":"log", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "typeArguments":null, + "arguments":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":17,"column":16},"end":{"line":17,"column":17}}, + "range":[303,304], + "value":2, + "raw":"2" + } + ] + }, + "directive":null + } + ] + } + }, + "finalizer":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":22,"column":0},"end":{"line":31,"column":1}}, + "range":[341,532], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":22,"column":9},"end":{"line":22,"column":27}}, + "range":[350,368], + "name":"leadingAndTrailing", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":22,"column":30},"end":{"line":31,"column":1}}, + "range":[371,532], + "body":[ + { + "type":"TryStatement", + "leadingComments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":23,"column":2},"end":{"line":23,"column":16}}, + "range":[375,389], + "value":" 3.1 Leading" + } + ], + "loc":{"source":null,"start":{"line":24,"column":2},"end":{"line":29,"column":3}}, + "range":[392,503], + "block":{ + "type":"BlockStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":6},"end":{"line":24,"column":29}}, + "range":[396,419], + "value":" 3.2 Leading block " + } + ], + "loc":{"source":null,"start":{"line":24,"column":30},"end":{"line":27,"column":3}}, + "range":[420,469], + "body":[ + { + "type":"VariableDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":4},"end":{"line":25,"column":26}}, + "range":[426,448], + "value":" 3.3 Not trailing " + } + ], + "loc":{"source":null,"start":{"line":26,"column":4},"end":{"line":26,"column":16}}, + "range":[453,465], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":26,"column":10},"end":{"line":26,"column":15}}, + "range":[459,464], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":26,"column":10},"end":{"line":26,"column":11}}, + "range":[459,460], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":26,"column":14},"end":{"line":26,"column":15}}, + "range":[463,464], + "value":2, + "raw":"2" + } + } + ], + "kind":"const" + } + ] + }, + "handler":null, + "finalizer":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":2},"end":{"line":30,"column":26}}, + "range":[506,530], + "value":" 3.4 Trailing block " + } + ], + "loc":{"source":null,"start":{"line":27,"column":12},"end":{"line":29,"column":3}}, + "range":[478,503], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":28,"column":4},"end":{"line":28,"column":19}}, + "range":[484,499], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":28,"column":4},"end":{"line":28,"column":18}}, + "range":[484,498], + "callee":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":28,"column":4},"end":{"line":28,"column":15}}, + "range":[484,495], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":28,"column":4},"end":{"line":28,"column":11}}, + "range":[484,491], + "name":"console", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":28,"column":12},"end":{"line":28,"column":15}}, + "range":[492,495], + "name":"log", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "typeArguments":null, + "arguments":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":28,"column":16},"end":{"line":28,"column":17}}, + "range":[496,497], + "value":3, + "raw":"3" + } + ] + }, + "directive":null + } + ] + } + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":33,"column":0},"end":{"line":36,"column":1}}, + "range":[534,654], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":33,"column":9},"end":{"line":33,"column":26}}, + "range":[543,560], + "name":"trailingWithCatch", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":33,"column":29},"end":{"line":36,"column":1}}, + "range":[563,654], + "body":[ + { + "type":"TryStatement", + "loc":{"source":null,"start":{"line":34,"column":2},"end":{"line":34,"column":17}}, + "range":[567,582], + "block":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":34,"column":6},"end":{"line":34,"column":8}}, + "range":[571,573], + "body":[] + }, + "handler":{ + "type":"CatchClause", + "loc":{"source":null,"start":{"line":34,"column":9},"end":{"line":34,"column":17}}, + "range":[574,582], + "param":null, + "body":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":18},"end":{"line":34,"column":35}}, + "range":[583,600], + "value":" 4.1 T block " + } + ], + "loc":{"source":null,"start":{"line":34,"column":15},"end":{"line":34,"column":17}}, + "range":[580,582], + "body":[] + } + }, + "finalizer":null + }, + { + "type":"TryStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":2},"end":{"line":35,"column":17}}, + "range":[603,618], + "value":" 4.2 L try " + } + ], + "loc":{"source":null,"start":{"line":35,"column":18},"end":{"line":35,"column":33}}, + "range":[619,634], + "block":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":35,"column":22},"end":{"line":35,"column":24}}, + "range":[623,625], + "body":[] + }, + "handler":{ + "type":"CatchClause", + "loc":{"source":null,"start":{"line":35,"column":25},"end":{"line":35,"column":33}}, + "range":[626,634], + "param":null, + "body":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":34},"end":{"line":35,"column":51}}, + "range":[635,652], + "value":" 4.3 T block " + } + ], + "loc":{"source":null,"start":{"line":35,"column":31},"end":{"line":35,"column":33}}, + "range":[632,634], + "body":[] + } + }, + "finalizer":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":38,"column":0},"end":{"line":41,"column":1}}, + "range":[656,782], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":38,"column":9},"end":{"line":38,"column":28}}, + "range":[665,684], + "name":"trailingWithFinally", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":38,"column":31},"end":{"line":41,"column":1}}, + "range":[687,782], + "body":[ + { + "type":"TryStatement", + "loc":{"source":null,"start":{"line":39,"column":2},"end":{"line":39,"column":19}}, + "range":[691,708], + "block":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":39,"column":6},"end":{"line":39,"column":8}}, + "range":[695,697], + "body":[] + }, + "handler":null, + "finalizer":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":39,"column":20},"end":{"line":39,"column":37}}, + "range":[709,726], + "value":" 5.1 T block " + } + ], + "loc":{"source":null,"start":{"line":39,"column":17},"end":{"line":39,"column":19}}, + "range":[706,708], + "body":[] + } + }, + { + "type":"TryStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":40,"column":2},"end":{"line":40,"column":17}}, + "range":[729,744], + "value":" 5.2 L try " + } + ], + "loc":{"source":null,"start":{"line":40,"column":18},"end":{"line":40,"column":35}}, + "range":[745,762], + "block":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":40,"column":22},"end":{"line":40,"column":24}}, + "range":[749,751], + "body":[] + }, + "handler":null, + "finalizer":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":40,"column":36},"end":{"line":40,"column":53}}, + "range":[763,780], + "value":" 5.3 T block " + } + ], + "loc":{"source":null,"start":{"line":40,"column":33},"end":{"line":40,"column":35}}, + "range":[760,762], + "body":[] + } + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":19}}, + "range":[27,44], + "value":" Not leading " + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":18}}, + "range":[62,78], + "value":" 1.1 Leading A" + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":2},"end":{"line":5,"column":21}}, + "range":[81,100], + "value":" 1.2 Leading B " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":6},"end":{"line":13,"column":29}}, + "range":[200,223], + "value":" 2.1 Leading block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":4},"end":{"line":14,"column":26}}, + "range":[230,252], + "value":" 2.2 Not trailing " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":2},"end":{"line":19,"column":26}}, + "range":[313,337], + "value":" 2.3 Trailing block " + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":23,"column":2},"end":{"line":23,"column":16}}, + "range":[375,389], + "value":" 3.1 Leading" + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":6},"end":{"line":24,"column":29}}, + "range":[396,419], + "value":" 3.2 Leading block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":4},"end":{"line":25,"column":26}}, + "range":[426,448], + "value":" 3.3 Not trailing " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":2},"end":{"line":30,"column":26}}, + "range":[506,530], + "value":" 3.4 Trailing block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":18},"end":{"line":34,"column":35}}, + "range":[583,600], + "value":" 4.1 T block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":2},"end":{"line":35,"column":17}}, + "range":[603,618], + "value":" 4.2 L try " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":34},"end":{"line":35,"column":51}}, + "range":[635,652], + "value":" 4.3 T block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":39,"column":20},"end":{"line":39,"column":37}}, + "range":[709,726], + "value":" 5.1 T block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":40,"column":2},"end":{"line":40,"column":17}}, + "range":[729,744], + "value":" 5.2 L try " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":40,"column":36},"end":{"line":40,"column":53}}, + "range":[763,780], + "value":" 5.3 T block " + } + ] +} diff --git a/lib/test/flow/comment_interning/type_alias.js b/lib/test/flow/comment_interning/type_alias.js new file mode 100644 index 0000000..c5a4a13 --- /dev/null +++ b/lib/test/flow/comment_interning/type_alias.js @@ -0,0 +1,21 @@ +/* 1.1 L alias */ type /* 1.2 L id */ Foo1 /* 1.3 L tparams */ /* 1.4 T tparams */ = /* 1.5 L type */ boolean /* 1.6 T type */; /* 1.7 T alias */ + +/* 2.1 L opaque */ opaque /* 2.2 L opaque */ type /* 2.3 L id */ Foo2 /* 2.4 L tparams */ /* 2.5 T tparams */ = /* 2.6 L type */ boolean /* 2.7 T type */; /* 2.8 T opaque */ + +{ + /* 3.1 L alias */ type t = any /* 3.2 T any */ + /* 3.3 L alias */ type t = any + /* 3.4 T any */ +} + +{ + /* 4.1 L opaque */ opaque type T = any /* 4.2 T any */ + /* 4.3 L opaque */ opaque type T = any + /* 4.4 T any */ +} + +type Foo /* 4.1 T id */ + /* 4.2 L tparams */ = any; + +opaque type Foo /* 5.1 T id */ + /* 5.2 L tparams */ = any; diff --git a/lib/test/flow/comment_interning/type_alias.options.json b/lib/test/flow/comment_interning/type_alias.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/type_alias.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/type_alias.tree.json b/lib/test/flow/comment_interning/type_alias.tree.json new file mode 100644 index 0000000..ea58286 --- /dev/null +++ b/lib/test/flow/comment_interning/type_alias.tree.json @@ -0,0 +1,615 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":21,"column":32}}, + "range":[18,677], + "body":[ + { + "type":"TypeAlias", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":132},"end":{"line":1,"column":149}}, + "range":[132,149], + "value":" 1.7 T alias " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "value":" 1.1 L alias " + } + ], + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":131}}, + "range":[18,131], + "id":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":37}}, + "range":[23,37], + "value":" 1.2 L id " + } + ], + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":42}}, + "range":[38,42], + "name":"Foo1", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":67},"end":{"line":1,"column":86}}, + "range":[67,86], + "value":" 1.4 T tparams " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":43},"end":{"line":1,"column":62}}, + "range":[43,62], + "value":" 1.3 L tparams " + } + ], + "loc":{"source":null,"start":{"line":1,"column":63},"end":{"line":1,"column":66}}, + "range":[63,66], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":64},"end":{"line":1,"column":65}}, + "range":[64,65], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "right":{ + "type":"BooleanTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":114},"end":{"line":1,"column":130}}, + "range":[114,130], + "value":" 1.6 T type " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":89},"end":{"line":1,"column":105}}, + "range":[89,105], + "value":" 1.5 L type " + } + ], + "loc":{"source":null,"start":{"line":1,"column":106},"end":{"line":1,"column":113}}, + "range":[106,113] + } + }, + { + "type":"OpaqueType", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":159},"end":{"line":3,"column":177}}, + "range":[310,328], + "value":" 2.8 T opaque " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":18}}, + "range":[151,169], + "value":" 2.1 L opaque " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":26},"end":{"line":3,"column":44}}, + "range":[177,195], + "value":" 2.2 L opaque " + } + ], + "loc":{"source":null,"start":{"line":3,"column":19},"end":{"line":3,"column":158}}, + "range":[170,309], + "id":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":50},"end":{"line":3,"column":64}}, + "range":[201,215], + "value":" 2.3 L id " + } + ], + "loc":{"source":null,"start":{"line":3,"column":65},"end":{"line":3,"column":69}}, + "range":[216,220], + "name":"Foo2", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":94},"end":{"line":3,"column":113}}, + "range":[245,264], + "value":" 2.5 T tparams " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":70},"end":{"line":3,"column":89}}, + "range":[221,240], + "value":" 2.4 L tparams " + } + ], + "loc":{"source":null,"start":{"line":3,"column":90},"end":{"line":3,"column":93}}, + "range":[241,244], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":3,"column":91},"end":{"line":3,"column":92}}, + "range":[242,243], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "impltype":{ + "type":"BooleanTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":141},"end":{"line":3,"column":157}}, + "range":[292,308], + "value":" 2.7 T type " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":116},"end":{"line":3,"column":132}}, + "range":[267,283], + "value":" 2.6 L type " + } + ], + "loc":{"source":null,"start":{"line":3,"column":133},"end":{"line":3,"column":140}}, + "range":[284,291] + }, + "supertype":null + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":9,"column":1}}, + "range":[330,433], + "body":[ + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":19}}, + "range":[334,351], + "value":" 3.1 L alias " + } + ], + "loc":{"source":null,"start":{"line":6,"column":20},"end":{"line":6,"column":32}}, + "range":[352,364], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":25},"end":{"line":6,"column":26}}, + "range":[357,358], + "name":"t", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":33},"end":{"line":6,"column":48}}, + "range":[365,380], + "value":" 3.2 T any " + } + ], + "loc":{"source":null,"start":{"line":6,"column":29},"end":{"line":6,"column":32}}, + "range":[361,364] + } + }, + { + "type":"TypeAlias", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":2},"end":{"line":7,"column":19}}, + "range":[383,400], + "value":" 3.3 L alias " + } + ], + "loc":{"source":null,"start":{"line":7,"column":20},"end":{"line":7,"column":32}}, + "range":[401,413], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":25},"end":{"line":7,"column":26}}, + "range":[406,407], + "name":"t", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":2},"end":{"line":8,"column":17}}, + "range":[416,431], + "value":" 3.4 T any " + } + ], + "loc":{"source":null,"start":{"line":7,"column":29},"end":{"line":7,"column":32}}, + "range":[410,413] + } + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":15,"column":1}}, + "range":[435,554], + "body":[ + { + "type":"OpaqueType", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":2},"end":{"line":12,"column":20}}, + "range":[439,457], + "value":" 4.1 L opaque " + } + ], + "loc":{"source":null,"start":{"line":12,"column":21},"end":{"line":12,"column":40}}, + "range":[458,477], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":12,"column":33},"end":{"line":12,"column":34}}, + "range":[470,471], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "impltype":{ + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":41},"end":{"line":12,"column":56}}, + "range":[478,493], + "value":" 4.2 T any " + } + ], + "loc":{"source":null,"start":{"line":12,"column":37},"end":{"line":12,"column":40}}, + "range":[474,477] + }, + "supertype":null + }, + { + "type":"OpaqueType", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":2},"end":{"line":13,"column":20}}, + "range":[496,514], + "value":" 4.3 L opaque " + } + ], + "loc":{"source":null,"start":{"line":13,"column":21},"end":{"line":13,"column":40}}, + "range":[515,534], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":13,"column":33},"end":{"line":13,"column":34}}, + "range":[527,528], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "impltype":{ + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":2},"end":{"line":14,"column":17}}, + "range":[537,552], + "value":" 4.4 T any " + } + ], + "loc":{"source":null,"start":{"line":13,"column":37},"end":{"line":13,"column":40}}, + "range":[531,534] + }, + "supertype":null + } + ] + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":17,"column":0},"end":{"line":18,"column":32}}, + "range":[556,612], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":9},"end":{"line":17,"column":23}}, + "range":[565,579], + "value":" 4.1 T id " + } + ], + "loc":{"source":null,"start":{"line":17,"column":5},"end":{"line":17,"column":8}}, + "range":[561,564], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":18,"column":21}}, + "range":[582,601], + "value":" 4.2 L tparams " + } + ], + "loc":{"source":null,"start":{"line":18,"column":22},"end":{"line":18,"column":25}}, + "range":[602,605], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":18,"column":23},"end":{"line":18,"column":24}}, + "range":[603,604], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "right":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":18,"column":28},"end":{"line":18,"column":31}}, + "range":[608,611] + } + }, + { + "type":"OpaqueType", + "loc":{"source":null,"start":{"line":20,"column":0},"end":{"line":21,"column":32}}, + "range":[614,677], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":16},"end":{"line":20,"column":30}}, + "range":[630,644], + "value":" 5.1 T id " + } + ], + "loc":{"source":null,"start":{"line":20,"column":12},"end":{"line":20,"column":15}}, + "range":[626,629], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":2},"end":{"line":21,"column":21}}, + "range":[647,666], + "value":" 5.2 L tparams " + } + ], + "loc":{"source":null,"start":{"line":21,"column":22},"end":{"line":21,"column":25}}, + "range":[667,670], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":21,"column":23},"end":{"line":21,"column":24}}, + "range":[668,669], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "impltype":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":21,"column":28},"end":{"line":21,"column":31}}, + "range":[673,676] + }, + "supertype":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "value":" 1.1 L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":37}}, + "range":[23,37], + "value":" 1.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":43},"end":{"line":1,"column":62}}, + "range":[43,62], + "value":" 1.3 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":67},"end":{"line":1,"column":86}}, + "range":[67,86], + "value":" 1.4 T tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":89},"end":{"line":1,"column":105}}, + "range":[89,105], + "value":" 1.5 L type " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":114},"end":{"line":1,"column":130}}, + "range":[114,130], + "value":" 1.6 T type " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":132},"end":{"line":1,"column":149}}, + "range":[132,149], + "value":" 1.7 T alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":18}}, + "range":[151,169], + "value":" 2.1 L opaque " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":26},"end":{"line":3,"column":44}}, + "range":[177,195], + "value":" 2.2 L opaque " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":50},"end":{"line":3,"column":64}}, + "range":[201,215], + "value":" 2.3 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":70},"end":{"line":3,"column":89}}, + "range":[221,240], + "value":" 2.4 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":94},"end":{"line":3,"column":113}}, + "range":[245,264], + "value":" 2.5 T tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":116},"end":{"line":3,"column":132}}, + "range":[267,283], + "value":" 2.6 L type " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":141},"end":{"line":3,"column":157}}, + "range":[292,308], + "value":" 2.7 T type " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":159},"end":{"line":3,"column":177}}, + "range":[310,328], + "value":" 2.8 T opaque " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":19}}, + "range":[334,351], + "value":" 3.1 L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":33},"end":{"line":6,"column":48}}, + "range":[365,380], + "value":" 3.2 T any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":2},"end":{"line":7,"column":19}}, + "range":[383,400], + "value":" 3.3 L alias " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":8,"column":2},"end":{"line":8,"column":17}}, + "range":[416,431], + "value":" 3.4 T any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":2},"end":{"line":12,"column":20}}, + "range":[439,457], + "value":" 4.1 L opaque " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":12,"column":41},"end":{"line":12,"column":56}}, + "range":[478,493], + "value":" 4.2 T any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":2},"end":{"line":13,"column":20}}, + "range":[496,514], + "value":" 4.3 L opaque " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":2},"end":{"line":14,"column":17}}, + "range":[537,552], + "value":" 4.4 T any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":9},"end":{"line":17,"column":23}}, + "range":[565,579], + "value":" 4.1 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":18,"column":21}}, + "range":[582,601], + "value":" 4.2 L tparams " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":20,"column":16},"end":{"line":20,"column":30}}, + "range":[630,644], + "value":" 5.1 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":2},"end":{"line":21,"column":21}}, + "range":[647,666], + "value":" 5.2 L tparams " + } + ] +} diff --git a/lib/test/flow/comment_interning/type_cast.js b/lib/test/flow/comment_interning/type_cast.js new file mode 100644 index 0000000..31c3bcf --- /dev/null +++ b/lib/test/flow/comment_interning/type_cast.js @@ -0,0 +1,15 @@ +function leadingOnly() { + /* 1.1 Leading */ (1: number) +} + +function trailingOnly() { + (1: number) /* 2.1 trailing */ +} + +function leadingAndTrailing() { + /* 3.1 Leading */ (1: number) /* 3.2 Trailing */ +} + +function innerComments() { + /* 4.1 L cast */ (/* 4.2 L num */ 1 /* 4.3 T num */ : /* 4.4 L type */ number /* 4.5 T type */) /* 4.6 T cast */ +} diff --git a/lib/test/flow/comment_interning/type_cast.options.json b/lib/test/flow/comment_interning/type_cast.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/type_cast.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/type_cast.tree.json b/lib/test/flow/comment_interning/type_cast.tree.json new file mode 100644 index 0000000..754e2da --- /dev/null +++ b/lib/test/flow/comment_interning/type_cast.tree.json @@ -0,0 +1,369 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":15,"column":1}}, + "range":[0,355], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,58], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":20}}, + "range":[9,20], + "name":"leadingOnly", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":3,"column":1}}, + "range":[23,58], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":20},"end":{"line":2,"column":31}}, + "range":[45,56], + "expression":{ + "type":"TypeCastExpression", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":19}}, + "range":[27,44], + "value":" 1.1 Leading " + } + ], + "loc":{"source":null,"start":{"line":2,"column":20},"end":{"line":2,"column":31}}, + "range":[45,56], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":21},"end":{"line":2,"column":22}}, + "range":[46,47], + "value":1, + "raw":"1" + }, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":22},"end":{"line":2,"column":30}}, + "range":[47,55], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":24},"end":{"line":2,"column":30}}, + "range":[49,55] + } + } + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":7,"column":1}}, + "range":[60,120], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":9},"end":{"line":5,"column":21}}, + "range":[69,81], + "name":"trailingOnly", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":5,"column":24},"end":{"line":7,"column":1}}, + "range":[84,120], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":13}}, + "range":[88,99], + "expression":{ + "type":"TypeCastExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":14},"end":{"line":6,"column":32}}, + "range":[100,118], + "value":" 2.1 trailing " + } + ], + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":13}}, + "range":[88,99], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":6,"column":3},"end":{"line":6,"column":4}}, + "range":[89,90], + "value":1, + "raw":"1" + }, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":6,"column":4},"end":{"line":6,"column":12}}, + "range":[90,98], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":6,"column":6},"end":{"line":6,"column":12}}, + "range":[92,98] + } + } + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":11,"column":1}}, + "range":[122,208], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":9},"end":{"line":9,"column":27}}, + "range":[131,149], + "name":"leadingAndTrailing", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":9,"column":30},"end":{"line":11,"column":1}}, + "range":[152,208], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":10,"column":22},"end":{"line":10,"column":33}}, + "range":[176,187], + "expression":{ + "type":"TypeCastExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":34},"end":{"line":10,"column":52}}, + "range":[188,206], + "value":" 3.2 Trailing " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":4},"end":{"line":10,"column":21}}, + "range":[158,175], + "value":" 3.1 Leading " + } + ], + "loc":{"source":null,"start":{"line":10,"column":22},"end":{"line":10,"column":33}}, + "range":[176,187], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":10,"column":23},"end":{"line":10,"column":24}}, + "range":[177,178], + "value":1, + "raw":"1" + }, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":10,"column":24},"end":{"line":10,"column":32}}, + "range":[178,186], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":10,"column":26},"end":{"line":10,"column":32}}, + "range":[180,186] + } + } + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":13,"column":0},"end":{"line":15,"column":1}}, + "range":[210,355], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":13,"column":9},"end":{"line":13,"column":22}}, + "range":[219,232], + "name":"innerComments", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":13,"column":25},"end":{"line":15,"column":1}}, + "range":[235,355], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":14,"column":21},"end":{"line":14,"column":99}}, + "range":[258,336], + "expression":{ + "type":"TypeCastExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":100},"end":{"line":14,"column":116}}, + "range":[337,353], + "value":" 4.6 T cast " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":4},"end":{"line":14,"column":20}}, + "range":[241,257], + "value":" 4.1 L cast " + } + ], + "loc":{"source":null,"start":{"line":14,"column":21},"end":{"line":14,"column":99}}, + "range":[258,336], + "expression":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":40},"end":{"line":14,"column":55}}, + "range":[277,292], + "value":" 4.3 T num " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":22},"end":{"line":14,"column":37}}, + "range":[259,274], + "value":" 4.2 L num " + } + ], + "loc":{"source":null,"start":{"line":14,"column":38},"end":{"line":14,"column":39}}, + "range":[275,276], + "value":1, + "raw":"1" + }, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":14,"column":56},"end":{"line":14,"column":81}}, + "range":[293,318], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":82},"end":{"line":14,"column":98}}, + "range":[319,335], + "value":" 4.5 T type " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":58},"end":{"line":14,"column":74}}, + "range":[295,311], + "value":" 4.4 L type " + } + ], + "loc":{"source":null,"start":{"line":14,"column":75},"end":{"line":14,"column":81}}, + "range":[312,318] + } + } + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":19}}, + "range":[27,44], + "value":" 1.1 Leading " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":14},"end":{"line":6,"column":32}}, + "range":[100,118], + "value":" 2.1 trailing " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":4},"end":{"line":10,"column":21}}, + "range":[158,175], + "value":" 3.1 Leading " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":34},"end":{"line":10,"column":52}}, + "range":[188,206], + "value":" 3.2 Trailing " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":4},"end":{"line":14,"column":20}}, + "range":[241,257], + "value":" 4.1 L cast " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":22},"end":{"line":14,"column":37}}, + "range":[259,274], + "value":" 4.2 L num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":40},"end":{"line":14,"column":55}}, + "range":[277,292], + "value":" 4.3 T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":58},"end":{"line":14,"column":74}}, + "range":[295,311], + "value":" 4.4 L type " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":82},"end":{"line":14,"column":98}}, + "range":[319,335], + "value":" 4.5 T type " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":100},"end":{"line":14,"column":116}}, + "range":[337,353], + "value":" 4.6 T cast " + } + ] +} diff --git a/lib/test/flow/comment_interning/type_parameters.js b/lib/test/flow/comment_interning/type_parameters.js new file mode 100644 index 0000000..3d125b5 --- /dev/null +++ b/lib/test/flow/comment_interning/type_parameters.js @@ -0,0 +1 @@ +() => {}; diff --git a/lib/test/flow/comment_interning/type_parameters.options.json b/lib/test/flow/comment_interning/type_parameters.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/type_parameters.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/type_parameters.tree.json b/lib/test/flow/comment_interning/type_parameters.tree.json new file mode 100644 index 0000000..1f3a3d6 --- /dev/null +++ b/lib/test/flow/comment_interning/type_parameters.tree.json @@ -0,0 +1,63 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "expression":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":32}}, + "range":[30,32], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":23}}, + "range":[4,23], + "value":" 1.1 I tparams " + } + ], + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, + "range":[1,2], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "directive":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":23}}, + "range":[4,23], + "value":" 1.1 I tparams " + } + ] +} diff --git a/lib/test/flow/comment_interning/types.js b/lib/test/flow/comment_interning/types.js new file mode 100644 index 0000000..68eb7b5 --- /dev/null +++ b/lib/test/flow/comment_interning/types.js @@ -0,0 +1,53 @@ +type Test1 = /* 1.1 L generic */ Foo /* 1.2 T generic */ . /* 1.3 L generic */ bar /* 1.4 T generic */; + +type Test2 = T; + +type Test3 = /* 3.1 L nullable */ ? /* 3.2 L generic */ T /* 3.3 T generic */; + +type Test4 = /* 4.1 L typeof */ typeof /* 4.2 L generic */ T /* 4.3 T generic */; + +type Test5 = /* 5.1 L tuple */ [ /* 5.2 L generic */ T /* 5.3 T generic */ ] /* 5.4 T tuple */; + +type Test6 = /* 6.1 L generic */ T /* 6.2 T generic */ [] /* 6.3 T array */; + +type Test7 = /* 7.1 L string lit */ 'foo' /* 7.2 T string lit */; + +type Test8 = /* 8.1 L num lit */ 1 /* 8.2 T num lit */; + +type Test9 = /* 9.1 L bigint lit */ 1n /* 9.2 T bigint lit */; + +type Test10 = /* 10.1 L bool lit */ true /* 10.2 T bool lit */; + +type Test11 = /* 11.1 L interface */ interface /* 11.2 L obj */ {} /* 11.3 T obj */; + +type Test12 = + /* 12.1 L union */ + | /* 12.2 L generic */ A /* 12.3 T generic */ + | /* 12.4 L generic */ B /* 12.5 T generic */; + +type Test13 = + /* 13.1 L intersection */ + & /* 13.2 L generic */ A /* 13.3 T generic */ + & /* 13.4 L generic */ B /* 13.5 T generic */; + +type Test14 = + /* 14.1 L any */ any /* 14.2 T any */ + | /* 14.3 L mixed */ mixed /* 14.4 T mixed */ + | /* 14.5 L empty */ empty /* 14.6 T empty */ + | /* 14.7 L void */ void /* 14.8 T void */ + | /* 14.9 L null */ null /* 14.10 T null */ + | /* 14.11 L number */ number /* 14.12 T number */ + | /* 14.13 L bigint */ bigint /* 14.14 T bigint */ + | /* 14.15 L string */ string /* 14.16 T string */ + | /* 14.17 L boolean */ boolean /* 14.18 T boolean */ + | /* 14.19 L symbol */ symbol /* 14.20 T symbol */ + | /* 14.21 L exists */ * /* 14.22 T exists */; + +type Test15 = /* 15.1 L id */ Foo /* 15.2 L targs */ /* 15.3 T targs */; + +type Test16 = Foo /* 16.1 T id */ + /* 16.2 L targs */ ; + +type Test17 = Foo; + +type Test18 = Foo; diff --git a/lib/test/flow/comment_interning/types.options.json b/lib/test/flow/comment_interning/types.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/types.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/types.tree.json b/lib/test/flow/comment_interning/types.tree.json new file mode 100644 index 0000000..d0365d7 --- /dev/null +++ b/lib/test/flow/comment_interning/types.tree.json @@ -0,0 +1,1764 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":53,"column":41}}, + "range":[0,2010], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":103}}, + "range":[0,103], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, + "range":[5,10], + "name":"Test1", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":82}}, + "range":[33,82], + "id":{ + "type":"QualifiedTypeIdentifier", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":82}}, + "range":[33,82], + "qualification":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":56}}, + "range":[37,56], + "value":" 1.2 T generic " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":32}}, + "range":[13,32], + "value":" 1.1 L generic " + } + ], + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":36}}, + "range":[33,36], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":83},"end":{"line":1,"column":102}}, + "range":[83,102], + "value":" 1.4 T generic " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":59},"end":{"line":1,"column":78}}, + "range":[59,78], + "value":" 1.3 L generic " + } + ], + "loc":{"source":null,"start":{"line":1,"column":79},"end":{"line":1,"column":82}}, + "range":[79,82], + "name":"bar", + "typeAnnotation":null, + "optional":false + } + }, + "typeParameters":null + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":174}}, + "range":[105,279], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":5},"end":{"line":3,"column":10}}, + "range":[110,115], + "name":"Test2", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":3,"column":10},"end":{"line":3,"column":169}}, + "range":[115,274], + "params":[ + { + "type":"TypeParameter", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":55},"end":{"line":3,"column":73}}, + "range":[160,178], + "value":" 2.3 T tparam " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":34},"end":{"line":3,"column":52}}, + "range":[139,157], + "value":" 2.2 L tparam " + } + ], + "loc":{"source":null,"start":{"line":3,"column":32},"end":{"line":3,"column":147}}, + "range":[137,252], + "name":"T", + "bound":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":74},"end":{"line":3,"column":99}}, + "range":[179,204], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":94},"end":{"line":3,"column":99}}, + "range":[199,204], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":100},"end":{"line":3,"column":117}}, + "range":[205,222], + "value":" 2.5 T bound " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":76},"end":{"line":3,"column":93}}, + "range":[181,198], + "value":" 2.4 L bound " + } + ], + "loc":{"source":null,"start":{"line":3,"column":94},"end":{"line":3,"column":99}}, + "range":[199,204], + "name":"Bound", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + "variance":{ + "type":"Variance", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":11},"end":{"line":3,"column":31}}, + "range":[116,136], + "value":" 2.1 L variance " + } + ], + "loc":{"source":null,"start":{"line":3,"column":32},"end":{"line":3,"column":33}}, + "range":[137,138], + "kind":"plus" + }, + "default":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":140},"end":{"line":3,"column":147}}, + "range":[245,252], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":148},"end":{"line":3,"column":167}}, + "range":[253,272], + "value":" 2.6 T default " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":120},"end":{"line":3,"column":139}}, + "range":[225,244], + "value":" 2.5 L default " + } + ], + "loc":{"source":null,"start":{"line":3,"column":140},"end":{"line":3,"column":147}}, + "range":[245,252], + "name":"Default", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + ] + }, + "right":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":172},"end":{"line":3,"column":173}}, + "range":[277,278], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":172},"end":{"line":3,"column":173}}, + "range":[277,278], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":78}}, + "range":[281,359], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":5},"end":{"line":5,"column":10}}, + "range":[286,291], + "name":"Test3", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"NullableTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":13},"end":{"line":5,"column":33}}, + "range":[294,314], + "value":" 3.1 L nullable " + } + ], + "loc":{"source":null,"start":{"line":5,"column":34},"end":{"line":5,"column":57}}, + "range":[315,338], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":56},"end":{"line":5,"column":57}}, + "range":[337,338], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":58},"end":{"line":5,"column":77}}, + "range":[339,358], + "value":" 3.3 T generic " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":36},"end":{"line":5,"column":55}}, + "range":[317,336], + "value":" 3.2 L generic " + } + ], + "loc":{"source":null,"start":{"line":5,"column":56},"end":{"line":5,"column":57}}, + "range":[337,338], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":81}}, + "range":[361,442], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":5},"end":{"line":7,"column":10}}, + "range":[366,371], + "name":"Test4", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"TypeofTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":13},"end":{"line":7,"column":31}}, + "range":[374,392], + "value":" 4.1 L typeof " + } + ], + "loc":{"source":null,"start":{"line":7,"column":32},"end":{"line":7,"column":60}}, + "range":[393,421], + "argument":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":59},"end":{"line":7,"column":60}}, + "range":[420,421], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":61},"end":{"line":7,"column":80}}, + "range":[422,441], + "value":" 4.3 T generic " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":39},"end":{"line":7,"column":58}}, + "range":[400,419], + "value":" 4.2 L generic " + } + ], + "loc":{"source":null,"start":{"line":7,"column":59},"end":{"line":7,"column":60}}, + "range":[420,421], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":9,"column":95}}, + "range":[444,539], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":5},"end":{"line":9,"column":10}}, + "range":[449,454], + "name":"Test5", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"TupleTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":77},"end":{"line":9,"column":94}}, + "range":[521,538], + "value":" 5.4 T tuple " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":13},"end":{"line":9,"column":30}}, + "range":[457,474], + "value":" 5.1 L tuple " + } + ], + "loc":{"source":null,"start":{"line":9,"column":31},"end":{"line":9,"column":76}}, + "range":[475,520], + "types":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":9,"column":53},"end":{"line":9,"column":54}}, + "range":[497,498], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":55},"end":{"line":9,"column":74}}, + "range":[499,518], + "value":" 5.3 T generic " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":33},"end":{"line":9,"column":52}}, + "range":[477,496], + "value":" 5.2 L generic " + } + ], + "loc":{"source":null,"start":{"line":9,"column":53},"end":{"line":9,"column":54}}, + "range":[497,498], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":11,"column":76}}, + "range":[541,617], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":11,"column":5},"end":{"line":11,"column":10}}, + "range":[546,551], + "name":"Test6", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ArrayTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":58},"end":{"line":11,"column":75}}, + "range":[599,616], + "value":" 6.3 T array " + } + ], + "loc":{"source":null,"start":{"line":11,"column":33},"end":{"line":11,"column":57}}, + "range":[574,598], + "elementType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":11,"column":33},"end":{"line":11,"column":34}}, + "range":[574,575], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":35},"end":{"line":11,"column":54}}, + "range":[576,595], + "value":" 6.2 T generic " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":13},"end":{"line":11,"column":32}}, + "range":[554,573], + "value":" 6.1 L generic " + } + ], + "loc":{"source":null,"start":{"line":11,"column":33},"end":{"line":11,"column":34}}, + "range":[574,575], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":13,"column":0},"end":{"line":13,"column":65}}, + "range":[619,684], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":13,"column":5},"end":{"line":13,"column":10}}, + "range":[624,629], + "name":"Test7", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"StringLiteralTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":42},"end":{"line":13,"column":64}}, + "range":[661,683], + "value":" 7.2 T string lit " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":13},"end":{"line":13,"column":35}}, + "range":[632,654], + "value":" 7.1 L string lit " + } + ], + "loc":{"source":null,"start":{"line":13,"column":36},"end":{"line":13,"column":41}}, + "range":[655,660], + "value":"foo", + "raw":"'foo'" + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":15,"column":0},"end":{"line":15,"column":55}}, + "range":[686,741], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":15,"column":5},"end":{"line":15,"column":10}}, + "range":[691,696], + "name":"Test8", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"NumberLiteralTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":35},"end":{"line":15,"column":54}}, + "range":[721,740], + "value":" 8.2 T num lit " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":13},"end":{"line":15,"column":32}}, + "range":[699,718], + "value":" 8.1 L num lit " + } + ], + "loc":{"source":null,"start":{"line":15,"column":33},"end":{"line":15,"column":34}}, + "range":[719,720], + "value":1, + "raw":"1" + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":17,"column":0},"end":{"line":17,"column":62}}, + "range":[743,805], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":17,"column":5},"end":{"line":17,"column":10}}, + "range":[748,753], + "name":"Test9", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"BigIntLiteralTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":39},"end":{"line":17,"column":61}}, + "range":[782,804], + "value":" 9.2 T bigint lit " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":13},"end":{"line":17,"column":35}}, + "range":[756,778], + "value":" 9.1 L bigint lit " + } + ], + "loc":{"source":null,"start":{"line":17,"column":36},"end":{"line":17,"column":38}}, + "range":[779,781], + "value":null, + "raw":"1n" + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":19,"column":0},"end":{"line":19,"column":63}}, + "range":[807,870], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":19,"column":5},"end":{"line":19,"column":11}}, + "range":[812,818], + "name":"Test10", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"BooleanLiteralTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":41},"end":{"line":19,"column":62}}, + "range":[848,869], + "value":" 10.2 T bool lit " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":14},"end":{"line":19,"column":35}}, + "range":[821,842], + "value":" 10.1 L bool lit " + } + ], + "loc":{"source":null,"start":{"line":19,"column":36},"end":{"line":19,"column":40}}, + "range":[843,847], + "value":true, + "raw":"true" + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":21,"column":0},"end":{"line":21,"column":84}}, + "range":[872,956], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":21,"column":5},"end":{"line":21,"column":11}}, + "range":[877,883], + "name":"Test11", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"InterfaceTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":14},"end":{"line":21,"column":36}}, + "range":[886,908], + "value":" 11.1 L interface " + } + ], + "loc":{"source":null,"start":{"line":21,"column":37},"end":{"line":21,"column":66}}, + "range":[909,938], + "extends":[], + "body":{ + "type":"ObjectTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":67},"end":{"line":21,"column":83}}, + "range":[939,955], + "value":" 11.3 T obj " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":47},"end":{"line":21,"column":63}}, + "range":[919,935], + "value":" 11.2 L obj " + } + ], + "loc":{"source":null,"start":{"line":21,"column":64},"end":{"line":21,"column":66}}, + "range":[936,938], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":23,"column":0},"end":{"line":26,"column":48}}, + "range":[958,1089], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":23,"column":5},"end":{"line":23,"column":11}}, + "range":[963,969], + "name":"Test12", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"UnionTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":2},"end":{"line":24,"column":20}}, + "range":[974,992], + "value":" 12.1 L union " + } + ], + "loc":{"source":null,"start":{"line":25,"column":25},"end":{"line":26,"column":26}}, + "range":[1018,1067], + "types":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":25,"column":25},"end":{"line":25,"column":26}}, + "range":[1018,1019], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":27},"end":{"line":25,"column":47}}, + "range":[1020,1040], + "value":" 12.3 T generic " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":4},"end":{"line":25,"column":24}}, + "range":[997,1017], + "value":" 12.2 L generic " + } + ], + "loc":{"source":null,"start":{"line":25,"column":25},"end":{"line":25,"column":26}}, + "range":[1018,1019], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":26,"column":25},"end":{"line":26,"column":26}}, + "range":[1066,1067], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":27},"end":{"line":26,"column":47}}, + "range":[1068,1088], + "value":" 12.5 T generic " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":4},"end":{"line":26,"column":24}}, + "range":[1045,1065], + "value":" 12.4 L generic " + } + ], + "loc":{"source":null,"start":{"line":26,"column":25},"end":{"line":26,"column":26}}, + "range":[1066,1067], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":28,"column":0},"end":{"line":31,"column":48}}, + "range":[1091,1229], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":28,"column":5},"end":{"line":28,"column":11}}, + "range":[1096,1102], + "name":"Test13", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"IntersectionTypeAnnotation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":2},"end":{"line":29,"column":27}}, + "range":[1107,1132], + "value":" 13.1 L intersection " + } + ], + "loc":{"source":null,"start":{"line":30,"column":25},"end":{"line":31,"column":26}}, + "range":[1158,1207], + "types":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":30,"column":25},"end":{"line":30,"column":26}}, + "range":[1158,1159], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":27},"end":{"line":30,"column":47}}, + "range":[1160,1180], + "value":" 13.3 T generic " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":4},"end":{"line":30,"column":24}}, + "range":[1137,1157], + "value":" 13.2 L generic " + } + ], + "loc":{"source":null,"start":{"line":30,"column":25},"end":{"line":30,"column":26}}, + "range":[1158,1159], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":31,"column":25},"end":{"line":31,"column":26}}, + "range":[1206,1207], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":27},"end":{"line":31,"column":47}}, + "range":[1208,1228], + "value":" 13.5 T generic " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":4},"end":{"line":31,"column":24}}, + "range":[1185,1205], + "value":" 13.4 L generic " + } + ], + "loc":{"source":null,"start":{"line":31,"column":25},"end":{"line":31,"column":26}}, + "range":[1206,1207], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":33,"column":0},"end":{"line":44,"column":48}}, + "range":[1231,1788], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":33,"column":5},"end":{"line":33,"column":11}}, + "range":[1236,1242], + "name":"Test14", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"UnionTypeAnnotation", + "loc":{"source":null,"start":{"line":34,"column":19},"end":{"line":44,"column":26}}, + "range":[1264,1766], + "types":[ + { + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":23},"end":{"line":34,"column":39}}, + "range":[1268,1284], + "value":" 14.2 T any " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":2},"end":{"line":34,"column":18}}, + "range":[1247,1263], + "value":" 14.1 L any " + } + ], + "loc":{"source":null,"start":{"line":34,"column":19},"end":{"line":34,"column":22}}, + "range":[1264,1267] + }, + { + "type":"MixedTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":29},"end":{"line":35,"column":47}}, + "range":[1314,1332], + "value":" 14.4 T mixed " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":4},"end":{"line":35,"column":22}}, + "range":[1289,1307], + "value":" 14.3 L mixed " + } + ], + "loc":{"source":null,"start":{"line":35,"column":23},"end":{"line":35,"column":28}}, + "range":[1308,1313] + }, + { + "type":"EmptyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":29},"end":{"line":36,"column":47}}, + "range":[1362,1380], + "value":" 14.6 T empty " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":4},"end":{"line":36,"column":22}}, + "range":[1337,1355], + "value":" 14.5 L empty " + } + ], + "loc":{"source":null,"start":{"line":36,"column":23},"end":{"line":36,"column":28}}, + "range":[1356,1361] + }, + { + "type":"VoidTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":37,"column":27},"end":{"line":37,"column":44}}, + "range":[1408,1425], + "value":" 14.8 T void " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":37,"column":4},"end":{"line":37,"column":21}}, + "range":[1385,1402], + "value":" 14.7 L void " + } + ], + "loc":{"source":null,"start":{"line":37,"column":22},"end":{"line":37,"column":26}}, + "range":[1403,1407] + }, + { + "type":"NullLiteralTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":38,"column":27},"end":{"line":38,"column":45}}, + "range":[1453,1471], + "value":" 14.10 T null " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":38,"column":4},"end":{"line":38,"column":21}}, + "range":[1430,1447], + "value":" 14.9 L null " + } + ], + "loc":{"source":null,"start":{"line":38,"column":22},"end":{"line":38,"column":26}}, + "range":[1448,1452] + }, + { + "type":"NumberTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":39,"column":32},"end":{"line":39,"column":52}}, + "range":[1504,1524], + "value":" 14.12 T number " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":39,"column":4},"end":{"line":39,"column":24}}, + "range":[1476,1496], + "value":" 14.11 L number " + } + ], + "loc":{"source":null,"start":{"line":39,"column":25},"end":{"line":39,"column":31}}, + "range":[1497,1503] + }, + { + "type":"BigIntTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":40,"column":32},"end":{"line":40,"column":52}}, + "range":[1557,1577], + "value":" 14.14 T bigint " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":40,"column":4},"end":{"line":40,"column":24}}, + "range":[1529,1549], + "value":" 14.13 L bigint " + } + ], + "loc":{"source":null,"start":{"line":40,"column":25},"end":{"line":40,"column":31}}, + "range":[1550,1556] + }, + { + "type":"StringTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":41,"column":32},"end":{"line":41,"column":52}}, + "range":[1610,1630], + "value":" 14.16 T string " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":41,"column":4},"end":{"line":41,"column":24}}, + "range":[1582,1602], + "value":" 14.15 L string " + } + ], + "loc":{"source":null,"start":{"line":41,"column":25},"end":{"line":41,"column":31}}, + "range":[1603,1609] + }, + { + "type":"BooleanTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":42,"column":34},"end":{"line":42,"column":55}}, + "range":[1665,1686], + "value":" 14.18 T boolean " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":42,"column":4},"end":{"line":42,"column":25}}, + "range":[1635,1656], + "value":" 14.17 L boolean " + } + ], + "loc":{"source":null,"start":{"line":42,"column":26},"end":{"line":42,"column":33}}, + "range":[1657,1664] + }, + { + "type":"SymbolTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":43,"column":32},"end":{"line":43,"column":52}}, + "range":[1719,1739], + "value":" 14.20 T symbol " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":43,"column":4},"end":{"line":43,"column":24}}, + "range":[1691,1711], + "value":" 14.19 L symbol " + } + ], + "loc":{"source":null,"start":{"line":43,"column":25},"end":{"line":43,"column":31}}, + "range":[1712,1718] + }, + { + "type":"ExistsTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":44,"column":27},"end":{"line":44,"column":47}}, + "range":[1767,1787], + "value":" 14.22 T exists " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":44,"column":4},"end":{"line":44,"column":24}}, + "range":[1744,1764], + "value":" 14.21 L exists " + } + ], + "loc":{"source":null,"start":{"line":44,"column":25},"end":{"line":44,"column":26}}, + "range":[1765,1766] + } + ] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":46,"column":0},"end":{"line":46,"column":76}}, + "range":[1790,1866], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":46,"column":5},"end":{"line":46,"column":11}}, + "range":[1795,1801], + "name":"Test15", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":46,"column":30},"end":{"line":46,"column":56}}, + "range":[1820,1846], + "id":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":46,"column":14},"end":{"line":46,"column":29}}, + "range":[1804,1819], + "value":" 15.1 L id " + } + ], + "loc":{"source":null,"start":{"line":46,"column":30},"end":{"line":46,"column":33}}, + "range":[1820,1823], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":46,"column":57},"end":{"line":46,"column":75}}, + "range":[1847,1865], + "value":" 15.3 T targs " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":46,"column":34},"end":{"line":46,"column":52}}, + "range":[1824,1842], + "value":" 15.2 L targs " + } + ], + "loc":{"source":null,"start":{"line":46,"column":53},"end":{"line":46,"column":56}}, + "range":[1843,1846], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":46,"column":54},"end":{"line":46,"column":55}}, + "range":[1844,1845], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":46,"column":54},"end":{"line":46,"column":55}}, + "range":[1844,1845], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":48,"column":0},"end":{"line":49,"column":25}}, + "range":[1868,1927], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":48,"column":5},"end":{"line":48,"column":11}}, + "range":[1873,1879], + "name":"Test16", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":48,"column":14},"end":{"line":49,"column":24}}, + "range":[1882,1926], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":48,"column":18},"end":{"line":48,"column":33}}, + "range":[1886,1901], + "value":" 16.1 T id " + } + ], + "loc":{"source":null,"start":{"line":48,"column":14},"end":{"line":48,"column":17}}, + "range":[1882,1885], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":49,"column":2},"end":{"line":49,"column":20}}, + "range":[1904,1922], + "value":" 16.2 L targs " + } + ], + "loc":{"source":null,"start":{"line":49,"column":21},"end":{"line":49,"column":24}}, + "range":[1923,1926], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":49,"column":22},"end":{"line":49,"column":23}}, + "range":[1924,1925], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":49,"column":22},"end":{"line":49,"column":23}}, + "range":[1924,1925], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":51,"column":0},"end":{"line":51,"column":38}}, + "range":[1929,1967], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":51,"column":5},"end":{"line":51,"column":11}}, + "range":[1934,1940], + "name":"Test17", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":51,"column":14},"end":{"line":51,"column":37}}, + "range":[1943,1966], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":51,"column":14},"end":{"line":51,"column":17}}, + "range":[1943,1946], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":51,"column":18},"end":{"line":51,"column":36}}, + "range":[1947,1965], + "value":" 17.1 I targs " + } + ], + "loc":{"source":null,"start":{"line":51,"column":17},"end":{"line":51,"column":37}}, + "range":[1946,1966], + "params":[] + } + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":53,"column":0},"end":{"line":53,"column":41}}, + "range":[1969,2010], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":53,"column":5},"end":{"line":53,"column":11}}, + "range":[1974,1980], + "name":"Test18", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":53,"column":14},"end":{"line":53,"column":40}}, + "range":[1983,2009], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":53,"column":14},"end":{"line":53,"column":17}}, + "range":[1983,1986], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":53,"column":21},"end":{"line":53,"column":39}}, + "range":[1990,2008], + "value":" 18.1 I targs " + } + ], + "loc":{"source":null,"start":{"line":53,"column":17},"end":{"line":53,"column":40}}, + "range":[1986,2009], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":53,"column":18},"end":{"line":53,"column":19}}, + "range":[1987,1988], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":53,"column":18},"end":{"line":53,"column":19}}, + "range":[1987,1988], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + } + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":32}}, + "range":[13,32], + "value":" 1.1 L generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":56}}, + "range":[37,56], + "value":" 1.2 T generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":59},"end":{"line":1,"column":78}}, + "range":[59,78], + "value":" 1.3 L generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":83},"end":{"line":1,"column":102}}, + "range":[83,102], + "value":" 1.4 T generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":11},"end":{"line":3,"column":31}}, + "range":[116,136], + "value":" 2.1 L variance " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":34},"end":{"line":3,"column":52}}, + "range":[139,157], + "value":" 2.2 L tparam " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":55},"end":{"line":3,"column":73}}, + "range":[160,178], + "value":" 2.3 T tparam " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":76},"end":{"line":3,"column":93}}, + "range":[181,198], + "value":" 2.4 L bound " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":100},"end":{"line":3,"column":117}}, + "range":[205,222], + "value":" 2.5 T bound " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":120},"end":{"line":3,"column":139}}, + "range":[225,244], + "value":" 2.5 L default " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":148},"end":{"line":3,"column":167}}, + "range":[253,272], + "value":" 2.6 T default " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":13},"end":{"line":5,"column":33}}, + "range":[294,314], + "value":" 3.1 L nullable " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":36},"end":{"line":5,"column":55}}, + "range":[317,336], + "value":" 3.2 L generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":5,"column":58},"end":{"line":5,"column":77}}, + "range":[339,358], + "value":" 3.3 T generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":13},"end":{"line":7,"column":31}}, + "range":[374,392], + "value":" 4.1 L typeof " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":39},"end":{"line":7,"column":58}}, + "range":[400,419], + "value":" 4.2 L generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":7,"column":61},"end":{"line":7,"column":80}}, + "range":[422,441], + "value":" 4.3 T generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":13},"end":{"line":9,"column":30}}, + "range":[457,474], + "value":" 5.1 L tuple " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":33},"end":{"line":9,"column":52}}, + "range":[477,496], + "value":" 5.2 L generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":55},"end":{"line":9,"column":74}}, + "range":[499,518], + "value":" 5.3 T generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":9,"column":77},"end":{"line":9,"column":94}}, + "range":[521,538], + "value":" 5.4 T tuple " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":13},"end":{"line":11,"column":32}}, + "range":[554,573], + "value":" 6.1 L generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":35},"end":{"line":11,"column":54}}, + "range":[576,595], + "value":" 6.2 T generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":58},"end":{"line":11,"column":75}}, + "range":[599,616], + "value":" 6.3 T array " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":13},"end":{"line":13,"column":35}}, + "range":[632,654], + "value":" 7.1 L string lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":13,"column":42},"end":{"line":13,"column":64}}, + "range":[661,683], + "value":" 7.2 T string lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":13},"end":{"line":15,"column":32}}, + "range":[699,718], + "value":" 8.1 L num lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":15,"column":35},"end":{"line":15,"column":54}}, + "range":[721,740], + "value":" 8.2 T num lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":13},"end":{"line":17,"column":35}}, + "range":[756,778], + "value":" 9.1 L bigint lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":17,"column":39},"end":{"line":17,"column":61}}, + "range":[782,804], + "value":" 9.2 T bigint lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":14},"end":{"line":19,"column":35}}, + "range":[821,842], + "value":" 10.1 L bool lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":19,"column":41},"end":{"line":19,"column":62}}, + "range":[848,869], + "value":" 10.2 T bool lit " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":14},"end":{"line":21,"column":36}}, + "range":[886,908], + "value":" 11.1 L interface " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":47},"end":{"line":21,"column":63}}, + "range":[919,935], + "value":" 11.2 L obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":21,"column":67},"end":{"line":21,"column":83}}, + "range":[939,955], + "value":" 11.3 T obj " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":24,"column":2},"end":{"line":24,"column":20}}, + "range":[974,992], + "value":" 12.1 L union " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":4},"end":{"line":25,"column":24}}, + "range":[997,1017], + "value":" 12.2 L generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":27},"end":{"line":25,"column":47}}, + "range":[1020,1040], + "value":" 12.3 T generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":4},"end":{"line":26,"column":24}}, + "range":[1045,1065], + "value":" 12.4 L generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":27},"end":{"line":26,"column":47}}, + "range":[1068,1088], + "value":" 12.5 T generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":29,"column":2},"end":{"line":29,"column":27}}, + "range":[1107,1132], + "value":" 13.1 L intersection " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":4},"end":{"line":30,"column":24}}, + "range":[1137,1157], + "value":" 13.2 L generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":27},"end":{"line":30,"column":47}}, + "range":[1160,1180], + "value":" 13.3 T generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":4},"end":{"line":31,"column":24}}, + "range":[1185,1205], + "value":" 13.4 L generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":27},"end":{"line":31,"column":47}}, + "range":[1208,1228], + "value":" 13.5 T generic " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":2},"end":{"line":34,"column":18}}, + "range":[1247,1263], + "value":" 14.1 L any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":34,"column":23},"end":{"line":34,"column":39}}, + "range":[1268,1284], + "value":" 14.2 T any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":4},"end":{"line":35,"column":22}}, + "range":[1289,1307], + "value":" 14.3 L mixed " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":35,"column":29},"end":{"line":35,"column":47}}, + "range":[1314,1332], + "value":" 14.4 T mixed " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":4},"end":{"line":36,"column":22}}, + "range":[1337,1355], + "value":" 14.5 L empty " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":29},"end":{"line":36,"column":47}}, + "range":[1362,1380], + "value":" 14.6 T empty " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":37,"column":4},"end":{"line":37,"column":21}}, + "range":[1385,1402], + "value":" 14.7 L void " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":37,"column":27},"end":{"line":37,"column":44}}, + "range":[1408,1425], + "value":" 14.8 T void " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":38,"column":4},"end":{"line":38,"column":21}}, + "range":[1430,1447], + "value":" 14.9 L null " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":38,"column":27},"end":{"line":38,"column":45}}, + "range":[1453,1471], + "value":" 14.10 T null " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":39,"column":4},"end":{"line":39,"column":24}}, + "range":[1476,1496], + "value":" 14.11 L number " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":39,"column":32},"end":{"line":39,"column":52}}, + "range":[1504,1524], + "value":" 14.12 T number " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":40,"column":4},"end":{"line":40,"column":24}}, + "range":[1529,1549], + "value":" 14.13 L bigint " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":40,"column":32},"end":{"line":40,"column":52}}, + "range":[1557,1577], + "value":" 14.14 T bigint " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":41,"column":4},"end":{"line":41,"column":24}}, + "range":[1582,1602], + "value":" 14.15 L string " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":41,"column":32},"end":{"line":41,"column":52}}, + "range":[1610,1630], + "value":" 14.16 T string " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":42,"column":4},"end":{"line":42,"column":25}}, + "range":[1635,1656], + "value":" 14.17 L boolean " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":42,"column":34},"end":{"line":42,"column":55}}, + "range":[1665,1686], + "value":" 14.18 T boolean " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":43,"column":4},"end":{"line":43,"column":24}}, + "range":[1691,1711], + "value":" 14.19 L symbol " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":43,"column":32},"end":{"line":43,"column":52}}, + "range":[1719,1739], + "value":" 14.20 T symbol " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":44,"column":4},"end":{"line":44,"column":24}}, + "range":[1744,1764], + "value":" 14.21 L exists " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":44,"column":27},"end":{"line":44,"column":47}}, + "range":[1767,1787], + "value":" 14.22 T exists " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":46,"column":14},"end":{"line":46,"column":29}}, + "range":[1804,1819], + "value":" 15.1 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":46,"column":34},"end":{"line":46,"column":52}}, + "range":[1824,1842], + "value":" 15.2 L targs " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":46,"column":57},"end":{"line":46,"column":75}}, + "range":[1847,1865], + "value":" 15.3 T targs " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":48,"column":18},"end":{"line":48,"column":33}}, + "range":[1886,1901], + "value":" 16.1 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":49,"column":2},"end":{"line":49,"column":20}}, + "range":[1904,1922], + "value":" 16.2 L targs " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":51,"column":18},"end":{"line":51,"column":36}}, + "range":[1947,1965], + "value":" 17.1 I targs " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":53,"column":21},"end":{"line":53,"column":39}}, + "range":[1990,2008], + "value":" 18.1 I targs " + } + ] +} diff --git a/lib/test/flow/comment_interning/unary.js b/lib/test/flow/comment_interning/unary.js new file mode 100644 index 0000000..15ccc24 --- /dev/null +++ b/lib/test/flow/comment_interning/unary.js @@ -0,0 +1,3 @@ +const a = /*pre*/ ! /*post*/ false; +const b = /*pre*/ typeof /*post*/ 5; +const c = /*pre*/ delete /*post*/ a; diff --git a/lib/test/flow/comment_interning/unary.options.json b/lib/test/flow/comment_interning/unary.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/unary.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/unary.tree.json b/lib/test/flow/comment_interning/unary.tree.json new file mode 100644 index 0000000..911c1ed --- /dev/null +++ b/lib/test/flow/comment_interning/unary.tree.json @@ -0,0 +1,199 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":36}}, + "range":[0,109], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":34}}, + "range":[6,34], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"UnaryExpression", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":17}}, + "range":[10,17], + "value":"pre" + } + ], + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":34}}, + "range":[18,34], + "operator":"!", + "prefix":true, + "argument":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, + "range":[20,28], + "value":"post" + } + ], + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":34}}, + "range":[29,34], + "value":false, + "raw":"false" + } + } + } + ], + "kind":"const" + }, + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":36}}, + "range":[36,72], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":35}}, + "range":[42,71], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, + "range":[42,43], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"UnaryExpression", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":17}}, + "range":[46,53], + "value":"pre" + } + ], + "loc":{"source":null,"start":{"line":2,"column":18},"end":{"line":2,"column":35}}, + "range":[54,71], + "operator":"typeof", + "prefix":true, + "argument":{ + "type":"Literal", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":25},"end":{"line":2,"column":33}}, + "range":[61,69], + "value":"post" + } + ], + "loc":{"source":null,"start":{"line":2,"column":34},"end":{"line":2,"column":35}}, + "range":[70,71], + "value":5, + "raw":"5" + } + } + } + ], + "kind":"const" + }, + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":36}}, + "range":[73,109], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":3,"column":6},"end":{"line":3,"column":35}}, + "range":[79,108], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":6},"end":{"line":3,"column":7}}, + "range":[79,80], + "name":"c", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"UnaryExpression", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":10},"end":{"line":3,"column":17}}, + "range":[83,90], + "value":"pre" + } + ], + "loc":{"source":null,"start":{"line":3,"column":18},"end":{"line":3,"column":35}}, + "range":[91,108], + "operator":"delete", + "prefix":true, + "argument":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":25},"end":{"line":3,"column":33}}, + "range":[98,106], + "value":"post" + } + ], + "loc":{"source":null,"start":{"line":3,"column":34},"end":{"line":3,"column":35}}, + "range":[107,108], + "name":"a", + "typeAnnotation":null, + "optional":false + } + } + } + ], + "kind":"const" + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":17}}, + "range":[10,17], + "value":"pre" + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, + "range":[20,28], + "value":"post" + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":17}}, + "range":[46,53], + "value":"pre" + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":25},"end":{"line":2,"column":33}}, + "range":[61,69], + "value":"post" + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":10},"end":{"line":3,"column":17}}, + "range":[83,90], + "value":"pre" + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":25},"end":{"line":3,"column":33}}, + "range":[98,106], + "value":"post" + } + ] +} diff --git a/lib/test/flow/comment_interning/update.js b/lib/test/flow/comment_interning/update.js new file mode 100644 index 0000000..5e76c39 --- /dev/null +++ b/lib/test/flow/comment_interning/update.js @@ -0,0 +1,11 @@ +function leading() { + let x = 1; + + /* Leading on update */ ++ /* Leading on arg */ x /* Trailing on arg */; +} + +function trailing() { + let x = 1; + + /* Leading on arg */ x /* Trailing on arg */ ++ /* Trailing on update */; +} diff --git a/lib/test/flow/comment_interning/update.options.json b/lib/test/flow/comment_interning/update.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/update.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/update.tree.json b/lib/test/flow/comment_interning/update.tree.json new file mode 100644 index 0000000..c8d5b46 --- /dev/null +++ b/lib/test/flow/comment_interning/update.tree.json @@ -0,0 +1,245 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":11,"column":1}}, + "range":[0,234], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "range":[0,115], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "name":"leading", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":5,"column":1}}, + "range":[19,115], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":14}}, + "range":[25,35], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":13}}, + "range":[29,34], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "range":[29,30], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":13}}, + "range":[33,34], + "value":1, + "raw":"1" + } + } + ], + "kind":"let" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":4,"column":28},"end":{"line":4,"column":76}}, + "range":[65,113], + "expression":{ + "type":"UpdateExpression", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":4},"end":{"line":4,"column":27}}, + "range":[41,64], + "value":" Leading on update " + } + ], + "loc":{"source":null,"start":{"line":4,"column":28},"end":{"line":4,"column":53}}, + "range":[65,90], + "operator":"++", + "argument":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":54},"end":{"line":4,"column":75}}, + "range":[91,112], + "value":" Trailing on arg " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":31},"end":{"line":4,"column":51}}, + "range":[68,88], + "value":" Leading on arg " + } + ], + "loc":{"source":null,"start":{"line":4,"column":52},"end":{"line":4,"column":53}}, + "range":[89,90], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "prefix":true + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":11,"column":1}}, + "range":[117,234], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":9},"end":{"line":7,"column":17}}, + "range":[126,134], + "name":"trailing", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":7,"column":20},"end":{"line":11,"column":1}}, + "range":[137,234], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":8,"column":4},"end":{"line":8,"column":14}}, + "range":[143,153], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":8,"column":8},"end":{"line":8,"column":13}}, + "range":[147,152], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":8,"column":8},"end":{"line":8,"column":9}}, + "range":[147,148], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":8,"column":12},"end":{"line":8,"column":13}}, + "range":[151,152], + "value":1, + "raw":"1" + } + } + ], + "kind":"let" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":10,"column":25},"end":{"line":10,"column":77}}, + "range":[180,232], + "expression":{ + "type":"UpdateExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":52},"end":{"line":10,"column":76}}, + "range":[207,231], + "value":" Trailing on update " + } + ], + "loc":{"source":null,"start":{"line":10,"column":25},"end":{"line":10,"column":51}}, + "range":[180,206], + "operator":"++", + "argument":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":27},"end":{"line":10,"column":48}}, + "range":[182,203], + "value":" Trailing on arg " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":4},"end":{"line":10,"column":24}}, + "range":[159,179], + "value":" Leading on arg " + } + ], + "loc":{"source":null,"start":{"line":10,"column":25},"end":{"line":10,"column":26}}, + "range":[180,181], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "prefix":false + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":4},"end":{"line":4,"column":27}}, + "range":[41,64], + "value":" Leading on update " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":31},"end":{"line":4,"column":51}}, + "range":[68,88], + "value":" Leading on arg " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":54},"end":{"line":4,"column":75}}, + "range":[91,112], + "value":" Trailing on arg " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":4},"end":{"line":10,"column":24}}, + "range":[159,179], + "value":" Leading on arg " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":27},"end":{"line":10,"column":48}}, + "range":[182,203], + "value":" Trailing on arg " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":52},"end":{"line":10,"column":76}}, + "range":[207,231], + "value":" Trailing on update " + } + ] +} diff --git a/lib/test/flow/comment_interning/variable_declaration.js b/lib/test/flow/comment_interning/variable_declaration.js new file mode 100644 index 0000000..2925fbe --- /dev/null +++ b/lib/test/flow/comment_interning/variable_declaration.js @@ -0,0 +1,45 @@ +function leadingOnly() { + /* 1.1 Leading */ var x = 1; +} + +function trailingOnly() { + let x = 1; /* 2.1 Trailing */ +} + +function leadingAndTrailing() { + /* 3.1 Leading */ const x = 1; /* 3.2 Trailing */ +} + +function innerComments() { + /* 4.1 L decl */ var /* 4.2 L id */ x /* 4.3 T id */ = /* 4.4 L num */ 1 /* 4.5 T num */; /* 4.6 T decl */ +} + +function forInitComments() { + for (/* 5.1 Leading */ var x = 1; /* 5.2 Not trailing */ x < 10; x++) {} +} + +function forOfComments() { + for (/* 6.1 Leading */ let x /* 6.2 Not trailing */ of []) {} +} + +function forInComments() { + for (/* 7.1 Leading */ let x /* 7.2 Not trailing */ in {}) {} +} + +{ + /* 8.1 L decl */ var x, y = 1 /* 8.2 T num */ + /* 8.3 L decl */ var x, y = 1 + /* 8.4 T num */ +} + +{ + /* 9.1 L decl */ var x, y: any /* 9.2 T any */ + /* 9.3 L decl */ var x, y: any + /* 9.4 T any */ +} + +{ + /* 10.1 L decl */ var x, y /* 10.2 T id */ + /* 10.3 L decl */ var x, y + /* 10.4 T id */ +} diff --git a/lib/test/flow/comment_interning/variable_declaration.options.json b/lib/test/flow/comment_interning/variable_declaration.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/variable_declaration.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/variable_declaration.tree.json b/lib/test/flow/comment_interning/variable_declaration.tree.json new file mode 100644 index 0000000..2dbdc1e --- /dev/null +++ b/lib/test/flow/comment_interning/variable_declaration.tree.json @@ -0,0 +1,1124 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":45,"column":1}}, + "range":[0,958], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,59], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":20}}, + "range":[9,20], + "name":"leadingOnly", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":3,"column":1}}, + "range":[23,59], + "body":[ + { + "type":"VariableDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":21}}, + "range":[29,46], + "value":" 1.1 Leading " + } + ], + "loc":{"source":null,"start":{"line":2,"column":22},"end":{"line":2,"column":32}}, + "range":[47,57], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":2,"column":26},"end":{"line":2,"column":31}}, + "range":[51,56], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":26},"end":{"line":2,"column":27}}, + "range":[51,52], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":30},"end":{"line":2,"column":31}}, + "range":[55,56], + "value":1, + "raw":"1" + } + } + ], + "kind":"var" + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":7,"column":1}}, + "range":[61,122], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":9},"end":{"line":5,"column":21}}, + "range":[70,82], + "name":"trailingOnly", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":5,"column":24},"end":{"line":7,"column":1}}, + "range":[85,122], + "body":[ + { + "type":"VariableDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":15},"end":{"line":6,"column":33}}, + "range":[102,120], + "value":" 2.1 Trailing " + } + ], + "loc":{"source":null,"start":{"line":6,"column":4},"end":{"line":6,"column":14}}, + "range":[91,101], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":6,"column":8},"end":{"line":6,"column":13}}, + "range":[95,100], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":8},"end":{"line":6,"column":9}}, + "range":[95,96], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":6,"column":12},"end":{"line":6,"column":13}}, + "range":[99,100], + "value":1, + "raw":"1" + } + } + ], + "kind":"let" + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":11,"column":1}}, + "range":[124,211], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":9},"end":{"line":9,"column":27}}, + "range":[133,151], + "name":"leadingAndTrailing", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":9,"column":30},"end":{"line":11,"column":1}}, + "range":[154,211], + "body":[ + { + "type":"VariableDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":35},"end":{"line":10,"column":53}}, + "range":[191,209], + "value":" 3.2 Trailing " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":4},"end":{"line":10,"column":21}}, + "range":[160,177], + "value":" 3.1 Leading " + } + ], + "loc":{"source":null,"start":{"line":10,"column":22},"end":{"line":10,"column":34}}, + "range":[178,190], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":10,"column":28},"end":{"line":10,"column":33}}, + "range":[184,189], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":10,"column":28},"end":{"line":10,"column":29}}, + "range":[184,185], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":10,"column":32},"end":{"line":10,"column":33}}, + "range":[188,189], + "value":1, + "raw":"1" + } + } + ], + "kind":"const" + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":13,"column":0},"end":{"line":15,"column":1}}, + "range":[213,352], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":13,"column":9},"end":{"line":13,"column":22}}, + "range":[222,235], + "name":"innerComments", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":13,"column":25},"end":{"line":15,"column":1}}, + "range":[238,352], + "body":[ + { + "type":"VariableDeclaration", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":94},"end":{"line":14,"column":110}}, + "range":[334,350], + "value":" 4.6 T decl " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":4},"end":{"line":14,"column":20}}, + "range":[244,260], + "value":" 4.1 L decl " + } + ], + "loc":{"source":null,"start":{"line":14,"column":21},"end":{"line":14,"column":93}}, + "range":[261,333], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":14,"column":40},"end":{"line":14,"column":76}}, + "range":[280,316], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":42},"end":{"line":14,"column":56}}, + "range":[282,296], + "value":" 4.3 T id " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":25},"end":{"line":14,"column":39}}, + "range":[265,279], + "value":" 4.2 L id " + } + ], + "loc":{"source":null,"start":{"line":14,"column":40},"end":{"line":14,"column":41}}, + "range":[280,281], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":77},"end":{"line":14,"column":92}}, + "range":[317,332], + "value":" 4.5 T num " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":59},"end":{"line":14,"column":74}}, + "range":[299,314], + "value":" 4.4 L num " + } + ], + "loc":{"source":null,"start":{"line":14,"column":75},"end":{"line":14,"column":76}}, + "range":[315,316], + "value":1, + "raw":"1" + } + } + ], + "kind":"var" + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":17,"column":0},"end":{"line":19,"column":1}}, + "range":[354,461], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":17,"column":9},"end":{"line":17,"column":24}}, + "range":[363,378], + "name":"forInitComments", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":17,"column":27},"end":{"line":19,"column":1}}, + "range":[381,461], + "body":[ + { + "type":"ForStatement", + "loc":{"source":null,"start":{"line":18,"column":4},"end":{"line":18,"column":76}}, + "range":[387,459], + "init":{ + "type":"VariableDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":9},"end":{"line":18,"column":26}}, + "range":[392,409], + "value":" 5.1 Leading " + } + ], + "loc":{"source":null,"start":{"line":18,"column":27},"end":{"line":18,"column":36}}, + "range":[410,419], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":18,"column":31},"end":{"line":18,"column":36}}, + "range":[414,419], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":18,"column":31},"end":{"line":18,"column":32}}, + "range":[414,415], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":18,"column":35},"end":{"line":18,"column":36}}, + "range":[418,419], + "value":1, + "raw":"1" + } + } + ], + "kind":"var" + }, + "test":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":18,"column":61},"end":{"line":18,"column":67}}, + "range":[444,450], + "operator":"<", + "left":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":38},"end":{"line":18,"column":60}}, + "range":[421,443], + "value":" 5.2 Not trailing " + } + ], + "loc":{"source":null,"start":{"line":18,"column":61},"end":{"line":18,"column":62}}, + "range":[444,445], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":18,"column":65},"end":{"line":18,"column":67}}, + "range":[448,450], + "value":10, + "raw":"10" + } + }, + "update":{ + "type":"UpdateExpression", + "loc":{"source":null,"start":{"line":18,"column":69},"end":{"line":18,"column":72}}, + "range":[452,455], + "operator":"++", + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":18,"column":69},"end":{"line":18,"column":70}}, + "range":[452,453], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "prefix":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":18,"column":74},"end":{"line":18,"column":76}}, + "range":[457,459], + "body":[] + } + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":21,"column":0},"end":{"line":23,"column":1}}, + "range":[463,557], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":21,"column":9},"end":{"line":21,"column":22}}, + "range":[472,485], + "name":"forOfComments", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":21,"column":25},"end":{"line":23,"column":1}}, + "range":[488,557], + "body":[ + { + "type":"ForOfStatement", + "loc":{"source":null,"start":{"line":22,"column":4},"end":{"line":22,"column":65}}, + "range":[494,555], + "left":{ + "type":"VariableDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":9},"end":{"line":22,"column":26}}, + "range":[499,516], + "value":" 6.1 Leading " + } + ], + "loc":{"source":null,"start":{"line":22,"column":27},"end":{"line":22,"column":32}}, + "range":[517,522], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":22,"column":31},"end":{"line":22,"column":32}}, + "range":[521,522], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":33},"end":{"line":22,"column":55}}, + "range":[523,545], + "value":" 6.2 Not trailing " + } + ], + "loc":{"source":null,"start":{"line":22,"column":31},"end":{"line":22,"column":32}}, + "range":[521,522], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":null + } + ], + "kind":"let" + }, + "right":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":22,"column":59},"end":{"line":22,"column":61}}, + "range":[549,551], + "elements":[] + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":22,"column":63},"end":{"line":22,"column":65}}, + "range":[553,555], + "body":[] + }, + "await":false + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":25,"column":0},"end":{"line":27,"column":1}}, + "range":[559,653], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":25,"column":9},"end":{"line":25,"column":22}}, + "range":[568,581], + "name":"forInComments", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":25,"column":25},"end":{"line":27,"column":1}}, + "range":[584,653], + "body":[ + { + "type":"ForInStatement", + "loc":{"source":null,"start":{"line":26,"column":4},"end":{"line":26,"column":65}}, + "range":[590,651], + "left":{ + "type":"VariableDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":9},"end":{"line":26,"column":26}}, + "range":[595,612], + "value":" 7.1 Leading " + } + ], + "loc":{"source":null,"start":{"line":26,"column":27},"end":{"line":26,"column":32}}, + "range":[613,618], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":26,"column":31},"end":{"line":26,"column":32}}, + "range":[617,618], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":33},"end":{"line":26,"column":55}}, + "range":[619,641], + "value":" 7.2 Not trailing " + } + ], + "loc":{"source":null,"start":{"line":26,"column":31},"end":{"line":26,"column":32}}, + "range":[617,618], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":null + } + ], + "kind":"let" + }, + "right":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":26,"column":59},"end":{"line":26,"column":61}}, + "range":[645,647], + "properties":[] + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":26,"column":63},"end":{"line":26,"column":65}}, + "range":[649,651], + "body":[] + }, + "each":false + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":29,"column":0},"end":{"line":33,"column":1}}, + "range":[655,756], + "body":[ + { + "type":"VariableDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":2},"end":{"line":30,"column":18}}, + "range":[659,675], + "value":" 8.1 L decl " + } + ], + "loc":{"source":null,"start":{"line":30,"column":19},"end":{"line":30,"column":31}}, + "range":[676,688], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":30,"column":23},"end":{"line":30,"column":24}}, + "range":[680,681], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":30,"column":23},"end":{"line":30,"column":24}}, + "range":[680,681], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":null + }, + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":30,"column":26},"end":{"line":30,"column":31}}, + "range":[683,688], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":30,"column":26},"end":{"line":30,"column":27}}, + "range":[683,684], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":32},"end":{"line":30,"column":47}}, + "range":[689,704], + "value":" 8.2 T num " + } + ], + "loc":{"source":null,"start":{"line":30,"column":30},"end":{"line":30,"column":31}}, + "range":[687,688], + "value":1, + "raw":"1" + } + } + ], + "kind":"var" + }, + { + "type":"VariableDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":2},"end":{"line":31,"column":18}}, + "range":[707,723], + "value":" 8.3 L decl " + } + ], + "loc":{"source":null,"start":{"line":31,"column":19},"end":{"line":31,"column":31}}, + "range":[724,736], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":31,"column":23},"end":{"line":31,"column":24}}, + "range":[728,729], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":31,"column":23},"end":{"line":31,"column":24}}, + "range":[728,729], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":null + }, + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":31,"column":26},"end":{"line":31,"column":31}}, + "range":[731,736], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":31,"column":26},"end":{"line":31,"column":27}}, + "range":[731,732], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":2},"end":{"line":32,"column":17}}, + "range":[739,754], + "value":" 8.4 T num " + } + ], + "loc":{"source":null,"start":{"line":31,"column":30},"end":{"line":31,"column":31}}, + "range":[735,736], + "value":1, + "raw":"1" + } + } + ], + "kind":"var" + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":35,"column":0},"end":{"line":39,"column":1}}, + "range":[758,861], + "body":[ + { + "type":"VariableDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":2},"end":{"line":36,"column":18}}, + "range":[762,778], + "value":" 9.1 L decl " + } + ], + "loc":{"source":null,"start":{"line":36,"column":19},"end":{"line":36,"column":32}}, + "range":[779,792], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":36,"column":23},"end":{"line":36,"column":24}}, + "range":[783,784], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":36,"column":23},"end":{"line":36,"column":24}}, + "range":[783,784], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":null + }, + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":36,"column":26},"end":{"line":36,"column":32}}, + "range":[786,792], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":36,"column":26},"end":{"line":36,"column":32}}, + "range":[786,792], + "name":"y", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":36,"column":27},"end":{"line":36,"column":32}}, + "range":[787,792], + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":33},"end":{"line":36,"column":48}}, + "range":[793,808], + "value":" 9.2 T any " + } + ], + "loc":{"source":null,"start":{"line":36,"column":29},"end":{"line":36,"column":32}}, + "range":[789,792] + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + }, + { + "type":"VariableDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":37,"column":2},"end":{"line":37,"column":18}}, + "range":[811,827], + "value":" 9.3 L decl " + } + ], + "loc":{"source":null,"start":{"line":37,"column":19},"end":{"line":37,"column":32}}, + "range":[828,841], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":37,"column":23},"end":{"line":37,"column":24}}, + "range":[832,833], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":37,"column":23},"end":{"line":37,"column":24}}, + "range":[832,833], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":null + }, + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":37,"column":26},"end":{"line":37,"column":32}}, + "range":[835,841], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":37,"column":26},"end":{"line":37,"column":32}}, + "range":[835,841], + "name":"y", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":37,"column":27},"end":{"line":37,"column":32}}, + "range":[836,841], + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":38,"column":2},"end":{"line":38,"column":17}}, + "range":[844,859], + "value":" 9.4 T any " + } + ], + "loc":{"source":null,"start":{"line":37,"column":29},"end":{"line":37,"column":32}}, + "range":[838,841] + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ] + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":41,"column":0},"end":{"line":45,"column":1}}, + "range":[863,958], + "body":[ + { + "type":"VariableDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":42,"column":2},"end":{"line":42,"column":19}}, + "range":[867,884], + "value":" 10.1 L decl " + } + ], + "loc":{"source":null,"start":{"line":42,"column":20},"end":{"line":42,"column":28}}, + "range":[885,893], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":42,"column":24},"end":{"line":42,"column":25}}, + "range":[889,890], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":42,"column":24},"end":{"line":42,"column":25}}, + "range":[889,890], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":null + }, + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":42,"column":27},"end":{"line":42,"column":28}}, + "range":[892,893], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":42,"column":29},"end":{"line":42,"column":44}}, + "range":[894,909], + "value":" 10.2 T id " + } + ], + "loc":{"source":null,"start":{"line":42,"column":27},"end":{"line":42,"column":28}}, + "range":[892,893], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "init":null + } + ], + "kind":"var" + }, + { + "type":"VariableDeclaration", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":43,"column":2},"end":{"line":43,"column":19}}, + "range":[912,929], + "value":" 10.3 L decl " + } + ], + "loc":{"source":null,"start":{"line":43,"column":20},"end":{"line":43,"column":28}}, + "range":[930,938], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":43,"column":24},"end":{"line":43,"column":25}}, + "range":[934,935], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":43,"column":24},"end":{"line":43,"column":25}}, + "range":[934,935], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":null + }, + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":43,"column":27},"end":{"line":43,"column":28}}, + "range":[937,938], + "id":{ + "type":"Identifier", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":44,"column":2},"end":{"line":44,"column":17}}, + "range":[941,956], + "value":" 10.4 T id " + } + ], + "loc":{"source":null,"start":{"line":43,"column":27},"end":{"line":43,"column":28}}, + "range":[937,938], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ] + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":21}}, + "range":[29,46], + "value":" 1.1 Leading " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":6,"column":15},"end":{"line":6,"column":33}}, + "range":[102,120], + "value":" 2.1 Trailing " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":4},"end":{"line":10,"column":21}}, + "range":[160,177], + "value":" 3.1 Leading " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":10,"column":35},"end":{"line":10,"column":53}}, + "range":[191,209], + "value":" 3.2 Trailing " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":4},"end":{"line":14,"column":20}}, + "range":[244,260], + "value":" 4.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":25},"end":{"line":14,"column":39}}, + "range":[265,279], + "value":" 4.2 L id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":42},"end":{"line":14,"column":56}}, + "range":[282,296], + "value":" 4.3 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":59},"end":{"line":14,"column":74}}, + "range":[299,314], + "value":" 4.4 L num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":77},"end":{"line":14,"column":92}}, + "range":[317,332], + "value":" 4.5 T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":14,"column":94},"end":{"line":14,"column":110}}, + "range":[334,350], + "value":" 4.6 T decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":9},"end":{"line":18,"column":26}}, + "range":[392,409], + "value":" 5.1 Leading " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":38},"end":{"line":18,"column":60}}, + "range":[421,443], + "value":" 5.2 Not trailing " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":9},"end":{"line":22,"column":26}}, + "range":[499,516], + "value":" 6.1 Leading " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":22,"column":33},"end":{"line":22,"column":55}}, + "range":[523,545], + "value":" 6.2 Not trailing " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":9},"end":{"line":26,"column":26}}, + "range":[595,612], + "value":" 7.1 Leading " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":26,"column":33},"end":{"line":26,"column":55}}, + "range":[619,641], + "value":" 7.2 Not trailing " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":2},"end":{"line":30,"column":18}}, + "range":[659,675], + "value":" 8.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":32},"end":{"line":30,"column":47}}, + "range":[689,704], + "value":" 8.2 T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":31,"column":2},"end":{"line":31,"column":18}}, + "range":[707,723], + "value":" 8.3 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":32,"column":2},"end":{"line":32,"column":17}}, + "range":[739,754], + "value":" 8.4 T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":2},"end":{"line":36,"column":18}}, + "range":[762,778], + "value":" 9.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":36,"column":33},"end":{"line":36,"column":48}}, + "range":[793,808], + "value":" 9.2 T any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":37,"column":2},"end":{"line":37,"column":18}}, + "range":[811,827], + "value":" 9.3 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":38,"column":2},"end":{"line":38,"column":17}}, + "range":[844,859], + "value":" 9.4 T any " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":42,"column":2},"end":{"line":42,"column":19}}, + "range":[867,884], + "value":" 10.1 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":42,"column":29},"end":{"line":42,"column":44}}, + "range":[894,909], + "value":" 10.2 T id " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":43,"column":2},"end":{"line":43,"column":19}}, + "range":[912,929], + "value":" 10.3 L decl " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":44,"column":2},"end":{"line":44,"column":17}}, + "range":[941,956], + "value":" 10.4 T id " + } + ] +} diff --git a/lib/test/flow/comment_interning/while.js b/lib/test/flow/comment_interning/while.js new file mode 100644 index 0000000..d2eb001 --- /dev/null +++ b/lib/test/flow/comment_interning/while.js @@ -0,0 +1 @@ +/* 1.1 L while */ while /* 1.2 L while */ (/* 1.3 L bool */ true /* 1.4 T bool */) /* 1.5 L block */ {} /* 1.6 T block */ diff --git a/lib/test/flow/comment_interning/while.options.json b/lib/test/flow/comment_interning/while.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/while.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/while.tree.json b/lib/test/flow/comment_interning/while.tree.json new file mode 100644 index 0000000..65f5906 --- /dev/null +++ b/lib/test/flow/comment_interning/while.tree.json @@ -0,0 +1,109 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":103}}, + "range":[18,103], + "body":[ + { + "type":"WhileStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "value":" 1.1 L while " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":41}}, + "range":[24,41], + "value":" 1.2 L while " + } + ], + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":103}}, + "range":[18,103], + "test":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":65},"end":{"line":1,"column":81}}, + "range":[65,81], + "value":" 1.4 T bool " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":43},"end":{"line":1,"column":59}}, + "range":[43,59], + "value":" 1.3 L bool " + } + ], + "loc":{"source":null,"start":{"line":1,"column":60},"end":{"line":1,"column":64}}, + "range":[60,64], + "value":true, + "raw":"true" + }, + "body":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":104},"end":{"line":1,"column":121}}, + "range":[104,121], + "value":" 1.6 T block " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":83},"end":{"line":1,"column":100}}, + "range":[83,100], + "value":" 1.5 L block " + } + ], + "loc":{"source":null,"start":{"line":1,"column":101},"end":{"line":1,"column":103}}, + "range":[101,103], + "body":[] + } + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "value":" 1.1 L while " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":41}}, + "range":[24,41], + "value":" 1.2 L while " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":43},"end":{"line":1,"column":59}}, + "range":[43,59], + "value":" 1.3 L bool " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":65},"end":{"line":1,"column":81}}, + "range":[65,81], + "value":" 1.4 T bool " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":83},"end":{"line":1,"column":100}}, + "range":[83,100], + "value":" 1.5 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":104},"end":{"line":1,"column":121}}, + "range":[104,121], + "value":" 1.6 T block " + } + ] +} diff --git a/lib/test/flow/comment_interning/with.js b/lib/test/flow/comment_interning/with.js new file mode 100644 index 0000000..a003192 --- /dev/null +++ b/lib/test/flow/comment_interning/with.js @@ -0,0 +1 @@ +/* 1.1 L with */ with /* 1.2 L with */ (/* 1.3 L num */ 1 /* 1.4 T num */) /* 1.5 L block */ {} /* 1.6 T block */ diff --git a/lib/test/flow/comment_interning/with.options.json b/lib/test/flow/comment_interning/with.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/with.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/with.tree.json b/lib/test/flow/comment_interning/with.tree.json new file mode 100644 index 0000000..9997bd6 --- /dev/null +++ b/lib/test/flow/comment_interning/with.tree.json @@ -0,0 +1,109 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":95}}, + "range":[17,95], + "body":[ + { + "type":"WithStatement", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "value":" 1.1 L with " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":38}}, + "range":[22,38], + "value":" 1.2 L with " + } + ], + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":95}}, + "range":[17,95], + "object":{ + "type":"Literal", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":58},"end":{"line":1,"column":73}}, + "range":[58,73], + "value":" 1.4 T num " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":40},"end":{"line":1,"column":55}}, + "range":[40,55], + "value":" 1.3 L num " + } + ], + "loc":{"source":null,"start":{"line":1,"column":56},"end":{"line":1,"column":57}}, + "range":[56,57], + "value":1, + "raw":"1" + }, + "body":{ + "type":"BlockStatement", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":96},"end":{"line":1,"column":113}}, + "range":[96,113], + "value":" 1.6 T block " + } + ], + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":75},"end":{"line":1,"column":92}}, + "range":[75,92], + "value":" 1.5 L block " + } + ], + "loc":{"source":null,"start":{"line":1,"column":93},"end":{"line":1,"column":95}}, + "range":[93,95], + "body":[] + } + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "value":" 1.1 L with " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":38}}, + "range":[22,38], + "value":" 1.2 L with " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":40},"end":{"line":1,"column":55}}, + "range":[40,55], + "value":" 1.3 L num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":58},"end":{"line":1,"column":73}}, + "range":[58,73], + "value":" 1.4 T num " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":75},"end":{"line":1,"column":92}}, + "range":[75,92], + "value":" 1.5 L block " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":96},"end":{"line":1,"column":113}}, + "range":[96,113], + "value":" 1.6 T block " + } + ] +} diff --git a/lib/test/flow/comment_interning/yield.js b/lib/test/flow/comment_interning/yield.js new file mode 100644 index 0000000..1669c36 --- /dev/null +++ b/lib/test/flow/comment_interning/yield.js @@ -0,0 +1,31 @@ +function *yield_trailing() { + cont arr = [1, 2, 3] + for (var i = 0; i < arr.length; i++) { + yield arr[i] /* trailing yield val 1 */; + } +} + +function *yield_trailing() { + cont arr = [1, 2, 3] + for (var i = 0; i < arr.length; i++) { + /* leading yield 1 */ yield arr[i] /* trailing yield val 2 */; + } +} + +function *yield_trailing() { + cont arr = [1, 2, 3] + for (var i = 0; i < arr.length; i++) { + /* leading yield 2 */ yield arr[i]; + } +} + +function *yield_trailing() { + cont arr = [1, 2, 3] + for (var i = 0; i < arr.length; i++) { + yield /* leading yield val */ arr[i] /* trailing yield val 3 */; + } +} + +function *yield_trailing() { + yield /* trailing no yield val */; +} diff --git a/lib/test/flow/comment_interning/yield.options.json b/lib/test/flow/comment_interning/yield.options.json new file mode 100644 index 0000000..0d0a7de --- /dev/null +++ b/lib/test/flow/comment_interning/yield.options.json @@ -0,0 +1,3 @@ +{ + "intern_comments": true +} diff --git a/lib/test/flow/comment_interning/yield.tree.json b/lib/test/flow/comment_interning/yield.tree.json new file mode 100644 index 0000000..e70c3b0 --- /dev/null +++ b/lib/test/flow/comment_interning/yield.tree.json @@ -0,0 +1,1021 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":12}}, + "message":"Unexpected identifier, expected the end of an expression statement (`;`)" + }, + { + "loc":{"source":null,"start":{"line":9,"column":9},"end":{"line":9,"column":12}}, + "message":"Unexpected identifier, expected the end of an expression statement (`;`)" + }, + { + "loc":{"source":null,"start":{"line":16,"column":9},"end":{"line":16,"column":12}}, + "message":"Unexpected identifier, expected the end of an expression statement (`;`)" + }, + { + "loc":{"source":null,"start":{"line":23,"column":9},"end":{"line":23,"column":12}}, + "message":"Unexpected identifier, expected the end of an expression statement (`;`)" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":31,"column":1}}, + "range":[0,730], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "range":[0,153], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":24}}, + "range":[10,24], + "name":"yield_trailing", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":6,"column":1}}, + "range":[27,153], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":8}}, + "range":[33,37], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":8}}, + "range":[33,37], + "name":"cont", + "typeAnnotation":null, + "optional":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":24}}, + "range":[38,53], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":24}}, + "range":[38,53], + "operator":"=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":12}}, + "range":[38,41], + "name":"arr", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":2,"column":15},"end":{"line":2,"column":24}}, + "range":[44,53], + "elements":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":17}}, + "range":[45,46], + "value":1, + "raw":"1" + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":20}}, + "range":[48,49], + "value":2, + "raw":"2" + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":22},"end":{"line":2,"column":23}}, + "range":[51,52], + "value":3, + "raw":"3" + } + ] + } + }, + "directive":null + }, + { + "type":"ForStatement", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":5,"column":5}}, + "range":[58,151], + "init":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":3,"column":9},"end":{"line":3,"column":18}}, + "range":[63,72], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":3,"column":13},"end":{"line":3,"column":18}}, + "range":[67,72], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":13},"end":{"line":3,"column":14}}, + "range":[67,68], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":17},"end":{"line":3,"column":18}}, + "range":[71,72], + "value":0, + "raw":"0" + } + } + ], + "kind":"var" + }, + "test":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":3,"column":20},"end":{"line":3,"column":34}}, + "range":[74,88], + "operator":"<", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":20},"end":{"line":3,"column":21}}, + "range":[74,75], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":3,"column":24},"end":{"line":3,"column":34}}, + "range":[78,88], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":24},"end":{"line":3,"column":27}}, + "range":[78,81], + "name":"arr", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":28},"end":{"line":3,"column":34}}, + "range":[82,88], + "name":"length", + "typeAnnotation":null, + "optional":false + }, + "computed":false + } + }, + "update":{ + "type":"UpdateExpression", + "loc":{"source":null,"start":{"line":3,"column":36},"end":{"line":3,"column":39}}, + "range":[90,93], + "operator":"++", + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":36},"end":{"line":3,"column":37}}, + "range":[90,91], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "prefix":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":41},"end":{"line":5,"column":5}}, + "range":[95,151], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":4,"column":8},"end":{"line":4,"column":48}}, + "range":[105,145], + "expression":{ + "type":"YieldExpression", + "loc":{"source":null,"start":{"line":4,"column":8},"end":{"line":4,"column":20}}, + "range":[105,117], + "argument":{ + "type":"MemberExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":21},"end":{"line":4,"column":47}}, + "range":[118,144], + "value":" trailing yield val 1 " + } + ], + "loc":{"source":null,"start":{"line":4,"column":14},"end":{"line":4,"column":20}}, + "range":[111,117], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":14},"end":{"line":4,"column":17}}, + "range":[111,114], + "name":"arr", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":18},"end":{"line":4,"column":19}}, + "range":[115,116], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "computed":true + }, + "delegate":false + }, + "directive":null + } + ] + } + } + ] + }, + "async":false, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":8,"column":0},"end":{"line":13,"column":1}}, + "range":[155,330], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":8,"column":10},"end":{"line":8,"column":24}}, + "range":[165,179], + "name":"yield_trailing", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":8,"column":27},"end":{"line":13,"column":1}}, + "range":[182,330], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":9,"column":4},"end":{"line":9,"column":8}}, + "range":[188,192], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":4},"end":{"line":9,"column":8}}, + "range":[188,192], + "name":"cont", + "typeAnnotation":null, + "optional":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":9,"column":9},"end":{"line":9,"column":24}}, + "range":[193,208], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":9,"column":9},"end":{"line":9,"column":24}}, + "range":[193,208], + "operator":"=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":9},"end":{"line":9,"column":12}}, + "range":[193,196], + "name":"arr", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":9,"column":15},"end":{"line":9,"column":24}}, + "range":[199,208], + "elements":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":9,"column":16},"end":{"line":9,"column":17}}, + "range":[200,201], + "value":1, + "raw":"1" + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":9,"column":19},"end":{"line":9,"column":20}}, + "range":[203,204], + "value":2, + "raw":"2" + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":9,"column":22},"end":{"line":9,"column":23}}, + "range":[206,207], + "value":3, + "raw":"3" + } + ] + } + }, + "directive":null + }, + { + "type":"ForStatement", + "loc":{"source":null,"start":{"line":10,"column":4},"end":{"line":12,"column":5}}, + "range":[213,328], + "init":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":10,"column":9},"end":{"line":10,"column":18}}, + "range":[218,227], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":10,"column":13},"end":{"line":10,"column":18}}, + "range":[222,227], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":10,"column":13},"end":{"line":10,"column":14}}, + "range":[222,223], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":10,"column":17},"end":{"line":10,"column":18}}, + "range":[226,227], + "value":0, + "raw":"0" + } + } + ], + "kind":"var" + }, + "test":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":10,"column":20},"end":{"line":10,"column":34}}, + "range":[229,243], + "operator":"<", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":10,"column":20},"end":{"line":10,"column":21}}, + "range":[229,230], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":10,"column":24},"end":{"line":10,"column":34}}, + "range":[233,243], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":10,"column":24},"end":{"line":10,"column":27}}, + "range":[233,236], + "name":"arr", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":10,"column":28},"end":{"line":10,"column":34}}, + "range":[237,243], + "name":"length", + "typeAnnotation":null, + "optional":false + }, + "computed":false + } + }, + "update":{ + "type":"UpdateExpression", + "loc":{"source":null,"start":{"line":10,"column":36},"end":{"line":10,"column":39}}, + "range":[245,248], + "operator":"++", + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":10,"column":36},"end":{"line":10,"column":37}}, + "range":[245,246], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "prefix":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":10,"column":41},"end":{"line":12,"column":5}}, + "range":[250,328], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":11,"column":30},"end":{"line":11,"column":70}}, + "range":[282,322], + "expression":{ + "type":"YieldExpression", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":8},"end":{"line":11,"column":29}}, + "range":[260,281], + "value":" leading yield 1 " + } + ], + "loc":{"source":null,"start":{"line":11,"column":30},"end":{"line":11,"column":42}}, + "range":[282,294], + "argument":{ + "type":"MemberExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":43},"end":{"line":11,"column":69}}, + "range":[295,321], + "value":" trailing yield val 2 " + } + ], + "loc":{"source":null,"start":{"line":11,"column":36},"end":{"line":11,"column":42}}, + "range":[288,294], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":11,"column":36},"end":{"line":11,"column":39}}, + "range":[288,291], + "name":"arr", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":11,"column":40},"end":{"line":11,"column":41}}, + "range":[292,293], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "computed":true + }, + "delegate":false + }, + "directive":null + } + ] + } + } + ] + }, + "async":false, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":15,"column":0},"end":{"line":20,"column":1}}, + "range":[332,480], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":15,"column":10},"end":{"line":15,"column":24}}, + "range":[342,356], + "name":"yield_trailing", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":15,"column":27},"end":{"line":20,"column":1}}, + "range":[359,480], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":16,"column":4},"end":{"line":16,"column":8}}, + "range":[365,369], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":16,"column":4},"end":{"line":16,"column":8}}, + "range":[365,369], + "name":"cont", + "typeAnnotation":null, + "optional":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":16,"column":9},"end":{"line":16,"column":24}}, + "range":[370,385], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":16,"column":9},"end":{"line":16,"column":24}}, + "range":[370,385], + "operator":"=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":16,"column":9},"end":{"line":16,"column":12}}, + "range":[370,373], + "name":"arr", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":16,"column":15},"end":{"line":16,"column":24}}, + "range":[376,385], + "elements":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":16,"column":16},"end":{"line":16,"column":17}}, + "range":[377,378], + "value":1, + "raw":"1" + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":16,"column":19},"end":{"line":16,"column":20}}, + "range":[380,381], + "value":2, + "raw":"2" + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":16,"column":22},"end":{"line":16,"column":23}}, + "range":[383,384], + "value":3, + "raw":"3" + } + ] + } + }, + "directive":null + }, + { + "type":"ForStatement", + "loc":{"source":null,"start":{"line":17,"column":4},"end":{"line":19,"column":5}}, + "range":[390,478], + "init":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":17,"column":9},"end":{"line":17,"column":18}}, + "range":[395,404], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":17,"column":13},"end":{"line":17,"column":18}}, + "range":[399,404], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":17,"column":13},"end":{"line":17,"column":14}}, + "range":[399,400], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":17,"column":17},"end":{"line":17,"column":18}}, + "range":[403,404], + "value":0, + "raw":"0" + } + } + ], + "kind":"var" + }, + "test":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":17,"column":20},"end":{"line":17,"column":34}}, + "range":[406,420], + "operator":"<", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":17,"column":20},"end":{"line":17,"column":21}}, + "range":[406,407], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":17,"column":24},"end":{"line":17,"column":34}}, + "range":[410,420], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":17,"column":24},"end":{"line":17,"column":27}}, + "range":[410,413], + "name":"arr", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":17,"column":28},"end":{"line":17,"column":34}}, + "range":[414,420], + "name":"length", + "typeAnnotation":null, + "optional":false + }, + "computed":false + } + }, + "update":{ + "type":"UpdateExpression", + "loc":{"source":null,"start":{"line":17,"column":36},"end":{"line":17,"column":39}}, + "range":[422,425], + "operator":"++", + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":17,"column":36},"end":{"line":17,"column":37}}, + "range":[422,423], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "prefix":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":17,"column":41},"end":{"line":19,"column":5}}, + "range":[427,478], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":18,"column":30},"end":{"line":18,"column":43}}, + "range":[459,472], + "expression":{ + "type":"YieldExpression", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":8},"end":{"line":18,"column":29}}, + "range":[437,458], + "value":" leading yield 2 " + } + ], + "loc":{"source":null,"start":{"line":18,"column":30},"end":{"line":18,"column":42}}, + "range":[459,471], + "argument":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":18,"column":36},"end":{"line":18,"column":42}}, + "range":[465,471], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":18,"column":36},"end":{"line":18,"column":39}}, + "range":[465,468], + "name":"arr", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":18,"column":40},"end":{"line":18,"column":41}}, + "range":[469,470], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "computed":true + }, + "delegate":false + }, + "directive":null + } + ] + } + } + ] + }, + "async":false, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":22,"column":0},"end":{"line":27,"column":1}}, + "range":[482,659], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":22,"column":10},"end":{"line":22,"column":24}}, + "range":[492,506], + "name":"yield_trailing", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":22,"column":27},"end":{"line":27,"column":1}}, + "range":[509,659], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":23,"column":4},"end":{"line":23,"column":8}}, + "range":[515,519], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":23,"column":4},"end":{"line":23,"column":8}}, + "range":[515,519], + "name":"cont", + "typeAnnotation":null, + "optional":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":23,"column":9},"end":{"line":23,"column":24}}, + "range":[520,535], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":23,"column":9},"end":{"line":23,"column":24}}, + "range":[520,535], + "operator":"=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":23,"column":9},"end":{"line":23,"column":12}}, + "range":[520,523], + "name":"arr", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":23,"column":15},"end":{"line":23,"column":24}}, + "range":[526,535], + "elements":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":23,"column":16},"end":{"line":23,"column":17}}, + "range":[527,528], + "value":1, + "raw":"1" + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":23,"column":19},"end":{"line":23,"column":20}}, + "range":[530,531], + "value":2, + "raw":"2" + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":23,"column":22},"end":{"line":23,"column":23}}, + "range":[533,534], + "value":3, + "raw":"3" + } + ] + } + }, + "directive":null + }, + { + "type":"ForStatement", + "loc":{"source":null,"start":{"line":24,"column":4},"end":{"line":26,"column":5}}, + "range":[540,657], + "init":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":24,"column":9},"end":{"line":24,"column":18}}, + "range":[545,554], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":24,"column":13},"end":{"line":24,"column":18}}, + "range":[549,554], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":24,"column":13},"end":{"line":24,"column":14}}, + "range":[549,550], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":24,"column":17},"end":{"line":24,"column":18}}, + "range":[553,554], + "value":0, + "raw":"0" + } + } + ], + "kind":"var" + }, + "test":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":24,"column":20},"end":{"line":24,"column":34}}, + "range":[556,570], + "operator":"<", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":24,"column":20},"end":{"line":24,"column":21}}, + "range":[556,557], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":24,"column":24},"end":{"line":24,"column":34}}, + "range":[560,570], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":24,"column":24},"end":{"line":24,"column":27}}, + "range":[560,563], + "name":"arr", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":24,"column":28},"end":{"line":24,"column":34}}, + "range":[564,570], + "name":"length", + "typeAnnotation":null, + "optional":false + }, + "computed":false + } + }, + "update":{ + "type":"UpdateExpression", + "loc":{"source":null,"start":{"line":24,"column":36},"end":{"line":24,"column":39}}, + "range":[572,575], + "operator":"++", + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":24,"column":36},"end":{"line":24,"column":37}}, + "range":[572,573], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "prefix":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":24,"column":41},"end":{"line":26,"column":5}}, + "range":[577,657], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":25,"column":8},"end":{"line":25,"column":72}}, + "range":[587,651], + "expression":{ + "type":"YieldExpression", + "loc":{"source":null,"start":{"line":25,"column":8},"end":{"line":25,"column":44}}, + "range":[587,623], + "argument":{ + "type":"MemberExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":45},"end":{"line":25,"column":71}}, + "range":[624,650], + "value":" trailing yield val 3 " + } + ], + "loc":{"source":null,"start":{"line":25,"column":38},"end":{"line":25,"column":44}}, + "range":[617,623], + "object":{ + "type":"Identifier", + "leadingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":14},"end":{"line":25,"column":37}}, + "range":[593,616], + "value":" leading yield val " + } + ], + "loc":{"source":null,"start":{"line":25,"column":38},"end":{"line":25,"column":41}}, + "range":[617,620], + "name":"arr", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":25,"column":42},"end":{"line":25,"column":43}}, + "range":[621,622], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "computed":true + }, + "delegate":false + }, + "directive":null + } + ] + } + } + ] + }, + "async":false, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":29,"column":0},"end":{"line":31,"column":1}}, + "range":[661,730], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":29,"column":10},"end":{"line":29,"column":24}}, + "range":[671,685], + "name":"yield_trailing", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":29,"column":27},"end":{"line":31,"column":1}}, + "range":[688,730], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":30,"column":4},"end":{"line":30,"column":38}}, + "range":[694,728], + "expression":{ + "type":"YieldExpression", + "trailingComments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":10},"end":{"line":30,"column":37}}, + "range":[700,727], + "value":" trailing no yield val " + } + ], + "loc":{"source":null,"start":{"line":30,"column":4},"end":{"line":30,"column":9}}, + "range":[694,699], + "argument":null, + "delegate":false + }, + "directive":null + } + ] + }, + "async":false, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":4,"column":21},"end":{"line":4,"column":47}}, + "range":[118,144], + "value":" trailing yield val 1 " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":8},"end":{"line":11,"column":29}}, + "range":[260,281], + "value":" leading yield 1 " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":11,"column":43},"end":{"line":11,"column":69}}, + "range":[295,321], + "value":" trailing yield val 2 " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":18,"column":8},"end":{"line":18,"column":29}}, + "range":[437,458], + "value":" leading yield 2 " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":14},"end":{"line":25,"column":37}}, + "range":[593,616], + "value":" leading yield val " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":25,"column":45},"end":{"line":25,"column":71}}, + "range":[624,650], + "value":" trailing yield val 3 " + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":30,"column":10},"end":{"line":30,"column":37}}, + "range":[700,727], + "value":" trailing no yield val " + } + ] +} diff --git a/lib/test/flow/comments/migrated_0000.js b/lib/test/flow/comments/migrated_0000.js new file mode 100644 index 0000000..fc802cd --- /dev/null +++ b/lib/test/flow/comments/migrated_0000.js @@ -0,0 +1,2 @@ +// Regression test: "/*" should be allowed inside block comments +/* /* */ diff --git a/lib/test/flow/comments/migrated_0000.tree.json b/lib/test/flow/comments/migrated_0000.tree.json new file mode 100644 index 0000000..9d0006b --- /dev/null +++ b/lib/test/flow/comments/migrated_0000.tree.json @@ -0,0 +1,20 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":0}}, + "range":[74,74], + "body":[], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":64}}, + "range":[0,64], + "value":" Regression test: \"/*\" should be allowed inside block comments" + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":8}}, + "range":[65,73], + "value":" /* " + } + ] +} diff --git a/lib/test/flow/comments/migrated_0001.js b/lib/test/flow/comments/migrated_0001.js new file mode 100644 index 0000000..d23519e --- /dev/null +++ b/lib/test/flow/comments/migrated_0001.js @@ -0,0 +1,2 @@ +// Regression test: there are no comments here! +let x = /x/* 5 */y/; diff --git a/lib/test/flow/comments/migrated_0001.tree.json b/lib/test/flow/comments/migrated_0001.tree.json new file mode 100644 index 0000000..08d5f46 --- /dev/null +++ b/lib/test/flow/comments/migrated_0001.tree.json @@ -0,0 +1,71 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":20}}, + "range":[48,68], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":20}}, + "range":[48,68], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":19}}, + "range":[52,67], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":5}}, + "range":[52,53], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":19}}, + "range":[56,67], + "operator":"*", + "left":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":14}}, + "range":[56,62], + "operator":"*", + "left":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":11}}, + "range":[56,59], + "value":null, + "raw":"/x/", + "regex":{"pattern":"x","flags":""} + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":14}}, + "range":[61,62], + "value":5, + "raw":"5" + } + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":19}}, + "range":[64,67], + "value":null, + "raw":"/y/", + "regex":{"pattern":"y","flags":""} + } + } + } + ], + "kind":"let" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "range":[0,47], + "value":" Regression test: there are no comments here!" + } + ] +} diff --git a/lib/test/flow/comments/migrated_0002.js b/lib/test/flow/comments/migrated_0002.js new file mode 100644 index 0000000..019d627 --- /dev/null +++ b/lib/test/flow/comments/migrated_0002.js @@ -0,0 +1,2 @@ +// Regression test: there is a comments here! +type Foo = Array<*/* comment */> diff --git a/lib/test/flow/comments/migrated_0002.tree.json b/lib/test/flow/comments/migrated_0002.tree.json new file mode 100644 index 0000000..afb054e --- /dev/null +++ b/lib/test/flow/comments/migrated_0002.tree.json @@ -0,0 +1,60 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":32}}, + "range":[46,78], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":32}}, + "range":[46,78], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":8}}, + "range":[51,54], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":32}}, + "range":[57,78], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":16}}, + "range":[57,62], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":32}}, + "range":[62,78], + "params":[ + { + "type":"ExistsTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":18}}, + "range":[63,64] + } + ] + } + } + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "range":[0,45], + "value":" Regression test: there is a comments here!" + }, + { + "type":"Block", + "loc":{"source":null,"start":{"line":2,"column":18},"end":{"line":2,"column":31}}, + "range":[64,77], + "value":" comment " + } + ] +} diff --git a/lib/test/flow/comments/migrated_0003.js b/lib/test/flow/comments/migrated_0003.js new file mode 100644 index 0000000..be779d0 --- /dev/null +++ b/lib/test/flow/comments/migrated_0003.js @@ -0,0 +1,3 @@ +type Foo = +| string // a +| number // b diff --git a/lib/test/flow/comments/migrated_0003.tree.json b/lib/test/flow/comments/migrated_0003.tree.json new file mode 100644 index 0000000..0f5e9d1 --- /dev/null +++ b/lib/test/flow/comments/migrated_0003.tree.json @@ -0,0 +1,52 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":8}}, + "range":[0,33], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":8}}, + "range":[0,33], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, + "range":[5,8], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"UnionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":3,"column":8}}, + "range":[13,33], + "types":[ + { + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":8}}, + "range":[13,19] + }, + { + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":8}}, + "range":[27,33] + } + ] + } + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":13}}, + "range":[20,24], + "value":" a" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":3,"column":9},"end":{"line":3,"column":13}}, + "range":[34,38], + "value":" b" + } + ] +} diff --git a/lib/test/flow/decorators/migrated_0000.js b/lib/test/flow/decorators/migrated_0000.js new file mode 100644 index 0000000..f387005 --- /dev/null +++ b/lib/test/flow/decorators/migrated_0000.js @@ -0,0 +1,2 @@ +function Bar() { @myDecorator2 @myDecorator1 +class Foo { myMethod() {} } } diff --git a/lib/test/flow/decorators/migrated_0000.options.json b/lib/test/flow/decorators/migrated_0000.options.json new file mode 100644 index 0000000..fdf7ecf --- /dev/null +++ b/lib/test/flow/decorators/migrated_0000.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_decorators": true +} \ No newline at end of file diff --git a/lib/test/flow/decorators/migrated_0000.tree.json b/lib/test/flow/decorators/migrated_0000.tree.json new file mode 100644 index 0000000..6a8e9d8 --- /dev/null +++ b/lib/test/flow/decorators/migrated_0000.tree.json @@ -0,0 +1,123 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":29}}, + "range":[0,74], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":29}}, + "range":[0,74], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"Bar", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":2,"column":29}}, + "range":[15,74], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":2,"column":27}}, + "range":[17,72], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":9}}, + "range":[51,54], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":27}}, + "range":[55,72], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":25}}, + "range":[57,70], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":20}}, + "range":[57,65], + "name":"myMethod", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":20},"end":{"line":2,"column":25}}, + "range":[65,70], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":23},"end":{"line":2,"column":25}}, + "range":[68,70], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[ + { + "type":"Decorator", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":30}}, + "range":[17,30], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "range":[18,30], + "name":"myDecorator2", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"Decorator", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":44}}, + "range":[31,44], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":44}}, + "range":[32,44], + "name":"myDecorator1", + "typeAnnotation":null, + "optional":false + } + } + ] + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/decorators/migrated_0001.js b/lib/test/flow/decorators/migrated_0001.js new file mode 100644 index 0000000..59d8933 --- /dev/null +++ b/lib/test/flow/decorators/migrated_0001.js @@ -0,0 +1,2 @@ +@myDecorator2 @myDecorator1 +class Foo { myMethod() {} } diff --git a/lib/test/flow/decorators/migrated_0001.options.json b/lib/test/flow/decorators/migrated_0001.options.json new file mode 100644 index 0000000..fdf7ecf --- /dev/null +++ b/lib/test/flow/decorators/migrated_0001.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_decorators": true +} \ No newline at end of file diff --git a/lib/test/flow/decorators/migrated_0001.tree.json b/lib/test/flow/decorators/migrated_0001.tree.json new file mode 100644 index 0000000..f73d2e7 --- /dev/null +++ b/lib/test/flow/decorators/migrated_0001.tree.json @@ -0,0 +1,96 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":27}}, + "range":[28,55], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":27}}, + "range":[28,55], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":9}}, + "range":[34,37], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":27}}, + "range":[38,55], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":25}}, + "range":[40,53], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":20}}, + "range":[40,48], + "name":"myMethod", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":20},"end":{"line":2,"column":25}}, + "range":[48,53], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":23},"end":{"line":2,"column":25}}, + "range":[51,53], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[ + { + "type":"Decorator", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":13}}, + "range":[1,13], + "name":"myDecorator2", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"Decorator", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":27}}, + "range":[14,27], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":27}}, + "range":[15,27], + "name":"myDecorator1", + "typeAnnotation":null, + "optional":false + } + } + ] + } + ], + "comments":[] +} diff --git a/lib/test/flow/decorators/migrated_0002.js b/lib/test/flow/decorators/migrated_0002.js new file mode 100644 index 0000000..2535799 --- /dev/null +++ b/lib/test/flow/decorators/migrated_0002.js @@ -0,0 +1,2 @@ +@myDecorator2 @myDecorator1 +export class Foo { myMethod() {} } diff --git a/lib/test/flow/decorators/migrated_0002.options.json b/lib/test/flow/decorators/migrated_0002.options.json new file mode 100644 index 0000000..fdf7ecf --- /dev/null +++ b/lib/test/flow/decorators/migrated_0002.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_decorators": true +} \ No newline at end of file diff --git a/lib/test/flow/decorators/migrated_0002.tree.json b/lib/test/flow/decorators/migrated_0002.tree.json new file mode 100644 index 0000000..d9cbcf0 --- /dev/null +++ b/lib/test/flow/decorators/migrated_0002.tree.json @@ -0,0 +1,104 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":34}}, + "range":[28,62], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":34}}, + "range":[28,62], + "declaration":{ + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":34}}, + "range":[35,62], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":16}}, + "range":[41,44], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":34}}, + "range":[45,62], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":32}}, + "range":[47,60], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":27}}, + "range":[47,55], + "name":"myMethod", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":27},"end":{"line":2,"column":32}}, + "range":[55,60], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":30},"end":{"line":2,"column":32}}, + "range":[58,60], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[ + { + "type":"Decorator", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":13}}, + "range":[1,13], + "name":"myDecorator2", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"Decorator", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":27}}, + "range":[14,27], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":27}}, + "range":[15,27], + "name":"myDecorator1", + "typeAnnotation":null, + "optional":false + } + } + ] + }, + "specifiers":[], + "source":null, + "exportKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/decorators/migrated_0003.js b/lib/test/flow/decorators/migrated_0003.js new file mode 100644 index 0000000..15d83e5 --- /dev/null +++ b/lib/test/flow/decorators/migrated_0003.js @@ -0,0 +1,4 @@ +@myDecorator1 +export +@myDecorator2 +class Foo { myMethod() {} } diff --git a/lib/test/flow/decorators/migrated_0003.options.json b/lib/test/flow/decorators/migrated_0003.options.json new file mode 100644 index 0000000..fdf7ecf --- /dev/null +++ b/lib/test/flow/decorators/migrated_0003.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_decorators": true +} \ No newline at end of file diff --git a/lib/test/flow/decorators/migrated_0003.tree.json b/lib/test/flow/decorators/migrated_0003.tree.json new file mode 100644 index 0000000..039963a --- /dev/null +++ b/lib/test/flow/decorators/migrated_0003.tree.json @@ -0,0 +1,104 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":4,"column":27}}, + "range":[14,62], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":4,"column":27}}, + "range":[14,62], + "declaration":{ + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":4,"column":27}}, + "range":[21,62], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":6},"end":{"line":4,"column":9}}, + "range":[41,44], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":4,"column":10},"end":{"line":4,"column":27}}, + "range":[45,62], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":4,"column":12},"end":{"line":4,"column":25}}, + "range":[47,60], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":12},"end":{"line":4,"column":20}}, + "range":[47,55], + "name":"myMethod", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":4,"column":20},"end":{"line":4,"column":25}}, + "range":[55,60], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":4,"column":23},"end":{"line":4,"column":25}}, + "range":[58,60], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[ + { + "type":"Decorator", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":13}}, + "range":[1,13], + "name":"myDecorator1", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"Decorator", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":13}}, + "range":[21,34], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":1},"end":{"line":3,"column":13}}, + "range":[22,34], + "name":"myDecorator2", + "typeAnnotation":null, + "optional":false + } + } + ] + }, + "specifiers":[], + "source":null, + "exportKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/decorators/migrated_0004.js b/lib/test/flow/decorators/migrated_0004.js new file mode 100644 index 0000000..9c4b434 --- /dev/null +++ b/lib/test/flow/decorators/migrated_0004.js @@ -0,0 +1,2 @@ +@myDecorator2 @myDecorator1 +export default class Foo { myMethod() {} } diff --git a/lib/test/flow/decorators/migrated_0004.options.json b/lib/test/flow/decorators/migrated_0004.options.json new file mode 100644 index 0000000..fdf7ecf --- /dev/null +++ b/lib/test/flow/decorators/migrated_0004.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_decorators": true +} \ No newline at end of file diff --git a/lib/test/flow/decorators/migrated_0004.tree.json b/lib/test/flow/decorators/migrated_0004.tree.json new file mode 100644 index 0000000..472807a --- /dev/null +++ b/lib/test/flow/decorators/migrated_0004.tree.json @@ -0,0 +1,102 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":42}}, + "range":[28,70], + "body":[ + { + "type":"ExportDefaultDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":42}}, + "range":[28,70], + "declaration":{ + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":2,"column":15},"end":{"line":2,"column":42}}, + "range":[43,70], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":21},"end":{"line":2,"column":24}}, + "range":[49,52], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":2,"column":25},"end":{"line":2,"column":42}}, + "range":[53,70], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":2,"column":27},"end":{"line":2,"column":40}}, + "range":[55,68], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":27},"end":{"line":2,"column":35}}, + "range":[55,63], + "name":"myMethod", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":35},"end":{"line":2,"column":40}}, + "range":[63,68], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":38},"end":{"line":2,"column":40}}, + "range":[66,68], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[ + { + "type":"Decorator", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":13}}, + "range":[1,13], + "name":"myDecorator2", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"Decorator", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":27}}, + "range":[14,27], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":27}}, + "range":[15,27], + "name":"myDecorator1", + "typeAnnotation":null, + "optional":false + } + } + ] + }, + "exportKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/decorators/migrated_0005.js b/lib/test/flow/decorators/migrated_0005.js new file mode 100644 index 0000000..7748ee2 --- /dev/null +++ b/lib/test/flow/decorators/migrated_0005.js @@ -0,0 +1,4 @@ +@myDecorator1 +export default +@myDecorator2 +class Foo { myMethod() {} } diff --git a/lib/test/flow/decorators/migrated_0005.options.json b/lib/test/flow/decorators/migrated_0005.options.json new file mode 100644 index 0000000..fdf7ecf --- /dev/null +++ b/lib/test/flow/decorators/migrated_0005.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_decorators": true +} \ No newline at end of file diff --git a/lib/test/flow/decorators/migrated_0005.tree.json b/lib/test/flow/decorators/migrated_0005.tree.json new file mode 100644 index 0000000..34b9047 --- /dev/null +++ b/lib/test/flow/decorators/migrated_0005.tree.json @@ -0,0 +1,102 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":4,"column":27}}, + "range":[14,70], + "body":[ + { + "type":"ExportDefaultDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":4,"column":27}}, + "range":[14,70], + "declaration":{ + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":4,"column":27}}, + "range":[29,70], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":6},"end":{"line":4,"column":9}}, + "range":[49,52], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":4,"column":10},"end":{"line":4,"column":27}}, + "range":[53,70], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":4,"column":12},"end":{"line":4,"column":25}}, + "range":[55,68], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":12},"end":{"line":4,"column":20}}, + "range":[55,63], + "name":"myMethod", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":4,"column":20},"end":{"line":4,"column":25}}, + "range":[63,68], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":4,"column":23},"end":{"line":4,"column":25}}, + "range":[66,68], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[ + { + "type":"Decorator", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":13}}, + "range":[1,13], + "name":"myDecorator1", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"Decorator", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":13}}, + "range":[29,42], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":1},"end":{"line":3,"column":13}}, + "range":[30,42], + "name":"myDecorator2", + "typeAnnotation":null, + "optional":false + } + } + ] + }, + "exportKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/decorators/migrated_0006.js b/lib/test/flow/decorators/migrated_0006.js new file mode 100644 index 0000000..37dfd1b --- /dev/null +++ b/lib/test/flow/decorators/migrated_0006.js @@ -0,0 +1 @@ +class Foo { @myDecorator1 @myDecorator2 myMethod() {} } diff --git a/lib/test/flow/decorators/migrated_0006.options.json b/lib/test/flow/decorators/migrated_0006.options.json new file mode 100644 index 0000000..fdf7ecf --- /dev/null +++ b/lib/test/flow/decorators/migrated_0006.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_decorators": true +} \ No newline at end of file diff --git a/lib/test/flow/decorators/migrated_0006.tree.json b/lib/test/flow/decorators/migrated_0006.tree.json new file mode 100644 index 0000000..bf0fb30 --- /dev/null +++ b/lib/test/flow/decorators/migrated_0006.tree.json @@ -0,0 +1,96 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":55}}, + "range":[0,55], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":55}}, + "range":[0,55], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":55}}, + "range":[10,55], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":53}}, + "range":[12,53], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":40},"end":{"line":1,"column":48}}, + "range":[40,48], + "name":"myMethod", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":48},"end":{"line":1,"column":53}}, + "range":[48,53], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":51},"end":{"line":1,"column":53}}, + "range":[51,53], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[ + { + "type":"Decorator", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":25}}, + "range":[12,25], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":25}}, + "range":[13,25], + "name":"myDecorator1", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"Decorator", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":39}}, + "range":[26,39], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":39}}, + "range":[27,39], + "name":"myDecorator2", + "typeAnnotation":null, + "optional":false + } + } + ] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/decorators/migrated_0007.js b/lib/test/flow/decorators/migrated_0007.js new file mode 100644 index 0000000..e016f65 --- /dev/null +++ b/lib/test/flow/decorators/migrated_0007.js @@ -0,0 +1 @@ +class Foo { @myDecorator1 @myDecorator2 *myMethod() {} } diff --git a/lib/test/flow/decorators/migrated_0007.options.json b/lib/test/flow/decorators/migrated_0007.options.json new file mode 100644 index 0000000..fdf7ecf --- /dev/null +++ b/lib/test/flow/decorators/migrated_0007.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_decorators": true +} \ No newline at end of file diff --git a/lib/test/flow/decorators/migrated_0007.tree.json b/lib/test/flow/decorators/migrated_0007.tree.json new file mode 100644 index 0000000..8002c25 --- /dev/null +++ b/lib/test/flow/decorators/migrated_0007.tree.json @@ -0,0 +1,96 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, + "range":[0,56], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, + "range":[0,56], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":56}}, + "range":[10,56], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":54}}, + "range":[12,54], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":49}}, + "range":[41,49], + "name":"myMethod", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":49},"end":{"line":1,"column":54}}, + "range":[49,54], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":52},"end":{"line":1,"column":54}}, + "range":[52,54], + "body":[] + }, + "async":false, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[ + { + "type":"Decorator", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":25}}, + "range":[12,25], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":25}}, + "range":[13,25], + "name":"myDecorator1", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"Decorator", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":39}}, + "range":[26,39], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":39}}, + "range":[27,39], + "name":"myDecorator2", + "typeAnnotation":null, + "optional":false + } + } + ] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/decorators/migrated_0008.js b/lib/test/flow/decorators/migrated_0008.js new file mode 100644 index 0000000..ca44a35 --- /dev/null +++ b/lib/test/flow/decorators/migrated_0008.js @@ -0,0 +1 @@ +class Foo { @myDecorator1 @myDecorator2 static myMethod() {} } diff --git a/lib/test/flow/decorators/migrated_0008.options.json b/lib/test/flow/decorators/migrated_0008.options.json new file mode 100644 index 0000000..fdf7ecf --- /dev/null +++ b/lib/test/flow/decorators/migrated_0008.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_decorators": true +} \ No newline at end of file diff --git a/lib/test/flow/decorators/migrated_0008.tree.json b/lib/test/flow/decorators/migrated_0008.tree.json new file mode 100644 index 0000000..ca23c3d --- /dev/null +++ b/lib/test/flow/decorators/migrated_0008.tree.json @@ -0,0 +1,96 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":62}}, + "range":[0,62], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":62}}, + "range":[0,62], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":62}}, + "range":[10,62], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":60}}, + "range":[12,60], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":47},"end":{"line":1,"column":55}}, + "range":[47,55], + "name":"myMethod", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":55},"end":{"line":1,"column":60}}, + "range":[55,60], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":58},"end":{"line":1,"column":60}}, + "range":[58,60], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":true, + "computed":false, + "decorators":[ + { + "type":"Decorator", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":25}}, + "range":[12,25], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":25}}, + "range":[13,25], + "name":"myDecorator1", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"Decorator", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":39}}, + "range":[26,39], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":39}}, + "range":[27,39], + "name":"myDecorator2", + "typeAnnotation":null, + "optional":false + } + } + ] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/decorators/migrated_0009.js b/lib/test/flow/decorators/migrated_0009.js new file mode 100644 index 0000000..ca28342 --- /dev/null +++ b/lib/test/flow/decorators/migrated_0009.js @@ -0,0 +1 @@ +class Foo { @myDecorator1 @myDecorator2 async myMethod() {} } diff --git a/lib/test/flow/decorators/migrated_0009.options.json b/lib/test/flow/decorators/migrated_0009.options.json new file mode 100644 index 0000000..fdf7ecf --- /dev/null +++ b/lib/test/flow/decorators/migrated_0009.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_decorators": true +} \ No newline at end of file diff --git a/lib/test/flow/decorators/migrated_0009.tree.json b/lib/test/flow/decorators/migrated_0009.tree.json new file mode 100644 index 0000000..43f427e --- /dev/null +++ b/lib/test/flow/decorators/migrated_0009.tree.json @@ -0,0 +1,96 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":61}}, + "range":[0,61], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":61}}, + "range":[0,61], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":61}}, + "range":[10,61], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":59}}, + "range":[12,59], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":46},"end":{"line":1,"column":54}}, + "range":[46,54], + "name":"myMethod", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":54},"end":{"line":1,"column":59}}, + "range":[54,59], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":57},"end":{"line":1,"column":59}}, + "range":[57,59], + "body":[] + }, + "async":true, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[ + { + "type":"Decorator", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":25}}, + "range":[12,25], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":25}}, + "range":[13,25], + "name":"myDecorator1", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"Decorator", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":39}}, + "range":[26,39], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":39}}, + "range":[27,39], + "name":"myDecorator2", + "typeAnnotation":null, + "optional":false + } + } + ] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/decorators/migrated_0010.js b/lib/test/flow/decorators/migrated_0010.js new file mode 100644 index 0000000..e73a689 --- /dev/null +++ b/lib/test/flow/decorators/migrated_0010.js @@ -0,0 +1 @@ +class Foo { @myDecorator1 @myDecorator2 get myProp() {} } diff --git a/lib/test/flow/decorators/migrated_0010.options.json b/lib/test/flow/decorators/migrated_0010.options.json new file mode 100644 index 0000000..fdf7ecf --- /dev/null +++ b/lib/test/flow/decorators/migrated_0010.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_decorators": true +} \ No newline at end of file diff --git a/lib/test/flow/decorators/migrated_0010.tree.json b/lib/test/flow/decorators/migrated_0010.tree.json new file mode 100644 index 0000000..98d85c8 --- /dev/null +++ b/lib/test/flow/decorators/migrated_0010.tree.json @@ -0,0 +1,96 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, + "range":[0,57], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, + "range":[0,57], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":57}}, + "range":[10,57], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":55}}, + "range":[12,55], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":44},"end":{"line":1,"column":50}}, + "range":[44,50], + "name":"myProp", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":50},"end":{"line":1,"column":55}}, + "range":[50,55], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":53},"end":{"line":1,"column":55}}, + "range":[53,55], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"get", + "static":false, + "computed":false, + "decorators":[ + { + "type":"Decorator", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":25}}, + "range":[12,25], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":25}}, + "range":[13,25], + "name":"myDecorator1", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"Decorator", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":39}}, + "range":[26,39], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":39}}, + "range":[27,39], + "name":"myDecorator2", + "typeAnnotation":null, + "optional":false + } + } + ] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/decorators/migrated_0011.js b/lib/test/flow/decorators/migrated_0011.js new file mode 100644 index 0000000..7142fa1 --- /dev/null +++ b/lib/test/flow/decorators/migrated_0011.js @@ -0,0 +1 @@ +class Foo { @myDecorator1 @myDecorator2 set myProp(v) {} } diff --git a/lib/test/flow/decorators/migrated_0011.options.json b/lib/test/flow/decorators/migrated_0011.options.json new file mode 100644 index 0000000..fdf7ecf --- /dev/null +++ b/lib/test/flow/decorators/migrated_0011.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_decorators": true +} \ No newline at end of file diff --git a/lib/test/flow/decorators/migrated_0011.tree.json b/lib/test/flow/decorators/migrated_0011.tree.json new file mode 100644 index 0000000..e6d2439 --- /dev/null +++ b/lib/test/flow/decorators/migrated_0011.tree.json @@ -0,0 +1,105 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "range":[0,58], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "range":[0,58], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":58}}, + "range":[10,58], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":56}}, + "range":[12,56], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":44},"end":{"line":1,"column":50}}, + "range":[44,50], + "name":"myProp", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":50},"end":{"line":1,"column":56}}, + "range":[50,56], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":51},"end":{"line":1,"column":52}}, + "range":[51,52], + "name":"v", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":54},"end":{"line":1,"column":56}}, + "range":[54,56], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"set", + "static":false, + "computed":false, + "decorators":[ + { + "type":"Decorator", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":25}}, + "range":[12,25], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":25}}, + "range":[13,25], + "name":"myDecorator1", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"Decorator", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":39}}, + "range":[26,39], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":39}}, + "range":[27,39], + "name":"myDecorator2", + "typeAnnotation":null, + "optional":false + } + } + ] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/decorators/migrated_0012.js b/lib/test/flow/decorators/migrated_0012.js new file mode 100644 index 0000000..a046363 --- /dev/null +++ b/lib/test/flow/decorators/migrated_0012.js @@ -0,0 +1 @@ +class Foo { @myDecorator("someParam") myMethod() {} } diff --git a/lib/test/flow/decorators/migrated_0012.options.json b/lib/test/flow/decorators/migrated_0012.options.json new file mode 100644 index 0000000..fdf7ecf --- /dev/null +++ b/lib/test/flow/decorators/migrated_0012.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_decorators": true +} \ No newline at end of file diff --git a/lib/test/flow/decorators/migrated_0012.tree.json b/lib/test/flow/decorators/migrated_0012.tree.json new file mode 100644 index 0000000..c4fbc73 --- /dev/null +++ b/lib/test/flow/decorators/migrated_0012.tree.json @@ -0,0 +1,98 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "range":[0,53], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "range":[0,53], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":53}}, + "range":[10,53], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":51}}, + "range":[12,51], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":46}}, + "range":[38,46], + "name":"myMethod", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":46},"end":{"line":1,"column":51}}, + "range":[46,51], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":49},"end":{"line":1,"column":51}}, + "range":[49,51], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[ + { + "type":"Decorator", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":37}}, + "range":[12,37], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":37}}, + "range":[13,37], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":24}}, + "range":[13,24], + "name":"myDecorator", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":36}}, + "range":[25,36], + "value":"someParam", + "raw":"\"someParam\"" + } + ] + } + } + ] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/decorators_invalid/migrated_0000.js b/lib/test/flow/decorators_invalid/migrated_0000.js new file mode 100644 index 0000000..261eb11 --- /dev/null +++ b/lib/test/flow/decorators_invalid/migrated_0000.js @@ -0,0 +1 @@ +@BadDirectiveNoParseOption diff --git a/lib/test/flow/decorators_invalid/migrated_0000.tree.json b/lib/test/flow/decorators_invalid/migrated_0000.tree.json new file mode 100644 index 0000000..ae73e7d --- /dev/null +++ b/lib/test/flow/decorators_invalid/migrated_0000.tree.json @@ -0,0 +1,42 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "message":"Unexpected token `@`, expected the token `class`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the token `{`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":26}}, + "range":[1,26], + "name":"BadDirectiveNoParseOption", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":1,"column":26}}, + "range":[27,26], + "body":[] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/decorators_invalid/migrated_0001.js b/lib/test/flow/decorators_invalid/migrated_0001.js new file mode 100644 index 0000000..4bd0ecd --- /dev/null +++ b/lib/test/flow/decorators_invalid/migrated_0001.js @@ -0,0 +1 @@ +@BadDirectiveWithParseOption diff --git a/lib/test/flow/decorators_invalid/migrated_0001.options.json b/lib/test/flow/decorators_invalid/migrated_0001.options.json new file mode 100644 index 0000000..fdf7ecf --- /dev/null +++ b/lib/test/flow/decorators_invalid/migrated_0001.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_decorators": true +} \ No newline at end of file diff --git a/lib/test/flow/decorators_invalid/migrated_0001.tree.json b/lib/test/flow/decorators_invalid/migrated_0001.tree.json new file mode 100644 index 0000000..2904599 --- /dev/null +++ b/lib/test/flow/decorators_invalid/migrated_0001.tree.json @@ -0,0 +1,23 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "message":"Found a decorator in an unsupported position." + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the start of a statement" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "range":[29,29], + "body":[ + { + "type":"EmptyStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "range":[29,29] + } + ], + "comments":[] +} diff --git a/lib/test/flow/decorators_invalid/migrated_0002.js b/lib/test/flow/decorators_invalid/migrated_0002.js new file mode 100644 index 0000000..c900cc5 --- /dev/null +++ b/lib/test/flow/decorators_invalid/migrated_0002.js @@ -0,0 +1,2 @@ +@blah +import * from "foo" diff --git a/lib/test/flow/decorators_invalid/migrated_0002.options.json b/lib/test/flow/decorators_invalid/migrated_0002.options.json new file mode 100644 index 0000000..fdf7ecf --- /dev/null +++ b/lib/test/flow/decorators_invalid/migrated_0002.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_decorators": true +} \ No newline at end of file diff --git a/lib/test/flow/decorators_invalid/migrated_0002.tree.json b/lib/test/flow/decorators_invalid/migrated_0002.tree.json new file mode 100644 index 0000000..37265c0 --- /dev/null +++ b/lib/test/flow/decorators_invalid/migrated_0002.tree.json @@ -0,0 +1,32 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "message":"Found a decorator in an unsupported position." + }, + { + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":13}}, + "message":"Unexpected identifier, expected the keyword `as`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":19}}, + "range":[6,25], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":19}}, + "range":[6,25], + "specifiers":[], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":19}}, + "range":[20,25], + "value":"foo", + "raw":"\"foo\"" + }, + "importKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/decorators_invalid/migrated_0003.js b/lib/test/flow/decorators_invalid/migrated_0003.js new file mode 100644 index 0000000..223affc --- /dev/null +++ b/lib/test/flow/decorators_invalid/migrated_0003.js @@ -0,0 +1,2 @@ +@blah +declare export class Foo {} diff --git a/lib/test/flow/decorators_invalid/migrated_0003.options.json b/lib/test/flow/decorators_invalid/migrated_0003.options.json new file mode 100644 index 0000000..fdf7ecf --- /dev/null +++ b/lib/test/flow/decorators_invalid/migrated_0003.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_decorators": true +} \ No newline at end of file diff --git a/lib/test/flow/decorators_invalid/migrated_0003.tree.json b/lib/test/flow/decorators_invalid/migrated_0003.tree.json new file mode 100644 index 0000000..0bad554 --- /dev/null +++ b/lib/test/flow/decorators_invalid/migrated_0003.tree.json @@ -0,0 +1,49 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "message":"Found a decorator in an unsupported position." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":27}}, + "range":[6,33], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":27}}, + "range":[6,33], + "default":false, + "declaration":{ + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":2,"column":15},"end":{"line":2,"column":27}}, + "range":[21,33], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":21},"end":{"line":2,"column":24}}, + "range":[27,30], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":25},"end":{"line":2,"column":27}}, + "range":[31,33], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/decorators_invalid/migrated_0004.js b/lib/test/flow/decorators_invalid/migrated_0004.js new file mode 100644 index 0000000..a56cb9c --- /dev/null +++ b/lib/test/flow/decorators_invalid/migrated_0004.js @@ -0,0 +1,2 @@ +@blah +let x = 123; diff --git a/lib/test/flow/decorators_invalid/migrated_0004.options.json b/lib/test/flow/decorators_invalid/migrated_0004.options.json new file mode 100644 index 0000000..fdf7ecf --- /dev/null +++ b/lib/test/flow/decorators_invalid/migrated_0004.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_decorators": true +} \ No newline at end of file diff --git a/lib/test/flow/decorators_invalid/migrated_0004.tree.json b/lib/test/flow/decorators_invalid/migrated_0004.tree.json new file mode 100644 index 0000000..aa672d7 --- /dev/null +++ b/lib/test/flow/decorators_invalid/migrated_0004.tree.json @@ -0,0 +1,42 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "message":"Found a decorator in an unsupported position." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":12}}, + "range":[6,18], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":12}}, + "range":[6,18], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":11}}, + "range":[10,17], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":5}}, + "range":[10,11], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":11}}, + "range":[14,17], + "value":123, + "raw":"123" + } + } + ], + "kind":"let" + } + ], + "comments":[] +} diff --git a/lib/test/flow/decorators_invalid/migrated_0005.js b/lib/test/flow/decorators_invalid/migrated_0005.js new file mode 100644 index 0000000..8a5a13b --- /dev/null +++ b/lib/test/flow/decorators_invalid/migrated_0005.js @@ -0,0 +1,2 @@ +@blah +const x = 123; diff --git a/lib/test/flow/decorators_invalid/migrated_0005.options.json b/lib/test/flow/decorators_invalid/migrated_0005.options.json new file mode 100644 index 0000000..fdf7ecf --- /dev/null +++ b/lib/test/flow/decorators_invalid/migrated_0005.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_decorators": true +} \ No newline at end of file diff --git a/lib/test/flow/decorators_invalid/migrated_0005.tree.json b/lib/test/flow/decorators_invalid/migrated_0005.tree.json new file mode 100644 index 0000000..8854155 --- /dev/null +++ b/lib/test/flow/decorators_invalid/migrated_0005.tree.json @@ -0,0 +1,42 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "message":"Found a decorator in an unsupported position." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":14}}, + "range":[6,20], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":14}}, + "range":[6,20], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":13}}, + "range":[12,19], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, + "range":[12,13], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":13}}, + "range":[16,19], + "value":123, + "raw":"123" + } + } + ], + "kind":"const" + } + ], + "comments":[] +} diff --git a/lib/test/flow/decorators_invalid/migrated_0006.js b/lib/test/flow/decorators_invalid/migrated_0006.js new file mode 100644 index 0000000..d9b3f10 --- /dev/null +++ b/lib/test/flow/decorators_invalid/migrated_0006.js @@ -0,0 +1,2 @@ +@blah +function foo() {} diff --git a/lib/test/flow/decorators_invalid/migrated_0006.options.json b/lib/test/flow/decorators_invalid/migrated_0006.options.json new file mode 100644 index 0000000..fdf7ecf --- /dev/null +++ b/lib/test/flow/decorators_invalid/migrated_0006.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_decorators": true +} \ No newline at end of file diff --git a/lib/test/flow/decorators_invalid/migrated_0006.tree.json b/lib/test/flow/decorators_invalid/migrated_0006.tree.json new file mode 100644 index 0000000..d391905 --- /dev/null +++ b/lib/test/flow/decorators_invalid/migrated_0006.tree.json @@ -0,0 +1,40 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "message":"Found a decorator in an unsupported position." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":17}}, + "range":[6,23], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":17}}, + "range":[6,23], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":12}}, + "range":[15,18], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":15},"end":{"line":2,"column":17}}, + "range":[21,23], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/decorators_invalid/migrated_0007.js b/lib/test/flow/decorators_invalid/migrated_0007.js new file mode 100644 index 0000000..28cb328 --- /dev/null +++ b/lib/test/flow/decorators_invalid/migrated_0007.js @@ -0,0 +1,2 @@ +@blah +interface Foo {} diff --git a/lib/test/flow/decorators_invalid/migrated_0007.options.json b/lib/test/flow/decorators_invalid/migrated_0007.options.json new file mode 100644 index 0000000..fdf7ecf --- /dev/null +++ b/lib/test/flow/decorators_invalid/migrated_0007.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_decorators": true +} \ No newline at end of file diff --git a/lib/test/flow/decorators_invalid/migrated_0007.tree.json b/lib/test/flow/decorators_invalid/migrated_0007.tree.json new file mode 100644 index 0000000..7f5d447 --- /dev/null +++ b/lib/test/flow/decorators_invalid/migrated_0007.tree.json @@ -0,0 +1,39 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "message":"Found a decorator in an unsupported position." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":16}}, + "range":[6,22], + "body":[ + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":16}}, + "range":[6,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":13}}, + "range":[16,19], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":16}}, + "range":[20,22], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/decorators_invalid/migrated_0008.js b/lib/test/flow/decorators_invalid/migrated_0008.js new file mode 100644 index 0000000..aa95c8e --- /dev/null +++ b/lib/test/flow/decorators_invalid/migrated_0008.js @@ -0,0 +1,2 @@ +@blah +declare class Foo {} diff --git a/lib/test/flow/decorators_invalid/migrated_0008.options.json b/lib/test/flow/decorators_invalid/migrated_0008.options.json new file mode 100644 index 0000000..fdf7ecf --- /dev/null +++ b/lib/test/flow/decorators_invalid/migrated_0008.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_decorators": true +} \ No newline at end of file diff --git a/lib/test/flow/decorators_invalid/migrated_0008.tree.json b/lib/test/flow/decorators_invalid/migrated_0008.tree.json new file mode 100644 index 0000000..c7a4fc6 --- /dev/null +++ b/lib/test/flow/decorators_invalid/migrated_0008.tree.json @@ -0,0 +1,41 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "message":"Found a decorator in an unsupported position." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":20}}, + "range":[6,26], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":20}}, + "range":[6,26], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":17}}, + "range":[20,23], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":18},"end":{"line":2,"column":20}}, + "range":[24,26], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/decorators_invalid/migrated_0009.js b/lib/test/flow/decorators_invalid/migrated_0009.js new file mode 100644 index 0000000..1b60267 --- /dev/null +++ b/lib/test/flow/decorators_invalid/migrated_0009.js @@ -0,0 +1,2 @@ +@blah +type Foo = any; diff --git a/lib/test/flow/decorators_invalid/migrated_0009.options.json b/lib/test/flow/decorators_invalid/migrated_0009.options.json new file mode 100644 index 0000000..fdf7ecf --- /dev/null +++ b/lib/test/flow/decorators_invalid/migrated_0009.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_decorators": true +} \ No newline at end of file diff --git a/lib/test/flow/decorators_invalid/migrated_0009.tree.json b/lib/test/flow/decorators_invalid/migrated_0009.tree.json new file mode 100644 index 0000000..2e77044 --- /dev/null +++ b/lib/test/flow/decorators_invalid/migrated_0009.tree.json @@ -0,0 +1,33 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "message":"Found a decorator in an unsupported position." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":15}}, + "range":[6,21], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":15}}, + "range":[6,21], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":8}}, + "range":[11,14], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":14}}, + "range":[17,20] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/decorators_invalid/migrated_0010.js b/lib/test/flow/decorators_invalid/migrated_0010.js new file mode 100644 index 0000000..fe115c9 --- /dev/null +++ b/lib/test/flow/decorators_invalid/migrated_0010.js @@ -0,0 +1,2 @@ +@blah +10*20; diff --git a/lib/test/flow/decorators_invalid/migrated_0010.options.json b/lib/test/flow/decorators_invalid/migrated_0010.options.json new file mode 100644 index 0000000..fdf7ecf --- /dev/null +++ b/lib/test/flow/decorators_invalid/migrated_0010.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_decorators": true +} \ No newline at end of file diff --git a/lib/test/flow/decorators_invalid/migrated_0010.tree.json b/lib/test/flow/decorators_invalid/migrated_0010.tree.json new file mode 100644 index 0000000..6b34822 --- /dev/null +++ b/lib/test/flow/decorators_invalid/migrated_0010.tree.json @@ -0,0 +1,40 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "message":"Found a decorator in an unsupported position." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":6}}, + "range":[6,12], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":6}}, + "range":[6,12], + "expression":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":5}}, + "range":[6,11], + "operator":"*", + "left":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":2}}, + "range":[6,8], + "value":10, + "raw":"10" + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":5}}, + "range":[9,11], + "value":20, + "raw":"20" + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/destructuring_with_default_values/migrated_0000.js b/lib/test/flow/destructuring_with_default_values/migrated_0000.js new file mode 100644 index 0000000..b31551c --- /dev/null +++ b/lib/test/flow/destructuring_with_default_values/migrated_0000.js @@ -0,0 +1 @@ +let {x=y} = {} diff --git a/lib/test/flow/destructuring_with_default_values/migrated_0000.tree.json b/lib/test/flow/destructuring_with_default_values/migrated_0000.tree.json new file mode 100644 index 0000000..5081a6e --- /dev/null +++ b/lib/test/flow/destructuring_with_default_values/migrated_0000.tree.json @@ -0,0 +1,73 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":14}}, + "range":[4,14], + "id":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, + "range":[4,9], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, + "range":[5,8], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"AssignmentPattern", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, + "range":[5,8], + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "range":[7,8], + "name":"y", + "typeAnnotation":null, + "optional":false + } + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ], + "typeAnnotation":null + }, + "init":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, + "range":[12,14], + "properties":[] + } + } + ], + "kind":"let" + } + ], + "comments":[] +} diff --git a/lib/test/flow/destructuring_with_default_values/migrated_0001.js b/lib/test/flow/destructuring_with_default_values/migrated_0001.js new file mode 100644 index 0000000..be7705c --- /dev/null +++ b/lib/test/flow/destructuring_with_default_values/migrated_0001.js @@ -0,0 +1 @@ +let {x:y=z} = {} diff --git a/lib/test/flow/destructuring_with_default_values/migrated_0001.tree.json b/lib/test/flow/destructuring_with_default_values/migrated_0001.tree.json new file mode 100644 index 0000000..dfcf1a1 --- /dev/null +++ b/lib/test/flow/destructuring_with_default_values/migrated_0001.tree.json @@ -0,0 +1,73 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, + "range":[4,16], + "id":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, + "range":[4,11], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, + "range":[5,10], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"AssignmentPattern", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, + "range":[7,10], + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "range":[7,8], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "name":"z", + "typeAnnotation":null, + "optional":false + } + }, + "kind":"init", + "method":false, + "shorthand":false, + "computed":false + } + ], + "typeAnnotation":null + }, + "init":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, + "range":[14,16], + "properties":[] + } + } + ], + "kind":"let" + } + ], + "comments":[] +} diff --git a/lib/test/flow/destructuring_with_default_values/migrated_0002.js b/lib/test/flow/destructuring_with_default_values/migrated_0002.js new file mode 100644 index 0000000..12b6908 --- /dev/null +++ b/lib/test/flow/destructuring_with_default_values/migrated_0002.js @@ -0,0 +1 @@ +let {p:{q=0,...o}={r:0}} = {p:{r:""}} diff --git a/lib/test/flow/destructuring_with_default_values/migrated_0002.tree.json b/lib/test/flow/destructuring_with_default_values/migrated_0002.tree.json new file mode 100644 index 0000000..9fbc0c7 --- /dev/null +++ b/lib/test/flow/destructuring_with_default_values/migrated_0002.tree.json @@ -0,0 +1,195 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "range":[0,37], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "range":[0,37], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":37}}, + "range":[4,37], + "id":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":24}}, + "range":[4,24], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":23}}, + "range":[5,23], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"p", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"AssignmentPattern", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":23}}, + "range":[7,23], + "left":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":17}}, + "range":[7,17], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":11}}, + "range":[8,11], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "name":"q", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"AssignmentPattern", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":11}}, + "range":[8,11], + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "name":"q", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "value":0, + "raw":"0" + } + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + }, + { + "type":"RestElement", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":16}}, + "range":[12,16], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"o", + "typeAnnotation":null, + "optional":false + } + } + ], + "typeAnnotation":null + }, + "right":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, + "range":[18,23], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, + "range":[19,22], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "range":[19,20], + "name":"r", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "value":0, + "raw":"0" + }, + "kind":"init", + "method":false, + "shorthand":false, + "computed":false + } + ] + } + }, + "kind":"init", + "method":false, + "shorthand":false, + "computed":false + } + ], + "typeAnnotation":null + }, + "init":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":37}}, + "range":[27,37], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":36}}, + "range":[28,36], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":29}}, + "range":[28,29], + "name":"p", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":36}}, + "range":[30,36], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":35}}, + "range":[31,35], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":32}}, + "range":[31,32], + "name":"r", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":35}}, + "range":[33,35], + "value":"", + "raw":"\"\"" + }, + "kind":"init", + "method":false, + "shorthand":false, + "computed":false + } + ] + }, + "kind":"init", + "method":false, + "shorthand":false, + "computed":false + } + ] + } + } + ], + "kind":"let" + } + ], + "comments":[] +} diff --git a/lib/test/flow/destructuring_with_default_values/migrated_0003.js b/lib/test/flow/destructuring_with_default_values/migrated_0003.js new file mode 100644 index 0000000..2c6ab54 --- /dev/null +++ b/lib/test/flow/destructuring_with_default_values/migrated_0003.js @@ -0,0 +1 @@ +let [x=y] = [] diff --git a/lib/test/flow/destructuring_with_default_values/migrated_0003.tree.json b/lib/test/flow/destructuring_with_default_values/migrated_0003.tree.json new file mode 100644 index 0000000..747ed65 --- /dev/null +++ b/lib/test/flow/destructuring_with_default_values/migrated_0003.tree.json @@ -0,0 +1,56 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":14}}, + "range":[4,14], + "id":{ + "type":"ArrayPattern", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, + "range":[4,9], + "elements":[ + { + "type":"AssignmentPattern", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, + "range":[5,8], + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "range":[7,8], + "name":"y", + "typeAnnotation":null, + "optional":false + } + } + ], + "typeAnnotation":null + }, + "init":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, + "range":[12,14], + "elements":[] + } + } + ], + "kind":"let" + } + ], + "comments":[] +} diff --git a/lib/test/flow/destructuring_with_default_values/migrated_0004.js b/lib/test/flow/destructuring_with_default_values/migrated_0004.js new file mode 100644 index 0000000..18d095b --- /dev/null +++ b/lib/test/flow/destructuring_with_default_values/migrated_0004.js @@ -0,0 +1 @@ +let [x=y, z] = [] diff --git a/lib/test/flow/destructuring_with_default_values/migrated_0004.tree.json b/lib/test/flow/destructuring_with_default_values/migrated_0004.tree.json new file mode 100644 index 0000000..3b5e004 --- /dev/null +++ b/lib/test/flow/destructuring_with_default_values/migrated_0004.tree.json @@ -0,0 +1,64 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, + "range":[4,17], + "id":{ + "type":"ArrayPattern", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, + "range":[4,12], + "elements":[ + { + "type":"AssignmentPattern", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, + "range":[5,8], + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "range":[7,8], + "name":"y", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"z", + "typeAnnotation":null, + "optional":false + } + ], + "typeAnnotation":null + }, + "init":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, + "range":[15,17], + "elements":[] + } + } + ], + "kind":"let" + } + ], + "comments":[] +} diff --git a/lib/test/flow/destructuring_with_default_values/obj_assignment_pattern_with_literal_key.js b/lib/test/flow/destructuring_with_default_values/obj_assignment_pattern_with_literal_key.js new file mode 100644 index 0000000..15ecb4c --- /dev/null +++ b/lib/test/flow/destructuring_with_default_values/obj_assignment_pattern_with_literal_key.js @@ -0,0 +1 @@ +({ "x" = true } = y); diff --git a/lib/test/flow/destructuring_with_default_values/obj_assignment_pattern_with_literal_key.tree.json b/lib/test/flow/destructuring_with_default_values/obj_assignment_pattern_with_literal_key.tree.json new file mode 100644 index 0000000..6841bc7 --- /dev/null +++ b/lib/test/flow/destructuring_with_default_values/obj_assignment_pattern_with_literal_key.tree.json @@ -0,0 +1,65 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "message":"Unexpected token `=`, expected the token `:`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":19}}, + "range":[1,19], + "operator":"=", + "left":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":15}}, + "range":[1,15], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":13}}, + "range":[3,13], + "key":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":6}}, + "range":[3,6], + "value":"x", + "raw":"\"x\"" + }, + "value":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, + "range":[9,13], + "value":true, + "raw":"true" + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ], + "typeAnnotation":null + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "name":"y", + "typeAnnotation":null, + "optional":false + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/dynamic_import/migrated_0000.js b/lib/test/flow/dynamic_import/migrated_0000.js new file mode 100644 index 0000000..9ca0e81 --- /dev/null +++ b/lib/test/flow/dynamic_import/migrated_0000.js @@ -0,0 +1 @@ +const m = import("asdf"); diff --git a/lib/test/flow/dynamic_import/migrated_0000.tree.json b/lib/test/flow/dynamic_import/migrated_0000.tree.json new file mode 100644 index 0000000..6ed1498 --- /dev/null +++ b/lib/test/flow/dynamic_import/migrated_0000.tree.json @@ -0,0 +1,41 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":24}}, + "range":[6,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"m", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ImportExpression", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":24}}, + "range":[10,24], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":23}}, + "range":[17,23], + "value":"asdf", + "raw":"\"asdf\"" + } + } + } + ], + "kind":"const" + } + ], + "comments":[] +} diff --git a/lib/test/flow/dynamic_import/migrated_0001.js b/lib/test/flow/dynamic_import/migrated_0001.js new file mode 100644 index 0000000..58d9e3b --- /dev/null +++ b/lib/test/flow/dynamic_import/migrated_0001.js @@ -0,0 +1 @@ +const m = import("asdf").then(); diff --git a/lib/test/flow/dynamic_import/migrated_0001.tree.json b/lib/test/flow/dynamic_import/migrated_0001.tree.json new file mode 100644 index 0000000..1e6f2fe --- /dev/null +++ b/lib/test/flow/dynamic_import/migrated_0001.tree.json @@ -0,0 +1,62 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":31}}, + "range":[6,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"m", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":31}}, + "range":[10,31], + "callee":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":29}}, + "range":[10,29], + "object":{ + "type":"ImportExpression", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":24}}, + "range":[10,24], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":23}}, + "range":[17,23], + "value":"asdf", + "raw":"\"asdf\"" + } + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":29}}, + "range":[25,29], + "name":"then", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "typeArguments":null, + "arguments":[] + } + } + ], + "kind":"const" + } + ], + "comments":[] +} diff --git a/lib/test/flow/dynamic_import/migrated_0002.js b/lib/test/flow/dynamic_import/migrated_0002.js new file mode 100644 index 0000000..0053d8f --- /dev/null +++ b/lib/test/flow/dynamic_import/migrated_0002.js @@ -0,0 +1 @@ +const m = import(a + b); diff --git a/lib/test/flow/dynamic_import/migrated_0002.tree.json b/lib/test/flow/dynamic_import/migrated_0002.tree.json new file mode 100644 index 0000000..0ec5fed --- /dev/null +++ b/lib/test/flow/dynamic_import/migrated_0002.tree.json @@ -0,0 +1,56 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":23}}, + "range":[6,23], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"m", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ImportExpression", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":23}}, + "range":[10,23], + "source":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":22}}, + "range":[17,22], + "operator":"+", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "range":[17,18], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "name":"b", + "typeAnnotation":null, + "optional":false + } + } + } + } + ], + "kind":"const" + } + ], + "comments":[] +} diff --git a/lib/test/flow/dynamic_import/migrated_0003.js b/lib/test/flow/dynamic_import/migrated_0003.js new file mode 100644 index 0000000..c1f67d0 --- /dev/null +++ b/lib/test/flow/dynamic_import/migrated_0003.js @@ -0,0 +1 @@ +import("dsa").then(); diff --git a/lib/test/flow/dynamic_import/migrated_0003.tree.json b/lib/test/flow/dynamic_import/migrated_0003.tree.json new file mode 100644 index 0000000..8062bff --- /dev/null +++ b/lib/test/flow/dynamic_import/migrated_0003.tree.json @@ -0,0 +1,47 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "callee":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "object":{ + "type":"ImportExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, + "range":[7,12], + "value":"dsa", + "raw":"\"dsa\"" + } + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":18}}, + "range":[14,18], + "name":"then", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "typeArguments":null, + "arguments":[] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/dynamic_import/migrated_0004.js b/lib/test/flow/dynamic_import/migrated_0004.js new file mode 100644 index 0000000..2f44562 --- /dev/null +++ b/lib/test/flow/dynamic_import/migrated_0004.js @@ -0,0 +1 @@ +{ import("dsa").then(); } diff --git a/lib/test/flow/dynamic_import/migrated_0004.tree.json b/lib/test/flow/dynamic_import/migrated_0004.tree.json new file mode 100644 index 0000000..22dbfed --- /dev/null +++ b/lib/test/flow/dynamic_import/migrated_0004.tree.json @@ -0,0 +1,54 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "body":[ + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":23}}, + "range":[2,23], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":22}}, + "range":[2,22], + "callee":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":20}}, + "range":[2,20], + "object":{ + "type":"ImportExpression", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":15}}, + "range":[2,15], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "range":[9,14], + "value":"dsa", + "raw":"\"dsa\"" + } + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":20}}, + "range":[16,20], + "name":"then", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "typeArguments":null, + "arguments":[] + }, + "directive":null + } + ] + } + ], + "comments":[] +} diff --git a/lib/test/flow/dynamic_import/migrated_0005.js b/lib/test/flow/dynamic_import/migrated_0005.js new file mode 100644 index 0000000..9a0301d --- /dev/null +++ b/lib/test/flow/dynamic_import/migrated_0005.js @@ -0,0 +1 @@ +const a = import("asdf", nope); diff --git a/lib/test/flow/dynamic_import/migrated_0005.tree.json b/lib/test/flow/dynamic_import/migrated_0005.tree.json new file mode 100644 index 0000000..0af7122 --- /dev/null +++ b/lib/test/flow/dynamic_import/migrated_0005.tree.json @@ -0,0 +1,78 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, + "message":"Unexpected token `,`, expected the token `)`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":29}}, + "message":"Unexpected identifier, expected the token `;`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, + "message":"Unexpected token `)`, expected the end of an expression statement (`;`)" + }, + { + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, + "message":"Unexpected token `)`, expected the start of a statement" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":24}}, + "range":[6,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ImportExpression", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":24}}, + "range":[10,24], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":23}}, + "range":[17,23], + "value":"asdf", + "raw":"\"asdf\"" + } + } + } + ], + "kind":"const" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":29}}, + "range":[25,29], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":29}}, + "range":[25,29], + "name":"nope", + "typeAnnotation":null, + "optional":false + }, + "directive":null + }, + { + "type":"EmptyStatement", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":31}}, + "range":[30,31] + } + ], + "comments":[] +} diff --git a/lib/test/flow/dynamic_import/migrated_0006.js b/lib/test/flow/dynamic_import/migrated_0006.js new file mode 100644 index 0000000..768334d --- /dev/null +++ b/lib/test/flow/dynamic_import/migrated_0006.js @@ -0,0 +1 @@ +{ import "asdf"; } diff --git a/lib/test/flow/dynamic_import/migrated_0006.tree.json b/lib/test/flow/dynamic_import/migrated_0006.tree.json new file mode 100644 index 0000000..586f777 --- /dev/null +++ b/lib/test/flow/dynamic_import/migrated_0006.tree.json @@ -0,0 +1,47 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "message":"Unexpected string, expected the token `(`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "message":"Unexpected token `;`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "message":"Unexpected token `;`, expected the token `)`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "body":[ + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":16}}, + "range":[2,16], + "expression":{ + "type":"ImportExpression", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":16}}, + "range":[2,16], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "value":null, + "raw":"null" + } + }, + "directive":null + } + ] + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-boolean-member-not-initialized-explicit.js b/lib/test/flow/enums/enum-boolean-member-not-initialized-explicit.js new file mode 100644 index 0000000..4fecb53 --- /dev/null +++ b/lib/test/flow/enums/enum-boolean-member-not-initialized-explicit.js @@ -0,0 +1,3 @@ +enum E of boolean { + A, +} diff --git a/lib/test/flow/enums/enum-boolean-member-not-initialized-explicit.options.json b/lib/test/flow/enums/enum-boolean-member-not-initialized-explicit.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-boolean-member-not-initialized-explicit.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-boolean-member-not-initialized-explicit.tree.json b/lib/test/flow/enums/enum-boolean-member-not-initialized-explicit.tree.json new file mode 100644 index 0000000..5a7c5ef --- /dev/null +++ b/lib/test/flow/enums/enum-boolean-member-not-initialized-explicit.tree.json @@ -0,0 +1,35 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "message":"Boolean enum members need to be initialized. Use either `A = true,` or `A = false,` in enum `E`." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,26], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,26], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumBooleanBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":3,"column":1}}, + "range":[7,26], + "members":[], + "explicitType":true, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-boolean-member-not-initialized-implicit.js b/lib/test/flow/enums/enum-boolean-member-not-initialized-implicit.js new file mode 100644 index 0000000..7370434 --- /dev/null +++ b/lib/test/flow/enums/enum-boolean-member-not-initialized-implicit.js @@ -0,0 +1,4 @@ +enum E { + A, + B = true, +} diff --git a/lib/test/flow/enums/enum-boolean-member-not-initialized-implicit.options.json b/lib/test/flow/enums/enum-boolean-member-not-initialized-implicit.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-boolean-member-not-initialized-implicit.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-boolean-member-not-initialized-implicit.tree.json b/lib/test/flow/enums/enum-boolean-member-not-initialized-implicit.tree.json new file mode 100644 index 0000000..1916aa2 --- /dev/null +++ b/lib/test/flow/enums/enum-boolean-member-not-initialized-implicit.tree.json @@ -0,0 +1,56 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "message":"Boolean enum members need to be initialized. Use either `A = true,` or `A = false,` in enum `E`." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,27], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,27], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumBooleanBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":4,"column":1}}, + "range":[7,27], + "members":[ + { + "type":"EnumBooleanMember", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":10}}, + "range":[16,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "range":[16,17], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":6},"end":{"line":3,"column":10}}, + "range":[20,24], + "value":true, + "raw":"true" + } + } + ], + "explicitType":false, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-duplicate-member-name.js b/lib/test/flow/enums/enum-duplicate-member-name.js new file mode 100644 index 0000000..c9fde50 --- /dev/null +++ b/lib/test/flow/enums/enum-duplicate-member-name.js @@ -0,0 +1,4 @@ +enum E { + A, + A, +} diff --git a/lib/test/flow/enums/enum-duplicate-member-name.options.json b/lib/test/flow/enums/enum-duplicate-member-name.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-duplicate-member-name.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-duplicate-member-name.tree.json b/lib/test/flow/enums/enum-duplicate-member-name.tree.json new file mode 100644 index 0000000..907d5a7 --- /dev/null +++ b/lib/test/flow/enums/enum-duplicate-member-name.tree.json @@ -0,0 +1,62 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "message":"Enum member names need to be unique, but the name `A` has already been used before in enum `E`." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,20], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,20], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":4,"column":1}}, + "range":[7,20], + "members":[ + { + "type":"EnumDefaultedMember", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[11,12], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[11,12], + "name":"A", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"EnumDefaultedMember", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "range":[16,17], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "range":[16,17], + "name":"A", + "typeAnnotation":null, + "optional":false + } + } + ], + "explicitType":false, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-end-of-file-after-member-name.js b/lib/test/flow/enums/enum-end-of-file-after-member-name.js new file mode 100644 index 0000000..f3198ae --- /dev/null +++ b/lib/test/flow/enums/enum-end-of-file-after-member-name.js @@ -0,0 +1,2 @@ +enum E { + A diff --git a/lib/test/flow/enums/enum-end-of-file-after-member-name.options.json b/lib/test/flow/enums/enum-end-of-file-after-member-name.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-end-of-file-after-member-name.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-end-of-file-after-member-name.tree.json b/lib/test/flow/enums/enum-end-of-file-after-member-name.tree.json new file mode 100644 index 0000000..f77549e --- /dev/null +++ b/lib/test/flow/enums/enum-end-of-file-after-member-name.tree.json @@ -0,0 +1,49 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":0}}, + "message":"Unexpected end of input, expected the token `}`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":0}}, + "range":[0,13], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":0}}, + "range":[0,13], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":3,"column":0}}, + "range":[7,13], + "members":[ + { + "type":"EnumDefaultedMember", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[11,12], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[11,12], + "name":"A", + "typeAnnotation":null, + "optional":false + } + } + ], + "explicitType":false, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-end-of-file.js b/lib/test/flow/enums/enum-end-of-file.js new file mode 100644 index 0000000..e3caefb --- /dev/null +++ b/lib/test/flow/enums/enum-end-of-file.js @@ -0,0 +1 @@ +enum diff --git a/lib/test/flow/enums/enum-end-of-file.options.json b/lib/test/flow/enums/enum-end-of-file.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-end-of-file.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-end-of-file.tree.json b/lib/test/flow/enums/enum-end-of-file.tree.json new file mode 100644 index 0000000..228b0a4 --- /dev/null +++ b/lib/test/flow/enums/enum-end-of-file.tree.json @@ -0,0 +1,43 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the token `{`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the token `}`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,5], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,5], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "range":[5,5], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "range":[5,5], + "members":[], + "explicitType":false, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-export.js b/lib/test/flow/enums/enum-export.js new file mode 100644 index 0000000..ebdc5a4 --- /dev/null +++ b/lib/test/flow/enums/enum-export.js @@ -0,0 +1,3 @@ +export enum A {} + +export default enum B {} diff --git a/lib/test/flow/enums/enum-export.options.json b/lib/test/flow/enums/enum-export.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-export.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-export.tree.json b/lib/test/flow/enums/enum-export.tree.json new file mode 100644 index 0000000..684ae42 --- /dev/null +++ b/lib/test/flow/enums/enum-export.tree.json @@ -0,0 +1,64 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":24}}, + "range":[0,42], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "declaration":{ + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":16}}, + "range":[7,16], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, + "range":[14,16], + "members":[], + "explicitType":false, + "hasUnknownMembers":false + } + }, + "specifiers":[], + "source":null, + "exportKind":"value" + }, + { + "type":"ExportDefaultDeclaration", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":24}}, + "range":[18,42], + "declaration":{ + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":3,"column":15},"end":{"line":3,"column":24}}, + "range":[33,42], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":20},"end":{"line":3,"column":21}}, + "range":[38,39], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":3,"column":22},"end":{"line":3,"column":24}}, + "range":[40,42], + "members":[], + "explicitType":false, + "hasUnknownMembers":false + } + }, + "exportKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-inconsistent-member-values-majority-defaulted.js b/lib/test/flow/enums/enum-inconsistent-member-values-majority-defaulted.js new file mode 100644 index 0000000..5a639f1 --- /dev/null +++ b/lib/test/flow/enums/enum-inconsistent-member-values-majority-defaulted.js @@ -0,0 +1,5 @@ +enum E { + A, + B, + C = 3, +} diff --git a/lib/test/flow/enums/enum-inconsistent-member-values-majority-defaulted.options.json b/lib/test/flow/enums/enum-inconsistent-member-values-majority-defaulted.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-inconsistent-member-values-majority-defaulted.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-inconsistent-member-values-majority-defaulted.tree.json b/lib/test/flow/enums/enum-inconsistent-member-values-majority-defaulted.tree.json new file mode 100644 index 0000000..b486af9 --- /dev/null +++ b/lib/test/flow/enums/enum-inconsistent-member-values-majority-defaulted.tree.json @@ -0,0 +1,35 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "message":"Enum `E` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "range":[0,29], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "range":[0,29], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":5,"column":1}}, + "range":[7,29], + "members":[], + "explicitType":false, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-inconsistent-member-values-mixed-initializers.js b/lib/test/flow/enums/enum-inconsistent-member-values-mixed-initializers.js new file mode 100644 index 0000000..b0b10ec --- /dev/null +++ b/lib/test/flow/enums/enum-inconsistent-member-values-mixed-initializers.js @@ -0,0 +1,4 @@ +enum E { + A = 1, + B = true, +} diff --git a/lib/test/flow/enums/enum-inconsistent-member-values-mixed-initializers.options.json b/lib/test/flow/enums/enum-inconsistent-member-values-mixed-initializers.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-inconsistent-member-values-mixed-initializers.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-inconsistent-member-values-mixed-initializers.tree.json b/lib/test/flow/enums/enum-inconsistent-member-values-mixed-initializers.tree.json new file mode 100644 index 0000000..0e267bb --- /dev/null +++ b/lib/test/flow/enums/enum-inconsistent-member-values-mixed-initializers.tree.json @@ -0,0 +1,35 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "message":"Enum `E` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,31], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":4,"column":1}}, + "range":[7,31], + "members":[], + "explicitType":false, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-invalid-explicit-type-expression.js b/lib/test/flow/enums/enum-invalid-explicit-type-expression.js new file mode 100644 index 0000000..e3353ef --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-explicit-type-expression.js @@ -0,0 +1,2 @@ +enum E of [] { +} diff --git a/lib/test/flow/enums/enum-invalid-explicit-type-expression.options.json b/lib/test/flow/enums/enum-invalid-explicit-type-expression.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-explicit-type-expression.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-invalid-explicit-type-expression.tree.json b/lib/test/flow/enums/enum-invalid-explicit-type-expression.tree.json new file mode 100644 index 0000000..bb7f2e3 --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-explicit-type-expression.tree.json @@ -0,0 +1,43 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "message":"Supplied enum type is not valid. Use one of `boolean`, `number`, `string`, or `symbol` in enum `E`." + }, + { + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "message":"Unexpected token `]`, expected the token `{`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "message":"Unexpected token `{`, expected an identifier" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, + "range":[0,16], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, + "range":[0,16], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":2,"column":1}}, + "range":[7,16], + "members":[], + "explicitType":false, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-invalid-explicit-type-identifier.js b/lib/test/flow/enums/enum-invalid-explicit-type-identifier.js new file mode 100644 index 0000000..25bbeb7 --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-explicit-type-identifier.js @@ -0,0 +1,2 @@ +enum E of xxx { +} diff --git a/lib/test/flow/enums/enum-invalid-explicit-type-identifier.options.json b/lib/test/flow/enums/enum-invalid-explicit-type-identifier.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-explicit-type-identifier.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-invalid-explicit-type-identifier.tree.json b/lib/test/flow/enums/enum-invalid-explicit-type-identifier.tree.json new file mode 100644 index 0000000..5953e35 --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-explicit-type-identifier.tree.json @@ -0,0 +1,35 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, + "message":"Enum type `xxx` is not valid. Use one of `boolean`, `number`, `string`, or `symbol` in enum `E`." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, + "range":[0,17], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, + "range":[0,17], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":2,"column":1}}, + "range":[7,17], + "members":[], + "explicitType":false, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-invalid-export.js b/lib/test/flow/enums/enum-invalid-export.js new file mode 100644 index 0000000..5c351dd --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-export.js @@ -0,0 +1,4 @@ +export type enum Foo { + A, + B, +} diff --git a/lib/test/flow/enums/enum-invalid-export.options.json b/lib/test/flow/enums/enum-invalid-export.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-export.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-invalid-export.tree.json b/lib/test/flow/enums/enum-invalid-export.tree.json new file mode 100644 index 0000000..aea1438 --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-export.tree.json @@ -0,0 +1,71 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, + "message":"Cannot export an enum with `export type`, try `export enum E {}` or `module.exports = E;` instead." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,34], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "declaration":null, + "specifiers":[], + "source":null, + "exportKind":"type" + }, + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":4,"column":1}}, + "range":[12,34], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":4,"column":1}}, + "range":[21,34], + "members":[ + { + "type":"EnumDefaultedMember", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[25,26], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[25,26], + "name":"A", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"EnumDefaultedMember", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "range":[30,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "range":[30,31], + "name":"B", + "typeAnnotation":null, + "optional":false + } + } + ], + "explicitType":false, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-invalid-initializer-separator.js b/lib/test/flow/enums/enum-invalid-initializer-separator.js new file mode 100644 index 0000000..52048a8 --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-initializer-separator.js @@ -0,0 +1,3 @@ +enum E { + Foo: 1 +} diff --git a/lib/test/flow/enums/enum-invalid-initializer-separator.options.json b/lib/test/flow/enums/enum-invalid-initializer-separator.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-initializer-separator.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-invalid-initializer-separator.tree.json b/lib/test/flow/enums/enum-invalid-initializer-separator.tree.json new file mode 100644 index 0000000..9a4b5af --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-initializer-separator.tree.json @@ -0,0 +1,56 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":6}}, + "message":"Enum member names and initializers are separated with `=`. Replace `Foo:` with `Foo =`." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,19], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,19], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumNumberBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":3,"column":1}}, + "range":[7,19], + "members":[ + { + "type":"EnumNumberMember", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":8}}, + "range":[11,17], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "range":[11,14], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":8}}, + "range":[16,17], + "value":1, + "raw":"1" + } + } + ], + "explicitType":false, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-boolean-explicit-string.js b/lib/test/flow/enums/enum-invalid-member-initializer-boolean-explicit-string.js new file mode 100644 index 0000000..31e79ef --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-boolean-explicit-string.js @@ -0,0 +1,3 @@ +enum E of string { + A = true, +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-boolean-explicit-string.options.json b/lib/test/flow/enums/enum-invalid-member-initializer-boolean-explicit-string.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-boolean-explicit-string.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-boolean-explicit-string.tree.json b/lib/test/flow/enums/enum-invalid-member-initializer-boolean-explicit-string.tree.json new file mode 100644 index 0000000..3ffa35d --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-boolean-explicit-string.tree.json @@ -0,0 +1,35 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":10}}, + "message":"Enum `E` has type `string`, so the initializer of `A` needs to be a string literal." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,32], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,32], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":3,"column":1}}, + "range":[7,32], + "members":[], + "explicitType":true, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-boolean.js b/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-boolean.js new file mode 100644 index 0000000..d4f1afa --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-boolean.js @@ -0,0 +1,3 @@ +enum E of boolean { + A = 1 + 2, +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-boolean.options.json b/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-boolean.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-boolean.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-boolean.tree.json b/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-boolean.tree.json new file mode 100644 index 0000000..b919e31 --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-boolean.tree.json @@ -0,0 +1,43 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, + "message":"Enum `E` has type `boolean`, so the initializer of `A` needs to be a boolean literal." + }, + { + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "message":"Unexpected token `+`, expected the token `,`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, + "message":"Unexpected number, expected an identifier" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,34], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,34], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumBooleanBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":3,"column":1}}, + "range":[7,34], + "members":[], + "explicitType":true, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-number.js b/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-number.js new file mode 100644 index 0000000..a6f7ed2 --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-number.js @@ -0,0 +1,3 @@ +enum E of number { + A = 1 + 2, +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-number.options.json b/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-number.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-number.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-number.tree.json b/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-number.tree.json new file mode 100644 index 0000000..ba2524d --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-number.tree.json @@ -0,0 +1,43 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, + "message":"Enum `E` has type `number`, so the initializer of `A` needs to be a number literal." + }, + { + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "message":"Unexpected token `+`, expected the token `,`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, + "message":"Unexpected number, expected an identifier" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,33], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,33], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumNumberBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":3,"column":1}}, + "range":[7,33], + "members":[], + "explicitType":true, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-string.js b/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-string.js new file mode 100644 index 0000000..704efcf --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-string.js @@ -0,0 +1,3 @@ +enum E of string { + A = 1 + 2, +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-string.options.json b/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-string.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-string.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-string.tree.json b/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-string.tree.json new file mode 100644 index 0000000..bd37d5d --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-string.tree.json @@ -0,0 +1,43 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, + "message":"Enum `E` has type `string`, so the initializer of `A` needs to be a string literal." + }, + { + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "message":"Unexpected token `+`, expected the token `,`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, + "message":"Unexpected number, expected an identifier" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,33], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,33], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":3,"column":1}}, + "range":[7,33], + "members":[], + "explicitType":true, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-symbol.js b/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-symbol.js new file mode 100644 index 0000000..d4acb6d --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-symbol.js @@ -0,0 +1,3 @@ +enum E of symbol { + A = 1 + 2, +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-symbol.options.json b/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-symbol.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-symbol.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-symbol.tree.json b/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-symbol.tree.json new file mode 100644 index 0000000..ce1f6ab --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-expression-explicit-symbol.tree.json @@ -0,0 +1,42 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, + "message":"Symbol enum members cannot be initialized. Use `A,` in enum `E`." + }, + { + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "message":"Unexpected token `+`, expected the token `,`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, + "message":"Unexpected number, expected an identifier" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,33], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,33], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumSymbolBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":3,"column":1}}, + "range":[7,33], + "members":[], + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-expression-implicit.js b/lib/test/flow/enums/enum-invalid-member-initializer-expression-implicit.js new file mode 100644 index 0000000..bed31f7 --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-expression-implicit.js @@ -0,0 +1,3 @@ +enum E { + A = 1 + 2, +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-expression-implicit.options.json b/lib/test/flow/enums/enum-invalid-member-initializer-expression-implicit.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-expression-implicit.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-expression-implicit.tree.json b/lib/test/flow/enums/enum-invalid-member-initializer-expression-implicit.tree.json new file mode 100644 index 0000000..cadd06f --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-expression-implicit.tree.json @@ -0,0 +1,43 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, + "message":"The enum member initializer for `A` needs to be a literal (either a boolean, number, or string) in enum `E`." + }, + { + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "message":"Unexpected token `+`, expected the token `,`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, + "message":"Unexpected number, expected an identifier" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,23], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,23], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":3,"column":1}}, + "range":[7,23], + "members":[], + "explicitType":false, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-literal-explicit-symbol.js b/lib/test/flow/enums/enum-invalid-member-initializer-literal-explicit-symbol.js new file mode 100644 index 0000000..dc8429b --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-literal-explicit-symbol.js @@ -0,0 +1,3 @@ +enum E of symbol { + A = 1, +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-literal-explicit-symbol.options.json b/lib/test/flow/enums/enum-invalid-member-initializer-literal-explicit-symbol.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-literal-explicit-symbol.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-literal-explicit-symbol.tree.json b/lib/test/flow/enums/enum-invalid-member-initializer-literal-explicit-symbol.tree.json new file mode 100644 index 0000000..07d1999 --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-literal-explicit-symbol.tree.json @@ -0,0 +1,34 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, + "message":"Symbol enum members cannot be initialized. Use `A,` in enum `E`." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,29], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,29], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumSymbolBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":3,"column":1}}, + "range":[7,29], + "members":[], + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-number-explicit-boolean.js b/lib/test/flow/enums/enum-invalid-member-initializer-number-explicit-boolean.js new file mode 100644 index 0000000..81e1097 --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-number-explicit-boolean.js @@ -0,0 +1,3 @@ +enum E of boolean { + A = 1, +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-number-explicit-boolean.options.json b/lib/test/flow/enums/enum-invalid-member-initializer-number-explicit-boolean.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-number-explicit-boolean.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-number-explicit-boolean.tree.json b/lib/test/flow/enums/enum-invalid-member-initializer-number-explicit-boolean.tree.json new file mode 100644 index 0000000..3535792 --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-number-explicit-boolean.tree.json @@ -0,0 +1,35 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, + "message":"Enum `E` has type `boolean`, so the initializer of `A` needs to be a boolean literal." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,30], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumBooleanBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":3,"column":1}}, + "range":[7,30], + "members":[], + "explicitType":true, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-number-explicit-string.js b/lib/test/flow/enums/enum-invalid-member-initializer-number-explicit-string.js new file mode 100644 index 0000000..7089149 --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-number-explicit-string.js @@ -0,0 +1,3 @@ +enum E of string { + A = 1, +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-number-explicit-string.options.json b/lib/test/flow/enums/enum-invalid-member-initializer-number-explicit-string.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-number-explicit-string.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-number-explicit-string.tree.json b/lib/test/flow/enums/enum-invalid-member-initializer-number-explicit-string.tree.json new file mode 100644 index 0000000..81786b2 --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-number-explicit-string.tree.json @@ -0,0 +1,35 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, + "message":"Enum `E` has type `string`, so the initializer of `A` needs to be a string literal." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,29], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,29], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":3,"column":1}}, + "range":[7,29], + "members":[], + "explicitType":true, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-parenthesized.js b/lib/test/flow/enums/enum-invalid-member-initializer-parenthesized.js new file mode 100644 index 0000000..92cc201 --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-parenthesized.js @@ -0,0 +1,3 @@ +enum E { + A = (1), +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-parenthesized.options.json b/lib/test/flow/enums/enum-invalid-member-initializer-parenthesized.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-parenthesized.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-parenthesized.tree.json b/lib/test/flow/enums/enum-invalid-member-initializer-parenthesized.tree.json new file mode 100644 index 0000000..648d4b5 --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-parenthesized.tree.json @@ -0,0 +1,43 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, + "message":"The enum member initializer for `A` needs to be a literal (either a boolean, number, or string) in enum `E`." + }, + { + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":8}}, + "message":"Unexpected number, expected the token `,`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "message":"Unexpected token `)`, expected an identifier" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,21], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,21], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":3,"column":1}}, + "range":[7,21], + "members":[], + "explicitType":false, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-string-explicit-boolean.js b/lib/test/flow/enums/enum-invalid-member-initializer-string-explicit-boolean.js new file mode 100644 index 0000000..86674e7 --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-string-explicit-boolean.js @@ -0,0 +1,3 @@ +enum E of boolean { + A = "hi", +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-string-explicit-boolean.options.json b/lib/test/flow/enums/enum-invalid-member-initializer-string-explicit-boolean.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-string-explicit-boolean.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-string-explicit-boolean.tree.json b/lib/test/flow/enums/enum-invalid-member-initializer-string-explicit-boolean.tree.json new file mode 100644 index 0000000..4636b64 --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-string-explicit-boolean.tree.json @@ -0,0 +1,35 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":10}}, + "message":"Enum `E` has type `boolean`, so the initializer of `A` needs to be a boolean literal." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,33], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,33], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumBooleanBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":3,"column":1}}, + "range":[7,33], + "members":[], + "explicitType":true, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-string-explicit-number.js b/lib/test/flow/enums/enum-invalid-member-initializer-string-explicit-number.js new file mode 100644 index 0000000..5b0a793 --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-string-explicit-number.js @@ -0,0 +1,3 @@ +enum E of number { + A = "hi", +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-string-explicit-number.options.json b/lib/test/flow/enums/enum-invalid-member-initializer-string-explicit-number.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-string-explicit-number.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-invalid-member-initializer-string-explicit-number.tree.json b/lib/test/flow/enums/enum-invalid-member-initializer-string-explicit-number.tree.json new file mode 100644 index 0000000..bc6eb63 --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-initializer-string-explicit-number.tree.json @@ -0,0 +1,35 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":10}}, + "message":"Enum `E` has type `number`, so the initializer of `A` needs to be a number literal." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,32], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,32], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumNumberBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":3,"column":1}}, + "range":[7,32], + "members":[], + "explicitType":true, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-invalid-member-name.js b/lib/test/flow/enums/enum-invalid-member-name.js new file mode 100644 index 0000000..3604a85 --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-name.js @@ -0,0 +1,4 @@ +enum E { + foo, + bar, +} diff --git a/lib/test/flow/enums/enum-invalid-member-name.options.json b/lib/test/flow/enums/enum-invalid-member-name.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-name.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-invalid-member-name.tree.json b/lib/test/flow/enums/enum-invalid-member-name.tree.json new file mode 100644 index 0000000..d9280d9 --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-name.tree.json @@ -0,0 +1,66 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "message":"Enum member names cannot start with lowercase 'a' through 'z'. Instead of using `foo`, consider using `Foo`, in enum `E`." + }, + { + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":5}}, + "message":"Enum member names cannot start with lowercase 'a' through 'z'. Instead of using `bar`, consider using `Bar`, in enum `E`." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,24], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":4,"column":1}}, + "range":[7,24], + "members":[ + { + "type":"EnumDefaultedMember", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "range":[11,14], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "range":[11,14], + "name":"foo", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"EnumDefaultedMember", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":5}}, + "range":[18,21], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":5}}, + "range":[18,21], + "name":"bar", + "typeAnnotation":null, + "optional":false + } + } + ], + "explicitType":false, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-invalid-member-separator-no-initializer.js b/lib/test/flow/enums/enum-invalid-member-separator-no-initializer.js new file mode 100644 index 0000000..87c2b06 --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-separator-no-initializer.js @@ -0,0 +1,4 @@ +enum E { + Foo; + Bar +} diff --git a/lib/test/flow/enums/enum-invalid-member-separator-no-initializer.options.json b/lib/test/flow/enums/enum-invalid-member-separator-no-initializer.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-separator-no-initializer.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-invalid-member-separator-no-initializer.tree.json b/lib/test/flow/enums/enum-invalid-member-separator-no-initializer.tree.json new file mode 100644 index 0000000..ac486da --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-separator-no-initializer.tree.json @@ -0,0 +1,62 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":6}}, + "message":"Enum members are separated with `,`. Replace `;` with `,`." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,23], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,23], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":4,"column":1}}, + "range":[7,23], + "members":[ + { + "type":"EnumDefaultedMember", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "range":[11,14], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "range":[11,14], + "name":"Foo", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"EnumDefaultedMember", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":5}}, + "range":[18,21], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":5}}, + "range":[18,21], + "name":"Bar", + "typeAnnotation":null, + "optional":false + } + } + ], + "explicitType":false, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-invalid-member-separator-with-initializer.js b/lib/test/flow/enums/enum-invalid-member-separator-with-initializer.js new file mode 100644 index 0000000..ef2465d --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-separator-with-initializer.js @@ -0,0 +1,3 @@ +enum E { + Foo = 1; +} diff --git a/lib/test/flow/enums/enum-invalid-member-separator-with-initializer.options.json b/lib/test/flow/enums/enum-invalid-member-separator-with-initializer.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-separator-with-initializer.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-invalid-member-separator-with-initializer.tree.json b/lib/test/flow/enums/enum-invalid-member-separator-with-initializer.tree.json new file mode 100644 index 0000000..1a01164 --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-member-separator-with-initializer.tree.json @@ -0,0 +1,56 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, + "message":"Enum members are separated with `,`. Replace `;` with `,`." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,21], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,21], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumNumberBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":3,"column":1}}, + "range":[7,21], + "members":[ + { + "type":"EnumNumberMember", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "range":[11,18], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "range":[11,14], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "range":[17,18], + "value":1, + "raw":"1" + } + } + ], + "explicitType":false, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-invalid-unknown-members-trailing-comma.js b/lib/test/flow/enums/enum-invalid-unknown-members-trailing-comma.js new file mode 100644 index 0000000..b658782 --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-unknown-members-trailing-comma.js @@ -0,0 +1,4 @@ +enum E { + A, + ..., +} diff --git a/lib/test/flow/enums/enum-invalid-unknown-members-trailing-comma.options.json b/lib/test/flow/enums/enum-invalid-unknown-members-trailing-comma.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-unknown-members-trailing-comma.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-invalid-unknown-members-trailing-comma.tree.json b/lib/test/flow/enums/enum-invalid-unknown-members-trailing-comma.tree.json new file mode 100644 index 0000000..6a49e4c --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-unknown-members-trailing-comma.tree.json @@ -0,0 +1,49 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":5}}, + "message":"The `...` must come at the end of the enum body. Remove the trailing comma." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,22], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":4,"column":1}}, + "range":[7,22], + "members":[ + { + "type":"EnumDefaultedMember", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[11,12], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[11,12], + "name":"A", + "typeAnnotation":null, + "optional":false + } + } + ], + "explicitType":false, + "hasUnknownMembers":true + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-invalid-unknown-members.js b/lib/test/flow/enums/enum-invalid-unknown-members.js new file mode 100644 index 0000000..7aa998d --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-unknown-members.js @@ -0,0 +1,4 @@ +enum E { + ..., + A +} diff --git a/lib/test/flow/enums/enum-invalid-unknown-members.options.json b/lib/test/flow/enums/enum-invalid-unknown-members.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-unknown-members.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-invalid-unknown-members.tree.json b/lib/test/flow/enums/enum-invalid-unknown-members.tree.json new file mode 100644 index 0000000..2495224 --- /dev/null +++ b/lib/test/flow/enums/enum-invalid-unknown-members.tree.json @@ -0,0 +1,49 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "message":"The `...` must come after all enum members. Move it to the end of the enum body." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,21], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,21], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":4,"column":1}}, + "range":[7,21], + "members":[ + { + "type":"EnumDefaultedMember", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "range":[18,19], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "range":[18,19], + "name":"A", + "typeAnnotation":null, + "optional":false + } + } + ], + "explicitType":false, + "hasUnknownMembers":true + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-number-member-not-initialized-explicit.js b/lib/test/flow/enums/enum-number-member-not-initialized-explicit.js new file mode 100644 index 0000000..7f4f9cb --- /dev/null +++ b/lib/test/flow/enums/enum-number-member-not-initialized-explicit.js @@ -0,0 +1,3 @@ +enum E of number { + A, +} diff --git a/lib/test/flow/enums/enum-number-member-not-initialized-explicit.options.json b/lib/test/flow/enums/enum-number-member-not-initialized-explicit.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-number-member-not-initialized-explicit.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-number-member-not-initialized-explicit.tree.json b/lib/test/flow/enums/enum-number-member-not-initialized-explicit.tree.json new file mode 100644 index 0000000..9ce0196 --- /dev/null +++ b/lib/test/flow/enums/enum-number-member-not-initialized-explicit.tree.json @@ -0,0 +1,35 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "message":"Number enum members need to be initialized, e.g. `A = 1,` in enum `E`." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,25], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,25], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumNumberBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":3,"column":1}}, + "range":[7,25], + "members":[], + "explicitType":true, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-number-member-not-initialized-implicit.js b/lib/test/flow/enums/enum-number-member-not-initialized-implicit.js new file mode 100644 index 0000000..a435e44 --- /dev/null +++ b/lib/test/flow/enums/enum-number-member-not-initialized-implicit.js @@ -0,0 +1,4 @@ +enum E { + A, + B = 1, +} diff --git a/lib/test/flow/enums/enum-number-member-not-initialized-implicit.options.json b/lib/test/flow/enums/enum-number-member-not-initialized-implicit.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-number-member-not-initialized-implicit.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-number-member-not-initialized-implicit.tree.json b/lib/test/flow/enums/enum-number-member-not-initialized-implicit.tree.json new file mode 100644 index 0000000..23c81ae --- /dev/null +++ b/lib/test/flow/enums/enum-number-member-not-initialized-implicit.tree.json @@ -0,0 +1,56 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "message":"Number enum members need to be initialized, e.g. `A = 1,` in enum `E`." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,24], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumNumberBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":4,"column":1}}, + "range":[7,24], + "members":[ + { + "type":"EnumNumberMember", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":7}}, + "range":[16,21], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "range":[16,17], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":6},"end":{"line":3,"column":7}}, + "range":[20,21], + "value":1, + "raw":"1" + } + } + ], + "explicitType":false, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-option-off.js b/lib/test/flow/enums/enum-option-off.js new file mode 100644 index 0000000..b74648f --- /dev/null +++ b/lib/test/flow/enums/enum-option-off.js @@ -0,0 +1,4 @@ +enum E { + A, + B, +} diff --git a/lib/test/flow/enums/enum-option-off.options.json b/lib/test/flow/enums/enum-option-off.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-option-off.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-option-off.tree.json b/lib/test/flow/enums/enum-option-off.tree.json new file mode 100644 index 0000000..306b2ca --- /dev/null +++ b/lib/test/flow/enums/enum-option-off.tree.json @@ -0,0 +1,56 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,20], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,20], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":4,"column":1}}, + "range":[7,20], + "members":[ + { + "type":"EnumDefaultedMember", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[11,12], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[11,12], + "name":"A", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"EnumDefaultedMember", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "range":[16,17], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "range":[16,17], + "name":"B", + "typeAnnotation":null, + "optional":false + } + } + ], + "explicitType":false, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-reserved-word-enum-name.js b/lib/test/flow/enums/enum-reserved-word-enum-name.js new file mode 100644 index 0000000..95350db --- /dev/null +++ b/lib/test/flow/enums/enum-reserved-word-enum-name.js @@ -0,0 +1,2 @@ +enum class { +} diff --git a/lib/test/flow/enums/enum-reserved-word-enum-name.options.json b/lib/test/flow/enums/enum-reserved-word-enum-name.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-reserved-word-enum-name.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-reserved-word-enum-name.tree.json b/lib/test/flow/enums/enum-reserved-word-enum-name.tree.json new file mode 100644 index 0000000..b747cc4 --- /dev/null +++ b/lib/test/flow/enums/enum-reserved-word-enum-name.tree.json @@ -0,0 +1,35 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, + "message":"Unexpected token `class`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, + "range":[0,14], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, + "range":[0,14], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, + "range":[5,10], + "name":"class", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":2,"column":1}}, + "range":[11,14], + "members":[], + "explicitType":false, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-string-member-inconsistently-initialized-majority-defaulted.js b/lib/test/flow/enums/enum-string-member-inconsistently-initialized-majority-defaulted.js new file mode 100644 index 0000000..279605f --- /dev/null +++ b/lib/test/flow/enums/enum-string-member-inconsistently-initialized-majority-defaulted.js @@ -0,0 +1,5 @@ +enum E of string { + A = "a", + B, + C, +} diff --git a/lib/test/flow/enums/enum-string-member-inconsistently-initialized-majority-defaulted.options.json b/lib/test/flow/enums/enum-string-member-inconsistently-initialized-majority-defaulted.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-string-member-inconsistently-initialized-majority-defaulted.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-string-member-inconsistently-initialized-majority-defaulted.tree.json b/lib/test/flow/enums/enum-string-member-inconsistently-initialized-majority-defaulted.tree.json new file mode 100644 index 0000000..e98b044 --- /dev/null +++ b/lib/test/flow/enums/enum-string-member-inconsistently-initialized-majority-defaulted.tree.json @@ -0,0 +1,62 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "message":"String enum members need to consistently either all use initializers, or use no initializers, in enum E." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "range":[0,41], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "range":[0,41], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":5,"column":1}}, + "range":[7,41], + "members":[ + { + "type":"EnumDefaultedMember", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "range":[32,33], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "range":[32,33], + "name":"B", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"EnumDefaultedMember", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":3}}, + "range":[37,38], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":3}}, + "range":[37,38], + "name":"C", + "typeAnnotation":null, + "optional":false + } + } + ], + "explicitType":true, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-string-member-inconsistently-initialized-majority-initialized.js b/lib/test/flow/enums/enum-string-member-inconsistently-initialized-majority-initialized.js new file mode 100644 index 0000000..e8db50e --- /dev/null +++ b/lib/test/flow/enums/enum-string-member-inconsistently-initialized-majority-initialized.js @@ -0,0 +1,5 @@ +enum E of string { + A, + B = "b", + C = "c", +} diff --git a/lib/test/flow/enums/enum-string-member-inconsistently-initialized-majority-initialized.options.json b/lib/test/flow/enums/enum-string-member-inconsistently-initialized-majority-initialized.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-string-member-inconsistently-initialized-majority-initialized.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-string-member-inconsistently-initialized-majority-initialized.tree.json b/lib/test/flow/enums/enum-string-member-inconsistently-initialized-majority-initialized.tree.json new file mode 100644 index 0000000..22d0d0c --- /dev/null +++ b/lib/test/flow/enums/enum-string-member-inconsistently-initialized-majority-initialized.tree.json @@ -0,0 +1,76 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "message":"String enum members need to consistently either all use initializers, or use no initializers, in enum E." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "range":[0,47], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "range":[0,47], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":5,"column":1}}, + "range":[7,47], + "members":[ + { + "type":"EnumStringMember", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":9}}, + "range":[26,33], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "range":[26,27], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":6},"end":{"line":3,"column":9}}, + "range":[30,33], + "value":"b", + "raw":"\"b\"" + } + }, + { + "type":"EnumStringMember", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":9}}, + "range":[37,44], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":3}}, + "range":[37,38], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":4,"column":6},"end":{"line":4,"column":9}}, + "range":[41,44], + "value":"c", + "raw":"\"c\"" + } + } + ], + "explicitType":true, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-valid-boolean-explicit.js b/lib/test/flow/enums/enum-valid-boolean-explicit.js new file mode 100644 index 0000000..7b63f4e --- /dev/null +++ b/lib/test/flow/enums/enum-valid-boolean-explicit.js @@ -0,0 +1,4 @@ +enum E of boolean { + A = true, + B = false, +} diff --git a/lib/test/flow/enums/enum-valid-boolean-explicit.options.json b/lib/test/flow/enums/enum-valid-boolean-explicit.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-valid-boolean-explicit.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-valid-boolean-explicit.tree.json b/lib/test/flow/enums/enum-valid-boolean-explicit.tree.json new file mode 100644 index 0000000..6357e09 --- /dev/null +++ b/lib/test/flow/enums/enum-valid-boolean-explicit.tree.json @@ -0,0 +1,70 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,46], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,46], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumBooleanBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":4,"column":1}}, + "range":[7,46], + "members":[ + { + "type":"EnumBooleanMember", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":10}}, + "range":[22,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[22,23], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":10}}, + "range":[26,30], + "value":true, + "raw":"true" + } + }, + { + "type":"EnumBooleanMember", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":11}}, + "range":[34,43], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "range":[34,35], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":6},"end":{"line":3,"column":11}}, + "range":[38,43], + "value":false, + "raw":"false" + } + } + ], + "explicitType":true, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-valid-boolean-implicit.js b/lib/test/flow/enums/enum-valid-boolean-implicit.js new file mode 100644 index 0000000..6ab49ea --- /dev/null +++ b/lib/test/flow/enums/enum-valid-boolean-implicit.js @@ -0,0 +1,4 @@ +enum E { + A = true, + B = false, +} diff --git a/lib/test/flow/enums/enum-valid-boolean-implicit.options.json b/lib/test/flow/enums/enum-valid-boolean-implicit.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-valid-boolean-implicit.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-valid-boolean-implicit.tree.json b/lib/test/flow/enums/enum-valid-boolean-implicit.tree.json new file mode 100644 index 0000000..e3357ff --- /dev/null +++ b/lib/test/flow/enums/enum-valid-boolean-implicit.tree.json @@ -0,0 +1,70 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,35], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,35], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumBooleanBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":4,"column":1}}, + "range":[7,35], + "members":[ + { + "type":"EnumBooleanMember", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":10}}, + "range":[11,19], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[11,12], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":10}}, + "range":[15,19], + "value":true, + "raw":"true" + } + }, + { + "type":"EnumBooleanMember", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":11}}, + "range":[23,32], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "range":[23,24], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":6},"end":{"line":3,"column":11}}, + "range":[27,32], + "value":false, + "raw":"false" + } + } + ], + "explicitType":false, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-valid-empty.js b/lib/test/flow/enums/enum-valid-empty.js new file mode 100644 index 0000000..714f607 --- /dev/null +++ b/lib/test/flow/enums/enum-valid-empty.js @@ -0,0 +1 @@ +enum E { } diff --git a/lib/test/flow/enums/enum-valid-empty.options.json b/lib/test/flow/enums/enum-valid-empty.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-valid-empty.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-valid-empty.tree.json b/lib/test/flow/enums/enum-valid-empty.tree.json new file mode 100644 index 0000000..c3356a6 --- /dev/null +++ b/lib/test/flow/enums/enum-valid-empty.tree.json @@ -0,0 +1,29 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, + "range":[7,10], + "members":[], + "explicitType":false, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-valid-name.js b/lib/test/flow/enums/enum-valid-name.js new file mode 100644 index 0000000..8d05790 --- /dev/null +++ b/lib/test/flow/enums/enum-valid-name.js @@ -0,0 +1,2 @@ +enum type { +} diff --git a/lib/test/flow/enums/enum-valid-name.options.json b/lib/test/flow/enums/enum-valid-name.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-valid-name.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-valid-name.tree.json b/lib/test/flow/enums/enum-valid-name.tree.json new file mode 100644 index 0000000..9e82c11 --- /dev/null +++ b/lib/test/flow/enums/enum-valid-name.tree.json @@ -0,0 +1,29 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, + "range":[0,13], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":1}}, + "range":[0,13], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":9}}, + "range":[5,9], + "name":"type", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":2,"column":1}}, + "range":[10,13], + "members":[], + "explicitType":false, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-valid-no-trailing-comma.js b/lib/test/flow/enums/enum-valid-no-trailing-comma.js new file mode 100644 index 0000000..228a928 --- /dev/null +++ b/lib/test/flow/enums/enum-valid-no-trailing-comma.js @@ -0,0 +1,3 @@ +enum E { + A +} diff --git a/lib/test/flow/enums/enum-valid-no-trailing-comma.options.json b/lib/test/flow/enums/enum-valid-no-trailing-comma.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-valid-no-trailing-comma.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-valid-no-trailing-comma.tree.json b/lib/test/flow/enums/enum-valid-no-trailing-comma.tree.json new file mode 100644 index 0000000..f689da3 --- /dev/null +++ b/lib/test/flow/enums/enum-valid-no-trailing-comma.tree.json @@ -0,0 +1,43 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,14], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,14], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":3,"column":1}}, + "range":[7,14], + "members":[ + { + "type":"EnumDefaultedMember", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[11,12], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[11,12], + "name":"A", + "typeAnnotation":null, + "optional":false + } + } + ], + "explicitType":false, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-valid-number-explicit.js b/lib/test/flow/enums/enum-valid-number-explicit.js new file mode 100644 index 0000000..f597c58 --- /dev/null +++ b/lib/test/flow/enums/enum-valid-number-explicit.js @@ -0,0 +1,4 @@ +enum E of number { + A = 1, + B = 2, +} diff --git a/lib/test/flow/enums/enum-valid-number-explicit.options.json b/lib/test/flow/enums/enum-valid-number-explicit.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-valid-number-explicit.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-valid-number-explicit.tree.json b/lib/test/flow/enums/enum-valid-number-explicit.tree.json new file mode 100644 index 0000000..d8ef868 --- /dev/null +++ b/lib/test/flow/enums/enum-valid-number-explicit.tree.json @@ -0,0 +1,70 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,38], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,38], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumNumberBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":4,"column":1}}, + "range":[7,38], + "members":[ + { + "type":"EnumNumberMember", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":7}}, + "range":[21,26], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[21,22], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, + "range":[25,26], + "value":1, + "raw":"1" + } + }, + { + "type":"EnumNumberMember", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":7}}, + "range":[30,35], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "range":[30,31], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":6},"end":{"line":3,"column":7}}, + "range":[34,35], + "value":2, + "raw":"2" + } + } + ], + "explicitType":true, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-valid-number-implicit.js b/lib/test/flow/enums/enum-valid-number-implicit.js new file mode 100644 index 0000000..29b4595 --- /dev/null +++ b/lib/test/flow/enums/enum-valid-number-implicit.js @@ -0,0 +1,4 @@ +enum E { + A = 0, + B = 1, +} diff --git a/lib/test/flow/enums/enum-valid-number-implicit.options.json b/lib/test/flow/enums/enum-valid-number-implicit.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-valid-number-implicit.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-valid-number-implicit.tree.json b/lib/test/flow/enums/enum-valid-number-implicit.tree.json new file mode 100644 index 0000000..cbbe1ae --- /dev/null +++ b/lib/test/flow/enums/enum-valid-number-implicit.tree.json @@ -0,0 +1,70 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,28], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,28], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumNumberBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":4,"column":1}}, + "range":[7,28], + "members":[ + { + "type":"EnumNumberMember", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":7}}, + "range":[11,16], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[11,12], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, + "range":[15,16], + "value":0, + "raw":"0" + } + }, + { + "type":"EnumNumberMember", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":7}}, + "range":[20,25], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "range":[20,21], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":6},"end":{"line":3,"column":7}}, + "range":[24,25], + "value":1, + "raw":"1" + } + } + ], + "explicitType":false, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-valid-string-explicit-defaulted.js b/lib/test/flow/enums/enum-valid-string-explicit-defaulted.js new file mode 100644 index 0000000..0d3f7fe --- /dev/null +++ b/lib/test/flow/enums/enum-valid-string-explicit-defaulted.js @@ -0,0 +1,4 @@ +enum E of string { + A, + B, +} diff --git a/lib/test/flow/enums/enum-valid-string-explicit-defaulted.options.json b/lib/test/flow/enums/enum-valid-string-explicit-defaulted.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-valid-string-explicit-defaulted.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-valid-string-explicit-defaulted.tree.json b/lib/test/flow/enums/enum-valid-string-explicit-defaulted.tree.json new file mode 100644 index 0000000..0e99d2a --- /dev/null +++ b/lib/test/flow/enums/enum-valid-string-explicit-defaulted.tree.json @@ -0,0 +1,56 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,30], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":4,"column":1}}, + "range":[7,30], + "members":[ + { + "type":"EnumDefaultedMember", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[21,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[21,22], + "name":"A", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"EnumDefaultedMember", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "range":[26,27], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "range":[26,27], + "name":"B", + "typeAnnotation":null, + "optional":false + } + } + ], + "explicitType":true, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-valid-string-explicit-initialized.js b/lib/test/flow/enums/enum-valid-string-explicit-initialized.js new file mode 100644 index 0000000..4d27120 --- /dev/null +++ b/lib/test/flow/enums/enum-valid-string-explicit-initialized.js @@ -0,0 +1,4 @@ +enum E of string { + A = "a", + B = "b", +} diff --git a/lib/test/flow/enums/enum-valid-string-explicit-initialized.options.json b/lib/test/flow/enums/enum-valid-string-explicit-initialized.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-valid-string-explicit-initialized.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-valid-string-explicit-initialized.tree.json b/lib/test/flow/enums/enum-valid-string-explicit-initialized.tree.json new file mode 100644 index 0000000..a672e6c --- /dev/null +++ b/lib/test/flow/enums/enum-valid-string-explicit-initialized.tree.json @@ -0,0 +1,70 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,42], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,42], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":4,"column":1}}, + "range":[7,42], + "members":[ + { + "type":"EnumStringMember", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "range":[21,28], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[21,22], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":9}}, + "range":[25,28], + "value":"a", + "raw":"\"a\"" + } + }, + { + "type":"EnumStringMember", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":9}}, + "range":[32,39], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "range":[32,33], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":6},"end":{"line":3,"column":9}}, + "range":[36,39], + "value":"b", + "raw":"\"b\"" + } + } + ], + "explicitType":true, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-valid-string-implicit-defaulted.js b/lib/test/flow/enums/enum-valid-string-implicit-defaulted.js new file mode 100644 index 0000000..b74648f --- /dev/null +++ b/lib/test/flow/enums/enum-valid-string-implicit-defaulted.js @@ -0,0 +1,4 @@ +enum E { + A, + B, +} diff --git a/lib/test/flow/enums/enum-valid-string-implicit-defaulted.options.json b/lib/test/flow/enums/enum-valid-string-implicit-defaulted.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-valid-string-implicit-defaulted.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-valid-string-implicit-defaulted.tree.json b/lib/test/flow/enums/enum-valid-string-implicit-defaulted.tree.json new file mode 100644 index 0000000..306b2ca --- /dev/null +++ b/lib/test/flow/enums/enum-valid-string-implicit-defaulted.tree.json @@ -0,0 +1,56 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,20], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,20], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":4,"column":1}}, + "range":[7,20], + "members":[ + { + "type":"EnumDefaultedMember", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[11,12], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[11,12], + "name":"A", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"EnumDefaultedMember", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "range":[16,17], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "range":[16,17], + "name":"B", + "typeAnnotation":null, + "optional":false + } + } + ], + "explicitType":false, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-valid-string-implicit-initialized.js b/lib/test/flow/enums/enum-valid-string-implicit-initialized.js new file mode 100644 index 0000000..d1b1c29 --- /dev/null +++ b/lib/test/flow/enums/enum-valid-string-implicit-initialized.js @@ -0,0 +1,4 @@ +enum E { + A = "a", + B = "b", +} diff --git a/lib/test/flow/enums/enum-valid-string-implicit-initialized.options.json b/lib/test/flow/enums/enum-valid-string-implicit-initialized.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-valid-string-implicit-initialized.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-valid-string-implicit-initialized.tree.json b/lib/test/flow/enums/enum-valid-string-implicit-initialized.tree.json new file mode 100644 index 0000000..74a222d --- /dev/null +++ b/lib/test/flow/enums/enum-valid-string-implicit-initialized.tree.json @@ -0,0 +1,70 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,32], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,32], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":4,"column":1}}, + "range":[7,32], + "members":[ + { + "type":"EnumStringMember", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "range":[11,18], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[11,12], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":9}}, + "range":[15,18], + "value":"a", + "raw":"\"a\"" + } + }, + { + "type":"EnumStringMember", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":9}}, + "range":[22,29], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "range":[22,23], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":6},"end":{"line":3,"column":9}}, + "range":[26,29], + "value":"b", + "raw":"\"b\"" + } + } + ], + "explicitType":false, + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-valid-symbol.js b/lib/test/flow/enums/enum-valid-symbol.js new file mode 100644 index 0000000..26e5377 --- /dev/null +++ b/lib/test/flow/enums/enum-valid-symbol.js @@ -0,0 +1,4 @@ +enum E of symbol { + A, + B, +} diff --git a/lib/test/flow/enums/enum-valid-symbol.options.json b/lib/test/flow/enums/enum-valid-symbol.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-valid-symbol.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-valid-symbol.tree.json b/lib/test/flow/enums/enum-valid-symbol.tree.json new file mode 100644 index 0000000..3a962f0 --- /dev/null +++ b/lib/test/flow/enums/enum-valid-symbol.tree.json @@ -0,0 +1,55 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,30], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumSymbolBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":4,"column":1}}, + "range":[7,30], + "members":[ + { + "type":"EnumDefaultedMember", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[21,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[21,22], + "name":"A", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"EnumDefaultedMember", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "range":[26,27], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "range":[26,27], + "name":"B", + "typeAnnotation":null, + "optional":false + } + } + ], + "hasUnknownMembers":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/enums/enum-valid-unknown-members.js b/lib/test/flow/enums/enum-valid-unknown-members.js new file mode 100644 index 0000000..9c95ac5 --- /dev/null +++ b/lib/test/flow/enums/enum-valid-unknown-members.js @@ -0,0 +1,8 @@ +enum E { + ... +} + +enum F { + A, + ... +} diff --git a/lib/test/flow/enums/enum-valid-unknown-members.options.json b/lib/test/flow/enums/enum-valid-unknown-members.options.json new file mode 100644 index 0000000..85dd67a --- /dev/null +++ b/lib/test/flow/enums/enum-valid-unknown-members.options.json @@ -0,0 +1,3 @@ +{ + "enums": true +} diff --git a/lib/test/flow/enums/enum-valid-unknown-members.tree.json b/lib/test/flow/enums/enum-valid-unknown-members.tree.json new file mode 100644 index 0000000..68b9cb1 --- /dev/null +++ b/lib/test/flow/enums/enum-valid-unknown-members.tree.json @@ -0,0 +1,64 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":8,"column":1}}, + "range":[0,39], + "body":[ + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,16], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":3,"column":1}}, + "range":[7,16], + "members":[], + "explicitType":false, + "hasUnknownMembers":true + } + }, + { + "type":"EnumDeclaration", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":8,"column":1}}, + "range":[18,39], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":5},"end":{"line":5,"column":6}}, + "range":[23,24], + "name":"F", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"EnumStringBody", + "loc":{"source":null,"start":{"line":5,"column":7},"end":{"line":8,"column":1}}, + "range":[25,39], + "members":[ + { + "type":"EnumDefaultedMember", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":3}}, + "range":[29,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":3}}, + "range":[29,30], + "name":"A", + "typeAnnotation":null, + "optional":false + } + } + ], + "explicitType":false, + "hasUnknownMembers":true + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/exponentiation/migrated_0000.js b/lib/test/flow/exponentiation/migrated_0000.js new file mode 100644 index 0000000..082389d --- /dev/null +++ b/lib/test/flow/exponentiation/migrated_0000.js @@ -0,0 +1 @@ +2 ** 3; diff --git a/lib/test/flow/exponentiation/migrated_0000.tree.json b/lib/test/flow/exponentiation/migrated_0000.tree.json new file mode 100644 index 0000000..c21d879 --- /dev/null +++ b/lib/test/flow/exponentiation/migrated_0000.tree.json @@ -0,0 +1,34 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "expression":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "operator":"**", + "left":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "value":2, + "raw":"2" + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "value":3, + "raw":"3" + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/exponentiation/migrated_0001.js b/lib/test/flow/exponentiation/migrated_0001.js new file mode 100644 index 0000000..ec9dde1 --- /dev/null +++ b/lib/test/flow/exponentiation/migrated_0001.js @@ -0,0 +1,2 @@ +// ** is right-associative: (1 + (2 ** (3 ** 4))) + 5 +1 + 2 ** 3 ** 4 + 5; diff --git a/lib/test/flow/exponentiation/migrated_0001.tree.json b/lib/test/flow/exponentiation/migrated_0001.tree.json new file mode 100644 index 0000000..efdfcd6 --- /dev/null +++ b/lib/test/flow/exponentiation/migrated_0001.tree.json @@ -0,0 +1,80 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":20}}, + "range":[54,74], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":20}}, + "range":[54,74], + "expression":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":19}}, + "range":[54,73], + "operator":"+", + "left":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":15}}, + "range":[54,69], + "operator":"+", + "left":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":1}}, + "range":[54,55], + "value":1, + "raw":"1" + }, + "right":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":15}}, + "range":[58,69], + "operator":"**", + "left":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":5}}, + "range":[58,59], + "value":2, + "raw":"2" + }, + "right":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":15}}, + "range":[63,69], + "operator":"**", + "left":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, + "range":[63,64], + "value":3, + "raw":"3" + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":15}}, + "range":[68,69], + "value":4, + "raw":"4" + } + } + } + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":18},"end":{"line":2,"column":19}}, + "range":[72,73], + "value":5, + "raw":"5" + } + }, + "directive":null + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "range":[0,53], + "value":" ** is right-associative: (1 + (2 ** (3 ** 4))) + 5" + } + ] +} diff --git a/lib/test/flow/exponentiation/migrated_0002.js b/lib/test/flow/exponentiation/migrated_0002.js new file mode 100644 index 0000000..402e87b --- /dev/null +++ b/lib/test/flow/exponentiation/migrated_0002.js @@ -0,0 +1 @@ +(-1) ** 2 diff --git a/lib/test/flow/exponentiation/migrated_0002.tree.json b/lib/test/flow/exponentiation/migrated_0002.tree.json new file mode 100644 index 0000000..578f352 --- /dev/null +++ b/lib/test/flow/exponentiation/migrated_0002.tree.json @@ -0,0 +1,41 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "range":[0,9], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "range":[0,9], + "expression":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "range":[0,9], + "operator":"**", + "left":{ + "type":"UnaryExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":3}}, + "range":[1,3], + "operator":"-", + "prefix":true, + "argument":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "range":[2,3], + "value":1, + "raw":"1" + } + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "value":2, + "raw":"2" + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/exponentiation/migrated_0003.js b/lib/test/flow/exponentiation/migrated_0003.js new file mode 100644 index 0000000..7fe15ed --- /dev/null +++ b/lib/test/flow/exponentiation/migrated_0003.js @@ -0,0 +1 @@ +-1 ** 2 diff --git a/lib/test/flow/exponentiation/migrated_0003.tree.json b/lib/test/flow/exponentiation/migrated_0003.tree.json new file mode 100644 index 0000000..891e85c --- /dev/null +++ b/lib/test/flow/exponentiation/migrated_0003.tree.json @@ -0,0 +1,47 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "message":"Invalid left-hand side in exponentiation expression" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "expression":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "operator":"**", + "left":{ + "type":"UnaryExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "range":[0,2], + "operator":"-", + "prefix":true, + "argument":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, + "range":[1,2], + "value":1, + "raw":"1" + } + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "value":2, + "raw":"2" + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/exponentiation/migrated_0004.js b/lib/test/flow/exponentiation/migrated_0004.js new file mode 100644 index 0000000..617595e --- /dev/null +++ b/lib/test/flow/exponentiation/migrated_0004.js @@ -0,0 +1 @@ +let x = 2; x **= 3; diff --git a/lib/test/flow/exponentiation/migrated_0004.tree.json b/lib/test/flow/exponentiation/migrated_0004.tree.json new file mode 100644 index 0000000..5326f65 --- /dev/null +++ b/lib/test/flow/exponentiation/migrated_0004.tree.json @@ -0,0 +1,63 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "range":[0,19], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, + "range":[4,9], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "value":2, + "raw":"2" + } + } + ], + "kind":"let" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":19}}, + "range":[11,19], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":18}}, + "range":[11,18], + "operator":"**=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "range":[17,18], + "value":3, + "raw":"3" + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/export_import_reserved_words/migrated_0000.js b/lib/test/flow/export_import_reserved_words/migrated_0000.js new file mode 100644 index 0000000..44a2a56 --- /dev/null +++ b/lib/test/flow/export_import_reserved_words/migrated_0000.js @@ -0,0 +1 @@ +export { default } from "foo" diff --git a/lib/test/flow/export_import_reserved_words/migrated_0000.tree.json b/lib/test/flow/export_import_reserved_words/migrated_0000.tree.json new file mode 100644 index 0000000..3561b11 --- /dev/null +++ b/lib/test/flow/export_import_reserved_words/migrated_0000.tree.json @@ -0,0 +1,45 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "name":"default", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "name":"default", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":29}}, + "range":[24,29], + "value":"foo", + "raw":"\"foo\"" + }, + "exportKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/export_import_reserved_words/migrated_0001.js b/lib/test/flow/export_import_reserved_words/migrated_0001.js new file mode 100644 index 0000000..86b22ce --- /dev/null +++ b/lib/test/flow/export_import_reserved_words/migrated_0001.js @@ -0,0 +1 @@ +export { default as foo } from "foo" diff --git a/lib/test/flow/export_import_reserved_words/migrated_0001.tree.json b/lib/test/flow/export_import_reserved_words/migrated_0001.tree.json new file mode 100644 index 0000000..d83f286 --- /dev/null +++ b/lib/test/flow/export_import_reserved_words/migrated_0001.tree.json @@ -0,0 +1,45 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":23}}, + "range":[9,23], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "name":"default", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":23}}, + "range":[20,23], + "name":"foo", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":36}}, + "range":[31,36], + "value":"foo", + "raw":"\"foo\"" + }, + "exportKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/export_import_reserved_words/migrated_0002.js b/lib/test/flow/export_import_reserved_words/migrated_0002.js new file mode 100644 index 0000000..5b81fde --- /dev/null +++ b/lib/test/flow/export_import_reserved_words/migrated_0002.js @@ -0,0 +1 @@ +export { foo as default } from "foo" diff --git a/lib/test/flow/export_import_reserved_words/migrated_0002.tree.json b/lib/test/flow/export_import_reserved_words/migrated_0002.tree.json new file mode 100644 index 0000000..c9358c3 --- /dev/null +++ b/lib/test/flow/export_import_reserved_words/migrated_0002.tree.json @@ -0,0 +1,45 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":23}}, + "range":[9,23], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":23}}, + "range":[16,23], + "name":"default", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":36}}, + "range":[31,36], + "value":"foo", + "raw":"\"foo\"" + }, + "exportKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/export_import_reserved_words/migrated_0003.js b/lib/test/flow/export_import_reserved_words/migrated_0003.js new file mode 100644 index 0000000..c49b9f8 --- /dev/null +++ b/lib/test/flow/export_import_reserved_words/migrated_0003.js @@ -0,0 +1 @@ +export { foo as default } diff --git a/lib/test/flow/export_import_reserved_words/migrated_0003.tree.json b/lib/test/flow/export_import_reserved_words/migrated_0003.tree.json new file mode 100644 index 0000000..dbad636 --- /dev/null +++ b/lib/test/flow/export_import_reserved_words/migrated_0003.tree.json @@ -0,0 +1,39 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":23}}, + "range":[9,23], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":23}}, + "range":[16,23], + "name":"default", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":null, + "exportKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/export_import_reserved_words/migrated_0004.js b/lib/test/flow/export_import_reserved_words/migrated_0004.js new file mode 100644 index 0000000..66fa694 --- /dev/null +++ b/lib/test/flow/export_import_reserved_words/migrated_0004.js @@ -0,0 +1 @@ +import { default as foo } from "foo" diff --git a/lib/test/flow/export_import_reserved_words/migrated_0004.tree.json b/lib/test/flow/export_import_reserved_words/migrated_0004.tree.json new file mode 100644 index 0000000..f11aa0f --- /dev/null +++ b/lib/test/flow/export_import_reserved_words/migrated_0004.tree.json @@ -0,0 +1,45 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":23}}, + "range":[9,23], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "name":"default", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":23}}, + "range":[20,23], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "importKind":null + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":36}}, + "range":[31,36], + "value":"foo", + "raw":"\"foo\"" + }, + "importKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/export_import_reserved_words/migrated_0005.js b/lib/test/flow/export_import_reserved_words/migrated_0005.js new file mode 100644 index 0000000..38748b7 --- /dev/null +++ b/lib/test/flow/export_import_reserved_words/migrated_0005.js @@ -0,0 +1 @@ +export { default } diff --git a/lib/test/flow/export_import_reserved_words/migrated_0005.tree.json b/lib/test/flow/export_import_reserved_words/migrated_0005.tree.json new file mode 100644 index 0000000..61e4129 --- /dev/null +++ b/lib/test/flow/export_import_reserved_words/migrated_0005.tree.json @@ -0,0 +1,45 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "message":"Unexpected token `default`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "name":"default", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "name":"default", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":null, + "exportKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/export_import_reserved_words/migrated_0006.js b/lib/test/flow/export_import_reserved_words/migrated_0006.js new file mode 100644 index 0000000..91fd02d --- /dev/null +++ b/lib/test/flow/export_import_reserved_words/migrated_0006.js @@ -0,0 +1 @@ +import { default } from "foo" diff --git a/lib/test/flow/export_import_reserved_words/migrated_0006.tree.json b/lib/test/flow/export_import_reserved_words/migrated_0006.tree.json new file mode 100644 index 0000000..d094365 --- /dev/null +++ b/lib/test/flow/export_import_reserved_words/migrated_0006.tree.json @@ -0,0 +1,51 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "message":"Unexpected token `default`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "name":"default", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "name":"default", + "typeAnnotation":null, + "optional":false + }, + "importKind":null + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":29}}, + "range":[24,29], + "value":"foo", + "raw":"\"foo\"" + }, + "importKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/export_import_reserved_words/migrated_0007.js b/lib/test/flow/export_import_reserved_words/migrated_0007.js new file mode 100644 index 0000000..76e6acd --- /dev/null +++ b/lib/test/flow/export_import_reserved_words/migrated_0007.js @@ -0,0 +1 @@ +import { foo as default } from "foo" diff --git a/lib/test/flow/export_import_reserved_words/migrated_0007.tree.json b/lib/test/flow/export_import_reserved_words/migrated_0007.tree.json new file mode 100644 index 0000000..3ae3ef6 --- /dev/null +++ b/lib/test/flow/export_import_reserved_words/migrated_0007.tree.json @@ -0,0 +1,51 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":23}}, + "message":"Unexpected token `default`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":23}}, + "range":[9,23], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":23}}, + "range":[16,23], + "name":"default", + "typeAnnotation":null, + "optional":false + }, + "importKind":null + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":36}}, + "range":[31,36], + "value":"foo", + "raw":"\"foo\"" + }, + "importKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/export_statements/export_default_async_expression.js b/lib/test/flow/export_statements/export_default_async_expression.js new file mode 100644 index 0000000..cbf2859 --- /dev/null +++ b/lib/test/flow/export_statements/export_default_async_expression.js @@ -0,0 +1 @@ +export default (async function f() {}) diff --git a/lib/test/flow/export_statements/export_default_async_expression.tree.json b/lib/test/flow/export_statements/export_default_async_expression.tree.json new file mode 100644 index 0000000..c3fd22d --- /dev/null +++ b/lib/test/flow/export_statements/export_default_async_expression.tree.json @@ -0,0 +1,40 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "body":[ + { + "type":"ExportDefaultDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "declaration":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":37}}, + "range":[16,37], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":32}}, + "range":[31,32], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":37}}, + "range":[35,37], + "body":[] + }, + "async":true, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "exportKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/export_statements/export_default_async_function.js b/lib/test/flow/export_statements/export_default_async_function.js new file mode 100644 index 0000000..da53d3b --- /dev/null +++ b/lib/test/flow/export_statements/export_default_async_function.js @@ -0,0 +1 @@ +export default async function () {} diff --git a/lib/test/flow/export_statements/export_default_async_function.tree.json b/lib/test/flow/export_statements/export_default_async_function.tree.json new file mode 100644 index 0000000..fefe71e --- /dev/null +++ b/lib/test/flow/export_statements/export_default_async_function.tree.json @@ -0,0 +1,33 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "body":[ + { + "type":"ExportDefaultDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "declaration":{ + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":35}}, + "range":[15,35], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":35}}, + "range":[33,35], + "body":[] + }, + "async":true, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "exportKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/export_statements/export_default_async_generator.js b/lib/test/flow/export_statements/export_default_async_generator.js new file mode 100644 index 0000000..11ba09b --- /dev/null +++ b/lib/test/flow/export_statements/export_default_async_generator.js @@ -0,0 +1 @@ +export default async function*() {} diff --git a/lib/test/flow/export_statements/export_default_async_generator.tree.json b/lib/test/flow/export_statements/export_default_async_generator.tree.json new file mode 100644 index 0000000..3fab11b --- /dev/null +++ b/lib/test/flow/export_statements/export_default_async_generator.tree.json @@ -0,0 +1,33 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "body":[ + { + "type":"ExportDefaultDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "declaration":{ + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":35}}, + "range":[15,35], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":35}}, + "range":[33,35], + "body":[] + }, + "async":true, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "exportKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/export_statements/export_default_async_id_and_function.js b/lib/test/flow/export_statements/export_default_async_id_and_function.js new file mode 100644 index 0000000..a75f41f --- /dev/null +++ b/lib/test/flow/export_statements/export_default_async_id_and_function.js @@ -0,0 +1,2 @@ +export default async +function() {} diff --git a/lib/test/flow/export_statements/export_default_async_id_and_function.tree.json b/lib/test/flow/export_statements/export_default_async_id_and_function.tree.json new file mode 100644 index 0000000..f6143b9 --- /dev/null +++ b/lib/test/flow/export_statements/export_default_async_id_and_function.tree.json @@ -0,0 +1,86 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "message":"Unexpected token `(`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, + "message":"Unexpected token `)`, expected the token `(`" + }, + { + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":0}}, + "message":"Unexpected end of input, expected the token `,`" + }, + { + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":0}}, + "message":"Rest parameter must be final parameter of an argument list" + }, + { + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":0}}, + "message":"Unexpected end of input, expected the token `)`" + }, + { + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":0}}, + "message":"Unexpected end of input, expected the token `{`" + }, + { + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":0}}, + "message":"Unexpected end of input, expected the token `}`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":0}}, + "range":[0,35], + "body":[ + { + "type":"ExportDefaultDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "declaration":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "range":[15,20], + "name":"async", + "typeAnnotation":null, + "optional":false + }, + "exportKind":"value" + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":3,"column":0}}, + "range":[21,35], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "range":[29,30], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":13}}, + "range":[32,34], + "properties":[], + "typeAnnotation":null + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":0}}, + "range":[35,35], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/export_statements/export_default_async_id_and_named_function.js b/lib/test/flow/export_statements/export_default_async_id_and_named_function.js new file mode 100644 index 0000000..77cebe0 --- /dev/null +++ b/lib/test/flow/export_statements/export_default_async_id_and_named_function.js @@ -0,0 +1,2 @@ +export default async +function foo() {} diff --git a/lib/test/flow/export_statements/export_default_async_id_and_named_function.tree.json b/lib/test/flow/export_statements/export_default_async_id_and_named_function.tree.json new file mode 100644 index 0000000..633037b --- /dev/null +++ b/lib/test/flow/export_statements/export_default_async_id_and_named_function.tree.json @@ -0,0 +1,48 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":17}}, + "range":[0,38], + "body":[ + { + "type":"ExportDefaultDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "declaration":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "range":[15,20], + "name":"async", + "typeAnnotation":null, + "optional":false + }, + "exportKind":"value" + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":17}}, + "range":[21,38], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":12}}, + "range":[30,33], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":15},"end":{"line":2,"column":17}}, + "range":[36,38], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/export_statements/export_default_async_named_function.js b/lib/test/flow/export_statements/export_default_async_named_function.js new file mode 100644 index 0000000..c40a5f2 --- /dev/null +++ b/lib/test/flow/export_statements/export_default_async_named_function.js @@ -0,0 +1 @@ +export default async function foo() {} diff --git a/lib/test/flow/export_statements/export_default_async_named_function.tree.json b/lib/test/flow/export_statements/export_default_async_named_function.tree.json new file mode 100644 index 0000000..72779ca --- /dev/null +++ b/lib/test/flow/export_statements/export_default_async_named_function.tree.json @@ -0,0 +1,40 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "body":[ + { + "type":"ExportDefaultDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "declaration":{ + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":38}}, + "range":[15,38], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":33}}, + "range":[30,33], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":38}}, + "range":[36,38], + "body":[] + }, + "async":true, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "exportKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/export_statements/export_default_async_named_generator.js b/lib/test/flow/export_statements/export_default_async_named_generator.js new file mode 100644 index 0000000..a4c99a0 --- /dev/null +++ b/lib/test/flow/export_statements/export_default_async_named_generator.js @@ -0,0 +1 @@ +export default async function* foo() {} diff --git a/lib/test/flow/export_statements/export_default_async_named_generator.tree.json b/lib/test/flow/export_statements/export_default_async_named_generator.tree.json new file mode 100644 index 0000000..50d703b --- /dev/null +++ b/lib/test/flow/export_statements/export_default_async_named_generator.tree.json @@ -0,0 +1,40 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "range":[0,39], + "body":[ + { + "type":"ExportDefaultDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "range":[0,39], + "declaration":{ + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":39}}, + "range":[15,39], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":34}}, + "range":[31,34], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":39}}, + "range":[37,39], + "body":[] + }, + "async":true, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "exportKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/export_statements/export_missing_comma.js b/lib/test/flow/export_statements/export_missing_comma.js new file mode 100644 index 0000000..a41d291 --- /dev/null +++ b/lib/test/flow/export_statements/export_missing_comma.js @@ -0,0 +1 @@ +export {x y} diff --git a/lib/test/flow/export_statements/export_missing_comma.tree.json b/lib/test/flow/export_statements/export_missing_comma.tree.json new file mode 100644 index 0000000..fd8044e --- /dev/null +++ b/lib/test/flow/export_statements/export_missing_comma.tree.json @@ -0,0 +1,66 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "message":"Missing comma between export specifiers" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "name":"x", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"y", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":null, + "exportKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/export_statements/export_trailing_comma.js b/lib/test/flow/export_statements/export_trailing_comma.js new file mode 100644 index 0000000..16fe5ea --- /dev/null +++ b/lib/test/flow/export_statements/export_trailing_comma.js @@ -0,0 +1 @@ +export {x,} diff --git a/lib/test/flow/export_statements/export_trailing_comma.tree.json b/lib/test/flow/export_statements/export_trailing_comma.tree.json new file mode 100644 index 0000000..30450c5 --- /dev/null +++ b/lib/test/flow/export_statements/export_trailing_comma.tree.json @@ -0,0 +1,39 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "name":"x", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":null, + "exportKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/expression/assignment/assign_declare.js b/lib/test/flow/expression/assignment/assign_declare.js new file mode 100644 index 0000000..05a38ce --- /dev/null +++ b/lib/test/flow/expression/assignment/assign_declare.js @@ -0,0 +1 @@ +declare = 42 diff --git a/lib/test/flow/expression/assignment/assign_declare.tree.json b/lib/test/flow/expression/assignment/assign_declare.tree.json new file mode 100644 index 0000000..c5eae44 --- /dev/null +++ b/lib/test/flow/expression/assignment/assign_declare.tree.json @@ -0,0 +1,35 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "operator":"=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "name":"declare", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, + "range":[10,12], + "value":42, + "raw":"42" + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/expression/assignment/assign_interface.js b/lib/test/flow/expression/assignment/assign_interface.js new file mode 100644 index 0000000..18ef6ce --- /dev/null +++ b/lib/test/flow/expression/assignment/assign_interface.js @@ -0,0 +1 @@ +interface = 42 diff --git a/lib/test/flow/expression/assignment/assign_interface.tree.json b/lib/test/flow/expression/assignment/assign_interface.tree.json new file mode 100644 index 0000000..56a98b9 --- /dev/null +++ b/lib/test/flow/expression/assignment/assign_interface.tree.json @@ -0,0 +1,35 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "operator":"=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "range":[0,9], + "name":"interface", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, + "range":[12,14], + "value":42, + "raw":"42" + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/expression/assignment/assign_of.js b/lib/test/flow/expression/assignment/assign_of.js new file mode 100644 index 0000000..f14c87d --- /dev/null +++ b/lib/test/flow/expression/assignment/assign_of.js @@ -0,0 +1 @@ +of = 42 diff --git a/lib/test/flow/expression/assignment/assign_of.tree.json b/lib/test/flow/expression/assignment/assign_of.tree.json new file mode 100644 index 0000000..e9ad768 --- /dev/null +++ b/lib/test/flow/expression/assignment/assign_of.tree.json @@ -0,0 +1,35 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "operator":"=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "range":[0,2], + "name":"of", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, + "range":[5,7], + "value":42, + "raw":"42" + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/expression/assignment/assign_type.js b/lib/test/flow/expression/assignment/assign_type.js new file mode 100644 index 0000000..dd212fe --- /dev/null +++ b/lib/test/flow/expression/assignment/assign_type.js @@ -0,0 +1 @@ +type = 42 diff --git a/lib/test/flow/expression/assignment/assign_type.tree.json b/lib/test/flow/expression/assignment/assign_type.tree.json new file mode 100644 index 0000000..f002cd7 --- /dev/null +++ b/lib/test/flow/expression/assignment/assign_type.tree.json @@ -0,0 +1,35 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "range":[0,9], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "range":[0,9], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "range":[0,9], + "operator":"=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "name":"type", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, + "range":[7,9], + "value":42, + "raw":"42" + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/expression/assignment/parens.js b/lib/test/flow/expression/assignment/parens.js new file mode 100644 index 0000000..7261c6e --- /dev/null +++ b/lib/test/flow/expression/assignment/parens.js @@ -0,0 +1 @@ +a=(1) diff --git a/lib/test/flow/expression/assignment/parens.tree.json b/lib/test/flow/expression/assignment/parens.tree.json new file mode 100644 index 0000000..6480026 --- /dev/null +++ b/lib/test/flow/expression/assignment/parens.tree.json @@ -0,0 +1,35 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "range":[0,5], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "range":[0,5], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "range":[0,5], + "operator":"=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":4}}, + "range":[3,4], + "value":1, + "raw":"1" + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/expression/binary-logical/and_on_lhs_of_or.js b/lib/test/flow/expression/binary-logical/and_on_lhs_of_or.js new file mode 100644 index 0000000..6f2cf96 --- /dev/null +++ b/lib/test/flow/expression/binary-logical/and_on_lhs_of_or.js @@ -0,0 +1 @@ +x && y || z diff --git a/lib/test/flow/expression/binary-logical/and_on_lhs_of_or.tree.json b/lib/test/flow/expression/binary-logical/and_on_lhs_of_or.tree.json new file mode 100644 index 0000000..8db6e07 --- /dev/null +++ b/lib/test/flow/expression/binary-logical/and_on_lhs_of_or.tree.json @@ -0,0 +1,50 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "expression":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "operator":"||", + "left":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "operator":"&&", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"y", + "typeAnnotation":null, + "optional":false + } + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"z", + "typeAnnotation":null, + "optional":false + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/expression/binary-logical/migrated_0000.js b/lib/test/flow/expression/binary-logical/migrated_0000.js new file mode 100644 index 0000000..2c4d180 --- /dev/null +++ b/lib/test/flow/expression/binary-logical/migrated_0000.js @@ -0,0 +1 @@ +(x || y) || z diff --git a/lib/test/flow/expression/binary-logical/migrated_0000.tree.json b/lib/test/flow/expression/binary-logical/migrated_0000.tree.json new file mode 100644 index 0000000..9efae01 --- /dev/null +++ b/lib/test/flow/expression/binary-logical/migrated_0000.tree.json @@ -0,0 +1,50 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "operator":"||", + "left":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, + "range":[1,7], + "operator":"||", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, + "range":[1,2], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"y", + "typeAnnotation":null, + "optional":false + } + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "name":"z", + "typeAnnotation":null, + "optional":false + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/expression/binary-logical/migrated_0001.js b/lib/test/flow/expression/binary-logical/migrated_0001.js new file mode 100644 index 0000000..be91f01 --- /dev/null +++ b/lib/test/flow/expression/binary-logical/migrated_0001.js @@ -0,0 +1 @@ +x || (y || z) diff --git a/lib/test/flow/expression/binary-logical/migrated_0001.tree.json b/lib/test/flow/expression/binary-logical/migrated_0001.tree.json new file mode 100644 index 0000000..41a1c5b --- /dev/null +++ b/lib/test/flow/expression/binary-logical/migrated_0001.tree.json @@ -0,0 +1,50 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "operator":"||", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, + "range":[6,12], + "operator":"||", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"z", + "typeAnnotation":null, + "optional":false + } + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/expression/binary-logical/migrated_0002.js b/lib/test/flow/expression/binary-logical/migrated_0002.js new file mode 100644 index 0000000..74a5d3c --- /dev/null +++ b/lib/test/flow/expression/binary-logical/migrated_0002.js @@ -0,0 +1 @@ +(x && y) || z diff --git a/lib/test/flow/expression/binary-logical/migrated_0002.tree.json b/lib/test/flow/expression/binary-logical/migrated_0002.tree.json new file mode 100644 index 0000000..cf5b9ee --- /dev/null +++ b/lib/test/flow/expression/binary-logical/migrated_0002.tree.json @@ -0,0 +1,50 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "operator":"||", + "left":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, + "range":[1,7], + "operator":"&&", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, + "range":[1,2], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"y", + "typeAnnotation":null, + "optional":false + } + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "name":"z", + "typeAnnotation":null, + "optional":false + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/expression/binary-logical/migrated_0003.js b/lib/test/flow/expression/binary-logical/migrated_0003.js new file mode 100644 index 0000000..f9cd71a --- /dev/null +++ b/lib/test/flow/expression/binary-logical/migrated_0003.js @@ -0,0 +1 @@ +x || (y && z) diff --git a/lib/test/flow/expression/binary-logical/migrated_0003.tree.json b/lib/test/flow/expression/binary-logical/migrated_0003.tree.json new file mode 100644 index 0000000..6ab2757 --- /dev/null +++ b/lib/test/flow/expression/binary-logical/migrated_0003.tree.json @@ -0,0 +1,50 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "operator":"||", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, + "range":[6,12], + "operator":"&&", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"z", + "typeAnnotation":null, + "optional":false + } + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/expression/binary-logical/migrated_0004.js b/lib/test/flow/expression/binary-logical/migrated_0004.js new file mode 100644 index 0000000..d9661cc --- /dev/null +++ b/lib/test/flow/expression/binary-logical/migrated_0004.js @@ -0,0 +1 @@ +(x || y) && z diff --git a/lib/test/flow/expression/binary-logical/migrated_0004.tree.json b/lib/test/flow/expression/binary-logical/migrated_0004.tree.json new file mode 100644 index 0000000..037d360 --- /dev/null +++ b/lib/test/flow/expression/binary-logical/migrated_0004.tree.json @@ -0,0 +1,50 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "operator":"&&", + "left":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, + "range":[1,7], + "operator":"||", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, + "range":[1,2], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"y", + "typeAnnotation":null, + "optional":false + } + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "name":"z", + "typeAnnotation":null, + "optional":false + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/expression/binary-logical/migrated_0005.js b/lib/test/flow/expression/binary-logical/migrated_0005.js new file mode 100644 index 0000000..6c446e8 --- /dev/null +++ b/lib/test/flow/expression/binary-logical/migrated_0005.js @@ -0,0 +1 @@ +x && (y || z) diff --git a/lib/test/flow/expression/binary-logical/migrated_0005.tree.json b/lib/test/flow/expression/binary-logical/migrated_0005.tree.json new file mode 100644 index 0000000..c273d56 --- /dev/null +++ b/lib/test/flow/expression/binary-logical/migrated_0005.tree.json @@ -0,0 +1,50 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "operator":"&&", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, + "range":[6,12], + "operator":"||", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"z", + "typeAnnotation":null, + "optional":false + } + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/expression/left-hand-side/type_property.js b/lib/test/flow/expression/left-hand-side/type_property.js new file mode 100644 index 0000000..f07f545 --- /dev/null +++ b/lib/test/flow/expression/left-hand-side/type_property.js @@ -0,0 +1 @@ +universe.type diff --git a/lib/test/flow/expression/left-hand-side/type_property.tree.json b/lib/test/flow/expression/left-hand-side/type_property.tree.json new file mode 100644 index 0000000..50f2b8a --- /dev/null +++ b/lib/test/flow/expression/left-hand-side/type_property.tree.json @@ -0,0 +1,36 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "range":[0,8], + "name":"universe", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, + "range":[9,13], + "name":"type", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/expression/sequence/parenthesized_left.js b/lib/test/flow/expression/sequence/parenthesized_left.js new file mode 100644 index 0000000..841a5e6 --- /dev/null +++ b/lib/test/flow/expression/sequence/parenthesized_left.js @@ -0,0 +1 @@ +(1), 2 diff --git a/lib/test/flow/expression/sequence/parenthesized_left.tree.json b/lib/test/flow/expression/sequence/parenthesized_left.tree.json new file mode 100644 index 0000000..a492c77 --- /dev/null +++ b/lib/test/flow/expression/sequence/parenthesized_left.tree.json @@ -0,0 +1,35 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "expression":{ + "type":"SequenceExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "expressions":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, + "range":[1,2], + "value":1, + "raw":"1" + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "value":2, + "raw":"2" + } + ] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/expression/sequence/parenthesized_right.js b/lib/test/flow/expression/sequence/parenthesized_right.js new file mode 100644 index 0000000..16cbd8e --- /dev/null +++ b/lib/test/flow/expression/sequence/parenthesized_right.js @@ -0,0 +1 @@ +1, (2) diff --git a/lib/test/flow/expression/sequence/parenthesized_right.tree.json b/lib/test/flow/expression/sequence/parenthesized_right.tree.json new file mode 100644 index 0000000..8197f76 --- /dev/null +++ b/lib/test/flow/expression/sequence/parenthesized_right.tree.json @@ -0,0 +1,35 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "expression":{ + "type":"SequenceExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "expressions":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "value":1, + "raw":"1" + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "value":2, + "raw":"2" + } + ] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/expression/unary/incr_with_parens.js b/lib/test/flow/expression/unary/incr_with_parens.js new file mode 100644 index 0000000..b0fe421 --- /dev/null +++ b/lib/test/flow/expression/unary/incr_with_parens.js @@ -0,0 +1 @@ +++(x) diff --git a/lib/test/flow/expression/unary/incr_with_parens.tree.json b/lib/test/flow/expression/unary/incr_with_parens.tree.json new file mode 100644 index 0000000..020a172 --- /dev/null +++ b/lib/test/flow/expression/unary/incr_with_parens.tree.json @@ -0,0 +1,29 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "range":[0,5], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "range":[0,5], + "expression":{ + "type":"UpdateExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "range":[0,5], + "operator":"++", + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":4}}, + "range":[3,4], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "prefix":true + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/expression/unary/not_with_parens.js b/lib/test/flow/expression/unary/not_with_parens.js new file mode 100644 index 0000000..c4a90db --- /dev/null +++ b/lib/test/flow/expression/unary/not_with_parens.js @@ -0,0 +1 @@ +!(x) diff --git a/lib/test/flow/expression/unary/not_with_parens.tree.json b/lib/test/flow/expression/unary/not_with_parens.tree.json new file mode 100644 index 0000000..8ebda24 --- /dev/null +++ b/lib/test/flow/expression/unary/not_with_parens.tree.json @@ -0,0 +1,29 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "expression":{ + "type":"UnaryExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "operator":"!", + "prefix":true, + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "range":[2,3], + "name":"x", + "typeAnnotation":null, + "optional":false + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/for_await_loops/migrated_0000.js b/lib/test/flow/for_await_loops/migrated_0000.js new file mode 100644 index 0000000..44650e1 --- /dev/null +++ b/lib/test/flow/for_await_loops/migrated_0000.js @@ -0,0 +1 @@ +for await (let x of e) {} diff --git a/lib/test/flow/for_await_loops/migrated_0000.tree.json b/lib/test/flow/for_await_loops/migrated_0000.tree.json new file mode 100644 index 0000000..b3a3917 --- /dev/null +++ b/lib/test/flow/for_await_loops/migrated_0000.tree.json @@ -0,0 +1,50 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, + "message":"Unexpected token `await`, expected the token `(`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "message":"Unexpected token `let`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "message":"Unexpected identifier, expected the token `)`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "body":[ + { + "type":"ForOfStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "range":[11,14], + "name":"let", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "name":"e", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, + "range":[23,25], + "body":[] + }, + "await":false + } + ], + "comments":[] +} diff --git a/lib/test/flow/for_await_loops/migrated_0001.js b/lib/test/flow/for_await_loops/migrated_0001.js new file mode 100644 index 0000000..3a8fc32 --- /dev/null +++ b/lib/test/flow/for_await_loops/migrated_0001.js @@ -0,0 +1 @@ +async () => { for await (let x of e) {} } diff --git a/lib/test/flow/for_await_loops/migrated_0001.tree.json b/lib/test/flow/for_await_loops/migrated_0001.tree.json new file mode 100644 index 0000000..96d604d --- /dev/null +++ b/lib/test/flow/for_await_loops/migrated_0001.tree.json @@ -0,0 +1,76 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "range":[0,41], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "range":[0,41], + "expression":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "range":[0,41], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":41}}, + "range":[12,41], + "body":[ + { + "type":"ForOfStatement", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":39}}, + "range":[14,39], + "left":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":30}}, + "range":[25,30], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, + "range":[29,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, + "range":[29,30], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":null + } + ], + "kind":"let" + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, + "range":[34,35], + "name":"e", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":39}}, + "range":[37,39], + "body":[] + }, + "await":true + } + ] + }, + "async":true, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/for_await_loops/migrated_0002.js b/lib/test/flow/for_await_loops/migrated_0002.js new file mode 100644 index 0000000..cdb4fb6 --- /dev/null +++ b/lib/test/flow/for_await_loops/migrated_0002.js @@ -0,0 +1 @@ +async () => { for await (let x in e) {} } diff --git a/lib/test/flow/for_await_loops/migrated_0002.tree.json b/lib/test/flow/for_await_loops/migrated_0002.tree.json new file mode 100644 index 0000000..cae8c1e --- /dev/null +++ b/lib/test/flow/for_await_loops/migrated_0002.tree.json @@ -0,0 +1,82 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":33}}, + "message":"Unexpected token `in`, expected the token `of`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "range":[0,41], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "range":[0,41], + "expression":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "range":[0,41], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":41}}, + "range":[12,41], + "body":[ + { + "type":"ForOfStatement", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":39}}, + "range":[14,39], + "left":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":30}}, + "range":[25,30], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, + "range":[29,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, + "range":[29,30], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":null + } + ], + "kind":"let" + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, + "range":[34,35], + "name":"e", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":39}}, + "range":[37,39], + "body":[] + }, + "await":true + } + ] + }, + "async":true, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/for_await_loops/migrated_0003.js b/lib/test/flow/for_await_loops/migrated_0003.js new file mode 100644 index 0000000..5f035aa --- /dev/null +++ b/lib/test/flow/for_await_loops/migrated_0003.js @@ -0,0 +1 @@ +async () => { for await (let i = 0; i < e; i++) {} } diff --git a/lib/test/flow/for_await_loops/migrated_0003.tree.json b/lib/test/flow/for_await_loops/migrated_0003.tree.json new file mode 100644 index 0000000..09652d9 --- /dev/null +++ b/lib/test/flow/for_await_loops/migrated_0003.tree.json @@ -0,0 +1,139 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":34}}, + "message":"Invalid left-hand side in for-of" + }, + { + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, + "message":"Unexpected token `;`, expected the token `of`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":42}}, + "message":"Unexpected token `;`, expected the token `)`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":46},"end":{"line":1,"column":47}}, + "message":"Unexpected token `)`, expected the end of an expression statement (`;`)" + }, + { + "loc":{"source":null,"start":{"line":1,"column":46},"end":{"line":1,"column":47}}, + "message":"Unexpected token `)`, expected the start of a statement" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, + "range":[0,52], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, + "range":[0,52], + "expression":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, + "range":[0,52], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":52}}, + "range":[12,52], + "body":[ + { + "type":"ForOfStatement", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":46}}, + "range":[14,46], + "left":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":34}}, + "range":[25,34], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":34}}, + "range":[29,34], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, + "range":[29,30], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":34}}, + "range":[33,34], + "value":0, + "raw":"0" + } + } + ], + "kind":"let" + }, + "right":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":41}}, + "range":[36,41], + "operator":"<", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":37}}, + "range":[36,37], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":40},"end":{"line":1,"column":41}}, + "range":[40,41], + "name":"e", + "typeAnnotation":null, + "optional":false + } + }, + "body":{ + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":43},"end":{"line":1,"column":46}}, + "range":[43,46], + "expression":{ + "type":"UpdateExpression", + "loc":{"source":null,"start":{"line":1,"column":43},"end":{"line":1,"column":46}}, + "range":[43,46], + "operator":"++", + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":43},"end":{"line":1,"column":44}}, + "range":[43,44], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "prefix":false + }, + "directive":null + }, + "await":true + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":48},"end":{"line":1,"column":50}}, + "range":[48,50], + "body":[] + } + ] + }, + "async":true, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/for_of_loops_invalid/migrated_0000.js b/lib/test/flow/for_of_loops_invalid/migrated_0000.js new file mode 100644 index 0000000..e9eb52f --- /dev/null +++ b/lib/test/flow/for_of_loops_invalid/migrated_0000.js @@ -0,0 +1 @@ +for (var x = 42 of list) process(x); diff --git a/lib/test/flow/for_of_loops_invalid/migrated_0000.tree.json b/lib/test/flow/for_of_loops_invalid/migrated_0000.tree.json new file mode 100644 index 0000000..c9d36ca --- /dev/null +++ b/lib/test/flow/for_of_loops_invalid/migrated_0000.tree.json @@ -0,0 +1,86 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":15}}, + "message":"Invalid left-hand side in for-of" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "body":[ + { + "type":"ForOfStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "left":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":15}}, + "range":[5,15], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "range":[9,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, + "range":[13,15], + "value":42, + "raw":"42" + } + } + ], + "kind":"var" + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":23}}, + "range":[19,23], + "name":"list", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":36}}, + "range":[25,36], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":35}}, + "range":[25,35], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":32}}, + "range":[25,32], + "name":"process", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":34}}, + "range":[33,34], + "name":"x", + "typeAnnotation":null, + "optional":false + } + ] + }, + "directive":null + }, + "await":false + } + ], + "comments":[] +} diff --git a/lib/test/flow/import_statements/migrated_0000.js b/lib/test/flow/import_statements/migrated_0000.js new file mode 100644 index 0000000..e0c0932 --- /dev/null +++ b/lib/test/flow/import_statements/migrated_0000.js @@ -0,0 +1 @@ +import {x,} from "MyModule"; diff --git a/lib/test/flow/import_statements/migrated_0000.tree.json b/lib/test/flow/import_statements/migrated_0000.tree.json new file mode 100644 index 0000000..7a2014a --- /dev/null +++ b/lib/test/flow/import_statements/migrated_0000.tree.json @@ -0,0 +1,45 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "importKind":null + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":27}}, + "range":[17,27], + "value":"MyModule", + "raw":"\"MyModule\"" + }, + "importKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/import_statements/migrated_0001.js b/lib/test/flow/import_statements/migrated_0001.js new file mode 100644 index 0000000..e88257e --- /dev/null +++ b/lib/test/flow/import_statements/migrated_0001.js @@ -0,0 +1 @@ +import defexp, {x,} from "MyModule"; diff --git a/lib/test/flow/import_statements/migrated_0001.tree.json b/lib/test/flow/import_statements/migrated_0001.tree.json new file mode 100644 index 0000000..a26851e --- /dev/null +++ b/lib/test/flow/import_statements/migrated_0001.tree.json @@ -0,0 +1,58 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "specifiers":[ + { + "type":"ImportDefaultSpecifier", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, + "range":[7,13], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, + "range":[7,13], + "name":"defexp", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "range":[16,17], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "range":[16,17], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "range":[16,17], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "importKind":null + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":35}}, + "range":[25,35], + "value":"MyModule", + "raw":"\"MyModule\"" + }, + "importKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/import_statements/migrated_0002.js b/lib/test/flow/import_statements/migrated_0002.js new file mode 100644 index 0000000..7c410e3 --- /dev/null +++ b/lib/test/flow/import_statements/migrated_0002.js @@ -0,0 +1 @@ +import {a nopeNeedsAPrecedingComma} from "MyModule"; diff --git a/lib/test/flow/import_statements/migrated_0002.tree.json b/lib/test/flow/import_statements/migrated_0002.tree.json new file mode 100644 index 0000000..399af0e --- /dev/null +++ b/lib/test/flow/import_statements/migrated_0002.tree.json @@ -0,0 +1,73 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":34}}, + "message":"Missing comma between import specifiers" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, + "range":[0,52], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, + "range":[0,52], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "importKind":null + }, + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":34}}, + "range":[10,34], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":34}}, + "range":[10,34], + "name":"nopeNeedsAPrecedingComma", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":34}}, + "range":[10,34], + "name":"nopeNeedsAPrecedingComma", + "typeAnnotation":null, + "optional":false + }, + "importKind":null + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":51}}, + "range":[41,51], + "value":"MyModule", + "raw":"\"MyModule\"" + }, + "importKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/import_statements/missing_as.js b/lib/test/flow/import_statements/missing_as.js new file mode 100644 index 0000000..ccac54f --- /dev/null +++ b/lib/test/flow/import_statements/missing_as.js @@ -0,0 +1,2 @@ +import * from 'bar'; +class X {} diff --git a/lib/test/flow/import_statements/missing_as.tree.json b/lib/test/flow/import_statements/missing_as.tree.json new file mode 100644 index 0000000..6ec9a2d --- /dev/null +++ b/lib/test/flow/import_statements/missing_as.tree.json @@ -0,0 +1,52 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, + "message":"Unexpected identifier, expected the keyword `as`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, + "range":[0,31], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "specifiers":[], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, + "range":[14,19], + "value":"bar", + "raw":"'bar'" + }, + "importKind":"value" + }, + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":10}}, + "range":[21,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, + "range":[27,28], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":10}}, + "range":[29,31], + "body":[] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/import_statements/missing_as_and_from.js b/lib/test/flow/import_statements/missing_as_and_from.js new file mode 100644 index 0000000..82ff8fb --- /dev/null +++ b/lib/test/flow/import_statements/missing_as_and_from.js @@ -0,0 +1,2 @@ +import * +class X {} diff --git a/lib/test/flow/import_statements/missing_as_and_from.tree.json b/lib/test/flow/import_statements/missing_as_and_from.tree.json new file mode 100644 index 0000000..bc8c0d8 --- /dev/null +++ b/lib/test/flow/import_statements/missing_as_and_from.tree.json @@ -0,0 +1,56 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":5}}, + "message":"Unexpected token `class`, expected the keyword `as`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":5}}, + "message":"Unexpected token `class`, expected the keyword `from`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, + "range":[0,19], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "range":[0,8], + "specifiers":[], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":8}}, + "range":[8,8], + "value":"", + "raw":"" + }, + "importKind":"value" + }, + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":10}}, + "range":[9,19], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, + "range":[15,16], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":10}}, + "range":[17,19], + "body":[] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/import_statements/missing_from.js b/lib/test/flow/import_statements/missing_from.js new file mode 100644 index 0000000..4e1fb7e --- /dev/null +++ b/lib/test/flow/import_statements/missing_from.js @@ -0,0 +1,2 @@ +import {x} +class X {} diff --git a/lib/test/flow/import_statements/missing_from.tree.json b/lib/test/flow/import_statements/missing_from.tree.json new file mode 100644 index 0000000..7ad53cf --- /dev/null +++ b/lib/test/flow/import_statements/missing_from.tree.json @@ -0,0 +1,75 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":5}}, + "message":"Unexpected token `class`, expected the keyword `from`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, + "range":[0,21], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "importKind":null + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":10}}, + "range":[10,10], + "value":"", + "raw":"" + }, + "importKind":"value" + }, + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":10}}, + "range":[11,21], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, + "range":[17,18], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":10}}, + "range":[19,21], + "body":[] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/import_statements/missing_source.js b/lib/test/flow/import_statements/missing_source.js new file mode 100644 index 0000000..924b045 --- /dev/null +++ b/lib/test/flow/import_statements/missing_source.js @@ -0,0 +1,2 @@ +import {x} from +class X {} diff --git a/lib/test/flow/import_statements/missing_source.tree.json b/lib/test/flow/import_statements/missing_source.tree.json new file mode 100644 index 0000000..17b129d --- /dev/null +++ b/lib/test/flow/import_statements/missing_source.tree.json @@ -0,0 +1,75 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":5}}, + "message":"Unexpected token `class`, expected a string" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":10}}, + "range":[0,26], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "importKind":null + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":15}}, + "range":[15,15], + "value":"", + "raw":"" + }, + "importKind":"value" + }, + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":10}}, + "range":[16,26], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, + "range":[22,23], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":10}}, + "range":[24,26], + "body":[] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/internal_slot/declare_class.js b/lib/test/flow/internal_slot/declare_class.js new file mode 100644 index 0000000..24dd359 --- /dev/null +++ b/lib/test/flow/internal_slot/declare_class.js @@ -0,0 +1 @@ +declare class C { [[foo]]: T } diff --git a/lib/test/flow/internal_slot/declare_class.tree.json b/lib/test/flow/internal_slot/declare_class.tree.json new file mode 100644 index 0000000..52472a8 --- /dev/null +++ b/lib/test/flow/internal_slot/declare_class.tree.json @@ -0,0 +1,66 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":30}}, + "range":[16,30], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[ + { + "type":"ObjectTypeInternalSlot", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":28}}, + "range":[18,28], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":23}}, + "range":[20,23], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "optional":false, + "static":false, + "method":false, + "value":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, + "range":[27,28], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, + "range":[27,28], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + ] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/internal_slot/declare_class_static.js b/lib/test/flow/internal_slot/declare_class_static.js new file mode 100644 index 0000000..9ae853a --- /dev/null +++ b/lib/test/flow/internal_slot/declare_class_static.js @@ -0,0 +1 @@ +declare class C { static [[foo]]: T } diff --git a/lib/test/flow/internal_slot/declare_class_static.tree.json b/lib/test/flow/internal_slot/declare_class_static.tree.json new file mode 100644 index 0000000..b767811 --- /dev/null +++ b/lib/test/flow/internal_slot/declare_class_static.tree.json @@ -0,0 +1,66 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "range":[0,37], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "range":[0,37], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":37}}, + "range":[16,37], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[ + { + "type":"ObjectTypeInternalSlot", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":35}}, + "range":[18,35], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":30}}, + "range":[27,30], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "optional":false, + "static":true, + "method":false, + "value":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, + "range":[34,35], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, + "range":[34,35], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + ] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/internal_slot/interface.js b/lib/test/flow/internal_slot/interface.js new file mode 100644 index 0000000..ce1d513 --- /dev/null +++ b/lib/test/flow/internal_slot/interface.js @@ -0,0 +1 @@ +interface T { [[foo]]: X } diff --git a/lib/test/flow/internal_slot/interface.tree.json b/lib/test/flow/internal_slot/interface.tree.json new file mode 100644 index 0000000..8961b4e --- /dev/null +++ b/lib/test/flow/internal_slot/interface.tree.json @@ -0,0 +1,64 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "body":[ + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":26}}, + "range":[12,26], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[ + { + "type":"ObjectTypeInternalSlot", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":24}}, + "range":[14,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":19}}, + "range":[16,19], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "optional":false, + "static":false, + "method":false, + "value":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, + "range":[23,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, + "range":[23,24], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + ] + }, + "extends":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/internal_slot/interface_method.js b/lib/test/flow/internal_slot/interface_method.js new file mode 100644 index 0000000..ce9f3e4 --- /dev/null +++ b/lib/test/flow/internal_slot/interface_method.js @@ -0,0 +1 @@ +interface T { [[foo]](): X } diff --git a/lib/test/flow/internal_slot/interface_method.tree.json b/lib/test/flow/internal_slot/interface_method.tree.json new file mode 100644 index 0000000..7e2d46d --- /dev/null +++ b/lib/test/flow/internal_slot/interface_method.tree.json @@ -0,0 +1,72 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "body":[ + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":28}}, + "range":[12,28], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[ + { + "type":"ObjectTypeInternalSlot", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":26}}, + "range":[14,26], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":19}}, + "range":[16,19], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "optional":false, + "static":false, + "method":true, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":26}}, + "range":[14,26], + "params":[], + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, + "range":[25,26], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, + "range":[25,26], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "rest":null, + "typeParameters":null + } + } + ] + }, + "extends":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/internal_slot/interface_variance.js b/lib/test/flow/internal_slot/interface_variance.js new file mode 100644 index 0000000..2c51c54 --- /dev/null +++ b/lib/test/flow/internal_slot/interface_variance.js @@ -0,0 +1 @@ +interface T { +[[foo]](): X } diff --git a/lib/test/flow/internal_slot/interface_variance.tree.json b/lib/test/flow/internal_slot/interface_variance.tree.json new file mode 100644 index 0000000..77938eb --- /dev/null +++ b/lib/test/flow/internal_slot/interface_variance.tree.json @@ -0,0 +1,78 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "message":"Unexpected variance sigil" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "body":[ + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":29}}, + "range":[12,29], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[ + { + "type":"ObjectTypeInternalSlot", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":27}}, + "range":[14,27], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "optional":false, + "static":false, + "method":true, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":27}}, + "range":[14,27], + "params":[], + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, + "range":[26,27], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, + "range":[26,27], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "rest":null, + "typeParameters":null + } + } + ] + }, + "extends":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/internal_slot/object.js b/lib/test/flow/internal_slot/object.js new file mode 100644 index 0000000..6601e90 --- /dev/null +++ b/lib/test/flow/internal_slot/object.js @@ -0,0 +1 @@ +type T = { [[foo]]: X } diff --git a/lib/test/flow/internal_slot/object.tree.json b/lib/test/flow/internal_slot/object.tree.json new file mode 100644 index 0000000..8e46960 --- /dev/null +++ b/lib/test/flow/internal_slot/object.tree.json @@ -0,0 +1,64 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":23}}, + "range":[9,23], + "exact":false, + "inexact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[ + { + "type":"ObjectTypeInternalSlot", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":21}}, + "range":[11,21], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, + "range":[13,16], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "optional":false, + "static":false, + "method":false, + "value":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + ] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/internal_slot/object_method.js b/lib/test/flow/internal_slot/object_method.js new file mode 100644 index 0000000..193e329 --- /dev/null +++ b/lib/test/flow/internal_slot/object_method.js @@ -0,0 +1 @@ +type T = { [[foo]](): X } diff --git a/lib/test/flow/internal_slot/object_method.tree.json b/lib/test/flow/internal_slot/object_method.tree.json new file mode 100644 index 0000000..c174055 --- /dev/null +++ b/lib/test/flow/internal_slot/object_method.tree.json @@ -0,0 +1,72 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":25}}, + "range":[9,25], + "exact":false, + "inexact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[ + { + "type":"ObjectTypeInternalSlot", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":23}}, + "range":[11,23], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, + "range":[13,16], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "optional":false, + "static":false, + "method":true, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":23}}, + "range":[11,23], + "params":[], + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, + "range":[22,23], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, + "range":[22,23], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "rest":null, + "typeParameters":null + } + } + ] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/internal_slot/object_optional.js b/lib/test/flow/internal_slot/object_optional.js new file mode 100644 index 0000000..a3361be --- /dev/null +++ b/lib/test/flow/internal_slot/object_optional.js @@ -0,0 +1 @@ +type T = { [[foo]]?: X } diff --git a/lib/test/flow/internal_slot/object_optional.tree.json b/lib/test/flow/internal_slot/object_optional.tree.json new file mode 100644 index 0000000..9535d81 --- /dev/null +++ b/lib/test/flow/internal_slot/object_optional.tree.json @@ -0,0 +1,64 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":24}}, + "range":[9,24], + "exact":false, + "inexact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[ + { + "type":"ObjectTypeInternalSlot", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":22}}, + "range":[11,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, + "range":[13,16], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "optional":true, + "static":false, + "method":false, + "value":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + ] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/internal_slot/object_variance.js b/lib/test/flow/internal_slot/object_variance.js new file mode 100644 index 0000000..a188b01 --- /dev/null +++ b/lib/test/flow/internal_slot/object_variance.js @@ -0,0 +1 @@ +type T = { +[[foo]]: X }; diff --git a/lib/test/flow/internal_slot/object_variance.tree.json b/lib/test/flow/internal_slot/object_variance.tree.json new file mode 100644 index 0000000..9d51f39 --- /dev/null +++ b/lib/test/flow/internal_slot/object_variance.tree.json @@ -0,0 +1,70 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "message":"Unexpected variance sigil" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":24}}, + "range":[9,24], + "exact":false, + "inexact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[ + { + "type":"ObjectTypeInternalSlot", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":22}}, + "range":[11,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, + "range":[14,17], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "optional":false, + "static":false, + "method":false, + "value":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + ] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/invalid_syntax/class_unexpected_identifier_before_body.js b/lib/test/flow/invalid_syntax/class_unexpected_identifier_before_body.js new file mode 100644 index 0000000..4d07ec5 --- /dev/null +++ b/lib/test/flow/invalid_syntax/class_unexpected_identifier_before_body.js @@ -0,0 +1,3 @@ +class X impl { + foo() {} +} diff --git a/lib/test/flow/invalid_syntax/class_unexpected_identifier_before_body.tree.json b/lib/test/flow/invalid_syntax/class_unexpected_identifier_before_body.tree.json new file mode 100644 index 0000000..d921264 --- /dev/null +++ b/lib/test/flow/invalid_syntax/class_unexpected_identifier_before_body.tree.json @@ -0,0 +1,94 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":12}}, + "message":"Unexpected identifier, expected the token `{`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "message":"Unexpected token `{`, expected the end of an expression statement (`;`)" + }, + { + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "message":"Unexpected token `{`, expected the end of an expression statement (`;`)" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,27], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":7}}, + "range":[8,7], + "body":[] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":12}}, + "range":[8,12], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":12}}, + "range":[8,12], + "name":"impl", + "typeAnnotation":null, + "optional":false + }, + "directive":null + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":3,"column":1}}, + "range":[13,27], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":7}}, + "range":[17,22], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":7}}, + "range":[17,22], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "range":[17,20], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[] + }, + "directive":null + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":10}}, + "range":[23,25], + "body":[] + } + ] + } + ], + "comments":[] +} diff --git a/lib/test/flow/invalid_syntax/migrated_0000.js b/lib/test/flow/invalid_syntax/migrated_0000.js new file mode 100644 index 0000000..fe18749 --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0000.js @@ -0,0 +1,3 @@ +// Duplicates are forbidden if IsSimpleParameterList is false, and rest +// params, patterns, and defaults all make the params non-simple +function a(t, t, ...rest) {} diff --git a/lib/test/flow/invalid_syntax/migrated_0000.tree.json b/lib/test/flow/invalid_syntax/migrated_0000.tree.json new file mode 100644 index 0000000..37fbb5d --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0000.tree.json @@ -0,0 +1,83 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":3,"column":14},"end":{"line":3,"column":15}}, + "message":"Strict mode function may not have duplicate parameter names" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":28}}, + "range":[137,165], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":28}}, + "range":[137,165], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":9},"end":{"line":3,"column":10}}, + "range":[146,147], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":11},"end":{"line":3,"column":12}}, + "range":[148,149], + "name":"t", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":14},"end":{"line":3,"column":15}}, + "range":[151,152], + "name":"t", + "typeAnnotation":null, + "optional":false + }, + { + "type":"RestElement", + "loc":{"source":null,"start":{"line":3,"column":17},"end":{"line":3,"column":24}}, + "range":[154,161], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":20},"end":{"line":3,"column":24}}, + "range":[157,161], + "name":"rest", + "typeAnnotation":null, + "optional":false + } + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":26},"end":{"line":3,"column":28}}, + "range":[163,165], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":71}}, + "range":[0,71], + "value":" Duplicates are forbidden if IsSimpleParameterList is false, and rest" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":64}}, + "range":[72,136], + "value":" params, patterns, and defaults all make the params non-simple" + } + ] +} diff --git a/lib/test/flow/invalid_syntax/migrated_0001.js b/lib/test/flow/invalid_syntax/migrated_0001.js new file mode 100644 index 0000000..6fef152 --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0001.js @@ -0,0 +1,3 @@ +// Duplicates are forbidden if IsSimpleParameterList is false, and rest +// params, patterns, and defaults all make the params non-simple +function a(t, t, [b]) {} diff --git a/lib/test/flow/invalid_syntax/migrated_0001.tree.json b/lib/test/flow/invalid_syntax/migrated_0001.tree.json new file mode 100644 index 0000000..70fbfbf --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0001.tree.json @@ -0,0 +1,86 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":3,"column":14},"end":{"line":3,"column":15}}, + "message":"Strict mode function may not have duplicate parameter names" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":24}}, + "range":[137,161], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":24}}, + "range":[137,161], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":9},"end":{"line":3,"column":10}}, + "range":[146,147], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":11},"end":{"line":3,"column":12}}, + "range":[148,149], + "name":"t", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":14},"end":{"line":3,"column":15}}, + "range":[151,152], + "name":"t", + "typeAnnotation":null, + "optional":false + }, + { + "type":"ArrayPattern", + "loc":{"source":null,"start":{"line":3,"column":17},"end":{"line":3,"column":20}}, + "range":[154,157], + "elements":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":18},"end":{"line":3,"column":19}}, + "range":[155,156], + "name":"b", + "typeAnnotation":null, + "optional":false + } + ], + "typeAnnotation":null + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":22},"end":{"line":3,"column":24}}, + "range":[159,161], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":71}}, + "range":[0,71], + "value":" Duplicates are forbidden if IsSimpleParameterList is false, and rest" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":64}}, + "range":[72,136], + "value":" params, patterns, and defaults all make the params non-simple" + } + ] +} diff --git a/lib/test/flow/invalid_syntax/migrated_0002.js b/lib/test/flow/invalid_syntax/migrated_0002.js new file mode 100644 index 0000000..898b019 --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0002.js @@ -0,0 +1,3 @@ +// Duplicates are forbidden if IsSimpleParameterList is false, and rest +// params, patterns, and defaults all make the params non-simple +function a(t, t, {b}) {} diff --git a/lib/test/flow/invalid_syntax/migrated_0002.tree.json b/lib/test/flow/invalid_syntax/migrated_0002.tree.json new file mode 100644 index 0000000..92c7a38 --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0002.tree.json @@ -0,0 +1,103 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":3,"column":14},"end":{"line":3,"column":15}}, + "message":"Strict mode function may not have duplicate parameter names" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":24}}, + "range":[137,161], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":24}}, + "range":[137,161], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":9},"end":{"line":3,"column":10}}, + "range":[146,147], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":11},"end":{"line":3,"column":12}}, + "range":[148,149], + "name":"t", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":14},"end":{"line":3,"column":15}}, + "range":[151,152], + "name":"t", + "typeAnnotation":null, + "optional":false + }, + { + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":3,"column":17},"end":{"line":3,"column":20}}, + "range":[154,157], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":3,"column":18},"end":{"line":3,"column":19}}, + "range":[155,156], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":18},"end":{"line":3,"column":19}}, + "range":[155,156], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":18},"end":{"line":3,"column":19}}, + "range":[155,156], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ], + "typeAnnotation":null + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":22},"end":{"line":3,"column":24}}, + "range":[159,161], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":71}}, + "range":[0,71], + "value":" Duplicates are forbidden if IsSimpleParameterList is false, and rest" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":64}}, + "range":[72,136], + "value":" params, patterns, and defaults all make the params non-simple" + } + ] +} diff --git a/lib/test/flow/invalid_syntax/migrated_0003.js b/lib/test/flow/invalid_syntax/migrated_0003.js new file mode 100644 index 0000000..b288701 --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0003.js @@ -0,0 +1,3 @@ +// Duplicates are forbidden if IsSimpleParameterList is false, and rest +// params, patterns, and defaults all make the params non-simple +function a(t, t, b=1) {} diff --git a/lib/test/flow/invalid_syntax/migrated_0003.tree.json b/lib/test/flow/invalid_syntax/migrated_0003.tree.json new file mode 100644 index 0000000..b94de85 --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0003.tree.json @@ -0,0 +1,90 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":3,"column":14},"end":{"line":3,"column":15}}, + "message":"Strict mode function may not have duplicate parameter names" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":24}}, + "range":[137,161], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":24}}, + "range":[137,161], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":9},"end":{"line":3,"column":10}}, + "range":[146,147], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":11},"end":{"line":3,"column":12}}, + "range":[148,149], + "name":"t", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":14},"end":{"line":3,"column":15}}, + "range":[151,152], + "name":"t", + "typeAnnotation":null, + "optional":false + }, + { + "type":"AssignmentPattern", + "loc":{"source":null,"start":{"line":3,"column":17},"end":{"line":3,"column":20}}, + "range":[154,157], + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":17},"end":{"line":3,"column":18}}, + "range":[154,155], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":19},"end":{"line":3,"column":20}}, + "range":[156,157], + "value":1, + "raw":"1" + } + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":22},"end":{"line":3,"column":24}}, + "range":[159,161], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":71}}, + "range":[0,71], + "value":" Duplicates are forbidden if IsSimpleParameterList is false, and rest" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":64}}, + "range":[72,136], + "value":" params, patterns, and defaults all make the params non-simple" + } + ] +} diff --git a/lib/test/flow/invalid_syntax/migrated_0004.js b/lib/test/flow/invalid_syntax/migrated_0004.js new file mode 100644 index 0000000..9952316 --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0004.js @@ -0,0 +1,3 @@ +// 11.9.1 +x +=>42 diff --git a/lib/test/flow/invalid_syntax/migrated_0004.tree.json b/lib/test/flow/invalid_syntax/migrated_0004.tree.json new file mode 100644 index 0000000..0b1bae5 --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0004.tree.json @@ -0,0 +1,56 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":2}}, + "message":"Illegal newline before arrow" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":3,"column":4}}, + "range":[10,16], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":3,"column":4}}, + "range":[10,16], + "expression":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":3,"column":4}}, + "range":[10,16], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":1}}, + "range":[10,11], + "name":"x", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":4}}, + "range":[14,16], + "value":42, + "raw":"42" + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":null, + "typeParameters":null + }, + "directive":null + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "range":[0,9], + "value":" 11.9.1" + } + ] +} diff --git a/lib/test/flow/invalid_syntax/migrated_0005.js b/lib/test/flow/invalid_syntax/migrated_0005.js new file mode 100644 index 0000000..3f26929 --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0005.js @@ -0,0 +1 @@ +[x, y] => 123 diff --git a/lib/test/flow/invalid_syntax/migrated_0005.tree.json b/lib/test/flow/invalid_syntax/migrated_0005.tree.json new file mode 100644 index 0000000..ec603ff --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0005.tree.json @@ -0,0 +1,60 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, + "message":"Unexpected token `=>`, expected the end of an expression statement (`;`)" + }, + { + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, + "message":"Unexpected token `=>`, expected the start of a statement" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "expression":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "elements":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, + "range":[1,2], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"y", + "typeAnnotation":null, + "optional":false + } + ] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, + "range":[10,13], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, + "range":[10,13], + "value":123, + "raw":"123" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/invalid_syntax/migrated_0006.js b/lib/test/flow/invalid_syntax/migrated_0006.js new file mode 100644 index 0000000..e03da79 --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0006.js @@ -0,0 +1 @@ +({a: x, b: y} => 123) diff --git a/lib/test/flow/invalid_syntax/migrated_0006.tree.json b/lib/test/flow/invalid_syntax/migrated_0006.tree.json new file mode 100644 index 0000000..e9e515c --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0006.tree.json @@ -0,0 +1,111 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, + "message":"Unexpected token `=>`, expected the token `)`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "message":"Unexpected number, expected the end of an expression statement (`;`)" + }, + { + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "message":"Unexpected token `)`, expected the end of an expression statement (`;`)" + }, + { + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "message":"Unexpected token `)`, expected the start of a statement" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the start of a statement" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,22], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "expression":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":13}}, + "range":[1,13], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":6}}, + "range":[2,6], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "range":[2,3], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":false, + "computed":false + }, + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":12}}, + "range":[8,12], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":false, + "computed":false + } + ] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "value":123, + "raw":"123" + }, + "directive":null + }, + { + "type":"EmptyStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "range":[22,22] + } + ], + "comments":[] +} diff --git a/lib/test/flow/invalid_syntax/migrated_0007.js b/lib/test/flow/invalid_syntax/migrated_0007.js new file mode 100644 index 0000000..7b5aa84 --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0007.js @@ -0,0 +1 @@ +try {} catch (-x) {} diff --git a/lib/test/flow/invalid_syntax/migrated_0007.tree.json b/lib/test/flow/invalid_syntax/migrated_0007.tree.json new file mode 100644 index 0000000..169e0f1 --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0007.tree.json @@ -0,0 +1,64 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "message":"Unexpected token `-`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "message":"Unexpected identifier, expected the token `)`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "message":"Unexpected token `)`, expected the token `{`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the token `}`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,21], + "body":[ + { + "type":"TryStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,21], + "block":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, + "range":[4,6], + "body":[] + }, + "handler":{ + "type":"CatchClause", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":2,"column":0}}, + "range":[7,21], + "param":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":2,"column":0}}, + "range":[16,21], + "body":[ + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, + "range":[18,20], + "body":[] + } + ] + } + }, + "finalizer":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/invalid_syntax/migrated_0008.js b/lib/test/flow/invalid_syntax/migrated_0008.js new file mode 100644 index 0000000..4667a13 --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0008.js @@ -0,0 +1 @@ +try {} catch (answer()) {} diff --git a/lib/test/flow/invalid_syntax/migrated_0008.tree.json b/lib/test/flow/invalid_syntax/migrated_0008.tree.json new file mode 100644 index 0000000..ed1e82d --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0008.tree.json @@ -0,0 +1,64 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "message":"Unexpected token `(`, expected the token `)`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "message":"Unexpected token `)`, expected the token `{`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, + "message":"Unexpected token `)`, expected the start of a statement" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the token `}`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,27], + "body":[ + { + "type":"TryStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,27], + "block":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, + "range":[4,6], + "body":[] + }, + "handler":{ + "type":"CatchClause", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":2,"column":0}}, + "range":[7,27], + "param":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":20}}, + "range":[14,20], + "name":"answer", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":2,"column":0}}, + "range":[21,27], + "body":[ + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, + "range":[24,26], + "body":[] + } + ] + } + }, + "finalizer":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/invalid_syntax/migrated_0009.js b/lib/test/flow/invalid_syntax/migrated_0009.js new file mode 100644 index 0000000..5b04136 --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0009.js @@ -0,0 +1 @@ +try {} catch (42) {} diff --git a/lib/test/flow/invalid_syntax/migrated_0009.tree.json b/lib/test/flow/invalid_syntax/migrated_0009.tree.json new file mode 100644 index 0000000..c7856a2 --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0009.tree.json @@ -0,0 +1,45 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, + "message":"Unexpected number, expected an identifier" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "body":[ + { + "type":"TryStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "block":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, + "range":[4,6], + "body":[] + }, + "handler":{ + "type":"CatchClause", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":20}}, + "range":[7,20], + "param":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, + "range":[14,16], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, + "range":[18,20], + "body":[] + } + }, + "finalizer":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/invalid_syntax/migrated_0010.js b/lib/test/flow/invalid_syntax/migrated_0010.js new file mode 100644 index 0000000..b07bc96 --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0010.js @@ -0,0 +1,2 @@ +// 11.8.5.1 no unicode as flags +var x = /[P QR]/\u0067 diff --git a/lib/test/flow/invalid_syntax/migrated_0010.tree.json b/lib/test/flow/invalid_syntax/migrated_0010.tree.json new file mode 100644 index 0000000..6c6644b --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0010.tree.json @@ -0,0 +1,64 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":22}}, + "message":"Unexpected identifier, expected the token `;`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":22}}, + "range":[32,54], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":16}}, + "range":[32,48], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":16}}, + "range":[36,48], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":5}}, + "range":[36,37], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":16}}, + "range":[40,48], + "value":null, + "raw":"/[P QR]/", + "regex":{"pattern":"[P QR]","flags":""} + } + } + ], + "kind":"var" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":22}}, + "range":[48,54], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":22}}, + "range":[48,54], + "name":"g", + "typeAnnotation":null, + "optional":false + }, + "directive":null + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "value":" 11.8.5.1 no unicode as flags" + } + ] +} diff --git a/lib/test/flow/invalid_syntax/migrated_0011.js b/lib/test/flow/invalid_syntax/migrated_0011.js new file mode 100644 index 0000000..a6e0f81 --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0011.js @@ -0,0 +1,2 @@ +// No generics for getters and setters +({ get foo() {} }) diff --git a/lib/test/flow/invalid_syntax/migrated_0011.tree.json b/lib/test/flow/invalid_syntax/migrated_0011.tree.json new file mode 100644 index 0000000..d7cddc1 --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0011.tree.json @@ -0,0 +1,99 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, + "message":"Unexpected token `<`, expected the token `(`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":13}}, + "message":"Unexpected token `>`, expected the token `,`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":14}}, + "message":"Unexpected token `(`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":10}}, + "message":"Getter should have zero parameters" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":21}}, + "range":[39,60], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":21}}, + "range":[39,60], + "expression":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":2,"column":1},"end":{"line":2,"column":20}}, + "range":[40,59], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":18}}, + "range":[42,57], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":10}}, + "range":[46,49], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":18}}, + "range":[49,57], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":12}}, + "range":[50,51], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":14}}, + "range":[52,53], + "name":"", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":18}}, + "range":[55,57], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"get", + "method":false, + "shorthand":false, + "computed":false + } + ] + }, + "directive":null + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "value":" No generics for getters and setters" + } + ] +} diff --git a/lib/test/flow/invalid_syntax/migrated_0012.js b/lib/test/flow/invalid_syntax/migrated_0012.js new file mode 100644 index 0000000..8113287 --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0012.js @@ -0,0 +1,2 @@ +// No generics for getters and setters +({ set foo(newFoo) {} }) diff --git a/lib/test/flow/invalid_syntax/migrated_0012.tree.json b/lib/test/flow/invalid_syntax/migrated_0012.tree.json new file mode 100644 index 0000000..5edb97f --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0012.tree.json @@ -0,0 +1,103 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, + "message":"Unexpected token `<`, expected the token `(`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":13}}, + "message":"Unexpected token `>`, expected the token `,`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":14}}, + "message":"Unexpected token `(`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":20}}, + "message":"Unexpected identifier, expected the token `,`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":10}}, + "message":"Setter should have exactly one parameter" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":27}}, + "range":[39,66], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":27}}, + "range":[39,66], + "expression":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":2,"column":1},"end":{"line":2,"column":26}}, + "range":[40,65], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":24}}, + "range":[42,63], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":10}}, + "range":[46,49], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":24}}, + "range":[49,63], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":12}}, + "range":[50,51], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":14}}, + "range":[52,53], + "name":"", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":22},"end":{"line":2,"column":24}}, + "range":[61,63], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"set", + "method":false, + "shorthand":false, + "computed":false + } + ] + }, + "directive":null + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "value":" No generics for getters and setters" + } + ] +} diff --git a/lib/test/flow/invalid_syntax/migrated_0013.js b/lib/test/flow/invalid_syntax/migrated_0013.js new file mode 100644 index 0000000..5913582 --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0013.js @@ -0,0 +1 @@ +1 + enum diff --git a/lib/test/flow/invalid_syntax/migrated_0013.tree.json b/lib/test/flow/invalid_syntax/migrated_0013.tree.json new file mode 100644 index 0000000..6c4150c --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0013.tree.json @@ -0,0 +1,41 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":8}}, + "message":"Unexpected reserved word" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "range":[0,8], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "range":[0,8], + "expression":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "range":[0,8], + "operator":"+", + "left":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "value":1, + "raw":"1" + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":8}}, + "range":[4,8], + "name":"enum", + "typeAnnotation":null, + "optional":false + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/invalid_syntax/migrated_0014.js b/lib/test/flow/invalid_syntax/migrated_0014.js new file mode 100644 index 0000000..d7608a9 --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0014.js @@ -0,0 +1 @@ +enum = 42 diff --git a/lib/test/flow/invalid_syntax/migrated_0014.tree.json b/lib/test/flow/invalid_syntax/migrated_0014.tree.json new file mode 100644 index 0000000..1311d6c --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0014.tree.json @@ -0,0 +1,41 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "message":"Unexpected reserved word" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "range":[0,9], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "range":[0,9], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "range":[0,9], + "operator":"=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "name":"enum", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, + "range":[7,9], + "value":42, + "raw":"42" + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/invalid_syntax/migrated_0015.js b/lib/test/flow/invalid_syntax/migrated_0015.js new file mode 100644 index 0000000..e7f0bd9 --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0015.js @@ -0,0 +1 @@ +var enum diff --git a/lib/test/flow/invalid_syntax/migrated_0015.tree.json b/lib/test/flow/invalid_syntax/migrated_0015.tree.json new file mode 100644 index 0000000..4bf81df --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0015.tree.json @@ -0,0 +1,36 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":8}}, + "message":"Unexpected reserved word" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "range":[0,8], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "range":[0,8], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":8}}, + "range":[4,8], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":8}}, + "range":[4,8], + "name":"enum", + "typeAnnotation":null, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/invalid_syntax/migrated_0016.js b/lib/test/flow/invalid_syntax/migrated_0016.js new file mode 100644 index 0000000..3f0378c --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0016.js @@ -0,0 +1 @@ +function hello() { "use strict"; var enum; } diff --git a/lib/test/flow/invalid_syntax/migrated_0016.tree.json b/lib/test/flow/invalid_syntax/migrated_0016.tree.json new file mode 100644 index 0000000..ce99369 --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0016.tree.json @@ -0,0 +1,76 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":41}}, + "message":"Unexpected reserved word" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, + "range":[0,44], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, + "range":[0,44], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "range":[9,14], + "name":"hello", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":44}}, + "range":[17,44], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "range":[19,32], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":31}}, + "range":[19,31], + "value":"use strict", + "raw":"\"use strict\"" + }, + "directive":"use strict" + }, + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":42}}, + "range":[33,42], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":41}}, + "range":[37,41], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":41}}, + "range":[37,41], + "name":"enum", + "typeAnnotation":null, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/invalid_syntax/migrated_0017.js b/lib/test/flow/invalid_syntax/migrated_0017.js new file mode 100644 index 0000000..ca1b081 --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0017.js @@ -0,0 +1 @@ +export type * "from" "foo" diff --git a/lib/test/flow/invalid_syntax/migrated_0017.tree.json b/lib/test/flow/invalid_syntax/migrated_0017.tree.json new file mode 100644 index 0000000..563f1c0 --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0017.tree.json @@ -0,0 +1,27 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":20}}, + "message":"Unexpected string, expected the identifier `from`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "body":[ + { + "type":"ExportAllDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":26}}, + "range":[21,26], + "value":"foo", + "raw":"\"foo\"" + }, + "exportKind":"type" + } + ], + "comments":[] +} diff --git a/lib/test/flow/invalid_syntax/migrated_0018.js b/lib/test/flow/invalid_syntax/migrated_0018.js new file mode 100644 index 0000000..3bf8503 --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0018.js @@ -0,0 +1 @@ +export type * as blah from "foo" diff --git a/lib/test/flow/invalid_syntax/migrated_0018.tree.json b/lib/test/flow/invalid_syntax/migrated_0018.tree.json new file mode 100644 index 0000000..7f5fc4a --- /dev/null +++ b/lib/test/flow/invalid_syntax/migrated_0018.tree.json @@ -0,0 +1,84 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, + "message":"Unexpected identifier, expected the identifier `from`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":21}}, + "message":"Unexpected identifier, expected a string" + }, + { + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":21}}, + "message":"Unexpected identifier, expected the token `;`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":26}}, + "message":"Unexpected identifier, expected the end of an expression statement (`;`)" + }, + { + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":32}}, + "message":"Unexpected string, expected the end of an expression statement (`;`)" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "body":[ + { + "type":"ExportAllDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":21}}, + "range":[17,21], + "value":"", + "raw":"" + }, + "exportKind":"type" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":21}}, + "range":[17,21], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":21}}, + "range":[17,21], + "name":"blah", + "typeAnnotation":null, + "optional":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":26}}, + "range":[22,26], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":26}}, + "range":[22,26], + "name":"from", + "typeAnnotation":null, + "optional":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":32}}, + "range":[27,32], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":32}}, + "range":[27,32], + "value":"foo", + "raw":"\"foo\"" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/invalid_syntax/string_newline.js b/lib/test/flow/invalid_syntax/string_newline.js new file mode 100644 index 0000000..7325139 --- /dev/null +++ b/lib/test/flow/invalid_syntax/string_newline.js @@ -0,0 +1,2 @@ +"foo +bar" diff --git a/lib/test/flow/invalid_syntax/string_newline.tree.json b/lib/test/flow/invalid_syntax/string_newline.tree.json new file mode 100644 index 0000000..3f3ad3d --- /dev/null +++ b/lib/test/flow/invalid_syntax/string_newline.tree.json @@ -0,0 +1,62 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "message":"Unexpected token ILLEGAL" + }, + { + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":5}}, + "message":"Unexpected token ILLEGAL" + }, + { + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":3,"column":0}}, + "message":"Unexpected string, expected the end of an expression statement (`;`)" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":0}}, + "range":[0,10], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,5], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,5], + "value":"foo\n", + "raw":"\"foo\n" + }, + "directive":"foo" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":3}}, + "range":[5,8], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":3}}, + "range":[5,8], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":3,"column":0}}, + "range":[8,10], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":3,"column":0}}, + "range":[8,10], + "value":"\n", + "raw":"\"\n" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/large_numbers/migrated_0000.js b/lib/test/flow/large_numbers/migrated_0000.js new file mode 100644 index 0000000..3803a5f --- /dev/null +++ b/lib/test/flow/large_numbers/migrated_0000.js @@ -0,0 +1 @@ +25257156155 diff --git a/lib/test/flow/large_numbers/migrated_0000.tree.json b/lib/test/flow/large_numbers/migrated_0000.tree.json new file mode 100644 index 0000000..382d135 --- /dev/null +++ b/lib/test/flow/large_numbers/migrated_0000.tree.json @@ -0,0 +1,21 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "value":25257156155, + "raw":"25257156155" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/large_numbers/migrated_0001.js b/lib/test/flow/large_numbers/migrated_0001.js new file mode 100644 index 0000000..c995532 --- /dev/null +++ b/lib/test/flow/large_numbers/migrated_0001.js @@ -0,0 +1 @@ +0274134317073 diff --git a/lib/test/flow/large_numbers/migrated_0001.tree.json b/lib/test/flow/large_numbers/migrated_0001.tree.json new file mode 100644 index 0000000..fd0cc8f --- /dev/null +++ b/lib/test/flow/large_numbers/migrated_0001.tree.json @@ -0,0 +1,21 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "value":25257156155, + "raw":"0274134317073" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/large_numbers/migrated_0002.js b/lib/test/flow/large_numbers/migrated_0002.js new file mode 100644 index 0000000..0048659 --- /dev/null +++ b/lib/test/flow/large_numbers/migrated_0002.js @@ -0,0 +1 @@ +0o274134317073 diff --git a/lib/test/flow/large_numbers/migrated_0002.tree.json b/lib/test/flow/large_numbers/migrated_0002.tree.json new file mode 100644 index 0000000..ef21703 --- /dev/null +++ b/lib/test/flow/large_numbers/migrated_0002.tree.json @@ -0,0 +1,21 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "value":25257156155, + "raw":"0o274134317073" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/large_numbers/migrated_0003.js b/lib/test/flow/large_numbers/migrated_0003.js new file mode 100644 index 0000000..369c2b5 --- /dev/null +++ b/lib/test/flow/large_numbers/migrated_0003.js @@ -0,0 +1 @@ +0x5E1719E3B diff --git a/lib/test/flow/large_numbers/migrated_0003.tree.json b/lib/test/flow/large_numbers/migrated_0003.tree.json new file mode 100644 index 0000000..365f206 --- /dev/null +++ b/lib/test/flow/large_numbers/migrated_0003.tree.json @@ -0,0 +1,21 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "value":25257156155, + "raw":"0x5E1719E3B" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/large_numbers/migrated_0004.js b/lib/test/flow/large_numbers/migrated_0004.js new file mode 100644 index 0000000..4cdae26 --- /dev/null +++ b/lib/test/flow/large_numbers/migrated_0004.js @@ -0,0 +1 @@ +0b10111100001011100011001111000111011 diff --git a/lib/test/flow/large_numbers/migrated_0004.tree.json b/lib/test/flow/large_numbers/migrated_0004.tree.json new file mode 100644 index 0000000..4e9c509 --- /dev/null +++ b/lib/test/flow/large_numbers/migrated_0004.tree.json @@ -0,0 +1,21 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "range":[0,37], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "range":[0,37], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "range":[0,37], + "value":25257156155, + "raw":"0b10111100001011100011001111000111011" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/nullish_coalescing/missing-plugin.js b/lib/test/flow/nullish_coalescing/missing-plugin.js new file mode 100644 index 0000000..569f804 --- /dev/null +++ b/lib/test/flow/nullish_coalescing/missing-plugin.js @@ -0,0 +1 @@ +a ?? b diff --git a/lib/test/flow/nullish_coalescing/missing-plugin.tree.json b/lib/test/flow/nullish_coalescing/missing-plugin.tree.json new file mode 100644 index 0000000..eb390b8 --- /dev/null +++ b/lib/test/flow/nullish_coalescing/missing-plugin.tree.json @@ -0,0 +1,42 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":4}}, + "message":"The nullish coalescing plugin must be enabled in order to use the nullish coalescing operator (`??`). Nullish coalescing is an active early-stage feature proposal which may change and is not enabled by default. To enable support in the parser, use the `esproposal_nullish_coalescing` option." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "expression":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "operator":"??", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"b", + "typeAnnotation":null, + "optional":false + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/nullish_coalescing/multiple.js b/lib/test/flow/nullish_coalescing/multiple.js new file mode 100644 index 0000000..6ffc89f --- /dev/null +++ b/lib/test/flow/nullish_coalescing/multiple.js @@ -0,0 +1 @@ +response.settings ?? response.defaultSettings ?? callback () diff --git a/lib/test/flow/nullish_coalescing/multiple.options.json b/lib/test/flow/nullish_coalescing/multiple.options.json new file mode 100644 index 0000000..d1468c9 --- /dev/null +++ b/lib/test/flow/nullish_coalescing/multiple.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_nullish_coalescing": true +} diff --git a/lib/test/flow/nullish_coalescing/multiple.tree.json b/lib/test/flow/nullish_coalescing/multiple.tree.json new file mode 100644 index 0000000..9d99b39 --- /dev/null +++ b/lib/test/flow/nullish_coalescing/multiple.tree.json @@ -0,0 +1,84 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":60}}, + "range":[0,60], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":60}}, + "range":[0,60], + "expression":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":60}}, + "range":[0,60], + "operator":"??", + "left":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "range":[0,45], + "operator":"??", + "left":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "range":[0,8], + "name":"response", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, + "range":[9,17], + "name":"settings", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "right":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":45}}, + "range":[21,45], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":29}}, + "range":[21,29], + "name":"response", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":45}}, + "range":[30,45], + "name":"defaultSettings", + "typeAnnotation":null, + "optional":false + }, + "computed":false + } + }, + "right":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":1,"column":49},"end":{"line":1,"column":60}}, + "range":[49,60], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":49},"end":{"line":1,"column":57}}, + "range":[49,57], + "name":"callback", + "typeAnnotation":null, + "optional":false + }, + "arguments":[] + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/nullish_coalescing/multiple_no_whitespace.js b/lib/test/flow/nullish_coalescing/multiple_no_whitespace.js new file mode 100644 index 0000000..24315bd --- /dev/null +++ b/lib/test/flow/nullish_coalescing/multiple_no_whitespace.js @@ -0,0 +1 @@ +response.settings??response.defaultSettings??callback () diff --git a/lib/test/flow/nullish_coalescing/multiple_no_whitespace.options.json b/lib/test/flow/nullish_coalescing/multiple_no_whitespace.options.json new file mode 100644 index 0000000..d1468c9 --- /dev/null +++ b/lib/test/flow/nullish_coalescing/multiple_no_whitespace.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_nullish_coalescing": true +} diff --git a/lib/test/flow/nullish_coalescing/multiple_no_whitespace.tree.json b/lib/test/flow/nullish_coalescing/multiple_no_whitespace.tree.json new file mode 100644 index 0000000..f0bebcb --- /dev/null +++ b/lib/test/flow/nullish_coalescing/multiple_no_whitespace.tree.json @@ -0,0 +1,84 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, + "range":[0,56], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, + "range":[0,56], + "expression":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, + "range":[0,56], + "operator":"??", + "left":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "range":[0,43], + "operator":"??", + "left":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "range":[0,8], + "name":"response", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, + "range":[9,17], + "name":"settings", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "right":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":43}}, + "range":[19,43], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, + "range":[19,27], + "name":"response", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":43}}, + "range":[28,43], + "name":"defaultSettings", + "typeAnnotation":null, + "optional":false + }, + "computed":false + } + }, + "right":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":1,"column":45},"end":{"line":1,"column":56}}, + "range":[45,56], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":45},"end":{"line":1,"column":53}}, + "range":[45,53], + "name":"callback", + "typeAnnotation":null, + "optional":false + }, + "arguments":[] + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/nullish_coalescing/precedence_and.js b/lib/test/flow/nullish_coalescing/precedence_and.js new file mode 100644 index 0000000..914ff84 --- /dev/null +++ b/lib/test/flow/nullish_coalescing/precedence_and.js @@ -0,0 +1 @@ +a ?? (b && c) diff --git a/lib/test/flow/nullish_coalescing/precedence_and.options.json b/lib/test/flow/nullish_coalescing/precedence_and.options.json new file mode 100644 index 0000000..d1468c9 --- /dev/null +++ b/lib/test/flow/nullish_coalescing/precedence_and.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_nullish_coalescing": true +} diff --git a/lib/test/flow/nullish_coalescing/precedence_and.tree.json b/lib/test/flow/nullish_coalescing/precedence_and.tree.json new file mode 100644 index 0000000..7b6590c --- /dev/null +++ b/lib/test/flow/nullish_coalescing/precedence_and.tree.json @@ -0,0 +1,50 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "operator":"??", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, + "range":[6,12], + "operator":"&&", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"c", + "typeAnnotation":null, + "optional":false + } + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/nullish_coalescing/precedence_and_lhs_no_parens.js b/lib/test/flow/nullish_coalescing/precedence_and_lhs_no_parens.js new file mode 100644 index 0000000..a8d594d --- /dev/null +++ b/lib/test/flow/nullish_coalescing/precedence_and_lhs_no_parens.js @@ -0,0 +1 @@ +a ?? b && c diff --git a/lib/test/flow/nullish_coalescing/precedence_and_lhs_no_parens.options.json b/lib/test/flow/nullish_coalescing/precedence_and_lhs_no_parens.options.json new file mode 100644 index 0000000..d1468c9 --- /dev/null +++ b/lib/test/flow/nullish_coalescing/precedence_and_lhs_no_parens.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_nullish_coalescing": true +} diff --git a/lib/test/flow/nullish_coalescing/precedence_and_lhs_no_parens.tree.json b/lib/test/flow/nullish_coalescing/precedence_and_lhs_no_parens.tree.json new file mode 100644 index 0000000..be9c17d --- /dev/null +++ b/lib/test/flow/nullish_coalescing/precedence_and_lhs_no_parens.tree.json @@ -0,0 +1,56 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, + "message":"Unexpected token `&&`. Parentheses are required to combine `??` with `&&` or `||` expressions." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "expression":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "operator":"??", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, + "range":[5,11], + "operator":"&&", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"c", + "typeAnnotation":null, + "optional":false + } + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/nullish_coalescing/precedence_and_nested_lhs.js b/lib/test/flow/nullish_coalescing/precedence_and_nested_lhs.js new file mode 100644 index 0000000..a019353 --- /dev/null +++ b/lib/test/flow/nullish_coalescing/precedence_and_nested_lhs.js @@ -0,0 +1 @@ +(a ?? b) && c diff --git a/lib/test/flow/nullish_coalescing/precedence_and_nested_lhs.options.json b/lib/test/flow/nullish_coalescing/precedence_and_nested_lhs.options.json new file mode 100644 index 0000000..d1468c9 --- /dev/null +++ b/lib/test/flow/nullish_coalescing/precedence_and_nested_lhs.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_nullish_coalescing": true +} diff --git a/lib/test/flow/nullish_coalescing/precedence_and_nested_lhs.tree.json b/lib/test/flow/nullish_coalescing/precedence_and_nested_lhs.tree.json new file mode 100644 index 0000000..56603ac --- /dev/null +++ b/lib/test/flow/nullish_coalescing/precedence_and_nested_lhs.tree.json @@ -0,0 +1,50 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "operator":"&&", + "left":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, + "range":[1,7], + "operator":"??", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, + "range":[1,2], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"b", + "typeAnnotation":null, + "optional":false + } + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "name":"c", + "typeAnnotation":null, + "optional":false + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/nullish_coalescing/precedence_and_nested_rhs.js b/lib/test/flow/nullish_coalescing/precedence_and_nested_rhs.js new file mode 100644 index 0000000..d322f5e --- /dev/null +++ b/lib/test/flow/nullish_coalescing/precedence_and_nested_rhs.js @@ -0,0 +1 @@ +a && (b ?? c) diff --git a/lib/test/flow/nullish_coalescing/precedence_and_nested_rhs.options.json b/lib/test/flow/nullish_coalescing/precedence_and_nested_rhs.options.json new file mode 100644 index 0000000..d1468c9 --- /dev/null +++ b/lib/test/flow/nullish_coalescing/precedence_and_nested_rhs.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_nullish_coalescing": true +} diff --git a/lib/test/flow/nullish_coalescing/precedence_and_nested_rhs.tree.json b/lib/test/flow/nullish_coalescing/precedence_and_nested_rhs.tree.json new file mode 100644 index 0000000..e3e826a --- /dev/null +++ b/lib/test/flow/nullish_coalescing/precedence_and_nested_rhs.tree.json @@ -0,0 +1,50 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "operator":"&&", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, + "range":[6,12], + "operator":"??", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"c", + "typeAnnotation":null, + "optional":false + } + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/nullish_coalescing/precedence_and_rhs_no_parens.js b/lib/test/flow/nullish_coalescing/precedence_and_rhs_no_parens.js new file mode 100644 index 0000000..7f9e51e --- /dev/null +++ b/lib/test/flow/nullish_coalescing/precedence_and_rhs_no_parens.js @@ -0,0 +1 @@ +a && b ?? c diff --git a/lib/test/flow/nullish_coalescing/precedence_and_rhs_no_parens.options.json b/lib/test/flow/nullish_coalescing/precedence_and_rhs_no_parens.options.json new file mode 100644 index 0000000..d1468c9 --- /dev/null +++ b/lib/test/flow/nullish_coalescing/precedence_and_rhs_no_parens.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_nullish_coalescing": true +} diff --git a/lib/test/flow/nullish_coalescing/precedence_and_rhs_no_parens.tree.json b/lib/test/flow/nullish_coalescing/precedence_and_rhs_no_parens.tree.json new file mode 100644 index 0000000..8369e39 --- /dev/null +++ b/lib/test/flow/nullish_coalescing/precedence_and_rhs_no_parens.tree.json @@ -0,0 +1,56 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, + "message":"Unexpected token `??`. Parentheses are required to combine `??` with `&&` or `||` expressions." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "expression":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "operator":"??", + "left":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "operator":"&&", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"b", + "typeAnnotation":null, + "optional":false + } + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"c", + "typeAnnotation":null, + "optional":false + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/nullish_coalescing/precedence_multiple_on_or_rhs_no_parens.js b/lib/test/flow/nullish_coalescing/precedence_multiple_on_or_rhs_no_parens.js new file mode 100644 index 0000000..79fa14d --- /dev/null +++ b/lib/test/flow/nullish_coalescing/precedence_multiple_on_or_rhs_no_parens.js @@ -0,0 +1 @@ +a || b ?? c ?? d diff --git a/lib/test/flow/nullish_coalescing/precedence_multiple_on_or_rhs_no_parens.options.json b/lib/test/flow/nullish_coalescing/precedence_multiple_on_or_rhs_no_parens.options.json new file mode 100644 index 0000000..d1468c9 --- /dev/null +++ b/lib/test/flow/nullish_coalescing/precedence_multiple_on_or_rhs_no_parens.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_nullish_coalescing": true +} diff --git a/lib/test/flow/nullish_coalescing/precedence_multiple_on_or_rhs_no_parens.tree.json b/lib/test/flow/nullish_coalescing/precedence_multiple_on_or_rhs_no_parens.tree.json new file mode 100644 index 0000000..171461b --- /dev/null +++ b/lib/test/flow/nullish_coalescing/precedence_multiple_on_or_rhs_no_parens.tree.json @@ -0,0 +1,70 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, + "message":"Unexpected token `??`. Parentheses are required to combine `??` with `&&` or `||` expressions." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "expression":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "operator":"??", + "left":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "operator":"??", + "left":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "operator":"||", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"b", + "typeAnnotation":null, + "optional":false + } + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"c", + "typeAnnotation":null, + "optional":false + } + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"d", + "typeAnnotation":null, + "optional":false + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/nullish_coalescing/precedence_or.js b/lib/test/flow/nullish_coalescing/precedence_or.js new file mode 100644 index 0000000..943182e --- /dev/null +++ b/lib/test/flow/nullish_coalescing/precedence_or.js @@ -0,0 +1 @@ +a ?? (b || c) diff --git a/lib/test/flow/nullish_coalescing/precedence_or.options.json b/lib/test/flow/nullish_coalescing/precedence_or.options.json new file mode 100644 index 0000000..d1468c9 --- /dev/null +++ b/lib/test/flow/nullish_coalescing/precedence_or.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_nullish_coalescing": true +} diff --git a/lib/test/flow/nullish_coalescing/precedence_or.tree.json b/lib/test/flow/nullish_coalescing/precedence_or.tree.json new file mode 100644 index 0000000..a793488 --- /dev/null +++ b/lib/test/flow/nullish_coalescing/precedence_or.tree.json @@ -0,0 +1,50 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "operator":"??", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, + "range":[6,12], + "operator":"||", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"c", + "typeAnnotation":null, + "optional":false + } + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/nullish_coalescing/precedence_or_lhs_no_parens.js b/lib/test/flow/nullish_coalescing/precedence_or_lhs_no_parens.js new file mode 100644 index 0000000..dc9a04b --- /dev/null +++ b/lib/test/flow/nullish_coalescing/precedence_or_lhs_no_parens.js @@ -0,0 +1 @@ +a ?? b || c diff --git a/lib/test/flow/nullish_coalescing/precedence_or_lhs_no_parens.options.json b/lib/test/flow/nullish_coalescing/precedence_or_lhs_no_parens.options.json new file mode 100644 index 0000000..d1468c9 --- /dev/null +++ b/lib/test/flow/nullish_coalescing/precedence_or_lhs_no_parens.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_nullish_coalescing": true +} diff --git a/lib/test/flow/nullish_coalescing/precedence_or_lhs_no_parens.tree.json b/lib/test/flow/nullish_coalescing/precedence_or_lhs_no_parens.tree.json new file mode 100644 index 0000000..38615ec --- /dev/null +++ b/lib/test/flow/nullish_coalescing/precedence_or_lhs_no_parens.tree.json @@ -0,0 +1,56 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, + "message":"Unexpected token `||`. Parentheses are required to combine `??` with `&&` or `||` expressions." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "expression":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "operator":"??", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, + "range":[5,11], + "operator":"||", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"c", + "typeAnnotation":null, + "optional":false + } + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/nullish_coalescing/precedence_or_no_parens.js b/lib/test/flow/nullish_coalescing/precedence_or_no_parens.js new file mode 100644 index 0000000..a751ded --- /dev/null +++ b/lib/test/flow/nullish_coalescing/precedence_or_no_parens.js @@ -0,0 +1,14 @@ +a || b ?? c || d + +/** + * `||` cannot be combined with `??` without parens. We assume `??` is lower + * precedence and recover by pretending the parens were there: + * + * a || b ... + * ^^^^^^ ok, a LogicalOrExpression + * a || b ?? ... + * ^^ error. to recover, give ?? lower precedence than ||: + * (a || b) ?? c || ... + * ^^ error. to recover, give || higher precedence than ??: + * (a || b) ?? (c || d) + */ diff --git a/lib/test/flow/nullish_coalescing/precedence_or_no_parens.options.json b/lib/test/flow/nullish_coalescing/precedence_or_no_parens.options.json new file mode 100644 index 0000000..d1468c9 --- /dev/null +++ b/lib/test/flow/nullish_coalescing/precedence_or_no_parens.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_nullish_coalescing": true +} diff --git a/lib/test/flow/nullish_coalescing/precedence_or_no_parens.tree.json b/lib/test/flow/nullish_coalescing/precedence_or_no_parens.tree.json new file mode 100644 index 0000000..38ea02e --- /dev/null +++ b/lib/test/flow/nullish_coalescing/precedence_or_no_parens.tree.json @@ -0,0 +1,81 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, + "message":"Unexpected token `??`. Parentheses are required to combine `??` with `&&` or `||` expressions." + }, + { + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, + "message":"Unexpected token `||`. Parentheses are required to combine `??` with `&&` or `||` expressions." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "expression":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "operator":"??", + "left":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "operator":"||", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"b", + "typeAnnotation":null, + "optional":false + } + }, + "right":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, + "range":[10,16], + "operator":"||", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"c", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"d", + "typeAnnotation":null, + "optional":false + } + } + }, + "directive":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":14,"column":3}}, + "range":[18,437], + "value":"*\n * `||` cannot be combined with `??` without parens. We assume `??` is lower\n * precedence and recover by pretending the parens were there:\n *\n * a || b ...\n * ^^^^^^ ok, a LogicalOrExpression\n * a || b ?? ...\n * ^^ error. to recover, give ?? lower precedence than ||:\n * (a || b) ?? c || ...\n * ^^ error. to recover, give || higher precedence than ??:\n * (a || b) ?? (c || d)\n " + } + ] +} diff --git a/lib/test/flow/nullish_coalescing/precedence_or_rhs_no_parens.js b/lib/test/flow/nullish_coalescing/precedence_or_rhs_no_parens.js new file mode 100644 index 0000000..2d12bd6 --- /dev/null +++ b/lib/test/flow/nullish_coalescing/precedence_or_rhs_no_parens.js @@ -0,0 +1 @@ +a || b ?? c diff --git a/lib/test/flow/nullish_coalescing/precedence_or_rhs_no_parens.options.json b/lib/test/flow/nullish_coalescing/precedence_or_rhs_no_parens.options.json new file mode 100644 index 0000000..d1468c9 --- /dev/null +++ b/lib/test/flow/nullish_coalescing/precedence_or_rhs_no_parens.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_nullish_coalescing": true +} diff --git a/lib/test/flow/nullish_coalescing/precedence_or_rhs_no_parens.tree.json b/lib/test/flow/nullish_coalescing/precedence_or_rhs_no_parens.tree.json new file mode 100644 index 0000000..0e0932c --- /dev/null +++ b/lib/test/flow/nullish_coalescing/precedence_or_rhs_no_parens.tree.json @@ -0,0 +1,56 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, + "message":"Unexpected token `??`. Parentheses are required to combine `??` with `&&` or `||` expressions." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "expression":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "operator":"??", + "left":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "operator":"||", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"b", + "typeAnnotation":null, + "optional":false + } + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"c", + "typeAnnotation":null, + "optional":false + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/nullish_coalescing/simple.js b/lib/test/flow/nullish_coalescing/simple.js new file mode 100644 index 0000000..352c10f --- /dev/null +++ b/lib/test/flow/nullish_coalescing/simple.js @@ -0,0 +1 @@ +null ?? 'hello' diff --git a/lib/test/flow/nullish_coalescing/simple.options.json b/lib/test/flow/nullish_coalescing/simple.options.json new file mode 100644 index 0000000..d1468c9 --- /dev/null +++ b/lib/test/flow/nullish_coalescing/simple.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_nullish_coalescing": true +} diff --git a/lib/test/flow/nullish_coalescing/simple.tree.json b/lib/test/flow/nullish_coalescing/simple.tree.json new file mode 100644 index 0000000..6abfc4f --- /dev/null +++ b/lib/test/flow/nullish_coalescing/simple.tree.json @@ -0,0 +1,34 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "expression":{ + "type":"LogicalExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "operator":"??", + "left":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "value":null, + "raw":"null" + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":15}}, + "range":[8,15], + "value":"hello", + "raw":"'hello'" + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/numbers/binnumber_word_invalid.js b/lib/test/flow/numbers/binnumber_word_invalid.js new file mode 100644 index 0000000..46c4fe3 --- /dev/null +++ b/lib/test/flow/numbers/binnumber_word_invalid.js @@ -0,0 +1 @@ +0b123hello; \ No newline at end of file diff --git a/lib/test/flow/numbers/binnumber_word_invalid.tree.json b/lib/test/flow/numbers/binnumber_word_invalid.tree.json new file mode 100644 index 0000000..c564b6f --- /dev/null +++ b/lib/test/flow/numbers/binnumber_word_invalid.tree.json @@ -0,0 +1,66 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "message":"Unexpected token ILLEGAL" + }, + { + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":10}}, + "message":"Unexpected token ILLEGAL" + }, + { + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":5}}, + "message":"Unexpected number, expected the end of an expression statement (`;`)" + }, + { + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, + "message":"Unexpected identifier, expected the end of an expression statement (`;`)" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "value":1, + "raw":"0b1" + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":5}}, + "range":[3,5], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":5}}, + "range":[3,5], + "value":23, + "raw":"23" + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, + "range":[5,11], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, + "range":[5,10], + "name":"hello", + "typeAnnotation":null, + "optional":false + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/numbers/migrated_0000.js b/lib/test/flow/numbers/migrated_0000.js new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/lib/test/flow/numbers/migrated_0000.js @@ -0,0 +1 @@ +1 diff --git a/lib/test/flow/numbers/migrated_0000.tree.json b/lib/test/flow/numbers/migrated_0000.tree.json new file mode 100644 index 0000000..a92f15f --- /dev/null +++ b/lib/test/flow/numbers/migrated_0000.tree.json @@ -0,0 +1,21 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "value":1, + "raw":"1" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/numbers/migrated_0001.js b/lib/test/flow/numbers/migrated_0001.js new file mode 100644 index 0000000..1e09dca --- /dev/null +++ b/lib/test/flow/numbers/migrated_0001.js @@ -0,0 +1 @@ +1e5 diff --git a/lib/test/flow/numbers/migrated_0001.tree.json b/lib/test/flow/numbers/migrated_0001.tree.json new file mode 100644 index 0000000..8ba1ca2 --- /dev/null +++ b/lib/test/flow/numbers/migrated_0001.tree.json @@ -0,0 +1,21 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "value":100000, + "raw":"1e5" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/numbers/migrated_0002.js b/lib/test/flow/numbers/migrated_0002.js new file mode 100644 index 0000000..ec57c48 --- /dev/null +++ b/lib/test/flow/numbers/migrated_0002.js @@ -0,0 +1 @@ +1e+05 diff --git a/lib/test/flow/numbers/migrated_0002.tree.json b/lib/test/flow/numbers/migrated_0002.tree.json new file mode 100644 index 0000000..0c6bd30 --- /dev/null +++ b/lib/test/flow/numbers/migrated_0002.tree.json @@ -0,0 +1,21 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "range":[0,5], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "range":[0,5], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "range":[0,5], + "value":100000, + "raw":"1e+05" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/numbers/non_octal_decimal_integer_literal.js b/lib/test/flow/numbers/non_octal_decimal_integer_literal.js new file mode 100644 index 0000000..3527e1f --- /dev/null +++ b/lib/test/flow/numbers/non_octal_decimal_integer_literal.js @@ -0,0 +1,3 @@ +08; +018; +088; diff --git a/lib/test/flow/numbers/non_octal_decimal_integer_literal.tree.json b/lib/test/flow/numbers/non_octal_decimal_integer_literal.tree.json new file mode 100644 index 0000000..3e5c3cd --- /dev/null +++ b/lib/test/flow/numbers/non_octal_decimal_integer_literal.tree.json @@ -0,0 +1,47 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":4}}, + "range":[0,13], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "range":[0,2], + "value":8, + "raw":"08" + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":4}}, + "range":[4,8], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":3}}, + "range":[4,7], + "value":18, + "raw":"018" + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":4}}, + "range":[9,13], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":3}}, + "range":[9,12], + "value":88, + "raw":"088" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/numbers/non_octal_decimal_integer_literal_strict.js b/lib/test/flow/numbers/non_octal_decimal_integer_literal_strict.js new file mode 100644 index 0000000..6b93d33 --- /dev/null +++ b/lib/test/flow/numbers/non_octal_decimal_integer_literal_strict.js @@ -0,0 +1,4 @@ +"use strict"; +08; +018; +088; diff --git a/lib/test/flow/numbers/non_octal_decimal_integer_literal_strict.tree.json b/lib/test/flow/numbers/non_octal_decimal_integer_literal_strict.tree.json new file mode 100644 index 0000000..24e3a06 --- /dev/null +++ b/lib/test/flow/numbers/non_octal_decimal_integer_literal_strict.tree.json @@ -0,0 +1,74 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":2}}, + "message":"Number literals with leading zeros are not allowed in strict mode." + }, + { + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":3}}, + "message":"Number literals with leading zeros are not allowed in strict mode." + }, + { + "loc":{"source":null,"start":{"line":4,"column":0},"end":{"line":4,"column":3}}, + "message":"Number literals with leading zeros are not allowed in strict mode." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":4}}, + "range":[0,27], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "value":"use strict", + "raw":"\"use strict\"" + }, + "directive":"use strict" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":3}}, + "range":[14,17], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":2}}, + "range":[14,16], + "value":8, + "raw":"08" + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":4}}, + "range":[18,22], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":3}}, + "range":[18,21], + "value":18, + "raw":"018" + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":4,"column":0},"end":{"line":4,"column":4}}, + "range":[23,27], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":4,"column":0},"end":{"line":4,"column":3}}, + "range":[23,26], + "value":88, + "raw":"088" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/numbers/scientific_leading_decimal.js b/lib/test/flow/numbers/scientific_leading_decimal.js new file mode 100644 index 0000000..fe7b328 --- /dev/null +++ b/lib/test/flow/numbers/scientific_leading_decimal.js @@ -0,0 +1 @@ +.1e5 diff --git a/lib/test/flow/numbers/scientific_leading_decimal.tree.json b/lib/test/flow/numbers/scientific_leading_decimal.tree.json new file mode 100644 index 0000000..ad3721a --- /dev/null +++ b/lib/test/flow/numbers/scientific_leading_decimal.tree.json @@ -0,0 +1,21 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "value":10000, + "raw":".1e5" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/numbers/scientific_leading_zero.js b/lib/test/flow/numbers/scientific_leading_zero.js new file mode 100644 index 0000000..5e3d0ce --- /dev/null +++ b/lib/test/flow/numbers/scientific_leading_zero.js @@ -0,0 +1 @@ +0.1e5 diff --git a/lib/test/flow/numbers/scientific_leading_zero.tree.json b/lib/test/flow/numbers/scientific_leading_zero.tree.json new file mode 100644 index 0000000..2ac6021 --- /dev/null +++ b/lib/test/flow/numbers/scientific_leading_zero.tree.json @@ -0,0 +1,21 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "range":[0,5], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "range":[0,5], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "range":[0,5], + "value":10000, + "raw":"0.1e5" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/numbers/scientific_without_fractional_digits.js b/lib/test/flow/numbers/scientific_without_fractional_digits.js new file mode 100644 index 0000000..125c1ef --- /dev/null +++ b/lib/test/flow/numbers/scientific_without_fractional_digits.js @@ -0,0 +1 @@ +1.e5 diff --git a/lib/test/flow/numbers/scientific_without_fractional_digits.tree.json b/lib/test/flow/numbers/scientific_without_fractional_digits.tree.json new file mode 100644 index 0000000..df4eef1 --- /dev/null +++ b/lib/test/flow/numbers/scientific_without_fractional_digits.tree.json @@ -0,0 +1,21 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "value":100000, + "raw":"1.e5" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/numbers/scientific_zero.js b/lib/test/flow/numbers/scientific_zero.js new file mode 100644 index 0000000..caae781 --- /dev/null +++ b/lib/test/flow/numbers/scientific_zero.js @@ -0,0 +1 @@ +0e5 diff --git a/lib/test/flow/numbers/scientific_zero.tree.json b/lib/test/flow/numbers/scientific_zero.tree.json new file mode 100644 index 0000000..3582613 --- /dev/null +++ b/lib/test/flow/numbers/scientific_zero.tree.json @@ -0,0 +1,21 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "value":0, + "raw":"0e5" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/numbers/underscored_bin.js b/lib/test/flow/numbers/underscored_bin.js new file mode 100644 index 0000000..5b1a6d2 --- /dev/null +++ b/lib/test/flow/numbers/underscored_bin.js @@ -0,0 +1 @@ +0b1111_0000 diff --git a/lib/test/flow/numbers/underscored_bin.tree.json b/lib/test/flow/numbers/underscored_bin.tree.json new file mode 100644 index 0000000..03ddd53 --- /dev/null +++ b/lib/test/flow/numbers/underscored_bin.tree.json @@ -0,0 +1,21 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "value":240, + "raw":"0b1111_0000" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/numbers/underscored_float.js b/lib/test/flow/numbers/underscored_float.js new file mode 100644 index 0000000..a68676b --- /dev/null +++ b/lib/test/flow/numbers/underscored_float.js @@ -0,0 +1 @@ +.123_45 diff --git a/lib/test/flow/numbers/underscored_float.tree.json b/lib/test/flow/numbers/underscored_float.tree.json new file mode 100644 index 0000000..95c9637 --- /dev/null +++ b/lib/test/flow/numbers/underscored_float.tree.json @@ -0,0 +1,21 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "value":0.12345, + "raw":".123_45" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/numbers/underscored_float_err_lead.js b/lib/test/flow/numbers/underscored_float_err_lead.js new file mode 100644 index 0000000..d44d991 --- /dev/null +++ b/lib/test/flow/numbers/underscored_float_err_lead.js @@ -0,0 +1 @@ +123._45 diff --git a/lib/test/flow/numbers/underscored_float_err_lead.tree.json b/lib/test/flow/numbers/underscored_float_err_lead.tree.json new file mode 100644 index 0000000..8b3b28b --- /dev/null +++ b/lib/test/flow/numbers/underscored_float_err_lead.tree.json @@ -0,0 +1,41 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "message":"Unexpected identifier, expected the end of an expression statement (`;`)" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "value":123, + "raw":"123." + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "range":[4,7], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "range":[4,7], + "name":"_45", + "typeAnnotation":null, + "optional":false + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/numbers/underscored_float_err_trail.js b/lib/test/flow/numbers/underscored_float_err_trail.js new file mode 100644 index 0000000..0c01a46 --- /dev/null +++ b/lib/test/flow/numbers/underscored_float_err_trail.js @@ -0,0 +1 @@ +123_.45 diff --git a/lib/test/flow/numbers/underscored_float_err_trail.tree.json b/lib/test/flow/numbers/underscored_float_err_trail.tree.json new file mode 100644 index 0000000..5b66237 --- /dev/null +++ b/lib/test/flow/numbers/underscored_float_err_trail.tree.json @@ -0,0 +1,58 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":4}}, + "message":"Unexpected identifier, expected the end of an expression statement (`;`)" + }, + { + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "message":"Unexpected number, expected the end of an expression statement (`;`)" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "value":123, + "raw":"123" + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":4}}, + "range":[3,4], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":4}}, + "range":[3,4], + "name":"_", + "typeAnnotation":null, + "optional":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "range":[4,7], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "range":[4,7], + "value":0.45, + "raw":".45" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/numbers/underscored_float_whole.js b/lib/test/flow/numbers/underscored_float_whole.js new file mode 100644 index 0000000..a02aac6 --- /dev/null +++ b/lib/test/flow/numbers/underscored_float_whole.js @@ -0,0 +1 @@ +123_45.123_45 diff --git a/lib/test/flow/numbers/underscored_float_whole.tree.json b/lib/test/flow/numbers/underscored_float_whole.tree.json new file mode 100644 index 0000000..8e4c5a1 --- /dev/null +++ b/lib/test/flow/numbers/underscored_float_whole.tree.json @@ -0,0 +1,21 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "value":12345.12345, + "raw":"123_45.123_45" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/numbers/underscored_hex.js b/lib/test/flow/numbers/underscored_hex.js new file mode 100644 index 0000000..cd46a17 --- /dev/null +++ b/lib/test/flow/numbers/underscored_hex.js @@ -0,0 +1 @@ +0xAB_CD_12 diff --git a/lib/test/flow/numbers/underscored_hex.tree.json b/lib/test/flow/numbers/underscored_hex.tree.json new file mode 100644 index 0000000..be92455 --- /dev/null +++ b/lib/test/flow/numbers/underscored_hex.tree.json @@ -0,0 +1,21 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "value":11259154, + "raw":"0xAB_CD_12" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/numbers/underscored_legacy_octal.js b/lib/test/flow/numbers/underscored_legacy_octal.js new file mode 100644 index 0000000..e264e62 --- /dev/null +++ b/lib/test/flow/numbers/underscored_legacy_octal.js @@ -0,0 +1,3 @@ +0_123; +01_23; +0123_; diff --git a/lib/test/flow/numbers/underscored_legacy_octal.tree.json b/lib/test/flow/numbers/underscored_legacy_octal.tree.json new file mode 100644 index 0000000..7e402fe --- /dev/null +++ b/lib/test/flow/numbers/underscored_legacy_octal.tree.json @@ -0,0 +1,103 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "message":"Unexpected identifier, expected the end of an expression statement (`;`)" + }, + { + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "message":"Unexpected identifier, expected the end of an expression statement (`;`)" + }, + { + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":5}}, + "message":"Unexpected identifier, expected the end of an expression statement (`;`)" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":6}}, + "range":[0,20], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "value":0, + "raw":"0" + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "range":[1,6], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "range":[1,5], + "name":"_123", + "typeAnnotation":null, + "optional":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":2}}, + "range":[7,9], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":2}}, + "range":[7,9], + "value":1, + "raw":"01" + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":6}}, + "range":[9,13], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "range":[9,12], + "name":"_23", + "typeAnnotation":null, + "optional":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":4}}, + "range":[14,18], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":4}}, + "range":[14,18], + "value":83, + "raw":"0123" + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":6}}, + "range":[18,20], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":5}}, + "range":[18,19], + "name":"_", + "typeAnnotation":null, + "optional":false + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/numbers/underscored_number.js b/lib/test/flow/numbers/underscored_number.js new file mode 100644 index 0000000..9d5fdcb --- /dev/null +++ b/lib/test/flow/numbers/underscored_number.js @@ -0,0 +1 @@ +123_45 diff --git a/lib/test/flow/numbers/underscored_number.tree.json b/lib/test/flow/numbers/underscored_number.tree.json new file mode 100644 index 0000000..241c229 --- /dev/null +++ b/lib/test/flow/numbers/underscored_number.tree.json @@ -0,0 +1,21 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "value":12345, + "raw":"123_45" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/numbers/underscored_number_err_double.js b/lib/test/flow/numbers/underscored_number_err_double.js new file mode 100644 index 0000000..e1d8ba9 --- /dev/null +++ b/lib/test/flow/numbers/underscored_number_err_double.js @@ -0,0 +1 @@ +123__45 diff --git a/lib/test/flow/numbers/underscored_number_err_double.tree.json b/lib/test/flow/numbers/underscored_number_err_double.tree.json new file mode 100644 index 0000000..3500a17 --- /dev/null +++ b/lib/test/flow/numbers/underscored_number_err_double.tree.json @@ -0,0 +1,41 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":7}}, + "message":"Unexpected identifier, expected the end of an expression statement (`;`)" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "value":123, + "raw":"123" + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":7}}, + "range":[3,7], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":7}}, + "range":[3,7], + "name":"__45", + "typeAnnotation":null, + "optional":false + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/numbers/underscored_number_err_lead.js b/lib/test/flow/numbers/underscored_number_err_lead.js new file mode 100644 index 0000000..fc880c7 --- /dev/null +++ b/lib/test/flow/numbers/underscored_number_err_lead.js @@ -0,0 +1 @@ +_12345 diff --git a/lib/test/flow/numbers/underscored_number_err_lead.tree.json b/lib/test/flow/numbers/underscored_number_err_lead.tree.json new file mode 100644 index 0000000..2aedae7 --- /dev/null +++ b/lib/test/flow/numbers/underscored_number_err_lead.tree.json @@ -0,0 +1,22 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "name":"_12345", + "typeAnnotation":null, + "optional":false + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/numbers/underscored_number_err_leading_zero.js b/lib/test/flow/numbers/underscored_number_err_leading_zero.js new file mode 100644 index 0000000..3eb3ae7 --- /dev/null +++ b/lib/test/flow/numbers/underscored_number_err_leading_zero.js @@ -0,0 +1 @@ +0_0123 diff --git a/lib/test/flow/numbers/underscored_number_err_leading_zero.tree.json b/lib/test/flow/numbers/underscored_number_err_leading_zero.tree.json new file mode 100644 index 0000000..2bddb51 --- /dev/null +++ b/lib/test/flow/numbers/underscored_number_err_leading_zero.tree.json @@ -0,0 +1,41 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "message":"Unexpected identifier, expected the end of an expression statement (`;`)" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "value":0, + "raw":"0" + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "range":[1,6], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":6}}, + "range":[1,6], + "name":"_0123", + "typeAnnotation":null, + "optional":false + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/numbers/underscored_number_err_trail.js b/lib/test/flow/numbers/underscored_number_err_trail.js new file mode 100644 index 0000000..ce75f2f --- /dev/null +++ b/lib/test/flow/numbers/underscored_number_err_trail.js @@ -0,0 +1 @@ +12345_ diff --git a/lib/test/flow/numbers/underscored_number_err_trail.tree.json b/lib/test/flow/numbers/underscored_number_err_trail.tree.json new file mode 100644 index 0000000..7dcdb17 --- /dev/null +++ b/lib/test/flow/numbers/underscored_number_err_trail.tree.json @@ -0,0 +1,41 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "message":"Unexpected identifier, expected the end of an expression statement (`;`)" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "range":[0,5], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "range":[0,5], + "value":12345, + "raw":"12345" + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"_", + "typeAnnotation":null, + "optional":false + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/numbers/underscored_oct.js b/lib/test/flow/numbers/underscored_oct.js new file mode 100644 index 0000000..8507b0b --- /dev/null +++ b/lib/test/flow/numbers/underscored_oct.js @@ -0,0 +1 @@ +0o12_34 diff --git a/lib/test/flow/numbers/underscored_oct.tree.json b/lib/test/flow/numbers/underscored_oct.tree.json new file mode 100644 index 0000000..8f2f611 --- /dev/null +++ b/lib/test/flow/numbers/underscored_oct.tree.json @@ -0,0 +1,21 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "value":668, + "raw":"0o12_34" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/object-literal-spread/spread_is_first.js b/lib/test/flow/object-literal-spread/spread_is_first.js new file mode 100644 index 0000000..a2a0b38 --- /dev/null +++ b/lib/test/flow/object-literal-spread/spread_is_first.js @@ -0,0 +1 @@ +({...rest, x}); diff --git a/lib/test/flow/object-literal-spread/spread_is_first.tree.json b/lib/test/flow/object-literal-spread/spread_is_first.tree.json new file mode 100644 index 0000000..d8ea6cf --- /dev/null +++ b/lib/test/flow/object-literal-spread/spread_is_first.tree.json @@ -0,0 +1,59 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "expression":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":13}}, + "range":[1,13], + "properties":[ + { + "type":"SpreadProperty", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":9}}, + "range":[2,9], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":9}}, + "range":[5,9], + "name":"rest", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/object-literal-spread/spread_is_last.js b/lib/test/flow/object-literal-spread/spread_is_last.js new file mode 100644 index 0000000..ed60427 --- /dev/null +++ b/lib/test/flow/object-literal-spread/spread_is_last.js @@ -0,0 +1 @@ +({x, ...rest}); diff --git a/lib/test/flow/object-literal-spread/spread_is_last.tree.json b/lib/test/flow/object-literal-spread/spread_is_last.tree.json new file mode 100644 index 0000000..d3ef8b3 --- /dev/null +++ b/lib/test/flow/object-literal-spread/spread_is_last.tree.json @@ -0,0 +1,59 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "expression":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":13}}, + "range":[1,13], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "range":[2,3], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "range":[2,3], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "range":[2,3], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + }, + { + "type":"SpreadProperty", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, + "range":[5,12], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":12}}, + "range":[8,12], + "name":"rest", + "typeAnnotation":null, + "optional":false + } + } + ] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/object-literal-spread/spread_is_last_trailing_comma.js b/lib/test/flow/object-literal-spread/spread_is_last_trailing_comma.js new file mode 100644 index 0000000..7863672 --- /dev/null +++ b/lib/test/flow/object-literal-spread/spread_is_last_trailing_comma.js @@ -0,0 +1 @@ +({x, ...rest,}); diff --git a/lib/test/flow/object-literal-spread/spread_is_last_trailing_comma.tree.json b/lib/test/flow/object-literal-spread/spread_is_last_trailing_comma.tree.json new file mode 100644 index 0000000..c0972ba --- /dev/null +++ b/lib/test/flow/object-literal-spread/spread_is_last_trailing_comma.tree.json @@ -0,0 +1,59 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "expression":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":14}}, + "range":[1,14], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "range":[2,3], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "range":[2,3], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "range":[2,3], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + }, + { + "type":"SpreadProperty", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, + "range":[5,12], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":12}}, + "range":[8,12], + "name":"rest", + "typeAnnotation":null, + "optional":false + } + } + ] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/optional_chaining/class-constructor-call.js b/lib/test/flow/optional_chaining/class-constructor-call.js new file mode 100644 index 0000000..39c849c --- /dev/null +++ b/lib/test/flow/optional_chaining/class-constructor-call.js @@ -0,0 +1,13 @@ +new C?.() + +new C?.(a, b) + +new B?.C?.() + +new B?.C?.(a, b) + +new B?.C + +new B?.C() + +new C?.b.d() diff --git a/lib/test/flow/optional_chaining/class-constructor-call.options.json b/lib/test/flow/optional_chaining/class-constructor-call.options.json new file mode 100644 index 0000000..6b03755 --- /dev/null +++ b/lib/test/flow/optional_chaining/class-constructor-call.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_optional_chaining": true +} diff --git a/lib/test/flow/optional_chaining/class-constructor-call.tree.json b/lib/test/flow/optional_chaining/class-constructor-call.tree.json new file mode 100644 index 0000000..dde2907 --- /dev/null +++ b/lib/test/flow/optional_chaining/class-constructor-call.tree.json @@ -0,0 +1,310 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, + "message":"An optional chain may not be used in a `new` expression." + }, + { + "loc":{"source":null,"start":{"line":3,"column":5},"end":{"line":3,"column":7}}, + "message":"An optional chain may not be used in a `new` expression." + }, + { + "loc":{"source":null,"start":{"line":5,"column":5},"end":{"line":5,"column":7}}, + "message":"An optional chain may not be used in a `new` expression." + }, + { + "loc":{"source":null,"start":{"line":5,"column":8},"end":{"line":5,"column":10}}, + "message":"An optional chain may not be used in a `new` expression." + }, + { + "loc":{"source":null,"start":{"line":7,"column":5},"end":{"line":7,"column":7}}, + "message":"An optional chain may not be used in a `new` expression." + }, + { + "loc":{"source":null,"start":{"line":7,"column":8},"end":{"line":7,"column":10}}, + "message":"An optional chain may not be used in a `new` expression." + }, + { + "loc":{"source":null,"start":{"line":9,"column":5},"end":{"line":9,"column":7}}, + "message":"An optional chain may not be used in a `new` expression." + }, + { + "loc":{"source":null,"start":{"line":11,"column":5},"end":{"line":11,"column":7}}, + "message":"An optional chain may not be used in a `new` expression." + }, + { + "loc":{"source":null,"start":{"line":13,"column":5},"end":{"line":13,"column":7}}, + "message":"An optional chain may not be used in a `new` expression." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":13,"column":12}}, + "range":[0,92], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "range":[0,9], + "expression":{ + "type":"NewExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "range":[0,9], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "arguments":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":13}}, + "range":[11,24], + "expression":{ + "type":"NewExpression", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":13}}, + "range":[11,24], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":5}}, + "range":[15,16], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "arguments":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":9}}, + "range":[19,20], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":11},"end":{"line":3,"column":12}}, + "range":[22,23], + "name":"b", + "typeAnnotation":null, + "optional":false + } + ] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":12}}, + "range":[26,38], + "expression":{ + "type":"NewExpression", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":12}}, + "range":[26,38], + "callee":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":5,"column":4},"end":{"line":5,"column":8}}, + "range":[30,34], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":4},"end":{"line":5,"column":5}}, + "range":[30,31], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":7},"end":{"line":5,"column":8}}, + "range":[33,34], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":true + }, + "arguments":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":16}}, + "range":[40,56], + "expression":{ + "type":"NewExpression", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":16}}, + "range":[40,56], + "callee":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":7,"column":4},"end":{"line":7,"column":8}}, + "range":[44,48], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":4},"end":{"line":7,"column":5}}, + "range":[44,45], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":7},"end":{"line":7,"column":8}}, + "range":[47,48], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":true + }, + "arguments":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":11},"end":{"line":7,"column":12}}, + "range":[51,52], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":14},"end":{"line":7,"column":15}}, + "range":[54,55], + "name":"b", + "typeAnnotation":null, + "optional":false + } + ] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":9,"column":8}}, + "range":[58,66], + "expression":{ + "type":"NewExpression", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":9,"column":8}}, + "range":[58,66], + "callee":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":9,"column":4},"end":{"line":9,"column":8}}, + "range":[62,66], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":4},"end":{"line":9,"column":5}}, + "range":[62,63], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":7},"end":{"line":9,"column":8}}, + "range":[65,66], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":true + }, + "arguments":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":11,"column":10}}, + "range":[68,78], + "expression":{ + "type":"NewExpression", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":11,"column":10}}, + "range":[68,78], + "callee":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":11,"column":4},"end":{"line":11,"column":8}}, + "range":[72,76], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":11,"column":4},"end":{"line":11,"column":5}}, + "range":[72,73], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":11,"column":7},"end":{"line":11,"column":8}}, + "range":[75,76], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":true + }, + "arguments":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":13,"column":0},"end":{"line":13,"column":12}}, + "range":[80,92], + "expression":{ + "type":"NewExpression", + "loc":{"source":null,"start":{"line":13,"column":0},"end":{"line":13,"column":12}}, + "range":[80,92], + "callee":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":13,"column":4},"end":{"line":13,"column":10}}, + "range":[84,90], + "object":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":13,"column":4},"end":{"line":13,"column":8}}, + "range":[84,88], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":13,"column":4},"end":{"line":13,"column":5}}, + "range":[84,85], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":13,"column":7},"end":{"line":13,"column":8}}, + "range":[87,88], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":true + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":13,"column":9},"end":{"line":13,"column":10}}, + "range":[89,90], + "name":"d", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":false + }, + "arguments":[] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/optional_chaining/conditional-decimal.js b/lib/test/flow/optional_chaining/conditional-decimal.js new file mode 100644 index 0000000..cc7524a --- /dev/null +++ b/lib/test/flow/optional_chaining/conditional-decimal.js @@ -0,0 +1,5 @@ +true?.3:0 + +true ? .3 : 0 + +true ?. 3 : 0 diff --git a/lib/test/flow/optional_chaining/conditional-decimal.options.json b/lib/test/flow/optional_chaining/conditional-decimal.options.json new file mode 100644 index 0000000..6b03755 --- /dev/null +++ b/lib/test/flow/optional_chaining/conditional-decimal.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_optional_chaining": true +} diff --git a/lib/test/flow/optional_chaining/conditional-decimal.tree.json b/lib/test/flow/optional_chaining/conditional-decimal.tree.json new file mode 100644 index 0000000..c556756 --- /dev/null +++ b/lib/test/flow/optional_chaining/conditional-decimal.tree.json @@ -0,0 +1,127 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":5,"column":8},"end":{"line":5,"column":9}}, + "message":"Unexpected number, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":5,"column":10},"end":{"line":5,"column":11}}, + "message":"Unexpected token `:`, expected the end of an expression statement (`;`)" + }, + { + "loc":{"source":null,"start":{"line":5,"column":10},"end":{"line":5,"column":11}}, + "message":"Unexpected token `:`, expected the start of a statement" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":5,"column":13}}, + "range":[0,39], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "range":[0,9], + "expression":{ + "type":"ConditionalExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "range":[0,9], + "test":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "value":true, + "raw":"true" + }, + "consequent":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, + "range":[5,7], + "value":0.3, + "raw":".3" + }, + "alternate":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "value":0, + "raw":"0" + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":13}}, + "range":[11,24], + "expression":{ + "type":"ConditionalExpression", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":13}}, + "range":[11,24], + "test":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":4}}, + "range":[11,15], + "value":true, + "raw":"true" + }, + "consequent":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":7},"end":{"line":3,"column":9}}, + "range":[18,20], + "value":0.3, + "raw":".3" + }, + "alternate":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":12},"end":{"line":3,"column":13}}, + "range":[23,24], + "value":0, + "raw":"0" + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":9}}, + "range":[26,35], + "expression":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":9}}, + "range":[26,35], + "object":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":4}}, + "range":[26,30], + "value":true, + "raw":"true" + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":8},"end":{"line":5,"column":9}}, + "range":[34,35], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":true + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":5,"column":12},"end":{"line":5,"column":13}}, + "range":[38,39], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":5,"column":12},"end":{"line":5,"column":13}}, + "range":[38,39], + "value":0, + "raw":"0" + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/optional_chaining/function-call.js b/lib/test/flow/optional_chaining/function-call.js new file mode 100644 index 0000000..26a411d --- /dev/null +++ b/lib/test/flow/optional_chaining/function-call.js @@ -0,0 +1,17 @@ +func?.() + +func?.(a, b) + +a?.func?.() + +a?.func?.(a, b) + +a.func?.() + +func?.()() + +func?.().a + +func?.()?.() + +func?.()?.a diff --git a/lib/test/flow/optional_chaining/function-call.options.json b/lib/test/flow/optional_chaining/function-call.options.json new file mode 100644 index 0000000..6b03755 --- /dev/null +++ b/lib/test/flow/optional_chaining/function-call.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_optional_chaining": true +} diff --git a/lib/test/flow/optional_chaining/function-call.tree.json b/lib/test/flow/optional_chaining/function-call.tree.json new file mode 100644 index 0000000..6f09d20 --- /dev/null +++ b/lib/test/flow/optional_chaining/function-call.tree.json @@ -0,0 +1,506 @@ +{ + "type":"Program", + "loc":{ + "source":null, + "start":{"line":1,"column":0}, + "end":{"line":17,"column":11} + }, + "range":[0,115], + "body":[ + { + "type":"ExpressionStatement", + "loc":{ + "source":null, + "start":{"line":1,"column":0}, + "end":{"line":1,"column":8} + }, + "range":[0,8], + "expression":{ + "type":"OptionalCallExpression", + "loc":{ + "source":null, + "start":{"line":1,"column":0}, + "end":{"line":1,"column":8} + }, + "range":[0,8], + "callee":{ + "type":"Identifier", + "loc":{ + "source":null, + "start":{"line":1,"column":0}, + "end":{"line":1,"column":4} + }, + "range":[0,4], + "name":"func", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[], + "optional":true + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{ + "source":null, + "start":{"line":3,"column":0}, + "end":{"line":3,"column":12} + }, + "range":[10,22], + "expression":{ + "type":"OptionalCallExpression", + "loc":{ + "source":null, + "start":{"line":3,"column":0}, + "end":{"line":3,"column":12} + }, + "range":[10,22], + "callee":{ + "type":"Identifier", + "loc":{ + "source":null, + "start":{"line":3,"column":0}, + "end":{"line":3,"column":4} + }, + "range":[10,14], + "name":"func", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[ + { + "type":"Identifier", + "loc":{ + "source":null, + "start":{"line":3,"column":7}, + "end":{"line":3,"column":8} + }, + "range":[17,18], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{ + "source":null, + "start":{"line":3,"column":10}, + "end":{"line":3,"column":11} + }, + "range":[20,21], + "name":"b", + "typeAnnotation":null, + "optional":false + } + ], + "optional":true + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{ + "source":null, + "start":{"line":5,"column":0}, + "end":{"line":5,"column":11} + }, + "range":[24,35], + "expression":{ + "type":"OptionalCallExpression", + "loc":{ + "source":null, + "start":{"line":5,"column":0}, + "end":{"line":5,"column":11} + }, + "range":[24,35], + "callee":{ + "type":"OptionalMemberExpression", + "loc":{ + "source":null, + "start":{"line":5,"column":0}, + "end":{"line":5,"column":7} + }, + "range":[24,31], + "object":{ + "type":"Identifier", + "loc":{ + "source":null, + "start":{"line":5,"column":0}, + "end":{"line":5,"column":1} + }, + "range":[24,25], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{ + "source":null, + "start":{"line":5,"column":3}, + "end":{"line":5,"column":7} + }, + "range":[27,31], + "name":"func", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":true + }, + "typeArguments":null, + "arguments":[], + "optional":true + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{ + "source":null, + "start":{"line":7,"column":0}, + "end":{"line":7,"column":15} + }, + "range":[37,52], + "expression":{ + "type":"OptionalCallExpression", + "loc":{ + "source":null, + "start":{"line":7,"column":0}, + "end":{"line":7,"column":15} + }, + "range":[37,52], + "callee":{ + "type":"OptionalMemberExpression", + "loc":{ + "source":null, + "start":{"line":7,"column":0}, + "end":{"line":7,"column":7} + }, + "range":[37,44], + "object":{ + "type":"Identifier", + "loc":{ + "source":null, + "start":{"line":7,"column":0}, + "end":{"line":7,"column":1} + }, + "range":[37,38], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{ + "source":null, + "start":{"line":7,"column":3}, + "end":{"line":7,"column":7} + }, + "range":[40,44], + "name":"func", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":true + }, + "typeArguments":null, + "arguments":[ + { + "type":"Identifier", + "loc":{ + "source":null, + "start":{"line":7,"column":10}, + "end":{"line":7,"column":11} + }, + "range":[47,48], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{ + "source":null, + "start":{"line":7,"column":13}, + "end":{"line":7,"column":14} + }, + "range":[50,51], + "name":"b", + "typeAnnotation":null, + "optional":false + } + ], + "optional":true + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{ + "source":null, + "start":{"line":9,"column":0}, + "end":{"line":9,"column":10} + }, + "range":[54,64], + "expression":{ + "type":"OptionalCallExpression", + "loc":{ + "source":null, + "start":{"line":9,"column":0}, + "end":{"line":9,"column":10} + }, + "range":[54,64], + "callee":{ + "type":"MemberExpression", + "loc":{ + "source":null, + "start":{"line":9,"column":0}, + "end":{"line":9,"column":6} + }, + "range":[54,60], + "object":{ + "type":"Identifier", + "loc":{ + "source":null, + "start":{"line":9,"column":0}, + "end":{"line":9,"column":1} + }, + "range":[54,55], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{ + "source":null, + "start":{"line":9,"column":2}, + "end":{"line":9,"column":6} + }, + "range":[56,60], + "name":"func", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "typeArguments":null, + "arguments":[], + "optional":true + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{ + "source":null, + "start":{"line":11,"column":0}, + "end":{"line":11,"column":10} + }, + "range":[66,76], + "expression":{ + "type":"OptionalCallExpression", + "loc":{ + "source":null, + "start":{"line":11,"column":0}, + "end":{"line":11,"column":10} + }, + "range":[66,76], + "callee":{ + "type":"OptionalCallExpression", + "loc":{ + "source":null, + "start":{"line":11,"column":0}, + "end":{"line":11,"column":8} + }, + "range":[66,74], + "callee":{ + "type":"Identifier", + "loc":{ + "source":null, + "start":{"line":11,"column":0}, + "end":{"line":11,"column":4} + }, + "range":[66,70], + "name":"func", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[], + "optional":true + }, + "typeArguments":null, + "arguments":[], + "optional":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{ + "source":null, + "start":{"line":13,"column":0}, + "end":{"line":13,"column":10} + }, + "range":[78,88], + "expression":{ + "type":"OptionalMemberExpression", + "loc":{ + "source":null, + "start":{"line":13,"column":0}, + "end":{"line":13,"column":10} + }, + "range":[78,88], + "object":{ + "type":"OptionalCallExpression", + "loc":{ + "source":null, + "start":{"line":13,"column":0}, + "end":{"line":13,"column":8} + }, + "range":[78,86], + "callee":{ + "type":"Identifier", + "loc":{ + "source":null, + "start":{"line":13,"column":0}, + "end":{"line":13,"column":4} + }, + "range":[78,82], + "name":"func", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[], + "optional":true + }, + "property":{ + "type":"Identifier", + "loc":{ + "source":null, + "start":{"line":13,"column":9}, + "end":{"line":13,"column":10} + }, + "range":[87,88], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{ + "source":null, + "start":{"line":15,"column":0}, + "end":{"line":15,"column":12} + }, + "range":[90,102], + "expression":{ + "type":"OptionalCallExpression", + "loc":{ + "source":null, + "start":{"line":15,"column":0}, + "end":{"line":15,"column":12} + }, + "range":[90,102], + "callee":{ + "type":"OptionalCallExpression", + "loc":{ + "source":null, + "start":{"line":15,"column":0}, + "end":{"line":15,"column":8} + }, + "range":[90,98], + "callee":{ + "type":"Identifier", + "loc":{ + "source":null, + "start":{"line":15,"column":0}, + "end":{"line":15,"column":4} + }, + "range":[90,94], + "name":"func", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[], + "optional":true + }, + "typeArguments":null, + "arguments":[], + "optional":true + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{ + "source":null, + "start":{"line":17,"column":0}, + "end":{"line":17,"column":11} + }, + "range":[104,115], + "expression":{ + "type":"OptionalMemberExpression", + "loc":{ + "source":null, + "start":{"line":17,"column":0}, + "end":{"line":17,"column":11} + }, + "range":[104,115], + "object":{ + "type":"OptionalCallExpression", + "loc":{ + "source":null, + "start":{"line":17,"column":0}, + "end":{"line":17,"column":8} + }, + "range":[104,112], + "callee":{ + "type":"Identifier", + "loc":{ + "source":null, + "start":{"line":17,"column":0}, + "end":{"line":17,"column":4} + }, + "range":[104,108], + "name":"func", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[], + "optional":true + }, + "property":{ + "type":"Identifier", + "loc":{ + "source":null, + "start":{"line":17,"column":10}, + "end":{"line":17,"column":11} + }, + "range":[114,115], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":true + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/optional_chaining/member-access-bracket.js b/lib/test/flow/optional_chaining/member-access-bracket.js new file mode 100644 index 0000000..de7015d --- /dev/null +++ b/lib/test/flow/optional_chaining/member-access-bracket.js @@ -0,0 +1,13 @@ +obj?.[expr] + +obj?.[expr]?.[other] + +obj?.[true] + +obj?.[true]?.[true] + +obj.a?.[expr] + +obj.a?.[true] + +obj?.["case"] diff --git a/lib/test/flow/optional_chaining/member-access-bracket.options.json b/lib/test/flow/optional_chaining/member-access-bracket.options.json new file mode 100644 index 0000000..6b03755 --- /dev/null +++ b/lib/test/flow/optional_chaining/member-access-bracket.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_optional_chaining": true +} diff --git a/lib/test/flow/optional_chaining/member-access-bracket.tree.json b/lib/test/flow/optional_chaining/member-access-bracket.tree.json new file mode 100644 index 0000000..b93ecf0 --- /dev/null +++ b/lib/test/flow/optional_chaining/member-access-bracket.tree.json @@ -0,0 +1,264 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":13,"column":13}}, + "range":[0,112], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "expression":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "name":"obj", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":10}}, + "range":[6,10], + "name":"expr", + "typeAnnotation":null, + "optional":false + }, + "computed":true, + "optional":true + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":20}}, + "range":[13,33], + "expression":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":20}}, + "range":[13,33], + "object":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":11}}, + "range":[13,24], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":3}}, + "range":[13,16], + "name":"obj", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":6},"end":{"line":3,"column":10}}, + "range":[19,23], + "name":"expr", + "typeAnnotation":null, + "optional":false + }, + "computed":true, + "optional":true + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":14},"end":{"line":3,"column":19}}, + "range":[27,32], + "name":"other", + "typeAnnotation":null, + "optional":false + }, + "computed":true, + "optional":true + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":11}}, + "range":[35,46], + "expression":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":11}}, + "range":[35,46], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":3}}, + "range":[35,38], + "name":"obj", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":5,"column":6},"end":{"line":5,"column":10}}, + "range":[41,45], + "value":true, + "raw":"true" + }, + "computed":true, + "optional":true + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":19}}, + "range":[48,67], + "expression":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":19}}, + "range":[48,67], + "object":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":11}}, + "range":[48,59], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":3}}, + "range":[48,51], + "name":"obj", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":7,"column":6},"end":{"line":7,"column":10}}, + "range":[54,58], + "value":true, + "raw":"true" + }, + "computed":true, + "optional":true + }, + "property":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":7,"column":14},"end":{"line":7,"column":18}}, + "range":[62,66], + "value":true, + "raw":"true" + }, + "computed":true, + "optional":true + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":9,"column":13}}, + "range":[69,82], + "expression":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":9,"column":13}}, + "range":[69,82], + "object":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":9,"column":5}}, + "range":[69,74], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":9,"column":3}}, + "range":[69,72], + "name":"obj", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":4},"end":{"line":9,"column":5}}, + "range":[73,74], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":8},"end":{"line":9,"column":12}}, + "range":[77,81], + "name":"expr", + "typeAnnotation":null, + "optional":false + }, + "computed":true, + "optional":true + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":11,"column":13}}, + "range":[84,97], + "expression":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":11,"column":13}}, + "range":[84,97], + "object":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":11,"column":5}}, + "range":[84,89], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":11,"column":3}}, + "range":[84,87], + "name":"obj", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":11,"column":4},"end":{"line":11,"column":5}}, + "range":[88,89], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "property":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":11,"column":8},"end":{"line":11,"column":12}}, + "range":[92,96], + "value":true, + "raw":"true" + }, + "computed":true, + "optional":true + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":13,"column":0},"end":{"line":13,"column":13}}, + "range":[99,112], + "expression":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":13,"column":0},"end":{"line":13,"column":13}}, + "range":[99,112], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":13,"column":0},"end":{"line":13,"column":3}}, + "range":[99,102], + "name":"obj", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":13,"column":6},"end":{"line":13,"column":12}}, + "range":[105,111], + "value":"case", + "raw":"\"case\"" + }, + "computed":true, + "optional":true + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/optional_chaining/member-access.js b/lib/test/flow/optional_chaining/member-access.js new file mode 100644 index 0000000..9dea1ee --- /dev/null +++ b/lib/test/flow/optional_chaining/member-access.js @@ -0,0 +1,7 @@ +foo?.bar + +foo?.bar?.baz + +foo.bar?.baz + +foo?.case diff --git a/lib/test/flow/optional_chaining/member-access.options.json b/lib/test/flow/optional_chaining/member-access.options.json new file mode 100644 index 0000000..6b03755 --- /dev/null +++ b/lib/test/flow/optional_chaining/member-access.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_optional_chaining": true +} diff --git a/lib/test/flow/optional_chaining/member-access.tree.json b/lib/test/flow/optional_chaining/member-access.tree.json new file mode 100644 index 0000000..ff95ba7 --- /dev/null +++ b/lib/test/flow/optional_chaining/member-access.tree.json @@ -0,0 +1,153 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":7,"column":9}}, + "range":[0,48], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "range":[0,8], + "expression":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "range":[0,8], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, + "range":[5,8], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":true + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":13}}, + "range":[10,23], + "expression":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":13}}, + "range":[10,23], + "object":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":8}}, + "range":[10,18], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":3}}, + "range":[10,13], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":5},"end":{"line":3,"column":8}}, + "range":[15,18], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":true + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":10},"end":{"line":3,"column":13}}, + "range":[20,23], + "name":"baz", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":true + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":12}}, + "range":[25,37], + "expression":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":12}}, + "range":[25,37], + "object":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":7}}, + "range":[25,32], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":3}}, + "range":[25,28], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":4},"end":{"line":5,"column":7}}, + "range":[29,32], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":9},"end":{"line":5,"column":12}}, + "range":[34,37], + "name":"baz", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":true + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":9}}, + "range":[39,48], + "expression":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":9}}, + "range":[39,48], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":3}}, + "range":[39,42], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":5},"end":{"line":7,"column":9}}, + "range":[44,48], + "name":"case", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":true + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/optional_chaining/missing-plugin.js b/lib/test/flow/optional_chaining/missing-plugin.js new file mode 100644 index 0000000..2807546 --- /dev/null +++ b/lib/test/flow/optional_chaining/missing-plugin.js @@ -0,0 +1 @@ +a?.b diff --git a/lib/test/flow/optional_chaining/missing-plugin.tree.json b/lib/test/flow/optional_chaining/missing-plugin.tree.json new file mode 100644 index 0000000..2089679 --- /dev/null +++ b/lib/test/flow/optional_chaining/missing-plugin.tree.json @@ -0,0 +1,43 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":3}}, + "message":"The optional chaining plugin must be enabled in order to use the optional chaining operator (`?.`). Optional chaining is an active early-stage feature proposal which may change and is not enabled by default. To enable support in the parser, use the `esproposal_optional_chaining` option." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "expression":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":4}}, + "range":[3,4], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":true + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/optional_chaining/optional-chain-expression.js b/lib/test/flow/optional_chaining/optional-chain-expression.js new file mode 100644 index 0000000..892df0d --- /dev/null +++ b/lib/test/flow/optional_chaining/optional-chain-expression.js @@ -0,0 +1 @@ +a.b?.c() diff --git a/lib/test/flow/optional_chaining/optional-chain-expression.options.json b/lib/test/flow/optional_chaining/optional-chain-expression.options.json new file mode 100644 index 0000000..6b03755 --- /dev/null +++ b/lib/test/flow/optional_chaining/optional-chain-expression.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_optional_chaining": true +} diff --git a/lib/test/flow/optional_chaining/optional-chain-expression.tree.json b/lib/test/flow/optional_chaining/optional-chain-expression.tree.json new file mode 100644 index 0000000..d472bda --- /dev/null +++ b/lib/test/flow/optional_chaining/optional-chain-expression.tree.json @@ -0,0 +1,58 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "range":[0,8], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "range":[0,8], + "expression":{ + "type":"OptionalCallExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "range":[0,8], + "callee":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "object":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "range":[2,3], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"c", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":true + }, + "arguments":[], + "optional":false + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/optional_chaining/parenthesized-chain.js b/lib/test/flow/optional_chaining/parenthesized-chain.js new file mode 100644 index 0000000..25c4e57 --- /dev/null +++ b/lib/test/flow/optional_chaining/parenthesized-chain.js @@ -0,0 +1,9 @@ +(a?.b).c; + +(a?.b).c(); + +(a?.b)?.c.d?.e; + +(a?.())(); + +(a?.()).b; diff --git a/lib/test/flow/optional_chaining/parenthesized-chain.options.json b/lib/test/flow/optional_chaining/parenthesized-chain.options.json new file mode 100644 index 0000000..6b03755 --- /dev/null +++ b/lib/test/flow/optional_chaining/parenthesized-chain.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_optional_chaining": true +} diff --git a/lib/test/flow/optional_chaining/parenthesized-chain.tree.json b/lib/test/flow/optional_chaining/parenthesized-chain.tree.json new file mode 100644 index 0000000..3676980 --- /dev/null +++ b/lib/test/flow/optional_chaining/parenthesized-chain.tree.json @@ -0,0 +1,372 @@ +{ + "type":"Program", + "loc":{ + "source":null, + "start":{"line":1,"column":0}, + "end":{"line":9,"column":10} + }, + "range":[0,63], + "body":[ + { + "type":"ExpressionStatement", + "loc":{ + "source":null, + "start":{"line":1,"column":0}, + "end":{"line":1,"column":9} + }, + "range":[0,9], + "expression":{ + "type":"MemberExpression", + "loc":{ + "source":null, + "start":{"line":1,"column":0}, + "end":{"line":1,"column":8} + }, + "range":[0,8], + "object":{ + "type":"OptionalMemberExpression", + "loc":{ + "source":null, + "start":{"line":1,"column":1}, + "end":{"line":1,"column":5} + }, + "range":[1,5], + "object":{ + "type":"Identifier", + "loc":{ + "source":null, + "start":{"line":1,"column":1}, + "end":{"line":1,"column":2} + }, + "range":[1,2], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{ + "source":null, + "start":{"line":1,"column":4}, + "end":{"line":1,"column":5} + }, + "range":[4,5], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":true + }, + "property":{ + "type":"Identifier", + "loc":{ + "source":null, + "start":{"line":1,"column":7}, + "end":{"line":1,"column":8} + }, + "range":[7,8], + "name":"c", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{ + "source":null, + "start":{"line":3,"column":0}, + "end":{"line":3,"column":11} + }, + "range":[11,22], + "expression":{ + "type":"CallExpression", + "loc":{ + "source":null, + "start":{"line":3,"column":0}, + "end":{"line":3,"column":10} + }, + "range":[11,21], + "callee":{ + "type":"MemberExpression", + "loc":{ + "source":null, + "start":{"line":3,"column":0}, + "end":{"line":3,"column":8} + }, + "range":[11,19], + "object":{ + "type":"OptionalMemberExpression", + "loc":{ + "source":null, + "start":{"line":3,"column":1}, + "end":{"line":3,"column":5} + }, + "range":[12,16], + "object":{ + "type":"Identifier", + "loc":{ + "source":null, + "start":{"line":3,"column":1}, + "end":{"line":3,"column":2} + }, + "range":[12,13], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{ + "source":null, + "start":{"line":3,"column":4}, + "end":{"line":3,"column":5} + }, + "range":[15,16], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":true + }, + "property":{ + "type":"Identifier", + "loc":{ + "source":null, + "start":{"line":3,"column":7}, + "end":{"line":3,"column":8} + }, + "range":[18,19], + "name":"c", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "typeArguments":null, + "arguments":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{ + "source":null, + "start":{"line":5,"column":0}, + "end":{"line":5,"column":15} + }, + "range":[24,39], + "expression":{ + "type":"OptionalMemberExpression", + "loc":{ + "source":null, + "start":{"line":5,"column":0}, + "end":{"line":5,"column":14} + }, + "range":[24,38], + "object":{ + "type":"OptionalMemberExpression", + "loc":{ + "source":null, + "start":{"line":5,"column":0}, + "end":{"line":5,"column":11} + }, + "range":[24,35], + "object":{ + "type":"OptionalMemberExpression", + "loc":{ + "source":null, + "start":{"line":5,"column":0}, + "end":{"line":5,"column":9} + }, + "range":[24,33], + "object":{ + "type":"OptionalMemberExpression", + "loc":{ + "source":null, + "start":{"line":5,"column":1}, + "end":{"line":5,"column":5} + }, + "range":[25,29], + "object":{ + "type":"Identifier", + "loc":{ + "source":null, + "start":{"line":5,"column":1}, + "end":{"line":5,"column":2} + }, + "range":[25,26], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{ + "source":null, + "start":{"line":5,"column":4}, + "end":{"line":5,"column":5} + }, + "range":[28,29], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":true + }, + "property":{ + "type":"Identifier", + "loc":{ + "source":null, + "start":{"line":5,"column":8}, + "end":{"line":5,"column":9} + }, + "range":[32,33], + "name":"c", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":true + }, + "property":{ + "type":"Identifier", + "loc":{ + "source":null, + "start":{"line":5,"column":10}, + "end":{"line":5,"column":11} + }, + "range":[34,35], + "name":"d", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{ + "source":null, + "start":{"line":5,"column":13}, + "end":{"line":5,"column":14} + }, + "range":[37,38], + "name":"e", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":true + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{ + "source":null, + "start":{"line":7,"column":0}, + "end":{"line":7,"column":10} + }, + "range":[41,51], + "expression":{ + "type":"CallExpression", + "loc":{ + "source":null, + "start":{"line":7,"column":0}, + "end":{"line":7,"column":9} + }, + "range":[41,50], + "callee":{ + "type":"OptionalCallExpression", + "loc":{ + "source":null, + "start":{"line":7,"column":1}, + "end":{"line":7,"column":6} + }, + "range":[42,47], + "callee":{ + "type":"Identifier", + "loc":{ + "source":null, + "start":{"line":7,"column":1}, + "end":{"line":7,"column":2} + }, + "range":[42,43], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[], + "optional":true + }, + "typeArguments":null, + "arguments":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{ + "source":null, + "start":{"line":9,"column":0}, + "end":{"line":9,"column":10} + }, + "range":[53,63], + "expression":{ + "type":"MemberExpression", + "loc":{ + "source":null, + "start":{"line":9,"column":0}, + "end":{"line":9,"column":9} + }, + "range":[53,62], + "object":{ + "type":"OptionalCallExpression", + "loc":{ + "source":null, + "start":{"line":9,"column":1}, + "end":{"line":9,"column":6} + }, + "range":[54,59], + "callee":{ + "type":"Identifier", + "loc":{ + "source":null, + "start":{"line":9,"column":1}, + "end":{"line":9,"column":2} + }, + "range":[54,55], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[], + "optional":true + }, + "property":{ + "type":"Identifier", + "loc":{ + "source":null, + "start":{"line":9,"column":8}, + "end":{"line":9,"column":9} + }, + "range":[61,62], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/optional_chaining/separated-chaining.js b/lib/test/flow/optional_chaining/separated-chaining.js new file mode 100644 index 0000000..41f0670 --- /dev/null +++ b/lib/test/flow/optional_chaining/separated-chaining.js @@ -0,0 +1,3 @@ +a?.b.c.d.e?.f + +a.b.c?.d.e.f diff --git a/lib/test/flow/optional_chaining/separated-chaining.options.json b/lib/test/flow/optional_chaining/separated-chaining.options.json new file mode 100644 index 0000000..6b03755 --- /dev/null +++ b/lib/test/flow/optional_chaining/separated-chaining.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_optional_chaining": true +} diff --git a/lib/test/flow/optional_chaining/separated-chaining.tree.json b/lib/test/flow/optional_chaining/separated-chaining.tree.json new file mode 100644 index 0000000..46c0f2a --- /dev/null +++ b/lib/test/flow/optional_chaining/separated-chaining.tree.json @@ -0,0 +1,184 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":12}}, + "range":[0,27], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "object":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "object":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "range":[0,8], + "object":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "object":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":4}}, + "range":[3,4], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":true + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"c", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "range":[7,8], + "name":"d", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "name":"e", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":true + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":12}}, + "range":[15,27], + "expression":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":12}}, + "range":[15,27], + "object":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":10}}, + "range":[15,25], + "object":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":8}}, + "range":[15,23], + "object":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":5}}, + "range":[15,20], + "object":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":3}}, + "range":[15,18], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":1}}, + "range":[15,16], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "range":[17,18], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":5}}, + "range":[19,20], + "name":"c", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":7},"end":{"line":3,"column":8}}, + "range":[22,23], + "name":"d", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":true + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":9},"end":{"line":3,"column":10}}, + "range":[24,25], + "name":"e", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":11},"end":{"line":3,"column":12}}, + "range":[26,27], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":false + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/optional_chaining/template-literals.js b/lib/test/flow/optional_chaining/template-literals.js new file mode 100644 index 0000000..a5c0182 --- /dev/null +++ b/lib/test/flow/optional_chaining/template-literals.js @@ -0,0 +1,7 @@ +a?.`{b}` + +a?.b`{c}` + +a?.b(c`{d}`) + +a?.[b`{c}`] diff --git a/lib/test/flow/optional_chaining/template-literals.options.json b/lib/test/flow/optional_chaining/template-literals.options.json new file mode 100644 index 0000000..6b03755 --- /dev/null +++ b/lib/test/flow/optional_chaining/template-literals.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_optional_chaining": true +} diff --git a/lib/test/flow/optional_chaining/template-literals.tree.json b/lib/test/flow/optional_chaining/template-literals.tree.json new file mode 100644 index 0000000..d2093e4 --- /dev/null +++ b/lib/test/flow/optional_chaining/template-literals.tree.json @@ -0,0 +1,221 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":8}}, + "message":"Template literals may not be used in an optional chain." + }, + { + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":8}}, + "message":"Unexpected template literal part, expected the end of an expression statement (`;`)" + }, + { + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":9}}, + "message":"Template literals may not be used in an optional chain." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":7,"column":11}}, + "range":[0,46], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":8}}, + "range":[3,8], + "expression":{ + "type":"TemplateLiteral", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":8}}, + "range":[3,8], + "quasis":[ + { + "type":"TemplateElement", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":8}}, + "range":[3,8], + "value":{"raw":"{b}","cooked":"{b}"}, + "tail":true + } + ], + "expressions":[] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":9}}, + "range":[10,19], + "expression":{ + "type":"TaggedTemplateExpression", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":9}}, + "range":[10,19], + "tag":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":4}}, + "range":[10,14], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":1}}, + "range":[10,11], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":3},"end":{"line":3,"column":4}}, + "range":[13,14], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":true + }, + "quasi":{ + "type":"TemplateLiteral", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":9}}, + "range":[14,19], + "quasis":[ + { + "type":"TemplateElement", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":9}}, + "range":[14,19], + "value":{"raw":"{c}","cooked":"{c}"}, + "tail":true + } + ], + "expressions":[] + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":12}}, + "range":[21,33], + "expression":{ + "type":"OptionalCallExpression", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":12}}, + "range":[21,33], + "callee":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":4}}, + "range":[21,25], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":1}}, + "range":[21,22], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":3},"end":{"line":5,"column":4}}, + "range":[24,25], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":true + }, + "typeArguments":null, + "arguments":[ + { + "type":"TaggedTemplateExpression", + "loc":{"source":null,"start":{"line":5,"column":5},"end":{"line":5,"column":11}}, + "range":[26,32], + "tag":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":5},"end":{"line":5,"column":6}}, + "range":[26,27], + "name":"c", + "typeAnnotation":null, + "optional":false + }, + "quasi":{ + "type":"TemplateLiteral", + "loc":{"source":null,"start":{"line":5,"column":6},"end":{"line":5,"column":11}}, + "range":[27,32], + "quasis":[ + { + "type":"TemplateElement", + "loc":{"source":null,"start":{"line":5,"column":6},"end":{"line":5,"column":11}}, + "range":[27,32], + "value":{"raw":"{d}","cooked":"{d}"}, + "tail":true + } + ], + "expressions":[] + } + } + ], + "optional":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":11}}, + "range":[35,46], + "expression":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":11}}, + "range":[35,46], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":1}}, + "range":[35,36], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"TaggedTemplateExpression", + "loc":{"source":null,"start":{"line":7,"column":4},"end":{"line":7,"column":10}}, + "range":[39,45], + "tag":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":4},"end":{"line":7,"column":5}}, + "range":[39,40], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "quasi":{ + "type":"TemplateLiteral", + "loc":{"source":null,"start":{"line":7,"column":5},"end":{"line":7,"column":10}}, + "range":[40,45], + "quasis":[ + { + "type":"TemplateElement", + "loc":{"source":null,"start":{"line":7,"column":5},"end":{"line":7,"column":10}}, + "range":[40,45], + "value":{"raw":"{c}","cooked":"{c}"}, + "tail":true + } + ], + "expressions":[] + } + }, + "computed":true, + "optional":true + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/private_class_properties/constructor.js b/lib/test/flow/private_class_properties/constructor.js new file mode 100644 index 0000000..ea18a92 --- /dev/null +++ b/lib/test/flow/private_class_properties/constructor.js @@ -0,0 +1,15 @@ +class A { + #constructor() {} // Error, no private methods +} + +class B { + static #constructor() {} // Error, no private methods +} + +class C { + #constructor: number // Error, no field named constructor +} + +class D { + static #constructor: number // Error, no field named constructor +} diff --git a/lib/test/flow/private_class_properties/constructor.tree.json b/lib/test/flow/private_class_properties/constructor.tree.json new file mode 100644 index 0000000..43be1be --- /dev/null +++ b/lib/test/flow/private_class_properties/constructor.tree.json @@ -0,0 +1,285 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":19}}, + "message":"Classes may not have private methods." + }, + { + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":26}}, + "message":"Classes may not have private methods." + }, + { + "loc":{"source":null,"start":{"line":10,"column":2},"end":{"line":10,"column":14}}, + "message":"Classes may not have fields named `#constructor`." + }, + { + "loc":{"source":null,"start":{"line":14,"column":9},"end":{"line":14,"column":21}}, + "message":"Classes may not have fields named `#constructor`." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":15,"column":1}}, + "range":[0,282], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,60], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "range":[8,60], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":19}}, + "range":[12,29], + "key":{ + "type":"PrivateName", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, + "range":[12,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":14}}, + "range":[13,24], + "name":"constructor", + "typeAnnotation":null, + "optional":false + } + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":19}}, + "range":[24,29], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":19}}, + "range":[27,29], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":7,"column":1}}, + "range":[62,129], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":6},"end":{"line":5,"column":7}}, + "range":[68,69], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":5,"column":8},"end":{"line":7,"column":1}}, + "range":[70,129], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":26}}, + "range":[74,98], + "key":{ + "type":"PrivateName", + "loc":{"source":null,"start":{"line":6,"column":9},"end":{"line":6,"column":21}}, + "range":[81,93], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":10},"end":{"line":6,"column":21}}, + "range":[82,93], + "name":"constructor", + "typeAnnotation":null, + "optional":false + } + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":6,"column":21},"end":{"line":6,"column":26}}, + "range":[93,98], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":6,"column":24},"end":{"line":6,"column":26}}, + "range":[96,98], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":true, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":11,"column":1}}, + "range":[131,202], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":6},"end":{"line":9,"column":7}}, + "range":[137,138], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":9,"column":8},"end":{"line":11,"column":1}}, + "range":[139,202], + "body":[ + { + "type":"ClassPrivateProperty", + "loc":{"source":null,"start":{"line":10,"column":2},"end":{"line":10,"column":22}}, + "range":[143,163], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":10,"column":3},"end":{"line":10,"column":14}}, + "range":[144,155], + "name":"constructor", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":10,"column":14},"end":{"line":10,"column":22}}, + "range":[155,163], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":10,"column":16},"end":{"line":10,"column":22}}, + "range":[157,163] + } + }, + "static":false, + "variance":null + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":13,"column":0},"end":{"line":15,"column":1}}, + "range":[204,282], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":13,"column":6},"end":{"line":13,"column":7}}, + "range":[210,211], + "name":"D", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":13,"column":8},"end":{"line":15,"column":1}}, + "range":[212,282], + "body":[ + { + "type":"ClassPrivateProperty", + "loc":{"source":null,"start":{"line":14,"column":2},"end":{"line":14,"column":29}}, + "range":[216,243], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":14,"column":10},"end":{"line":14,"column":21}}, + "range":[224,235], + "name":"constructor", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":14,"column":21},"end":{"line":14,"column":29}}, + "range":[235,243], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":14,"column":23},"end":{"line":14,"column":29}}, + "range":[237,243] + } + }, + "static":true, + "variance":null + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":2,"column":20},"end":{"line":2,"column":48}}, + "range":[30,58], + "value":" Error, no private methods" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":6,"column":27},"end":{"line":6,"column":55}}, + "range":[99,127], + "value":" Error, no private methods" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":10,"column":23},"end":{"line":10,"column":59}}, + "range":[164,200], + "value":" Error, no field named constructor" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":14,"column":30},"end":{"line":14,"column":66}}, + "range":[244,280], + "value":" Error, no field named constructor" + } + ] +} diff --git a/lib/test/flow/private_class_properties/delete.js b/lib/test/flow/private_class_properties/delete.js new file mode 100644 index 0000000..53ef189 --- /dev/null +++ b/lib/test/flow/private_class_properties/delete.js @@ -0,0 +1,7 @@ +class A { + #p: number + constructor() { + delete this.#p; // Error can't delete private! + delete ((this.#p)) // Error, can't delete private + } +} diff --git a/lib/test/flow/private_class_properties/delete.tree.json b/lib/test/flow/private_class_properties/delete.tree.json new file mode 100644 index 0000000..eb2b945 --- /dev/null +++ b/lib/test/flow/private_class_properties/delete.tree.json @@ -0,0 +1,193 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":4,"column":4},"end":{"line":4,"column":18}}, + "message":"Private fields may not be deleted." + }, + { + "loc":{"source":null,"start":{"line":5,"column":4},"end":{"line":5,"column":22}}, + "message":"Private fields may not be deleted." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "range":[0,151], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "range":[0,151], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":7,"column":1}}, + "range":[8,151], + "body":[ + { + "type":"ClassPrivateProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, + "range":[12,22], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":4}}, + "range":[13,14], + "name":"p", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":12}}, + "range":[14,22], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":12}}, + "range":[16,22] + } + }, + "static":false, + "variance":null + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":6,"column":3}}, + "range":[25,149], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":13}}, + "range":[25,36], + "name":"constructor", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":3,"column":13},"end":{"line":6,"column":3}}, + "range":[36,149], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":16},"end":{"line":6,"column":3}}, + "range":[39,149], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":4,"column":4},"end":{"line":4,"column":19}}, + "range":[45,60], + "expression":{ + "type":"UnaryExpression", + "loc":{"source":null,"start":{"line":4,"column":4},"end":{"line":4,"column":18}}, + "range":[45,59], + "operator":"delete", + "prefix":true, + "argument":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":4,"column":11},"end":{"line":4,"column":18}}, + "range":[52,59], + "object":{ + "type":"ThisExpression", + "loc":{"source":null,"start":{"line":4,"column":11},"end":{"line":4,"column":15}}, + "range":[52,56] + }, + "property":{ + "type":"PrivateName", + "loc":{"source":null,"start":{"line":4,"column":16},"end":{"line":4,"column":18}}, + "range":[57,59], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":17},"end":{"line":4,"column":18}}, + "range":[58,59], + "name":"p", + "typeAnnotation":null, + "optional":false + } + }, + "computed":false + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":5,"column":4},"end":{"line":5,"column":22}}, + "range":[96,114], + "expression":{ + "type":"UnaryExpression", + "loc":{"source":null,"start":{"line":5,"column":4},"end":{"line":5,"column":22}}, + "range":[96,114], + "operator":"delete", + "prefix":true, + "argument":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":5,"column":13},"end":{"line":5,"column":20}}, + "range":[105,112], + "object":{ + "type":"ThisExpression", + "loc":{"source":null,"start":{"line":5,"column":13},"end":{"line":5,"column":17}}, + "range":[105,109] + }, + "property":{ + "type":"PrivateName", + "loc":{"source":null,"start":{"line":5,"column":18},"end":{"line":5,"column":20}}, + "range":[110,112], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":19},"end":{"line":5,"column":20}}, + "range":[111,112], + "name":"p", + "typeAnnotation":null, + "optional":false + } + }, + "computed":false + } + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"constructor", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":4,"column":20},"end":{"line":4,"column":50}}, + "range":[61,91], + "value":" Error can't delete private!" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":5,"column":23},"end":{"line":5,"column":53}}, + "range":[115,145], + "value":" Error, can't delete private" + } + ] +} diff --git a/lib/test/flow/private_class_properties/getter.js b/lib/test/flow/private_class_properties/getter.js new file mode 100644 index 0000000..d49b9e9 --- /dev/null +++ b/lib/test/flow/private_class_properties/getter.js @@ -0,0 +1,3 @@ +class C { + get #m() {} +} diff --git a/lib/test/flow/private_class_properties/getter.tree.json b/lib/test/flow/private_class_properties/getter.tree.json new file mode 100644 index 0000000..f8cac0f --- /dev/null +++ b/lib/test/flow/private_class_properties/getter.tree.json @@ -0,0 +1,74 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,25], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,25], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "range":[8,25], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, + "range":[12,23], + "key":{ + "type":"PrivateName", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":8}}, + "range":[16,18], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":8}}, + "range":[17,18], + "name":"m", + "typeAnnotation":null, + "optional":false + } + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":13}}, + "range":[18,23], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":13}}, + "range":[21,23], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"get", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/private_class_properties/getter_and_field.js b/lib/test/flow/private_class_properties/getter_and_field.js new file mode 100644 index 0000000..ca9573f --- /dev/null +++ b/lib/test/flow/private_class_properties/getter_and_field.js @@ -0,0 +1,4 @@ +class C { + #m; + get #m() {} +} diff --git a/lib/test/flow/private_class_properties/getter_and_field.tree.json b/lib/test/flow/private_class_properties/getter_and_field.tree.json new file mode 100644 index 0000000..1395dfd --- /dev/null +++ b/lib/test/flow/private_class_properties/getter_and_field.tree.json @@ -0,0 +1,97 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":3,"column":6},"end":{"line":3,"column":8}}, + "message":"Private fields may only be declared once. `#m` is declared more than once." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,31], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "range":[8,31], + "body":[ + { + "type":"ClassPrivateProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "range":[12,15], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":4}}, + "range":[13,14], + "name":"m", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":null, + "static":false, + "variance":null + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":13}}, + "range":[18,29], + "key":{ + "type":"PrivateName", + "loc":{"source":null,"start":{"line":3,"column":6},"end":{"line":3,"column":8}}, + "range":[22,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":7},"end":{"line":3,"column":8}}, + "range":[23,24], + "name":"m", + "typeAnnotation":null, + "optional":false + } + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":13}}, + "range":[24,29], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":11},"end":{"line":3,"column":13}}, + "range":[27,29], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"get", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/private_class_properties/getter_and_setter.js b/lib/test/flow/private_class_properties/getter_and_setter.js new file mode 100644 index 0000000..2facd0f --- /dev/null +++ b/lib/test/flow/private_class_properties/getter_and_setter.js @@ -0,0 +1,4 @@ +class C { + get #m() {} + set #m(x) {} +} diff --git a/lib/test/flow/private_class_properties/getter_and_setter.tree.json b/lib/test/flow/private_class_properties/getter_and_setter.tree.json new file mode 100644 index 0000000..841f3c6 --- /dev/null +++ b/lib/test/flow/private_class_properties/getter_and_setter.tree.json @@ -0,0 +1,124 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,40], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,40], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "range":[8,40], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, + "range":[12,23], + "key":{ + "type":"PrivateName", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":8}}, + "range":[16,18], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":8}}, + "range":[17,18], + "name":"m", + "typeAnnotation":null, + "optional":false + } + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":13}}, + "range":[18,23], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":13}}, + "range":[21,23], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"get", + "static":false, + "computed":false, + "decorators":[] + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":14}}, + "range":[26,38], + "key":{ + "type":"PrivateName", + "loc":{"source":null,"start":{"line":3,"column":6},"end":{"line":3,"column":8}}, + "range":[30,32], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":7},"end":{"line":3,"column":8}}, + "range":[31,32], + "name":"m", + "typeAnnotation":null, + "optional":false + } + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":14}}, + "range":[32,38], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":9},"end":{"line":3,"column":10}}, + "range":[33,34], + "name":"x", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":12},"end":{"line":3,"column":14}}, + "range":[36,38], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"set", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/private_class_properties/getter_duplicate.js b/lib/test/flow/private_class_properties/getter_duplicate.js new file mode 100644 index 0000000..6195777 --- /dev/null +++ b/lib/test/flow/private_class_properties/getter_duplicate.js @@ -0,0 +1,4 @@ +class C { + get #m() {} + get #m() {} +} diff --git a/lib/test/flow/private_class_properties/getter_duplicate.tree.json b/lib/test/flow/private_class_properties/getter_duplicate.tree.json new file mode 100644 index 0000000..ec1b346 --- /dev/null +++ b/lib/test/flow/private_class_properties/getter_duplicate.tree.json @@ -0,0 +1,121 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":3,"column":6},"end":{"line":3,"column":8}}, + "message":"Private fields may only be declared once. `#m` is declared more than once." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,39], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,39], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "range":[8,39], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, + "range":[12,23], + "key":{ + "type":"PrivateName", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":8}}, + "range":[16,18], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":8}}, + "range":[17,18], + "name":"m", + "typeAnnotation":null, + "optional":false + } + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":13}}, + "range":[18,23], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":13}}, + "range":[21,23], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"get", + "static":false, + "computed":false, + "decorators":[] + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":13}}, + "range":[26,37], + "key":{ + "type":"PrivateName", + "loc":{"source":null,"start":{"line":3,"column":6},"end":{"line":3,"column":8}}, + "range":[30,32], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":7},"end":{"line":3,"column":8}}, + "range":[31,32], + "name":"m", + "typeAnnotation":null, + "optional":false + } + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":13}}, + "range":[32,37], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":11},"end":{"line":3,"column":13}}, + "range":[35,37], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"get", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/private_class_properties/getter_whitespace.js b/lib/test/flow/private_class_properties/getter_whitespace.js new file mode 100644 index 0000000..db51e47 --- /dev/null +++ b/lib/test/flow/private_class_properties/getter_whitespace.js @@ -0,0 +1,3 @@ +class C { + get # m () {} +} diff --git a/lib/test/flow/private_class_properties/getter_whitespace.tree.json b/lib/test/flow/private_class_properties/getter_whitespace.tree.json new file mode 100644 index 0000000..4752a7c --- /dev/null +++ b/lib/test/flow/private_class_properties/getter_whitespace.tree.json @@ -0,0 +1,80 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":9}}, + "message":"Unexpected whitespace between `#` and identifier" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,27], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,27], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "range":[8,27], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, + "range":[12,25], + "key":{ + "type":"PrivateName", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":9}}, + "range":[16,19], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "range":[18,19], + "name":"m", + "typeAnnotation":null, + "optional":false + } + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":15}}, + "range":[20,25], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":15}}, + "range":[23,25], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"get", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/private_class_properties/member.js b/lib/test/flow/private_class_properties/member.js new file mode 100644 index 0000000..cd5e098 --- /dev/null +++ b/lib/test/flow/private_class_properties/member.js @@ -0,0 +1,8 @@ +class A { + #p: number + constructor() { + #p; // Error! Private property must be a member + this.#p; + this.other.#p; + } +} diff --git a/lib/test/flow/private_class_properties/member.tree.json b/lib/test/flow/private_class_properties/member.tree.json new file mode 100644 index 0000000..cd76540 --- /dev/null +++ b/lib/test/flow/private_class_properties/member.tree.json @@ -0,0 +1,215 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":4,"column":4},"end":{"line":4,"column":5}}, + "message":"Unexpected token `#`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":4,"column":5},"end":{"line":4,"column":6}}, + "message":"Unexpected identifier, expected the end of an expression statement (`;`)" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":8,"column":1}}, + "range":[0,130], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":8,"column":1}}, + "range":[0,130], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":8,"column":1}}, + "range":[8,130], + "body":[ + { + "type":"ClassPrivateProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, + "range":[12,22], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":4}}, + "range":[13,14], + "name":"p", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":12}}, + "range":[14,22], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":12}}, + "range":[16,22] + } + }, + "static":false, + "variance":null + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":7,"column":3}}, + "range":[25,128], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":13}}, + "range":[25,36], + "name":"constructor", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":3,"column":13},"end":{"line":7,"column":3}}, + "range":[36,128], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":16},"end":{"line":7,"column":3}}, + "range":[39,128], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":4,"column":4},"end":{"line":4,"column":5}}, + "range":[45,46], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":4},"end":{"line":4,"column":5}}, + "range":[45,46], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":4,"column":5},"end":{"line":4,"column":7}}, + "range":[46,48], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":5},"end":{"line":4,"column":6}}, + "range":[46,47], + "name":"p", + "typeAnnotation":null, + "optional":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":5,"column":4},"end":{"line":5,"column":12}}, + "range":[97,105], + "expression":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":5,"column":4},"end":{"line":5,"column":11}}, + "range":[97,104], + "object":{ + "type":"ThisExpression", + "loc":{"source":null,"start":{"line":5,"column":4},"end":{"line":5,"column":8}}, + "range":[97,101] + }, + "property":{ + "type":"PrivateName", + "loc":{"source":null,"start":{"line":5,"column":9},"end":{"line":5,"column":11}}, + "range":[102,104], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":10},"end":{"line":5,"column":11}}, + "range":[103,104], + "name":"p", + "typeAnnotation":null, + "optional":false + } + }, + "computed":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":6,"column":4},"end":{"line":6,"column":18}}, + "range":[110,124], + "expression":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":6,"column":4},"end":{"line":6,"column":17}}, + "range":[110,123], + "object":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":6,"column":4},"end":{"line":6,"column":14}}, + "range":[110,120], + "object":{ + "type":"ThisExpression", + "loc":{"source":null,"start":{"line":6,"column":4},"end":{"line":6,"column":8}}, + "range":[110,114] + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":9},"end":{"line":6,"column":14}}, + "range":[115,120], + "name":"other", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "property":{ + "type":"PrivateName", + "loc":{"source":null,"start":{"line":6,"column":15},"end":{"line":6,"column":17}}, + "range":[121,123], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":16},"end":{"line":6,"column":17}}, + "range":[122,123], + "name":"p", + "typeAnnotation":null, + "optional":false + } + }, + "computed":false + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"constructor", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":4,"column":8},"end":{"line":4,"column":51}}, + "range":[49,92], + "value":" Error! Private property must be a member" + } + ] +} diff --git a/lib/test/flow/private_class_properties/member_whitespace.js b/lib/test/flow/private_class_properties/member_whitespace.js new file mode 100644 index 0000000..13f4467 --- /dev/null +++ b/lib/test/flow/private_class_properties/member_whitespace.js @@ -0,0 +1,6 @@ +class C { + #m; + foo() { + this.# m; + } +} diff --git a/lib/test/flow/private_class_properties/member_whitespace.tree.json b/lib/test/flow/private_class_properties/member_whitespace.tree.json new file mode 100644 index 0000000..6ebe005 --- /dev/null +++ b/lib/test/flow/private_class_properties/member_whitespace.tree.json @@ -0,0 +1,123 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":4,"column":9},"end":{"line":4,"column":12}}, + "message":"Unexpected whitespace between `#` and identifier" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "range":[0,45], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "range":[0,45], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":6,"column":1}}, + "range":[8,45], + "body":[ + { + "type":"ClassPrivateProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "range":[12,15], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":4}}, + "range":[13,14], + "name":"m", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":null, + "static":false, + "variance":null + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":5,"column":3}}, + "range":[18,43], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":5}}, + "range":[18,21], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":3,"column":5},"end":{"line":5,"column":3}}, + "range":[21,43], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":5,"column":3}}, + "range":[24,43], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":4,"column":4},"end":{"line":4,"column":13}}, + "range":[30,39], + "expression":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":4,"column":4},"end":{"line":4,"column":12}}, + "range":[30,38], + "object":{ + "type":"ThisExpression", + "loc":{"source":null,"start":{"line":4,"column":4},"end":{"line":4,"column":8}}, + "range":[30,34] + }, + "property":{ + "type":"PrivateName", + "loc":{"source":null,"start":{"line":4,"column":9},"end":{"line":4,"column":12}}, + "range":[35,38], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":11},"end":{"line":4,"column":12}}, + "range":[37,38], + "name":"m", + "typeAnnotation":null, + "optional":false + } + }, + "computed":false + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/private_class_properties/multiple.js b/lib/test/flow/private_class_properties/multiple.js new file mode 100644 index 0000000..9f2a46d --- /dev/null +++ b/lib/test/flow/private_class_properties/multiple.js @@ -0,0 +1,6 @@ +class A { + #p: number + #q: number + #p: number // Error, multiple definitions of #p + static #q: number // Error, multiple fields named #q +} diff --git a/lib/test/flow/private_class_properties/multiple.tree.json b/lib/test/flow/private_class_properties/multiple.tree.json new file mode 100644 index 0000000..0c2ae67 --- /dev/null +++ b/lib/test/flow/private_class_properties/multiple.tree.json @@ -0,0 +1,160 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":4}}, + "message":"Private fields may only be declared once. `#p` is declared more than once." + }, + { + "loc":{"source":null,"start":{"line":5,"column":9},"end":{"line":5,"column":11}}, + "message":"Private fields may only be declared once. `#q` is declared more than once." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "range":[0,142], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "range":[0,142], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":6,"column":1}}, + "range":[8,142], + "body":[ + { + "type":"ClassPrivateProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, + "range":[12,22], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":4}}, + "range":[13,14], + "name":"p", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":12}}, + "range":[14,22], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":12}}, + "range":[16,22] + } + }, + "static":false, + "variance":null + }, + { + "type":"ClassPrivateProperty", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":12}}, + "range":[25,35], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":3},"end":{"line":3,"column":4}}, + "range":[26,27], + "name":"q", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":12}}, + "range":[27,35], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":6},"end":{"line":3,"column":12}}, + "range":[29,35] + } + }, + "static":false, + "variance":null + }, + { + "type":"ClassPrivateProperty", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":12}}, + "range":[38,48], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":3},"end":{"line":4,"column":4}}, + "range":[39,40], + "name":"p", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":4},"end":{"line":4,"column":12}}, + "range":[40,48], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":6},"end":{"line":4,"column":12}}, + "range":[42,48] + } + }, + "static":false, + "variance":null + }, + { + "type":"ClassPrivateProperty", + "loc":{"source":null,"start":{"line":5,"column":2},"end":{"line":5,"column":19}}, + "range":[88,105], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":10},"end":{"line":5,"column":11}}, + "range":[96,97], + "name":"q", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":11},"end":{"line":5,"column":19}}, + "range":[97,105], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":13},"end":{"line":5,"column":19}}, + "range":[99,105] + } + }, + "static":true, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":4,"column":13},"end":{"line":4,"column":49}}, + "range":[49,85], + "value":" Error, multiple definitions of #p" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":5,"column":20},"end":{"line":5,"column":54}}, + "range":[106,140], + "value":" Error, multiple fields named #q" + } + ] +} diff --git a/lib/test/flow/private_class_properties/nested.js b/lib/test/flow/private_class_properties/nested.js new file mode 100644 index 0000000..8142940 --- /dev/null +++ b/lib/test/flow/private_class_properties/nested.js @@ -0,0 +1,3 @@ +class C { + #p: {#q: number} // Error, # is only meaningful in class props +} diff --git a/lib/test/flow/private_class_properties/nested.tree.json b/lib/test/flow/private_class_properties/nested.tree.json new file mode 100644 index 0000000..65de6f2 --- /dev/null +++ b/lib/test/flow/private_class_properties/nested.tree.json @@ -0,0 +1,103 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":9}}, + "message":"Private fields can only be referenced from within a class." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,76], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,76], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "range":[8,76], + "body":[ + { + "type":"ClassPrivateProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":18}}, + "range":[12,28], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":4}}, + "range":[13,14], + "name":"p", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":18}}, + "range":[14,28], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":18}}, + "range":[16,28], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":17}}, + "range":[17,27], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "range":[18,19], + "name":"q", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":17}}, + "range":[21,27] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + "static":false, + "variance":null + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":64}}, + "range":[29,74], + "value":" Error, # is only meaningful in class props" + } + ] +} diff --git a/lib/test/flow/private_class_properties/object_type.js b/lib/test/flow/private_class_properties/object_type.js new file mode 100644 index 0000000..298e5f0 --- /dev/null +++ b/lib/test/flow/private_class_properties/object_type.js @@ -0,0 +1,3 @@ +type T = { + #p: number // Error, props can only be private in classes +} diff --git a/lib/test/flow/private_class_properties/object_type.tree.json b/lib/test/flow/private_class_properties/object_type.tree.json new file mode 100644 index 0000000..004a37a --- /dev/null +++ b/lib/test/flow/private_class_properties/object_type.tree.json @@ -0,0 +1,71 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "message":"Private fields can only be referenced from within a class." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,72], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,72], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":3,"column":1}}, + "range":[9,72], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, + "range":[13,23], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":4}}, + "range":[14,15], + "name":"p", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":12}}, + "range":[17,23] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":59}}, + "range":[24,70], + "value":" Error, props can only be private in classes" + } + ] +} diff --git a/lib/test/flow/private_class_properties/scope.js b/lib/test/flow/private_class_properties/scope.js new file mode 100644 index 0000000..a9cd167 --- /dev/null +++ b/lib/test/flow/private_class_properties/scope.js @@ -0,0 +1,45 @@ +class A { + #p: number + constructor() { this.#p = 3; this.#q = 3} // All in scope + #q: number +} + +class B { + #p: number + constructor() { + var x = class { + test() { + var b = new B(); + b.#q = 3; + b.#p = 3; // All in scope! + } + } + } + #q: number +} + +class C { + #p: number + constructor () { + var x = class { + #r: number + test() { + this.#r = 3; // Fine + var c = new C(); + c.#p = 3; // Fine + c.#q = 3; // Fine + } + } + var y = class { + test() { + this.#r = 3; // Error! + var c = new C(); + c.#p = 3; // Fine + c.#q = 3; // Fine + } + } + } + #q: number +} + +this.#p; // Error! diff --git a/lib/test/flow/private_class_properties/scope.tree.json b/lib/test/flow/private_class_properties/scope.tree.json new file mode 100644 index 0000000..f518203 --- /dev/null +++ b/lib/test/flow/private_class_properties/scope.tree.json @@ -0,0 +1,1252 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":35,"column":13},"end":{"line":35,"column":15}}, + "message":"Private fields must be declared before they can be referenced. `#r` has not been declared." + }, + { + "loc":{"source":null,"start":{"line":45,"column":5},"end":{"line":45,"column":7}}, + "message":"Private fields can only be referenced from within a class." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":45,"column":8}}, + "range":[0,686], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "range":[0,97], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":5,"column":1}}, + "range":[8,97], + "body":[ + { + "type":"ClassPrivateProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, + "range":[12,22], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":4}}, + "range":[13,14], + "name":"p", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":12}}, + "range":[14,22], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":12}}, + "range":[16,22] + } + }, + "static":false, + "variance":null + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":43}}, + "range":[25,66], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":13}}, + "range":[25,36], + "name":"constructor", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":3,"column":13},"end":{"line":3,"column":43}}, + "range":[36,66], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":16},"end":{"line":3,"column":43}}, + "range":[39,66], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":3,"column":18},"end":{"line":3,"column":30}}, + "range":[41,53], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":3,"column":18},"end":{"line":3,"column":29}}, + "range":[41,52], + "operator":"=", + "left":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":3,"column":18},"end":{"line":3,"column":25}}, + "range":[41,48], + "object":{ + "type":"ThisExpression", + "loc":{"source":null,"start":{"line":3,"column":18},"end":{"line":3,"column":22}}, + "range":[41,45] + }, + "property":{ + "type":"PrivateName", + "loc":{"source":null,"start":{"line":3,"column":23},"end":{"line":3,"column":25}}, + "range":[46,48], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":24},"end":{"line":3,"column":25}}, + "range":[47,48], + "name":"p", + "typeAnnotation":null, + "optional":false + } + }, + "computed":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":28},"end":{"line":3,"column":29}}, + "range":[51,52], + "value":3, + "raw":"3" + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":3,"column":31},"end":{"line":3,"column":42}}, + "range":[54,65], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":3,"column":31},"end":{"line":3,"column":42}}, + "range":[54,65], + "operator":"=", + "left":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":3,"column":31},"end":{"line":3,"column":38}}, + "range":[54,61], + "object":{ + "type":"ThisExpression", + "loc":{"source":null,"start":{"line":3,"column":31},"end":{"line":3,"column":35}}, + "range":[54,58] + }, + "property":{ + "type":"PrivateName", + "loc":{"source":null,"start":{"line":3,"column":36},"end":{"line":3,"column":38}}, + "range":[59,61], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":37},"end":{"line":3,"column":38}}, + "range":[60,61], + "name":"q", + "typeAnnotation":null, + "optional":false + } + }, + "computed":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":41},"end":{"line":3,"column":42}}, + "range":[64,65], + "value":3, + "raw":"3" + } + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"constructor", + "static":false, + "computed":false, + "decorators":[] + }, + { + "type":"ClassPrivateProperty", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":12}}, + "range":[85,95], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":3},"end":{"line":4,"column":4}}, + "range":[86,87], + "name":"q", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":4},"end":{"line":4,"column":12}}, + "range":[87,95], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":6},"end":{"line":4,"column":12}}, + "range":[89,95] + } + }, + "static":false, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":19,"column":1}}, + "range":[99,285], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":6},"end":{"line":7,"column":7}}, + "range":[105,106], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":7,"column":8},"end":{"line":19,"column":1}}, + "range":[107,285], + "body":[ + { + "type":"ClassPrivateProperty", + "loc":{"source":null,"start":{"line":8,"column":2},"end":{"line":8,"column":12}}, + "range":[111,121], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":8,"column":3},"end":{"line":8,"column":4}}, + "range":[112,113], + "name":"p", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":8,"column":4},"end":{"line":8,"column":12}}, + "range":[113,121], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":8,"column":6},"end":{"line":8,"column":12}}, + "range":[115,121] + } + }, + "static":false, + "variance":null + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":9,"column":2},"end":{"line":17,"column":3}}, + "range":[124,270], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":2},"end":{"line":9,"column":13}}, + "range":[124,135], + "name":"constructor", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":9,"column":13},"end":{"line":17,"column":3}}, + "range":[135,270], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":9,"column":16},"end":{"line":17,"column":3}}, + "range":[138,270], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":10,"column":4},"end":{"line":16,"column":5}}, + "range":[144,266], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":10,"column":8},"end":{"line":16,"column":5}}, + "range":[148,266], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":10,"column":8},"end":{"line":10,"column":9}}, + "range":[148,149], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ClassExpression", + "loc":{"source":null,"start":{"line":10,"column":12},"end":{"line":16,"column":5}}, + "range":[152,266], + "id":null, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":10,"column":18},"end":{"line":16,"column":5}}, + "range":[158,266], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":11,"column":6},"end":{"line":15,"column":7}}, + "range":[166,260], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":11,"column":6},"end":{"line":11,"column":10}}, + "range":[166,170], + "name":"test", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":11,"column":10},"end":{"line":15,"column":7}}, + "range":[170,260], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":11,"column":13},"end":{"line":15,"column":7}}, + "range":[173,260], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":12,"column":8},"end":{"line":12,"column":24}}, + "range":[183,199], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":12,"column":12},"end":{"line":12,"column":23}}, + "range":[187,198], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":12,"column":12},"end":{"line":12,"column":13}}, + "range":[187,188], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"NewExpression", + "loc":{"source":null,"start":{"line":12,"column":16},"end":{"line":12,"column":23}}, + "range":[191,198], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":12,"column":20},"end":{"line":12,"column":21}}, + "range":[195,196], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "arguments":[] + } + } + ], + "kind":"var" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":13,"column":8},"end":{"line":13,"column":17}}, + "range":[208,217], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":13,"column":8},"end":{"line":13,"column":16}}, + "range":[208,216], + "operator":"=", + "left":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":13,"column":8},"end":{"line":13,"column":12}}, + "range":[208,212], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":13,"column":8},"end":{"line":13,"column":9}}, + "range":[208,209], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"PrivateName", + "loc":{"source":null,"start":{"line":13,"column":10},"end":{"line":13,"column":12}}, + "range":[210,212], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":13,"column":11},"end":{"line":13,"column":12}}, + "range":[211,212], + "name":"q", + "typeAnnotation":null, + "optional":false + } + }, + "computed":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":13,"column":15},"end":{"line":13,"column":16}}, + "range":[215,216], + "value":3, + "raw":"3" + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":14,"column":8},"end":{"line":14,"column":17}}, + "range":[226,235], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":14,"column":8},"end":{"line":14,"column":16}}, + "range":[226,234], + "operator":"=", + "left":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":14,"column":8},"end":{"line":14,"column":12}}, + "range":[226,230], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":14,"column":8},"end":{"line":14,"column":9}}, + "range":[226,227], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"PrivateName", + "loc":{"source":null,"start":{"line":14,"column":10},"end":{"line":14,"column":12}}, + "range":[228,230], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":14,"column":11},"end":{"line":14,"column":12}}, + "range":[229,230], + "name":"p", + "typeAnnotation":null, + "optional":false + } + }, + "computed":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":14,"column":15},"end":{"line":14,"column":16}}, + "range":[233,234], + "value":3, + "raw":"3" + } + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + } + ], + "kind":"var" + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"constructor", + "static":false, + "computed":false, + "decorators":[] + }, + { + "type":"ClassPrivateProperty", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":18,"column":12}}, + "range":[273,283], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":18,"column":3},"end":{"line":18,"column":4}}, + "range":[274,275], + "name":"q", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":18,"column":4},"end":{"line":18,"column":12}}, + "range":[275,283], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":18,"column":6},"end":{"line":18,"column":12}}, + "range":[277,283] + } + }, + "static":false, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":21,"column":0},"end":{"line":43,"column":1}}, + "range":[287,676], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":21,"column":6},"end":{"line":21,"column":7}}, + "range":[293,294], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":21,"column":8},"end":{"line":43,"column":1}}, + "range":[295,676], + "body":[ + { + "type":"ClassPrivateProperty", + "loc":{"source":null,"start":{"line":22,"column":2},"end":{"line":22,"column":12}}, + "range":[299,309], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":22,"column":3},"end":{"line":22,"column":4}}, + "range":[300,301], + "name":"p", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":22,"column":4},"end":{"line":22,"column":12}}, + "range":[301,309], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":22,"column":6},"end":{"line":22,"column":12}}, + "range":[303,309] + } + }, + "static":false, + "variance":null + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":23,"column":2},"end":{"line":41,"column":3}}, + "range":[312,661], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":23,"column":2},"end":{"line":23,"column":13}}, + "range":[312,323], + "name":"constructor", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":23,"column":14},"end":{"line":41,"column":3}}, + "range":[324,661], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":23,"column":17},"end":{"line":41,"column":3}}, + "range":[327,661], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":24,"column":4},"end":{"line":32,"column":5}}, + "range":[333,500], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":24,"column":8},"end":{"line":32,"column":5}}, + "range":[337,500], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":24,"column":8},"end":{"line":24,"column":9}}, + "range":[337,338], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ClassExpression", + "loc":{"source":null,"start":{"line":24,"column":12},"end":{"line":32,"column":5}}, + "range":[341,500], + "id":null, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":24,"column":18},"end":{"line":32,"column":5}}, + "range":[347,500], + "body":[ + { + "type":"ClassPrivateProperty", + "loc":{"source":null,"start":{"line":25,"column":6},"end":{"line":25,"column":16}}, + "range":[355,365], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":25,"column":7},"end":{"line":25,"column":8}}, + "range":[356,357], + "name":"r", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":25,"column":8},"end":{"line":25,"column":16}}, + "range":[357,365], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":25,"column":10},"end":{"line":25,"column":16}}, + "range":[359,365] + } + }, + "static":false, + "variance":null + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":26,"column":6},"end":{"line":31,"column":7}}, + "range":[372,494], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":26,"column":6},"end":{"line":26,"column":10}}, + "range":[372,376], + "name":"test", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":26,"column":10},"end":{"line":31,"column":7}}, + "range":[376,494], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":26,"column":13},"end":{"line":31,"column":7}}, + "range":[379,494], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":27,"column":8},"end":{"line":27,"column":20}}, + "range":[389,401], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":27,"column":8},"end":{"line":27,"column":19}}, + "range":[389,400], + "operator":"=", + "left":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":27,"column":8},"end":{"line":27,"column":15}}, + "range":[389,396], + "object":{ + "type":"ThisExpression", + "loc":{"source":null,"start":{"line":27,"column":8},"end":{"line":27,"column":12}}, + "range":[389,393] + }, + "property":{ + "type":"PrivateName", + "loc":{"source":null,"start":{"line":27,"column":13},"end":{"line":27,"column":15}}, + "range":[394,396], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":27,"column":14},"end":{"line":27,"column":15}}, + "range":[395,396], + "name":"r", + "typeAnnotation":null, + "optional":false + } + }, + "computed":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":27,"column":18},"end":{"line":27,"column":19}}, + "range":[399,400], + "value":3, + "raw":"3" + } + }, + "directive":null + }, + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":28,"column":8},"end":{"line":28,"column":24}}, + "range":[418,434], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":28,"column":12},"end":{"line":28,"column":23}}, + "range":[422,433], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":28,"column":12},"end":{"line":28,"column":13}}, + "range":[422,423], + "name":"c", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"NewExpression", + "loc":{"source":null,"start":{"line":28,"column":16},"end":{"line":28,"column":23}}, + "range":[426,433], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":28,"column":20},"end":{"line":28,"column":21}}, + "range":[430,431], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "arguments":[] + } + } + ], + "kind":"var" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":29,"column":8},"end":{"line":29,"column":17}}, + "range":[443,452], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":29,"column":8},"end":{"line":29,"column":16}}, + "range":[443,451], + "operator":"=", + "left":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":29,"column":8},"end":{"line":29,"column":12}}, + "range":[443,447], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":29,"column":8},"end":{"line":29,"column":9}}, + "range":[443,444], + "name":"c", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"PrivateName", + "loc":{"source":null,"start":{"line":29,"column":10},"end":{"line":29,"column":12}}, + "range":[445,447], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":29,"column":11},"end":{"line":29,"column":12}}, + "range":[446,447], + "name":"p", + "typeAnnotation":null, + "optional":false + } + }, + "computed":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":29,"column":15},"end":{"line":29,"column":16}}, + "range":[450,451], + "value":3, + "raw":"3" + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":30,"column":8},"end":{"line":30,"column":17}}, + "range":[469,478], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":30,"column":8},"end":{"line":30,"column":16}}, + "range":[469,477], + "operator":"=", + "left":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":30,"column":8},"end":{"line":30,"column":12}}, + "range":[469,473], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":30,"column":8},"end":{"line":30,"column":9}}, + "range":[469,470], + "name":"c", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"PrivateName", + "loc":{"source":null,"start":{"line":30,"column":10},"end":{"line":30,"column":12}}, + "range":[471,473], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":30,"column":11},"end":{"line":30,"column":12}}, + "range":[472,473], + "name":"q", + "typeAnnotation":null, + "optional":false + } + }, + "computed":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":30,"column":15},"end":{"line":30,"column":16}}, + "range":[476,477], + "value":3, + "raw":"3" + } + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + } + ], + "kind":"var" + }, + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":33,"column":4},"end":{"line":40,"column":5}}, + "range":[505,657], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":33,"column":8},"end":{"line":40,"column":5}}, + "range":[509,657], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":33,"column":8},"end":{"line":33,"column":9}}, + "range":[509,510], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ClassExpression", + "loc":{"source":null,"start":{"line":33,"column":12},"end":{"line":40,"column":5}}, + "range":[513,657], + "id":null, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":33,"column":18},"end":{"line":40,"column":5}}, + "range":[519,657], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":34,"column":6},"end":{"line":39,"column":7}}, + "range":[527,651], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":34,"column":6},"end":{"line":34,"column":10}}, + "range":[527,531], + "name":"test", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":34,"column":10},"end":{"line":39,"column":7}}, + "range":[531,651], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":34,"column":13},"end":{"line":39,"column":7}}, + "range":[534,651], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":35,"column":8},"end":{"line":35,"column":20}}, + "range":[544,556], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":35,"column":8},"end":{"line":35,"column":19}}, + "range":[544,555], + "operator":"=", + "left":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":35,"column":8},"end":{"line":35,"column":15}}, + "range":[544,551], + "object":{ + "type":"ThisExpression", + "loc":{"source":null,"start":{"line":35,"column":8},"end":{"line":35,"column":12}}, + "range":[544,548] + }, + "property":{ + "type":"PrivateName", + "loc":{"source":null,"start":{"line":35,"column":13},"end":{"line":35,"column":15}}, + "range":[549,551], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":35,"column":14},"end":{"line":35,"column":15}}, + "range":[550,551], + "name":"r", + "typeAnnotation":null, + "optional":false + } + }, + "computed":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":35,"column":18},"end":{"line":35,"column":19}}, + "range":[554,555], + "value":3, + "raw":"3" + } + }, + "directive":null + }, + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":36,"column":8},"end":{"line":36,"column":24}}, + "range":[575,591], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":36,"column":12},"end":{"line":36,"column":23}}, + "range":[579,590], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":36,"column":12},"end":{"line":36,"column":13}}, + "range":[579,580], + "name":"c", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"NewExpression", + "loc":{"source":null,"start":{"line":36,"column":16},"end":{"line":36,"column":23}}, + "range":[583,590], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":36,"column":20},"end":{"line":36,"column":21}}, + "range":[587,588], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "arguments":[] + } + } + ], + "kind":"var" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":37,"column":8},"end":{"line":37,"column":17}}, + "range":[600,609], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":37,"column":8},"end":{"line":37,"column":16}}, + "range":[600,608], + "operator":"=", + "left":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":37,"column":8},"end":{"line":37,"column":12}}, + "range":[600,604], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":37,"column":8},"end":{"line":37,"column":9}}, + "range":[600,601], + "name":"c", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"PrivateName", + "loc":{"source":null,"start":{"line":37,"column":10},"end":{"line":37,"column":12}}, + "range":[602,604], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":37,"column":11},"end":{"line":37,"column":12}}, + "range":[603,604], + "name":"p", + "typeAnnotation":null, + "optional":false + } + }, + "computed":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":37,"column":15},"end":{"line":37,"column":16}}, + "range":[607,608], + "value":3, + "raw":"3" + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":38,"column":8},"end":{"line":38,"column":17}}, + "range":[626,635], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":38,"column":8},"end":{"line":38,"column":16}}, + "range":[626,634], + "operator":"=", + "left":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":38,"column":8},"end":{"line":38,"column":12}}, + "range":[626,630], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":38,"column":8},"end":{"line":38,"column":9}}, + "range":[626,627], + "name":"c", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"PrivateName", + "loc":{"source":null,"start":{"line":38,"column":10},"end":{"line":38,"column":12}}, + "range":[628,630], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":38,"column":11},"end":{"line":38,"column":12}}, + "range":[629,630], + "name":"q", + "typeAnnotation":null, + "optional":false + } + }, + "computed":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":38,"column":15},"end":{"line":38,"column":16}}, + "range":[633,634], + "value":3, + "raw":"3" + } + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + } + ], + "kind":"var" + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"constructor", + "static":false, + "computed":false, + "decorators":[] + }, + { + "type":"ClassPrivateProperty", + "loc":{"source":null,"start":{"line":42,"column":2},"end":{"line":42,"column":12}}, + "range":[664,674], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":42,"column":3},"end":{"line":42,"column":4}}, + "range":[665,666], + "name":"q", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":42,"column":4},"end":{"line":42,"column":12}}, + "range":[666,674], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":42,"column":6},"end":{"line":42,"column":12}}, + "range":[668,674] + } + }, + "static":false, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":45,"column":0},"end":{"line":45,"column":8}}, + "range":[678,686], + "expression":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":45,"column":0},"end":{"line":45,"column":7}}, + "range":[678,685], + "object":{ + "type":"ThisExpression", + "loc":{"source":null,"start":{"line":45,"column":0},"end":{"line":45,"column":4}}, + "range":[678,682] + }, + "property":{ + "type":"PrivateName", + "loc":{"source":null,"start":{"line":45,"column":5},"end":{"line":45,"column":7}}, + "range":[683,685], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":45,"column":6},"end":{"line":45,"column":7}}, + "range":[684,685], + "name":"p", + "typeAnnotation":null, + "optional":false + } + }, + "computed":false + }, + "directive":null + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":3,"column":44},"end":{"line":3,"column":59}}, + "range":[67,82], + "value":" All in scope" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":14,"column":18},"end":{"line":14,"column":34}}, + "range":[236,252], + "value":" All in scope!" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":27,"column":21},"end":{"line":27,"column":28}}, + "range":[402,409], + "value":" Fine" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":29,"column":18},"end":{"line":29,"column":25}}, + "range":[453,460], + "value":" Fine" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":30,"column":18},"end":{"line":30,"column":25}}, + "range":[479,486], + "value":" Fine" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":35,"column":21},"end":{"line":35,"column":30}}, + "range":[557,566], + "value":" Error!" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":37,"column":18},"end":{"line":37,"column":25}}, + "range":[610,617], + "value":" Fine" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":38,"column":18},"end":{"line":38,"column":25}}, + "range":[636,643], + "value":" Fine" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":45,"column":9},"end":{"line":45,"column":18}}, + "range":[687,696], + "value":" Error!" + } + ] +} diff --git a/lib/test/flow/private_class_properties/setter.js b/lib/test/flow/private_class_properties/setter.js new file mode 100644 index 0000000..bc6b5b0 --- /dev/null +++ b/lib/test/flow/private_class_properties/setter.js @@ -0,0 +1,3 @@ +class C { + set #m(x) {} +} diff --git a/lib/test/flow/private_class_properties/setter.tree.json b/lib/test/flow/private_class_properties/setter.tree.json new file mode 100644 index 0000000..af4cefc --- /dev/null +++ b/lib/test/flow/private_class_properties/setter.tree.json @@ -0,0 +1,83 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,26], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,26], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "range":[8,26], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, + "range":[12,24], + "key":{ + "type":"PrivateName", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":8}}, + "range":[16,18], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":8}}, + "range":[17,18], + "name":"m", + "typeAnnotation":null, + "optional":false + } + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":14}}, + "range":[18,24], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, + "range":[19,20], + "name":"x", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, + "range":[22,24], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"set", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/private_class_properties/setter_and_field.js b/lib/test/flow/private_class_properties/setter_and_field.js new file mode 100644 index 0000000..b70a462 --- /dev/null +++ b/lib/test/flow/private_class_properties/setter_and_field.js @@ -0,0 +1,4 @@ +class C { + #m; + set #m(x) {} +} diff --git a/lib/test/flow/private_class_properties/setter_and_field.tree.json b/lib/test/flow/private_class_properties/setter_and_field.tree.json new file mode 100644 index 0000000..8b8a658 --- /dev/null +++ b/lib/test/flow/private_class_properties/setter_and_field.tree.json @@ -0,0 +1,106 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":3,"column":6},"end":{"line":3,"column":8}}, + "message":"Private fields may only be declared once. `#m` is declared more than once." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,32], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,32], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "range":[8,32], + "body":[ + { + "type":"ClassPrivateProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "range":[12,15], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":4}}, + "range":[13,14], + "name":"m", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":null, + "static":false, + "variance":null + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":14}}, + "range":[18,30], + "key":{ + "type":"PrivateName", + "loc":{"source":null,"start":{"line":3,"column":6},"end":{"line":3,"column":8}}, + "range":[22,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":7},"end":{"line":3,"column":8}}, + "range":[23,24], + "name":"m", + "typeAnnotation":null, + "optional":false + } + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":14}}, + "range":[24,30], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":9},"end":{"line":3,"column":10}}, + "range":[25,26], + "name":"x", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":12},"end":{"line":3,"column":14}}, + "range":[28,30], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"set", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/private_class_properties/setter_duplicate.js b/lib/test/flow/private_class_properties/setter_duplicate.js new file mode 100644 index 0000000..6dfc410 --- /dev/null +++ b/lib/test/flow/private_class_properties/setter_duplicate.js @@ -0,0 +1,4 @@ +class C { + set #m(x) {} + set #m(x) {} +} diff --git a/lib/test/flow/private_class_properties/setter_duplicate.tree.json b/lib/test/flow/private_class_properties/setter_duplicate.tree.json new file mode 100644 index 0000000..b8de527 --- /dev/null +++ b/lib/test/flow/private_class_properties/setter_duplicate.tree.json @@ -0,0 +1,139 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":3,"column":6},"end":{"line":3,"column":8}}, + "message":"Private fields may only be declared once. `#m` is declared more than once." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,41], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,41], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "range":[8,41], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, + "range":[12,24], + "key":{ + "type":"PrivateName", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":8}}, + "range":[16,18], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":8}}, + "range":[17,18], + "name":"m", + "typeAnnotation":null, + "optional":false + } + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":14}}, + "range":[18,24], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, + "range":[19,20], + "name":"x", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, + "range":[22,24], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"set", + "static":false, + "computed":false, + "decorators":[] + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":14}}, + "range":[27,39], + "key":{ + "type":"PrivateName", + "loc":{"source":null,"start":{"line":3,"column":6},"end":{"line":3,"column":8}}, + "range":[31,33], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":7},"end":{"line":3,"column":8}}, + "range":[32,33], + "name":"m", + "typeAnnotation":null, + "optional":false + } + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":14}}, + "range":[33,39], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":9},"end":{"line":3,"column":10}}, + "range":[34,35], + "name":"x", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":12},"end":{"line":3,"column":14}}, + "range":[37,39], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"set", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/private_class_properties/super.js b/lib/test/flow/private_class_properties/super.js new file mode 100644 index 0000000..1abbc4c --- /dev/null +++ b/lib/test/flow/private_class_properties/super.js @@ -0,0 +1,6 @@ +class A { + #p: number + m() { + super.#p; // Error, super.PrivateName is not allowed + } +} diff --git a/lib/test/flow/private_class_properties/super.tree.json b/lib/test/flow/private_class_properties/super.tree.json new file mode 100644 index 0000000..cbcfcaf --- /dev/null +++ b/lib/test/flow/private_class_properties/super.tree.json @@ -0,0 +1,139 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":4,"column":4},"end":{"line":4,"column":12}}, + "message":"You may not access a private field through the `super` keyword." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "range":[0,93], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "range":[0,93], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":6,"column":1}}, + "range":[8,93], + "body":[ + { + "type":"ClassPrivateProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, + "range":[12,22], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":4}}, + "range":[13,14], + "name":"p", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":12}}, + "range":[14,22], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":12}}, + "range":[16,22] + } + }, + "static":false, + "variance":null + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":5,"column":3}}, + "range":[25,91], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "range":[25,26], + "name":"m", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":3,"column":3},"end":{"line":5,"column":3}}, + "range":[26,91], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":6},"end":{"line":5,"column":3}}, + "range":[29,91], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":4,"column":4},"end":{"line":4,"column":13}}, + "range":[35,44], + "expression":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":4,"column":4},"end":{"line":4,"column":12}}, + "range":[35,43], + "object":{ + "type":"Super", + "loc":{"source":null,"start":{"line":4,"column":4},"end":{"line":4,"column":9}}, + "range":[35,40] + }, + "property":{ + "type":"PrivateName", + "loc":{"source":null,"start":{"line":4,"column":10},"end":{"line":4,"column":12}}, + "range":[41,43], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":11},"end":{"line":4,"column":12}}, + "range":[42,43], + "name":"p", + "typeAnnotation":null, + "optional":false + } + }, + "computed":false + }, + "directive":null + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":4,"column":14},"end":{"line":4,"column":56}}, + "range":[45,87], + "value":" Error, super.PrivateName is not allowed" + } + ] +} diff --git a/lib/test/flow/private_class_properties/unannotated.js b/lib/test/flow/private_class_properties/unannotated.js new file mode 100644 index 0000000..f2a45da --- /dev/null +++ b/lib/test/flow/private_class_properties/unannotated.js @@ -0,0 +1,3 @@ +class C { + #foo +} diff --git a/lib/test/flow/private_class_properties/unannotated.tree.json b/lib/test/flow/private_class_properties/unannotated.tree.json new file mode 100644 index 0000000..6ede2bf --- /dev/null +++ b/lib/test/flow/private_class_properties/unannotated.tree.json @@ -0,0 +1,50 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,18], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,18], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "range":[8,18], + "body":[ + { + "type":"ClassPrivateProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":6}}, + "range":[12,16], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":6}}, + "range":[13,16], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":null, + "static":false, + "variance":null + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/private_class_properties/unannotated_asi.js b/lib/test/flow/private_class_properties/unannotated_asi.js new file mode 100644 index 0000000..d8789bd --- /dev/null +++ b/lib/test/flow/private_class_properties/unannotated_asi.js @@ -0,0 +1,4 @@ +class C { + #foo + #bar +} diff --git a/lib/test/flow/private_class_properties/unannotated_asi.tree.json b/lib/test/flow/private_class_properties/unannotated_asi.tree.json new file mode 100644 index 0000000..3650df7 --- /dev/null +++ b/lib/test/flow/private_class_properties/unannotated_asi.tree.json @@ -0,0 +1,67 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,25], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,25], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "range":[8,25], + "body":[ + { + "type":"ClassPrivateProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":6}}, + "range":[12,16], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":6}}, + "range":[13,16], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":null, + "static":false, + "variance":null + }, + { + "type":"ClassPrivateProperty", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":6}}, + "range":[19,23], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":3},"end":{"line":3,"column":6}}, + "range":[20,23], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":null, + "static":false, + "variance":null + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/private_class_properties/valid.js b/lib/test/flow/private_class_properties/valid.js new file mode 100644 index 0000000..7821c2d --- /dev/null +++ b/lib/test/flow/private_class_properties/valid.js @@ -0,0 +1,5 @@ +class B { + #p: number + #q: string + q: string +} diff --git a/lib/test/flow/private_class_properties/valid.tree.json b/lib/test/flow/private_class_properties/valid.tree.json new file mode 100644 index 0000000..8b8a669 --- /dev/null +++ b/lib/test/flow/private_class_properties/valid.tree.json @@ -0,0 +1,112 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "range":[0,49], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "range":[0,49], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":5,"column":1}}, + "range":[8,49], + "body":[ + { + "type":"ClassPrivateProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, + "range":[12,22], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":4}}, + "range":[13,14], + "name":"p", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":12}}, + "range":[14,22], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":12}}, + "range":[16,22] + } + }, + "static":false, + "variance":null + }, + { + "type":"ClassPrivateProperty", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":12}}, + "range":[25,35], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":3},"end":{"line":3,"column":4}}, + "range":[26,27], + "name":"q", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":12}}, + "range":[27,35], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":6},"end":{"line":3,"column":12}}, + "range":[29,35] + } + }, + "static":false, + "variance":null + }, + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":11}}, + "range":[38,47], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":3}}, + "range":[38,39], + "name":"q", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":3},"end":{"line":4,"column":11}}, + "range":[39,47], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":5},"end":{"line":4,"column":11}}, + "range":[41,47] + } + }, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/private_class_properties/whitespace.js b/lib/test/flow/private_class_properties/whitespace.js new file mode 100644 index 0000000..5c0f016 --- /dev/null +++ b/lib/test/flow/private_class_properties/whitespace.js @@ -0,0 +1,3 @@ +class C { + # m; +} diff --git a/lib/test/flow/private_class_properties/whitespace.tree.json b/lib/test/flow/private_class_properties/whitespace.tree.json new file mode 100644 index 0000000..d5884de --- /dev/null +++ b/lib/test/flow/private_class_properties/whitespace.tree.json @@ -0,0 +1,56 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "message":"Unexpected whitespace between `#` and identifier" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,18], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,18], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "range":[8,18], + "body":[ + { + "type":"ClassPrivateProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":6}}, + "range":[12,16], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":5}}, + "range":[14,15], + "name":"m", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":null, + "static":false, + "variance":null + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/statement/if/declare_in_consequent.js b/lib/test/flow/statement/if/declare_in_consequent.js new file mode 100644 index 0000000..3182914 --- /dev/null +++ b/lib/test/flow/statement/if/declare_in_consequent.js @@ -0,0 +1 @@ +if (true) declare += 4; diff --git a/lib/test/flow/statement/if/declare_in_consequent.tree.json b/lib/test/flow/statement/if/declare_in_consequent.tree.json new file mode 100644 index 0000000..6faca5f --- /dev/null +++ b/lib/test/flow/statement/if/declare_in_consequent.tree.json @@ -0,0 +1,48 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "body":[ + { + "type":"IfStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "test":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":8}}, + "range":[4,8], + "value":true, + "raw":"true" + }, + "consequent":{ + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":23}}, + "range":[10,23], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":22}}, + "range":[10,22], + "operator":"+=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":17}}, + "range":[10,17], + "name":"declare", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "value":4, + "raw":"4" + } + }, + "directive":null + }, + "alternate":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/statement/labelled/label_declare.js b/lib/test/flow/statement/labelled/label_declare.js new file mode 100644 index 0000000..13c014a --- /dev/null +++ b/lib/test/flow/statement/labelled/label_declare.js @@ -0,0 +1 @@ +declare: 62 diff --git a/lib/test/flow/statement/labelled/label_declare.tree.json b/lib/test/flow/statement/labelled/label_declare.tree.json new file mode 100644 index 0000000..2c6bc67 --- /dev/null +++ b/lib/test/flow/statement/labelled/label_declare.tree.json @@ -0,0 +1,34 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "body":[ + { + "type":"LabeledStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "label":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "name":"declare", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, + "range":[9,11], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, + "range":[9,11], + "value":62, + "raw":"62" + }, + "directive":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/statement/labelled/label_of.js b/lib/test/flow/statement/labelled/label_of.js new file mode 100644 index 0000000..821709d --- /dev/null +++ b/lib/test/flow/statement/labelled/label_of.js @@ -0,0 +1 @@ +of: 52 diff --git a/lib/test/flow/statement/labelled/label_of.tree.json b/lib/test/flow/statement/labelled/label_of.tree.json new file mode 100644 index 0000000..492ad2f --- /dev/null +++ b/lib/test/flow/statement/labelled/label_of.tree.json @@ -0,0 +1,34 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "body":[ + { + "type":"LabeledStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "label":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, + "range":[0,2], + "name":"of", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, + "range":[4,6], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, + "range":[4,6], + "value":52, + "raw":"52" + }, + "directive":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/statement/labelled/label_type.js b/lib/test/flow/statement/labelled/label_type.js new file mode 100644 index 0000000..0d30a19 --- /dev/null +++ b/lib/test/flow/statement/labelled/label_type.js @@ -0,0 +1 @@ +type: 42 diff --git a/lib/test/flow/statement/labelled/label_type.tree.json b/lib/test/flow/statement/labelled/label_type.tree.json new file mode 100644 index 0000000..fb5c8b2 --- /dev/null +++ b/lib/test/flow/statement/labelled/label_type.tree.json @@ -0,0 +1,34 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "range":[0,8], + "body":[ + { + "type":"LabeledStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "range":[0,8], + "label":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "name":"type", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":8}}, + "range":[6,8], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":8}}, + "range":[6,8], + "value":42, + "raw":"42" + }, + "directive":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/statement/labelled/statement_with_parens.js b/lib/test/flow/statement/labelled/statement_with_parens.js new file mode 100644 index 0000000..4014d18 --- /dev/null +++ b/lib/test/flow/statement/labelled/statement_with_parens.js @@ -0,0 +1 @@ +foo: (123); diff --git a/lib/test/flow/statement/labelled/statement_with_parens.tree.json b/lib/test/flow/statement/labelled/statement_with_parens.tree.json new file mode 100644 index 0000000..357b009 --- /dev/null +++ b/lib/test/flow/statement/labelled/statement_with_parens.tree.json @@ -0,0 +1,34 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "body":[ + { + "type":"LabeledStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "label":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, + "range":[5,11], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "value":123, + "raw":"123" + }, + "directive":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/statement/labelled/statement_with_parens_no_semi.js b/lib/test/flow/statement/labelled/statement_with_parens_no_semi.js new file mode 100644 index 0000000..c9bf3a7 --- /dev/null +++ b/lib/test/flow/statement/labelled/statement_with_parens_no_semi.js @@ -0,0 +1 @@ +foo: (123) diff --git a/lib/test/flow/statement/labelled/statement_with_parens_no_semi.tree.json b/lib/test/flow/statement/labelled/statement_with_parens_no_semi.tree.json new file mode 100644 index 0000000..d4f0a1c --- /dev/null +++ b/lib/test/flow/statement/labelled/statement_with_parens_no_semi.tree.json @@ -0,0 +1,34 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "body":[ + { + "type":"LabeledStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "label":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, + "range":[5,10], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "value":123, + "raw":"123" + }, + "directive":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/statement/return/expression_with_parens.js b/lib/test/flow/statement/return/expression_with_parens.js new file mode 100644 index 0000000..e101c28 --- /dev/null +++ b/lib/test/flow/statement/return/expression_with_parens.js @@ -0,0 +1 @@ +(function(){ return (123); }) diff --git a/lib/test/flow/statement/return/expression_with_parens.tree.json b/lib/test/flow/statement/return/expression_with_parens.tree.json new file mode 100644 index 0000000..3f10a71 --- /dev/null +++ b/lib/test/flow/statement/return/expression_with_parens.tree.json @@ -0,0 +1,46 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "expression":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":28}}, + "range":[1,28], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":28}}, + "range":[11,28], + "body":[ + { + "type":"ReturnStatement", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":26}}, + "range":[13,26], + "argument":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":24}}, + "range":[21,24], + "value":123, + "raw":"123" + } + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/statement/return/expression_with_parens_no_semi.js b/lib/test/flow/statement/return/expression_with_parens_no_semi.js new file mode 100644 index 0000000..04eb120 --- /dev/null +++ b/lib/test/flow/statement/return/expression_with_parens_no_semi.js @@ -0,0 +1 @@ +(function(){ return (123) }) diff --git a/lib/test/flow/statement/return/expression_with_parens_no_semi.tree.json b/lib/test/flow/statement/return/expression_with_parens_no_semi.tree.json new file mode 100644 index 0000000..6c633f0 --- /dev/null +++ b/lib/test/flow/statement/return/expression_with_parens_no_semi.tree.json @@ -0,0 +1,46 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "expression":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":27}}, + "range":[1,27], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":27}}, + "range":[11,27], + "body":[ + { + "type":"ReturnStatement", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":25}}, + "range":[13,25], + "argument":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":24}}, + "range":[21,24], + "value":123, + "raw":"123" + } + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/statement/throw/expression_with_parens.js b/lib/test/flow/statement/throw/expression_with_parens.js new file mode 100644 index 0000000..f039b96 --- /dev/null +++ b/lib/test/flow/statement/throw/expression_with_parens.js @@ -0,0 +1 @@ +throw (123); diff --git a/lib/test/flow/statement/throw/expression_with_parens.tree.json b/lib/test/flow/statement/throw/expression_with_parens.tree.json new file mode 100644 index 0000000..7afa92b --- /dev/null +++ b/lib/test/flow/statement/throw/expression_with_parens.tree.json @@ -0,0 +1,20 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "body":[ + { + "type":"ThrowStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "argument":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, + "range":[7,10], + "value":123, + "raw":"123" + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/statement/throw/expression_with_parens_no_semi.js b/lib/test/flow/statement/throw/expression_with_parens_no_semi.js new file mode 100644 index 0000000..1593db9 --- /dev/null +++ b/lib/test/flow/statement/throw/expression_with_parens_no_semi.js @@ -0,0 +1 @@ +throw (123) diff --git a/lib/test/flow/statement/throw/expression_with_parens_no_semi.tree.json b/lib/test/flow/statement/throw/expression_with_parens_no_semi.tree.json new file mode 100644 index 0000000..8cd3c58 --- /dev/null +++ b/lib/test/flow/statement/throw/expression_with_parens_no_semi.tree.json @@ -0,0 +1,20 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "body":[ + { + "type":"ThrowStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "argument":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, + "range":[7,10], + "value":123, + "raw":"123" + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/statement/variable/const_ends_with_paren.js b/lib/test/flow/statement/variable/const_ends_with_paren.js new file mode 100644 index 0000000..51584c0 --- /dev/null +++ b/lib/test/flow/statement/variable/const_ends_with_paren.js @@ -0,0 +1 @@ +const x = (y = 1); diff --git a/lib/test/flow/statement/variable/const_ends_with_paren.tree.json b/lib/test/flow/statement/variable/const_ends_with_paren.tree.json new file mode 100644 index 0000000..65fc6e6 --- /dev/null +++ b/lib/test/flow/statement/variable/const_ends_with_paren.tree.json @@ -0,0 +1,50 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":17}}, + "range":[6,17], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":16}}, + "range":[11,16], + "operator":"=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "value":1, + "raw":"1" + } + } + } + ], + "kind":"const" + } + ], + "comments":[] +} diff --git a/lib/test/flow/statement/variable/const_ends_with_paren_no_semi.js b/lib/test/flow/statement/variable/const_ends_with_paren_no_semi.js new file mode 100644 index 0000000..7e5fd05 --- /dev/null +++ b/lib/test/flow/statement/variable/const_ends_with_paren_no_semi.js @@ -0,0 +1 @@ +const x = (y = 1) diff --git a/lib/test/flow/statement/variable/const_ends_with_paren_no_semi.tree.json b/lib/test/flow/statement/variable/const_ends_with_paren_no_semi.tree.json new file mode 100644 index 0000000..cb24816 --- /dev/null +++ b/lib/test/flow/statement/variable/const_ends_with_paren_no_semi.tree.json @@ -0,0 +1,50 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":17}}, + "range":[6,17], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":16}}, + "range":[11,16], + "operator":"=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "value":1, + "raw":"1" + } + } + } + ], + "kind":"const" + } + ], + "comments":[] +} diff --git a/lib/test/flow/statement/variable/let_ends_with_paren.js b/lib/test/flow/statement/variable/let_ends_with_paren.js new file mode 100644 index 0000000..3269f96 --- /dev/null +++ b/lib/test/flow/statement/variable/let_ends_with_paren.js @@ -0,0 +1 @@ +let x = (y = 1); diff --git a/lib/test/flow/statement/variable/let_ends_with_paren.tree.json b/lib/test/flow/statement/variable/let_ends_with_paren.tree.json new file mode 100644 index 0000000..490690f --- /dev/null +++ b/lib/test/flow/statement/variable/let_ends_with_paren.tree.json @@ -0,0 +1,50 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":15}}, + "range":[4,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "range":[9,14], + "operator":"=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "value":1, + "raw":"1" + } + } + } + ], + "kind":"let" + } + ], + "comments":[] +} diff --git a/lib/test/flow/statement/variable/let_ends_with_paren_no_semi.js b/lib/test/flow/statement/variable/let_ends_with_paren_no_semi.js new file mode 100644 index 0000000..fc58a72 --- /dev/null +++ b/lib/test/flow/statement/variable/let_ends_with_paren_no_semi.js @@ -0,0 +1 @@ +let x = (y = 1) diff --git a/lib/test/flow/statement/variable/let_ends_with_paren_no_semi.tree.json b/lib/test/flow/statement/variable/let_ends_with_paren_no_semi.tree.json new file mode 100644 index 0000000..029dcee --- /dev/null +++ b/lib/test/flow/statement/variable/let_ends_with_paren_no_semi.tree.json @@ -0,0 +1,50 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":15}}, + "range":[4,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "range":[9,14], + "operator":"=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "value":1, + "raw":"1" + } + } + } + ], + "kind":"let" + } + ], + "comments":[] +} diff --git a/lib/test/flow/statement/variable/var_ends_with_paren.js b/lib/test/flow/statement/variable/var_ends_with_paren.js new file mode 100644 index 0000000..0694574 --- /dev/null +++ b/lib/test/flow/statement/variable/var_ends_with_paren.js @@ -0,0 +1 @@ +var x = (y = 1); diff --git a/lib/test/flow/statement/variable/var_ends_with_paren.tree.json b/lib/test/flow/statement/variable/var_ends_with_paren.tree.json new file mode 100644 index 0000000..a149eff --- /dev/null +++ b/lib/test/flow/statement/variable/var_ends_with_paren.tree.json @@ -0,0 +1,50 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":15}}, + "range":[4,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "range":[9,14], + "operator":"=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "value":1, + "raw":"1" + } + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/statement/variable/var_ends_with_paren_no_semi.js b/lib/test/flow/statement/variable/var_ends_with_paren_no_semi.js new file mode 100644 index 0000000..55afed4 --- /dev/null +++ b/lib/test/flow/statement/variable/var_ends_with_paren_no_semi.js @@ -0,0 +1 @@ +var x = (y = 1) diff --git a/lib/test/flow/statement/variable/var_ends_with_paren_no_semi.tree.json b/lib/test/flow/statement/variable/var_ends_with_paren_no_semi.tree.json new file mode 100644 index 0000000..09351dc --- /dev/null +++ b/lib/test/flow/statement/variable/var_ends_with_paren_no_semi.tree.json @@ -0,0 +1,50 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":15}}, + "range":[4,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "range":[9,14], + "operator":"=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "value":1, + "raw":"1" + } + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/statement/variable/var_named_declare.js b/lib/test/flow/statement/variable/var_named_declare.js new file mode 100644 index 0000000..b14f0bd --- /dev/null +++ b/lib/test/flow/statement/variable/var_named_declare.js @@ -0,0 +1 @@ +var foo, declare diff --git a/lib/test/flow/statement/variable/var_named_declare.tree.json b/lib/test/flow/statement/variable/var_named_declare.tree.json new file mode 100644 index 0000000..b5088f0 --- /dev/null +++ b/lib/test/flow/statement/variable/var_named_declare.tree.json @@ -0,0 +1,44 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "range":[4,7], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "range":[4,7], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "init":null + }, + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "name":"declare", + "typeAnnotation":null, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/statement/variable/var_named_type.js b/lib/test/flow/statement/variable/var_named_type.js new file mode 100644 index 0000000..5e94217 --- /dev/null +++ b/lib/test/flow/statement/variable/var_named_type.js @@ -0,0 +1 @@ +var foo = 42, type = 12 diff --git a/lib/test/flow/statement/variable/var_named_type.tree.json b/lib/test/flow/statement/variable/var_named_type.tree.json new file mode 100644 index 0000000..b8ec401 --- /dev/null +++ b/lib/test/flow/statement/variable/var_named_type.tree.json @@ -0,0 +1,56 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, + "range":[4,12], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "range":[4,7], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, + "range":[10,12], + "value":42, + "raw":"42" + } + }, + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":23}}, + "range":[14,23], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":18}}, + "range":[14,18], + "name":"type", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, + "range":[21,23], + "value":12, + "raw":"12" + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/this_param/annotation_required.js b/lib/test/flow/this_param/annotation_required.js new file mode 100644 index 0000000..caba99b --- /dev/null +++ b/lib/test/flow/this_param/annotation_required.js @@ -0,0 +1,2 @@ +// Error - the annotation for this is required +function foo(this) {} diff --git a/lib/test/flow/this_param/annotation_required.tree.json b/lib/test/flow/this_param/annotation_required.tree.json new file mode 100644 index 0000000..ca99df4 --- /dev/null +++ b/lib/test/flow/this_param/annotation_required.tree.json @@ -0,0 +1,47 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":18}}, + "message":"A type annotation is required for the `this` parameter." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":21}}, + "range":[47,68], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":21}}, + "range":[47,68], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":12}}, + "range":[56,59], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":21}}, + "range":[66,68], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "range":[0,46], + "value":" Error - the annotation for this is required" + } + ] +} diff --git a/lib/test/flow/this_param/arrow_function.js b/lib/test/flow/this_param/arrow_function.js new file mode 100644 index 0000000..739c30f --- /dev/null +++ b/lib/test/flow/this_param/arrow_function.js @@ -0,0 +1,7 @@ +((this: string) => {}); + +((this: string, bar: number) => {}); + +((this: string, bar: number, ...rest: Array) => {}); + +((this: string, ...rest: Array) => {}); diff --git a/lib/test/flow/this_param/arrow_function.tree.json b/lib/test/flow/this_param/arrow_function.tree.json new file mode 100644 index 0000000..ca199b9 --- /dev/null +++ b/lib/test/flow/this_param/arrow_function.tree.json @@ -0,0 +1,247 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":14}}, + "message":"Arrow functions cannot have a `this` parameter; arrow functions automatically bind `this` when declared." + }, + { + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":14}}, + "message":"Arrow functions cannot have a `this` parameter; arrow functions automatically bind `this` when declared." + }, + { + "loc":{"source":null,"start":{"line":5,"column":2},"end":{"line":5,"column":14}}, + "message":"Arrow functions cannot have a `this` parameter; arrow functions automatically bind `this` when declared." + }, + { + "loc":{"source":null,"start":{"line":7,"column":2},"end":{"line":7,"column":14}}, + "message":"Arrow functions cannot have a `this` parameter; arrow functions automatically bind `this` when declared." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":7,"column":48}}, + "range":[0,174], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "expression":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":21}}, + "range":[1,21], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, + "range":[19,21], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":36}}, + "range":[25,61], + "expression":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":3,"column":1},"end":{"line":3,"column":34}}, + "range":[26,59], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":16},"end":{"line":3,"column":27}}, + "range":[41,52], + "name":"bar", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":19},"end":{"line":3,"column":27}}, + "range":[44,52], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":21},"end":{"line":3,"column":27}}, + "range":[46,52] + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":32},"end":{"line":3,"column":34}}, + "range":[57,59], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":61}}, + "range":[63,124], + "expression":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":5,"column":1},"end":{"line":5,"column":59}}, + "range":[64,122], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":16},"end":{"line":5,"column":27}}, + "range":[79,90], + "name":"bar", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":19},"end":{"line":5,"column":27}}, + "range":[82,90], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":21},"end":{"line":5,"column":27}}, + "range":[84,90] + } + }, + "optional":false + }, + { + "type":"RestElement", + "loc":{"source":null,"start":{"line":5,"column":29},"end":{"line":5,"column":52}}, + "range":[92,115], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":32},"end":{"line":5,"column":52}}, + "range":[95,115], + "name":"rest", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":36},"end":{"line":5,"column":52}}, + "range":[99,115], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":38},"end":{"line":5,"column":52}}, + "range":[101,115], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":38},"end":{"line":5,"column":43}}, + "range":[101,106], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":5,"column":43},"end":{"line":5,"column":52}}, + "range":[106,115], + "params":[ + { + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":44},"end":{"line":5,"column":51}}, + "range":[107,114] + } + ] + } + } + }, + "optional":false + } + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":5,"column":57},"end":{"line":5,"column":59}}, + "range":[120,122], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":48}}, + "range":[126,174], + "expression":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":7,"column":1},"end":{"line":7,"column":46}}, + "range":[127,172], + "id":null, + "params":[ + { + "type":"RestElement", + "loc":{"source":null,"start":{"line":7,"column":16},"end":{"line":7,"column":39}}, + "range":[142,165], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":19},"end":{"line":7,"column":39}}, + "range":[145,165], + "name":"rest", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":23},"end":{"line":7,"column":39}}, + "range":[149,165], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":25},"end":{"line":7,"column":39}}, + "range":[151,165], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":25},"end":{"line":7,"column":30}}, + "range":[151,156], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":7,"column":30},"end":{"line":7,"column":39}}, + "range":[156,165], + "params":[ + { + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":31},"end":{"line":7,"column":38}}, + "range":[157,164] + } + ] + } + } + }, + "optional":false + } + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":7,"column":44},"end":{"line":7,"column":46}}, + "range":[170,172], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/this_param/class_constructor.js b/lib/test/flow/this_param/class_constructor.js new file mode 100644 index 0000000..6a3fc4b --- /dev/null +++ b/lib/test/flow/this_param/class_constructor.js @@ -0,0 +1,15 @@ +class A { + constructor(this: string,) {} +} + +class B { + constructor(this: string, bar: number) {} +} + +class C { + constructor(this: string, bar: number, ...rest: Array) {} +} + +class D { + constructor(this: string, ...rest: Array) {} +} diff --git a/lib/test/flow/this_param/class_constructor.tree.json b/lib/test/flow/this_param/class_constructor.tree.json new file mode 100644 index 0000000..6ca5fda --- /dev/null +++ b/lib/test/flow/this_param/class_constructor.tree.json @@ -0,0 +1,391 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":26}}, + "message":"Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions." + }, + { + "loc":{"source":null,"start":{"line":6,"column":14},"end":{"line":6,"column":26}}, + "message":"Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions." + }, + { + "loc":{"source":null,"start":{"line":10,"column":14},"end":{"line":10,"column":26}}, + "message":"Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions." + }, + { + "loc":{"source":null,"start":{"line":14,"column":14},"end":{"line":14,"column":26}}, + "message":"Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":15,"column":1}}, + "range":[0,251], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,43], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "range":[8,43], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":31}}, + "range":[12,41], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, + "range":[12,23], + "name":"constructor", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":31}}, + "range":[23,41], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":29},"end":{"line":2,"column":31}}, + "range":[39,41], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"constructor", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":7,"column":1}}, + "range":[45,100], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":6},"end":{"line":5,"column":7}}, + "range":[51,52], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":5,"column":8},"end":{"line":7,"column":1}}, + "range":[53,100], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":43}}, + "range":[57,98], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":13}}, + "range":[57,68], + "name":"constructor", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":6,"column":13},"end":{"line":6,"column":43}}, + "range":[68,98], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":28},"end":{"line":6,"column":39}}, + "range":[83,94], + "name":"bar", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":6,"column":31},"end":{"line":6,"column":39}}, + "range":[86,94], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":6,"column":33},"end":{"line":6,"column":39}}, + "range":[88,94] + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":6,"column":41},"end":{"line":6,"column":43}}, + "range":[96,98], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"constructor", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":11,"column":1}}, + "range":[102,182], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":6},"end":{"line":9,"column":7}}, + "range":[108,109], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":9,"column":8},"end":{"line":11,"column":1}}, + "range":[110,182], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":10,"column":2},"end":{"line":10,"column":68}}, + "range":[114,180], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":10,"column":2},"end":{"line":10,"column":13}}, + "range":[114,125], + "name":"constructor", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":10,"column":13},"end":{"line":10,"column":68}}, + "range":[125,180], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":10,"column":28},"end":{"line":10,"column":39}}, + "range":[140,151], + "name":"bar", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":10,"column":31},"end":{"line":10,"column":39}}, + "range":[143,151], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":10,"column":33},"end":{"line":10,"column":39}}, + "range":[145,151] + } + }, + "optional":false + }, + { + "type":"RestElement", + "loc":{"source":null,"start":{"line":10,"column":41},"end":{"line":10,"column":64}}, + "range":[153,176], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":10,"column":44},"end":{"line":10,"column":64}}, + "range":[156,176], + "name":"rest", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":10,"column":48},"end":{"line":10,"column":64}}, + "range":[160,176], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":10,"column":50},"end":{"line":10,"column":64}}, + "range":[162,176], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":10,"column":50},"end":{"line":10,"column":55}}, + "range":[162,167], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":10,"column":55},"end":{"line":10,"column":64}}, + "range":[167,176], + "params":[ + { + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":10,"column":56},"end":{"line":10,"column":63}}, + "range":[168,175] + } + ] + } + } + }, + "optional":false + } + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":10,"column":66},"end":{"line":10,"column":68}}, + "range":[178,180], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"constructor", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":13,"column":0},"end":{"line":15,"column":1}}, + "range":[184,251], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":13,"column":6},"end":{"line":13,"column":7}}, + "range":[190,191], + "name":"D", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":13,"column":8},"end":{"line":15,"column":1}}, + "range":[192,251], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":14,"column":2},"end":{"line":14,"column":55}}, + "range":[196,249], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":14,"column":2},"end":{"line":14,"column":13}}, + "range":[196,207], + "name":"constructor", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":14,"column":13},"end":{"line":14,"column":55}}, + "range":[207,249], + "id":null, + "params":[ + { + "type":"RestElement", + "loc":{"source":null,"start":{"line":14,"column":28},"end":{"line":14,"column":51}}, + "range":[222,245], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":14,"column":31},"end":{"line":14,"column":51}}, + "range":[225,245], + "name":"rest", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":14,"column":35},"end":{"line":14,"column":51}}, + "range":[229,245], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":14,"column":37},"end":{"line":14,"column":51}}, + "range":[231,245], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":14,"column":37},"end":{"line":14,"column":42}}, + "range":[231,236], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":14,"column":42},"end":{"line":14,"column":51}}, + "range":[236,245], + "params":[ + { + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":14,"column":43},"end":{"line":14,"column":50}}, + "range":[237,244] + } + ] + } + } + }, + "optional":false + } + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":14,"column":53},"end":{"line":14,"column":55}}, + "range":[247,249], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"constructor", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/this_param/class_method.js b/lib/test/flow/this_param/class_method.js new file mode 100644 index 0000000..c320ba9 --- /dev/null +++ b/lib/test/flow/this_param/class_method.js @@ -0,0 +1,9 @@ +class Foo { + foo1(this: string) {} + + foo2(this: string, bar: number) {} + + foo3(this: string, bar: number, ...rest: Array) {} + + foo4(this: string, ...rest: Array) {} +} diff --git a/lib/test/flow/this_param/class_method.tree.json b/lib/test/flow/this_param/class_method.tree.json new file mode 100644 index 0000000..525772f --- /dev/null +++ b/lib/test/flow/this_param/class_method.tree.json @@ -0,0 +1,363 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, + "range":[0,188], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, + "range":[0,188], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":9,"column":1}}, + "range":[10,188], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":23}}, + "range":[14,35], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":6}}, + "range":[14,18], + "name":"foo1", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":23}}, + "range":[18,35], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":19}}, + "range":[19,31], + "name":"this", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":19}}, + "range":[23,31], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":19}}, + "range":[25,31] + } + } + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":21},"end":{"line":2,"column":23}}, + "range":[33,35], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":36}}, + "range":[39,73], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":6}}, + "range":[39,43], + "name":"foo2", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":4,"column":6},"end":{"line":4,"column":36}}, + "range":[43,73], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":7},"end":{"line":4,"column":19}}, + "range":[44,56], + "name":"this", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":11},"end":{"line":4,"column":19}}, + "range":[48,56], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":13},"end":{"line":4,"column":19}}, + "range":[50,56] + } + } + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":21},"end":{"line":4,"column":32}}, + "range":[58,69], + "name":"bar", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":24},"end":{"line":4,"column":32}}, + "range":[61,69], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":26},"end":{"line":4,"column":32}}, + "range":[63,69] + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":4,"column":34},"end":{"line":4,"column":36}}, + "range":[71,73], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":61}}, + "range":[77,136], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":6}}, + "range":[77,81], + "name":"foo3", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":6,"column":6},"end":{"line":6,"column":61}}, + "range":[81,136], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":7},"end":{"line":6,"column":19}}, + "range":[82,94], + "name":"this", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":6,"column":11},"end":{"line":6,"column":19}}, + "range":[86,94], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":6,"column":13},"end":{"line":6,"column":19}}, + "range":[88,94] + } + } + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":21},"end":{"line":6,"column":32}}, + "range":[96,107], + "name":"bar", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":6,"column":24},"end":{"line":6,"column":32}}, + "range":[99,107], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":6,"column":26},"end":{"line":6,"column":32}}, + "range":[101,107] + } + }, + "optional":false + }, + { + "type":"RestElement", + "loc":{"source":null,"start":{"line":6,"column":34},"end":{"line":6,"column":57}}, + "range":[109,132], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":37},"end":{"line":6,"column":57}}, + "range":[112,132], + "name":"rest", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":6,"column":41},"end":{"line":6,"column":57}}, + "range":[116,132], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":6,"column":43},"end":{"line":6,"column":57}}, + "range":[118,132], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":43},"end":{"line":6,"column":48}}, + "range":[118,123], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":6,"column":48},"end":{"line":6,"column":57}}, + "range":[123,132], + "params":[ + { + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":6,"column":49},"end":{"line":6,"column":56}}, + "range":[124,131] + } + ] + } + } + }, + "optional":false + } + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":6,"column":59},"end":{"line":6,"column":61}}, + "range":[134,136], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":8,"column":2},"end":{"line":8,"column":48}}, + "range":[140,186], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":8,"column":2},"end":{"line":8,"column":6}}, + "range":[140,144], + "name":"foo4", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":8,"column":6},"end":{"line":8,"column":48}}, + "range":[144,186], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":8,"column":7},"end":{"line":8,"column":19}}, + "range":[145,157], + "name":"this", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":8,"column":11},"end":{"line":8,"column":19}}, + "range":[149,157], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":8,"column":13},"end":{"line":8,"column":19}}, + "range":[151,157] + } + } + }, + { + "type":"RestElement", + "loc":{"source":null,"start":{"line":8,"column":21},"end":{"line":8,"column":44}}, + "range":[159,182], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":8,"column":24},"end":{"line":8,"column":44}}, + "range":[162,182], + "name":"rest", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":8,"column":28},"end":{"line":8,"column":44}}, + "range":[166,182], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":8,"column":30},"end":{"line":8,"column":44}}, + "range":[168,182], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":8,"column":30},"end":{"line":8,"column":35}}, + "range":[168,173], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":8,"column":35},"end":{"line":8,"column":44}}, + "range":[173,182], + "params":[ + { + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":8,"column":36},"end":{"line":8,"column":43}}, + "range":[174,181] + } + ] + } + } + }, + "optional":false + } + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":8,"column":46},"end":{"line":8,"column":48}}, + "range":[184,186], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/this_param/declare_class.js b/lib/test/flow/this_param/declare_class.js new file mode 100644 index 0000000..3732a94 --- /dev/null +++ b/lib/test/flow/this_param/declare_class.js @@ -0,0 +1,9 @@ +declare class Foo { + foo1(this: string): void; + + foo2(this: string, bar: number): void; + + foo3(this: string, bar: number, ...rest: Array): void; + + foo4(this: string, ...rest: Array): void; +} diff --git a/lib/test/flow/this_param/declare_class.tree.json b/lib/test/flow/this_param/declare_class.tree.json new file mode 100644 index 0000000..3d58c7b --- /dev/null +++ b/lib/test/flow/this_param/declare_class.tree.json @@ -0,0 +1,328 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, + "range":[0,212], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, + "range":[0,212], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, + "range":[14,17], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":9,"column":1}}, + "range":[18,212], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":26}}, + "range":[22,46], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":6}}, + "range":[22,26], + "name":"foo1", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":26}}, + "range":[22,46], + "params":[], + "this":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":19}}, + "range":[27,39], + "name":null, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":19}}, + "range":[33,39] + }, + "optional":false + }, + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":22},"end":{"line":2,"column":26}}, + "range":[42,46] + }, + "rest":null, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + }, + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":39}}, + "range":[51,88], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":6}}, + "range":[51,55], + "name":"foo2", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":39}}, + "range":[51,88], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":4,"column":21},"end":{"line":4,"column":32}}, + "range":[70,81], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":21},"end":{"line":4,"column":24}}, + "range":[70,73], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":26},"end":{"line":4,"column":32}}, + "range":[75,81] + }, + "optional":false + } + ], + "this":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":4,"column":7},"end":{"line":4,"column":19}}, + "range":[56,68], + "name":null, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":13},"end":{"line":4,"column":19}}, + "range":[62,68] + }, + "optional":false + }, + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":35},"end":{"line":4,"column":39}}, + "range":[84,88] + }, + "rest":null, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + }, + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":64}}, + "range":[93,155], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":6}}, + "range":[93,97], + "name":"foo3", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":64}}, + "range":[93,155], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":6,"column":21},"end":{"line":6,"column":32}}, + "range":[112,123], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":21},"end":{"line":6,"column":24}}, + "range":[112,115], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":6,"column":26},"end":{"line":6,"column":32}}, + "range":[117,123] + }, + "optional":false + } + ], + "this":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":6,"column":7},"end":{"line":6,"column":19}}, + "range":[98,110], + "name":null, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":6,"column":13},"end":{"line":6,"column":19}}, + "range":[104,110] + }, + "optional":false + }, + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":6,"column":60},"end":{"line":6,"column":64}}, + "range":[151,155] + }, + "rest":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":6,"column":37},"end":{"line":6,"column":57}}, + "range":[128,148], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":37},"end":{"line":6,"column":41}}, + "range":[128,132], + "name":"rest", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":6,"column":43},"end":{"line":6,"column":57}}, + "range":[134,148], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":43},"end":{"line":6,"column":48}}, + "range":[134,139], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":6,"column":48},"end":{"line":6,"column":57}}, + "range":[139,148], + "params":[ + { + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":6,"column":49},"end":{"line":6,"column":56}}, + "range":[140,147] + } + ] + } + }, + "optional":false + }, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + }, + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":8,"column":2},"end":{"line":8,"column":51}}, + "range":[160,209], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":8,"column":2},"end":{"line":8,"column":6}}, + "range":[160,164], + "name":"foo4", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":8,"column":2},"end":{"line":8,"column":51}}, + "range":[160,209], + "params":[], + "this":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":8,"column":7},"end":{"line":8,"column":19}}, + "range":[165,177], + "name":null, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":8,"column":13},"end":{"line":8,"column":19}}, + "range":[171,177] + }, + "optional":false + }, + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":8,"column":47},"end":{"line":8,"column":51}}, + "range":[205,209] + }, + "rest":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":8,"column":24},"end":{"line":8,"column":44}}, + "range":[182,202], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":8,"column":24},"end":{"line":8,"column":28}}, + "range":[182,186], + "name":"rest", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":8,"column":30},"end":{"line":8,"column":44}}, + "range":[188,202], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":8,"column":30},"end":{"line":8,"column":35}}, + "range":[188,193], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":8,"column":35},"end":{"line":8,"column":44}}, + "range":[193,202], + "params":[ + { + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":8,"column":36},"end":{"line":8,"column":43}}, + "range":[194,201] + } + ] + } + }, + "optional":false + }, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/this_param/declare_function.js b/lib/test/flow/this_param/declare_function.js new file mode 100644 index 0000000..8c9cdf1 --- /dev/null +++ b/lib/test/flow/this_param/declare_function.js @@ -0,0 +1,7 @@ +declare function foo1(this: string): void + +declare function foo2(this: string, bar: number): void + +declare function foo3(this: string, bar: number, ...rest: Array): void + +declare function foo4(this: string, ...rest: Array): void diff --git a/lib/test/flow/this_param/declare_function.tree.json b/lib/test/flow/this_param/declare_function.tree.json new file mode 100644 index 0000000..7a7ee46 --- /dev/null +++ b/lib/test/flow/this_param/declare_function.tree.json @@ -0,0 +1,296 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":7,"column":66}}, + "range":[0,246], + "body":[ + { + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "range":[0,41], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":41}}, + "range":[17,41], + "name":"foo1", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":41}}, + "range":[21,41], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":41}}, + "range":[21,41], + "params":[], + "this":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":34}}, + "range":[22,34], + "name":null, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":34}}, + "range":[28,34] + }, + "optional":false + }, + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":41}}, + "range":[37,41] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + }, + { + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":54}}, + "range":[43,97], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":17},"end":{"line":3,"column":54}}, + "range":[60,97], + "name":"foo2", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":21},"end":{"line":3,"column":54}}, + "range":[64,97], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":21},"end":{"line":3,"column":54}}, + "range":[64,97], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":3,"column":36},"end":{"line":3,"column":47}}, + "range":[79,90], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":36},"end":{"line":3,"column":39}}, + "range":[79,82], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":41},"end":{"line":3,"column":47}}, + "range":[84,90] + }, + "optional":false + } + ], + "this":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":3,"column":22},"end":{"line":3,"column":34}}, + "range":[65,77], + "name":null, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":28},"end":{"line":3,"column":34}}, + "range":[71,77] + }, + "optional":false + }, + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":50},"end":{"line":3,"column":54}}, + "range":[93,97] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + }, + { + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":79}}, + "range":[99,178], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":17},"end":{"line":5,"column":79}}, + "range":[116,178], + "name":"foo3", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":21},"end":{"line":5,"column":79}}, + "range":[120,178], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":21},"end":{"line":5,"column":79}}, + "range":[120,178], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":5,"column":36},"end":{"line":5,"column":47}}, + "range":[135,146], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":36},"end":{"line":5,"column":39}}, + "range":[135,138], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":41},"end":{"line":5,"column":47}}, + "range":[140,146] + }, + "optional":false + } + ], + "this":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":5,"column":22},"end":{"line":5,"column":34}}, + "range":[121,133], + "name":null, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":28},"end":{"line":5,"column":34}}, + "range":[127,133] + }, + "optional":false + }, + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":75},"end":{"line":5,"column":79}}, + "range":[174,178] + }, + "rest":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":5,"column":52},"end":{"line":5,"column":72}}, + "range":[151,171], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":52},"end":{"line":5,"column":56}}, + "range":[151,155], + "name":"rest", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":58},"end":{"line":5,"column":72}}, + "range":[157,171], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":58},"end":{"line":5,"column":63}}, + "range":[157,162], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":5,"column":63},"end":{"line":5,"column":72}}, + "range":[162,171], + "params":[ + { + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":64},"end":{"line":5,"column":71}}, + "range":[163,170] + } + ] + } + }, + "optional":false + }, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + }, + { + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":66}}, + "range":[180,246], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":17},"end":{"line":7,"column":66}}, + "range":[197,246], + "name":"foo4", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":21},"end":{"line":7,"column":66}}, + "range":[201,246], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":21},"end":{"line":7,"column":66}}, + "range":[201,246], + "params":[], + "this":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":7,"column":22},"end":{"line":7,"column":34}}, + "range":[202,214], + "name":null, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":28},"end":{"line":7,"column":34}}, + "range":[208,214] + }, + "optional":false + }, + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":62},"end":{"line":7,"column":66}}, + "range":[242,246] + }, + "rest":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":7,"column":39},"end":{"line":7,"column":59}}, + "range":[219,239], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":39},"end":{"line":7,"column":43}}, + "range":[219,223], + "name":"rest", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":45},"end":{"line":7,"column":59}}, + "range":[225,239], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":45},"end":{"line":7,"column":50}}, + "range":[225,230], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":7,"column":50},"end":{"line":7,"column":59}}, + "range":[230,239], + "params":[ + { + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":51},"end":{"line":7,"column":58}}, + "range":[231,238] + } + ] + } + }, + "optional":false + }, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/this_param/function_declaration.js b/lib/test/flow/this_param/function_declaration.js new file mode 100644 index 0000000..073f908 --- /dev/null +++ b/lib/test/flow/this_param/function_declaration.js @@ -0,0 +1,7 @@ +function foo1(this: string) {} + +function foo2(this: string, bar: number) {} + +function foo3(this: string, bar: number, ...rest: Array) {} + +function foo4(this: string, ...rest: Array) {} diff --git a/lib/test/flow/this_param/function_declaration.tree.json b/lib/test/flow/this_param/function_declaration.tree.json new file mode 100644 index 0000000..4ff99d0 --- /dev/null +++ b/lib/test/flow/this_param/function_declaration.tree.json @@ -0,0 +1,298 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":7,"column":55}}, + "range":[0,202], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, + "range":[9,13], + "name":"foo1", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":26}}, + "range":[14,26], + "name":"this", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":26}}, + "range":[18,26], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":26}}, + "range":[20,26] + } + } + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, + "range":[28,30], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":43}}, + "range":[32,75], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":9},"end":{"line":3,"column":13}}, + "range":[41,45], + "name":"foo2", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":14},"end":{"line":3,"column":26}}, + "range":[46,58], + "name":"this", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":18},"end":{"line":3,"column":26}}, + "range":[50,58], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":20},"end":{"line":3,"column":26}}, + "range":[52,58] + } + } + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":28},"end":{"line":3,"column":39}}, + "range":[60,71], + "name":"bar", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":31},"end":{"line":3,"column":39}}, + "range":[63,71], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":33},"end":{"line":3,"column":39}}, + "range":[65,71] + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":41},"end":{"line":3,"column":43}}, + "range":[73,75], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":68}}, + "range":[77,145], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":9},"end":{"line":5,"column":13}}, + "range":[86,90], + "name":"foo3", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":14},"end":{"line":5,"column":26}}, + "range":[91,103], + "name":"this", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":18},"end":{"line":5,"column":26}}, + "range":[95,103], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":20},"end":{"line":5,"column":26}}, + "range":[97,103] + } + } + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":28},"end":{"line":5,"column":39}}, + "range":[105,116], + "name":"bar", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":31},"end":{"line":5,"column":39}}, + "range":[108,116], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":33},"end":{"line":5,"column":39}}, + "range":[110,116] + } + }, + "optional":false + }, + { + "type":"RestElement", + "loc":{"source":null,"start":{"line":5,"column":41},"end":{"line":5,"column":64}}, + "range":[118,141], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":44},"end":{"line":5,"column":64}}, + "range":[121,141], + "name":"rest", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":48},"end":{"line":5,"column":64}}, + "range":[125,141], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":50},"end":{"line":5,"column":64}}, + "range":[127,141], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":50},"end":{"line":5,"column":55}}, + "range":[127,132], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":5,"column":55},"end":{"line":5,"column":64}}, + "range":[132,141], + "params":[ + { + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":56},"end":{"line":5,"column":63}}, + "range":[133,140] + } + ] + } + } + }, + "optional":false + } + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":5,"column":66},"end":{"line":5,"column":68}}, + "range":[143,145], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":55}}, + "range":[147,202], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":9},"end":{"line":7,"column":13}}, + "range":[156,160], + "name":"foo4", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":14},"end":{"line":7,"column":26}}, + "range":[161,173], + "name":"this", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":18},"end":{"line":7,"column":26}}, + "range":[165,173], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":20},"end":{"line":7,"column":26}}, + "range":[167,173] + } + } + }, + { + "type":"RestElement", + "loc":{"source":null,"start":{"line":7,"column":28},"end":{"line":7,"column":51}}, + "range":[175,198], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":31},"end":{"line":7,"column":51}}, + "range":[178,198], + "name":"rest", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":35},"end":{"line":7,"column":51}}, + "range":[182,198], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":37},"end":{"line":7,"column":51}}, + "range":[184,198], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":37},"end":{"line":7,"column":42}}, + "range":[184,189], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":7,"column":42},"end":{"line":7,"column":51}}, + "range":[189,198], + "params":[ + { + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":43},"end":{"line":7,"column":50}}, + "range":[190,197] + } + ] + } + } + }, + "optional":false + } + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":7,"column":53},"end":{"line":7,"column":55}}, + "range":[200,202], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/this_param/function_expression.js b/lib/test/flow/this_param/function_expression.js new file mode 100644 index 0000000..cc37af2 --- /dev/null +++ b/lib/test/flow/this_param/function_expression.js @@ -0,0 +1,7 @@ +(function foo1(this: string) {}); + +(function foo2(this: string, bar: number) {}); + +(function foo3(this: string, bar: number, ...rest: Array) {}); + +(function foo4(this: string, ...rest: Array) {}); diff --git a/lib/test/flow/this_param/function_expression.tree.json b/lib/test/flow/this_param/function_expression.tree.json new file mode 100644 index 0000000..d015b2c --- /dev/null +++ b/lib/test/flow/this_param/function_expression.tree.json @@ -0,0 +1,322 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":7,"column":58}}, + "range":[0,214], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "expression":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":31}}, + "range":[1,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, + "range":[10,14], + "name":"foo1", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":27}}, + "range":[15,27], + "name":"this", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, + "range":[19,27], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "range":[21,27] + } + } + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, + "range":[29,31], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":46}}, + "range":[35,81], + "expression":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":3,"column":1},"end":{"line":3,"column":44}}, + "range":[36,79], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":10},"end":{"line":3,"column":14}}, + "range":[45,49], + "name":"foo2", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":15},"end":{"line":3,"column":27}}, + "range":[50,62], + "name":"this", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":19},"end":{"line":3,"column":27}}, + "range":[54,62], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":21},"end":{"line":3,"column":27}}, + "range":[56,62] + } + } + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":29},"end":{"line":3,"column":40}}, + "range":[64,75], + "name":"bar", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":32},"end":{"line":3,"column":40}}, + "range":[67,75], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":34},"end":{"line":3,"column":40}}, + "range":[69,75] + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":42},"end":{"line":3,"column":44}}, + "range":[77,79], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":71}}, + "range":[83,154], + "expression":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":5,"column":1},"end":{"line":5,"column":69}}, + "range":[84,152], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":10},"end":{"line":5,"column":14}}, + "range":[93,97], + "name":"foo3", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":15},"end":{"line":5,"column":27}}, + "range":[98,110], + "name":"this", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":19},"end":{"line":5,"column":27}}, + "range":[102,110], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":21},"end":{"line":5,"column":27}}, + "range":[104,110] + } + } + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":29},"end":{"line":5,"column":40}}, + "range":[112,123], + "name":"bar", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":32},"end":{"line":5,"column":40}}, + "range":[115,123], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":34},"end":{"line":5,"column":40}}, + "range":[117,123] + } + }, + "optional":false + }, + { + "type":"RestElement", + "loc":{"source":null,"start":{"line":5,"column":42},"end":{"line":5,"column":65}}, + "range":[125,148], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":45},"end":{"line":5,"column":65}}, + "range":[128,148], + "name":"rest", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":49},"end":{"line":5,"column":65}}, + "range":[132,148], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":51},"end":{"line":5,"column":65}}, + "range":[134,148], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":51},"end":{"line":5,"column":56}}, + "range":[134,139], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":5,"column":56},"end":{"line":5,"column":65}}, + "range":[139,148], + "params":[ + { + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":57},"end":{"line":5,"column":64}}, + "range":[140,147] + } + ] + } + } + }, + "optional":false + } + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":5,"column":67},"end":{"line":5,"column":69}}, + "range":[150,152], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":58}}, + "range":[156,214], + "expression":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":7,"column":1},"end":{"line":7,"column":56}}, + "range":[157,212], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":10},"end":{"line":7,"column":14}}, + "range":[166,170], + "name":"foo4", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":15},"end":{"line":7,"column":27}}, + "range":[171,183], + "name":"this", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":19},"end":{"line":7,"column":27}}, + "range":[175,183], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":21},"end":{"line":7,"column":27}}, + "range":[177,183] + } + } + }, + { + "type":"RestElement", + "loc":{"source":null,"start":{"line":7,"column":29},"end":{"line":7,"column":52}}, + "range":[185,208], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":32},"end":{"line":7,"column":52}}, + "range":[188,208], + "name":"rest", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":36},"end":{"line":7,"column":52}}, + "range":[192,208], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":38},"end":{"line":7,"column":52}}, + "range":[194,208], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":38},"end":{"line":7,"column":43}}, + "range":[194,199], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":7,"column":43},"end":{"line":7,"column":52}}, + "range":[199,208], + "params":[ + { + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":44},"end":{"line":7,"column":51}}, + "range":[200,207] + } + ] + } + } + }, + "optional":false + } + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":7,"column":54},"end":{"line":7,"column":56}}, + "range":[210,212], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/this_param/function_type.js b/lib/test/flow/this_param/function_type.js new file mode 100644 index 0000000..b167b72 --- /dev/null +++ b/lib/test/flow/this_param/function_type.js @@ -0,0 +1,7 @@ +type foo1 = (this: string) => void; + +type foo2 = (this: string, bar: number) => void; + +type foo3 = (this: string, bar: number, ...rest: Array) => void; + +type foo4 = (this: string, ...rest: Array) => void; diff --git a/lib/test/flow/this_param/function_type.tree.json b/lib/test/flow/this_param/function_type.tree.json new file mode 100644 index 0000000..9999cca --- /dev/null +++ b/lib/test/flow/this_param/function_type.tree.json @@ -0,0 +1,280 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":7,"column":60}}, + "range":[0,222], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":9}}, + "range":[5,9], + "name":"foo1", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":34}}, + "range":[12,34], + "params":[], + "this":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":25}}, + "range":[13,25], + "name":null, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":25}}, + "range":[19,25] + }, + "optional":false + }, + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":34}}, + "range":[30,34] + }, + "rest":null, + "typeParameters":null + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":48}}, + "range":[37,85], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":5},"end":{"line":3,"column":9}}, + "range":[42,46], + "name":"foo2", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":12},"end":{"line":3,"column":47}}, + "range":[49,84], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":3,"column":27},"end":{"line":3,"column":38}}, + "range":[64,75], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":27},"end":{"line":3,"column":30}}, + "range":[64,67], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":32},"end":{"line":3,"column":38}}, + "range":[69,75] + }, + "optional":false + } + ], + "this":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":3,"column":13},"end":{"line":3,"column":25}}, + "range":[50,62], + "name":null, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":19},"end":{"line":3,"column":25}}, + "range":[56,62] + }, + "optional":false + }, + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":43},"end":{"line":3,"column":47}}, + "range":[80,84] + }, + "rest":null, + "typeParameters":null + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":73}}, + "range":[87,160], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":5},"end":{"line":5,"column":9}}, + "range":[92,96], + "name":"foo3", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":12},"end":{"line":5,"column":72}}, + "range":[99,159], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":5,"column":27},"end":{"line":5,"column":38}}, + "range":[114,125], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":27},"end":{"line":5,"column":30}}, + "range":[114,117], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":32},"end":{"line":5,"column":38}}, + "range":[119,125] + }, + "optional":false + } + ], + "this":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":5,"column":13},"end":{"line":5,"column":25}}, + "range":[100,112], + "name":null, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":19},"end":{"line":5,"column":25}}, + "range":[106,112] + }, + "optional":false + }, + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":68},"end":{"line":5,"column":72}}, + "range":[155,159] + }, + "rest":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":5,"column":43},"end":{"line":5,"column":63}}, + "range":[130,150], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":43},"end":{"line":5,"column":47}}, + "range":[130,134], + "name":"rest", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":49},"end":{"line":5,"column":63}}, + "range":[136,150], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":49},"end":{"line":5,"column":54}}, + "range":[136,141], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":5,"column":54},"end":{"line":5,"column":63}}, + "range":[141,150], + "params":[ + { + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":55},"end":{"line":5,"column":62}}, + "range":[142,149] + } + ] + } + }, + "optional":false + }, + "typeParameters":null + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":60}}, + "range":[162,222], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":5},"end":{"line":7,"column":9}}, + "range":[167,171], + "name":"foo4", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":12},"end":{"line":7,"column":59}}, + "range":[174,221], + "params":[], + "this":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":7,"column":13},"end":{"line":7,"column":25}}, + "range":[175,187], + "name":null, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":19},"end":{"line":7,"column":25}}, + "range":[181,187] + }, + "optional":false + }, + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":55},"end":{"line":7,"column":59}}, + "range":[217,221] + }, + "rest":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":7,"column":30},"end":{"line":7,"column":50}}, + "range":[192,212], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":30},"end":{"line":7,"column":34}}, + "range":[192,196], + "name":"rest", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":36},"end":{"line":7,"column":50}}, + "range":[198,212], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":36},"end":{"line":7,"column":41}}, + "range":[198,203], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":7,"column":41},"end":{"line":7,"column":50}}, + "range":[203,212], + "params":[ + { + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":42},"end":{"line":7,"column":49}}, + "range":[204,211] + } + ] + } + }, + "optional":false + }, + "typeParameters":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/this_param/function_type_no_annotation.js b/lib/test/flow/this_param/function_type_no_annotation.js new file mode 100644 index 0000000..093605f --- /dev/null +++ b/lib/test/flow/this_param/function_type_no_annotation.js @@ -0,0 +1,3 @@ +// These are ok - foo is a function which takes the `this` type +type foo = (this) => void; +type bar = this => void; diff --git a/lib/test/flow/this_param/function_type_no_annotation.tree.json b/lib/test/flow/this_param/function_type_no_annotation.tree.json new file mode 100644 index 0000000..be3a61c --- /dev/null +++ b/lib/test/flow/this_param/function_type_no_annotation.tree.json @@ -0,0 +1,115 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":3,"column":24}}, + "range":[64,115], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":26}}, + "range":[64,90], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":8}}, + "range":[69,72], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":25}}, + "range":[75,89], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":16}}, + "range":[76,80], + "name":null, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":16}}, + "range":[76,80], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":16}}, + "range":[76,80], + "name":"this", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "optional":false + } + ], + "this":null, + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":21},"end":{"line":2,"column":25}}, + "range":[85,89] + }, + "rest":null, + "typeParameters":null + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":24}}, + "range":[91,115], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":5},"end":{"line":3,"column":8}}, + "range":[96,99], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":11},"end":{"line":3,"column":23}}, + "range":[102,114], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":3,"column":11},"end":{"line":3,"column":15}}, + "range":[102,106], + "name":null, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":11},"end":{"line":3,"column":15}}, + "range":[102,106], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":11},"end":{"line":3,"column":15}}, + "range":[102,106], + "name":"this", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "optional":false + } + ], + "this":null, + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":19},"end":{"line":3,"column":23}}, + "range":[110,114] + }, + "rest":null, + "typeParameters":null + } + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "range":[0,63], + "value":" These are ok - foo is a function which takes the `this` type" + } + ] +} diff --git a/lib/test/flow/this_param/getters_and_setters.js b/lib/test/flow/this_param/getters_and_setters.js new file mode 100644 index 0000000..a0fb022 --- /dev/null +++ b/lib/test/flow/this_param/getters_and_setters.js @@ -0,0 +1,4 @@ +class Foo { + get foo(this: string) {} + set foo(this: string) {} +} diff --git a/lib/test/flow/this_param/getters_and_setters.tree.json b/lib/test/flow/this_param/getters_and_setters.tree.json new file mode 100644 index 0000000..8a26c5e --- /dev/null +++ b/lib/test/flow/this_param/getters_and_setters.tree.json @@ -0,0 +1,149 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":9}}, + "message":"A getter cannot have a `this` parameter." + }, + { + "loc":{"source":null,"start":{"line":3,"column":6},"end":{"line":3,"column":9}}, + "message":"A setter cannot have a `this` parameter." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,67], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,67], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":4,"column":1}}, + "range":[10,67], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":26}}, + "range":[14,38], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":9}}, + "range":[18,21], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":26}}, + "range":[21,38], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":22}}, + "range":[22,34], + "name":"this", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":22}}, + "range":[26,34], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":22}}, + "range":[28,34] + } + } + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":24},"end":{"line":2,"column":26}}, + "range":[36,38], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"get", + "static":false, + "computed":false, + "decorators":[] + }, + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":26}}, + "range":[41,65], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":6},"end":{"line":3,"column":9}}, + "range":[45,48], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":3,"column":9},"end":{"line":3,"column":26}}, + "range":[48,65], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":10},"end":{"line":3,"column":22}}, + "range":[49,61], + "name":"this", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":14},"end":{"line":3,"column":22}}, + "range":[53,61], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":16},"end":{"line":3,"column":22}}, + "range":[55,61] + } + } + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":3,"column":24},"end":{"line":3,"column":26}}, + "range":[63,65], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"set", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/this_param/must_be_first.js b/lib/test/flow/this_param/must_be_first.js new file mode 100644 index 0000000..f195f69 --- /dev/null +++ b/lib/test/flow/this_param/must_be_first.js @@ -0,0 +1 @@ +function foo(bar: number, this: string) {} diff --git a/lib/test/flow/this_param/must_be_first.tree.json b/lib/test/flow/this_param/must_be_first.tree.json new file mode 100644 index 0000000..7863ba6 --- /dev/null +++ b/lib/test/flow/this_param/must_be_first.tree.json @@ -0,0 +1,79 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":30}}, + "message":"The `this` parameter must be the first function parameter." + }, + { + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":30}}, + "message":"Unexpected token `this`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "range":[0,42], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "range":[0,42], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":24}}, + "range":[13,24], + "name":"bar", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":24}}, + "range":[16,24], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":24}}, + "range":[18,24] + } + }, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":38}}, + "range":[26,38], + "name":"this", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":38}}, + "range":[30,38], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":38}}, + "range":[32,38] + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":40},"end":{"line":1,"column":42}}, + "range":[40,42], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/this_param/no_shorthand_arrow_function.js b/lib/test/flow/this_param/no_shorthand_arrow_function.js new file mode 100644 index 0000000..f327c80 --- /dev/null +++ b/lib/test/flow/this_param/no_shorthand_arrow_function.js @@ -0,0 +1 @@ +(this => {}); diff --git a/lib/test/flow/this_param/no_shorthand_arrow_function.tree.json b/lib/test/flow/this_param/no_shorthand_arrow_function.tree.json new file mode 100644 index 0000000..b622d7b --- /dev/null +++ b/lib/test/flow/this_param/no_shorthand_arrow_function.tree.json @@ -0,0 +1,44 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":8}}, + "message":"Unexpected token `=>`, expected the token `)`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "message":"Unexpected token `{`, expected the end of an expression statement (`;`)" + }, + { + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "message":"Unexpected token `)`, expected the start of a statement" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "range":[0,8], + "expression":{ + "type":"ThisExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, + "range":[1,5] + }, + "directive":null + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, + "range":[9,11], + "body":[] + }, + { + "type":"EmptyStatement", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13] + } + ], + "comments":[] +} diff --git a/lib/test/flow/this_param/not_an_arrow_function.js b/lib/test/flow/this_param/not_an_arrow_function.js new file mode 100644 index 0000000..166df52 --- /dev/null +++ b/lib/test/flow/this_param/not_an_arrow_function.js @@ -0,0 +1,5 @@ +class Foo { + bar(): number { + return ((this: any): number); + } +} diff --git a/lib/test/flow/this_param/not_an_arrow_function.tree.json b/lib/test/flow/this_param/not_an_arrow_function.tree.json new file mode 100644 index 0000000..4ead9bf --- /dev/null +++ b/lib/test/flow/this_param/not_an_arrow_function.tree.json @@ -0,0 +1,119 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "range":[0,69], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "range":[0,69], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":5,"column":1}}, + "range":[10,69], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":4,"column":3}}, + "range":[14,67], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "range":[14,17], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":4,"column":3}}, + "range":[17,67], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":4,"column":3}}, + "range":[28,67], + "body":[ + { + "type":"ReturnStatement", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":33}}, + "range":[34,63], + "argument":{ + "type":"TypeCastExpression", + "loc":{"source":null,"start":{"line":3,"column":11},"end":{"line":3,"column":32}}, + "range":[41,62], + "expression":{ + "type":"TypeCastExpression", + "loc":{"source":null,"start":{"line":3,"column":12},"end":{"line":3,"column":23}}, + "range":[42,53], + "expression":{ + "type":"ThisExpression", + "loc":{"source":null,"start":{"line":3,"column":13},"end":{"line":3,"column":17}}, + "range":[43,47] + }, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":17},"end":{"line":3,"column":22}}, + "range":[47,52], + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":19},"end":{"line":3,"column":22}}, + "range":[49,52] + } + } + }, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":23},"end":{"line":3,"column":31}}, + "range":[53,61], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":25},"end":{"line":3,"column":31}}, + "range":[55,61] + } + } + } + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":15}}, + "range":[19,27], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":15}}, + "range":[21,27] + } + }, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/this_param/object_method.js b/lib/test/flow/this_param/object_method.js new file mode 100644 index 0000000..b3ac79f --- /dev/null +++ b/lib/test/flow/this_param/object_method.js @@ -0,0 +1,9 @@ +({ + foo1(this: string) {}, + + foo2(this: string, bar: number) {}, + + foo3(this: string, bar: number, ...rest: Array) {}, + + foo4(this: string, ...rest: Array) {} +}); diff --git a/lib/test/flow/this_param/object_method.tree.json b/lib/test/flow/this_param/object_method.tree.json new file mode 100644 index 0000000..75bd282 --- /dev/null +++ b/lib/test/flow/this_param/object_method.tree.json @@ -0,0 +1,351 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":9,"column":3}}, + "range":[0,184], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":9,"column":3}}, + "range":[0,184], + "expression":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":9,"column":1}}, + "range":[1,182], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":23}}, + "range":[5,26], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":6}}, + "range":[5,9], + "name":"foo1", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":23}}, + "range":[9,26], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":19}}, + "range":[10,22], + "name":"this", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":19}}, + "range":[14,22], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":19}}, + "range":[16,22] + } + } + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":21},"end":{"line":2,"column":23}}, + "range":[24,26], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"init", + "method":true, + "shorthand":false, + "computed":false + }, + { + "type":"Property", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":36}}, + "range":[31,65], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":6}}, + "range":[31,35], + "name":"foo2", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":4,"column":6},"end":{"line":4,"column":36}}, + "range":[35,65], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":7},"end":{"line":4,"column":19}}, + "range":[36,48], + "name":"this", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":11},"end":{"line":4,"column":19}}, + "range":[40,48], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":13},"end":{"line":4,"column":19}}, + "range":[42,48] + } + } + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":21},"end":{"line":4,"column":32}}, + "range":[50,61], + "name":"bar", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":24},"end":{"line":4,"column":32}}, + "range":[53,61], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":26},"end":{"line":4,"column":32}}, + "range":[55,61] + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":4,"column":34},"end":{"line":4,"column":36}}, + "range":[63,65], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"init", + "method":true, + "shorthand":false, + "computed":false + }, + { + "type":"Property", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":61}}, + "range":[70,129], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":6}}, + "range":[70,74], + "name":"foo3", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":6,"column":6},"end":{"line":6,"column":61}}, + "range":[74,129], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":7},"end":{"line":6,"column":19}}, + "range":[75,87], + "name":"this", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":6,"column":11},"end":{"line":6,"column":19}}, + "range":[79,87], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":6,"column":13},"end":{"line":6,"column":19}}, + "range":[81,87] + } + } + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":21},"end":{"line":6,"column":32}}, + "range":[89,100], + "name":"bar", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":6,"column":24},"end":{"line":6,"column":32}}, + "range":[92,100], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":6,"column":26},"end":{"line":6,"column":32}}, + "range":[94,100] + } + }, + "optional":false + }, + { + "type":"RestElement", + "loc":{"source":null,"start":{"line":6,"column":34},"end":{"line":6,"column":57}}, + "range":[102,125], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":37},"end":{"line":6,"column":57}}, + "range":[105,125], + "name":"rest", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":6,"column":41},"end":{"line":6,"column":57}}, + "range":[109,125], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":6,"column":43},"end":{"line":6,"column":57}}, + "range":[111,125], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":43},"end":{"line":6,"column":48}}, + "range":[111,116], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":6,"column":48},"end":{"line":6,"column":57}}, + "range":[116,125], + "params":[ + { + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":6,"column":49},"end":{"line":6,"column":56}}, + "range":[117,124] + } + ] + } + } + }, + "optional":false + } + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":6,"column":59},"end":{"line":6,"column":61}}, + "range":[127,129], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"init", + "method":true, + "shorthand":false, + "computed":false + }, + { + "type":"Property", + "loc":{"source":null,"start":{"line":8,"column":2},"end":{"line":8,"column":48}}, + "range":[134,180], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":8,"column":2},"end":{"line":8,"column":6}}, + "range":[134,138], + "name":"foo4", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":8,"column":6},"end":{"line":8,"column":48}}, + "range":[138,180], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":8,"column":7},"end":{"line":8,"column":19}}, + "range":[139,151], + "name":"this", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":8,"column":11},"end":{"line":8,"column":19}}, + "range":[143,151], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":8,"column":13},"end":{"line":8,"column":19}}, + "range":[145,151] + } + } + }, + { + "type":"RestElement", + "loc":{"source":null,"start":{"line":8,"column":21},"end":{"line":8,"column":44}}, + "range":[153,176], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":8,"column":24},"end":{"line":8,"column":44}}, + "range":[156,176], + "name":"rest", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":8,"column":28},"end":{"line":8,"column":44}}, + "range":[160,176], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":8,"column":30},"end":{"line":8,"column":44}}, + "range":[162,176], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":8,"column":30},"end":{"line":8,"column":35}}, + "range":[162,167], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":8,"column":35},"end":{"line":8,"column":44}}, + "range":[167,176], + "params":[ + { + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":8,"column":36},"end":{"line":8,"column":43}}, + "range":[168,175] + } + ] + } + } + }, + "optional":false + } + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":8,"column":46},"end":{"line":8,"column":48}}, + "range":[178,180], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"init", + "method":true, + "shorthand":false, + "computed":false + } + ] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/trailing_commas/migrated_0000.js b/lib/test/flow/trailing_commas/migrated_0000.js new file mode 100644 index 0000000..112298e --- /dev/null +++ b/lib/test/flow/trailing_commas/migrated_0000.js @@ -0,0 +1 @@ +Math.max(a, b, c,) diff --git a/lib/test/flow/trailing_commas/migrated_0000.tree.json b/lib/test/flow/trailing_commas/migrated_0000.tree.json new file mode 100644 index 0000000..3e323a5 --- /dev/null +++ b/lib/test/flow/trailing_commas/migrated_0000.tree.json @@ -0,0 +1,67 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "callee":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "range":[0,8], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "name":"Math", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, + "range":[5,8], + "name":"max", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "arguments":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"c", + "typeAnnotation":null, + "optional":false + } + ] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/trailing_commas/migrated_0001.js b/lib/test/flow/trailing_commas/migrated_0001.js new file mode 100644 index 0000000..a6f7f19 --- /dev/null +++ b/lib/test/flow/trailing_commas/migrated_0001.js @@ -0,0 +1 @@ +var exp = function(a, b,) { return a + b; }; diff --git a/lib/test/flow/trailing_commas/migrated_0001.tree.json b/lib/test/flow/trailing_commas/migrated_0001.tree.json new file mode 100644 index 0000000..ac65c9b --- /dev/null +++ b/lib/test/flow/trailing_commas/migrated_0001.tree.json @@ -0,0 +1,93 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, + "range":[0,44], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, + "range":[0,44], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":43}}, + "range":[4,43], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "range":[4,7], + "name":"exp", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":43}}, + "range":[10,43], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "range":[19,20], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, + "range":[22,23], + "name":"b", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":43}}, + "range":[26,43], + "body":[ + { + "type":"ReturnStatement", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":41}}, + "range":[28,41], + "argument":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":40}}, + "range":[35,40], + "operator":"+", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":36}}, + "range":[35,36], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":40}}, + "range":[39,40], + "name":"b", + "typeAnnotation":null, + "optional":false + } + } + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/trailing_commas/migrated_0002.js b/lib/test/flow/trailing_commas/migrated_0002.js new file mode 100644 index 0000000..a84a693 --- /dev/null +++ b/lib/test/flow/trailing_commas/migrated_0002.js @@ -0,0 +1 @@ +function dec(a, b,) { return a + b; } diff --git a/lib/test/flow/trailing_commas/migrated_0002.tree.json b/lib/test/flow/trailing_commas/migrated_0002.tree.json new file mode 100644 index 0000000..3aa1472 --- /dev/null +++ b/lib/test/flow/trailing_commas/migrated_0002.tree.json @@ -0,0 +1,79 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "range":[0,37], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "range":[0,37], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"dec", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "range":[16,17], + "name":"b", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":37}}, + "range":[20,37], + "body":[ + { + "type":"ReturnStatement", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":35}}, + "range":[22,35], + "argument":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":34}}, + "range":[29,34], + "operator":"+", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, + "range":[29,30], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":34}}, + "range":[33,34], + "name":"b", + "typeAnnotation":null, + "optional":false + } + } + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/trailing_commas/migrated_0003.js b/lib/test/flow/trailing_commas/migrated_0003.js new file mode 100644 index 0000000..a9ebe83 --- /dev/null +++ b/lib/test/flow/trailing_commas/migrated_0003.js @@ -0,0 +1 @@ +class Test { constructor(x, y,) {} } diff --git a/lib/test/flow/trailing_commas/migrated_0003.tree.json b/lib/test/flow/trailing_commas/migrated_0003.tree.json new file mode 100644 index 0000000..abd5ebb --- /dev/null +++ b/lib/test/flow/trailing_commas/migrated_0003.tree.json @@ -0,0 +1,86 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":10}}, + "range":[6,10], + "name":"Test", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":36}}, + "range":[11,36], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":34}}, + "range":[13,34], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":24}}, + "range":[13,24], + "name":"constructor", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":34}}, + "range":[24,34], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, + "range":[25,26], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":29}}, + "range":[28,29], + "name":"y", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":34}}, + "range":[32,34], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"constructor", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/trailing_commas/migrated_0004.js b/lib/test/flow/trailing_commas/migrated_0004.js new file mode 100644 index 0000000..4abd9dc --- /dev/null +++ b/lib/test/flow/trailing_commas/migrated_0004.js @@ -0,0 +1 @@ +(x,) => x * x diff --git a/lib/test/flow/trailing_commas/migrated_0004.tree.json b/lib/test/flow/trailing_commas/migrated_0004.tree.json new file mode 100644 index 0000000..2e4869c --- /dev/null +++ b/lib/test/flow/trailing_commas/migrated_0004.tree.json @@ -0,0 +1,58 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, + "range":[1,2], + "name":"x", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, + "range":[8,13], + "operator":"*", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "name":"x", + "typeAnnotation":null, + "optional":false + } + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":null, + "typeParameters":null + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/trailing_commas/migrated_0005.js b/lib/test/flow/trailing_commas/migrated_0005.js new file mode 100644 index 0000000..7ba925d --- /dev/null +++ b/lib/test/flow/trailing_commas/migrated_0005.js @@ -0,0 +1 @@ +(x,y,) => Math.pow(x,y,) diff --git a/lib/test/flow/trailing_commas/migrated_0005.tree.json b/lib/test/flow/trailing_commas/migrated_0005.tree.json new file mode 100644 index 0000000..bebf598 --- /dev/null +++ b/lib/test/flow/trailing_commas/migrated_0005.tree.json @@ -0,0 +1,90 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "expression":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, + "range":[1,2], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":4}}, + "range":[3,4], + "name":"y", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":24}}, + "range":[10,24], + "callee":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":18}}, + "range":[10,18], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, + "range":[10,14], + "name":"Math", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, + "range":[15,18], + "name":"pow", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "typeArguments":null, + "arguments":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "range":[19,20], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "name":"y", + "typeAnnotation":null, + "optional":false + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":null, + "typeParameters":null + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/trailing_commas/migrated_0006.js b/lib/test/flow/trailing_commas/migrated_0006.js new file mode 100644 index 0000000..f6ffa4d --- /dev/null +++ b/lib/test/flow/trailing_commas/migrated_0006.js @@ -0,0 +1 @@ +(function foo(x = 5,) {}) diff --git a/lib/test/flow/trailing_commas/migrated_0006.tree.json b/lib/test/flow/trailing_commas/migrated_0006.tree.json new file mode 100644 index 0000000..b50e1e8 --- /dev/null +++ b/lib/test/flow/trailing_commas/migrated_0006.tree.json @@ -0,0 +1,61 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "expression":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":24}}, + "range":[1,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, + "range":[10,13], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"AssignmentPattern", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, + "range":[14,19], + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "value":5, + "raw":"5" + } + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, + "range":[22,24], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/trailing_commas/migrated_0007.js b/lib/test/flow/trailing_commas/migrated_0007.js new file mode 100644 index 0000000..0a0df7b --- /dev/null +++ b/lib/test/flow/trailing_commas/migrated_0007.js @@ -0,0 +1 @@ +foo(a, ...b,) diff --git a/lib/test/flow/trailing_commas/migrated_0007.tree.json b/lib/test/flow/trailing_commas/migrated_0007.tree.json new file mode 100644 index 0000000..46217e0 --- /dev/null +++ b/lib/test/flow/trailing_commas/migrated_0007.tree.json @@ -0,0 +1,50 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "arguments":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + { + "type":"SpreadElement", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, + "range":[7,11], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"b", + "typeAnnotation":null, + "optional":false + } + } + ] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/trailing_commas/migrated_0008.js b/lib/test/flow/trailing_commas/migrated_0008.js new file mode 100644 index 0000000..20a0896 --- /dev/null +++ b/lib/test/flow/trailing_commas/migrated_0008.js @@ -0,0 +1 @@ +var x = [1, 2, 3,]; diff --git a/lib/test/flow/trailing_commas/migrated_0008.tree.json b/lib/test/flow/trailing_commas/migrated_0008.tree.json new file mode 100644 index 0000000..1477886 --- /dev/null +++ b/lib/test/flow/trailing_commas/migrated_0008.tree.json @@ -0,0 +1,57 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "range":[0,19], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "range":[0,19], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":18}}, + "range":[4,18], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":18}}, + "range":[8,18], + "elements":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "value":1, + "raw":"1" + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "value":2, + "raw":"2" + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "value":3, + "raw":"3" + } + ] + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/trailing_commas/migrated_0009.js b/lib/test/flow/trailing_commas/migrated_0009.js new file mode 100644 index 0000000..65a4caa --- /dev/null +++ b/lib/test/flow/trailing_commas/migrated_0009.js @@ -0,0 +1 @@ +var x = [1, 2, ...y,]; diff --git a/lib/test/flow/trailing_commas/migrated_0009.tree.json b/lib/test/flow/trailing_commas/migrated_0009.tree.json new file mode 100644 index 0000000..eb16f5c --- /dev/null +++ b/lib/test/flow/trailing_commas/migrated_0009.tree.json @@ -0,0 +1,63 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":21}}, + "range":[4,21], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":21}}, + "range":[8,21], + "elements":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "value":1, + "raw":"1" + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "value":2, + "raw":"2" + }, + { + "type":"SpreadElement", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":19}}, + "range":[15,19], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "name":"y", + "typeAnnotation":null, + "optional":false + } + } + ] + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/trailing_commas/migrated_0010.js b/lib/test/flow/trailing_commas/migrated_0010.js new file mode 100644 index 0000000..d79a3a5 --- /dev/null +++ b/lib/test/flow/trailing_commas/migrated_0010.js @@ -0,0 +1 @@ +var x = [1, 2, ...y, 4,]; diff --git a/lib/test/flow/trailing_commas/migrated_0010.tree.json b/lib/test/flow/trailing_commas/migrated_0010.tree.json new file mode 100644 index 0000000..5ca621a --- /dev/null +++ b/lib/test/flow/trailing_commas/migrated_0010.tree.json @@ -0,0 +1,70 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":24}}, + "range":[4,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":24}}, + "range":[8,24], + "elements":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "value":1, + "raw":"1" + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "value":2, + "raw":"2" + }, + { + "type":"SpreadElement", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":19}}, + "range":[15,19], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "name":"y", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "value":4, + "raw":"4" + } + ] + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/trailing_commas_invalid/migrated_0000.js b/lib/test/flow/trailing_commas_invalid/migrated_0000.js new file mode 100644 index 0000000..beb576e --- /dev/null +++ b/lib/test/flow/trailing_commas_invalid/migrated_0000.js @@ -0,0 +1 @@ +foo(a, (b,)) diff --git a/lib/test/flow/trailing_commas_invalid/migrated_0000.tree.json b/lib/test/flow/trailing_commas_invalid/migrated_0000.tree.json new file mode 100644 index 0000000..c08f43f --- /dev/null +++ b/lib/test/flow/trailing_commas_invalid/migrated_0000.tree.json @@ -0,0 +1,66 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "message":"Unexpected token `)`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + { + "type":"SequenceExpression", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, + "range":[8,10], + "expressions":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "value":null, + "raw":"null" + } + ] + } + ] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/trailing_commas_invalid/migrated_0001.js b/lib/test/flow/trailing_commas_invalid/migrated_0001.js new file mode 100644 index 0000000..94d55e8 --- /dev/null +++ b/lib/test/flow/trailing_commas_invalid/migrated_0001.js @@ -0,0 +1 @@ +function foo(a, ...b,) { return b.concat(a); } diff --git a/lib/test/flow/trailing_commas_invalid/migrated_0001.tree.json b/lib/test/flow/trailing_commas_invalid/migrated_0001.tree.json new file mode 100644 index 0000000..5215dd4 --- /dev/null +++ b/lib/test/flow/trailing_commas_invalid/migrated_0001.tree.json @@ -0,0 +1,125 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "message":"Rest parameter must be final parameter of an argument list" + }, + { + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "message":"Unexpected token `,`, expected the token `)`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "message":"Unexpected token `)`, expected the token `{`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the token `}`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,47], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,47], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + { + "type":"RestElement", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":20}}, + "range":[16,20], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "range":[19,20], + "name":"b", + "typeAnnotation":null, + "optional":false + } + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":2,"column":0}}, + "range":[21,47], + "body":[ + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":46}}, + "range":[23,46], + "body":[ + { + "type":"ReturnStatement", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":44}}, + "range":[25,44], + "argument":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":43}}, + "range":[32,43], + "callee":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":40}}, + "range":[32,40], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, + "range":[32,33], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":40}}, + "range":[34,40], + "name":"concat", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "typeArguments":null, + "arguments":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":42}}, + "range":[41,42], + "name":"a", + "typeAnnotation":null, + "optional":false + } + ] + } + } + ] + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/trailing_commas_invalid/migrated_0002.js b/lib/test/flow/trailing_commas_invalid/migrated_0002.js new file mode 100644 index 0000000..1d3e576 --- /dev/null +++ b/lib/test/flow/trailing_commas_invalid/migrated_0002.js @@ -0,0 +1 @@ +var f = function(a, ...b,) { return b.concat(a); } diff --git a/lib/test/flow/trailing_commas_invalid/migrated_0002.tree.json b/lib/test/flow/trailing_commas_invalid/migrated_0002.tree.json new file mode 100644 index 0000000..8453616 --- /dev/null +++ b/lib/test/flow/trailing_commas_invalid/migrated_0002.tree.json @@ -0,0 +1,139 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, + "message":"Rest parameter must be final parameter of an argument list" + }, + { + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, + "message":"Unexpected token `,`, expected the token `)`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, + "message":"Unexpected token `)`, expected the token `{`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the token `}`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,51], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,51], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":2,"column":0}}, + "range":[4,51], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":2,"column":0}}, + "range":[8,51], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "range":[17,18], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + { + "type":"RestElement", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":24}}, + "range":[20,24], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, + "range":[23,24], + "name":"b", + "typeAnnotation":null, + "optional":false + } + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":2,"column":0}}, + "range":[25,51], + "body":[ + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":50}}, + "range":[27,50], + "body":[ + { + "type":"ReturnStatement", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":48}}, + "range":[29,48], + "argument":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":47}}, + "range":[36,47], + "callee":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":44}}, + "range":[36,44], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":37}}, + "range":[36,37], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":44}}, + "range":[38,44], + "name":"concat", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "typeArguments":null, + "arguments":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":45},"end":{"line":1,"column":46}}, + "range":[45,46], + "name":"a", + "typeAnnotation":null, + "optional":false + } + ] + } + } + ] + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/trailing_commas_invalid/migrated_0003.js b/lib/test/flow/trailing_commas_invalid/migrated_0003.js new file mode 100644 index 0000000..8fafb1b --- /dev/null +++ b/lib/test/flow/trailing_commas_invalid/migrated_0003.js @@ -0,0 +1 @@ +var f = (a, ...b,) => b.concat(a); diff --git a/lib/test/flow/trailing_commas_invalid/migrated_0003.tree.json b/lib/test/flow/trailing_commas_invalid/migrated_0003.tree.json new file mode 100644 index 0000000..a96b85a --- /dev/null +++ b/lib/test/flow/trailing_commas_invalid/migrated_0003.tree.json @@ -0,0 +1,153 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":15}}, + "message":"Unexpected token `...`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":15}}, + "message":"Unexpected token `...`, expected the token `)`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "message":"Unexpected identifier, expected the token `;`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "message":"Unexpected token `)`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "message":"Unexpected token `)`, expected the end of an expression statement (`;`)" + }, + { + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "message":"Unexpected token `)`, expected the start of a statement" + }, + { + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, + "message":"Unexpected token `=>`, expected the start of a statement" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "range":[0,34], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":15}}, + "range":[4,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"SequenceExpression", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, + "range":[9,11], + "expressions":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":15}}, + "range":[12,15], + "value":null, + "raw":"null" + } + ] + } + } + ], + "kind":"var" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, + "range":[15,17], + "expression":{ + "type":"SequenceExpression", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, + "range":[15,17], + "expressions":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "range":[17,18], + "value":null, + "raw":"null" + } + ] + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":34}}, + "range":[22,34], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":33}}, + "range":[22,33], + "callee":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":30}}, + "range":[22,30], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, + "range":[22,23], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":30}}, + "range":[24,30], + "name":"concat", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "typeArguments":null, + "arguments":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":32}}, + "range":[31,32], + "name":"a", + "typeAnnotation":null, + "optional":false + } + ] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/typeapp_call/disabled_ambiguous_call.js b/lib/test/flow/typeapp_call/disabled_ambiguous_call.js new file mode 100644 index 0000000..13d3d3b --- /dev/null +++ b/lib/test/flow/typeapp_call/disabled_ambiguous_call.js @@ -0,0 +1 @@ +f(e); diff --git a/lib/test/flow/typeapp_call/disabled_ambiguous_call.options.json b/lib/test/flow/typeapp_call/disabled_ambiguous_call.options.json new file mode 100644 index 0000000..5a7dde3 --- /dev/null +++ b/lib/test/flow/typeapp_call/disabled_ambiguous_call.options.json @@ -0,0 +1,3 @@ +{ + "types": false +} diff --git a/lib/test/flow/typeapp_call/disabled_ambiguous_call.tree.json b/lib/test/flow/typeapp_call/disabled_ambiguous_call.tree.json new file mode 100644 index 0000000..4a362e1 --- /dev/null +++ b/lib/test/flow/typeapp_call/disabled_ambiguous_call.tree.json @@ -0,0 +1,50 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "range":[0,8], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "range":[0,8], + "expression":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "operator":">", + "left":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "operator":"<", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "range":[2,3], + "name":"T", + "typeAnnotation":null, + "optional":false + } + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"e", + "typeAnnotation":null, + "optional":false + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/typeapp_call/disabled_ambiguous_new.js b/lib/test/flow/typeapp_call/disabled_ambiguous_new.js new file mode 100644 index 0000000..b51cafc --- /dev/null +++ b/lib/test/flow/typeapp_call/disabled_ambiguous_new.js @@ -0,0 +1 @@ +new C(e); diff --git a/lib/test/flow/typeapp_call/disabled_ambiguous_new.options.json b/lib/test/flow/typeapp_call/disabled_ambiguous_new.options.json new file mode 100644 index 0000000..5a7dde3 --- /dev/null +++ b/lib/test/flow/typeapp_call/disabled_ambiguous_new.options.json @@ -0,0 +1,3 @@ +{ + "types": false +} diff --git a/lib/test/flow/typeapp_call/disabled_ambiguous_new.tree.json b/lib/test/flow/typeapp_call/disabled_ambiguous_new.tree.json new file mode 100644 index 0000000..2024d6c --- /dev/null +++ b/lib/test/flow/typeapp_call/disabled_ambiguous_new.tree.json @@ -0,0 +1,56 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "expression":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "operator":">", + "left":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "operator":"<", + "left":{ + "type":"NewExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "range":[0,5], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "arguments":[] + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"T", + "typeAnnotation":null, + "optional":false + } + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "name":"e", + "typeAnnotation":null, + "optional":false + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/typeapp_call/function_call.js b/lib/test/flow/typeapp_call/function_call.js new file mode 100644 index 0000000..8472372 --- /dev/null +++ b/lib/test/flow/typeapp_call/function_call.js @@ -0,0 +1 @@ +f(); diff --git a/lib/test/flow/typeapp_call/function_call.tree.json b/lib/test/flow/typeapp_call/function_call.tree.json new file mode 100644 index 0000000..8c2cb8d --- /dev/null +++ b/lib/test/flow/typeapp_call/function_call.tree.json @@ -0,0 +1,49 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "range":[1,4], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "range":[2,3], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "range":[2,3], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + }, + "arguments":[] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/typeapp_call/function_call_chain.js b/lib/test/flow/typeapp_call/function_call_chain.js new file mode 100644 index 0000000..22d61e6 --- /dev/null +++ b/lib/test/flow/typeapp_call/function_call_chain.js @@ -0,0 +1 @@ +f(x)(y); diff --git a/lib/test/flow/typeapp_call/function_call_chain.tree.json b/lib/test/flow/typeapp_call/function_call_chain.tree.json new file mode 100644 index 0000000..270a477 --- /dev/null +++ b/lib/test/flow/typeapp_call/function_call_chain.tree.json @@ -0,0 +1,94 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "callee":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "range":[1,4], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "range":[2,3], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "range":[2,3], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + }, + "arguments":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"x", + "typeAnnotation":null, + "optional":false + } + ] + }, + "typeArguments":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, + "range":[7,10], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "name":"U", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + }, + "arguments":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"y", + "typeAnnotation":null, + "optional":false + } + ] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/typeapp_call/function_call_optional.js b/lib/test/flow/typeapp_call/function_call_optional.js new file mode 100644 index 0000000..1ca71b5 --- /dev/null +++ b/lib/test/flow/typeapp_call/function_call_optional.js @@ -0,0 +1 @@ +f?.(e); diff --git a/lib/test/flow/typeapp_call/function_call_optional.options.json b/lib/test/flow/typeapp_call/function_call_optional.options.json new file mode 100644 index 0000000..6b03755 --- /dev/null +++ b/lib/test/flow/typeapp_call/function_call_optional.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_optional_chaining": true +} diff --git a/lib/test/flow/typeapp_call/function_call_optional.tree.json b/lib/test/flow/typeapp_call/function_call_optional.tree.json new file mode 100644 index 0000000..24cd0ba --- /dev/null +++ b/lib/test/flow/typeapp_call/function_call_optional.tree.json @@ -0,0 +1,59 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "expression":{ + "type":"OptionalCallExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "range":[0,9], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":6}}, + "range":[3,6], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + }, + "arguments":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "range":[7,8], + "name":"e", + "typeAnnotation":null, + "optional":false + } + ], + "optional":true + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/typeapp_call/method_call.js b/lib/test/flow/typeapp_call/method_call.js new file mode 100644 index 0000000..bd321d8 --- /dev/null +++ b/lib/test/flow/typeapp_call/method_call.js @@ -0,0 +1 @@ +o.m(); diff --git a/lib/test/flow/typeapp_call/method_call.tree.json b/lib/test/flow/typeapp_call/method_call.tree.json new file mode 100644 index 0000000..a0be3ad --- /dev/null +++ b/lib/test/flow/typeapp_call/method_call.tree.json @@ -0,0 +1,63 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "range":[0,9], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "range":[0,9], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "range":[0,8], + "callee":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"o", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "range":[2,3], + "name":"m", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "typeArguments":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":6}}, + "range":[3,6], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + }, + "arguments":[] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/typeapp_call/method_call_computed.js b/lib/test/flow/typeapp_call/method_call_computed.js new file mode 100644 index 0000000..ac29dff --- /dev/null +++ b/lib/test/flow/typeapp_call/method_call_computed.js @@ -0,0 +1 @@ +o[e](); diff --git a/lib/test/flow/typeapp_call/method_call_computed.tree.json b/lib/test/flow/typeapp_call/method_call_computed.tree.json new file mode 100644 index 0000000..3b0fa0c --- /dev/null +++ b/lib/test/flow/typeapp_call/method_call_computed.tree.json @@ -0,0 +1,63 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "range":[0,9], + "callee":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"o", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "range":[2,3], + "name":"e", + "typeAnnotation":null, + "optional":false + }, + "computed":true + }, + "typeArguments":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "range":[4,7], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + }, + "arguments":[] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/typeapp_call/method_call_optional.js b/lib/test/flow/typeapp_call/method_call_optional.js new file mode 100644 index 0000000..1569375 --- /dev/null +++ b/lib/test/flow/typeapp_call/method_call_optional.js @@ -0,0 +1 @@ +o?.m(e); diff --git a/lib/test/flow/typeapp_call/method_call_optional.options.json b/lib/test/flow/typeapp_call/method_call_optional.options.json new file mode 100644 index 0000000..6b03755 --- /dev/null +++ b/lib/test/flow/typeapp_call/method_call_optional.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_optional_chaining": true +} diff --git a/lib/test/flow/typeapp_call/method_call_optional.tree.json b/lib/test/flow/typeapp_call/method_call_optional.tree.json new file mode 100644 index 0000000..1e1c734 --- /dev/null +++ b/lib/test/flow/typeapp_call/method_call_optional.tree.json @@ -0,0 +1,74 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "expression":{ + "type":"OptionalCallExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "callee":{ + "type":"OptionalMemberExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"o", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":4}}, + "range":[3,4], + "name":"m", + "typeAnnotation":null, + "optional":false + }, + "computed":false, + "optional":true + }, + "typeArguments":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "range":[4,7], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + }, + "arguments":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "name":"e", + "typeAnnotation":null, + "optional":false + } + ], + "optional":false + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/typeapp_call/method_call_optional2.js b/lib/test/flow/typeapp_call/method_call_optional2.js new file mode 100644 index 0000000..241b6ab --- /dev/null +++ b/lib/test/flow/typeapp_call/method_call_optional2.js @@ -0,0 +1 @@ +o.m?.(e); diff --git a/lib/test/flow/typeapp_call/method_call_optional2.options.json b/lib/test/flow/typeapp_call/method_call_optional2.options.json new file mode 100644 index 0000000..6b03755 --- /dev/null +++ b/lib/test/flow/typeapp_call/method_call_optional2.options.json @@ -0,0 +1,3 @@ +{ + "esproposal_optional_chaining": true +} diff --git a/lib/test/flow/typeapp_call/method_call_optional2.tree.json b/lib/test/flow/typeapp_call/method_call_optional2.tree.json new file mode 100644 index 0000000..3871e29 --- /dev/null +++ b/lib/test/flow/typeapp_call/method_call_optional2.tree.json @@ -0,0 +1,73 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "expression":{ + "type":"OptionalCallExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "callee":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"o", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "range":[2,3], + "name":"m", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "typeArguments":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, + "range":[5,8], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + }, + "arguments":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "name":"e", + "typeAnnotation":null, + "optional":false + } + ], + "optional":true + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/typeapp_call/new.js b/lib/test/flow/typeapp_call/new.js new file mode 100644 index 0000000..4a1e3a0 --- /dev/null +++ b/lib/test/flow/typeapp_call/new.js @@ -0,0 +1 @@ +new C(); diff --git a/lib/test/flow/typeapp_call/new.tree.json b/lib/test/flow/typeapp_call/new.tree.json new file mode 100644 index 0000000..0e105b5 --- /dev/null +++ b/lib/test/flow/typeapp_call/new.tree.json @@ -0,0 +1,49 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "expression":{ + "type":"NewExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, + "range":[5,8], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + }, + "arguments":[] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/typeapp_call/new_noparens.js b/lib/test/flow/typeapp_call/new_noparens.js new file mode 100644 index 0000000..441bd64 --- /dev/null +++ b/lib/test/flow/typeapp_call/new_noparens.js @@ -0,0 +1 @@ +new C; diff --git a/lib/test/flow/typeapp_call/new_noparens.tree.json b/lib/test/flow/typeapp_call/new_noparens.tree.json new file mode 100644 index 0000000..b77e511 --- /dev/null +++ b/lib/test/flow/typeapp_call/new_noparens.tree.json @@ -0,0 +1,49 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "range":[0,9], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "range":[0,9], + "expression":{ + "type":"NewExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "range":[0,8], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, + "range":[5,8], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + }, + "arguments":[] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/typeapp_call/rollback_computed.js b/lib/test/flow/typeapp_call/rollback_computed.js new file mode 100644 index 0000000..d3e98c9 --- /dev/null +++ b/lib/test/flow/typeapp_call/rollback_computed.js @@ -0,0 +1 @@ +f[e]; diff --git a/lib/test/flow/typeapp_call/rollback_computed.tree.json b/lib/test/flow/typeapp_call/rollback_computed.tree.json new file mode 100644 index 0000000..7dffb7b --- /dev/null +++ b/lib/test/flow/typeapp_call/rollback_computed.tree.json @@ -0,0 +1,57 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "range":[0,8], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "range":[0,8], + "expression":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "operator":">", + "left":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "operator":"<", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "range":[2,3], + "name":"T", + "typeAnnotation":null, + "optional":false + } + }, + "right":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "range":[4,7], + "elements":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"e", + "typeAnnotation":null, + "optional":false + } + ] + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/typeapp_call/rollback_dot.js b/lib/test/flow/typeapp_call/rollback_dot.js new file mode 100644 index 0000000..8e078af --- /dev/null +++ b/lib/test/flow/typeapp_call/rollback_dot.js @@ -0,0 +1 @@ +f.0; diff --git a/lib/test/flow/typeapp_call/rollback_dot.tree.json b/lib/test/flow/typeapp_call/rollback_dot.tree.json new file mode 100644 index 0000000..3f478c2 --- /dev/null +++ b/lib/test/flow/typeapp_call/rollback_dot.tree.json @@ -0,0 +1,49 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "expression":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "operator":">", + "left":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "operator":"<", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "range":[2,3], + "name":"T", + "typeAnnotation":null, + "optional":false + } + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, + "range":[4,6], + "value":0, + "raw":".0" + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/typeapp_call/rollback_jsx.js b/lib/test/flow/typeapp_call/rollback_jsx.js new file mode 100644 index 0000000..906df23 --- /dev/null +++ b/lib/test/flow/typeapp_call/rollback_jsx.js @@ -0,0 +1 @@ +f; diff --git a/lib/test/flow/typeapp_call/rollback_jsx.tree.json b/lib/test/flow/typeapp_call/rollback_jsx.tree.json new file mode 100644 index 0000000..6d38e8a --- /dev/null +++ b/lib/test/flow/typeapp_call/rollback_jsx.tree.json @@ -0,0 +1,72 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "expression":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "operator":">", + "left":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "range":[0,3], + "operator":"<", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "range":[2,3], + "name":"T", + "typeAnnotation":null, + "optional":false + } + }, + "right":{ + "type":"JSXElement", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, + "range":[4,11], + "openingElement":{ + "type":"JSXOpeningElement", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "range":[4,7], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"U" + }, + "attributes":[], + "selfClosing":false + }, + "closingElement":{ + "type":"JSXClosingElement", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, + "range":[7,11], + "name":{ + "type":"JSXIdentifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "name":"U" + } + }, + "children":[] + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/aliases/alias_with_parens.js b/lib/test/flow/types/aliases/alias_with_parens.js new file mode 100644 index 0000000..a8e2d62 --- /dev/null +++ b/lib/test/flow/types/aliases/alias_with_parens.js @@ -0,0 +1 @@ +type x = (string); diff --git a/lib/test/flow/types/aliases/alias_with_parens.tree.json b/lib/test/flow/types/aliases/alias_with_parens.tree.json new file mode 100644 index 0000000..7e103fe --- /dev/null +++ b/lib/test/flow/types/aliases/alias_with_parens.tree.json @@ -0,0 +1,27 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, + "range":[10,16] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/aliases/alias_with_parens_no_semi.js b/lib/test/flow/types/aliases/alias_with_parens_no_semi.js new file mode 100644 index 0000000..9545167 --- /dev/null +++ b/lib/test/flow/types/aliases/alias_with_parens_no_semi.js @@ -0,0 +1 @@ +type x = (string) diff --git a/lib/test/flow/types/aliases/alias_with_parens_no_semi.tree.json b/lib/test/flow/types/aliases/alias_with_parens_no_semi.tree.json new file mode 100644 index 0000000..95193c1 --- /dev/null +++ b/lib/test/flow/types/aliases/alias_with_parens_no_semi.tree.json @@ -0,0 +1,27 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, + "range":[10,16] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/aliases/keyword.js b/lib/test/flow/types/aliases/keyword.js new file mode 100644 index 0000000..6ee82c4 --- /dev/null +++ b/lib/test/flow/types/aliases/keyword.js @@ -0,0 +1 @@ +type extends = string; diff --git a/lib/test/flow/types/aliases/keyword.tree.json b/lib/test/flow/types/aliases/keyword.tree.json new file mode 100644 index 0000000..1498d8b --- /dev/null +++ b/lib/test/flow/types/aliases/keyword.tree.json @@ -0,0 +1,67 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, + "message":"Unexpected token `extends`, expected the end of an expression statement (`;`)" + }, + { + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, + "message":"Unexpected token `extends`, expected the start of a statement" + }, + { + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "message":"Unexpected token `=`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "message":"Invalid left-hand side in assignment" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "name":"type", + "typeAnnotation":null, + "optional":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":22}}, + "range":[13,22], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":21}}, + "range":[13,21], + "operator":"=", + "left":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "value":null, + "raw":"null" + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":21}}, + "range":[15,21], + "name":"string", + "typeAnnotation":null, + "optional":false + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/aliases/line_separator_after_type.js b/lib/test/flow/types/aliases/line_separator_after_type.js new file mode 100644 index 0000000..51b0fa7 --- /dev/null +++ b/lib/test/flow/types/aliases/line_separator_after_type.js @@ -0,0 +1,2 @@ +type +Foo = {}; diff --git a/lib/test/flow/types/aliases/line_separator_after_type.tree.json b/lib/test/flow/types/aliases/line_separator_after_type.tree.json new file mode 100644 index 0000000..44c19d0 --- /dev/null +++ b/lib/test/flow/types/aliases/line_separator_after_type.tree.json @@ -0,0 +1,48 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":9}}, + "range":[0,14], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "name":"type", + "typeAnnotation":null, + "optional":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":9}}, + "range":[5,14], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":8}}, + "range":[5,13], + "operator":"=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":3}}, + "range":[5,8], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":8}}, + "range":[11,13], + "properties":[] + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/aliases/migrated_0000.js b/lib/test/flow/types/aliases/migrated_0000.js new file mode 100644 index 0000000..3aa877b --- /dev/null +++ b/lib/test/flow/types/aliases/migrated_0000.js @@ -0,0 +1 @@ +type FBID = number; diff --git a/lib/test/flow/types/aliases/migrated_0000.tree.json b/lib/test/flow/types/aliases/migrated_0000.tree.json new file mode 100644 index 0000000..ea36354 --- /dev/null +++ b/lib/test/flow/types/aliases/migrated_0000.tree.json @@ -0,0 +1,27 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "range":[0,19], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "range":[0,19], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":9}}, + "range":[5,9], + "name":"FBID", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":18}}, + "range":[12,18] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/aliases/migrated_0001.js b/lib/test/flow/types/aliases/migrated_0001.js new file mode 100644 index 0000000..2863ac2 --- /dev/null +++ b/lib/test/flow/types/aliases/migrated_0001.js @@ -0,0 +1 @@ +type FBID = number diff --git a/lib/test/flow/types/aliases/migrated_0001.tree.json b/lib/test/flow/types/aliases/migrated_0001.tree.json new file mode 100644 index 0000000..9d7bab9 --- /dev/null +++ b/lib/test/flow/types/aliases/migrated_0001.tree.json @@ -0,0 +1,27 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":9}}, + "range":[5,9], + "name":"FBID", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":18}}, + "range":[12,18] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/aliases/migrated_0002.js b/lib/test/flow/types/aliases/migrated_0002.js new file mode 100644 index 0000000..5aa15b4 --- /dev/null +++ b/lib/test/flow/types/aliases/migrated_0002.js @@ -0,0 +1 @@ +type Arr = Array; diff --git a/lib/test/flow/types/aliases/migrated_0002.tree.json b/lib/test/flow/types/aliases/migrated_0002.tree.json new file mode 100644 index 0000000..3680dff --- /dev/null +++ b/lib/test/flow/types/aliases/migrated_0002.tree.json @@ -0,0 +1,71 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, + "range":[5,8], + "name":"Arr", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":11}}, + "range":[8,11], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "right":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":22}}, + "range":[14,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, + "range":[14,19], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, + "range":[19,22], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/aliases/migrated_0003.js b/lib/test/flow/types/aliases/migrated_0003.js new file mode 100644 index 0000000..4afd55f --- /dev/null +++ b/lib/test/flow/types/aliases/migrated_0003.js @@ -0,0 +1 @@ +type union = | A | B | C diff --git a/lib/test/flow/types/aliases/migrated_0003.tree.json b/lib/test/flow/types/aliases/migrated_0003.tree.json new file mode 100644 index 0000000..97fa47d --- /dev/null +++ b/lib/test/flow/types/aliases/migrated_0003.tree.json @@ -0,0 +1,71 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, + "range":[5,10], + "name":"union", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"UnionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":24}}, + "range":[15,24], + "types":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "range":[19,20], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "range":[19,20], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, + "range":[23,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, + "range":[23,24], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/aliases/migrated_0004.js b/lib/test/flow/types/aliases/migrated_0004.js new file mode 100644 index 0000000..b5e6dae --- /dev/null +++ b/lib/test/flow/types/aliases/migrated_0004.js @@ -0,0 +1 @@ +type overloads = & ((x: string) => number) & ((x: number) => string); diff --git a/lib/test/flow/types/aliases/migrated_0004.tree.json b/lib/test/flow/types/aliases/migrated_0004.tree.json new file mode 100644 index 0000000..493401b --- /dev/null +++ b/lib/test/flow/types/aliases/migrated_0004.tree.json @@ -0,0 +1,95 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":69}}, + "range":[0,69], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":69}}, + "range":[0,69], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":14}}, + "range":[5,14], + "name":"overloads", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"IntersectionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":68}}, + "range":[20,68], + "types":[ + { + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":41}}, + "range":[20,41], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":30}}, + "range":[21,30], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":30}}, + "range":[24,30] + }, + "optional":false + } + ], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":41}}, + "range":[35,41] + }, + "rest":null, + "typeParameters":null + }, + { + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":46},"end":{"line":1,"column":67}}, + "range":[46,67], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":47},"end":{"line":1,"column":56}}, + "range":[47,56], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":47},"end":{"line":1,"column":48}}, + "range":[47,48], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":50},"end":{"line":1,"column":56}}, + "range":[50,56] + }, + "optional":false + } + ], + "returnType":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":61},"end":{"line":1,"column":67}}, + "range":[61,67] + }, + "rest":null, + "typeParameters":null + } + ] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/aliases/reserved_type.js b/lib/test/flow/types/aliases/reserved_type.js new file mode 100644 index 0000000..5ff11d1 --- /dev/null +++ b/lib/test/flow/types/aliases/reserved_type.js @@ -0,0 +1 @@ +type interface = string; diff --git a/lib/test/flow/types/aliases/reserved_type.tree.json b/lib/test/flow/types/aliases/reserved_type.tree.json new file mode 100644 index 0000000..271c159 --- /dev/null +++ b/lib/test/flow/types/aliases/reserved_type.tree.json @@ -0,0 +1,33 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":14}}, + "message":"Unexpected reserved type" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":14}}, + "range":[5,14], + "name":"interface", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":23}}, + "range":[17,23] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/explicit_inexact_disallowed_in_non_objects.js b/lib/test/flow/types/annotations/explicit_inexact_disallowed_in_non_objects.js new file mode 100644 index 0000000..7a197b1 --- /dev/null +++ b/lib/test/flow/types/annotations/explicit_inexact_disallowed_in_non_objects.js @@ -0,0 +1,39 @@ +declare class A { + ...; +} + +declare class B { + foo: number; + ...; +} + +declare class C { + ...; + foo: number; +} + +declare class D { + foo: number; + ...; + bar: number; +} + +interface E { + ...; +} + +interface F { + foo: number; + ...; +} + +interface G { + ...; + foo: number; +} + +interface H { + foo: number; + ...; + bar: number; +} diff --git a/lib/test/flow/types/annotations/explicit_inexact_disallowed_in_non_objects.tree.json b/lib/test/flow/types/annotations/explicit_inexact_disallowed_in_non_objects.tree.json new file mode 100644 index 0000000..1663b14 --- /dev/null +++ b/lib/test/flow/types/annotations/explicit_inexact_disallowed_in_non_objects.tree.json @@ -0,0 +1,448 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "message":"Explicit inexact syntax can only appear inside an object type" + }, + { + "loc":{"source":null,"start":{"line":7,"column":2},"end":{"line":7,"column":5}}, + "message":"Explicit inexact syntax can only appear inside an object type" + }, + { + "loc":{"source":null,"start":{"line":11,"column":2},"end":{"line":11,"column":5}}, + "message":"Explicit inexact syntax can only appear inside an object type" + }, + { + "loc":{"source":null,"start":{"line":17,"column":2},"end":{"line":17,"column":5}}, + "message":"Explicit inexact syntax can only appear inside an object type" + }, + { + "loc":{"source":null,"start":{"line":22,"column":2},"end":{"line":22,"column":5}}, + "message":"Explicit inexact syntax can only appear inside an object type" + }, + { + "loc":{"source":null,"start":{"line":27,"column":2},"end":{"line":27,"column":5}}, + "message":"Explicit inexact syntax can only appear inside an object type" + }, + { + "loc":{"source":null,"start":{"line":31,"column":2},"end":{"line":31,"column":5}}, + "message":"Explicit inexact syntax can only appear inside an object type" + }, + { + "loc":{"source":null,"start":{"line":37,"column":2},"end":{"line":37,"column":5}}, + "message":"Explicit inexact syntax can only appear inside an object type" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":39,"column":1}}, + "range":[0,326], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,26], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":3,"column":1}}, + "range":[16,26], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + }, + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":8,"column":1}}, + "range":[28,69], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":14},"end":{"line":5,"column":15}}, + "range":[42,43], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":16},"end":{"line":8,"column":1}}, + "range":[44,69], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":13}}, + "range":[48,59], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":5}}, + "range":[48,51], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":6,"column":7},"end":{"line":6,"column":13}}, + "range":[53,59] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + }, + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":10,"column":0},"end":{"line":13,"column":1}}, + "range":[71,112], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":10,"column":14},"end":{"line":10,"column":15}}, + "range":[85,86], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":10,"column":16},"end":{"line":13,"column":1}}, + "range":[87,112], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":12,"column":2},"end":{"line":12,"column":13}}, + "range":[98,109], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":12,"column":2},"end":{"line":12,"column":5}}, + "range":[98,101], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":12,"column":7},"end":{"line":12,"column":13}}, + "range":[103,109] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + }, + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":15,"column":0},"end":{"line":19,"column":1}}, + "range":[114,170], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":15,"column":14},"end":{"line":15,"column":15}}, + "range":[128,129], + "name":"D", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":15,"column":16},"end":{"line":19,"column":1}}, + "range":[130,170], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":16,"column":2},"end":{"line":16,"column":13}}, + "range":[134,145], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":16,"column":2},"end":{"line":16,"column":5}}, + "range":[134,137], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":16,"column":7},"end":{"line":16,"column":13}}, + "range":[139,145] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + }, + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":18,"column":13}}, + "range":[156,167], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":18,"column":2},"end":{"line":18,"column":5}}, + "range":[156,159], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":18,"column":7},"end":{"line":18,"column":13}}, + "range":[161,167] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + }, + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":21,"column":0},"end":{"line":23,"column":1}}, + "range":[172,194], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":21,"column":10},"end":{"line":21,"column":11}}, + "range":[182,183], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":21,"column":12},"end":{"line":23,"column":1}}, + "range":[184,194], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + }, + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":25,"column":0},"end":{"line":28,"column":1}}, + "range":[196,233], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":25,"column":10},"end":{"line":25,"column":11}}, + "range":[206,207], + "name":"F", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":25,"column":12},"end":{"line":28,"column":1}}, + "range":[208,233], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":26,"column":2},"end":{"line":26,"column":13}}, + "range":[212,223], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":26,"column":2},"end":{"line":26,"column":5}}, + "range":[212,215], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":26,"column":7},"end":{"line":26,"column":13}}, + "range":[217,223] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + }, + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":30,"column":0},"end":{"line":33,"column":1}}, + "range":[235,272], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":30,"column":10},"end":{"line":30,"column":11}}, + "range":[245,246], + "name":"G", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":30,"column":12},"end":{"line":33,"column":1}}, + "range":[247,272], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":32,"column":2},"end":{"line":32,"column":13}}, + "range":[258,269], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":32,"column":2},"end":{"line":32,"column":5}}, + "range":[258,261], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":32,"column":7},"end":{"line":32,"column":13}}, + "range":[263,269] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + }, + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":35,"column":0},"end":{"line":39,"column":1}}, + "range":[274,326], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":35,"column":10},"end":{"line":35,"column":11}}, + "range":[284,285], + "name":"H", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":35,"column":12},"end":{"line":39,"column":1}}, + "range":[286,326], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":36,"column":2},"end":{"line":36,"column":13}}, + "range":[290,301], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":36,"column":2},"end":{"line":36,"column":5}}, + "range":[290,293], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":36,"column":7},"end":{"line":36,"column":13}}, + "range":[295,301] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + }, + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":38,"column":2},"end":{"line":38,"column":13}}, + "range":[312,323], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":38,"column":2},"end":{"line":38,"column":5}}, + "range":[312,315], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":38,"column":7},"end":{"line":38,"column":13}}, + "range":[317,323] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/explicit_inexact_forbidden_in_exact.js b/lib/test/flow/types/annotations/explicit_inexact_forbidden_in_exact.js new file mode 100644 index 0000000..06abe76 --- /dev/null +++ b/lib/test/flow/types/annotations/explicit_inexact_forbidden_in_exact.js @@ -0,0 +1 @@ +type T = {| foo: number, ... |}; diff --git a/lib/test/flow/types/annotations/explicit_inexact_forbidden_in_exact.tree.json b/lib/test/flow/types/annotations/explicit_inexact_forbidden_in_exact.tree.json new file mode 100644 index 0000000..4691a15 --- /dev/null +++ b/lib/test/flow/types/annotations/explicit_inexact_forbidden_in_exact.tree.json @@ -0,0 +1,64 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":28}}, + "message":"Explicit inexact syntax cannot appear inside an explicit exact object type" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":31}}, + "range":[9,31], + "exact":true, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":23}}, + "range":[12,23], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":15}}, + "range":[12,15], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":23}}, + "range":[17,23] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/explicit_inexact_must_appear_last.js b/lib/test/flow/types/annotations/explicit_inexact_must_appear_last.js new file mode 100644 index 0000000..938fa7d --- /dev/null +++ b/lib/test/flow/types/annotations/explicit_inexact_must_appear_last.js @@ -0,0 +1 @@ +type T = {..., foo: number}; diff --git a/lib/test/flow/types/annotations/explicit_inexact_must_appear_last.tree.json b/lib/test/flow/types/annotations/explicit_inexact_must_appear_last.tree.json new file mode 100644 index 0000000..181146d --- /dev/null +++ b/lib/test/flow/types/annotations/explicit_inexact_must_appear_last.tree.json @@ -0,0 +1,64 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, + "message":"Explicit inexact syntax must come at the end of an object type" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":27}}, + "range":[9,27], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":26}}, + "range":[15,26], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, + "range":[15,18], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":26}}, + "range":[20,26] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/explicit_inexact_object.js b/lib/test/flow/types/annotations/explicit_inexact_object.js new file mode 100644 index 0000000..0e5d25f --- /dev/null +++ b/lib/test/flow/types/annotations/explicit_inexact_object.js @@ -0,0 +1,3 @@ +type T = {...}; +type U = {x: number, ...}; +type V = {x: number, ...V, ...U, ...}; diff --git a/lib/test/flow/types/annotations/explicit_inexact_object.tree.json b/lib/test/flow/types/annotations/explicit_inexact_object.tree.json new file mode 100644 index 0000000..333b331 --- /dev/null +++ b/lib/test/flow/types/annotations/explicit_inexact_object.tree.json @@ -0,0 +1,171 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":38}}, + "range":[0,81], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "range":[9,14], + "exact":false, + "inexact":true, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":26}}, + "range":[16,42], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":6}}, + "range":[21,22], + "name":"U", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":25}}, + "range":[25,41], + "exact":false, + "inexact":true, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":19}}, + "range":[26,35], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, + "range":[26,27], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":19}}, + "range":[29,35] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":38}}, + "range":[43,81], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":5},"end":{"line":3,"column":6}}, + "range":[48,49], + "name":"V", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":9},"end":{"line":3,"column":37}}, + "range":[52,80], + "exact":false, + "inexact":true, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":3,"column":10},"end":{"line":3,"column":19}}, + "range":[53,62], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":10},"end":{"line":3,"column":11}}, + "range":[53,54], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":13},"end":{"line":3,"column":19}}, + "range":[56,62] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + }, + { + "type":"ObjectTypeSpreadProperty", + "loc":{"source":null,"start":{"line":3,"column":21},"end":{"line":3,"column":25}}, + "range":[64,68], + "argument":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":24},"end":{"line":3,"column":25}}, + "range":[67,68], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":24},"end":{"line":3,"column":25}}, + "range":[67,68], + "name":"V", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + { + "type":"ObjectTypeSpreadProperty", + "loc":{"source":null,"start":{"line":3,"column":27},"end":{"line":3,"column":31}}, + "range":[70,74], + "argument":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":30},"end":{"line":3,"column":31}}, + "range":[73,74], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":30},"end":{"line":3,"column":31}}, + "range":[73,74], + "name":"U", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/explicit_inexact_object_invalid.js b/lib/test/flow/types/annotations/explicit_inexact_object_invalid.js new file mode 100644 index 0000000..1a1b50e --- /dev/null +++ b/lib/test/flow/types/annotations/explicit_inexact_object_invalid.js @@ -0,0 +1,3 @@ +type T = {x: number, ..., y: number}; +type U = {x: number, ..., ...}; +type V = {x: number, ..., ...X}; diff --git a/lib/test/flow/types/annotations/explicit_inexact_object_invalid.tree.json b/lib/test/flow/types/annotations/explicit_inexact_object_invalid.tree.json new file mode 100644 index 0000000..7962232 --- /dev/null +++ b/lib/test/flow/types/annotations/explicit_inexact_object_invalid.tree.json @@ -0,0 +1,215 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":24}}, + "message":"Explicit inexact syntax must come at the end of an object type" + }, + { + "loc":{"source":null,"start":{"line":2,"column":21},"end":{"line":2,"column":24}}, + "message":"Explicit inexact syntax must come at the end of an object type" + }, + { + "loc":{"source":null,"start":{"line":3,"column":21},"end":{"line":3,"column":24}}, + "message":"Explicit inexact syntax must come at the end of an object type" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":32}}, + "range":[0,102], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "range":[0,37], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":36}}, + "range":[9,36], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":19}}, + "range":[10,19], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":19}}, + "range":[13,19] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + }, + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":35}}, + "range":[26,35], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, + "range":[26,27], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":35}}, + "range":[29,35] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":31}}, + "range":[38,69], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":6}}, + "range":[43,44], + "name":"U", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":30}}, + "range":[47,68], + "exact":false, + "inexact":true, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":19}}, + "range":[48,57], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, + "range":[48,49], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":19}}, + "range":[51,57] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":32}}, + "range":[70,102], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":5},"end":{"line":3,"column":6}}, + "range":[75,76], + "name":"V", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":9},"end":{"line":3,"column":31}}, + "range":[79,101], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":3,"column":10},"end":{"line":3,"column":19}}, + "range":[80,89], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":10},"end":{"line":3,"column":11}}, + "range":[80,81], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":13},"end":{"line":3,"column":19}}, + "range":[83,89] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + }, + { + "type":"ObjectTypeSpreadProperty", + "loc":{"source":null,"start":{"line":3,"column":26},"end":{"line":3,"column":30}}, + "range":[96,100], + "argument":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":29},"end":{"line":3,"column":30}}, + "range":[99,100], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":29},"end":{"line":3,"column":30}}, + "range":[99,100], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/explicit_inexact_trailing_comma.js b/lib/test/flow/types/annotations/explicit_inexact_trailing_comma.js new file mode 100644 index 0000000..cb18079 --- /dev/null +++ b/lib/test/flow/types/annotations/explicit_inexact_trailing_comma.js @@ -0,0 +1,10 @@ +type T = { ..., } +type U = { ...; } +type V = { + x: number, + ..., +} +type W = { + x: number; + ...; +} diff --git a/lib/test/flow/types/annotations/explicit_inexact_trailing_comma.tree.json b/lib/test/flow/types/annotations/explicit_inexact_trailing_comma.tree.json new file mode 100644 index 0000000..2de76cf --- /dev/null +++ b/lib/test/flow/types/annotations/explicit_inexact_trailing_comma.tree.json @@ -0,0 +1,158 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":10,"column":1}}, + "range":[0,101], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, + "range":[9,17], + "exact":false, + "inexact":true, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":17}}, + "range":[18,35], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":6}}, + "range":[23,24], + "name":"U", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":17}}, + "range":[27,35], + "exact":false, + "inexact":true, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":6,"column":1}}, + "range":[36,68], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":5},"end":{"line":3,"column":6}}, + "range":[41,42], + "name":"V", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":9},"end":{"line":6,"column":1}}, + "range":[45,68], + "exact":false, + "inexact":true, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":11}}, + "range":[49,58], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":3}}, + "range":[49,50], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":5},"end":{"line":4,"column":11}}, + "range":[52,58] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":10,"column":1}}, + "range":[69,101], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":5},"end":{"line":7,"column":6}}, + "range":[74,75], + "name":"W", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":9},"end":{"line":10,"column":1}}, + "range":[78,101], + "exact":false, + "inexact":true, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":8,"column":2},"end":{"line":8,"column":11}}, + "range":[82,91], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":8,"column":2},"end":{"line":8,"column":3}}, + "range":[82,83], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":8,"column":5},"end":{"line":8,"column":11}}, + "range":[85,91] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0000.js b/lib/test/flow/types/annotations/migrated_0000.js new file mode 100644 index 0000000..8f44f95 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0000.js @@ -0,0 +1 @@ +function foo(numVal: number, x: number){} diff --git a/lib/test/flow/types/annotations/migrated_0000.tree.json b/lib/test/flow/types/annotations/migrated_0000.tree.json new file mode 100644 index 0000000..d8e4dc9 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0000.tree.json @@ -0,0 +1,69 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "range":[0,41], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "range":[0,41], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":27}}, + "range":[13,27], + "name":"numVal", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, + "range":[19,27], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "range":[21,27] + } + }, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":38}}, + "range":[29,38], + "name":"x", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":38}}, + "range":[30,38], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":38}}, + "range":[32,38] + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":41}}, + "range":[39,41], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0001.js b/lib/test/flow/types/annotations/migrated_0001.js new file mode 100644 index 0000000..51e2ff1 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0001.js @@ -0,0 +1 @@ +function foo(a: function, b: switch){} diff --git a/lib/test/flow/types/annotations/migrated_0001.tree.json b/lib/test/flow/types/annotations/migrated_0001.tree.json new file mode 100644 index 0000000..b0e37a9 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0001.tree.json @@ -0,0 +1,87 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":24}}, + "range":[13,24], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":24}}, + "range":[14,24], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":24}}, + "range":[16,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":24}}, + "range":[16,24], + "name":"function", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":35}}, + "range":[26,35], + "name":"b", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":35}}, + "range":[27,35], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":35}}, + "range":[29,35], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":35}}, + "range":[29,35], + "name":"switch", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":38}}, + "range":[36,38], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0002.js b/lib/test/flow/types/annotations/migrated_0002.js new file mode 100644 index 0000000..d750783 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0002.js @@ -0,0 +1 @@ +function foo(numVal: number, strVal: string){} diff --git a/lib/test/flow/types/annotations/migrated_0002.tree.json b/lib/test/flow/types/annotations/migrated_0002.tree.json new file mode 100644 index 0000000..2bfd0f0 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0002.tree.json @@ -0,0 +1,69 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "range":[0,46], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "range":[0,46], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":27}}, + "range":[13,27], + "name":"numVal", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, + "range":[19,27], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "range":[21,27] + } + }, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":43}}, + "range":[29,43], + "name":"strVal", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":43}}, + "range":[35,43], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":43}}, + "range":[37,43] + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":44},"end":{"line":1,"column":46}}, + "range":[44,46], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0003.js b/lib/test/flow/types/annotations/migrated_0003.js new file mode 100644 index 0000000..887e2ca --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0003.js @@ -0,0 +1 @@ +function foo(numVal: number, untypedVal){} diff --git a/lib/test/flow/types/annotations/migrated_0003.tree.json b/lib/test/flow/types/annotations/migrated_0003.tree.json new file mode 100644 index 0000000..9487245 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0003.tree.json @@ -0,0 +1,60 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "range":[0,42], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "range":[0,42], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":27}}, + "range":[13,27], + "name":"numVal", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, + "range":[19,27], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "range":[21,27] + } + }, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":39}}, + "range":[29,39], + "name":"untypedVal", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":40},"end":{"line":1,"column":42}}, + "range":[40,42], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0004.js b/lib/test/flow/types/annotations/migrated_0004.js new file mode 100644 index 0000000..e930b47 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0004.js @@ -0,0 +1 @@ +function foo(untypedVal, numVal: number){} diff --git a/lib/test/flow/types/annotations/migrated_0004.tree.json b/lib/test/flow/types/annotations/migrated_0004.tree.json new file mode 100644 index 0000000..0fc7bf7 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0004.tree.json @@ -0,0 +1,60 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "range":[0,42], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "range":[0,42], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":23}}, + "range":[13,23], + "name":"untypedVal", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":39}}, + "range":[25,39], + "name":"numVal", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":39}}, + "range":[31,39], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":39}}, + "range":[33,39] + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":40},"end":{"line":1,"column":42}}, + "range":[40,42], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0005.js b/lib/test/flow/types/annotations/migrated_0005.js new file mode 100644 index 0000000..e6a65a0 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0005.js @@ -0,0 +1 @@ +function foo(nullableNum: ?number){} diff --git a/lib/test/flow/types/annotations/migrated_0005.tree.json b/lib/test/flow/types/annotations/migrated_0005.tree.json new file mode 100644 index 0000000..c038771 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0005.tree.json @@ -0,0 +1,57 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":33}}, + "range":[13,33], + "name":"nullableNum", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":33}}, + "range":[24,33], + "typeAnnotation":{ + "type":"NullableTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":33}}, + "range":[26,33], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":33}}, + "range":[27,33] + } + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":36}}, + "range":[34,36], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0006.js b/lib/test/flow/types/annotations/migrated_0006.js new file mode 100644 index 0000000..a8170c0 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0006.js @@ -0,0 +1 @@ +function foo(callback: () => void){} diff --git a/lib/test/flow/types/annotations/migrated_0006.tree.json b/lib/test/flow/types/annotations/migrated_0006.tree.json new file mode 100644 index 0000000..e5082db --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0006.tree.json @@ -0,0 +1,60 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":33}}, + "range":[13,33], + "name":"callback", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":33}}, + "range":[21,33], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":33}}, + "range":[23,33], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":33}}, + "range":[29,33] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":36}}, + "range":[34,36], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0007.js b/lib/test/flow/types/annotations/migrated_0007.js new file mode 100644 index 0000000..f3df842 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0007.js @@ -0,0 +1 @@ +function foo(callback: () => number){} diff --git a/lib/test/flow/types/annotations/migrated_0007.tree.json b/lib/test/flow/types/annotations/migrated_0007.tree.json new file mode 100644 index 0000000..ddb2f19 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0007.tree.json @@ -0,0 +1,60 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":35}}, + "range":[13,35], + "name":"callback", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":35}}, + "range":[21,35], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":35}}, + "range":[23,35], + "params":[], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":35}}, + "range":[29,35] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":38}}, + "range":[36,38], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0008.js b/lib/test/flow/types/annotations/migrated_0008.js new file mode 100644 index 0000000..3550d7c --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0008.js @@ -0,0 +1 @@ +function foo(callback: (_:bool) => number){} diff --git a/lib/test/flow/types/annotations/migrated_0008.tree.json b/lib/test/flow/types/annotations/migrated_0008.tree.json new file mode 100644 index 0000000..ef38ded --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0008.tree.json @@ -0,0 +1,80 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, + "range":[0,44], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, + "range":[0,44], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":41}}, + "range":[13,41], + "name":"callback", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":41}}, + "range":[21,41], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":41}}, + "range":[23,41], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":30}}, + "range":[24,30], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, + "range":[24,25], + "name":"_", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":30}}, + "range":[26,30] + }, + "optional":false + } + ], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":41}}, + "range":[35,41] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":42},"end":{"line":1,"column":44}}, + "range":[42,44], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0009.js b/lib/test/flow/types/annotations/migrated_0009.js new file mode 100644 index 0000000..ef6d936 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0009.js @@ -0,0 +1 @@ +function foo(callback: (_1:bool, _2:string) => number){} diff --git a/lib/test/flow/types/annotations/migrated_0009.tree.json b/lib/test/flow/types/annotations/migrated_0009.tree.json new file mode 100644 index 0000000..727e1da --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0009.tree.json @@ -0,0 +1,99 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, + "range":[0,56], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, + "range":[0,56], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":53}}, + "range":[13,53], + "name":"callback", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":53}}, + "range":[21,53], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":53}}, + "range":[23,53], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":31}}, + "range":[24,31], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, + "range":[24,26], + "name":"_1", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":31}}, + "range":[27,31] + }, + "optional":false + }, + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":42}}, + "range":[33,42], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":35}}, + "range":[33,35], + "name":"_2", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":42}}, + "range":[36,42] + }, + "optional":false + } + ], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":47},"end":{"line":1,"column":53}}, + "range":[47,53] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":54},"end":{"line":1,"column":56}}, + "range":[54,56], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0010.js b/lib/test/flow/types/annotations/migrated_0010.js new file mode 100644 index 0000000..b6b9ebf --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0010.js @@ -0,0 +1 @@ +function foo():number{} diff --git a/lib/test/flow/types/annotations/migrated_0010.tree.json b/lib/test/flow/types/annotations/migrated_0010.tree.json new file mode 100644 index 0000000..38ef7f6 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0010.tree.json @@ -0,0 +1,43 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, + "range":[21,23], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":21}}, + "range":[14,21], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":21}}, + "range":[15,21] + } + }, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0011.js b/lib/test/flow/types/annotations/migrated_0011.js new file mode 100644 index 0000000..648543b --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0011.js @@ -0,0 +1 @@ +function foo():() => void{} diff --git a/lib/test/flow/types/annotations/migrated_0011.tree.json b/lib/test/flow/types/annotations/migrated_0011.tree.json new file mode 100644 index 0000000..61a31c9 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0011.tree.json @@ -0,0 +1,51 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, + "range":[25,27], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":25}}, + "range":[14,25], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":25}}, + "range":[15,25], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":25}}, + "range":[21,25] + }, + "rest":null, + "typeParameters":null + } + }, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0012.js b/lib/test/flow/types/annotations/migrated_0012.js new file mode 100644 index 0000000..8155cd4 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0012.js @@ -0,0 +1 @@ +function foo():(_:bool) => number{} diff --git a/lib/test/flow/types/annotations/migrated_0012.tree.json b/lib/test/flow/types/annotations/migrated_0012.tree.json new file mode 100644 index 0000000..6bc10c5 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0012.tree.json @@ -0,0 +1,71 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":35}}, + "range":[33,35], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":33}}, + "range":[14,33], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":33}}, + "range":[15,33], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":22}}, + "range":[16,22], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "range":[16,17], + "name":"_", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":22}}, + "range":[18,22] + }, + "optional":false + } + ], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":33}}, + "range":[27,33] + }, + "rest":null, + "typeParameters":null + } + }, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0013.js b/lib/test/flow/types/annotations/migrated_0013.js new file mode 100644 index 0000000..dd66d46 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0013.js @@ -0,0 +1 @@ +function foo(): {} {} diff --git a/lib/test/flow/types/annotations/migrated_0013.tree.json b/lib/test/flow/types/annotations/migrated_0013.tree.json new file mode 100644 index 0000000..0c039cb --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0013.tree.json @@ -0,0 +1,49 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, + "range":[19,21], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":18}}, + "range":[14,18], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, + "range":[16,18], + "exact":false, + "inexact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0014.js b/lib/test/flow/types/annotations/migrated_0014.js new file mode 100644 index 0000000..7994e75 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0014.js @@ -0,0 +1 @@ +function foo() {} diff --git a/lib/test/flow/types/annotations/migrated_0014.tree.json b/lib/test/flow/types/annotations/migrated_0014.tree.json new file mode 100644 index 0000000..5c23519 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0014.tree.json @@ -0,0 +1,49 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, + "range":[18,20], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":15}}, + "range":[12,15], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0015.js b/lib/test/flow/types/annotations/migrated_0015.js new file mode 100644 index 0000000..ec6801a --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0015.js @@ -0,0 +1 @@ +function foo() {} diff --git a/lib/test/flow/types/annotations/migrated_0015.tree.json b/lib/test/flow/types/annotations/migrated_0015.tree.json new file mode 100644 index 0000000..86872a6 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0015.tree.json @@ -0,0 +1,58 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "range":[20,22], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":17}}, + "range":[12,17], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "name":"T", + "bound":null, + "variance":null, + "default":null + }, + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"S", + "bound":null, + "variance":null, + "default":null + } + ] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0016.js b/lib/test/flow/types/annotations/migrated_0016.js new file mode 100644 index 0000000..4a09234 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0016.js @@ -0,0 +1 @@ +function foo(...typedRest: Array){} diff --git a/lib/test/flow/types/annotations/migrated_0016.tree.json b/lib/test/flow/types/annotations/migrated_0016.tree.json new file mode 100644 index 0000000..52b4ad1 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0016.tree.json @@ -0,0 +1,77 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "range":[0,43], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "range":[0,43], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"RestElement", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":40}}, + "range":[13,40], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":40}}, + "range":[16,40], + "name":"typedRest", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":40}}, + "range":[25,40], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":40}}, + "range":[27,40], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":32}}, + "range":[27,32], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":40}}, + "range":[32,40], + "params":[ + { + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":39}}, + "range":[33,39] + } + ] + } + } + }, + "optional":false + } + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":43}}, + "range":[41,43], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0017.js b/lib/test/flow/types/annotations/migrated_0017.js new file mode 100644 index 0000000..f0fa40b --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0017.js @@ -0,0 +1 @@ +a=function() {} diff --git a/lib/test/flow/types/annotations/migrated_0017.tree.json b/lib/test/flow/types/annotations/migrated_0017.tree.json new file mode 100644 index 0000000..a59b239 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0017.tree.json @@ -0,0 +1,71 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "operator":"=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":20}}, + "range":[2,20], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, + "range":[18,20], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, + "range":[10,15], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"T", + "bound":null, + "variance":null, + "default":null + }, + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "name":"S", + "bound":null, + "variance":null, + "default":null + } + ] + } + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0018.js b/lib/test/flow/types/annotations/migrated_0018.js new file mode 100644 index 0000000..406ae85 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0018.js @@ -0,0 +1 @@ +a={set fooProp(value:number){}} diff --git a/lib/test/flow/types/annotations/migrated_0018.tree.json b/lib/test/flow/types/annotations/migrated_0018.tree.json new file mode 100644 index 0000000..40bd640 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0018.tree.json @@ -0,0 +1,89 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "operator":"=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":31}}, + "range":[2,31], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":30}}, + "range":[3,30], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":14}}, + "range":[7,14], + "name":"fooProp", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":30}}, + "range":[14,30], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":27}}, + "range":[15,27], + "name":"value", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":27}}, + "range":[20,27], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "range":[21,27] + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, + "range":[28,30], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"set", + "method":false, + "shorthand":false, + "computed":false + } + ] + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0019.js b/lib/test/flow/types/annotations/migrated_0019.js new file mode 100644 index 0000000..7f3dbc9 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0019.js @@ -0,0 +1 @@ +var numVal:number; diff --git a/lib/test/flow/types/annotations/migrated_0019.tree.json b/lib/test/flow/types/annotations/migrated_0019.tree.json new file mode 100644 index 0000000..5531589 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0019.tree.json @@ -0,0 +1,39 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, + "range":[4,17], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, + "range":[4,17], + "name":"numVal", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":17}}, + "range":[10,17], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":17}}, + "range":[11,17] + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0020.js b/lib/test/flow/types/annotations/migrated_0020.js new file mode 100644 index 0000000..edbc4e4 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0020.js @@ -0,0 +1 @@ +var numVal:number = otherNumVal; diff --git a/lib/test/flow/types/annotations/migrated_0020.tree.json b/lib/test/flow/types/annotations/migrated_0020.tree.json new file mode 100644 index 0000000..f5dad91 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0020.tree.json @@ -0,0 +1,46 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":31}}, + "range":[4,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, + "range":[4,17], + "name":"numVal", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":17}}, + "range":[10,17], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":17}}, + "range":[11,17] + } + }, + "optional":false + }, + "init":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":31}}, + "range":[20,31], + "name":"otherNumVal", + "typeAnnotation":null, + "optional":false + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0021.js b/lib/test/flow/types/annotations/migrated_0021.js new file mode 100644 index 0000000..460fac5 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0021.js @@ -0,0 +1 @@ +var a: ?{numVal: number}; diff --git a/lib/test/flow/types/annotations/migrated_0021.tree.json b/lib/test/flow/types/annotations/migrated_0021.tree.json new file mode 100644 index 0000000..28160a5 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0021.tree.json @@ -0,0 +1,75 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":24}}, + "range":[4,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":24}}, + "range":[4,24], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":24}}, + "range":[5,24], + "typeAnnotation":{ + "type":"NullableTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":24}}, + "range":[7,24], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":24}}, + "range":[8,24], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":23}}, + "range":[9,23], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "range":[9,15], + "name":"numVal", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":23}}, + "range":[17,23] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0022.js b/lib/test/flow/types/annotations/migrated_0022.js new file mode 100644 index 0000000..47599fd --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0022.js @@ -0,0 +1 @@ +var a: {numVal: number}; diff --git a/lib/test/flow/types/annotations/migrated_0022.tree.json b/lib/test/flow/types/annotations/migrated_0022.tree.json new file mode 100644 index 0000000..c60afe1 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0022.tree.json @@ -0,0 +1,70 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":23}}, + "range":[4,23], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":23}}, + "range":[4,23], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":23}}, + "range":[5,23], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":23}}, + "range":[7,23], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":22}}, + "range":[8,22], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, + "range":[8,14], + "name":"numVal", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":22}}, + "range":[16,22] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0023.js b/lib/test/flow/types/annotations/migrated_0023.js new file mode 100644 index 0000000..b5760d1 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0023.js @@ -0,0 +1 @@ +var a: {numVal: number; [index: number]: string}; diff --git a/lib/test/flow/types/annotations/migrated_0023.tree.json b/lib/test/flow/types/annotations/migrated_0023.tree.json new file mode 100644 index 0000000..3204fa2 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0023.tree.json @@ -0,0 +1,96 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "range":[0,49], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "range":[0,49], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":48}}, + "range":[4,48], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":48}}, + "range":[4,48], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":48}}, + "range":[5,48], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":48}}, + "range":[7,48], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":22}}, + "range":[8,22], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, + "range":[8,14], + "name":"numVal", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":22}}, + "range":[16,22] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[ + { + "type":"ObjectTypeIndexer", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":47}}, + "range":[24,47], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":30}}, + "range":[25,30], + "name":"index", + "typeAnnotation":null, + "optional":false + }, + "key":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":38}}, + "range":[32,38] + }, + "value":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":47}}, + "range":[41,47] + }, + "static":false, + "variance":null + } + ], + "callProperties":[], + "internalSlots":[] + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0024.js b/lib/test/flow/types/annotations/migrated_0024.js new file mode 100644 index 0000000..9c6b3e3 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0024.js @@ -0,0 +1 @@ +var a: {[index: number]: string; [index2: string]: number}; diff --git a/lib/test/flow/types/annotations/migrated_0024.tree.json b/lib/test/flow/types/annotations/migrated_0024.tree.json new file mode 100644 index 0000000..97c394f --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0024.tree.json @@ -0,0 +1,96 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":59}}, + "range":[0,59], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":59}}, + "range":[0,59], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":58}}, + "range":[4,58], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":58}}, + "range":[4,58], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":58}}, + "range":[5,58], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":58}}, + "range":[7,58], + "exact":false, + "inexact":false, + "properties":[], + "indexers":[ + { + "type":"ObjectTypeIndexer", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":31}}, + "range":[8,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "range":[9,14], + "name":"index", + "typeAnnotation":null, + "optional":false + }, + "key":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":22}}, + "range":[16,22] + }, + "value":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":31}}, + "range":[25,31] + }, + "static":false, + "variance":null + }, + { + "type":"ObjectTypeIndexer", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":57}}, + "range":[33,57], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":40}}, + "range":[34,40], + "name":"index2", + "typeAnnotation":null, + "optional":false + }, + "key":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":42},"end":{"line":1,"column":48}}, + "range":[42,48] + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":51},"end":{"line":1,"column":57}}, + "range":[51,57] + }, + "static":false, + "variance":null + } + ], + "callProperties":[], + "internalSlots":[] + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0025.js b/lib/test/flow/types/annotations/migrated_0025.js new file mode 100644 index 0000000..ab00afa --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0025.js @@ -0,0 +1 @@ +var a: {subObj: {strVal: string}} diff --git a/lib/test/flow/types/annotations/migrated_0025.tree.json b/lib/test/flow/types/annotations/migrated_0025.tree.json new file mode 100644 index 0000000..a14dcd0 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0025.tree.json @@ -0,0 +1,101 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":33}}, + "range":[4,33], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":33}}, + "range":[4,33], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":33}}, + "range":[5,33], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":33}}, + "range":[7,33], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":32}}, + "range":[8,32], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, + "range":[8,14], + "name":"subObj", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":32}}, + "range":[16,32], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":31}}, + "range":[17,31], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":23}}, + "range":[17,23], + "name":"strVal", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":31}}, + "range":[25,31] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0026.js b/lib/test/flow/types/annotations/migrated_0026.js new file mode 100644 index 0000000..5d72145 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0026.js @@ -0,0 +1 @@ +var a: {param1: number; param2: string} diff --git a/lib/test/flow/types/annotations/migrated_0026.tree.json b/lib/test/flow/types/annotations/migrated_0026.tree.json new file mode 100644 index 0000000..56dc6f8 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0026.tree.json @@ -0,0 +1,94 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "range":[0,39], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "range":[0,39], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":39}}, + "range":[4,39], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":39}}, + "range":[4,39], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":39}}, + "range":[5,39], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":39}}, + "range":[7,39], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":22}}, + "range":[8,22], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, + "range":[8,14], + "name":"param1", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":22}}, + "range":[16,22] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + }, + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":38}}, + "range":[24,38], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":30}}, + "range":[24,30], + "name":"param2", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":38}}, + "range":[32,38] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0027.js b/lib/test/flow/types/annotations/migrated_0027.js new file mode 100644 index 0000000..5b68536 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0027.js @@ -0,0 +1 @@ +var a: {param1: number; param2?: string} diff --git a/lib/test/flow/types/annotations/migrated_0027.tree.json b/lib/test/flow/types/annotations/migrated_0027.tree.json new file mode 100644 index 0000000..cec1aec --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0027.tree.json @@ -0,0 +1,94 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "range":[0,40], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "range":[0,40], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":40}}, + "range":[4,40], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":40}}, + "range":[4,40], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":40}}, + "range":[5,40], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":40}}, + "range":[7,40], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":22}}, + "range":[8,22], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, + "range":[8,14], + "name":"param1", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":22}}, + "range":[16,22] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + }, + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":39}}, + "range":[24,39], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":30}}, + "range":[24,30], + "name":"param2", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":39}}, + "range":[33,39] + }, + "method":false, + "optional":true, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0030.js b/lib/test/flow/types/annotations/migrated_0030.js new file mode 100644 index 0000000..6094fb9 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0030.js @@ -0,0 +1 @@ +var a: { add(...rest:Array): number; } diff --git a/lib/test/flow/types/annotations/migrated_0030.tree.json b/lib/test/flow/types/annotations/migrated_0030.tree.json new file mode 100644 index 0000000..78bf191 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0030.tree.json @@ -0,0 +1,116 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "range":[0,46], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "range":[0,46], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":46}}, + "range":[4,46], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":46}}, + "range":[4,46], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":46}}, + "range":[5,46], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":46}}, + "range":[7,46], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":43}}, + "range":[9,43], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"add", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":43}}, + "range":[9,43], + "params":[], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":43}}, + "range":[37,43] + }, + "rest":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":34}}, + "range":[16,34], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":20}}, + "range":[16,20], + "name":"rest", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":34}}, + "range":[21,34], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":26}}, + "range":[21,26], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":34}}, + "range":[26,34], + "params":[ + { + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":33}}, + "range":[27,33] + } + ] + } + }, + "optional":false + }, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0031.js b/lib/test/flow/types/annotations/migrated_0031.js new file mode 100644 index 0000000..2d5f8d7 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0031.js @@ -0,0 +1 @@ +var a: { get foo(): number; } diff --git a/lib/test/flow/types/annotations/migrated_0031.tree.json b/lib/test/flow/types/annotations/migrated_0031.tree.json new file mode 100644 index 0000000..4e7a8cf --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0031.tree.json @@ -0,0 +1,78 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":29}}, + "range":[4,29], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":29}}, + "range":[4,29], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":29}}, + "range":[5,29], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":29}}, + "range":[7,29], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":26}}, + "range":[9,26], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, + "range":[13,16], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":26}}, + "range":[9,26], + "params":[], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":26}}, + "range":[20,26] + }, + "rest":null, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"get" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0032.js b/lib/test/flow/types/annotations/migrated_0032.js new file mode 100644 index 0000000..96cc7d2 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0032.js @@ -0,0 +1 @@ +var a: { set foo(x: number): void; } diff --git a/lib/test/flow/types/annotations/migrated_0032.tree.json b/lib/test/flow/types/annotations/migrated_0032.tree.json new file mode 100644 index 0000000..ed0d0b2 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0032.tree.json @@ -0,0 +1,98 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":36}}, + "range":[4,36], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":36}}, + "range":[4,36], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":36}}, + "range":[5,36], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":36}}, + "range":[7,36], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":33}}, + "range":[9,33], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, + "range":[13,16], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":33}}, + "range":[9,33], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":26}}, + "range":[17,26], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "range":[17,18], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":26}}, + "range":[20,26] + }, + "optional":false + } + ], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":33}}, + "range":[29,33] + }, + "rest":null, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"set" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0033.js b/lib/test/flow/types/annotations/migrated_0033.js new file mode 100644 index 0000000..d45c82b --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0033.js @@ -0,0 +1 @@ +var a: { get foo(): number; set foo(x: number): void; } diff --git a/lib/test/flow/types/annotations/migrated_0033.tree.json b/lib/test/flow/types/annotations/migrated_0033.tree.json new file mode 100644 index 0000000..ab8a641 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0033.tree.json @@ -0,0 +1,130 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":55}}, + "range":[0,55], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":55}}, + "range":[0,55], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":55}}, + "range":[4,55], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":55}}, + "range":[4,55], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":55}}, + "range":[5,55], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":55}}, + "range":[7,55], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":26}}, + "range":[9,26], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, + "range":[13,16], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":26}}, + "range":[9,26], + "params":[], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":26}}, + "range":[20,26] + }, + "rest":null, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"get" + }, + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":52}}, + "range":[28,52], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":35}}, + "range":[32,35], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":52}}, + "range":[28,52], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":45}}, + "range":[36,45], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":37}}, + "range":[36,37], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":45}}, + "range":[39,45] + }, + "optional":false + } + ], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":48},"end":{"line":1,"column":52}}, + "range":[48,52] + }, + "rest":null, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"set" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0034.js b/lib/test/flow/types/annotations/migrated_0034.js new file mode 100644 index 0000000..4e3fc20 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0034.js @@ -0,0 +1 @@ +var a: {get?: number; set?: string} diff --git a/lib/test/flow/types/annotations/migrated_0034.tree.json b/lib/test/flow/types/annotations/migrated_0034.tree.json new file mode 100644 index 0000000..1ed6927 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0034.tree.json @@ -0,0 +1,94 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":35}}, + "range":[4,35], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":35}}, + "range":[4,35], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":35}}, + "range":[5,35], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":35}}, + "range":[7,35], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":20}}, + "range":[8,20], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":11}}, + "range":[8,11], + "name":"get", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":20}}, + "range":[14,20] + }, + "method":false, + "optional":true, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + }, + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":34}}, + "range":[22,34], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":25}}, + "range":[22,25], + "name":"set", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":34}}, + "range":[28,34] + }, + "method":false, + "optional":true, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0035.js b/lib/test/flow/types/annotations/migrated_0035.js new file mode 100644 index 0000000..eb9af12 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0035.js @@ -0,0 +1 @@ +var a: { get foo(x: string): number; } diff --git a/lib/test/flow/types/annotations/migrated_0035.tree.json b/lib/test/flow/types/annotations/migrated_0035.tree.json new file mode 100644 index 0000000..fdbf0d5 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0035.tree.json @@ -0,0 +1,104 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, + "message":"Getter should have zero parameters" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":38}}, + "range":[4,38], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":38}}, + "range":[4,38], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":38}}, + "range":[5,38], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":38}}, + "range":[7,38], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":35}}, + "range":[9,35], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, + "range":[13,16], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":35}}, + "range":[9,35], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":26}}, + "range":[17,26], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "range":[17,18], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":26}}, + "range":[20,26] + }, + "optional":false + } + ], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":35}}, + "range":[29,35] + }, + "rest":null, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"get" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0036.js b/lib/test/flow/types/annotations/migrated_0036.js new file mode 100644 index 0000000..a85b116 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0036.js @@ -0,0 +1 @@ +var a: { set foo(): void; } diff --git a/lib/test/flow/types/annotations/migrated_0036.tree.json b/lib/test/flow/types/annotations/migrated_0036.tree.json new file mode 100644 index 0000000..9cdb7d5 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0036.tree.json @@ -0,0 +1,84 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, + "message":"Setter should have exactly one parameter" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":27}}, + "range":[4,27], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":27}}, + "range":[4,27], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":27}}, + "range":[5,27], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":27}}, + "range":[7,27], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":24}}, + "range":[9,24], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, + "range":[13,16], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":24}}, + "range":[9,24], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":24}}, + "range":[20,24] + }, + "rest":null, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"set" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0037.js b/lib/test/flow/types/annotations/migrated_0037.js new file mode 100644 index 0000000..769fe23 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0037.js @@ -0,0 +1 @@ +var a: { +get foo(): number } diff --git a/lib/test/flow/types/annotations/migrated_0037.tree.json b/lib/test/flow/types/annotations/migrated_0037.tree.json new file mode 100644 index 0000000..99daf37 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0037.tree.json @@ -0,0 +1,84 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "message":"Unexpected variance sigil" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":29}}, + "range":[4,29], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":29}}, + "range":[4,29], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":29}}, + "range":[5,29], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":29}}, + "range":[7,29], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":27}}, + "range":[9,27], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, + "range":[14,17], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":27}}, + "range":[9,27], + "params":[], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "range":[21,27] + }, + "rest":null, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"get" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0038.js b/lib/test/flow/types/annotations/migrated_0038.js new file mode 100644 index 0000000..ad58693 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0038.js @@ -0,0 +1 @@ +var a: { +set foo(x: number): void } diff --git a/lib/test/flow/types/annotations/migrated_0038.tree.json b/lib/test/flow/types/annotations/migrated_0038.tree.json new file mode 100644 index 0000000..8f470e0 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0038.tree.json @@ -0,0 +1,104 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "message":"Unexpected variance sigil" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":36}}, + "range":[4,36], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":36}}, + "range":[4,36], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":36}}, + "range":[5,36], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":36}}, + "range":[7,36], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":34}}, + "range":[9,34], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, + "range":[14,17], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":34}}, + "range":[9,34], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":27}}, + "range":[18,27], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "range":[21,27] + }, + "optional":false + } + ], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":34}}, + "range":[30,34] + }, + "rest":null, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"set" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0039.js b/lib/test/flow/types/annotations/migrated_0039.js new file mode 100644 index 0000000..633b702 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0039.js @@ -0,0 +1 @@ +var a:(...rest:Array) => number diff --git a/lib/test/flow/types/annotations/migrated_0039.tree.json b/lib/test/flow/types/annotations/migrated_0039.tree.json new file mode 100644 index 0000000..406000e --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0039.tree.json @@ -0,0 +1,85 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "range":[0,39], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "range":[0,39], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":39}}, + "range":[4,39], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":39}}, + "range":[4,39], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":39}}, + "range":[5,39], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":39}}, + "range":[6,39], + "params":[], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":39}}, + "range":[33,39] + }, + "rest":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":28}}, + "range":[10,28], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, + "range":[10,14], + "name":"rest", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":28}}, + "range":[15,28], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "range":[15,20], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, + "range":[20,28], + "params":[ + { + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "range":[21,27] + } + ] + } + }, + "optional":false + }, + "typeParameters":null + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0040.js b/lib/test/flow/types/annotations/migrated_0040.js new file mode 100644 index 0000000..74f50a0 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0040.js @@ -0,0 +1 @@ +var bar: (str:number, i:number)=> string = foo; diff --git a/lib/test/flow/types/annotations/migrated_0040.tree.json b/lib/test/flow/types/annotations/migrated_0040.tree.json new file mode 100644 index 0000000..92a2457 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0040.tree.json @@ -0,0 +1,93 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "range":[0,47], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "range":[0,47], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":46}}, + "range":[4,46], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":40}}, + "range":[4,40], + "name":"bar", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":40}}, + "range":[7,40], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":40}}, + "range":[9,40], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":20}}, + "range":[10,20], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, + "range":[10,13], + "name":"str", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":20}}, + "range":[14,20] + }, + "optional":false + }, + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":30}}, + "range":[22,30], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, + "range":[22,23], + "name":"i", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":30}}, + "range":[24,30] + }, + "optional":false + } + ], + "returnType":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":40}}, + "range":[34,40] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "init":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":43},"end":{"line":1,"column":46}}, + "range":[43,46], + "name":"foo", + "typeAnnotation":null, + "optional":false + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0041.js b/lib/test/flow/types/annotations/migrated_0041.js new file mode 100644 index 0000000..38ad744 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0041.js @@ -0,0 +1 @@ +var a:Array = [1, 2, 3] diff --git a/lib/test/flow/types/annotations/migrated_0041.tree.json b/lib/test/flow/types/annotations/migrated_0041.tree.json new file mode 100644 index 0000000..c20080c --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0041.tree.json @@ -0,0 +1,86 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":31}}, + "range":[4,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":19}}, + "range":[4,19], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":19}}, + "range":[5,19], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":19}}, + "range":[6,19], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":11}}, + "range":[6,11], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":19}}, + "range":[11,19], + "params":[ + { + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":18}}, + "range":[12,18] + } + ] + } + } + }, + "optional":false + }, + "init":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":31}}, + "range":[22,31], + "elements":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, + "range":[23,24], + "value":1, + "raw":"1" + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, + "range":[26,27], + "value":2, + "raw":"2" + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, + "range":[29,30], + "value":3, + "raw":"3" + } + ] + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0042.js b/lib/test/flow/types/annotations/migrated_0042.js new file mode 100644 index 0000000..97607a0 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0042.js @@ -0,0 +1 @@ +function foo(requiredParam, optParam?) {} diff --git a/lib/test/flow/types/annotations/migrated_0042.tree.json b/lib/test/flow/types/annotations/migrated_0042.tree.json new file mode 100644 index 0000000..f98212a --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0042.tree.json @@ -0,0 +1,51 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "range":[0,41], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "range":[0,41], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":26}}, + "range":[13,26], + "name":"requiredParam", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":37}}, + "range":[28,37], + "name":"optParam", + "typeAnnotation":null, + "optional":true + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":41}}, + "range":[39,41], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0043.js b/lib/test/flow/types/annotations/migrated_0043.js new file mode 100644 index 0000000..9d3c01c --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0043.js @@ -0,0 +1 @@ +function foo(requiredParam, optParam?=123) {} diff --git a/lib/test/flow/types/annotations/migrated_0043.tree.json b/lib/test/flow/types/annotations/migrated_0043.tree.json new file mode 100644 index 0000000..4b349f8 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0043.tree.json @@ -0,0 +1,63 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "range":[0,45], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "range":[0,45], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":26}}, + "range":[13,26], + "name":"requiredParam", + "typeAnnotation":null, + "optional":false + }, + { + "type":"AssignmentPattern", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":41}}, + "range":[28,41], + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":37}}, + "range":[28,37], + "name":"optParam", + "typeAnnotation":null, + "optional":true + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":41}}, + "range":[38,41], + "value":123, + "raw":"123" + } + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":43},"end":{"line":1,"column":45}}, + "range":[43,45], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0044.js b/lib/test/flow/types/annotations/migrated_0044.js new file mode 100644 index 0000000..ab25c6e --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0044.js @@ -0,0 +1 @@ +class Foo {set fooProp(value:number){}} diff --git a/lib/test/flow/types/annotations/migrated_0044.tree.json b/lib/test/flow/types/annotations/migrated_0044.tree.json new file mode 100644 index 0000000..034130a --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0044.tree.json @@ -0,0 +1,87 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "range":[0,39], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "range":[0,39], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":39}}, + "range":[10,39], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":38}}, + "range":[11,38], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":22}}, + "range":[15,22], + "name":"fooProp", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":38}}, + "range":[22,38], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":35}}, + "range":[23,35], + "name":"value", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":35}}, + "range":[28,35], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":35}}, + "range":[29,35] + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":38}}, + "range":[36,38], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"set", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0045.js b/lib/test/flow/types/annotations/migrated_0045.js new file mode 100644 index 0000000..aa4b747 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0045.js @@ -0,0 +1 @@ +a = class Foo { } diff --git a/lib/test/flow/types/annotations/migrated_0045.tree.json b/lib/test/flow/types/annotations/migrated_0045.tree.json new file mode 100644 index 0000000..42ebd74 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0045.tree.json @@ -0,0 +1,67 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "operator":"=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"ClassExpression", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":20}}, + "range":[4,20], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, + "range":[10,13], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "body":[] + }, + "superClass":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, + "range":[13,16], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0046.js b/lib/test/flow/types/annotations/migrated_0046.js new file mode 100644 index 0000000..9f84d17 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0046.js @@ -0,0 +1 @@ +class Foo {} diff --git a/lib/test/flow/types/annotations/migrated_0046.tree.json b/lib/test/flow/types/annotations/migrated_0046.tree.json new file mode 100644 index 0000000..924954b --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0046.tree.json @@ -0,0 +1,47 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, + "range":[13,15], + "body":[] + }, + "superClass":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0047.js b/lib/test/flow/types/annotations/migrated_0047.js new file mode 100644 index 0000000..7e90e16 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0047.js @@ -0,0 +1 @@ +class Foo { bar():number { return 42; }} diff --git a/lib/test/flow/types/annotations/migrated_0047.tree.json b/lib/test/flow/types/annotations/migrated_0047.tree.json new file mode 100644 index 0000000..6ae3591 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0047.tree.json @@ -0,0 +1,121 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "range":[0,46], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "range":[0,46], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":46}}, + "range":[13,46], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":45}}, + "range":[15,45], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, + "range":[15,18], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":45}}, + "range":[18,45], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":45}}, + "range":[31,45], + "body":[ + { + "type":"ReturnStatement", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":43}}, + "range":[33,43], + "argument":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":40},"end":{"line":1,"column":42}}, + "range":[40,42], + "value":42, + "raw":"42" + } + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":30}}, + "range":[23,30], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":30}}, + "range":[24,30] + } + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, + "range":[18,21], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "range":[19,20], + "name":"U", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0048.js b/lib/test/flow/types/annotations/migrated_0048.js new file mode 100644 index 0000000..0bdea2b --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0048.js @@ -0,0 +1 @@ +class Foo { "bar"() { } } diff --git a/lib/test/flow/types/annotations/migrated_0048.tree.json b/lib/test/flow/types/annotations/migrated_0048.tree.json new file mode 100644 index 0000000..e716204 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0048.tree.json @@ -0,0 +1,83 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":28}}, + "range":[10,28], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":26}}, + "range":[12,26], + "key":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":17}}, + "range":[12,17], + "value":"bar", + "raw":"\"bar\"" + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":26}}, + "range":[17,26], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":26}}, + "range":[23,26], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0049.js b/lib/test/flow/types/annotations/migrated_0049.js new file mode 100644 index 0000000..e0a07ef --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0049.js @@ -0,0 +1 @@ +class Foo { prop1:string; prop2:number; } diff --git a/lib/test/flow/types/annotations/migrated_0049.tree.json b/lib/test/flow/types/annotations/migrated_0049.tree.json new file mode 100644 index 0000000..e95cc79 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0049.tree.json @@ -0,0 +1,87 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "range":[0,41], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "range":[0,41], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":41}}, + "range":[10,41], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":25}}, + "range":[12,25], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":17}}, + "range":[12,17], + "name":"prop1", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":24}}, + "range":[17,24], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":24}}, + "range":[18,24] + } + }, + "computed":false, + "static":false, + "variance":null + }, + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":39}}, + "range":[26,39], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":31}}, + "range":[26,31], + "name":"prop2", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":38}}, + "range":[31,38], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":38}}, + "range":[32,38] + } + }, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0050.js b/lib/test/flow/types/annotations/migrated_0050.js new file mode 100644 index 0000000..8f391a0 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0050.js @@ -0,0 +1 @@ +class Foo { static prop: number; } diff --git a/lib/test/flow/types/annotations/migrated_0050.tree.json b/lib/test/flow/types/annotations/migrated_0050.tree.json new file mode 100644 index 0000000..bce2405 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0050.tree.json @@ -0,0 +1,60 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "range":[0,34], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "range":[0,34], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":34}}, + "range":[10,34], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":32}}, + "range":[12,32], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":23}}, + "range":[19,23], + "name":"prop", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":31}}, + "range":[23,31], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":31}}, + "range":[25,31] + } + }, + "computed":false, + "static":true, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0051.js b/lib/test/flow/types/annotations/migrated_0051.js new file mode 100644 index 0000000..6d325ff --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0051.js @@ -0,0 +1 @@ +class Foo { "prop1":string; } diff --git a/lib/test/flow/types/annotations/migrated_0051.tree.json b/lib/test/flow/types/annotations/migrated_0051.tree.json new file mode 100644 index 0000000..0ad133d --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0051.tree.json @@ -0,0 +1,59 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":29}}, + "range":[10,29], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":27}}, + "range":[12,27], + "key":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":19}}, + "range":[12,19], + "value":"prop1", + "raw":"\"prop1\"" + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":26}}, + "range":[19,26], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":26}}, + "range":[20,26] + } + }, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0052.js b/lib/test/flow/types/annotations/migrated_0052.js new file mode 100644 index 0000000..be49893 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0052.js @@ -0,0 +1 @@ +class Foo { 123:string; } diff --git a/lib/test/flow/types/annotations/migrated_0052.tree.json b/lib/test/flow/types/annotations/migrated_0052.tree.json new file mode 100644 index 0000000..103d9e0 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0052.tree.json @@ -0,0 +1,59 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":25}}, + "range":[10,25], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":23}}, + "range":[12,23], + "key":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":15}}, + "range":[12,15], + "value":123, + "raw":"123" + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":22}}, + "range":[15,22], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":22}}, + "range":[16,22] + } + }, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0053.js b/lib/test/flow/types/annotations/migrated_0053.js new file mode 100644 index 0000000..b0a8ad2 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0053.js @@ -0,0 +1 @@ +class Foo { [prop1]: string; } diff --git a/lib/test/flow/types/annotations/migrated_0053.tree.json b/lib/test/flow/types/annotations/migrated_0053.tree.json new file mode 100644 index 0000000..8e3935e --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0053.tree.json @@ -0,0 +1,60 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":30}}, + "range":[10,30], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":28}}, + "range":[12,28], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":18}}, + "range":[13,18], + "name":"prop1", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, + "range":[19,27], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "range":[21,27] + } + }, + "computed":true, + "static":false, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0054.js b/lib/test/flow/types/annotations/migrated_0054.js new file mode 100644 index 0000000..6aac19e --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0054.js @@ -0,0 +1 @@ +class Foo { [1 + 1]: string; } diff --git a/lib/test/flow/types/annotations/migrated_0054.tree.json b/lib/test/flow/types/annotations/migrated_0054.tree.json new file mode 100644 index 0000000..79a22fe --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0054.tree.json @@ -0,0 +1,72 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":30}}, + "range":[10,30], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":28}}, + "range":[12,28], + "key":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":18}}, + "range":[13,18], + "operator":"+", + "left":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "value":1, + "raw":"1" + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "range":[17,18], + "value":1, + "raw":"1" + } + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, + "range":[19,27], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "range":[21,27] + } + }, + "computed":true, + "static":false, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0055.js b/lib/test/flow/types/annotations/migrated_0055.js new file mode 100644 index 0000000..67bbb9d --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0055.js @@ -0,0 +1 @@ +class Foo extends Bar {} diff --git a/lib/test/flow/types/annotations/migrated_0055.tree.json b/lib/test/flow/types/annotations/migrated_0055.tree.json new file mode 100644 index 0000000..60a238f --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0055.tree.json @@ -0,0 +1,74 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, + "range":[28,30], + "body":[] + }, + "superClass":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":24}}, + "range":[21,24], + "name":"Bar", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "superTypeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":27}}, + "range":[24,27], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, + "range":[25,26], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, + "range":[25,26], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + }, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0056.js b/lib/test/flow/types/annotations/migrated_0056.js new file mode 100644 index 0000000..2bd0a7c --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0056.js @@ -0,0 +1 @@ +a = class Foo extends Bar {} diff --git a/lib/test/flow/types/annotations/migrated_0056.tree.json b/lib/test/flow/types/annotations/migrated_0056.tree.json new file mode 100644 index 0000000..b9a1706 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0056.tree.json @@ -0,0 +1,94 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "range":[0,34], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "range":[0,34], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "range":[0,34], + "operator":"=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"ClassExpression", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":34}}, + "range":[4,34], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, + "range":[10,13], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":34}}, + "range":[32,34], + "body":[] + }, + "superClass":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":28}}, + "range":[25,28], + "name":"Bar", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, + "range":[13,16], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "superTypeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":31}}, + "range":[28,31], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, + "range":[29,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, + "range":[29,30], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + }, + "implements":[], + "decorators":[] + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0057.js b/lib/test/flow/types/annotations/migrated_0057.js new file mode 100644 index 0000000..b264c58 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0057.js @@ -0,0 +1 @@ +class Foo<+T1,-T2> {} diff --git a/lib/test/flow/types/annotations/migrated_0057.tree.json b/lib/test/flow/types/annotations/migrated_0057.tree.json new file mode 100644 index 0000000..47729d4 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0057.tree.json @@ -0,0 +1,66 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, + "range":[19,21], + "body":[] + }, + "superClass":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":18}}, + "range":[9,18], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, + "range":[10,13], + "name":"T1", + "bound":null, + "variance":{ + "type":"Variance", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "kind":"plus" + }, + "default":null + }, + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, + "range":[14,17], + "name":"T2", + "bound":null, + "variance":{ + "type":"Variance", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "kind":"minus" + }, + "default":null + } + ] + }, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0058.js b/lib/test/flow/types/annotations/migrated_0058.js new file mode 100644 index 0000000..1299bdb --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0058.js @@ -0,0 +1 @@ +var {x}: {x: string; } = { x: "hello" }; diff --git a/lib/test/flow/types/annotations/migrated_0058.tree.json b/lib/test/flow/types/annotations/migrated_0058.tree.json new file mode 100644 index 0000000..7083c60 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0058.tree.json @@ -0,0 +1,125 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "range":[0,40], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "range":[0,40], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":39}}, + "range":[4,39], + "id":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":22}}, + "range":[4,22], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ], + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":22}}, + "range":[7,22], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":22}}, + "range":[9,22], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":19}}, + "range":[10,19], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":19}}, + "range":[13,19] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + }, + "init":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":39}}, + "range":[25,39], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":37}}, + "range":[27,37], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, + "range":[27,28], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":37}}, + "range":[30,37], + "value":"hello", + "raw":"\"hello\"" + }, + "kind":"init", + "method":false, + "shorthand":false, + "computed":false + } + ] + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0059.js b/lib/test/flow/types/annotations/migrated_0059.js new file mode 100644 index 0000000..c9c021c --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0059.js @@ -0,0 +1 @@ +var [x]: Array = [ "hello" ]; diff --git a/lib/test/flow/types/annotations/migrated_0059.tree.json b/lib/test/flow/types/annotations/migrated_0059.tree.json new file mode 100644 index 0000000..8070606 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0059.tree.json @@ -0,0 +1,80 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "range":[0,37], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "range":[0,37], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":36}}, + "range":[4,36], + "id":{ + "type":"ArrayPattern", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":22}}, + "range":[4,22], + "elements":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"x", + "typeAnnotation":null, + "optional":false + } + ], + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":22}}, + "range":[7,22], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":22}}, + "range":[9,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "range":[9,14], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":22}}, + "range":[14,22], + "params":[ + { + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":21}}, + "range":[15,21] + } + ] + } + } + } + }, + "init":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":36}}, + "range":[25,36], + "elements":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":34}}, + "range":[27,34], + "value":"hello", + "raw":"\"hello\"" + } + ] + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0060.js b/lib/test/flow/types/annotations/migrated_0060.js new file mode 100644 index 0000000..8bd6c26 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0060.js @@ -0,0 +1 @@ +function foo({x}: { x: string; }) {} diff --git a/lib/test/flow/types/annotations/migrated_0060.tree.json b/lib/test/flow/types/annotations/migrated_0060.tree.json new file mode 100644 index 0000000..0efe840 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0060.tree.json @@ -0,0 +1,108 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":32}}, + "range":[13,32], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ], + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":32}}, + "range":[16,32], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":32}}, + "range":[18,32], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":29}}, + "range":[20,29], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":29}}, + "range":[23,29] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":36}}, + "range":[34,36], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0061.js b/lib/test/flow/types/annotations/migrated_0061.js new file mode 100644 index 0000000..740ff69 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0061.js @@ -0,0 +1 @@ +function foo([x]: Array) {} diff --git a/lib/test/flow/types/annotations/migrated_0061.tree.json b/lib/test/flow/types/annotations/migrated_0061.tree.json new file mode 100644 index 0000000..d6cb8fa --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0061.tree.json @@ -0,0 +1,80 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"ArrayPattern", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":31}}, + "range":[13,31], + "elements":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"x", + "typeAnnotation":null, + "optional":false + } + ], + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":31}}, + "range":[16,31], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":31}}, + "range":[18,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, + "range":[18,23], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":31}}, + "range":[23,31], + "params":[ + { + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":30}}, + "range":[24,30] + } + ] + } + } + } + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":35}}, + "range":[33,35], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0062.js b/lib/test/flow/types/annotations/migrated_0062.js new file mode 100644 index 0000000..d3cfd12 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0062.js @@ -0,0 +1 @@ +var x : number | string = 4; diff --git a/lib/test/flow/types/annotations/migrated_0062.tree.json b/lib/test/flow/types/annotations/migrated_0062.tree.json new file mode 100644 index 0000000..b49b278 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0062.tree.json @@ -0,0 +1,57 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":27}}, + "range":[4,27], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":23}}, + "range":[4,23], + "name":"x", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":23}}, + "range":[6,23], + "typeAnnotation":{ + "type":"UnionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":23}}, + "range":[8,23], + "types":[ + { + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, + "range":[8,14] + }, + { + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":23}}, + "range":[17,23] + } + ] + } + }, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, + "range":[26,27], + "value":4, + "raw":"4" + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0063.js b/lib/test/flow/types/annotations/migrated_0063.js new file mode 100644 index 0000000..66e21a2 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0063.js @@ -0,0 +1 @@ +interface Array { concat(...items: Array | T>): Array; } diff --git a/lib/test/flow/types/annotations/migrated_0063.tree.json b/lib/test/flow/types/annotations/migrated_0063.tree.json new file mode 100644 index 0000000..6f629b9 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0063.tree.json @@ -0,0 +1,198 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":71}}, + "range":[0,71], + "body":[ + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":71}}, + "range":[0,71], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, + "range":[10,15], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, + "range":[15,18], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "range":[16,17], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":71}}, + "range":[19,71], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":68}}, + "range":[21,68], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "range":[21,27], + "name":"concat", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":68}}, + "range":[21,68], + "params":[], + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":60},"end":{"line":1,"column":68}}, + "range":[60,68], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":60},"end":{"line":1,"column":65}}, + "range":[60,65], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":65},"end":{"line":1,"column":68}}, + "range":[65,68], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":66},"end":{"line":1,"column":67}}, + "range":[66,67], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":66},"end":{"line":1,"column":67}}, + "range":[66,67], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + }, + "rest":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":57}}, + "range":[31,57], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":36}}, + "range":[31,36], + "name":"items", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":57}}, + "range":[38,57], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":43}}, + "range":[38,43], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":43},"end":{"line":1,"column":57}}, + "range":[43,57], + "params":[ + { + "type":"UnionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":44},"end":{"line":1,"column":56}}, + "range":[44,56], + "types":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":44},"end":{"line":1,"column":52}}, + "range":[44,52], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":44},"end":{"line":1,"column":49}}, + "range":[44,49], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":49},"end":{"line":1,"column":52}}, + "range":[49,52], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":50},"end":{"line":1,"column":51}}, + "range":[50,51], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":50},"end":{"line":1,"column":51}}, + "range":[50,51], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + }, + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":55},"end":{"line":1,"column":56}}, + "range":[55,56], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":55},"end":{"line":1,"column":56}}, + "range":[55,56], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + ] + } + }, + "optional":false + }, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0064.js b/lib/test/flow/types/annotations/migrated_0064.js new file mode 100644 index 0000000..198d50a --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0064.js @@ -0,0 +1 @@ +var x : () => number | () => string = fn; diff --git a/lib/test/flow/types/annotations/migrated_0064.tree.json b/lib/test/flow/types/annotations/migrated_0064.tree.json new file mode 100644 index 0000000..75e650d --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0064.tree.json @@ -0,0 +1,74 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "range":[0,41], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "range":[0,41], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":40}}, + "range":[4,40], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":35}}, + "range":[4,35], + "name":"x", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":35}}, + "range":[6,35], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":35}}, + "range":[8,35], + "params":[], + "returnType":{ + "type":"UnionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":35}}, + "range":[14,35], + "types":[ + { + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":20}}, + "range":[14,20] + }, + { + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":35}}, + "range":[23,35], + "params":[], + "returnType":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":35}}, + "range":[29,35] + }, + "rest":null, + "typeParameters":null + } + ] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "init":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":40}}, + "range":[38,40], + "name":"fn", + "typeAnnotation":null, + "optional":false + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0065.js b/lib/test/flow/types/annotations/migrated_0065.js new file mode 100644 index 0000000..79567b8 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0065.js @@ -0,0 +1 @@ +var x: typeof Y = Y; diff --git a/lib/test/flow/types/annotations/migrated_0065.tree.json b/lib/test/flow/types/annotations/migrated_0065.tree.json new file mode 100644 index 0000000..e5df44b --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0065.tree.json @@ -0,0 +1,60 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":19}}, + "range":[4,19], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":15}}, + "range":[4,15], + "name":"x", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":15}}, + "range":[5,15], + "typeAnnotation":{ + "type":"TypeofTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":15}}, + "range":[7,15], + "argument":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"Y", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + }, + "optional":false + }, + "init":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "name":"Y", + "typeAnnotation":null, + "optional":false + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0066.js b/lib/test/flow/types/annotations/migrated_0066.js new file mode 100644 index 0000000..6716c50 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0066.js @@ -0,0 +1 @@ +var x: typeof Y | number = Y; diff --git a/lib/test/flow/types/annotations/migrated_0066.tree.json b/lib/test/flow/types/annotations/migrated_0066.tree.json new file mode 100644 index 0000000..d7c451e --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0066.tree.json @@ -0,0 +1,72 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":28}}, + "range":[4,28], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":24}}, + "range":[4,24], + "name":"x", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":24}}, + "range":[5,24], + "typeAnnotation":{ + "type":"UnionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":24}}, + "range":[7,24], + "types":[ + { + "type":"TypeofTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":15}}, + "range":[7,15], + "argument":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"Y", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + { + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":24}}, + "range":[18,24] + } + ] + } + }, + "optional":false + }, + "init":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, + "range":[27,28], + "name":"Y", + "typeAnnotation":null, + "optional":false + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0067.js b/lib/test/flow/types/annotations/migrated_0067.js new file mode 100644 index 0000000..7abecd3 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0067.js @@ -0,0 +1 @@ +var x : number & string = 4; diff --git a/lib/test/flow/types/annotations/migrated_0067.tree.json b/lib/test/flow/types/annotations/migrated_0067.tree.json new file mode 100644 index 0000000..752ab2f --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0067.tree.json @@ -0,0 +1,57 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":27}}, + "range":[4,27], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":23}}, + "range":[4,23], + "name":"x", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":23}}, + "range":[6,23], + "typeAnnotation":{ + "type":"IntersectionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":23}}, + "range":[8,23], + "types":[ + { + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, + "range":[8,14] + }, + { + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":23}}, + "range":[17,23] + } + ] + } + }, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, + "range":[26,27], + "value":4, + "raw":"4" + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0068.js b/lib/test/flow/types/annotations/migrated_0068.js new file mode 100644 index 0000000..c27fe03 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0068.js @@ -0,0 +1 @@ +interface Array { concat(...items: Array & T>): Array; } diff --git a/lib/test/flow/types/annotations/migrated_0068.tree.json b/lib/test/flow/types/annotations/migrated_0068.tree.json new file mode 100644 index 0000000..5a27cdb --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0068.tree.json @@ -0,0 +1,198 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":71}}, + "range":[0,71], + "body":[ + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":71}}, + "range":[0,71], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, + "range":[10,15], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, + "range":[15,18], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "range":[16,17], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":71}}, + "range":[19,71], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":68}}, + "range":[21,68], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "range":[21,27], + "name":"concat", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":68}}, + "range":[21,68], + "params":[], + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":60},"end":{"line":1,"column":68}}, + "range":[60,68], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":60},"end":{"line":1,"column":65}}, + "range":[60,65], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":65},"end":{"line":1,"column":68}}, + "range":[65,68], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":66},"end":{"line":1,"column":67}}, + "range":[66,67], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":66},"end":{"line":1,"column":67}}, + "range":[66,67], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + }, + "rest":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":57}}, + "range":[31,57], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":36}}, + "range":[31,36], + "name":"items", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":57}}, + "range":[38,57], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":43}}, + "range":[38,43], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":43},"end":{"line":1,"column":57}}, + "range":[43,57], + "params":[ + { + "type":"IntersectionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":44},"end":{"line":1,"column":56}}, + "range":[44,56], + "types":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":44},"end":{"line":1,"column":52}}, + "range":[44,52], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":44},"end":{"line":1,"column":49}}, + "range":[44,49], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":49},"end":{"line":1,"column":52}}, + "range":[49,52], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":50},"end":{"line":1,"column":51}}, + "range":[50,51], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":50},"end":{"line":1,"column":51}}, + "range":[50,51], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + }, + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":55},"end":{"line":1,"column":56}}, + "range":[55,56], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":55},"end":{"line":1,"column":56}}, + "range":[55,56], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + ] + } + }, + "optional":false + }, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0069.js b/lib/test/flow/types/annotations/migrated_0069.js new file mode 100644 index 0000000..d406b6a --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0069.js @@ -0,0 +1 @@ +var x : () => number & () => string = fn; diff --git a/lib/test/flow/types/annotations/migrated_0069.tree.json b/lib/test/flow/types/annotations/migrated_0069.tree.json new file mode 100644 index 0000000..86a0c0a --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0069.tree.json @@ -0,0 +1,74 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "range":[0,41], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "range":[0,41], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":40}}, + "range":[4,40], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":35}}, + "range":[4,35], + "name":"x", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":35}}, + "range":[6,35], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":35}}, + "range":[8,35], + "params":[], + "returnType":{ + "type":"IntersectionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":35}}, + "range":[14,35], + "types":[ + { + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":20}}, + "range":[14,20] + }, + { + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":35}}, + "range":[23,35], + "params":[], + "returnType":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":35}}, + "range":[29,35] + }, + "rest":null, + "typeParameters":null + } + ] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "init":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":40}}, + "range":[38,40], + "name":"fn", + "typeAnnotation":null, + "optional":false + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0070.js b/lib/test/flow/types/annotations/migrated_0070.js new file mode 100644 index 0000000..b341505 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0070.js @@ -0,0 +1 @@ +var x: typeof Y & number = Y; diff --git a/lib/test/flow/types/annotations/migrated_0070.tree.json b/lib/test/flow/types/annotations/migrated_0070.tree.json new file mode 100644 index 0000000..c116b53 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0070.tree.json @@ -0,0 +1,72 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":28}}, + "range":[4,28], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":24}}, + "range":[4,24], + "name":"x", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":24}}, + "range":[5,24], + "typeAnnotation":{ + "type":"IntersectionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":24}}, + "range":[7,24], + "types":[ + { + "type":"TypeofTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":15}}, + "range":[7,15], + "argument":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"Y", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + { + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":24}}, + "range":[18,24] + } + ] + } + }, + "optional":false + }, + "init":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, + "range":[27,28], + "name":"Y", + "typeAnnotation":null, + "optional":false + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0071.js b/lib/test/flow/types/annotations/migrated_0071.js new file mode 100644 index 0000000..56c3194 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0071.js @@ -0,0 +1 @@ +var identity: (x: T) => T diff --git a/lib/test/flow/types/annotations/migrated_0071.tree.json b/lib/test/flow/types/annotations/migrated_0071.tree.json new file mode 100644 index 0000000..1a97ae1 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0071.tree.json @@ -0,0 +1,100 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":28}}, + "range":[4,28], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":28}}, + "range":[4,28], + "name":"identity", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":28}}, + "range":[12,28], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":28}}, + "range":[14,28], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":22}}, + "range":[18,22], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "optional":false + } + ], + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, + "range":[27,28], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, + "range":[27,28], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "rest":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, + "range":[14,17], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0072.js b/lib/test/flow/types/annotations/migrated_0072.js new file mode 100644 index 0000000..aed18ab --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0072.js @@ -0,0 +1 @@ +var a: (number: any, string: any, any: any, type: any) => any; diff --git a/lib/test/flow/types/annotations/migrated_0072.tree.json b/lib/test/flow/types/annotations/migrated_0072.tree.json new file mode 100644 index 0000000..339b792 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0072.tree.json @@ -0,0 +1,124 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":62}}, + "range":[0,62], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":62}}, + "range":[0,62], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":61}}, + "range":[4,61], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":61}}, + "range":[4,61], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":61}}, + "range":[5,61], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":61}}, + "range":[7,61], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":19}}, + "range":[8,19], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, + "range":[8,14], + "name":"number", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":19}}, + "range":[16,19] + }, + "optional":false + }, + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":32}}, + "range":[21,32], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "range":[21,27], + "name":"string", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":32}}, + "range":[29,32] + }, + "optional":false + }, + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":42}}, + "range":[34,42], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":37}}, + "range":[34,37], + "name":"any", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":42}}, + "range":[39,42] + }, + "optional":false + }, + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":44},"end":{"line":1,"column":53}}, + "range":[44,53], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":44},"end":{"line":1,"column":48}}, + "range":[44,48], + "name":"type", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":50},"end":{"line":1,"column":53}}, + "range":[50,53] + }, + "optional":false + } + ], + "returnType":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":58},"end":{"line":1,"column":61}}, + "range":[58,61] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0073.js b/lib/test/flow/types/annotations/migrated_0073.js new file mode 100644 index 0000000..381b9fb --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0073.js @@ -0,0 +1 @@ +var a: {[type: any]: any} diff --git a/lib/test/flow/types/annotations/migrated_0073.tree.json b/lib/test/flow/types/annotations/migrated_0073.tree.json new file mode 100644 index 0000000..fd0f692 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0073.tree.json @@ -0,0 +1,71 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":25}}, + "range":[4,25], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":25}}, + "range":[4,25], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":25}}, + "range":[5,25], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":25}}, + "range":[7,25], + "exact":false, + "inexact":false, + "properties":[], + "indexers":[ + { + "type":"ObjectTypeIndexer", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":24}}, + "range":[8,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, + "range":[9,13], + "name":"type", + "typeAnnotation":null, + "optional":false + }, + "key":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, + "range":[15,18] + }, + "value":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":24}}, + "range":[21,24] + }, + "static":false, + "variance":null + } + ], + "callProperties":[], + "internalSlots":[] + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0074.js b/lib/test/flow/types/annotations/migrated_0074.js new file mode 100644 index 0000000..18c820b --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0074.js @@ -0,0 +1 @@ +type foo = bar; diff --git a/lib/test/flow/types/annotations/migrated_0074.tree.json b/lib/test/flow/types/annotations/migrated_0074.tree.json new file mode 100644 index 0000000..4b0986c --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0074.tree.json @@ -0,0 +1,60 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, + "range":[5,8], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, + "range":[8,14], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "name":"A", + "bound":null, + "variance":null, + "default":null + }, + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"B", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "right":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0075.js b/lib/test/flow/types/annotations/migrated_0075.js new file mode 100644 index 0000000..2764f63 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0075.js @@ -0,0 +1 @@ +class Foo extends Bar {} diff --git a/lib/test/flow/types/annotations/migrated_0075.tree.json b/lib/test/flow/types/annotations/migrated_0075.tree.json new file mode 100644 index 0000000..0257826 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0075.tree.json @@ -0,0 +1,97 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":36}}, + "range":[34,36], + "body":[] + }, + "superClass":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":27}}, + "range":[24,27], + "name":"Bar", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "range":[9,15], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"A", + "bound":null, + "variance":null, + "default":null + }, + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "name":"B", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "superTypeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":33}}, + "range":[27,33], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":29}}, + "range":[28,29], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":29}}, + "range":[28,29], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":31}}, + "range":[30,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":31}}, + "range":[30,31], + "name":"D", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + }, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0076.js b/lib/test/flow/types/annotations/migrated_0076.js new file mode 100644 index 0000000..b8580c4 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0076.js @@ -0,0 +1 @@ +interface Foo {} diff --git a/lib/test/flow/types/annotations/migrated_0076.tree.json b/lib/test/flow/types/annotations/migrated_0076.tree.json new file mode 100644 index 0000000..ebc361c --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0076.tree.json @@ -0,0 +1,57 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "body":[ + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, + "range":[10,13], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":19}}, + "range":[13,19], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "bound":null, + "variance":null, + "default":null + }, + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "range":[16,17], + "name":"B", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "range":[20,22], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0077.js b/lib/test/flow/types/annotations/migrated_0077.js new file mode 100644 index 0000000..a7f3579 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0077.js @@ -0,0 +1 @@ +function f() {} diff --git a/lib/test/flow/types/annotations/migrated_0077.tree.json b/lib/test/flow/types/annotations/migrated_0077.tree.json new file mode 100644 index 0000000..7958cda --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0077.tree.json @@ -0,0 +1,58 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, + "range":[19,21], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, + "range":[10,16], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"A", + "bound":null, + "variance":null, + "default":null + }, + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "name":"B", + "bound":null, + "variance":null, + "default":null + } + ] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0078.js b/lib/test/flow/types/annotations/migrated_0078.js new file mode 100644 index 0000000..a866369 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0078.js @@ -0,0 +1 @@ +type Foo = Array<*> diff --git a/lib/test/flow/types/annotations/migrated_0078.tree.json b/lib/test/flow/types/annotations/migrated_0078.tree.json new file mode 100644 index 0000000..6c73d53 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0078.tree.json @@ -0,0 +1,47 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "range":[0,19], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "range":[0,19], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, + "range":[5,8], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":19}}, + "range":[11,19], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":16}}, + "range":[11,16], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":19}}, + "range":[16,19], + "params":[ + { + "type":"ExistsTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "range":[17,18] + } + ] + } + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/migrated_0079.js b/lib/test/flow/types/annotations/migrated_0079.js new file mode 100644 index 0000000..41e7fea --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0079.js @@ -0,0 +1 @@ +type T = { a: | number | string } diff --git a/lib/test/flow/types/annotations/migrated_0079.tree.json b/lib/test/flow/types/annotations/migrated_0079.tree.json new file mode 100644 index 0000000..58bc556 --- /dev/null +++ b/lib/test/flow/types/annotations/migrated_0079.tree.json @@ -0,0 +1,70 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":33}}, + "range":[9,33], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":31}}, + "range":[11,31], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"UnionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":31}}, + "range":[16,31], + "types":[ + { + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":22}}, + "range":[16,22] + }, + { + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":31}}, + "range":[25,31] + } + ] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/static_is_reserved_param.js b/lib/test/flow/types/annotations/static_is_reserved_param.js new file mode 100644 index 0000000..df0acae --- /dev/null +++ b/lib/test/flow/types/annotations/static_is_reserved_param.js @@ -0,0 +1 @@ +type T = (static: number) => void diff --git a/lib/test/flow/types/annotations/static_is_reserved_param.tree.json b/lib/test/flow/types/annotations/static_is_reserved_param.tree.json new file mode 100644 index 0000000..eeb0ad1 --- /dev/null +++ b/lib/test/flow/types/annotations/static_is_reserved_param.tree.json @@ -0,0 +1,61 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, + "message":"Use of future reserved word in strict mode" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":33}}, + "range":[9,33], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":24}}, + "range":[10,24], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, + "range":[10,16], + "name":"static", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":24}}, + "range":[18,24] + }, + "optional":false + } + ], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":33}}, + "range":[29,33] + }, + "rest":null, + "typeParameters":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/static_is_reserved_type.js b/lib/test/flow/types/annotations/static_is_reserved_type.js new file mode 100644 index 0000000..6807fb6 --- /dev/null +++ b/lib/test/flow/types/annotations/static_is_reserved_type.js @@ -0,0 +1 @@ +type T = static diff --git a/lib/test/flow/types/annotations/static_is_reserved_type.tree.json b/lib/test/flow/types/annotations/static_is_reserved_type.tree.json new file mode 100644 index 0000000..690b02f --- /dev/null +++ b/lib/test/flow/types/annotations/static_is_reserved_type.tree.json @@ -0,0 +1,42 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "message":"Unexpected reserved type" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "range":[9,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "range":[9,15], + "name":"static", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/symbol.js b/lib/test/flow/types/annotations/symbol.js new file mode 100644 index 0000000..d91b81b --- /dev/null +++ b/lib/test/flow/types/annotations/symbol.js @@ -0,0 +1 @@ +declare var x: symbol; diff --git a/lib/test/flow/types/annotations/symbol.tree.json b/lib/test/flow/types/annotations/symbol.tree.json new file mode 100644 index 0000000..3d19529 --- /dev/null +++ b/lib/test/flow/types/annotations/symbol.tree.json @@ -0,0 +1,30 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "body":[ + { + "type":"DeclareVariable", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":21}}, + "range":[12,21], + "name":"x", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":21}}, + "range":[13,21], + "typeAnnotation":{ + "type":"SymbolTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":21}}, + "range":[15,21] + } + }, + "optional":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/underscore_is_allowed_trailing_commas.js b/lib/test/flow/types/annotations/underscore_is_allowed_trailing_commas.js new file mode 100644 index 0000000..0da470d --- /dev/null +++ b/lib/test/flow/types/annotations/underscore_is_allowed_trailing_commas.js @@ -0,0 +1,7 @@ +test< + _, + _, + number, + _, + _, +>(); diff --git a/lib/test/flow/types/annotations/underscore_is_allowed_trailing_commas.tree.json b/lib/test/flow/types/annotations/underscore_is_allowed_trailing_commas.tree.json new file mode 100644 index 0000000..35433da --- /dev/null +++ b/lib/test/flow/types/annotations/underscore_is_allowed_trailing_commas.tree.json @@ -0,0 +1,96 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":7,"column":4}}, + "range":[0,40], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":7,"column":4}}, + "range":[0,40], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":7,"column":3}}, + "range":[0,39], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "name":"test", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":7,"column":1}}, + "range":[4,37], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[8,9], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[8,9], + "name":"_", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "range":[13,14], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":3}}, + "range":[13,14], + "name":"_", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + { + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":8}}, + "range":[18,24] + }, + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":2},"end":{"line":5,"column":3}}, + "range":[28,29], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":2},"end":{"line":5,"column":3}}, + "range":[28,29], + "name":"_", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":3}}, + "range":[33,34], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":3}}, + "range":[33,34], + "name":"_", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + }, + "arguments":[] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/underscore_is_implicit_anywhere_in_list.js b/lib/test/flow/types/annotations/underscore_is_implicit_anywhere_in_list.js new file mode 100644 index 0000000..0515bd5 --- /dev/null +++ b/lib/test/flow/types/annotations/underscore_is_implicit_anywhere_in_list.js @@ -0,0 +1 @@ +test(); diff --git a/lib/test/flow/types/annotations/underscore_is_implicit_anywhere_in_list.tree.json b/lib/test/flow/types/annotations/underscore_is_implicit_anywhere_in_list.tree.json new file mode 100644 index 0000000..c263fe5 --- /dev/null +++ b/lib/test/flow/types/annotations/underscore_is_implicit_anywhere_in_list.tree.json @@ -0,0 +1,143 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "range":[0,50], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "range":[0,50], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "range":[0,49], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "name":"test", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":47}}, + "range":[4,47], + "params":[ + { + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, + "range":[5,11] + }, + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "name":"_", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + { + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":22}}, + "range":[16,22] + }, + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, + "range":[24,25], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, + "range":[24,25], + "name":"_", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, + "range":[27,28], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, + "range":[27,28], + "name":"_", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":31}}, + "range":[30,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":31}}, + "range":[30,31], + "name":"_", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":36}}, + "range":[33,36], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":36}}, + "range":[33,36], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":41}}, + "range":[38,41], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":41}}, + "range":[38,41], + "name":"Bar", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":43},"end":{"line":1,"column":46}}, + "range":[43,46], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":43},"end":{"line":1,"column":46}}, + "range":[43,46], + "name":"Baz", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + }, + "arguments":[] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/underscore_is_implicit_in_calls.js b/lib/test/flow/types/annotations/underscore_is_implicit_in_calls.js new file mode 100644 index 0000000..dbcf0ea --- /dev/null +++ b/lib/test/flow/types/annotations/underscore_is_implicit_in_calls.js @@ -0,0 +1 @@ +test<_>(); diff --git a/lib/test/flow/types/annotations/underscore_is_implicit_in_calls.tree.json b/lib/test/flow/types/annotations/underscore_is_implicit_in_calls.tree.json new file mode 100644 index 0000000..f4a4ad0 --- /dev/null +++ b/lib/test/flow/types/annotations/underscore_is_implicit_in_calls.tree.json @@ -0,0 +1,49 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "range":[0,9], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "range":[0,4], + "name":"test", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, + "range":[4,7], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"_", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + }, + "arguments":[] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/underscore_is_implicit_in_constructor_calls.js b/lib/test/flow/types/annotations/underscore_is_implicit_in_constructor_calls.js new file mode 100644 index 0000000..1aeca64 --- /dev/null +++ b/lib/test/flow/types/annotations/underscore_is_implicit_in_constructor_calls.js @@ -0,0 +1 @@ +new test<_>(); diff --git a/lib/test/flow/types/annotations/underscore_is_implicit_in_constructor_calls.tree.json b/lib/test/flow/types/annotations/underscore_is_implicit_in_constructor_calls.tree.json new file mode 100644 index 0000000..194caf5 --- /dev/null +++ b/lib/test/flow/types/annotations/underscore_is_implicit_in_constructor_calls.tree.json @@ -0,0 +1,49 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "expression":{ + "type":"NewExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":8}}, + "range":[4,8], + "name":"test", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":11}}, + "range":[8,11], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "name":"_", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + }, + "arguments":[] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/underscore_is_implicit_in_methods.js b/lib/test/flow/types/annotations/underscore_is_implicit_in_methods.js new file mode 100644 index 0000000..fac16db --- /dev/null +++ b/lib/test/flow/types/annotations/underscore_is_implicit_in_methods.js @@ -0,0 +1 @@ +instance.method()<_>(); diff --git a/lib/test/flow/types/annotations/underscore_is_implicit_in_methods.tree.json b/lib/test/flow/types/annotations/underscore_is_implicit_in_methods.tree.json new file mode 100644 index 0000000..67761bf --- /dev/null +++ b/lib/test/flow/types/annotations/underscore_is_implicit_in_methods.tree.json @@ -0,0 +1,70 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "callee":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "callee":{ + "type":"MemberExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "object":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "range":[0,8], + "name":"instance", + "typeAnnotation":null, + "optional":false + }, + "property":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "range":[9,15], + "name":"method", + "typeAnnotation":null, + "optional":false + }, + "computed":false + }, + "typeArguments":null, + "arguments":[] + }, + "typeArguments":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "name":"_", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + }, + "arguments":[] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/underscore_is_reserved_elsewhere.js b/lib/test/flow/types/annotations/underscore_is_reserved_elsewhere.js new file mode 100644 index 0000000..076632f --- /dev/null +++ b/lib/test/flow/types/annotations/underscore_is_reserved_elsewhere.js @@ -0,0 +1,7 @@ +var x: Generic<_> = 3; +(x: Generic<_>); +var y: _ = 3; +(y: _); + +type _ = number; +opaque type _ = number; diff --git a/lib/test/flow/types/annotations/underscore_is_reserved_elsewhere.tree.json b/lib/test/flow/types/annotations/underscore_is_reserved_elsewhere.tree.json new file mode 100644 index 0000000..942ac81 --- /dev/null +++ b/lib/test/flow/types/annotations/underscore_is_reserved_elsewhere.tree.json @@ -0,0 +1,281 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "message":"Unexpected reserved type" + }, + { + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":13}}, + "message":"Unexpected reserved type" + }, + { + "loc":{"source":null,"start":{"line":3,"column":7},"end":{"line":3,"column":8}}, + "message":"Unexpected reserved type" + }, + { + "loc":{"source":null,"start":{"line":4,"column":4},"end":{"line":4,"column":5}}, + "message":"Unexpected reserved type" + }, + { + "loc":{"source":null,"start":{"line":6,"column":5},"end":{"line":6,"column":6}}, + "message":"Unexpected reserved type" + }, + { + "loc":{"source":null,"start":{"line":7,"column":12},"end":{"line":7,"column":13}}, + "message":"Unexpected reserved type" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":7,"column":23}}, + "range":[0,103], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":21}}, + "range":[4,21], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, + "range":[4,17], + "name":"x", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":17}}, + "range":[5,17], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":17}}, + "range":[7,17], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":14}}, + "range":[7,14], + "name":"Generic", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, + "range":[14,17], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"_", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + } + }, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "value":3, + "raw":"3" + } + } + ], + "kind":"var" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":16}}, + "range":[23,39], + "expression":{ + "type":"TypeCastExpression", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":15}}, + "range":[23,38], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":1},"end":{"line":2,"column":2}}, + "range":[24,25], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, + "range":[25,37], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":14}}, + "range":[27,37], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":11}}, + "range":[27,34], + "name":"Generic", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":14}}, + "range":[34,37], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":13}}, + "range":[35,36], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":13}}, + "range":[35,36], + "name":"_", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + } + } + }, + "directive":null + }, + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":13}}, + "range":[40,53], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":12}}, + "range":[44,52], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":8}}, + "range":[44,48], + "name":"y", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":5},"end":{"line":3,"column":8}}, + "range":[45,48], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":7},"end":{"line":3,"column":8}}, + "range":[47,48], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":7},"end":{"line":3,"column":8}}, + "range":[47,48], + "name":"_", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":11},"end":{"line":3,"column":12}}, + "range":[51,52], + "value":3, + "raw":"3" + } + } + ], + "kind":"var" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":4,"column":0},"end":{"line":4,"column":7}}, + "range":[54,61], + "expression":{ + "type":"TypeCastExpression", + "loc":{"source":null,"start":{"line":4,"column":0},"end":{"line":4,"column":6}}, + "range":[54,60], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":1},"end":{"line":4,"column":2}}, + "range":[55,56], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":2},"end":{"line":4,"column":5}}, + "range":[56,59], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":4},"end":{"line":4,"column":5}}, + "range":[58,59], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":4},"end":{"line":4,"column":5}}, + "range":[58,59], + "name":"_", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + }, + "directive":null + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":6,"column":0},"end":{"line":6,"column":16}}, + "range":[63,79], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":5},"end":{"line":6,"column":6}}, + "range":[68,69], + "name":"_", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":6,"column":9},"end":{"line":6,"column":15}}, + "range":[72,78] + } + }, + { + "type":"OpaqueType", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":23}}, + "range":[80,103], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":7,"column":12},"end":{"line":7,"column":13}}, + "range":[92,93], + "name":"_", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "impltype":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":7,"column":16},"end":{"line":7,"column":22}}, + "range":[96,102] + }, + "supertype":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/unfinished_colon_method.js b/lib/test/flow/types/annotations/unfinished_colon_method.js new file mode 100644 index 0000000..50e80f7 --- /dev/null +++ b/lib/test/flow/types/annotations/unfinished_colon_method.js @@ -0,0 +1 @@ +a = {foo(): { return 42; }} diff --git a/lib/test/flow/types/annotations/unfinished_colon_method.tree.json b/lib/test/flow/types/annotations/unfinished_colon_method.tree.json new file mode 100644 index 0000000..1411a12 --- /dev/null +++ b/lib/test/flow/types/annotations/unfinished_colon_method.tree.json @@ -0,0 +1,129 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, + "message":"Unexpected number, expected the token `:`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, + "message":"Unexpected token `;`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, + "message":"Unexpected token `}`, expected the token `{`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the token `}`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,28], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,28], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,28], + "operator":"=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":2,"column":0}}, + "range":[4,28], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":2,"column":0}}, + "range":[5,28], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, + "range":[5,8], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":2,"column":0}}, + "range":[8,28], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":2,"column":0}}, + "range":[26,28], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":26}}, + "range":[10,26], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":26}}, + "range":[12,26], + "inexact":false, + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":23}}, + "range":[14,23], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":20}}, + "range":[14,20], + "name":"return", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, + "range":[23,24] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + "typeParameters":null + }, + "kind":"init", + "method":true, + "shorthand":false, + "computed":false + } + ] + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/unfinished_colon_param.js b/lib/test/flow/types/annotations/unfinished_colon_param.js new file mode 100644 index 0000000..ecb4601 --- /dev/null +++ b/lib/test/flow/types/annotations/unfinished_colon_param.js @@ -0,0 +1 @@ +function foo(callback:) {} diff --git a/lib/test/flow/types/annotations/unfinished_colon_param.tree.json b/lib/test/flow/types/annotations/unfinished_colon_param.tree.json new file mode 100644 index 0000000..398c563 --- /dev/null +++ b/lib/test/flow/types/annotations/unfinished_colon_param.tree.json @@ -0,0 +1,58 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, + "message":"Unexpected token `)`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":22}}, + "range":[13,22], + "name":"callback", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, + "range":[22,23] + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, + "range":[24,26], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/unfinished_colon_return.js b/lib/test/flow/types/annotations/unfinished_colon_return.js new file mode 100644 index 0000000..2626d4f --- /dev/null +++ b/lib/test/flow/types/annotations/unfinished_colon_return.js @@ -0,0 +1 @@ +function foo(): { foo() } diff --git a/lib/test/flow/types/annotations/unfinished_colon_return.tree.json b/lib/test/flow/types/annotations/unfinished_colon_return.tree.json new file mode 100644 index 0000000..6ba264d --- /dev/null +++ b/lib/test/flow/types/annotations/unfinished_colon_return.tree.json @@ -0,0 +1,100 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, + "message":"Unexpected token `}`, expected the token `:`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the token `}`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the token `{`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,26], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,26], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "range":[26,26], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":2,"column":0}}, + "range":[14,26], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":2,"column":0}}, + "range":[16,26], + "inexact":false, + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":25}}, + "range":[18,25], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, + "range":[18,21], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":25}}, + "range":[18,25], + "params":[], + "returnType":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "range":[26,26] + }, + "rest":null, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/unfinished_function_body.js b/lib/test/flow/types/annotations/unfinished_function_body.js new file mode 100644 index 0000000..84d0a30 --- /dev/null +++ b/lib/test/flow/types/annotations/unfinished_function_body.js @@ -0,0 +1 @@ +function foo(): {} diff --git a/lib/test/flow/types/annotations/unfinished_function_body.tree.json b/lib/test/flow/types/annotations/unfinished_function_body.tree.json new file mode 100644 index 0000000..5d690eb --- /dev/null +++ b/lib/test/flow/types/annotations/unfinished_function_body.tree.json @@ -0,0 +1,59 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the token `{`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the token `}`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,19], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,19], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "range":[19,19], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":18}}, + "range":[14,18], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, + "range":[16,18], + "inexact":false, + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations/void_is_reserved_param.js b/lib/test/flow/types/annotations/void_is_reserved_param.js new file mode 100644 index 0000000..69acb55 --- /dev/null +++ b/lib/test/flow/types/annotations/void_is_reserved_param.js @@ -0,0 +1 @@ +type X = (void: string) => void diff --git a/lib/test/flow/types/annotations/void_is_reserved_param.tree.json b/lib/test/flow/types/annotations/void_is_reserved_param.tree.json new file mode 100644 index 0000000..b5cfe03 --- /dev/null +++ b/lib/test/flow/types/annotations/void_is_reserved_param.tree.json @@ -0,0 +1,61 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, + "message":"Unexpected token `void`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":31}}, + "range":[9,31], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":22}}, + "range":[10,22], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, + "range":[10,14], + "name":"void", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":22}}, + "range":[16,22] + }, + "optional":false + } + ], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":31}}, + "range":[27,31] + }, + "rest":null, + "typeParameters":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0000.js b/lib/test/flow/types/annotations_in_comments/migrated_0000.js new file mode 100644 index 0000000..22d7f35 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0000.js @@ -0,0 +1 @@ +function foo(numVal/*: number*/, x/* : number*/){} diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0000.tree.json b/lib/test/flow/types/annotations_in_comments/migrated_0000.tree.json new file mode 100644 index 0000000..4f1056d --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0000.tree.json @@ -0,0 +1,69 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "range":[0,50], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "range":[0,50], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":29}}, + "range":[13,29], + "name":"numVal", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":29}}, + "range":[19,29], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":29}}, + "range":[23,29] + } + }, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":45}}, + "range":[33,45], + "name":"x", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":45}}, + "range":[34,45], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":45}}, + "range":[39,45] + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":48},"end":{"line":1,"column":50}}, + "range":[48,50], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0001.js b/lib/test/flow/types/annotations_in_comments/migrated_0001.js new file mode 100644 index 0000000..515e4a1 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0001.js @@ -0,0 +1 @@ +function foo(a/* :function*/, b/* : switch*/){} diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0001.tree.json b/lib/test/flow/types/annotations_in_comments/migrated_0001.tree.json new file mode 100644 index 0000000..1279551 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0001.tree.json @@ -0,0 +1,87 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "range":[0,48], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "range":[0,48], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":26}}, + "range":[13,26], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":26}}, + "range":[14,26], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":26}}, + "range":[18,26], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":26}}, + "range":[18,26], + "name":"function", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":43}}, + "range":[30,43], + "name":"b", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":43}}, + "range":[31,43], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":43}}, + "range":[37,43], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":43}}, + "range":[37,43], + "name":"switch", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":46},"end":{"line":1,"column":48}}, + "range":[46,48], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0002.js b/lib/test/flow/types/annotations_in_comments/migrated_0002.js new file mode 100644 index 0000000..a558ac0 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0002.js @@ -0,0 +1 @@ +function foo(numVal/*::: number*/, strVal/*:: :string*/){} diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0002.tree.json b/lib/test/flow/types/annotations_in_comments/migrated_0002.tree.json new file mode 100644 index 0000000..5763ba5 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0002.tree.json @@ -0,0 +1,69 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "range":[0,58], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "range":[0,58], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":31}}, + "range":[13,31], + "name":"numVal", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":31}}, + "range":[23,31], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":31}}, + "range":[25,31] + } + }, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":53}}, + "range":[35,53], + "name":"strVal", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":46},"end":{"line":1,"column":53}}, + "range":[46,53], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":47},"end":{"line":1,"column":53}}, + "range":[47,53] + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":56},"end":{"line":1,"column":58}}, + "range":[56,58], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0003.js b/lib/test/flow/types/annotations_in_comments/migrated_0003.js new file mode 100644 index 0000000..6ad770f --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0003.js @@ -0,0 +1 @@ +function foo(numVal/* :: : number*/, untypedVal){} diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0003.tree.json b/lib/test/flow/types/annotations_in_comments/migrated_0003.tree.json new file mode 100644 index 0000000..b3d07c3 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0003.tree.json @@ -0,0 +1,60 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, + "range":[0,51], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, + "range":[0,51], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":34}}, + "range":[13,34], + "name":"numVal", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":34}}, + "range":[26,34], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":34}}, + "range":[28,34] + } + }, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":48}}, + "range":[38,48], + "name":"untypedVal", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":49},"end":{"line":1,"column":51}}, + "range":[49,51], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0004.js b/lib/test/flow/types/annotations_in_comments/migrated_0004.js new file mode 100644 index 0000000..fcf0bb4 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0004.js @@ -0,0 +1 @@ +function foo(untypedVal, numVal/*flow-include: number*/){} diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0004.tree.json b/lib/test/flow/types/annotations_in_comments/migrated_0004.tree.json new file mode 100644 index 0000000..8b7f7a9 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0004.tree.json @@ -0,0 +1,60 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "range":[0,58], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "range":[0,58], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":23}}, + "range":[13,23], + "name":"untypedVal", + "typeAnnotation":null, + "optional":false + }, + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":53}}, + "range":[25,53], + "name":"numVal", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":45},"end":{"line":1,"column":53}}, + "range":[45,53], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":47},"end":{"line":1,"column":53}}, + "range":[47,53] + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":56},"end":{"line":1,"column":58}}, + "range":[56,58], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0005.js b/lib/test/flow/types/annotations_in_comments/migrated_0005.js new file mode 100644 index 0000000..437cacb --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0005.js @@ -0,0 +1 @@ +function foo(nullableNum/*flow-include : ?number*/){} diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0005.tree.json b/lib/test/flow/types/annotations_in_comments/migrated_0005.tree.json new file mode 100644 index 0000000..0da0d7c --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0005.tree.json @@ -0,0 +1,57 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "range":[0,53], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "range":[0,53], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":48}}, + "range":[13,48], + "name":"nullableNum", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":48}}, + "range":[39,48], + "typeAnnotation":{ + "type":"NullableTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":48}}, + "range":[41,48], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":42},"end":{"line":1,"column":48}}, + "range":[42,48] + } + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":51},"end":{"line":1,"column":53}}, + "range":[51,53], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0006.js b/lib/test/flow/types/annotations_in_comments/migrated_0006.js new file mode 100644 index 0000000..204b9d4 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0006.js @@ -0,0 +1 @@ +function foo(callback/* flow-include : () => void*/){} diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0006.tree.json b/lib/test/flow/types/annotations_in_comments/migrated_0006.tree.json new file mode 100644 index 0000000..304c8f8 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0006.tree.json @@ -0,0 +1,60 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, + "range":[0,54], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, + "range":[0,54], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":49}}, + "range":[13,49], + "name":"callback", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":49}}, + "range":[37,49], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":49}}, + "range":[39,49], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":45},"end":{"line":1,"column":49}}, + "range":[45,49] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":52},"end":{"line":1,"column":54}}, + "range":[52,54], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0007.js b/lib/test/flow/types/annotations_in_comments/migrated_0007.js new file mode 100644 index 0000000..6d9c9eb --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0007.js @@ -0,0 +1 @@ +function foo(callback/*: () => number*/){} diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0007.tree.json b/lib/test/flow/types/annotations_in_comments/migrated_0007.tree.json new file mode 100644 index 0000000..26deed6 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0007.tree.json @@ -0,0 +1,60 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "range":[0,42], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "range":[0,42], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":37}}, + "range":[13,37], + "name":"callback", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":37}}, + "range":[21,37], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":37}}, + "range":[25,37], + "params":[], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":37}}, + "range":[31,37] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":40},"end":{"line":1,"column":42}}, + "range":[40,42], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0008.js b/lib/test/flow/types/annotations_in_comments/migrated_0008.js new file mode 100644 index 0000000..95a0a97 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0008.js @@ -0,0 +1 @@ +function foo(callback/*: (_:bool) => number*/){} diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0008.tree.json b/lib/test/flow/types/annotations_in_comments/migrated_0008.tree.json new file mode 100644 index 0000000..ddedf06 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0008.tree.json @@ -0,0 +1,80 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "range":[0,48], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "range":[0,48], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":43}}, + "range":[13,43], + "name":"callback", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":43}}, + "range":[21,43], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":43}}, + "range":[25,43], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":32}}, + "range":[26,32], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, + "range":[26,27], + "name":"_", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":32}}, + "range":[28,32] + }, + "optional":false + } + ], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":43}}, + "range":[37,43] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":46},"end":{"line":1,"column":48}}, + "range":[46,48], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0009.js b/lib/test/flow/types/annotations_in_comments/migrated_0009.js new file mode 100644 index 0000000..29677bd --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0009.js @@ -0,0 +1 @@ +function foo(callback/*: (_1:bool, _2:string) => number*/){} diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0009.tree.json b/lib/test/flow/types/annotations_in_comments/migrated_0009.tree.json new file mode 100644 index 0000000..e140190 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0009.tree.json @@ -0,0 +1,99 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":60}}, + "range":[0,60], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":60}}, + "range":[0,60], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":55}}, + "range":[13,55], + "name":"callback", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":55}}, + "range":[21,55], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":55}}, + "range":[25,55], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":33}}, + "range":[26,33], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":28}}, + "range":[26,28], + "name":"_1", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":33}}, + "range":[29,33] + }, + "optional":false + }, + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":44}}, + "range":[35,44], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":37}}, + "range":[35,37], + "name":"_2", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":44}}, + "range":[38,44] + }, + "optional":false + } + ], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":49},"end":{"line":1,"column":55}}, + "range":[49,55] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":58},"end":{"line":1,"column":60}}, + "range":[58,60], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0010.js b/lib/test/flow/types/annotations_in_comments/migrated_0010.js new file mode 100644 index 0000000..93b5810 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0010.js @@ -0,0 +1 @@ +function foo()/*:number*/{} diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0010.tree.json b/lib/test/flow/types/annotations_in_comments/migrated_0010.tree.json new file mode 100644 index 0000000..a7f342d --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0010.tree.json @@ -0,0 +1,43 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, + "range":[25,27], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":23}}, + "range":[14,23], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":23}}, + "range":[17,23] + } + }, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0011.js b/lib/test/flow/types/annotations_in_comments/migrated_0011.js new file mode 100644 index 0000000..d976d12 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0011.js @@ -0,0 +1 @@ +function foo()/*:() => void*/{} diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0011.tree.json b/lib/test/flow/types/annotations_in_comments/migrated_0011.tree.json new file mode 100644 index 0000000..f484fda --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0011.tree.json @@ -0,0 +1,51 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, + "range":[29,31], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":27}}, + "range":[14,27], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":27}}, + "range":[17,27], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":27}}, + "range":[23,27] + }, + "rest":null, + "typeParameters":null + } + }, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0012.js b/lib/test/flow/types/annotations_in_comments/migrated_0012.js new file mode 100644 index 0000000..c5b12fc --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0012.js @@ -0,0 +1,5 @@ +/*:: +type duck = { + quack(): string; +}; +*/ diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0012.tree.json b/lib/test/flow/types/annotations_in_comments/migrated_0012.tree.json new file mode 100644 index 0000000..d159ac7 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0012.tree.json @@ -0,0 +1,66 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":4,"column":2}}, + "range":[5,40], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":4,"column":2}}, + "range":[5,40], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":9}}, + "range":[10,14], + "name":"duck", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":4,"column":1}}, + "range":[17,39], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":17}}, + "range":[21,36], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":7}}, + "range":[21,26], + "name":"quack", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":17}}, + "range":[21,36], + "params":[], + "returnType":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":11},"end":{"line":3,"column":17}}, + "range":[30,36] + }, + "rest":null, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0013.js b/lib/test/flow/types/annotations_in_comments/migrated_0013.js new file mode 100644 index 0000000..3660221 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0013.js @@ -0,0 +1,5 @@ +/*flow-include +type duck = { + quack(): string; +}; +*/ diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0013.tree.json b/lib/test/flow/types/annotations_in_comments/migrated_0013.tree.json new file mode 100644 index 0000000..eb6086b --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0013.tree.json @@ -0,0 +1,66 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":4,"column":2}}, + "range":[15,50], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":4,"column":2}}, + "range":[15,50], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":9}}, + "range":[20,24], + "name":"duck", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":4,"column":1}}, + "range":[27,49], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":17}}, + "range":[31,46], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":7}}, + "range":[31,36], + "name":"quack", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":17}}, + "range":[31,46], + "params":[], + "returnType":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":11},"end":{"line":3,"column":17}}, + "range":[40,46] + }, + "rest":null, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0014.js b/lib/test/flow/types/annotations_in_comments/migrated_0014.js new file mode 100644 index 0000000..7c7cf64 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0014.js @@ -0,0 +1 @@ +/*:: */ diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0014.tree.json b/lib/test/flow/types/annotations_in_comments/migrated_0014.tree.json new file mode 100644 index 0000000..f767c3b --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0014.tree.json @@ -0,0 +1,7 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "range":[8,8], + "body":[], + "comments":[] +} diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0015.js b/lib/test/flow/types/annotations_in_comments/migrated_0015.js new file mode 100644 index 0000000..18f95b3 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0015.js @@ -0,0 +1 @@ +/*flow-include */ diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0015.tree.json b/lib/test/flow/types/annotations_in_comments/migrated_0015.tree.json new file mode 100644 index 0000000..8c54931 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0015.tree.json @@ -0,0 +1,7 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "range":[18,18], + "body":[], + "comments":[] +} diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0016.js b/lib/test/flow/types/annotations_in_comments/migrated_0016.js new file mode 100644 index 0000000..a15d494 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0016.js @@ -0,0 +1 @@ +function foo/*:: */(x /*: T */)/*: T */ { return x; } diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0016.tree.json b/lib/test/flow/types/annotations_in_comments/migrated_0016.tree.json new file mode 100644 index 0000000..425c19d --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0016.tree.json @@ -0,0 +1,108 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, + "range":[0,57], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, + "range":[0,57], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":31}}, + "range":[24,31], + "name":"x", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":31}}, + "range":[26,31], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":31}}, + "range":[30,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":31}}, + "range":[30,31], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":44},"end":{"line":1,"column":57}}, + "range":[44,57], + "body":[ + { + "type":"ReturnStatement", + "loc":{"source":null,"start":{"line":1,"column":46},"end":{"line":1,"column":55}}, + "range":[46,55], + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":53},"end":{"line":1,"column":54}}, + "range":[53,54], + "name":"x", + "typeAnnotation":null, + "optional":false + } + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":40}}, + "range":[35,40], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":40}}, + "range":[39,40], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":40}}, + "range":[39,40], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0017.js b/lib/test/flow/types/annotations_in_comments/migrated_0017.js new file mode 100644 index 0000000..80726ac --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0017.js @@ -0,0 +1 @@ +/*::type F = /* inner escaped comment *-/ number;*/ diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0017.tree.json b/lib/test/flow/types/annotations_in_comments/migrated_0017.tree.json new file mode 100644 index 0000000..b1a7c35 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0017.tree.json @@ -0,0 +1,34 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":49}}, + "range":[4,49], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":49}}, + "range":[4,49], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "name":"F", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":42},"end":{"line":1,"column":48}}, + "range":[42,48] + } + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":41}}, + "range":[13,41], + "value":" inner escaped comment " + } + ] +} diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0018.js b/lib/test/flow/types/annotations_in_comments/migrated_0018.js new file mode 100644 index 0000000..152cbf4 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0018.js @@ -0,0 +1 @@ +/*flow-include type F = /* inner escaped comment *-/ number;*/ diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0018.tree.json b/lib/test/flow/types/annotations_in_comments/migrated_0018.tree.json new file mode 100644 index 0000000..72894c9 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0018.tree.json @@ -0,0 +1,34 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":60}}, + "range":[15,60], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":60}}, + "range":[15,60], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "name":"F", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":53},"end":{"line":1,"column":59}}, + "range":[53,59] + } + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":52}}, + "range":[24,52], + "value":" inner escaped comment " + } + ] +} diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0019.js b/lib/test/flow/types/annotations_in_comments/migrated_0019.js new file mode 100644 index 0000000..382b0fd --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0019.js @@ -0,0 +1 @@ +var a/*: /* inner escaped comment *-/ number*/; diff --git a/lib/test/flow/types/annotations_in_comments/migrated_0019.tree.json b/lib/test/flow/types/annotations_in_comments/migrated_0019.tree.json new file mode 100644 index 0000000..6f74f6f --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments/migrated_0019.tree.json @@ -0,0 +1,46 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "range":[0,47], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "range":[0,47], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":44}}, + "range":[4,44], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":44}}, + "range":[4,44], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":44}}, + "range":[5,44], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":44}}, + "range":[38,44] + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":37}}, + "range":[9,37], + "value":" inner escaped comment " + } + ] +} diff --git a/lib/test/flow/types/annotations_in_comments_invalid/migrated_0000.js b/lib/test/flow/types/annotations_in_comments_invalid/migrated_0000.js new file mode 100644 index 0000000..af6737c --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments_invalid/migrated_0000.js @@ -0,0 +1 @@ +/*: */ diff --git a/lib/test/flow/types/annotations_in_comments_invalid/migrated_0000.tree.json b/lib/test/flow/types/annotations_in_comments_invalid/migrated_0000.tree.json new file mode 100644 index 0000000..5afcb33 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments_invalid/migrated_0000.tree.json @@ -0,0 +1,23 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, + "message":"Unexpected token `:`, expected the start of a statement" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the start of a statement" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "range":[7,7], + "body":[ + { + "type":"EmptyStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "range":[7,7] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations_in_comments_invalid/migrated_0001.js b/lib/test/flow/types/annotations_in_comments_invalid/migrated_0001.js new file mode 100644 index 0000000..3ba723b --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments_invalid/migrated_0001.js @@ -0,0 +1 @@ +/*:: /*: */ diff --git a/lib/test/flow/types/annotations_in_comments_invalid/migrated_0001.tree.json b/lib/test/flow/types/annotations_in_comments_invalid/migrated_0001.tree.json new file mode 100644 index 0000000..714f08c --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments_invalid/migrated_0001.tree.json @@ -0,0 +1,27 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, + "message":"Unexpected token `/*:`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, + "message":"Unexpected token `:`, expected the start of a statement" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the start of a statement" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "range":[12,12], + "body":[ + { + "type":"EmptyStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "range":[12,12] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations_in_comments_invalid/migrated_0002.js b/lib/test/flow/types/annotations_in_comments_invalid/migrated_0002.js new file mode 100644 index 0000000..102c1da --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments_invalid/migrated_0002.js @@ -0,0 +1 @@ +/*:: /* : */ diff --git a/lib/test/flow/types/annotations_in_comments_invalid/migrated_0002.tree.json b/lib/test/flow/types/annotations_in_comments_invalid/migrated_0002.tree.json new file mode 100644 index 0000000..59e7dff --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments_invalid/migrated_0002.tree.json @@ -0,0 +1,27 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":9}}, + "message":"Unexpected token `/* :`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":9}}, + "message":"Unexpected token `:`, expected the start of a statement" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the start of a statement" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "range":[13,13], + "body":[ + { + "type":"EmptyStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "range":[13,13] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations_in_comments_invalid/migrated_0003.js b/lib/test/flow/types/annotations_in_comments_invalid/migrated_0003.js new file mode 100644 index 0000000..36854d7 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments_invalid/migrated_0003.js @@ -0,0 +1 @@ +/*:: /*:: */ diff --git a/lib/test/flow/types/annotations_in_comments_invalid/migrated_0003.tree.json b/lib/test/flow/types/annotations_in_comments_invalid/migrated_0003.tree.json new file mode 100644 index 0000000..b38b403 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments_invalid/migrated_0003.tree.json @@ -0,0 +1,13 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":9}}, + "message":"Unexpected token `/*::`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "range":[13,13], + "body":[], + "comments":[] +} diff --git a/lib/test/flow/types/annotations_in_comments_invalid/migrated_0004.js b/lib/test/flow/types/annotations_in_comments_invalid/migrated_0004.js new file mode 100644 index 0000000..e5ec97f --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments_invalid/migrated_0004.js @@ -0,0 +1 @@ +/*:: /*flow-include */ diff --git a/lib/test/flow/types/annotations_in_comments_invalid/migrated_0004.tree.json b/lib/test/flow/types/annotations_in_comments_invalid/migrated_0004.tree.json new file mode 100644 index 0000000..3c70ff3 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments_invalid/migrated_0004.tree.json @@ -0,0 +1,13 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":19}}, + "message":"Unexpected token `/*flow-include`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "range":[23,23], + "body":[], + "comments":[] +} diff --git a/lib/test/flow/types/annotations_in_comments_invalid/migrated_0005.js b/lib/test/flow/types/annotations_in_comments_invalid/migrated_0005.js new file mode 100644 index 0000000..355164c --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments_invalid/migrated_0005.js @@ -0,0 +1 @@ +*/ diff --git a/lib/test/flow/types/annotations_in_comments_invalid/migrated_0005.tree.json b/lib/test/flow/types/annotations_in_comments_invalid/migrated_0005.tree.json new file mode 100644 index 0000000..884dbf1 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments_invalid/migrated_0005.tree.json @@ -0,0 +1,45 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "message":"Unexpected token `*`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "message":"Invalid regular expression: missing /" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,3], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,3], + "expression":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,3], + "operator":"*", + "left":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "range":[0,1], + "value":null, + "raw":"null" + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":2,"column":0}}, + "range":[1,3], + "value":null, + "raw":"//", + "regex":{"pattern":"","flags":""} + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/annotations_in_comments_invalid/migrated_0006.js b/lib/test/flow/types/annotations_in_comments_invalid/migrated_0006.js new file mode 100644 index 0000000..b31b0dc --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments_invalid/migrated_0006.js @@ -0,0 +1 @@ +/*:: diff --git a/lib/test/flow/types/annotations_in_comments_invalid/migrated_0006.tree.json b/lib/test/flow/types/annotations_in_comments_invalid/migrated_0006.tree.json new file mode 100644 index 0000000..85c6c15 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments_invalid/migrated_0006.tree.json @@ -0,0 +1,13 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "range":[5,5], + "body":[], + "comments":[] +} diff --git a/lib/test/flow/types/annotations_in_comments_invalid/migrated_0007.js b/lib/test/flow/types/annotations_in_comments_invalid/migrated_0007.js new file mode 100644 index 0000000..b092c22 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments_invalid/migrated_0007.js @@ -0,0 +1 @@ +/*:: type PowerGlove = /* bad means good */ soBad; */ diff --git a/lib/test/flow/types/annotations_in_comments_invalid/migrated_0007.tree.json b/lib/test/flow/types/annotations_in_comments_invalid/migrated_0007.tree.json new file mode 100644 index 0000000..9a1f594 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments_invalid/migrated_0007.tree.json @@ -0,0 +1,49 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":43}}, + "message":"Unexpected token `*/`. Did you mean `*-/`?" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":50}}, + "range":[5,50], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":50}}, + "range":[5,50], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":20}}, + "range":[10,20], + "name":"PowerGlove", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":44},"end":{"line":1,"column":49}}, + "range":[44,49], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":44},"end":{"line":1,"column":49}}, + "range":[44,49], + "name":"soBad", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":43}}, + "range":[23,43], + "value":" bad means good " + } + ] +} diff --git a/lib/test/flow/types/annotations_in_comments_types_disabled/migrated_0000.js b/lib/test/flow/types/annotations_in_comments_types_disabled/migrated_0000.js new file mode 100644 index 0000000..a12937f --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments_types_disabled/migrated_0000.js @@ -0,0 +1 @@ +function foo(numVal/* : number */){} diff --git a/lib/test/flow/types/annotations_in_comments_types_disabled/migrated_0000.options.json b/lib/test/flow/types/annotations_in_comments_types_disabled/migrated_0000.options.json new file mode 100644 index 0000000..a5f2acb --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments_types_disabled/migrated_0000.options.json @@ -0,0 +1,3 @@ +{ + "types": false +} \ No newline at end of file diff --git a/lib/test/flow/types/annotations_in_comments_types_disabled/migrated_0000.tree.json b/lib/test/flow/types/annotations_in_comments_types_disabled/migrated_0000.tree.json new file mode 100644 index 0000000..c1c81c7 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments_types_disabled/migrated_0000.tree.json @@ -0,0 +1,50 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "range":[0,37], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "range":[0,37], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":19}}, + "range":[13,19], + "name":"numVal", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":37}}, + "range":[35,37], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":34}}, + "range":[19,34], + "value":" : number " + } + ] +} diff --git a/lib/test/flow/types/annotations_in_comments_types_disabled/migrated_0001.js b/lib/test/flow/types/annotations_in_comments_types_disabled/migrated_0001.js new file mode 100644 index 0000000..570ede0 --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments_types_disabled/migrated_0001.js @@ -0,0 +1 @@ +type Foo = /*:: number */ diff --git a/lib/test/flow/types/annotations_in_comments_types_disabled/migrated_0001.options.json b/lib/test/flow/types/annotations_in_comments_types_disabled/migrated_0001.options.json new file mode 100644 index 0000000..a5f2acb --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments_types_disabled/migrated_0001.options.json @@ -0,0 +1,3 @@ +{ + "types": false +} \ No newline at end of file diff --git a/lib/test/flow/types/annotations_in_comments_types_disabled/migrated_0001.tree.json b/lib/test/flow/types/annotations_in_comments_types_disabled/migrated_0001.tree.json new file mode 100644 index 0000000..533bd2e --- /dev/null +++ b/lib/test/flow/types/annotations_in_comments_types_disabled/migrated_0001.tree.json @@ -0,0 +1,44 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "message":"Type aliases are not allowed in untyped mode" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, + "range":[5,8], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "range":[26,26] + } + } + ], + "comments":[ + { + "type":"Block", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":25}}, + "range":[11,25], + "value":":: number " + } + ] +} diff --git a/lib/test/flow/types/bigint_literal/migrated_0000.js b/lib/test/flow/types/bigint_literal/migrated_0000.js new file mode 100644 index 0000000..db40a8a --- /dev/null +++ b/lib/test/flow/types/bigint_literal/migrated_0000.js @@ -0,0 +1 @@ +var a: 123n diff --git a/lib/test/flow/types/bigint_literal/migrated_0000.tree.json b/lib/test/flow/types/bigint_literal/migrated_0000.tree.json new file mode 100644 index 0000000..7ea1a79 --- /dev/null +++ b/lib/test/flow/types/bigint_literal/migrated_0000.tree.json @@ -0,0 +1,41 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, + "range":[4,11], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, + "range":[4,11], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, + "range":[5,11], + "typeAnnotation":{ + "type":"BigIntLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, + "range":[7,11], + "value":null, + "raw":"123n" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/bigint_literal/migrated_0002.js b/lib/test/flow/types/bigint_literal/migrated_0002.js new file mode 100644 index 0000000..ca902f1 --- /dev/null +++ b/lib/test/flow/types/bigint_literal/migrated_0002.js @@ -0,0 +1 @@ +var a: 0x7Bn diff --git a/lib/test/flow/types/bigint_literal/migrated_0002.tree.json b/lib/test/flow/types/bigint_literal/migrated_0002.tree.json new file mode 100644 index 0000000..244f004 --- /dev/null +++ b/lib/test/flow/types/bigint_literal/migrated_0002.tree.json @@ -0,0 +1,41 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, + "range":[4,12], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, + "range":[4,12], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, + "range":[5,12], + "typeAnnotation":{ + "type":"BigIntLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, + "range":[7,12], + "value":null, + "raw":"0x7Bn" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/bigint_literal/migrated_0003.js b/lib/test/flow/types/bigint_literal/migrated_0003.js new file mode 100644 index 0000000..0472121 --- /dev/null +++ b/lib/test/flow/types/bigint_literal/migrated_0003.js @@ -0,0 +1 @@ +var a: 0b1111011n diff --git a/lib/test/flow/types/bigint_literal/migrated_0003.tree.json b/lib/test/flow/types/bigint_literal/migrated_0003.tree.json new file mode 100644 index 0000000..2786bc0 --- /dev/null +++ b/lib/test/flow/types/bigint_literal/migrated_0003.tree.json @@ -0,0 +1,41 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, + "range":[4,17], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, + "range":[4,17], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":17}}, + "range":[5,17], + "typeAnnotation":{ + "type":"BigIntLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":17}}, + "range":[7,17], + "value":null, + "raw":"0b1111011n" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/bigint_literal/migrated_0004.js b/lib/test/flow/types/bigint_literal/migrated_0004.js new file mode 100644 index 0000000..319d239 --- /dev/null +++ b/lib/test/flow/types/bigint_literal/migrated_0004.js @@ -0,0 +1 @@ +var a: 0o173n diff --git a/lib/test/flow/types/bigint_literal/migrated_0004.tree.json b/lib/test/flow/types/bigint_literal/migrated_0004.tree.json new file mode 100644 index 0000000..bb83968 --- /dev/null +++ b/lib/test/flow/types/bigint_literal/migrated_0004.tree.json @@ -0,0 +1,41 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, + "range":[4,13], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, + "range":[4,13], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":13}}, + "range":[5,13], + "typeAnnotation":{ + "type":"BigIntLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, + "range":[7,13], + "value":null, + "raw":"0o173n" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/bigint_literal/migrated_0005.js b/lib/test/flow/types/bigint_literal/migrated_0005.js new file mode 100644 index 0000000..48ec2c0 --- /dev/null +++ b/lib/test/flow/types/bigint_literal/migrated_0005.js @@ -0,0 +1 @@ +var a: -123n diff --git a/lib/test/flow/types/bigint_literal/migrated_0005.tree.json b/lib/test/flow/types/bigint_literal/migrated_0005.tree.json new file mode 100644 index 0000000..cd2e8d3 --- /dev/null +++ b/lib/test/flow/types/bigint_literal/migrated_0005.tree.json @@ -0,0 +1,41 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, + "range":[4,12], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, + "range":[4,12], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, + "range":[5,12], + "typeAnnotation":{ + "type":"BigIntLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, + "range":[7,12], + "value":null, + "raw":"-123n" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/bigint_literal/migrated_0006.js b/lib/test/flow/types/bigint_literal/migrated_0006.js new file mode 100644 index 0000000..56a2d78 --- /dev/null +++ b/lib/test/flow/types/bigint_literal/migrated_0006.js @@ -0,0 +1 @@ +var a: - 123n diff --git a/lib/test/flow/types/bigint_literal/migrated_0006.tree.json b/lib/test/flow/types/bigint_literal/migrated_0006.tree.json new file mode 100644 index 0000000..41f6596 --- /dev/null +++ b/lib/test/flow/types/bigint_literal/migrated_0006.tree.json @@ -0,0 +1,41 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, + "range":[4,13], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, + "range":[4,13], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":13}}, + "range":[5,13], + "typeAnnotation":{ + "type":"BigIntLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, + "range":[7,13], + "value":null, + "raw":"- 123n" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/bigint_literal/migrated_0007.js b/lib/test/flow/types/bigint_literal/migrated_0007.js new file mode 100644 index 0000000..8114a44 --- /dev/null +++ b/lib/test/flow/types/bigint_literal/migrated_0007.js @@ -0,0 +1 @@ +var a: 25257156155n diff --git a/lib/test/flow/types/bigint_literal/migrated_0007.tree.json b/lib/test/flow/types/bigint_literal/migrated_0007.tree.json new file mode 100644 index 0000000..3035a48 --- /dev/null +++ b/lib/test/flow/types/bigint_literal/migrated_0007.tree.json @@ -0,0 +1,41 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "range":[0,19], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "range":[0,19], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":19}}, + "range":[4,19], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":19}}, + "range":[4,19], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":19}}, + "range":[5,19], + "typeAnnotation":{ + "type":"BigIntLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":19}}, + "range":[7,19], + "value":null, + "raw":"25257156155n" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/bigint_literal/migrated_0008.js b/lib/test/flow/types/bigint_literal/migrated_0008.js new file mode 100644 index 0000000..9cc9435 --- /dev/null +++ b/lib/test/flow/types/bigint_literal/migrated_0008.js @@ -0,0 +1 @@ +var a: 0x5E1719E3Bn diff --git a/lib/test/flow/types/bigint_literal/migrated_0008.tree.json b/lib/test/flow/types/bigint_literal/migrated_0008.tree.json new file mode 100644 index 0000000..c8f1078 --- /dev/null +++ b/lib/test/flow/types/bigint_literal/migrated_0008.tree.json @@ -0,0 +1,41 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "range":[0,19], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "range":[0,19], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":19}}, + "range":[4,19], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":19}}, + "range":[4,19], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":19}}, + "range":[5,19], + "typeAnnotation":{ + "type":"BigIntLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":19}}, + "range":[7,19], + "value":null, + "raw":"0x5E1719E3Bn" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/bigint_literal/migrated_0009.js b/lib/test/flow/types/bigint_literal/migrated_0009.js new file mode 100644 index 0000000..d951a7e --- /dev/null +++ b/lib/test/flow/types/bigint_literal/migrated_0009.js @@ -0,0 +1 @@ +var a: 0o274134317073n diff --git a/lib/test/flow/types/bigint_literal/migrated_0009.tree.json b/lib/test/flow/types/bigint_literal/migrated_0009.tree.json new file mode 100644 index 0000000..443cf1e --- /dev/null +++ b/lib/test/flow/types/bigint_literal/migrated_0009.tree.json @@ -0,0 +1,41 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":22}}, + "range":[4,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":22}}, + "range":[4,22], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":22}}, + "range":[5,22], + "typeAnnotation":{ + "type":"BigIntLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":22}}, + "range":[7,22], + "value":null, + "raw":"0o274134317073n" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/bigint_literal_invalid/migrated_0000.js b/lib/test/flow/types/bigint_literal_invalid/migrated_0000.js new file mode 100644 index 0000000..a9fa30e --- /dev/null +++ b/lib/test/flow/types/bigint_literal_invalid/migrated_0000.js @@ -0,0 +1 @@ +var a: 0173n diff --git a/lib/test/flow/types/bigint_literal_invalid/migrated_0000.tree.json b/lib/test/flow/types/bigint_literal_invalid/migrated_0000.tree.json new file mode 100644 index 0000000..3fa63f2 --- /dev/null +++ b/lib/test/flow/types/bigint_literal_invalid/migrated_0000.tree.json @@ -0,0 +1,69 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, + "message":"Unexpected token ILLEGAL" + }, + { + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "message":"Octal literals are not allowed in strict mode." + }, + { + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "message":"Unexpected identifier, expected the token `;`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, + "range":[4,11], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, + "range":[4,11], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, + "range":[5,11], + "typeAnnotation":{ + "type":"NumberLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, + "range":[7,11], + "value":123, + "raw":"0173" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"n", + "typeAnnotation":null, + "optional":false + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/bigint_literal_invalid/migrated_0001.js b/lib/test/flow/types/bigint_literal_invalid/migrated_0001.js new file mode 100644 index 0000000..02d4d96 --- /dev/null +++ b/lib/test/flow/types/bigint_literal_invalid/migrated_0001.js @@ -0,0 +1 @@ +var a: 123.0n diff --git a/lib/test/flow/types/bigint_literal_invalid/migrated_0001.tree.json b/lib/test/flow/types/bigint_literal_invalid/migrated_0001.tree.json new file mode 100644 index 0000000..09bcf2c --- /dev/null +++ b/lib/test/flow/types/bigint_literal_invalid/migrated_0001.tree.json @@ -0,0 +1,47 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, + "message":"A bigint literal must be an integer" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, + "range":[4,13], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, + "range":[4,13], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":13}}, + "range":[5,13], + "typeAnnotation":{ + "type":"BigIntLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, + "range":[7,13], + "value":null, + "raw":"123.0n" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/bigint_literal_invalid/migrated_0002.js b/lib/test/flow/types/bigint_literal_invalid/migrated_0002.js new file mode 100644 index 0000000..8c34530 --- /dev/null +++ b/lib/test/flow/types/bigint_literal_invalid/migrated_0002.js @@ -0,0 +1 @@ +var a: 123-3n diff --git a/lib/test/flow/types/bigint_literal_invalid/migrated_0002.tree.json b/lib/test/flow/types/bigint_literal_invalid/migrated_0002.tree.json new file mode 100644 index 0000000..9d08dc5 --- /dev/null +++ b/lib/test/flow/types/bigint_literal_invalid/migrated_0002.tree.json @@ -0,0 +1,67 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "message":"Unexpected token `-`, expected the token `;`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, + "range":[4,10], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, + "range":[4,10], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, + "range":[5,10], + "typeAnnotation":{ + "type":"NumberLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, + "range":[7,10], + "value":123, + "raw":"123" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, + "range":[10,13], + "expression":{ + "type":"UnaryExpression", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, + "range":[10,13], + "operator":"-", + "prefix":true, + "argument":{ + "type":"BigIntLiteral", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, + "range":[11,13], + "value":null, + "bigint":"3n" + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/bigint_literal_invalid/migrated_0010.js b/lib/test/flow/types/bigint_literal_invalid/migrated_0010.js new file mode 100644 index 0000000..116efc7 --- /dev/null +++ b/lib/test/flow/types/bigint_literal_invalid/migrated_0010.js @@ -0,0 +1 @@ +var a: 1e5n diff --git a/lib/test/flow/types/bigint_literal_invalid/migrated_0010.tree.json b/lib/test/flow/types/bigint_literal_invalid/migrated_0010.tree.json new file mode 100644 index 0000000..3614c19 --- /dev/null +++ b/lib/test/flow/types/bigint_literal_invalid/migrated_0010.tree.json @@ -0,0 +1,47 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, + "message":"A bigint literal cannot use exponential notation" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, + "range":[4,11], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, + "range":[4,11], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, + "range":[5,11], + "typeAnnotation":{ + "type":"BigIntLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, + "range":[7,11], + "value":null, + "raw":"1e5n" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/boolean_literal/migrated_0000.js b/lib/test/flow/types/boolean_literal/migrated_0000.js new file mode 100644 index 0000000..859b74a --- /dev/null +++ b/lib/test/flow/types/boolean_literal/migrated_0000.js @@ -0,0 +1 @@ +var a: true diff --git a/lib/test/flow/types/boolean_literal/migrated_0000.tree.json b/lib/test/flow/types/boolean_literal/migrated_0000.tree.json new file mode 100644 index 0000000..737d5ec --- /dev/null +++ b/lib/test/flow/types/boolean_literal/migrated_0000.tree.json @@ -0,0 +1,41 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, + "range":[4,11], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, + "range":[4,11], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, + "range":[5,11], + "typeAnnotation":{ + "type":"BooleanLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, + "range":[7,11], + "value":true, + "raw":"true" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/boolean_literal/migrated_0001.js b/lib/test/flow/types/boolean_literal/migrated_0001.js new file mode 100644 index 0000000..31e1a6a --- /dev/null +++ b/lib/test/flow/types/boolean_literal/migrated_0001.js @@ -0,0 +1 @@ +var a: false diff --git a/lib/test/flow/types/boolean_literal/migrated_0001.tree.json b/lib/test/flow/types/boolean_literal/migrated_0001.tree.json new file mode 100644 index 0000000..600a699 --- /dev/null +++ b/lib/test/flow/types/boolean_literal/migrated_0001.tree.json @@ -0,0 +1,41 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, + "range":[4,12], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, + "range":[4,12], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, + "range":[5,12], + "typeAnnotation":{ + "type":"BooleanLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, + "range":[7,12], + "value":false, + "raw":"false" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/class_property_variance/migrated_0000.js b/lib/test/flow/types/class_property_variance/migrated_0000.js new file mode 100644 index 0000000..0f3c91a --- /dev/null +++ b/lib/test/flow/types/class_property_variance/migrated_0000.js @@ -0,0 +1 @@ +class C {p:T} diff --git a/lib/test/flow/types/class_property_variance/migrated_0000.tree.json b/lib/test/flow/types/class_property_variance/migrated_0000.tree.json new file mode 100644 index 0000000..46fb6cb --- /dev/null +++ b/lib/test/flow/types/class_property_variance/migrated_0000.tree.json @@ -0,0 +1,69 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, + "range":[8,13], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "name":"p", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, + "range":[10,12], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/class_property_variance/migrated_0001.js b/lib/test/flow/types/class_property_variance/migrated_0001.js new file mode 100644 index 0000000..ee4e200 --- /dev/null +++ b/lib/test/flow/types/class_property_variance/migrated_0001.js @@ -0,0 +1 @@ +class C {+p:T} diff --git a/lib/test/flow/types/class_property_variance/migrated_0001.tree.json b/lib/test/flow/types/class_property_variance/migrated_0001.tree.json new file mode 100644 index 0000000..30def81 --- /dev/null +++ b/lib/test/flow/types/class_property_variance/migrated_0001.tree.json @@ -0,0 +1,74 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, + "range":[8,14], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, + "range":[9,13], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"p", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, + "range":[11,13], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + "computed":false, + "static":false, + "variance":{ + "type":"Variance", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "kind":"plus" + } + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/class_property_variance/migrated_0002.js b/lib/test/flow/types/class_property_variance/migrated_0002.js new file mode 100644 index 0000000..1b998dc --- /dev/null +++ b/lib/test/flow/types/class_property_variance/migrated_0002.js @@ -0,0 +1 @@ +class C {-p:T} diff --git a/lib/test/flow/types/class_property_variance/migrated_0002.tree.json b/lib/test/flow/types/class_property_variance/migrated_0002.tree.json new file mode 100644 index 0000000..dcfd4dc --- /dev/null +++ b/lib/test/flow/types/class_property_variance/migrated_0002.tree.json @@ -0,0 +1,74 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, + "range":[8,14], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, + "range":[9,13], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"p", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, + "range":[11,13], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + "computed":false, + "static":false, + "variance":{ + "type":"Variance", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "kind":"minus" + } + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/class_property_variance/migrated_0003.js b/lib/test/flow/types/class_property_variance/migrated_0003.js new file mode 100644 index 0000000..13a39ee --- /dev/null +++ b/lib/test/flow/types/class_property_variance/migrated_0003.js @@ -0,0 +1 @@ +class C {+m(){}} diff --git a/lib/test/flow/types/class_property_variance/migrated_0003.tree.json b/lib/test/flow/types/class_property_variance/migrated_0003.tree.json new file mode 100644 index 0000000..a2f72c3 --- /dev/null +++ b/lib/test/flow/types/class_property_variance/migrated_0003.tree.json @@ -0,0 +1,75 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "message":"Unexpected variance sigil" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":16}}, + "range":[8,16], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "range":[9,15], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"m", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":15}}, + "range":[11,15], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, + "range":[13,15], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/class_property_variance/migrated_0004.js b/lib/test/flow/types/class_property_variance/migrated_0004.js new file mode 100644 index 0000000..e269ad5 --- /dev/null +++ b/lib/test/flow/types/class_property_variance/migrated_0004.js @@ -0,0 +1 @@ +class C {-m() {}} diff --git a/lib/test/flow/types/class_property_variance/migrated_0004.tree.json b/lib/test/flow/types/class_property_variance/migrated_0004.tree.json new file mode 100644 index 0000000..7899b27 --- /dev/null +++ b/lib/test/flow/types/class_property_variance/migrated_0004.tree.json @@ -0,0 +1,75 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "message":"Unexpected variance sigil" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":17}}, + "range":[8,17], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"m", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":16}}, + "range":[11,16], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, + "range":[14,16], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/class_property_variance/migrated_0005.js b/lib/test/flow/types/class_property_variance/migrated_0005.js new file mode 100644 index 0000000..5bb4985 --- /dev/null +++ b/lib/test/flow/types/class_property_variance/migrated_0005.js @@ -0,0 +1 @@ +class C {async +m() {}} diff --git a/lib/test/flow/types/class_property_variance/migrated_0005.tree.json b/lib/test/flow/types/class_property_variance/migrated_0005.tree.json new file mode 100644 index 0000000..91ae9a8 --- /dev/null +++ b/lib/test/flow/types/class_property_variance/migrated_0005.tree.json @@ -0,0 +1,75 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "message":"Unexpected variance sigil" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":23}}, + "range":[8,23], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":22}}, + "range":[9,22], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "range":[16,17], + "name":"m", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":22}}, + "range":[17,22], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "range":[20,22], + "body":[] + }, + "async":true, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/class_property_variance/migrated_0006.js b/lib/test/flow/types/class_property_variance/migrated_0006.js new file mode 100644 index 0000000..7a4e0e5 --- /dev/null +++ b/lib/test/flow/types/class_property_variance/migrated_0006.js @@ -0,0 +1 @@ +class C {async -m():T {}} diff --git a/lib/test/flow/types/class_property_variance/migrated_0006.tree.json b/lib/test/flow/types/class_property_variance/migrated_0006.tree.json new file mode 100644 index 0000000..82e77c6 --- /dev/null +++ b/lib/test/flow/types/class_property_variance/migrated_0006.tree.json @@ -0,0 +1,93 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "message":"Unexpected variance sigil" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":25}}, + "range":[8,25], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":24}}, + "range":[9,24], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "range":[16,17], + "name":"m", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":24}}, + "range":[17,24], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, + "range":[22,24], + "body":[] + }, + "async":true, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, + "range":[19,21], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/class_property_variance/migrated_0007.js b/lib/test/flow/types/class_property_variance/migrated_0007.js new file mode 100644 index 0000000..13d3808 --- /dev/null +++ b/lib/test/flow/types/class_property_variance/migrated_0007.js @@ -0,0 +1 @@ +class C {*+m() {}} diff --git a/lib/test/flow/types/class_property_variance/migrated_0007.tree.json b/lib/test/flow/types/class_property_variance/migrated_0007.tree.json new file mode 100644 index 0000000..92d56b5 --- /dev/null +++ b/lib/test/flow/types/class_property_variance/migrated_0007.tree.json @@ -0,0 +1,75 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "message":"Unexpected variance sigil" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":18}}, + "range":[8,18], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, + "range":[9,17], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"m", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":17}}, + "range":[12,17], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, + "range":[15,17], + "body":[] + }, + "async":false, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/class_property_variance/migrated_0008.js b/lib/test/flow/types/class_property_variance/migrated_0008.js new file mode 100644 index 0000000..26937fa --- /dev/null +++ b/lib/test/flow/types/class_property_variance/migrated_0008.js @@ -0,0 +1 @@ +class C {*-m():T {}} diff --git a/lib/test/flow/types/class_property_variance/migrated_0008.tree.json b/lib/test/flow/types/class_property_variance/migrated_0008.tree.json new file mode 100644 index 0000000..9231897 --- /dev/null +++ b/lib/test/flow/types/class_property_variance/migrated_0008.tree.json @@ -0,0 +1,93 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "message":"Unexpected variance sigil" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":20}}, + "range":[8,20], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":19}}, + "range":[9,19], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"m", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":19}}, + "range":[12,19], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, + "range":[17,19], + "body":[] + }, + "async":false, + "generator":true, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, + "range":[14,16], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/class_property_variance/migrated_0009.js b/lib/test/flow/types/class_property_variance/migrated_0009.js new file mode 100644 index 0000000..9b5de23 --- /dev/null +++ b/lib/test/flow/types/class_property_variance/migrated_0009.js @@ -0,0 +1 @@ +class C {+*m() {}} diff --git a/lib/test/flow/types/class_property_variance/migrated_0009.tree.json b/lib/test/flow/types/class_property_variance/migrated_0009.tree.json new file mode 100644 index 0000000..60b41be --- /dev/null +++ b/lib/test/flow/types/class_property_variance/migrated_0009.tree.json @@ -0,0 +1,75 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "message":"Unexpected variance sigil" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":18}}, + "range":[8,18], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, + "range":[9,17], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"m", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":17}}, + "range":[12,17], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, + "range":[15,17], + "body":[] + }, + "async":false, + "generator":true, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/class_property_variance/migrated_0010.js b/lib/test/flow/types/class_property_variance/migrated_0010.js new file mode 100644 index 0000000..3528c6b --- /dev/null +++ b/lib/test/flow/types/class_property_variance/migrated_0010.js @@ -0,0 +1 @@ +class C {-*m():T {}} diff --git a/lib/test/flow/types/class_property_variance/migrated_0010.tree.json b/lib/test/flow/types/class_property_variance/migrated_0010.tree.json new file mode 100644 index 0000000..894155d --- /dev/null +++ b/lib/test/flow/types/class_property_variance/migrated_0010.tree.json @@ -0,0 +1,93 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "message":"Unexpected variance sigil" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":20}}, + "range":[8,20], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":19}}, + "range":[9,19], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"m", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":19}}, + "range":[12,19], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, + "range":[17,19], + "body":[] + }, + "async":false, + "generator":true, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, + "range":[14,16], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_class/basic.js b/lib/test/flow/types/declare_class/basic.js new file mode 100644 index 0000000..f349d94 --- /dev/null +++ b/lib/test/flow/types/declare_class/basic.js @@ -0,0 +1 @@ +declare class A {} diff --git a/lib/test/flow/types/declare_class/basic.tree.json b/lib/test/flow/types/declare_class/basic.tree.json new file mode 100644 index 0000000..ffdbd00 --- /dev/null +++ b/lib/test/flow/types/declare_class/basic.tree.json @@ -0,0 +1,35 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, + "range":[16,18], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_class/field_named_static.js b/lib/test/flow/types/declare_class/field_named_static.js new file mode 100644 index 0000000..dbd7e5a --- /dev/null +++ b/lib/test/flow/types/declare_class/field_named_static.js @@ -0,0 +1 @@ +declare class A { static : number } diff --git a/lib/test/flow/types/declare_class/field_named_static.tree.json b/lib/test/flow/types/declare_class/field_named_static.tree.json new file mode 100644 index 0000000..58de93b --- /dev/null +++ b/lib/test/flow/types/declare_class/field_named_static.tree.json @@ -0,0 +1,60 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":35}}, + "range":[16,35], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":33}}, + "range":[18,33], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":24}}, + "range":[18,24], + "name":"static", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":33}}, + "range":[27,33] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_class/implements.js b/lib/test/flow/types/declare_class/implements.js new file mode 100644 index 0000000..35893a6 --- /dev/null +++ b/lib/test/flow/types/declare_class/implements.js @@ -0,0 +1 @@ +declare class A implements B {} diff --git a/lib/test/flow/types/declare_class/implements.tree.json b/lib/test/flow/types/declare_class/implements.tree.json new file mode 100644 index 0000000..0d8638b --- /dev/null +++ b/lib/test/flow/types/declare_class/implements.tree.json @@ -0,0 +1,50 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, + "range":[29,31], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[ + { + "type":"ClassImplements", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, + "range":[27,28], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, + "range":[27,28], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_class/implements_and_mixins.js b/lib/test/flow/types/declare_class/implements_and_mixins.js new file mode 100644 index 0000000..045b763 --- /dev/null +++ b/lib/test/flow/types/declare_class/implements_and_mixins.js @@ -0,0 +1 @@ +declare class A mixins B implements C {} diff --git a/lib/test/flow/types/declare_class/implements_and_mixins.tree.json b/lib/test/flow/types/declare_class/implements_and_mixins.tree.json new file mode 100644 index 0000000..a6b4b1b --- /dev/null +++ b/lib/test/flow/types/declare_class/implements_and_mixins.tree.json @@ -0,0 +1,65 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "range":[0,40], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "range":[0,40], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":40}}, + "range":[38,40], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[ + { + "type":"ClassImplements", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":37}}, + "range":[36,37], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":37}}, + "range":[36,37], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ], + "mixins":[ + { + "type":"InterfaceExtends", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, + "range":[23,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, + "range":[23,24], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_class/implements_multiple.js b/lib/test/flow/types/declare_class/implements_multiple.js new file mode 100644 index 0000000..9132ccd --- /dev/null +++ b/lib/test/flow/types/declare_class/implements_multiple.js @@ -0,0 +1 @@ +declare class A implements B, C {} diff --git a/lib/test/flow/types/declare_class/implements_multiple.tree.json b/lib/test/flow/types/declare_class/implements_multiple.tree.json new file mode 100644 index 0000000..4ba92fa --- /dev/null +++ b/lib/test/flow/types/declare_class/implements_multiple.tree.json @@ -0,0 +1,64 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "range":[0,34], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "range":[0,34], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":34}}, + "range":[32,34], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[ + { + "type":"ClassImplements", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, + "range":[27,28], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, + "range":[27,28], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + { + "type":"ClassImplements", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":31}}, + "range":[30,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":31}}, + "range":[30,31], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_class/invalid_quoted_static_modifier.js b/lib/test/flow/types/declare_class/invalid_quoted_static_modifier.js new file mode 100644 index 0000000..9c13cc2 --- /dev/null +++ b/lib/test/flow/types/declare_class/invalid_quoted_static_modifier.js @@ -0,0 +1 @@ +declare class A { "static" foo(): number } diff --git a/lib/test/flow/types/declare_class/invalid_quoted_static_modifier.tree.json b/lib/test/flow/types/declare_class/invalid_quoted_static_modifier.tree.json new file mode 100644 index 0000000..f5dd171 --- /dev/null +++ b/lib/test/flow/types/declare_class/invalid_quoted_static_modifier.tree.json @@ -0,0 +1,77 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":30}}, + "message":"Unexpected identifier, expected the token `:`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, + "message":"Unexpected token `:`, expected the token `=>`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "range":[0,42], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "range":[0,42], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":42}}, + "range":[16,42], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":40}}, + "range":[18,40], + "key":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":26}}, + "range":[18,26], + "value":"static", + "raw":"\"static\"" + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":40}}, + "range":[30,40], + "params":[], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":40}}, + "range":[34,40] + }, + "rest":null, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_class/method_with_this_return.js b/lib/test/flow/types/declare_class/method_with_this_return.js new file mode 100644 index 0000000..5cf7011 --- /dev/null +++ b/lib/test/flow/types/declare_class/method_with_this_return.js @@ -0,0 +1,3 @@ +declare class Foo { + m(): this; +} diff --git a/lib/test/flow/types/declare_class/method_with_this_return.tree.json b/lib/test/flow/types/declare_class/method_with_this_return.tree.json new file mode 100644 index 0000000..5030c56 --- /dev/null +++ b/lib/test/flow/types/declare_class/method_with_this_return.tree.json @@ -0,0 +1,78 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,34], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,34], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, + "range":[14,17], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":3,"column":1}}, + "range":[18,34], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":11}}, + "range":[22,31], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[22,23], + "name":"m", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":11}}, + "range":[22,31], + "params":[], + "this":null, + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":11}}, + "range":[27,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":11}}, + "range":[27,31], + "name":"this", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "rest":null, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_class/mixins.js b/lib/test/flow/types/declare_class/mixins.js new file mode 100644 index 0000000..bc8b256 --- /dev/null +++ b/lib/test/flow/types/declare_class/mixins.js @@ -0,0 +1 @@ +declare class A mixins B {} diff --git a/lib/test/flow/types/declare_class/mixins.tree.json b/lib/test/flow/types/declare_class/mixins.tree.json new file mode 100644 index 0000000..b6c09a5 --- /dev/null +++ b/lib/test/flow/types/declare_class/mixins.tree.json @@ -0,0 +1,50 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, + "range":[25,27], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[ + { + "type":"InterfaceExtends", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, + "range":[23,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, + "range":[23,24], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_class/mixins_multiple.js b/lib/test/flow/types/declare_class/mixins_multiple.js new file mode 100644 index 0000000..caa2cc2 --- /dev/null +++ b/lib/test/flow/types/declare_class/mixins_multiple.js @@ -0,0 +1 @@ +declare class A mixins B, C {} diff --git a/lib/test/flow/types/declare_class/mixins_multiple.tree.json b/lib/test/flow/types/declare_class/mixins_multiple.tree.json new file mode 100644 index 0000000..e445b22 --- /dev/null +++ b/lib/test/flow/types/declare_class/mixins_multiple.tree.json @@ -0,0 +1,64 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, + "range":[28,30], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[ + { + "type":"InterfaceExtends", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, + "range":[23,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, + "range":[23,24], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + { + "type":"InterfaceExtends", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, + "range":[26,27], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, + "range":[26,27], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_class/multiple_extends.js b/lib/test/flow/types/declare_class/multiple_extends.js new file mode 100644 index 0000000..db1d8d2 --- /dev/null +++ b/lib/test/flow/types/declare_class/multiple_extends.js @@ -0,0 +1 @@ +declare class A extends B, C {} diff --git a/lib/test/flow/types/declare_class/multiple_extends.tree.json b/lib/test/flow/types/declare_class/multiple_extends.tree.json new file mode 100644 index 0000000..ff5fce5 --- /dev/null +++ b/lib/test/flow/types/declare_class/multiple_extends.tree.json @@ -0,0 +1,89 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, + "message":"Unexpected token `,`, expected the token `{`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, + "message":"Unexpected token `{`, expected the token `:`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":31}}, + "message":"Unexpected token `}`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":31}}, + "range":[25,31], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":30}}, + "range":[27,30], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, + "range":[27,28], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":31}}, + "range":[30,31] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[ + { + "type":"InterfaceExtends", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, + "range":[24,25], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, + "range":[24,25], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_class/proto.js b/lib/test/flow/types/declare_class/proto.js new file mode 100644 index 0000000..4a80666 --- /dev/null +++ b/lib/test/flow/types/declare_class/proto.js @@ -0,0 +1,11 @@ +declare class A { + proto: T; +} + +declare class B { + proto x: T; +} + +declare class C { + proto +x: T; +} diff --git a/lib/test/flow/types/declare_class/proto.tree.json b/lib/test/flow/types/declare_class/proto.tree.json new file mode 100644 index 0000000..b82d874 --- /dev/null +++ b/lib/test/flow/types/declare_class/proto.tree.json @@ -0,0 +1,196 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":11,"column":1}}, + "range":[0,102], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":3,"column":1}}, + "range":[16,31], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":10}}, + "range":[20,28], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":7}}, + "range":[20,25], + "name":"proto", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, + "range":[27,28], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, + "range":[27,28], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + }, + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":7,"column":1}}, + "range":[33,66], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":14},"end":{"line":5,"column":15}}, + "range":[47,48], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":16},"end":{"line":7,"column":1}}, + "range":[49,66], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":6,"column":2},"end":{"line":6,"column":12}}, + "range":[53,63], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":8},"end":{"line":6,"column":9}}, + "range":[59,60], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":6,"column":11},"end":{"line":6,"column":12}}, + "range":[62,63], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":11},"end":{"line":6,"column":12}}, + "range":[62,63], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":false, + "proto":true, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + }, + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":11,"column":1}}, + "range":[68,102], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":14},"end":{"line":9,"column":15}}, + "range":[82,83], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":9,"column":16},"end":{"line":11,"column":1}}, + "range":[84,102], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":10,"column":2},"end":{"line":10,"column":13}}, + "range":[88,99], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":10,"column":9},"end":{"line":10,"column":10}}, + "range":[95,96], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":10,"column":12},"end":{"line":10,"column":13}}, + "range":[98,99], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":10,"column":12},"end":{"line":10,"column":13}}, + "range":[98,99], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":false, + "proto":true, + "variance":{ + "type":"Variance", + "loc":{"source":null,"start":{"line":10,"column":8},"end":{"line":10,"column":9}}, + "range":[94,95], + "kind":"plus" + }, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_class/proto_indexer.js b/lib/test/flow/types/declare_class/proto_indexer.js new file mode 100644 index 0000000..802cf99 --- /dev/null +++ b/lib/test/flow/types/declare_class/proto_indexer.js @@ -0,0 +1 @@ +declare class C { proto [K]: V } diff --git a/lib/test/flow/types/declare_class/proto_indexer.tree.json b/lib/test/flow/types/declare_class/proto_indexer.tree.json new file mode 100644 index 0000000..bf2617b --- /dev/null +++ b/lib/test/flow/types/declare_class/proto_indexer.tree.json @@ -0,0 +1,78 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, + "message":"Unexpected proto modifier" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":32}}, + "range":[16,32], + "exact":false, + "properties":[], + "indexers":[ + { + "type":"ObjectTypeIndexer", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":30}}, + "range":[18,30], + "id":null, + "key":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, + "range":[25,26], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, + "range":[25,26], + "name":"K", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "value":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, + "range":[29,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, + "range":[29,30], + "name":"V", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "static":false, + "variance":null + } + ], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_class/proto_method.js b/lib/test/flow/types/declare_class/proto_method.js new file mode 100644 index 0000000..b07b25c --- /dev/null +++ b/lib/test/flow/types/declare_class/proto_method.js @@ -0,0 +1 @@ +declare class C { proto m(): void } diff --git a/lib/test/flow/types/declare_class/proto_method.tree.json b/lib/test/flow/types/declare_class/proto_method.tree.json new file mode 100644 index 0000000..1dc47bb --- /dev/null +++ b/lib/test/flow/types/declare_class/proto_method.tree.json @@ -0,0 +1,74 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":23}}, + "message":"Unexpected proto modifier" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":35}}, + "range":[16,35], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":33}}, + "range":[18,33], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, + "range":[24,25], + "name":"m", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":33}}, + "range":[18,33], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":33}}, + "range":[29,33] + }, + "rest":null, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_class/static_indexer.js b/lib/test/flow/types/declare_class/static_indexer.js new file mode 100644 index 0000000..238dbf8 --- /dev/null +++ b/lib/test/flow/types/declare_class/static_indexer.js @@ -0,0 +1 @@ +declare class A { static [ indexer: number]: string } diff --git a/lib/test/flow/types/declare_class/static_indexer.tree.json b/lib/test/flow/types/declare_class/static_indexer.tree.json new file mode 100644 index 0000000..17355a7 --- /dev/null +++ b/lib/test/flow/types/declare_class/static_indexer.tree.json @@ -0,0 +1,61 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "range":[0,53], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "range":[0,53], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":53}}, + "range":[16,53], + "exact":false, + "properties":[], + "indexers":[ + { + "type":"ObjectTypeIndexer", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":51}}, + "range":[18,51], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":34}}, + "range":[27,34], + "name":"indexer", + "typeAnnotation":null, + "optional":false + }, + "key":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":42}}, + "range":[36,42] + }, + "value":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":45},"end":{"line":1,"column":51}}, + "range":[45,51] + }, + "static":true, + "variance":null + } + ], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_class/static_method.js b/lib/test/flow/types/declare_class/static_method.js new file mode 100644 index 0000000..7c06e6f --- /dev/null +++ b/lib/test/flow/types/declare_class/static_method.js @@ -0,0 +1 @@ +declare class A { static () : number } diff --git a/lib/test/flow/types/declare_class/static_method.tree.json b/lib/test/flow/types/declare_class/static_method.tree.json new file mode 100644 index 0000000..25bc644 --- /dev/null +++ b/lib/test/flow/types/declare_class/static_method.tree.json @@ -0,0 +1,55 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":38}}, + "range":[16,38], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[ + { + "type":"ObjectTypeCallProperty", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":36}}, + "range":[18,36], + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":36}}, + "range":[25,36], + "params":[], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":36}}, + "range":[30,36] + }, + "rest":null, + "typeParameters":null + }, + "static":true + } + ], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_class/static_proto.js b/lib/test/flow/types/declare_class/static_proto.js new file mode 100644 index 0000000..22bf5dc --- /dev/null +++ b/lib/test/flow/types/declare_class/static_proto.js @@ -0,0 +1 @@ +declare class C { static proto x: T } diff --git a/lib/test/flow/types/declare_class/static_proto.tree.json b/lib/test/flow/types/declare_class/static_proto.tree.json new file mode 100644 index 0000000..b7e387f --- /dev/null +++ b/lib/test/flow/types/declare_class/static_proto.tree.json @@ -0,0 +1,106 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":32}}, + "message":"Unexpected identifier, expected the token `:`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, + "message":"Unexpected token `:`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, + "message":"Unexpected token `:`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, + "message":"Unexpected identifier, expected the token `:`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":37}}, + "message":"Unexpected token `}`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "range":[0,37], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "range":[0,37], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":37}}, + "range":[16,37], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":32}}, + "range":[18,32], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":30}}, + "range":[25,30], + "name":"proto", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, + "range":[32,33] + }, + "method":false, + "optional":false, + "static":true, + "proto":false, + "variance":null, + "kind":"init" + }, + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":35}}, + "range":[32,35], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, + "range":[32,33], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":37}}, + "range":[36,37] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_class/truncated0.js b/lib/test/flow/types/declare_class/truncated0.js new file mode 100644 index 0000000..454bd1c --- /dev/null +++ b/lib/test/flow/types/declare_class/truncated0.js @@ -0,0 +1,3 @@ +declare class A { + static +} diff --git a/lib/test/flow/types/declare_class/truncated0.tree.json b/lib/test/flow/types/declare_class/truncated0.tree.json new file mode 100644 index 0000000..72ca3cc --- /dev/null +++ b/lib/test/flow/types/declare_class/truncated0.tree.json @@ -0,0 +1,78 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":1}}, + "message":"Unexpected token `}`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":4,"column":0},"end":{"line":4,"column":0}}, + "message":"Unexpected end of input, expected the token `:`" + }, + { + "loc":{"source":null,"start":{"line":4,"column":0},"end":{"line":4,"column":0}}, + "message":"Unexpected end of input" + }, + { + "loc":{"source":null,"start":{"line":4,"column":0},"end":{"line":4,"column":0}}, + "message":"Unexpected end of input, expected the token `}`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":0}}, + "range":[0,29], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":0}}, + "range":[0,29], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":4,"column":0}}, + "range":[16,29], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":4,"column":0}}, + "range":[20,29], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":1}}, + "range":[27,28], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":0},"end":{"line":4,"column":0}}, + "range":[29,29] + }, + "method":false, + "optional":false, + "static":true, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_class/truncated1.js b/lib/test/flow/types/declare_class/truncated1.js new file mode 100644 index 0000000..2fb05b1 --- /dev/null +++ b/lib/test/flow/types/declare_class/truncated1.js @@ -0,0 +1,3 @@ +declare class B { + static + +} diff --git a/lib/test/flow/types/declare_class/truncated1.tree.json b/lib/test/flow/types/declare_class/truncated1.tree.json new file mode 100644 index 0000000..58c4b0b --- /dev/null +++ b/lib/test/flow/types/declare_class/truncated1.tree.json @@ -0,0 +1,83 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":1}}, + "message":"Unexpected token `}`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":4,"column":0},"end":{"line":4,"column":0}}, + "message":"Unexpected end of input, expected the token `:`" + }, + { + "loc":{"source":null,"start":{"line":4,"column":0},"end":{"line":4,"column":0}}, + "message":"Unexpected end of input" + }, + { + "loc":{"source":null,"start":{"line":4,"column":0},"end":{"line":4,"column":0}}, + "message":"Unexpected end of input, expected the token `}`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":0}}, + "range":[0,31], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":0}}, + "range":[0,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":4,"column":0}}, + "range":[16,31], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":4,"column":0}}, + "range":[20,31], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":1}}, + "range":[29,30], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":0},"end":{"line":4,"column":0}}, + "range":[31,31] + }, + "method":false, + "optional":false, + "static":true, + "proto":false, + "variance":{ + "type":"Variance", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, + "range":[27,28], + "kind":"plus" + }, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_class/truncated2.js b/lib/test/flow/types/declare_class/truncated2.js new file mode 100644 index 0000000..7a27d3b --- /dev/null +++ b/lib/test/flow/types/declare_class/truncated2.js @@ -0,0 +1,3 @@ +declare class C { + - +} diff --git a/lib/test/flow/types/declare_class/truncated2.tree.json b/lib/test/flow/types/declare_class/truncated2.tree.json new file mode 100644 index 0000000..7754cb8 --- /dev/null +++ b/lib/test/flow/types/declare_class/truncated2.tree.json @@ -0,0 +1,83 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":1}}, + "message":"Unexpected token `}`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":4,"column":0},"end":{"line":4,"column":0}}, + "message":"Unexpected end of input, expected the token `:`" + }, + { + "loc":{"source":null,"start":{"line":4,"column":0},"end":{"line":4,"column":0}}, + "message":"Unexpected end of input" + }, + { + "loc":{"source":null,"start":{"line":4,"column":0},"end":{"line":4,"column":0}}, + "message":"Unexpected end of input, expected the token `}`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":0}}, + "range":[0,24], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":0}}, + "range":[0,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":4,"column":0}}, + "range":[16,24], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":4,"column":0}}, + "range":[20,24], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":1}}, + "range":[22,23], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":0},"end":{"line":4,"column":0}}, + "range":[24,24] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":{ + "type":"Variance", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[20,21], + "kind":"minus" + }, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_class_properties/basic.js b/lib/test/flow/types/declare_class_properties/basic.js new file mode 100644 index 0000000..714a40a --- /dev/null +++ b/lib/test/flow/types/declare_class_properties/basic.js @@ -0,0 +1,4 @@ +class C { + declare x: string; + declare static y: string; +} diff --git a/lib/test/flow/types/declare_class_properties/basic.tree.json b/lib/test/flow/types/declare_class_properties/basic.tree.json new file mode 100644 index 0000000..b99c0ff --- /dev/null +++ b/lib/test/flow/types/declare_class_properties/basic.tree.json @@ -0,0 +1,89 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,60], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "range":[0,60], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "range":[8,60], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":20}}, + "range":[12,30], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, + "range":[20,21], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":19}}, + "range":[21,29], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":19}}, + "range":[23,29] + } + }, + "computed":false, + "static":false, + "variance":null, + "declare":true + }, + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":3,"column":2},"end":{"line":3,"column":27}}, + "range":[33,58], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":17},"end":{"line":3,"column":18}}, + "range":[48,49], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":18},"end":{"line":3,"column":26}}, + "range":[49,57], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":20},"end":{"line":3,"column":26}}, + "range":[51,57] + } + }, + "computed":false, + "static":true, + "variance":null, + "declare":true + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_class_properties/invalid_async.js b/lib/test/flow/types/declare_class_properties/invalid_async.js new file mode 100644 index 0000000..e18a9e5 --- /dev/null +++ b/lib/test/flow/types/declare_class_properties/invalid_async.js @@ -0,0 +1,3 @@ +class C { + declare async x(): string {}; +} diff --git a/lib/test/flow/types/declare_class_properties/invalid_async.tree.json b/lib/test/flow/types/declare_class_properties/invalid_async.tree.json new file mode 100644 index 0000000..5886aa8 --- /dev/null +++ b/lib/test/flow/types/declare_class_properties/invalid_async.tree.json @@ -0,0 +1,84 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "message":"`declare` modifier can only appear on class fields." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,43], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,43], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "range":[8,43], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":30}}, + "range":[12,40], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":17}}, + "range":[26,27], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":30}}, + "range":[27,40], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":28},"end":{"line":2,"column":30}}, + "range":[38,40], + "body":[] + }, + "async":true, + "generator":false, + "predicate":null, + "expression":false, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":27}}, + "range":[29,37], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":21},"end":{"line":2,"column":27}}, + "range":[31,37] + } + }, + "typeParameters":null + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_class_properties/invalid_initializer.js b/lib/test/flow/types/declare_class_properties/invalid_initializer.js new file mode 100644 index 0000000..3a6f70e --- /dev/null +++ b/lib/test/flow/types/declare_class_properties/invalid_initializer.js @@ -0,0 +1,3 @@ +class C { + declare x: string = "foo"; +} diff --git a/lib/test/flow/types/declare_class_properties/invalid_initializer.tree.json b/lib/test/flow/types/declare_class_properties/invalid_initializer.tree.json new file mode 100644 index 0000000..150e856 --- /dev/null +++ b/lib/test/flow/types/declare_class_properties/invalid_initializer.tree.json @@ -0,0 +1,84 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":20},"end":{"line":2,"column":21}}, + "message":"Unexpected token `=`. Initializers are not allowed in a `declare`." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,40], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,40], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "range":[8,40], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":21}}, + "range":[12,31], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, + "range":[20,21], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":19}}, + "range":[21,29], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":19}}, + "range":[23,29] + } + }, + "computed":false, + "static":false, + "variance":null, + "declare":true + }, + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":2,"column":22},"end":{"line":2,"column":28}}, + "range":[32,38], + "key":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":22},"end":{"line":2,"column":27}}, + "range":[32,37], + "value":"foo", + "raw":"\"foo\"" + }, + "value":null, + "typeAnnotation":null, + "computed":false, + "static":false, + "variance":null + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_class_properties/invalid_missing_annotation.js b/lib/test/flow/types/declare_class_properties/invalid_missing_annotation.js new file mode 100644 index 0000000..9415ec0 --- /dev/null +++ b/lib/test/flow/types/declare_class_properties/invalid_missing_annotation.js @@ -0,0 +1,3 @@ +class C { + declare x; +} diff --git a/lib/test/flow/types/declare_class_properties/invalid_missing_annotation.tree.json b/lib/test/flow/types/declare_class_properties/invalid_missing_annotation.tree.json new file mode 100644 index 0000000..7cd0ab5 --- /dev/null +++ b/lib/test/flow/types/declare_class_properties/invalid_missing_annotation.tree.json @@ -0,0 +1,52 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,24], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":3,"column":1}}, + "range":[8,24], + "body":[ + { + "type":"ClassProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, + "range":[12,22], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, + "range":[20,21], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":null, + "typeAnnotation":null, + "computed":false, + "static":false, + "variance":null, + "declare":true + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/batch/migrated_0000.js b/lib/test/flow/types/declare_export/batch/migrated_0000.js new file mode 100644 index 0000000..6ee74e9 --- /dev/null +++ b/lib/test/flow/types/declare_export/batch/migrated_0000.js @@ -0,0 +1 @@ +declare export * from "foo"; diff --git a/lib/test/flow/types/declare_export/batch/migrated_0000.tree.json b/lib/test/flow/types/declare_export/batch/migrated_0000.tree.json new file mode 100644 index 0000000..220fe34 --- /dev/null +++ b/lib/test/flow/types/declare_export/batch/migrated_0000.tree.json @@ -0,0 +1,20 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "body":[ + { + "type":"DeclareExportAllDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":27}}, + "range":[22,27], + "value":"foo", + "raw":"\"foo\"" + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/batch/migrated_0001.js b/lib/test/flow/types/declare_export/batch/migrated_0001.js new file mode 100644 index 0000000..dbac53e --- /dev/null +++ b/lib/test/flow/types/declare_export/batch/migrated_0001.js @@ -0,0 +1 @@ +declare export * from "foo" diff --git a/lib/test/flow/types/declare_export/batch/migrated_0001.tree.json b/lib/test/flow/types/declare_export/batch/migrated_0001.tree.json new file mode 100644 index 0000000..d514a3e --- /dev/null +++ b/lib/test/flow/types/declare_export/batch/migrated_0001.tree.json @@ -0,0 +1,20 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "body":[ + { + "type":"DeclareExportAllDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":27}}, + "range":[22,27], + "value":"foo", + "raw":"\"foo\"" + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/class/migrated_0017.js b/lib/test/flow/types/declare_export/class/migrated_0017.js new file mode 100644 index 0000000..401c79c --- /dev/null +++ b/lib/test/flow/types/declare_export/class/migrated_0017.js @@ -0,0 +1 @@ +declare export class A {} diff --git a/lib/test/flow/types/declare_export/class/migrated_0017.tree.json b/lib/test/flow/types/declare_export/class/migrated_0017.tree.json new file mode 100644 index 0000000..91056bd --- /dev/null +++ b/lib/test/flow/types/declare_export/class/migrated_0017.tree.json @@ -0,0 +1,43 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "default":false, + "declaration":{ + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":25}}, + "range":[15,25], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, + "range":[23,25], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/class/migrated_0018.js b/lib/test/flow/types/declare_export/class/migrated_0018.js new file mode 100644 index 0000000..3ef2731 --- /dev/null +++ b/lib/test/flow/types/declare_export/class/migrated_0018.js @@ -0,0 +1 @@ +declare export class A extends B { x: number } diff --git a/lib/test/flow/types/declare_export/class/migrated_0018.tree.json b/lib/test/flow/types/declare_export/class/migrated_0018.tree.json new file mode 100644 index 0000000..d8e6f9a --- /dev/null +++ b/lib/test/flow/types/declare_export/class/migrated_0018.tree.json @@ -0,0 +1,118 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, + "range":[0,52], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, + "range":[0,52], + "default":false, + "declaration":{ + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":52}}, + "range":[15,52], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":25}}, + "range":[22,25], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, + "range":[23,24], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":52}}, + "range":[39,52], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":50}}, + "range":[41,50], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":42}}, + "range":[41,42], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":44},"end":{"line":1,"column":50}}, + "range":[44,50] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[ + { + "type":"InterfaceExtends", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":38}}, + "range":[34,38], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, + "range":[34,35], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":38}}, + "range":[35,38], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":37}}, + "range":[36,37], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":37}}, + "range":[36,37], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + } + ], + "implements":[], + "mixins":[] + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/class/migrated_0019.js b/lib/test/flow/types/declare_export/class/migrated_0019.js new file mode 100644 index 0000000..5ff252a --- /dev/null +++ b/lib/test/flow/types/declare_export/class/migrated_0019.js @@ -0,0 +1 @@ +declare export class A { static foo(): number; static x : string } diff --git a/lib/test/flow/types/declare_export/class/migrated_0019.tree.json b/lib/test/flow/types/declare_export/class/migrated_0019.tree.json new file mode 100644 index 0000000..c6d9e9e --- /dev/null +++ b/lib/test/flow/types/declare_export/class/migrated_0019.tree.json @@ -0,0 +1,100 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":66}}, + "range":[0,66], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":66}}, + "range":[0,66], + "default":false, + "declaration":{ + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":66}}, + "range":[15,66], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":66}}, + "range":[23,66], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":45}}, + "range":[25,45], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":35}}, + "range":[32,35], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":45}}, + "range":[25,45], + "params":[], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":45}}, + "range":[39,45] + }, + "rest":null, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":true, + "proto":false, + "variance":null, + "kind":"init" + }, + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":47},"end":{"line":1,"column":64}}, + "range":[47,64], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":54},"end":{"line":1,"column":55}}, + "range":[54,55], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":58},"end":{"line":1,"column":64}}, + "range":[58,64] + }, + "method":false, + "optional":false, + "static":true, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/class/migrated_0020.js b/lib/test/flow/types/declare_export/class/migrated_0020.js new file mode 100644 index 0000000..627cc59 --- /dev/null +++ b/lib/test/flow/types/declare_export/class/migrated_0020.js @@ -0,0 +1 @@ +declare export class A { static [ indexer: number]: string } diff --git a/lib/test/flow/types/declare_export/class/migrated_0020.tree.json b/lib/test/flow/types/declare_export/class/migrated_0020.tree.json new file mode 100644 index 0000000..b8645a9 --- /dev/null +++ b/lib/test/flow/types/declare_export/class/migrated_0020.tree.json @@ -0,0 +1,69 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":60}}, + "range":[0,60], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":60}}, + "range":[0,60], + "default":false, + "declaration":{ + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":60}}, + "range":[15,60], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":60}}, + "range":[23,60], + "exact":false, + "properties":[], + "indexers":[ + { + "type":"ObjectTypeIndexer", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":58}}, + "range":[25,58], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":41}}, + "range":[34,41], + "name":"indexer", + "typeAnnotation":null, + "optional":false + }, + "key":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":43},"end":{"line":1,"column":49}}, + "range":[43,49] + }, + "value":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":52},"end":{"line":1,"column":58}}, + "range":[52,58] + }, + "static":true, + "variance":null + } + ], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/class/migrated_0021.js b/lib/test/flow/types/declare_export/class/migrated_0021.js new file mode 100644 index 0000000..7adfb06 --- /dev/null +++ b/lib/test/flow/types/declare_export/class/migrated_0021.js @@ -0,0 +1 @@ +declare export class A { static () : number } diff --git a/lib/test/flow/types/declare_export/class/migrated_0021.tree.json b/lib/test/flow/types/declare_export/class/migrated_0021.tree.json new file mode 100644 index 0000000..790c787 --- /dev/null +++ b/lib/test/flow/types/declare_export/class/migrated_0021.tree.json @@ -0,0 +1,63 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "range":[0,45], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "range":[0,45], + "default":false, + "declaration":{ + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":45}}, + "range":[15,45], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":45}}, + "range":[23,45], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[ + { + "type":"ObjectTypeCallProperty", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":43}}, + "range":[25,43], + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":43}}, + "range":[32,43], + "params":[], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":43}}, + "range":[37,43] + }, + "rest":null, + "typeParameters":null + }, + "static":true + } + ], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/declare_export_class_prop_named_static.js b/lib/test/flow/types/declare_export/declare_export_class_prop_named_static.js new file mode 100644 index 0000000..4972c05 --- /dev/null +++ b/lib/test/flow/types/declare_export/declare_export_class_prop_named_static.js @@ -0,0 +1 @@ +declare export class A { static : number } diff --git a/lib/test/flow/types/declare_export/declare_export_class_prop_named_static.tree.json b/lib/test/flow/types/declare_export/declare_export_class_prop_named_static.tree.json new file mode 100644 index 0000000..f3fb457 --- /dev/null +++ b/lib/test/flow/types/declare_export/declare_export_class_prop_named_static.tree.json @@ -0,0 +1,68 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "range":[0,42], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "range":[0,42], + "default":false, + "declaration":{ + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":42}}, + "range":[15,42], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":42}}, + "range":[23,42], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":40}}, + "range":[25,40], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":31}}, + "range":[25,31], + "name":"static", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":40}}, + "range":[34,40] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/default/default_with_parens.js b/lib/test/flow/types/declare_export/default/default_with_parens.js new file mode 100644 index 0000000..33f0937 --- /dev/null +++ b/lib/test/flow/types/declare_export/default/default_with_parens.js @@ -0,0 +1 @@ +declare export default (string); diff --git a/lib/test/flow/types/declare_export/default/default_with_parens.tree.json b/lib/test/flow/types/declare_export/default/default_with_parens.tree.json new file mode 100644 index 0000000..e8fdade --- /dev/null +++ b/lib/test/flow/types/declare_export/default/default_with_parens.tree.json @@ -0,0 +1,21 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "default":true, + "declaration":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":30}}, + "range":[24,30] + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/default/default_with_parens_no_semi.js b/lib/test/flow/types/declare_export/default/default_with_parens_no_semi.js new file mode 100644 index 0000000..99e796f --- /dev/null +++ b/lib/test/flow/types/declare_export/default/default_with_parens_no_semi.js @@ -0,0 +1 @@ +declare export default (string) diff --git a/lib/test/flow/types/declare_export/default/default_with_parens_no_semi.tree.json b/lib/test/flow/types/declare_export/default/default_with_parens_no_semi.tree.json new file mode 100644 index 0000000..f0771ec --- /dev/null +++ b/lib/test/flow/types/declare_export/default/default_with_parens_no_semi.tree.json @@ -0,0 +1,21 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "default":true, + "declaration":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":30}}, + "range":[24,30] + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/default/migrated_0022.js b/lib/test/flow/types/declare_export/default/migrated_0022.js new file mode 100644 index 0000000..c2e2bbb --- /dev/null +++ b/lib/test/flow/types/declare_export/default/migrated_0022.js @@ -0,0 +1 @@ +declare export default number; diff --git a/lib/test/flow/types/declare_export/default/migrated_0022.tree.json b/lib/test/flow/types/declare_export/default/migrated_0022.tree.json new file mode 100644 index 0000000..929ab13 --- /dev/null +++ b/lib/test/flow/types/declare_export/default/migrated_0022.tree.json @@ -0,0 +1,21 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "default":true, + "declaration":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":29}}, + "range":[23,29] + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/default/migrated_0023.js b/lib/test/flow/types/declare_export/default/migrated_0023.js new file mode 100644 index 0000000..f5e695b --- /dev/null +++ b/lib/test/flow/types/declare_export/default/migrated_0023.js @@ -0,0 +1 @@ +declare export default number diff --git a/lib/test/flow/types/declare_export/default/migrated_0023.tree.json b/lib/test/flow/types/declare_export/default/migrated_0023.tree.json new file mode 100644 index 0000000..0ead6ac --- /dev/null +++ b/lib/test/flow/types/declare_export/default/migrated_0023.tree.json @@ -0,0 +1,21 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "default":true, + "declaration":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":29}}, + "range":[23,29] + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/default/migrated_0024.js b/lib/test/flow/types/declare_export/default/migrated_0024.js new file mode 100644 index 0000000..ae29b8a --- /dev/null +++ b/lib/test/flow/types/declare_export/default/migrated_0024.js @@ -0,0 +1 @@ +declare export default function foo(): void diff --git a/lib/test/flow/types/declare_export/default/migrated_0024.tree.json b/lib/test/flow/types/declare_export/default/migrated_0024.tree.json new file mode 100644 index 0000000..ae64610 --- /dev/null +++ b/lib/test/flow/types/declare_export/default/migrated_0024.tree.json @@ -0,0 +1,47 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "range":[0,43], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "range":[0,43], + "default":true, + "declaration":{ + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":43}}, + "range":[23,43], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":43}}, + "range":[32,43], + "name":"foo", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":43}}, + "range":[35,43], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":43}}, + "range":[35,43], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":43}}, + "range":[39,43] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/default/migrated_0025.js b/lib/test/flow/types/declare_export/default/migrated_0025.js new file mode 100644 index 0000000..b26f522 --- /dev/null +++ b/lib/test/flow/types/declare_export/default/migrated_0025.js @@ -0,0 +1 @@ +declare export default function foo(): void; diff --git a/lib/test/flow/types/declare_export/default/migrated_0025.tree.json b/lib/test/flow/types/declare_export/default/migrated_0025.tree.json new file mode 100644 index 0000000..a771da8 --- /dev/null +++ b/lib/test/flow/types/declare_export/default/migrated_0025.tree.json @@ -0,0 +1,47 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, + "range":[0,44], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, + "range":[0,44], + "default":true, + "declaration":{ + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":44}}, + "range":[23,44], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":43}}, + "range":[32,43], + "name":"foo", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":43}}, + "range":[35,43], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":43}}, + "range":[35,43], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":43}}, + "range":[39,43] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/default/migrated_0026.js b/lib/test/flow/types/declare_export/default/migrated_0026.js new file mode 100644 index 0000000..15ee601 --- /dev/null +++ b/lib/test/flow/types/declare_export/default/migrated_0026.js @@ -0,0 +1 @@ +declare export default function foo(): void; diff --git a/lib/test/flow/types/declare_export/default/migrated_0026.tree.json b/lib/test/flow/types/declare_export/default/migrated_0026.tree.json new file mode 100644 index 0000000..aa28b51 --- /dev/null +++ b/lib/test/flow/types/declare_export/default/migrated_0026.tree.json @@ -0,0 +1,62 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "range":[0,47], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "range":[0,47], + "default":true, + "declaration":{ + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":47}}, + "range":[23,47], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":46}}, + "range":[32,46], + "name":"foo", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":46}}, + "range":[35,46], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":46}}, + "range":[35,46], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":42},"end":{"line":1,"column":46}}, + "range":[42,46] + }, + "rest":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":38}}, + "range":[35,38], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":37}}, + "range":[36,37], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + } + }, + "optional":false + }, + "predicate":null + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/default/migrated_0027.js b/lib/test/flow/types/declare_export/default/migrated_0027.js new file mode 100644 index 0000000..fc7cf34 --- /dev/null +++ b/lib/test/flow/types/declare_export/default/migrated_0027.js @@ -0,0 +1 @@ +declare export default function foo(x: number, y: string): void; diff --git a/lib/test/flow/types/declare_export/default/migrated_0027.tree.json b/lib/test/flow/types/declare_export/default/migrated_0027.tree.json new file mode 100644 index 0000000..74050a9 --- /dev/null +++ b/lib/test/flow/types/declare_export/default/migrated_0027.tree.json @@ -0,0 +1,86 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":64}}, + "range":[0,64], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":64}}, + "range":[0,64], + "default":true, + "declaration":{ + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":64}}, + "range":[23,64], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":63}}, + "range":[32,63], + "name":"foo", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":63}}, + "range":[35,63], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":63}}, + "range":[35,63], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":45}}, + "range":[36,45], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":37}}, + "range":[36,37], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":45}}, + "range":[39,45] + }, + "optional":false + }, + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":47},"end":{"line":1,"column":56}}, + "range":[47,56], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":47},"end":{"line":1,"column":48}}, + "range":[47,48], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":50},"end":{"line":1,"column":56}}, + "range":[50,56] + }, + "optional":false + } + ], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":59},"end":{"line":1,"column":63}}, + "range":[59,63] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/default/migrated_0028.js b/lib/test/flow/types/declare_export/default/migrated_0028.js new file mode 100644 index 0000000..e40f4a8 --- /dev/null +++ b/lib/test/flow/types/declare_export/default/migrated_0028.js @@ -0,0 +1 @@ +declare export default class A {} diff --git a/lib/test/flow/types/declare_export/default/migrated_0028.tree.json b/lib/test/flow/types/declare_export/default/migrated_0028.tree.json new file mode 100644 index 0000000..8537daa --- /dev/null +++ b/lib/test/flow/types/declare_export/default/migrated_0028.tree.json @@ -0,0 +1,43 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "default":true, + "declaration":{ + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":33}}, + "range":[23,33], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, + "range":[29,30], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":33}}, + "range":[31,33], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/default/migrated_0029.js b/lib/test/flow/types/declare_export/default/migrated_0029.js new file mode 100644 index 0000000..50deca5 --- /dev/null +++ b/lib/test/flow/types/declare_export/default/migrated_0029.js @@ -0,0 +1 @@ +declare export default class A extends B { x: number } diff --git a/lib/test/flow/types/declare_export/default/migrated_0029.tree.json b/lib/test/flow/types/declare_export/default/migrated_0029.tree.json new file mode 100644 index 0000000..fd7a740 --- /dev/null +++ b/lib/test/flow/types/declare_export/default/migrated_0029.tree.json @@ -0,0 +1,118 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":60}}, + "range":[0,60], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":60}}, + "range":[0,60], + "default":true, + "declaration":{ + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":60}}, + "range":[23,60], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, + "range":[29,30], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":33}}, + "range":[30,33], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":32}}, + "range":[31,32], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":47},"end":{"line":1,"column":60}}, + "range":[47,60], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":49},"end":{"line":1,"column":58}}, + "range":[49,58], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":49},"end":{"line":1,"column":50}}, + "range":[49,50], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":52},"end":{"line":1,"column":58}}, + "range":[52,58] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[ + { + "type":"InterfaceExtends", + "loc":{"source":null,"start":{"line":1,"column":42},"end":{"line":1,"column":46}}, + "range":[42,46], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":42},"end":{"line":1,"column":43}}, + "range":[42,43], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":43},"end":{"line":1,"column":46}}, + "range":[43,46], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":44},"end":{"line":1,"column":45}}, + "range":[44,45], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":44},"end":{"line":1,"column":45}}, + "range":[44,45], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + } + ], + "implements":[], + "mixins":[] + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/default/migrated_0030.js b/lib/test/flow/types/declare_export/default/migrated_0030.js new file mode 100644 index 0000000..dc4aabe --- /dev/null +++ b/lib/test/flow/types/declare_export/default/migrated_0030.js @@ -0,0 +1 @@ +declare export default class A { static foo(): number; static x : string } diff --git a/lib/test/flow/types/declare_export/default/migrated_0030.tree.json b/lib/test/flow/types/declare_export/default/migrated_0030.tree.json new file mode 100644 index 0000000..88d1516 --- /dev/null +++ b/lib/test/flow/types/declare_export/default/migrated_0030.tree.json @@ -0,0 +1,100 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":74}}, + "range":[0,74], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":74}}, + "range":[0,74], + "default":true, + "declaration":{ + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":74}}, + "range":[23,74], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, + "range":[29,30], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":74}}, + "range":[31,74], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":53}}, + "range":[33,53], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":40},"end":{"line":1,"column":43}}, + "range":[40,43], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":53}}, + "range":[33,53], + "params":[], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":47},"end":{"line":1,"column":53}}, + "range":[47,53] + }, + "rest":null, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":true, + "proto":false, + "variance":null, + "kind":"init" + }, + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":55},"end":{"line":1,"column":72}}, + "range":[55,72], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":62},"end":{"line":1,"column":63}}, + "range":[62,63], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":66},"end":{"line":1,"column":72}}, + "range":[66,72] + }, + "method":false, + "optional":false, + "static":true, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/default/migrated_0031.js b/lib/test/flow/types/declare_export/default/migrated_0031.js new file mode 100644 index 0000000..5df72cc --- /dev/null +++ b/lib/test/flow/types/declare_export/default/migrated_0031.js @@ -0,0 +1 @@ +declare export default class A { static [ indexer: number]: string } diff --git a/lib/test/flow/types/declare_export/default/migrated_0031.tree.json b/lib/test/flow/types/declare_export/default/migrated_0031.tree.json new file mode 100644 index 0000000..f58d36c --- /dev/null +++ b/lib/test/flow/types/declare_export/default/migrated_0031.tree.json @@ -0,0 +1,69 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":68}}, + "range":[0,68], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":68}}, + "range":[0,68], + "default":true, + "declaration":{ + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":68}}, + "range":[23,68], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, + "range":[29,30], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":68}}, + "range":[31,68], + "exact":false, + "properties":[], + "indexers":[ + { + "type":"ObjectTypeIndexer", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":66}}, + "range":[33,66], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":42},"end":{"line":1,"column":49}}, + "range":[42,49], + "name":"indexer", + "typeAnnotation":null, + "optional":false + }, + "key":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":51},"end":{"line":1,"column":57}}, + "range":[51,57] + }, + "value":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":60},"end":{"line":1,"column":66}}, + "range":[60,66] + }, + "static":true, + "variance":null + } + ], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/default/migrated_0032.js b/lib/test/flow/types/declare_export/default/migrated_0032.js new file mode 100644 index 0000000..432d542 --- /dev/null +++ b/lib/test/flow/types/declare_export/default/migrated_0032.js @@ -0,0 +1 @@ +declare export default class A { static () : number } diff --git a/lib/test/flow/types/declare_export/default/migrated_0032.tree.json b/lib/test/flow/types/declare_export/default/migrated_0032.tree.json new file mode 100644 index 0000000..aac6cae --- /dev/null +++ b/lib/test/flow/types/declare_export/default/migrated_0032.tree.json @@ -0,0 +1,63 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "range":[0,53], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "range":[0,53], + "default":true, + "declaration":{ + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":53}}, + "range":[23,53], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, + "range":[29,30], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":53}}, + "range":[31,53], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[ + { + "type":"ObjectTypeCallProperty", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":51}}, + "range":[33,51], + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":40},"end":{"line":1,"column":51}}, + "range":[40,51], + "params":[], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":45},"end":{"line":1,"column":51}}, + "range":[45,51] + }, + "rest":null, + "typeParameters":null + }, + "static":true + } + ], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/function/migrated_0012.js b/lib/test/flow/types/declare_export/function/migrated_0012.js new file mode 100644 index 0000000..2aa02da --- /dev/null +++ b/lib/test/flow/types/declare_export/function/migrated_0012.js @@ -0,0 +1 @@ +declare export function foo(): void diff --git a/lib/test/flow/types/declare_export/function/migrated_0012.tree.json b/lib/test/flow/types/declare_export/function/migrated_0012.tree.json new file mode 100644 index 0000000..d727e37 --- /dev/null +++ b/lib/test/flow/types/declare_export/function/migrated_0012.tree.json @@ -0,0 +1,47 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "default":false, + "declaration":{ + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":35}}, + "range":[15,35], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":35}}, + "range":[24,35], + "name":"foo", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":35}}, + "range":[27,35], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":35}}, + "range":[27,35], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":35}}, + "range":[31,35] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/function/migrated_0013.js b/lib/test/flow/types/declare_export/function/migrated_0013.js new file mode 100644 index 0000000..6696179 --- /dev/null +++ b/lib/test/flow/types/declare_export/function/migrated_0013.js @@ -0,0 +1 @@ +declare export function foo(): void; diff --git a/lib/test/flow/types/declare_export/function/migrated_0013.tree.json b/lib/test/flow/types/declare_export/function/migrated_0013.tree.json new file mode 100644 index 0000000..05d0dc6 --- /dev/null +++ b/lib/test/flow/types/declare_export/function/migrated_0013.tree.json @@ -0,0 +1,47 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "default":false, + "declaration":{ + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":36}}, + "range":[15,36], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":35}}, + "range":[24,35], + "name":"foo", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":35}}, + "range":[27,35], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":35}}, + "range":[27,35], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":35}}, + "range":[31,35] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/function/migrated_0014.js b/lib/test/flow/types/declare_export/function/migrated_0014.js new file mode 100644 index 0000000..e211d49 --- /dev/null +++ b/lib/test/flow/types/declare_export/function/migrated_0014.js @@ -0,0 +1 @@ +declare export function foo(): void; diff --git a/lib/test/flow/types/declare_export/function/migrated_0014.tree.json b/lib/test/flow/types/declare_export/function/migrated_0014.tree.json new file mode 100644 index 0000000..ef28906 --- /dev/null +++ b/lib/test/flow/types/declare_export/function/migrated_0014.tree.json @@ -0,0 +1,62 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "range":[0,39], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "range":[0,39], + "default":false, + "declaration":{ + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":39}}, + "range":[15,39], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":38}}, + "range":[24,38], + "name":"foo", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":38}}, + "range":[27,38], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":38}}, + "range":[27,38], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":38}}, + "range":[34,38] + }, + "rest":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":30}}, + "range":[27,30], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":29}}, + "range":[28,29], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + } + } + }, + "optional":false + }, + "predicate":null + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/function/migrated_0015.js b/lib/test/flow/types/declare_export/function/migrated_0015.js new file mode 100644 index 0000000..3424cbc --- /dev/null +++ b/lib/test/flow/types/declare_export/function/migrated_0015.js @@ -0,0 +1 @@ +declare export function foo(x: number, y: string): void; diff --git a/lib/test/flow/types/declare_export/function/migrated_0015.tree.json b/lib/test/flow/types/declare_export/function/migrated_0015.tree.json new file mode 100644 index 0000000..924aba2 --- /dev/null +++ b/lib/test/flow/types/declare_export/function/migrated_0015.tree.json @@ -0,0 +1,86 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, + "range":[0,56], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, + "range":[0,56], + "default":false, + "declaration":{ + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":56}}, + "range":[15,56], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":55}}, + "range":[24,55], + "name":"foo", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":55}}, + "range":[27,55], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":55}}, + "range":[27,55], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":37}}, + "range":[28,37], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":29}}, + "range":[28,29], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":37}}, + "range":[31,37] + }, + "optional":false + }, + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":48}}, + "range":[39,48], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":40}}, + "range":[39,40], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":42},"end":{"line":1,"column":48}}, + "range":[42,48] + }, + "optional":false + } + ], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":51},"end":{"line":1,"column":55}}, + "range":[51,55] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/function/migrated_0016.js b/lib/test/flow/types/declare_export/function/migrated_0016.js new file mode 100644 index 0000000..1c0d336 --- /dev/null +++ b/lib/test/flow/types/declare_export/function/migrated_0016.js @@ -0,0 +1 @@ +declare export function foo(x: number, string): void diff --git a/lib/test/flow/types/declare_export/function/migrated_0016.tree.json b/lib/test/flow/types/declare_export/function/migrated_0016.tree.json new file mode 100644 index 0000000..61fed36 --- /dev/null +++ b/lib/test/flow/types/declare_export/function/migrated_0016.tree.json @@ -0,0 +1,79 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, + "range":[0,52], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, + "range":[0,52], + "default":false, + "declaration":{ + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":52}}, + "range":[15,52], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":52}}, + "range":[24,52], + "name":"foo", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":52}}, + "range":[27,52], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":52}}, + "range":[27,52], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":37}}, + "range":[28,37], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":29}}, + "range":[28,29], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":37}}, + "range":[31,37] + }, + "optional":false + }, + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":45}}, + "range":[39,45], + "name":null, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":45}}, + "range":[39,45] + }, + "optional":false + } + ], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":48},"end":{"line":1,"column":52}}, + "range":[48,52] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/named/migrated_0002.js b/lib/test/flow/types/declare_export/named/migrated_0002.js new file mode 100644 index 0000000..ac1bec4 --- /dev/null +++ b/lib/test/flow/types/declare_export/named/migrated_0002.js @@ -0,0 +1 @@ +declare export {} from "foo"; diff --git a/lib/test/flow/types/declare_export/named/migrated_0002.tree.json b/lib/test/flow/types/declare_export/named/migrated_0002.tree.json new file mode 100644 index 0000000..fe3c365 --- /dev/null +++ b/lib/test/flow/types/declare_export/named/migrated_0002.tree.json @@ -0,0 +1,23 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "default":false, + "declaration":null, + "specifiers":[], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":28}}, + "range":[23,28], + "value":"foo", + "raw":"\"foo\"" + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/named/migrated_0003.js b/lib/test/flow/types/declare_export/named/migrated_0003.js new file mode 100644 index 0000000..eaf33a7 --- /dev/null +++ b/lib/test/flow/types/declare_export/named/migrated_0003.js @@ -0,0 +1 @@ +declare export { bar } from "foo"; diff --git a/lib/test/flow/types/declare_export/named/migrated_0003.tree.json b/lib/test/flow/types/declare_export/named/migrated_0003.tree.json new file mode 100644 index 0000000..8fd6702 --- /dev/null +++ b/lib/test/flow/types/declare_export/named/migrated_0003.tree.json @@ -0,0 +1,45 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "range":[0,34], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "range":[0,34], + "default":false, + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "name":"bar", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":33}}, + "range":[28,33], + "value":"foo", + "raw":"\"foo\"" + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/named/migrated_0004.js b/lib/test/flow/types/declare_export/named/migrated_0004.js new file mode 100644 index 0000000..3eaa50f --- /dev/null +++ b/lib/test/flow/types/declare_export/named/migrated_0004.js @@ -0,0 +1 @@ +declare export { bar } from "foo" diff --git a/lib/test/flow/types/declare_export/named/migrated_0004.tree.json b/lib/test/flow/types/declare_export/named/migrated_0004.tree.json new file mode 100644 index 0000000..64940cd --- /dev/null +++ b/lib/test/flow/types/declare_export/named/migrated_0004.tree.json @@ -0,0 +1,45 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "default":false, + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "name":"bar", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":33}}, + "range":[28,33], + "value":"foo", + "raw":"\"foo\"" + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/named/migrated_0005.js b/lib/test/flow/types/declare_export/named/migrated_0005.js new file mode 100644 index 0000000..46f721b --- /dev/null +++ b/lib/test/flow/types/declare_export/named/migrated_0005.js @@ -0,0 +1 @@ +declare export { bar, baz } from "foo"; diff --git a/lib/test/flow/types/declare_export/named/migrated_0005.tree.json b/lib/test/flow/types/declare_export/named/migrated_0005.tree.json new file mode 100644 index 0000000..76008dc --- /dev/null +++ b/lib/test/flow/types/declare_export/named/migrated_0005.tree.json @@ -0,0 +1,66 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "range":[0,39], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "range":[0,39], + "default":false, + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "name":"bar", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":25}}, + "range":[22,25], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":25}}, + "range":[22,25], + "name":"baz", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":25}}, + "range":[22,25], + "name":"baz", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":38}}, + "range":[33,38], + "value":"foo", + "raw":"\"foo\"" + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/named/migrated_0006.js b/lib/test/flow/types/declare_export/named/migrated_0006.js new file mode 100644 index 0000000..2b76f04 --- /dev/null +++ b/lib/test/flow/types/declare_export/named/migrated_0006.js @@ -0,0 +1 @@ +declare export { bar }; diff --git a/lib/test/flow/types/declare_export/named/migrated_0006.tree.json b/lib/test/flow/types/declare_export/named/migrated_0006.tree.json new file mode 100644 index 0000000..b7adb46 --- /dev/null +++ b/lib/test/flow/types/declare_export/named/migrated_0006.tree.json @@ -0,0 +1,39 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "default":false, + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "name":"bar", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/named/migrated_0007.js b/lib/test/flow/types/declare_export/named/migrated_0007.js new file mode 100644 index 0000000..117c745 --- /dev/null +++ b/lib/test/flow/types/declare_export/named/migrated_0007.js @@ -0,0 +1 @@ +declare export { bar, } diff --git a/lib/test/flow/types/declare_export/named/migrated_0007.tree.json b/lib/test/flow/types/declare_export/named/migrated_0007.tree.json new file mode 100644 index 0000000..b7adb46 --- /dev/null +++ b/lib/test/flow/types/declare_export/named/migrated_0007.tree.json @@ -0,0 +1,39 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "default":false, + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "name":"bar", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/named/migrated_0008.js b/lib/test/flow/types/declare_export/named/migrated_0008.js new file mode 100644 index 0000000..68062ea --- /dev/null +++ b/lib/test/flow/types/declare_export/named/migrated_0008.js @@ -0,0 +1 @@ +declare export { bar, baz }; diff --git a/lib/test/flow/types/declare_export/named/migrated_0008.tree.json b/lib/test/flow/types/declare_export/named/migrated_0008.tree.json new file mode 100644 index 0000000..38161e9 --- /dev/null +++ b/lib/test/flow/types/declare_export/named/migrated_0008.tree.json @@ -0,0 +1,60 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "default":false, + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "name":"bar", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":25}}, + "range":[22,25], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":25}}, + "range":[22,25], + "name":"baz", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":25}}, + "range":[22,25], + "name":"baz", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/var/migrated_0009.js b/lib/test/flow/types/declare_export/var/migrated_0009.js new file mode 100644 index 0000000..4098e46 --- /dev/null +++ b/lib/test/flow/types/declare_export/var/migrated_0009.js @@ -0,0 +1 @@ +declare export var x diff --git a/lib/test/flow/types/declare_export/var/migrated_0009.tree.json b/lib/test/flow/types/declare_export/var/migrated_0009.tree.json new file mode 100644 index 0000000..c035c50 --- /dev/null +++ b/lib/test/flow/types/declare_export/var/migrated_0009.tree.json @@ -0,0 +1,29 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "default":false, + "declaration":{ + "type":"DeclareVariable", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "range":[15,20], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "range":[19,20], + "name":"x", + "typeAnnotation":null, + "optional":false + } + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/var/migrated_0010.js b/lib/test/flow/types/declare_export/var/migrated_0010.js new file mode 100644 index 0000000..344fb3b --- /dev/null +++ b/lib/test/flow/types/declare_export/var/migrated_0010.js @@ -0,0 +1 @@ +declare export var x; diff --git a/lib/test/flow/types/declare_export/var/migrated_0010.tree.json b/lib/test/flow/types/declare_export/var/migrated_0010.tree.json new file mode 100644 index 0000000..c38bb4e --- /dev/null +++ b/lib/test/flow/types/declare_export/var/migrated_0010.tree.json @@ -0,0 +1,29 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "default":false, + "declaration":{ + "type":"DeclareVariable", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":21}}, + "range":[15,21], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "range":[19,20], + "name":"x", + "typeAnnotation":null, + "optional":false + } + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export/var/migrated_0011.js b/lib/test/flow/types/declare_export/var/migrated_0011.js new file mode 100644 index 0000000..259e773 --- /dev/null +++ b/lib/test/flow/types/declare_export/var/migrated_0011.js @@ -0,0 +1 @@ +declare export var x: number; diff --git a/lib/test/flow/types/declare_export/var/migrated_0011.tree.json b/lib/test/flow/types/declare_export/var/migrated_0011.tree.json new file mode 100644 index 0000000..fef4841 --- /dev/null +++ b/lib/test/flow/types/declare_export/var/migrated_0011.tree.json @@ -0,0 +1,38 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "default":false, + "declaration":{ + "type":"DeclareVariable", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":29}}, + "range":[15,29], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":28}}, + "range":[19,28], + "name":"x", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, + "range":[20,28], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":28}}, + "range":[22,28] + } + }, + "optional":false + } + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export_invalid/export_non_default_type.js b/lib/test/flow/types/declare_export_invalid/export_non_default_type.js new file mode 100644 index 0000000..108fd7b --- /dev/null +++ b/lib/test/flow/types/declare_export_invalid/export_non_default_type.js @@ -0,0 +1,2 @@ +// You may only export a type directly for declare export default +declare export number; diff --git a/lib/test/flow/types/declare_export_invalid/export_non_default_type.tree.json b/lib/test/flow/types/declare_export_invalid/export_non_default_type.tree.json new file mode 100644 index 0000000..9818555 --- /dev/null +++ b/lib/test/flow/types/declare_export_invalid/export_non_default_type.tree.json @@ -0,0 +1,60 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":15},"end":{"line":2,"column":21}}, + "message":"Unexpected identifier, expected the token `{`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":21},"end":{"line":2,"column":22}}, + "message":"Unexpected token `;`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":0}}, + "message":"Unexpected end of input, expected the token `}`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":3,"column":0}}, + "range":[66,89], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":3,"column":0}}, + "range":[66,89], + "default":false, + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":2,"column":21},"end":{"line":2,"column":22}}, + "range":[87,88], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":21},"end":{"line":2,"column":22}}, + "range":[87,88], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":21},"end":{"line":2,"column":22}}, + "range":[87,88], + "name":"", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":null + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":65}}, + "range":[0,65], + "value":" You may only export a type directly for declare export default" + } + ] +} diff --git a/lib/test/flow/types/declare_export_invalid/export_type/migrated_0000.js b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0000.js new file mode 100644 index 0000000..f2c105f --- /dev/null +++ b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0000.js @@ -0,0 +1 @@ +declare export type foo = number; diff --git a/lib/test/flow/types/declare_export_invalid/export_type/migrated_0000.tree.json b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0000.tree.json new file mode 100644 index 0000000..522fc6f --- /dev/null +++ b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0000.tree.json @@ -0,0 +1,136 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":19}}, + "message":"`declare export type` is not supported. Use `export type` instead." + }, + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":19}}, + "message":"Unexpected token `type`, expected the token `{`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, + "message":"Missing comma between export specifiers" + }, + { + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, + "message":"Unexpected token `=`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":32}}, + "message":"Missing comma between export specifiers" + }, + { + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, + "message":"Missing comma between export specifiers" + }, + { + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, + "message":"Unexpected token `;`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the token `}`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,34], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,34], + "default":false, + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":23}}, + "range":[20,23], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":23}}, + "range":[20,23], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":23}}, + "range":[20,23], + "name":"foo", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, + "range":[24,25], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, + "range":[24,25], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, + "range":[24,25], + "name":"", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":32}}, + "range":[26,32], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":32}}, + "range":[26,32], + "name":"number", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":32}}, + "range":[26,32], + "name":"number", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, + "range":[32,33], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, + "range":[32,33], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, + "range":[32,33], + "name":"", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export_invalid/export_type/migrated_0001.js b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0001.js new file mode 100644 index 0000000..9d1fd99 --- /dev/null +++ b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0001.js @@ -0,0 +1 @@ +declare export type { x, y } diff --git a/lib/test/flow/types/declare_export_invalid/export_type/migrated_0001.tree.json b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0001.tree.json new file mode 100644 index 0000000..0ead274 --- /dev/null +++ b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0001.tree.json @@ -0,0 +1,99 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":19}}, + "message":"`declare export type` is not supported. Use `export type` instead." + }, + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":19}}, + "message":"Unexpected token `type`, expected the token `{`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "message":"Unexpected token `{`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, + "message":"Missing comma between export specifiers" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "default":false, + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "name":"", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, + "range":[22,23], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, + "range":[22,23], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, + "range":[22,23], + "name":"x", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, + "range":[25,26], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, + "range":[25,26], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, + "range":[25,26], + "name":"y", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export_invalid/export_type/migrated_0002.js b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0002.js new file mode 100644 index 0000000..c153baa --- /dev/null +++ b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0002.js @@ -0,0 +1 @@ +declare export type * from "foo"; diff --git a/lib/test/flow/types/declare_export_invalid/export_type/migrated_0002.tree.json b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0002.tree.json new file mode 100644 index 0000000..3e24fc5 --- /dev/null +++ b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0002.tree.json @@ -0,0 +1,140 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":19}}, + "message":"`declare export type` is not supported. Use `export type` instead." + }, + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":19}}, + "message":"Unexpected token `type`, expected the token `{`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "message":"Unexpected token `*`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":26}}, + "message":"Missing comma between export specifiers" + }, + { + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":32}}, + "message":"Missing comma between export specifiers" + }, + { + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":32}}, + "message":"Unexpected string, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, + "message":"Missing comma between export specifiers" + }, + { + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, + "message":"Unexpected token `;`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the token `}`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,34], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,34], + "default":false, + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "name":"", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":26}}, + "range":[22,26], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":26}}, + "range":[22,26], + "name":"from", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":26}}, + "range":[22,26], + "name":"from", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":32}}, + "range":[27,32], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":32}}, + "range":[27,32], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":32}}, + "range":[27,32], + "name":"", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, + "range":[32,33], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, + "range":[32,33], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, + "range":[32,33], + "name":"", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export_invalid/export_type/migrated_0003.js b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0003.js new file mode 100644 index 0000000..65dba75 --- /dev/null +++ b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0003.js @@ -0,0 +1 @@ +declare export type var x: number; diff --git a/lib/test/flow/types/declare_export_invalid/export_type/migrated_0003.tree.json b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0003.tree.json new file mode 100644 index 0000000..77e1c33 --- /dev/null +++ b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0003.tree.json @@ -0,0 +1,165 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":19}}, + "message":"`declare export type` is not supported. Use `export type` instead." + }, + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":19}}, + "message":"Unexpected token `type`, expected the token `{`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, + "message":"Missing comma between export specifiers" + }, + { + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, + "message":"Missing comma between export specifiers" + }, + { + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, + "message":"Unexpected token `:`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":33}}, + "message":"Missing comma between export specifiers" + }, + { + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":34}}, + "message":"Missing comma between export specifiers" + }, + { + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":34}}, + "message":"Unexpected token `;`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the token `}`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":23}}, + "message":"Unexpected token `var`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,35], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,35], + "default":false, + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":23}}, + "range":[20,23], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":23}}, + "range":[20,23], + "name":"var", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":23}}, + "range":[20,23], + "name":"var", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, + "range":[24,25], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, + "range":[24,25], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, + "range":[24,25], + "name":"x", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, + "range":[25,26], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, + "range":[25,26], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, + "range":[25,26], + "name":"", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":33}}, + "range":[27,33], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":33}}, + "range":[27,33], + "name":"number", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":33}}, + "range":[27,33], + "name":"number", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":34}}, + "range":[33,34], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":34}}, + "range":[33,34], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":34}}, + "range":[33,34], + "name":"", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export_invalid/export_type/migrated_0004.js b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0004.js new file mode 100644 index 0000000..9ab63da --- /dev/null +++ b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0004.js @@ -0,0 +1 @@ +declare export type function foo(): void diff --git a/lib/test/flow/types/declare_export_invalid/export_type/migrated_0004.tree.json b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0004.tree.json new file mode 100644 index 0000000..bc7392b --- /dev/null +++ b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0004.tree.json @@ -0,0 +1,198 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":19}}, + "message":"`declare export type` is not supported. Use `export type` instead." + }, + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":19}}, + "message":"Unexpected token `type`, expected the token `{`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":32}}, + "message":"Missing comma between export specifiers" + }, + { + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, + "message":"Missing comma between export specifiers" + }, + { + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, + "message":"Unexpected token `(`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":34}}, + "message":"Missing comma between export specifiers" + }, + { + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":34}}, + "message":"Unexpected token `)`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, + "message":"Missing comma between export specifiers" + }, + { + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, + "message":"Unexpected token `:`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":40}}, + "message":"Missing comma between export specifiers" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the token `}`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, + "message":"Unexpected token `function`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":40}}, + "message":"Unexpected token `void`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,41], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,41], + "default":false, + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, + "range":[20,28], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, + "range":[20,28], + "name":"function", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, + "range":[20,28], + "name":"function", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":32}}, + "range":[29,32], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":32}}, + "range":[29,32], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":32}}, + "range":[29,32], + "name":"foo", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, + "range":[32,33], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, + "range":[32,33], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, + "range":[32,33], + "name":"", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":34}}, + "range":[33,34], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":34}}, + "range":[33,34], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":34}}, + "range":[33,34], + "name":"", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, + "range":[34,35], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, + "range":[34,35], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, + "range":[34,35], + "name":"", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":40}}, + "range":[36,40], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":40}}, + "range":[36,40], + "name":"void", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":40}}, + "range":[36,40], + "name":"void", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export_invalid/export_type/migrated_0005.js b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0005.js new file mode 100644 index 0000000..d024bfd --- /dev/null +++ b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0005.js @@ -0,0 +1 @@ +declare export type class A {} diff --git a/lib/test/flow/types/declare_export_invalid/export_type/migrated_0005.tree.json b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0005.tree.json new file mode 100644 index 0000000..a592735 --- /dev/null +++ b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0005.tree.json @@ -0,0 +1,107 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":19}}, + "message":"`declare export type` is not supported. Use `export type` instead." + }, + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":19}}, + "message":"Unexpected token `type`, expected the token `{`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, + "message":"Missing comma between export specifiers" + }, + { + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":29}}, + "message":"Missing comma between export specifiers" + }, + { + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":29}}, + "message":"Unexpected token `{`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":25}}, + "message":"Unexpected token `class`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "default":false, + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":25}}, + "range":[20,25], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":25}}, + "range":[20,25], + "name":"class", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":25}}, + "range":[20,25], + "name":"class", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, + "range":[26,27], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, + "range":[26,27], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, + "range":[26,27], + "name":"A", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":29}}, + "range":[28,29], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":29}}, + "range":[28,29], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":29}}, + "range":[28,29], + "name":"", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export_invalid/export_type/migrated_0006.js b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0006.js new file mode 100644 index 0000000..e398ed2 --- /dev/null +++ b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0006.js @@ -0,0 +1 @@ +declare export type default number; diff --git a/lib/test/flow/types/declare_export_invalid/export_type/migrated_0006.tree.json b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0006.tree.json new file mode 100644 index 0000000..dfa2cde --- /dev/null +++ b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0006.tree.json @@ -0,0 +1,111 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":19}}, + "message":"`declare export type` is not supported. Use `export type` instead." + }, + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":19}}, + "message":"Unexpected token `type`, expected the token `{`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":34}}, + "message":"Missing comma between export specifiers" + }, + { + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, + "message":"Missing comma between export specifiers" + }, + { + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, + "message":"Unexpected token `;`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the token `}`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":27}}, + "message":"Unexpected token `default`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,36], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,36], + "default":false, + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":27}}, + "range":[20,27], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":27}}, + "range":[20,27], + "name":"default", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":27}}, + "range":[20,27], + "name":"default", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":34}}, + "range":[28,34], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":34}}, + "range":[28,34], + "name":"number", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":34}}, + "range":[28,34], + "name":"number", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, + "range":[34,35], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, + "range":[34,35], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, + "range":[34,35], + "name":"", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export_invalid/export_type/migrated_0007.js b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0007.js new file mode 100644 index 0000000..a9cb4f9 --- /dev/null +++ b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0007.js @@ -0,0 +1 @@ +declare export type default function foo(): void diff --git a/lib/test/flow/types/declare_export_invalid/export_type/migrated_0007.tree.json b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0007.tree.json new file mode 100644 index 0000000..0bb2dd7 --- /dev/null +++ b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0007.tree.json @@ -0,0 +1,227 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":19}}, + "message":"`declare export type` is not supported. Use `export type` instead." + }, + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":19}}, + "message":"Unexpected token `type`, expected the token `{`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":36}}, + "message":"Missing comma between export specifiers" + }, + { + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":40}}, + "message":"Missing comma between export specifiers" + }, + { + "loc":{"source":null,"start":{"line":1,"column":40},"end":{"line":1,"column":41}}, + "message":"Missing comma between export specifiers" + }, + { + "loc":{"source":null,"start":{"line":1,"column":40},"end":{"line":1,"column":41}}, + "message":"Unexpected token `(`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":42}}, + "message":"Missing comma between export specifiers" + }, + { + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":42}}, + "message":"Unexpected token `)`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":1,"column":42},"end":{"line":1,"column":43}}, + "message":"Missing comma between export specifiers" + }, + { + "loc":{"source":null,"start":{"line":1,"column":42},"end":{"line":1,"column":43}}, + "message":"Unexpected token `:`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":1,"column":44},"end":{"line":1,"column":48}}, + "message":"Missing comma between export specifiers" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the token `}`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":27}}, + "message":"Unexpected token `default`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":36}}, + "message":"Unexpected token `function`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":44},"end":{"line":1,"column":48}}, + "message":"Unexpected token `void`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,49], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,49], + "default":false, + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":27}}, + "range":[20,27], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":27}}, + "range":[20,27], + "name":"default", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":27}}, + "range":[20,27], + "name":"default", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":36}}, + "range":[28,36], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":36}}, + "range":[28,36], + "name":"function", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":36}}, + "range":[28,36], + "name":"function", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":40}}, + "range":[37,40], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":40}}, + "range":[37,40], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":40}}, + "range":[37,40], + "name":"foo", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":40},"end":{"line":1,"column":41}}, + "range":[40,41], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":40},"end":{"line":1,"column":41}}, + "range":[40,41], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":40},"end":{"line":1,"column":41}}, + "range":[40,41], + "name":"", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":42}}, + "range":[41,42], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":42}}, + "range":[41,42], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":42}}, + "range":[41,42], + "name":"", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":42},"end":{"line":1,"column":43}}, + "range":[42,43], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":42},"end":{"line":1,"column":43}}, + "range":[42,43], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":42},"end":{"line":1,"column":43}}, + "range":[42,43], + "name":"", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":44},"end":{"line":1,"column":48}}, + "range":[44,48], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":44},"end":{"line":1,"column":48}}, + "range":[44,48], + "name":"void", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":44},"end":{"line":1,"column":48}}, + "range":[44,48], + "name":"void", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export_invalid/export_type/migrated_0008.js b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0008.js new file mode 100644 index 0000000..765dc76 --- /dev/null +++ b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0008.js @@ -0,0 +1 @@ +declare export type default class A {} diff --git a/lib/test/flow/types/declare_export_invalid/export_type/migrated_0008.tree.json b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0008.tree.json new file mode 100644 index 0000000..0f185d4 --- /dev/null +++ b/lib/test/flow/types/declare_export_invalid/export_type/migrated_0008.tree.json @@ -0,0 +1,136 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":19}}, + "message":"`declare export type` is not supported. Use `export type` instead." + }, + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":19}}, + "message":"Unexpected token `type`, expected the token `{`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":33}}, + "message":"Missing comma between export specifiers" + }, + { + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, + "message":"Missing comma between export specifiers" + }, + { + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":37}}, + "message":"Missing comma between export specifiers" + }, + { + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":37}}, + "message":"Unexpected token `{`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":27}}, + "message":"Unexpected token `default`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":33}}, + "message":"Unexpected token `class`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "default":false, + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":27}}, + "range":[20,27], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":27}}, + "range":[20,27], + "name":"default", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":27}}, + "range":[20,27], + "name":"default", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":33}}, + "range":[28,33], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":33}}, + "range":[28,33], + "name":"class", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":33}}, + "range":[28,33], + "name":"class", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, + "range":[34,35], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, + "range":[34,35], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, + "range":[34,35], + "name":"A", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":37}}, + "range":[36,37], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":37}}, + "range":[36,37], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":37}}, + "range":[36,37], + "name":"", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export_invalid/let_const/migrated_0009.js b/lib/test/flow/types/declare_export_invalid/let_const/migrated_0009.js new file mode 100644 index 0000000..cffa3c6 --- /dev/null +++ b/lib/test/flow/types/declare_export_invalid/let_const/migrated_0009.js @@ -0,0 +1 @@ +declare export let foo: number diff --git a/lib/test/flow/types/declare_export_invalid/let_const/migrated_0009.tree.json b/lib/test/flow/types/declare_export_invalid/let_const/migrated_0009.tree.json new file mode 100644 index 0000000..13576e5 --- /dev/null +++ b/lib/test/flow/types/declare_export_invalid/let_const/migrated_0009.tree.json @@ -0,0 +1,48 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, + "message":"`declare export let` is not supported. Use `declare export var` instead." + }, + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, + "message":"Unexpected token `let`, expected the token `var`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "default":false, + "declaration":{ + "type":"DeclareVariable", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":30}}, + "range":[15,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":30}}, + "range":[19,30], + "name":"foo", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":30}}, + "range":[22,30], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":30}}, + "range":[24,30] + } + }, + "optional":false + } + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export_invalid/let_const/migrated_0010.js b/lib/test/flow/types/declare_export_invalid/let_const/migrated_0010.js new file mode 100644 index 0000000..8ee799d --- /dev/null +++ b/lib/test/flow/types/declare_export_invalid/let_const/migrated_0010.js @@ -0,0 +1 @@ +declare export const foo: number diff --git a/lib/test/flow/types/declare_export_invalid/let_const/migrated_0010.tree.json b/lib/test/flow/types/declare_export_invalid/let_const/migrated_0010.tree.json new file mode 100644 index 0000000..d7cb819 --- /dev/null +++ b/lib/test/flow/types/declare_export_invalid/let_const/migrated_0010.tree.json @@ -0,0 +1,48 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "message":"`declare export const` is not supported. Use `declare export var` instead." + }, + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "message":"Unexpected token `const`, expected the token `var`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "default":false, + "declaration":{ + "type":"DeclareVariable", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":32}}, + "range":[15,32], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":32}}, + "range":[21,32], + "name":"foo", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":32}}, + "range":[24,32], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":32}}, + "range":[26,32] + } + }, + "optional":false + } + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_export_invalid/migrated_0012.js b/lib/test/flow/types/declare_export_invalid/migrated_0012.js new file mode 100644 index 0000000..fb5540f --- /dev/null +++ b/lib/test/flow/types/declare_export_invalid/migrated_0012.js @@ -0,0 +1,2 @@ +// You must provide a return type +declare export function foo(); diff --git a/lib/test/flow/types/declare_export_invalid/migrated_0012.tree.json b/lib/test/flow/types/declare_export_invalid/migrated_0012.tree.json new file mode 100644 index 0000000..c75f6c3 --- /dev/null +++ b/lib/test/flow/types/declare_export_invalid/migrated_0012.tree.json @@ -0,0 +1,64 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":29},"end":{"line":2,"column":30}}, + "message":"Unexpected token `;`, expected the token `:`" + }, + { + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":0}}, + "message":"Unexpected end of input" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":30}}, + "range":[34,64], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":30}}, + "range":[34,64], + "default":false, + "declaration":{ + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":2,"column":15},"end":{"line":2,"column":30}}, + "range":[49,64], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":24},"end":{"line":3,"column":0}}, + "range":[58,65], + "name":"foo", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":27},"end":{"line":3,"column":0}}, + "range":[61,65], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":27},"end":{"line":3,"column":0}}, + "range":[61,65], + "params":[], + "returnType":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":0}}, + "range":[65,65] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + }, + "specifiers":[], + "source":null + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "value":" You must provide a return type" + } + ] +} diff --git a/lib/test/flow/types/declare_export_invalid/migrated_0014.js b/lib/test/flow/types/declare_export_invalid/migrated_0014.js new file mode 100644 index 0000000..9df3f24 --- /dev/null +++ b/lib/test/flow/types/declare_export_invalid/migrated_0014.js @@ -0,0 +1 @@ +declare export class A { static implements: number; implements: number } diff --git a/lib/test/flow/types/declare_export_invalid/migrated_0014.tree.json b/lib/test/flow/types/declare_export_invalid/migrated_0014.tree.json new file mode 100644 index 0000000..c25d1db --- /dev/null +++ b/lib/test/flow/types/declare_export_invalid/migrated_0014.tree.json @@ -0,0 +1,92 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":72}}, + "range":[0,72], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":72}}, + "range":[0,72], + "default":false, + "declaration":{ + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":72}}, + "range":[15,72], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":72}}, + "range":[23,72], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":50}}, + "range":[25,50], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":42}}, + "range":[32,42], + "name":"implements", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":44},"end":{"line":1,"column":50}}, + "range":[44,50] + }, + "method":false, + "optional":false, + "static":true, + "proto":false, + "variance":null, + "kind":"init" + }, + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":52},"end":{"line":1,"column":70}}, + "range":[52,70], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":52},"end":{"line":1,"column":62}}, + "range":[52,62], + "name":"implements", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":64},"end":{"line":1,"column":70}}, + "range":[64,70] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_interface/migrated_0000.js b/lib/test/flow/types/declare_interface/migrated_0000.js new file mode 100644 index 0000000..2204aad --- /dev/null +++ b/lib/test/flow/types/declare_interface/migrated_0000.js @@ -0,0 +1 @@ +declare interface A {} diff --git a/lib/test/flow/types/declare_interface/migrated_0000.tree.json b/lib/test/flow/types/declare_interface/migrated_0000.tree.json new file mode 100644 index 0000000..bc33610 --- /dev/null +++ b/lib/test/flow/types/declare_interface/migrated_0000.tree.json @@ -0,0 +1,33 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "body":[ + { + "type":"DeclareInterface", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "range":[20,22], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_interface/migrated_0001.js b/lib/test/flow/types/declare_interface/migrated_0001.js new file mode 100644 index 0000000..ab99102 --- /dev/null +++ b/lib/test/flow/types/declare_interface/migrated_0001.js @@ -0,0 +1 @@ +declare interface A {} diff --git a/lib/test/flow/types/declare_interface/migrated_0001.tree.json b/lib/test/flow/types/declare_interface/migrated_0001.tree.json new file mode 100644 index 0000000..ddecf6a --- /dev/null +++ b/lib/test/flow/types/declare_interface/migrated_0001.tree.json @@ -0,0 +1,57 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "body":[ + { + "type":"DeclareInterface", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":25}}, + "range":[19,25], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "name":"T", + "bound":null, + "variance":null, + "default":null + }, + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, + "range":[23,24], + "name":"S", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":28}}, + "range":[26,28], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_interface/migrated_0002.js b/lib/test/flow/types/declare_interface/migrated_0002.js new file mode 100644 index 0000000..afe5fc8 --- /dev/null +++ b/lib/test/flow/types/declare_interface/migrated_0002.js @@ -0,0 +1 @@ +declare interface A { foo: number; } diff --git a/lib/test/flow/types/declare_interface/migrated_0002.tree.json b/lib/test/flow/types/declare_interface/migrated_0002.tree.json new file mode 100644 index 0000000..caee2f6 --- /dev/null +++ b/lib/test/flow/types/declare_interface/migrated_0002.tree.json @@ -0,0 +1,58 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "body":[ + { + "type":"DeclareInterface", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":36}}, + "range":[20,36], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":33}}, + "range":[22,33], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":25}}, + "range":[22,25], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":33}}, + "range":[27,33] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_interface/migrated_0003.js b/lib/test/flow/types/declare_interface/migrated_0003.js new file mode 100644 index 0000000..b6855f4 --- /dev/null +++ b/lib/test/flow/types/declare_interface/migrated_0003.js @@ -0,0 +1 @@ +declare interface A extends B {} diff --git a/lib/test/flow/types/declare_interface/migrated_0003.tree.json b/lib/test/flow/types/declare_interface/migrated_0003.tree.json new file mode 100644 index 0000000..612a884 --- /dev/null +++ b/lib/test/flow/types/declare_interface/migrated_0003.tree.json @@ -0,0 +1,48 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "body":[ + { + "type":"DeclareInterface", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":32}}, + "range":[30,32], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[ + { + "type":"InterfaceExtends", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":29}}, + "range":[28,29], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":29}}, + "range":[28,29], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_interface/migrated_0004.js b/lib/test/flow/types/declare_interface/migrated_0004.js new file mode 100644 index 0000000..e5d4fd2 --- /dev/null +++ b/lib/test/flow/types/declare_interface/migrated_0004.js @@ -0,0 +1 @@ +declare interface A extends B, C {} diff --git a/lib/test/flow/types/declare_interface/migrated_0004.tree.json b/lib/test/flow/types/declare_interface/migrated_0004.tree.json new file mode 100644 index 0000000..861139f --- /dev/null +++ b/lib/test/flow/types/declare_interface/migrated_0004.tree.json @@ -0,0 +1,62 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "body":[ + { + "type":"DeclareInterface", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":35}}, + "range":[33,35], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[ + { + "type":"InterfaceExtends", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":29}}, + "range":[28,29], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":29}}, + "range":[28,29], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + { + "type":"InterfaceExtends", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":32}}, + "range":[31,32], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":32}}, + "range":[31,32], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_interface/migrated_0005.js b/lib/test/flow/types/declare_interface/migrated_0005.js new file mode 100644 index 0000000..a89ef8d --- /dev/null +++ b/lib/test/flow/types/declare_interface/migrated_0005.js @@ -0,0 +1 @@ +declare interface A extends B {} diff --git a/lib/test/flow/types/declare_interface/migrated_0005.tree.json b/lib/test/flow/types/declare_interface/migrated_0005.tree.json new file mode 100644 index 0000000..54838c2 --- /dev/null +++ b/lib/test/flow/types/declare_interface/migrated_0005.tree.json @@ -0,0 +1,83 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "body":[ + { + "type":"DeclareInterface", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, + "range":[19,22], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":38}}, + "range":[36,38], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[ + { + "type":"InterfaceExtends", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":35}}, + "range":[31,35], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":32}}, + "range":[31,32], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":35}}, + "range":[32,35], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":34}}, + "range":[33,34], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":34}}, + "range":[33,34], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + } + ] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_interface/migrated_0010.js b/lib/test/flow/types/declare_interface/migrated_0010.js new file mode 100644 index 0000000..a8d3dd8 --- /dev/null +++ b/lib/test/flow/types/declare_interface/migrated_0010.js @@ -0,0 +1 @@ +declare interface A {numVal: number; [index: number]: string}; diff --git a/lib/test/flow/types/declare_interface/migrated_0010.tree.json b/lib/test/flow/types/declare_interface/migrated_0010.tree.json new file mode 100644 index 0000000..2ed03ad --- /dev/null +++ b/lib/test/flow/types/declare_interface/migrated_0010.tree.json @@ -0,0 +1,89 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":62}}, + "range":[0,62], + "body":[ + { + "type":"DeclareInterface", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":61}}, + "range":[0,61], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":61}}, + "range":[20,61], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":35}}, + "range":[21,35], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "range":[21,27], + "name":"numVal", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":35}}, + "range":[29,35] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[ + { + "type":"ObjectTypeIndexer", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":60}}, + "range":[37,60], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":43}}, + "range":[38,43], + "name":"index", + "typeAnnotation":null, + "optional":false + }, + "key":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":45},"end":{"line":1,"column":51}}, + "range":[45,51] + }, + "value":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":54},"end":{"line":1,"column":60}}, + "range":[54,60] + }, + "static":false, + "variance":null + } + ], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + }, + { + "type":"EmptyStatement", + "loc":{"source":null,"start":{"line":1,"column":61},"end":{"line":1,"column":62}}, + "range":[61,62] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_interface/migrated_0011.js b/lib/test/flow/types/declare_interface/migrated_0011.js new file mode 100644 index 0000000..ce5e73a --- /dev/null +++ b/lib/test/flow/types/declare_interface/migrated_0011.js @@ -0,0 +1 @@ +declare interface A {[index: number]: string; [index2: string]: number}; diff --git a/lib/test/flow/types/declare_interface/migrated_0011.tree.json b/lib/test/flow/types/declare_interface/migrated_0011.tree.json new file mode 100644 index 0000000..f55e396 --- /dev/null +++ b/lib/test/flow/types/declare_interface/migrated_0011.tree.json @@ -0,0 +1,89 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":72}}, + "range":[0,72], + "body":[ + { + "type":"DeclareInterface", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":71}}, + "range":[0,71], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":71}}, + "range":[20,71], + "exact":false, + "properties":[], + "indexers":[ + { + "type":"ObjectTypeIndexer", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":44}}, + "range":[21,44], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":27}}, + "range":[22,27], + "name":"index", + "typeAnnotation":null, + "optional":false + }, + "key":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":35}}, + "range":[29,35] + }, + "value":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":44}}, + "range":[38,44] + }, + "static":false, + "variance":null + }, + { + "type":"ObjectTypeIndexer", + "loc":{"source":null,"start":{"line":1,"column":46},"end":{"line":1,"column":70}}, + "range":[46,70], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":47},"end":{"line":1,"column":53}}, + "range":[47,53], + "name":"index2", + "typeAnnotation":null, + "optional":false + }, + "key":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":55},"end":{"line":1,"column":61}}, + "range":[55,61] + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":64},"end":{"line":1,"column":70}}, + "range":[64,70] + }, + "static":false, + "variance":null + } + ], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + }, + { + "type":"EmptyStatement", + "loc":{"source":null,"start":{"line":1,"column":71},"end":{"line":1,"column":72}}, + "range":[71,72] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_module/migrated_0000.js b/lib/test/flow/types/declare_module/migrated_0000.js new file mode 100644 index 0000000..9f49911 --- /dev/null +++ b/lib/test/flow/types/declare_module/migrated_0000.js @@ -0,0 +1 @@ +declare module A {} diff --git a/lib/test/flow/types/declare_module/migrated_0000.tree.json b/lib/test/flow/types/declare_module/migrated_0000.tree.json new file mode 100644 index 0000000..c3f48f3 --- /dev/null +++ b/lib/test/flow/types/declare_module/migrated_0000.tree.json @@ -0,0 +1,28 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "range":[0,19], + "body":[ + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "range":[0,19], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, + "range":[17,19], + "body":[] + }, + "kind":"CommonJS" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_module/migrated_0001.js b/lib/test/flow/types/declare_module/migrated_0001.js new file mode 100644 index 0000000..16e8b4f --- /dev/null +++ b/lib/test/flow/types/declare_module/migrated_0001.js @@ -0,0 +1 @@ +declare module "./a/b.js" {} diff --git a/lib/test/flow/types/declare_module/migrated_0001.tree.json b/lib/test/flow/types/declare_module/migrated_0001.tree.json new file mode 100644 index 0000000..88d26d9 --- /dev/null +++ b/lib/test/flow/types/declare_module/migrated_0001.tree.json @@ -0,0 +1,27 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "body":[ + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "id":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":25}}, + "range":[15,25], + "value":"./a/b.js", + "raw":"\"./a/b.js\"" + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":28}}, + "range":[26,28], + "body":[] + }, + "kind":"CommonJS" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_module/migrated_0002.js b/lib/test/flow/types/declare_module/migrated_0002.js new file mode 100644 index 0000000..58b3335 --- /dev/null +++ b/lib/test/flow/types/declare_module/migrated_0002.js @@ -0,0 +1 @@ +declare module "M" { import type T from "TM"; } diff --git a/lib/test/flow/types/declare_module/migrated_0002.tree.json b/lib/test/flow/types/declare_module/migrated_0002.tree.json new file mode 100644 index 0000000..33e6b33 --- /dev/null +++ b/lib/test/flow/types/declare_module/migrated_0002.tree.json @@ -0,0 +1,56 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "range":[0,47], + "body":[ + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "range":[0,47], + "id":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, + "range":[15,18], + "value":"M", + "raw":"\"M\"" + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":47}}, + "range":[19,47], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":45}}, + "range":[21,45], + "specifiers":[ + { + "type":"ImportDefaultSpecifier", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":34}}, + "range":[33,34], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":34}}, + "range":[33,34], + "name":"T", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":40},"end":{"line":1,"column":44}}, + "range":[40,44], + "value":"TM", + "raw":"\"TM\"" + }, + "importKind":"type" + } + ] + }, + "kind":"CommonJS" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_module/migrated_0003.js b/lib/test/flow/types/declare_module/migrated_0003.js new file mode 100644 index 0000000..8480a76 --- /dev/null +++ b/lib/test/flow/types/declare_module/migrated_0003.js @@ -0,0 +1,2 @@ +declare module A {} +declare module B {} diff --git a/lib/test/flow/types/declare_module/migrated_0003.tree.json b/lib/test/flow/types/declare_module/migrated_0003.tree.json new file mode 100644 index 0000000..2b019bc --- /dev/null +++ b/lib/test/flow/types/declare_module/migrated_0003.tree.json @@ -0,0 +1,48 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":19}}, + "range":[0,39], + "body":[ + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "range":[0,19], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, + "range":[17,19], + "body":[] + }, + "kind":"CommonJS" + }, + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":19}}, + "range":[20,39], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":15},"end":{"line":2,"column":16}}, + "range":[35,36], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":19}}, + "range":[37,39], + "body":[] + }, + "kind":"CommonJS" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_module_exports/migrated_0000.js b/lib/test/flow/types/declare_module_exports/migrated_0000.js new file mode 100644 index 0000000..d2c141c --- /dev/null +++ b/lib/test/flow/types/declare_module_exports/migrated_0000.js @@ -0,0 +1 @@ +declare module.exports: number diff --git a/lib/test/flow/types/declare_module_exports/migrated_0000.tree.json b/lib/test/flow/types/declare_module_exports/migrated_0000.tree.json new file mode 100644 index 0000000..13fae3b --- /dev/null +++ b/lib/test/flow/types/declare_module_exports/migrated_0000.tree.json @@ -0,0 +1,23 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "body":[ + { + "type":"DeclareModuleExports", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":30}}, + "range":[22,30], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":30}}, + "range":[24,30] + } + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_module_exports/migrated_0001.js b/lib/test/flow/types/declare_module_exports/migrated_0001.js new file mode 100644 index 0000000..a2cfb7b --- /dev/null +++ b/lib/test/flow/types/declare_module_exports/migrated_0001.js @@ -0,0 +1 @@ +declare module "foo" { declare module.exports: number; } diff --git a/lib/test/flow/types/declare_module_exports/migrated_0001.tree.json b/lib/test/flow/types/declare_module_exports/migrated_0001.tree.json new file mode 100644 index 0000000..0e8d35c --- /dev/null +++ b/lib/test/flow/types/declare_module_exports/migrated_0001.tree.json @@ -0,0 +1,43 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, + "range":[0,56], + "body":[ + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, + "range":[0,56], + "id":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "range":[15,20], + "value":"foo", + "raw":"\"foo\"" + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":56}}, + "range":[21,56], + "body":[ + { + "type":"DeclareModuleExports", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":54}}, + "range":[23,54], + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":45},"end":{"line":1,"column":53}}, + "range":[45,53], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":47},"end":{"line":1,"column":53}}, + "range":[47,53] + } + } + } + ] + }, + "kind":"CommonJS" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_module_exports_invalid/migrated_0000.js b/lib/test/flow/types/declare_module_exports_invalid/migrated_0000.js new file mode 100644 index 0000000..ab4eecd --- /dev/null +++ b/lib/test/flow/types/declare_module_exports_invalid/migrated_0000.js @@ -0,0 +1 @@ +declare module.exports diff --git a/lib/test/flow/types/declare_module_exports_invalid/migrated_0000.tree.json b/lib/test/flow/types/declare_module_exports_invalid/migrated_0000.tree.json new file mode 100644 index 0000000..72c0c88 --- /dev/null +++ b/lib/test/flow/types/declare_module_exports_invalid/migrated_0000.tree.json @@ -0,0 +1,33 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the token `:`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,23], + "body":[ + { + "type":"DeclareModuleExports", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,23], + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "range":[23,23], + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "range":[23,23] + } + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_module_exports_invalid/migrated_0001.js b/lib/test/flow/types/declare_module_exports_invalid/migrated_0001.js new file mode 100644 index 0000000..fda57ee --- /dev/null +++ b/lib/test/flow/types/declare_module_exports_invalid/migrated_0001.js @@ -0,0 +1 @@ +declare module "foo" { declare module.exports: number; declare module.exports: string; } diff --git a/lib/test/flow/types/declare_module_exports_invalid/migrated_0001.tree.json b/lib/test/flow/types/declare_module_exports_invalid/migrated_0001.tree.json new file mode 100644 index 0000000..3e1c87d --- /dev/null +++ b/lib/test/flow/types/declare_module_exports_invalid/migrated_0001.tree.json @@ -0,0 +1,64 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":87},"end":{"line":1,"column":88}}, + "message":"Duplicate `declare module.exports` statement!" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":88}}, + "range":[0,88], + "body":[ + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":88}}, + "range":[0,88], + "id":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "range":[15,20], + "value":"foo", + "raw":"\"foo\"" + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":88}}, + "range":[21,88], + "body":[ + { + "type":"DeclareModuleExports", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":54}}, + "range":[23,54], + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":45},"end":{"line":1,"column":53}}, + "range":[45,53], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":47},"end":{"line":1,"column":53}}, + "range":[47,53] + } + } + }, + { + "type":"DeclareModuleExports", + "loc":{"source":null,"start":{"line":1,"column":55},"end":{"line":1,"column":86}}, + "range":[55,86], + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":77},"end":{"line":1,"column":85}}, + "range":[77,85], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":79},"end":{"line":1,"column":85}}, + "range":[79,85] + } + } + } + ] + }, + "kind":"CommonJS" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_module_invalid/migrated_0000.js b/lib/test/flow/types/declare_module_invalid/migrated_0000.js new file mode 100644 index 0000000..df5e693 --- /dev/null +++ b/lib/test/flow/types/declare_module_invalid/migrated_0000.js @@ -0,0 +1 @@ +declare Module A {} diff --git a/lib/test/flow/types/declare_module_invalid/migrated_0000.tree.json b/lib/test/flow/types/declare_module_invalid/migrated_0000.tree.json new file mode 100644 index 0000000..c05e41c --- /dev/null +++ b/lib/test/flow/types/declare_module_invalid/migrated_0000.tree.json @@ -0,0 +1,70 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, + "message":"Unexpected identifier, expected the end of an expression statement (`;`)" + }, + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "message":"Unexpected identifier, expected the end of an expression statement (`;`)" + }, + { + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "message":"Unexpected token `{`, expected the end of an expression statement (`;`)" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "range":[0,19], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "range":[0,7], + "name":"declare", + "typeAnnotation":null, + "optional":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, + "range":[8,14], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, + "range":[8,14], + "name":"Module", + "typeAnnotation":null, + "optional":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "directive":null + }, + { + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, + "range":[17,19], + "body":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_module_invalid/migrated_0001.js b/lib/test/flow/types/declare_module_invalid/migrated_0001.js new file mode 100644 index 0000000..9f79e4c --- /dev/null +++ b/lib/test/flow/types/declare_module_invalid/migrated_0001.js @@ -0,0 +1 @@ +declare module {} diff --git a/lib/test/flow/types/declare_module_invalid/migrated_0001.tree.json b/lib/test/flow/types/declare_module_invalid/migrated_0001.tree.json new file mode 100644 index 0000000..fe5455a --- /dev/null +++ b/lib/test/flow/types/declare_module_invalid/migrated_0001.tree.json @@ -0,0 +1,42 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "message":"Unexpected token `{`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "message":"Unexpected token `}`, expected the token `{`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the token `}`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,18], + "body":[ + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,18], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":2,"column":0}}, + "range":[16,18], + "body":[] + }, + "kind":"CommonJS" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_module_invalid/migrated_0002.js b/lib/test/flow/types/declare_module_invalid/migrated_0002.js new file mode 100644 index 0000000..7b0be34 --- /dev/null +++ b/lib/test/flow/types/declare_module_invalid/migrated_0002.js @@ -0,0 +1 @@ +declare module A { declare module B {} } diff --git a/lib/test/flow/types/declare_module_invalid/migrated_0002.tree.json b/lib/test/flow/types/declare_module_invalid/migrated_0002.tree.json new file mode 100644 index 0000000..3a9738a --- /dev/null +++ b/lib/test/flow/types/declare_module_invalid/migrated_0002.tree.json @@ -0,0 +1,62 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, + "message":"Unexpected identifier, expected the token `.`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":37}}, + "message":"Unexpected token `{`, expected the identifier `exports`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":38}}, + "message":"Unexpected token `}`, expected the token `:`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":40}}, + "message":"Unexpected token `}`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "range":[0,40], + "body":[ + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "range":[0,40], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":40}}, + "range":[17,40], + "body":[ + { + "type":"DeclareModuleExports", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":38}}, + "range":[19,38], + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":38}}, + "range":[37,38], + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":40}}, + "range":[39,40] + } + } + } + ] + }, + "kind":"CommonJS" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_module_invalid/migrated_0003.js b/lib/test/flow/types/declare_module_invalid/migrated_0003.js new file mode 100644 index 0000000..daaac06 --- /dev/null +++ b/lib/test/flow/types/declare_module_invalid/migrated_0003.js @@ -0,0 +1 @@ +declare module A { export default function foo() {} } diff --git a/lib/test/flow/types/declare_module_invalid/migrated_0003.tree.json b/lib/test/flow/types/declare_module_invalid/migrated_0003.tree.json new file mode 100644 index 0000000..fe64183 --- /dev/null +++ b/lib/test/flow/types/declare_module_invalid/migrated_0003.tree.json @@ -0,0 +1,118 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":25}}, + "message":"Unexpected token `export`, expected the token `declare`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":33}}, + "message":"Unexpected token `default`, expected the token `var`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":42}}, + "message":"Unexpected token `function`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":43},"end":{"line":1,"column":46}}, + "message":"Unexpected identifier, expected the token `;`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":43},"end":{"line":1,"column":46}}, + "message":"Unexpected identifier, expected the token `declare`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":46},"end":{"line":1,"column":47}}, + "message":"Unexpected token `(`, expected the token `var`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":47},"end":{"line":1,"column":48}}, + "message":"Unexpected token `)`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":1,"column":49},"end":{"line":1,"column":50}}, + "message":"Unexpected token `{`, expected the token `;`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":49},"end":{"line":1,"column":50}}, + "message":"Unexpected token `{`, expected the token `declare`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":50},"end":{"line":1,"column":51}}, + "message":"Unexpected token `}`, expected the token `var`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":52},"end":{"line":1,"column":53}}, + "message":"Unexpected token `}`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the token `}`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,54], + "body":[ + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,54], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":2,"column":0}}, + "range":[17,54], + "body":[ + { + "type":"DeclareVariable", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":42}}, + "range":[19,42], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":42}}, + "range":[34,42], + "name":"function", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"DeclareVariable", + "loc":{"source":null,"start":{"line":1,"column":43},"end":{"line":1,"column":48}}, + "range":[43,48], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":47},"end":{"line":1,"column":48}}, + "range":[47,48], + "name":"", + "typeAnnotation":null, + "optional":false + } + }, + { + "type":"DeclareVariable", + "loc":{"source":null,"start":{"line":1,"column":49},"end":{"line":1,"column":53}}, + "range":[49,53], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":52},"end":{"line":1,"column":53}}, + "range":[52,53], + "name":"", + "typeAnnotation":null, + "optional":false + } + } + ] + }, + "kind":"CommonJS" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_module_invalid/migrated_0004.js b/lib/test/flow/types/declare_module_invalid/migrated_0004.js new file mode 100644 index 0000000..111a0c6 --- /dev/null +++ b/lib/test/flow/types/declare_module_invalid/migrated_0004.js @@ -0,0 +1 @@ +declare module "foo" { declare export var a: number; declare module.exports: number; } diff --git a/lib/test/flow/types/declare_module_invalid/migrated_0004.tree.json b/lib/test/flow/types/declare_module_invalid/migrated_0004.tree.json new file mode 100644 index 0000000..c6dd35e --- /dev/null +++ b/lib/test/flow/types/declare_module_invalid/migrated_0004.tree.json @@ -0,0 +1,79 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":85},"end":{"line":1,"column":86}}, + "message":"Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module xor they are a CommonJS module." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":86}}, + "range":[0,86], + "body":[ + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":86}}, + "range":[0,86], + "id":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "range":[15,20], + "value":"foo", + "raw":"\"foo\"" + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":86}}, + "range":[21,86], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":52}}, + "range":[23,52], + "default":false, + "declaration":{ + "type":"DeclareVariable", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":52}}, + "range":[38,52], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":42},"end":{"line":1,"column":51}}, + "range":[42,51], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":43},"end":{"line":1,"column":51}}, + "range":[43,51], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":45},"end":{"line":1,"column":51}}, + "range":[45,51] + } + }, + "optional":false + } + }, + "specifiers":[], + "source":null + }, + { + "type":"DeclareModuleExports", + "loc":{"source":null,"start":{"line":1,"column":53},"end":{"line":1,"column":84}}, + "range":[53,84], + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":75},"end":{"line":1,"column":83}}, + "range":[75,83], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":77},"end":{"line":1,"column":83}}, + "range":[77,83] + } + } + } + ] + }, + "kind":"ES" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_module_invalid/migrated_0005.js b/lib/test/flow/types/declare_module_invalid/migrated_0005.js new file mode 100644 index 0000000..fd091d4 --- /dev/null +++ b/lib/test/flow/types/declare_module_invalid/migrated_0005.js @@ -0,0 +1 @@ +declare module "M" { import T from "TM"; } diff --git a/lib/test/flow/types/declare_module_invalid/migrated_0005.tree.json b/lib/test/flow/types/declare_module_invalid/migrated_0005.tree.json new file mode 100644 index 0000000..275d66e --- /dev/null +++ b/lib/test/flow/types/declare_module_invalid/migrated_0005.tree.json @@ -0,0 +1,61 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "message":"Imports within a `declare module` body must always be `import type` or `import typeof`!" + }, + { + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":29}}, + "message":"Unexpected identifier, expected the token `(`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":39}}, + "message":"Unexpected string, expected the token `)`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "range":[0,42], + "body":[ + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "range":[0,42], + "id":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, + "range":[15,18], + "value":"M", + "raw":"\"M\"" + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":42}}, + "range":[19,42], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":40}}, + "range":[21,40], + "expression":{ + "type":"ImportExpression", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":39}}, + "range":[21,39], + "source":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":34}}, + "range":[30,34], + "name":"from", + "typeAnnotation":null, + "optional":false + } + }, + "directive":null + } + ] + }, + "kind":"CommonJS" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_module_with_exports/export_type_with_parens.js b/lib/test/flow/types/declare_module_with_exports/export_type_with_parens.js new file mode 100644 index 0000000..e274e44 --- /dev/null +++ b/lib/test/flow/types/declare_module_with_exports/export_type_with_parens.js @@ -0,0 +1,3 @@ +declare module Foo { + declare export type foo = (string); +} diff --git a/lib/test/flow/types/declare_module_with_exports/export_type_with_parens.tree.json b/lib/test/flow/types/declare_module_with_exports/export_type_with_parens.tree.json new file mode 100644 index 0000000..0c33bcf --- /dev/null +++ b/lib/test/flow/types/declare_module_with_exports/export_type_with_parens.tree.json @@ -0,0 +1,56 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,60], + "body":[ + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,60], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, + "range":[15,18], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":3,"column":1}}, + "range":[19,60], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":37}}, + "range":[23,58], + "default":false, + "declaration":{ + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":37}}, + "range":[38,58], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":22},"end":{"line":2,"column":25}}, + "range":[43,46], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":29},"end":{"line":2,"column":35}}, + "range":[50,56] + } + }, + "specifiers":[], + "source":null + } + ] + }, + "kind":"CommonJS" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_module_with_exports/export_type_with_parens_no_semi.js b/lib/test/flow/types/declare_module_with_exports/export_type_with_parens_no_semi.js new file mode 100644 index 0000000..9a87cbb --- /dev/null +++ b/lib/test/flow/types/declare_module_with_exports/export_type_with_parens_no_semi.js @@ -0,0 +1,3 @@ +declare module Foo { + declare export type foo = (string) +} diff --git a/lib/test/flow/types/declare_module_with_exports/export_type_with_parens_no_semi.tree.json b/lib/test/flow/types/declare_module_with_exports/export_type_with_parens_no_semi.tree.json new file mode 100644 index 0000000..45368be --- /dev/null +++ b/lib/test/flow/types/declare_module_with_exports/export_type_with_parens_no_semi.tree.json @@ -0,0 +1,56 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,59], + "body":[ + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,59], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, + "range":[15,18], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":3,"column":1}}, + "range":[19,59], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":36}}, + "range":[23,57], + "default":false, + "declaration":{ + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":36}}, + "range":[38,57], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":22},"end":{"line":2,"column":25}}, + "range":[43,46], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":29},"end":{"line":2,"column":35}}, + "range":[50,56] + } + }, + "specifiers":[], + "source":null + } + ] + }, + "kind":"CommonJS" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_module_with_exports/migrated_0000.js b/lib/test/flow/types/declare_module_with_exports/migrated_0000.js new file mode 100644 index 0000000..25be792 --- /dev/null +++ b/lib/test/flow/types/declare_module_with_exports/migrated_0000.js @@ -0,0 +1 @@ +declare module "foo" { declare export * from "bar"; } diff --git a/lib/test/flow/types/declare_module_with_exports/migrated_0000.tree.json b/lib/test/flow/types/declare_module_with_exports/migrated_0000.tree.json new file mode 100644 index 0000000..b72e894 --- /dev/null +++ b/lib/test/flow/types/declare_module_with_exports/migrated_0000.tree.json @@ -0,0 +1,40 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "range":[0,53], + "body":[ + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "range":[0,53], + "id":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "range":[15,20], + "value":"foo", + "raw":"\"foo\"" + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":53}}, + "range":[21,53], + "body":[ + { + "type":"DeclareExportAllDeclaration", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":51}}, + "range":[23,51], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":45},"end":{"line":1,"column":50}}, + "range":[45,50], + "value":"bar", + "raw":"\"bar\"" + } + } + ] + }, + "kind":"ES" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_module_with_exports/migrated_0001.js b/lib/test/flow/types/declare_module_with_exports/migrated_0001.js new file mode 100644 index 0000000..516e8e2 --- /dev/null +++ b/lib/test/flow/types/declare_module_with_exports/migrated_0001.js @@ -0,0 +1 @@ +declare module "foo" { declare export {a,} from "bar"; } diff --git a/lib/test/flow/types/declare_module_with_exports/migrated_0001.tree.json b/lib/test/flow/types/declare_module_with_exports/migrated_0001.tree.json new file mode 100644 index 0000000..e9c0617 --- /dev/null +++ b/lib/test/flow/types/declare_module_with_exports/migrated_0001.tree.json @@ -0,0 +1,65 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, + "range":[0,56], + "body":[ + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, + "range":[0,56], + "id":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "range":[15,20], + "value":"foo", + "raw":"\"foo\"" + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":56}}, + "range":[21,56], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":54}}, + "range":[23,54], + "default":false, + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":40}}, + "range":[39,40], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":40}}, + "range":[39,40], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":40}}, + "range":[39,40], + "name":"a", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":48},"end":{"line":1,"column":53}}, + "range":[48,53], + "value":"bar", + "raw":"\"bar\"" + } + } + ] + }, + "kind":"ES" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_module_with_exports/migrated_0002.js b/lib/test/flow/types/declare_module_with_exports/migrated_0002.js new file mode 100644 index 0000000..6a25a18 --- /dev/null +++ b/lib/test/flow/types/declare_module_with_exports/migrated_0002.js @@ -0,0 +1 @@ +declare module "foo" { declare export {a,}; } diff --git a/lib/test/flow/types/declare_module_with_exports/migrated_0002.tree.json b/lib/test/flow/types/declare_module_with_exports/migrated_0002.tree.json new file mode 100644 index 0000000..3446ce7 --- /dev/null +++ b/lib/test/flow/types/declare_module_with_exports/migrated_0002.tree.json @@ -0,0 +1,59 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "range":[0,45], + "body":[ + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "range":[0,45], + "id":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "range":[15,20], + "value":"foo", + "raw":"\"foo\"" + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":45}}, + "range":[21,45], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":43}}, + "range":[23,43], + "default":false, + "declaration":null, + "specifiers":[ + { + "type":"ExportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":40}}, + "range":[39,40], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":40}}, + "range":[39,40], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "exported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":40}}, + "range":[39,40], + "name":"a", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":null + } + ] + }, + "kind":"ES" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_module_with_exports/migrated_0003.js b/lib/test/flow/types/declare_module_with_exports/migrated_0003.js new file mode 100644 index 0000000..b14a9dd --- /dev/null +++ b/lib/test/flow/types/declare_module_with_exports/migrated_0003.js @@ -0,0 +1 @@ +declare module "foo" { declare export var a: number; } diff --git a/lib/test/flow/types/declare_module_with_exports/migrated_0003.tree.json b/lib/test/flow/types/declare_module_with_exports/migrated_0003.tree.json new file mode 100644 index 0000000..b956b86 --- /dev/null +++ b/lib/test/flow/types/declare_module_with_exports/migrated_0003.tree.json @@ -0,0 +1,58 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, + "range":[0,54], + "body":[ + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, + "range":[0,54], + "id":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "range":[15,20], + "value":"foo", + "raw":"\"foo\"" + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":54}}, + "range":[21,54], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":52}}, + "range":[23,52], + "default":false, + "declaration":{ + "type":"DeclareVariable", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":52}}, + "range":[38,52], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":42},"end":{"line":1,"column":51}}, + "range":[42,51], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":43},"end":{"line":1,"column":51}}, + "range":[43,51], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":45},"end":{"line":1,"column":51}}, + "range":[45,51] + } + }, + "optional":false + } + }, + "specifiers":[], + "source":null + } + ] + }, + "kind":"ES" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_module_with_exports/migrated_0004.js b/lib/test/flow/types/declare_module_with_exports/migrated_0004.js new file mode 100644 index 0000000..4b0b254 --- /dev/null +++ b/lib/test/flow/types/declare_module_with_exports/migrated_0004.js @@ -0,0 +1 @@ +declare module "foo" { declare export function bar(p1: number): string; } diff --git a/lib/test/flow/types/declare_module_with_exports/migrated_0004.tree.json b/lib/test/flow/types/declare_module_with_exports/migrated_0004.tree.json new file mode 100644 index 0000000..00e291a --- /dev/null +++ b/lib/test/flow/types/declare_module_with_exports/migrated_0004.tree.json @@ -0,0 +1,87 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":73}}, + "range":[0,73], + "body":[ + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":73}}, + "range":[0,73], + "id":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "range":[15,20], + "value":"foo", + "raw":"\"foo\"" + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":73}}, + "range":[21,73], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":71}}, + "range":[23,71], + "default":false, + "declaration":{ + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":71}}, + "range":[38,71], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":47},"end":{"line":1,"column":70}}, + "range":[47,70], + "name":"bar", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":50},"end":{"line":1,"column":70}}, + "range":[50,70], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":50},"end":{"line":1,"column":70}}, + "range":[50,70], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":51},"end":{"line":1,"column":61}}, + "range":[51,61], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":51},"end":{"line":1,"column":53}}, + "range":[51,53], + "name":"p1", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":55},"end":{"line":1,"column":61}}, + "range":[55,61] + }, + "optional":false + } + ], + "returnType":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":64},"end":{"line":1,"column":70}}, + "range":[64,70] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + }, + "specifiers":[], + "source":null + } + ] + }, + "kind":"ES" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_module_with_exports/migrated_0005.js b/lib/test/flow/types/declare_module_with_exports/migrated_0005.js new file mode 100644 index 0000000..07165a0 --- /dev/null +++ b/lib/test/flow/types/declare_module_with_exports/migrated_0005.js @@ -0,0 +1 @@ +declare module "foo" { declare export class Foo { meth(p1: number): void; } } diff --git a/lib/test/flow/types/declare_module_with_exports/migrated_0005.tree.json b/lib/test/flow/types/declare_module_with_exports/migrated_0005.tree.json new file mode 100644 index 0000000..def85d5 --- /dev/null +++ b/lib/test/flow/types/declare_module_with_exports/migrated_0005.tree.json @@ -0,0 +1,116 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":77}}, + "range":[0,77], + "body":[ + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":77}}, + "range":[0,77], + "id":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "range":[15,20], + "value":"foo", + "raw":"\"foo\"" + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":77}}, + "range":[21,77], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":75}}, + "range":[23,75], + "default":false, + "declaration":{ + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":75}}, + "range":[38,75], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":44},"end":{"line":1,"column":47}}, + "range":[44,47], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":48},"end":{"line":1,"column":75}}, + "range":[48,75], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":50},"end":{"line":1,"column":72}}, + "range":[50,72], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":50},"end":{"line":1,"column":54}}, + "range":[50,54], + "name":"meth", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":50},"end":{"line":1,"column":72}}, + "range":[50,72], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":55},"end":{"line":1,"column":65}}, + "range":[55,65], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":55},"end":{"line":1,"column":57}}, + "range":[55,57], + "name":"p1", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":59},"end":{"line":1,"column":65}}, + "range":[59,65] + }, + "optional":false + } + ], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":68},"end":{"line":1,"column":72}}, + "range":[68,72] + }, + "rest":null, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + }, + "specifiers":[], + "source":null + } + ] + }, + "kind":"ES" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_module_with_exports/migrated_0006.js b/lib/test/flow/types/declare_module_with_exports/migrated_0006.js new file mode 100644 index 0000000..422ea55 --- /dev/null +++ b/lib/test/flow/types/declare_module_with_exports/migrated_0006.js @@ -0,0 +1 @@ +declare module "foo" { declare export type bar = number; } diff --git a/lib/test/flow/types/declare_module_with_exports/migrated_0006.tree.json b/lib/test/flow/types/declare_module_with_exports/migrated_0006.tree.json new file mode 100644 index 0000000..9d4a466 --- /dev/null +++ b/lib/test/flow/types/declare_module_with_exports/migrated_0006.tree.json @@ -0,0 +1,55 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "range":[0,58], + "body":[ + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "range":[0,58], + "id":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "range":[15,20], + "value":"foo", + "raw":"\"foo\"" + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":58}}, + "range":[21,58], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":56}}, + "range":[23,56], + "default":false, + "declaration":{ + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":56}}, + "range":[38,56], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":43},"end":{"line":1,"column":46}}, + "range":[43,46], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":49},"end":{"line":1,"column":55}}, + "range":[49,55] + } + }, + "specifiers":[], + "source":null + } + ] + }, + "kind":"CommonJS" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_module_with_exports/migrated_0007.js b/lib/test/flow/types/declare_module_with_exports/migrated_0007.js new file mode 100644 index 0000000..f4de1e1 --- /dev/null +++ b/lib/test/flow/types/declare_module_with_exports/migrated_0007.js @@ -0,0 +1 @@ +declare module "foo" { declare export type bar = number; declare export var baz: number; } diff --git a/lib/test/flow/types/declare_module_with_exports/migrated_0007.tree.json b/lib/test/flow/types/declare_module_with_exports/migrated_0007.tree.json new file mode 100644 index 0000000..d6322ce --- /dev/null +++ b/lib/test/flow/types/declare_module_with_exports/migrated_0007.tree.json @@ -0,0 +1,85 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":90}}, + "range":[0,90], + "body":[ + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":90}}, + "range":[0,90], + "id":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "range":[15,20], + "value":"foo", + "raw":"\"foo\"" + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":90}}, + "range":[21,90], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":56}}, + "range":[23,56], + "default":false, + "declaration":{ + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":56}}, + "range":[38,56], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":43},"end":{"line":1,"column":46}}, + "range":[43,46], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":49},"end":{"line":1,"column":55}}, + "range":[49,55] + } + }, + "specifiers":[], + "source":null + }, + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":57},"end":{"line":1,"column":88}}, + "range":[57,88], + "default":false, + "declaration":{ + "type":"DeclareVariable", + "loc":{"source":null,"start":{"line":1,"column":72},"end":{"line":1,"column":88}}, + "range":[72,88], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":76},"end":{"line":1,"column":87}}, + "range":[76,87], + "name":"baz", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":79},"end":{"line":1,"column":87}}, + "range":[79,87], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":81},"end":{"line":1,"column":87}}, + "range":[81,87] + } + }, + "optional":false + } + }, + "specifiers":[], + "source":null + } + ] + }, + "kind":"ES" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_module_with_exports/migrated_0008.js b/lib/test/flow/types/declare_module_with_exports/migrated_0008.js new file mode 100644 index 0000000..21cd35d --- /dev/null +++ b/lib/test/flow/types/declare_module_with_exports/migrated_0008.js @@ -0,0 +1 @@ +declare module "foo" { declare export type bar = number; declare module.exports: number; } diff --git a/lib/test/flow/types/declare_module_with_exports/migrated_0008.tree.json b/lib/test/flow/types/declare_module_with_exports/migrated_0008.tree.json new file mode 100644 index 0000000..c3f7433 --- /dev/null +++ b/lib/test/flow/types/declare_module_with_exports/migrated_0008.tree.json @@ -0,0 +1,70 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":90}}, + "range":[0,90], + "body":[ + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":90}}, + "range":[0,90], + "id":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "range":[15,20], + "value":"foo", + "raw":"\"foo\"" + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":90}}, + "range":[21,90], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":56}}, + "range":[23,56], + "default":false, + "declaration":{ + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":56}}, + "range":[38,56], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":43},"end":{"line":1,"column":46}}, + "range":[43,46], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":49},"end":{"line":1,"column":55}}, + "range":[49,55] + } + }, + "specifiers":[], + "source":null + }, + { + "type":"DeclareModuleExports", + "loc":{"source":null,"start":{"line":1,"column":57},"end":{"line":1,"column":88}}, + "range":[57,88], + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":79},"end":{"line":1,"column":87}}, + "range":[79,87], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":81},"end":{"line":1,"column":87}}, + "range":[81,87] + } + } + } + ] + }, + "kind":"CommonJS" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_module_with_exports/migrated_0009.js b/lib/test/flow/types/declare_module_with_exports/migrated_0009.js new file mode 100644 index 0000000..2904734 --- /dev/null +++ b/lib/test/flow/types/declare_module_with_exports/migrated_0009.js @@ -0,0 +1 @@ +declare module "foo" { declare export interface bar {} } diff --git a/lib/test/flow/types/declare_module_with_exports/migrated_0009.tree.json b/lib/test/flow/types/declare_module_with_exports/migrated_0009.tree.json new file mode 100644 index 0000000..7a408f6 --- /dev/null +++ b/lib/test/flow/types/declare_module_with_exports/migrated_0009.tree.json @@ -0,0 +1,61 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, + "range":[0,56], + "body":[ + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":56}}, + "range":[0,56], + "id":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "range":[15,20], + "value":"foo", + "raw":"\"foo\"" + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":56}}, + "range":[21,56], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":54}}, + "range":[23,54], + "default":false, + "declaration":{ + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":54}}, + "range":[38,54], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":48},"end":{"line":1,"column":51}}, + "range":[48,51], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":52},"end":{"line":1,"column":54}}, + "range":[52,54], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + }, + "specifiers":[], + "source":null + } + ] + }, + "kind":"CommonJS" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_module_with_exports/migrated_0010.js b/lib/test/flow/types/declare_module_with_exports/migrated_0010.js new file mode 100644 index 0000000..2f9a87e --- /dev/null +++ b/lib/test/flow/types/declare_module_with_exports/migrated_0010.js @@ -0,0 +1 @@ +declare module "foo" { declare export interface bar {} declare export var baz: number; } diff --git a/lib/test/flow/types/declare_module_with_exports/migrated_0010.tree.json b/lib/test/flow/types/declare_module_with_exports/migrated_0010.tree.json new file mode 100644 index 0000000..1f74674 --- /dev/null +++ b/lib/test/flow/types/declare_module_with_exports/migrated_0010.tree.json @@ -0,0 +1,91 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":88}}, + "range":[0,88], + "body":[ + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":88}}, + "range":[0,88], + "id":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "range":[15,20], + "value":"foo", + "raw":"\"foo\"" + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":88}}, + "range":[21,88], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":54}}, + "range":[23,54], + "default":false, + "declaration":{ + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":54}}, + "range":[38,54], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":48},"end":{"line":1,"column":51}}, + "range":[48,51], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":52},"end":{"line":1,"column":54}}, + "range":[52,54], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + }, + "specifiers":[], + "source":null + }, + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":55},"end":{"line":1,"column":86}}, + "range":[55,86], + "default":false, + "declaration":{ + "type":"DeclareVariable", + "loc":{"source":null,"start":{"line":1,"column":70},"end":{"line":1,"column":86}}, + "range":[70,86], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":74},"end":{"line":1,"column":85}}, + "range":[74,85], + "name":"baz", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":77},"end":{"line":1,"column":85}}, + "range":[77,85], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":79},"end":{"line":1,"column":85}}, + "range":[79,85] + } + }, + "optional":false + } + }, + "specifiers":[], + "source":null + } + ] + }, + "kind":"ES" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_module_with_exports/migrated_0011.js b/lib/test/flow/types/declare_module_with_exports/migrated_0011.js new file mode 100644 index 0000000..d624036 --- /dev/null +++ b/lib/test/flow/types/declare_module_with_exports/migrated_0011.js @@ -0,0 +1 @@ +declare module "foo" { declare export interface bar {} declare module.exports: number; } diff --git a/lib/test/flow/types/declare_module_with_exports/migrated_0011.tree.json b/lib/test/flow/types/declare_module_with_exports/migrated_0011.tree.json new file mode 100644 index 0000000..cffa355 --- /dev/null +++ b/lib/test/flow/types/declare_module_with_exports/migrated_0011.tree.json @@ -0,0 +1,76 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":88}}, + "range":[0,88], + "body":[ + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":88}}, + "range":[0,88], + "id":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "range":[15,20], + "value":"foo", + "raw":"\"foo\"" + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":88}}, + "range":[21,88], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":54}}, + "range":[23,54], + "default":false, + "declaration":{ + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":54}}, + "range":[38,54], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":48},"end":{"line":1,"column":51}}, + "range":[48,51], + "name":"bar", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":52},"end":{"line":1,"column":54}}, + "range":[52,54], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + }, + "specifiers":[], + "source":null + }, + { + "type":"DeclareModuleExports", + "loc":{"source":null,"start":{"line":1,"column":55},"end":{"line":1,"column":86}}, + "range":[55,86], + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":77},"end":{"line":1,"column":85}}, + "range":[77,85], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":79},"end":{"line":1,"column":85}}, + "range":[79,85] + } + } + } + ] + }, + "kind":"CommonJS" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_statements/declare_class_prop_named_static.js b/lib/test/flow/types/declare_statements/declare_class_prop_named_static.js new file mode 100644 index 0000000..dbd7e5a --- /dev/null +++ b/lib/test/flow/types/declare_statements/declare_class_prop_named_static.js @@ -0,0 +1 @@ +declare class A { static : number } diff --git a/lib/test/flow/types/declare_statements/declare_class_prop_named_static.tree.json b/lib/test/flow/types/declare_statements/declare_class_prop_named_static.tree.json new file mode 100644 index 0000000..58de93b --- /dev/null +++ b/lib/test/flow/types/declare_statements/declare_class_prop_named_static.tree.json @@ -0,0 +1,60 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":35}}, + "range":[16,35], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":33}}, + "range":[18,33], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":24}}, + "range":[18,24], + "name":"static", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":33}}, + "range":[27,33] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_statements/migrated_0000.js b/lib/test/flow/types/declare_statements/migrated_0000.js new file mode 100644 index 0000000..6a62e59 --- /dev/null +++ b/lib/test/flow/types/declare_statements/migrated_0000.js @@ -0,0 +1 @@ +declare var foo diff --git a/lib/test/flow/types/declare_statements/migrated_0000.tree.json b/lib/test/flow/types/declare_statements/migrated_0000.tree.json new file mode 100644 index 0000000..b0090b8 --- /dev/null +++ b/lib/test/flow/types/declare_statements/migrated_0000.tree.json @@ -0,0 +1,21 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "body":[ + { + "type":"DeclareVariable", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":15}}, + "range":[12,15], + "name":"foo", + "typeAnnotation":null, + "optional":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_statements/migrated_0001.js b/lib/test/flow/types/declare_statements/migrated_0001.js new file mode 100644 index 0000000..290bd34 --- /dev/null +++ b/lib/test/flow/types/declare_statements/migrated_0001.js @@ -0,0 +1 @@ +declare var foo; diff --git a/lib/test/flow/types/declare_statements/migrated_0001.tree.json b/lib/test/flow/types/declare_statements/migrated_0001.tree.json new file mode 100644 index 0000000..bde48e6 --- /dev/null +++ b/lib/test/flow/types/declare_statements/migrated_0001.tree.json @@ -0,0 +1,21 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "body":[ + { + "type":"DeclareVariable", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":15}}, + "range":[12,15], + "name":"foo", + "typeAnnotation":null, + "optional":false + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_statements/migrated_0002.js b/lib/test/flow/types/declare_statements/migrated_0002.js new file mode 100644 index 0000000..44407a3 --- /dev/null +++ b/lib/test/flow/types/declare_statements/migrated_0002.js @@ -0,0 +1 @@ +declare function foo(): void diff --git a/lib/test/flow/types/declare_statements/migrated_0002.tree.json b/lib/test/flow/types/declare_statements/migrated_0002.tree.json new file mode 100644 index 0000000..e931227 --- /dev/null +++ b/lib/test/flow/types/declare_statements/migrated_0002.tree.json @@ -0,0 +1,39 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "body":[ + { + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":28}}, + "range":[17,28], + "name":"foo", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, + "range":[20,28], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, + "range":[20,28], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":28}}, + "range":[24,28] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_statements/migrated_0003.js b/lib/test/flow/types/declare_statements/migrated_0003.js new file mode 100644 index 0000000..7ab5bf1 --- /dev/null +++ b/lib/test/flow/types/declare_statements/migrated_0003.js @@ -0,0 +1 @@ +declare function foo(): void; diff --git a/lib/test/flow/types/declare_statements/migrated_0003.tree.json b/lib/test/flow/types/declare_statements/migrated_0003.tree.json new file mode 100644 index 0000000..ade7c6f --- /dev/null +++ b/lib/test/flow/types/declare_statements/migrated_0003.tree.json @@ -0,0 +1,39 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "body":[ + { + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":28}}, + "range":[17,28], + "name":"foo", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, + "range":[20,28], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, + "range":[20,28], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":28}}, + "range":[24,28] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_statements/migrated_0004.js b/lib/test/flow/types/declare_statements/migrated_0004.js new file mode 100644 index 0000000..05fa9e2 --- /dev/null +++ b/lib/test/flow/types/declare_statements/migrated_0004.js @@ -0,0 +1 @@ +declare function foo(x: number, y: string): void; diff --git a/lib/test/flow/types/declare_statements/migrated_0004.tree.json b/lib/test/flow/types/declare_statements/migrated_0004.tree.json new file mode 100644 index 0000000..04f622c --- /dev/null +++ b/lib/test/flow/types/declare_statements/migrated_0004.tree.json @@ -0,0 +1,78 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "range":[0,49], + "body":[ + { + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "range":[0,49], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":48}}, + "range":[17,48], + "name":"foo", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":48}}, + "range":[20,48], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":48}}, + "range":[20,48], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":30}}, + "range":[21,30], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":30}}, + "range":[24,30] + }, + "optional":false + }, + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":41}}, + "range":[32,41], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, + "range":[32,33], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":41}}, + "range":[35,41] + }, + "optional":false + } + ], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":44},"end":{"line":1,"column":48}}, + "range":[44,48] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_statements/migrated_0005.js b/lib/test/flow/types/declare_statements/migrated_0005.js new file mode 100644 index 0000000..226a2cf --- /dev/null +++ b/lib/test/flow/types/declare_statements/migrated_0005.js @@ -0,0 +1,2 @@ +// Function argument types are now optional +declare function foo(x: number, string): void diff --git a/lib/test/flow/types/declare_statements/migrated_0005.tree.json b/lib/test/flow/types/declare_statements/migrated_0005.tree.json new file mode 100644 index 0000000..06ceaee --- /dev/null +++ b/lib/test/flow/types/declare_statements/migrated_0005.tree.json @@ -0,0 +1,78 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":45}}, + "range":[44,89], + "body":[ + { + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":45}}, + "range":[44,89], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":45}}, + "range":[61,89], + "name":"foo", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":20},"end":{"line":2,"column":45}}, + "range":[64,89], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":20},"end":{"line":2,"column":45}}, + "range":[64,89], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":2,"column":21},"end":{"line":2,"column":30}}, + "range":[65,74], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":21},"end":{"line":2,"column":22}}, + "range":[65,66], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":24},"end":{"line":2,"column":30}}, + "range":[68,74] + }, + "optional":false + }, + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":2,"column":32},"end":{"line":2,"column":38}}, + "range":[76,82], + "name":null, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":32},"end":{"line":2,"column":38}}, + "range":[76,82] + }, + "optional":false + } + ], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":41},"end":{"line":2,"column":45}}, + "range":[85,89] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "range":[0,43], + "value":" Function argument types are now optional" + } + ] +} diff --git a/lib/test/flow/types/declare_statements/migrated_0006.js b/lib/test/flow/types/declare_statements/migrated_0006.js new file mode 100644 index 0000000..f349d94 --- /dev/null +++ b/lib/test/flow/types/declare_statements/migrated_0006.js @@ -0,0 +1 @@ +declare class A {} diff --git a/lib/test/flow/types/declare_statements/migrated_0006.tree.json b/lib/test/flow/types/declare_statements/migrated_0006.tree.json new file mode 100644 index 0000000..ffdbd00 --- /dev/null +++ b/lib/test/flow/types/declare_statements/migrated_0006.tree.json @@ -0,0 +1,35 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, + "range":[16,18], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_statements/migrated_0007.js b/lib/test/flow/types/declare_statements/migrated_0007.js new file mode 100644 index 0000000..2639a59 --- /dev/null +++ b/lib/test/flow/types/declare_statements/migrated_0007.js @@ -0,0 +1 @@ +declare class A extends B { x: number } diff --git a/lib/test/flow/types/declare_statements/migrated_0007.tree.json b/lib/test/flow/types/declare_statements/migrated_0007.tree.json new file mode 100644 index 0000000..6f4318f --- /dev/null +++ b/lib/test/flow/types/declare_statements/migrated_0007.tree.json @@ -0,0 +1,110 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "range":[0,45], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "range":[0,45], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, + "range":[15,18], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "range":[16,17], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":45}}, + "range":[32,45], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":43}}, + "range":[34,43], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, + "range":[34,35], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":43}}, + "range":[37,43] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[ + { + "type":"InterfaceExtends", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":31}}, + "range":[27,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, + "range":[27,28], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":31}}, + "range":[28,31], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, + "range":[29,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, + "range":[29,30], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + } + ], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_statements/migrated_0008.js b/lib/test/flow/types/declare_statements/migrated_0008.js new file mode 100644 index 0000000..71ea2d6 --- /dev/null +++ b/lib/test/flow/types/declare_statements/migrated_0008.js @@ -0,0 +1 @@ +declare class A { static foo(): number; static x : string; } diff --git a/lib/test/flow/types/declare_statements/migrated_0008.tree.json b/lib/test/flow/types/declare_statements/migrated_0008.tree.json new file mode 100644 index 0000000..09c8178 --- /dev/null +++ b/lib/test/flow/types/declare_statements/migrated_0008.tree.json @@ -0,0 +1,92 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":60}}, + "range":[0,60], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":60}}, + "range":[0,60], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":60}}, + "range":[16,60], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":38}}, + "range":[18,38], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":28}}, + "range":[25,28], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":38}}, + "range":[18,38], + "params":[], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":38}}, + "range":[32,38] + }, + "rest":null, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":true, + "proto":false, + "variance":null, + "kind":"init" + }, + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":40},"end":{"line":1,"column":57}}, + "range":[40,57], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":47},"end":{"line":1,"column":48}}, + "range":[47,48], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":51},"end":{"line":1,"column":57}}, + "range":[51,57] + }, + "method":false, + "optional":false, + "static":true, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_statements/migrated_0009.js b/lib/test/flow/types/declare_statements/migrated_0009.js new file mode 100644 index 0000000..7c06e6f --- /dev/null +++ b/lib/test/flow/types/declare_statements/migrated_0009.js @@ -0,0 +1 @@ +declare class A { static () : number } diff --git a/lib/test/flow/types/declare_statements/migrated_0009.tree.json b/lib/test/flow/types/declare_statements/migrated_0009.tree.json new file mode 100644 index 0000000..25bc644 --- /dev/null +++ b/lib/test/flow/types/declare_statements/migrated_0009.tree.json @@ -0,0 +1,55 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":38}}, + "range":[16,38], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[ + { + "type":"ObjectTypeCallProperty", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":36}}, + "range":[18,36], + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":36}}, + "range":[25,36], + "params":[], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":36}}, + "range":[30,36] + }, + "rest":null, + "typeParameters":null + }, + "static":true + } + ], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_statements/migrated_0010.js b/lib/test/flow/types/declare_statements/migrated_0010.js new file mode 100644 index 0000000..238dbf8 --- /dev/null +++ b/lib/test/flow/types/declare_statements/migrated_0010.js @@ -0,0 +1 @@ +declare class A { static [ indexer: number]: string } diff --git a/lib/test/flow/types/declare_statements/migrated_0010.tree.json b/lib/test/flow/types/declare_statements/migrated_0010.tree.json new file mode 100644 index 0000000..17355a7 --- /dev/null +++ b/lib/test/flow/types/declare_statements/migrated_0010.tree.json @@ -0,0 +1,61 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "range":[0,53], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "range":[0,53], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":53}}, + "range":[16,53], + "exact":false, + "properties":[], + "indexers":[ + { + "type":"ObjectTypeIndexer", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":51}}, + "range":[18,51], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":34}}, + "range":[27,34], + "name":"indexer", + "typeAnnotation":null, + "optional":false + }, + "key":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":42}}, + "range":[36,42] + }, + "value":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":45},"end":{"line":1,"column":51}}, + "range":[45,51] + }, + "static":true, + "variance":null + } + ], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_statements/migrated_0011.js b/lib/test/flow/types/declare_statements/migrated_0011.js new file mode 100644 index 0000000..053b6fb --- /dev/null +++ b/lib/test/flow/types/declare_statements/migrated_0011.js @@ -0,0 +1 @@ +declare class A { get foo(): number; } diff --git a/lib/test/flow/types/declare_statements/migrated_0011.tree.json b/lib/test/flow/types/declare_statements/migrated_0011.tree.json new file mode 100644 index 0000000..2b03320 --- /dev/null +++ b/lib/test/flow/types/declare_statements/migrated_0011.tree.json @@ -0,0 +1,68 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":38}}, + "range":[16,38], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":35}}, + "range":[18,35], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":25}}, + "range":[22,25], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":35}}, + "range":[18,35], + "params":[], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":35}}, + "range":[29,35] + }, + "rest":null, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"get" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_statements/migrated_0012.js b/lib/test/flow/types/declare_statements/migrated_0012.js new file mode 100644 index 0000000..3c21a77 --- /dev/null +++ b/lib/test/flow/types/declare_statements/migrated_0012.js @@ -0,0 +1 @@ +declare class A { set foo(x: number): void; } diff --git a/lib/test/flow/types/declare_statements/migrated_0012.tree.json b/lib/test/flow/types/declare_statements/migrated_0012.tree.json new file mode 100644 index 0000000..9341e76 --- /dev/null +++ b/lib/test/flow/types/declare_statements/migrated_0012.tree.json @@ -0,0 +1,88 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "range":[0,45], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "range":[0,45], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":45}}, + "range":[16,45], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":42}}, + "range":[18,42], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":25}}, + "range":[22,25], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":42}}, + "range":[18,42], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":35}}, + "range":[26,35], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, + "range":[26,27], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":35}}, + "range":[29,35] + }, + "optional":false + } + ], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":42}}, + "range":[38,42] + }, + "rest":null, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"set" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_statements/migrated_0013.js b/lib/test/flow/types/declare_statements/migrated_0013.js new file mode 100644 index 0000000..74d8e77 --- /dev/null +++ b/lib/test/flow/types/declare_statements/migrated_0013.js @@ -0,0 +1 @@ +declare class A { get foo(): number; set foo(x: string): void; } diff --git a/lib/test/flow/types/declare_statements/migrated_0013.tree.json b/lib/test/flow/types/declare_statements/migrated_0013.tree.json new file mode 100644 index 0000000..828bcd2 --- /dev/null +++ b/lib/test/flow/types/declare_statements/migrated_0013.tree.json @@ -0,0 +1,120 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":64}}, + "range":[0,64], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":64}}, + "range":[0,64], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":64}}, + "range":[16,64], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":35}}, + "range":[18,35], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":25}}, + "range":[22,25], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":35}}, + "range":[18,35], + "params":[], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":35}}, + "range":[29,35] + }, + "rest":null, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"get" + }, + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":61}}, + "range":[37,61], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":44}}, + "range":[41,44], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":61}}, + "range":[37,61], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":45},"end":{"line":1,"column":54}}, + "range":[45,54], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":45},"end":{"line":1,"column":46}}, + "range":[45,46], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":48},"end":{"line":1,"column":54}}, + "range":[48,54] + }, + "optional":false + } + ], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":57},"end":{"line":1,"column":61}}, + "range":[57,61] + }, + "rest":null, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"set" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_statements_invalid/migrated_0000.js b/lib/test/flow/types/declare_statements_invalid/migrated_0000.js new file mode 100644 index 0000000..6f3c04b --- /dev/null +++ b/lib/test/flow/types/declare_statements_invalid/migrated_0000.js @@ -0,0 +1,2 @@ +// You must provide a return type +declare function foo(); diff --git a/lib/test/flow/types/declare_statements_invalid/migrated_0000.tree.json b/lib/test/flow/types/declare_statements_invalid/migrated_0000.tree.json new file mode 100644 index 0000000..a550bd9 --- /dev/null +++ b/lib/test/flow/types/declare_statements_invalid/migrated_0000.tree.json @@ -0,0 +1,56 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":22},"end":{"line":2,"column":23}}, + "message":"Unexpected token `;`, expected the token `:`" + }, + { + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":0}}, + "message":"Unexpected end of input" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":23}}, + "range":[34,57], + "body":[ + { + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":23}}, + "range":[34,57], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":3,"column":0}}, + "range":[51,58], + "name":"foo", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":20},"end":{"line":3,"column":0}}, + "range":[54,58], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":20},"end":{"line":3,"column":0}}, + "range":[54,58], + "params":[], + "returnType":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":0}}, + "range":[58,58] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "value":" You must provide a return type" + } + ] +} diff --git a/lib/test/flow/types/declare_statements_invalid/migrated_0002.js b/lib/test/flow/types/declare_statements_invalid/migrated_0002.js new file mode 100644 index 0000000..22688b7 --- /dev/null +++ b/lib/test/flow/types/declare_statements_invalid/migrated_0002.js @@ -0,0 +1 @@ +declare class A { static implements: number; implements: number } diff --git a/lib/test/flow/types/declare_statements_invalid/migrated_0002.tree.json b/lib/test/flow/types/declare_statements_invalid/migrated_0002.tree.json new file mode 100644 index 0000000..ced2733 --- /dev/null +++ b/lib/test/flow/types/declare_statements_invalid/migrated_0002.tree.json @@ -0,0 +1,84 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":65}}, + "range":[0,65], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":65}}, + "range":[0,65], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":65}}, + "range":[16,65], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":43}}, + "range":[18,43], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":35}}, + "range":[25,35], + "name":"implements", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":43}}, + "range":[37,43] + }, + "method":false, + "optional":false, + "static":true, + "proto":false, + "variance":null, + "kind":"init" + }, + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":45},"end":{"line":1,"column":63}}, + "range":[45,63], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":45},"end":{"line":1,"column":55}}, + "range":[45,55], + "name":"implements", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":57},"end":{"line":1,"column":63}}, + "range":[57,63] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/declare_type_alias/basic.js b/lib/test/flow/types/declare_type_alias/basic.js new file mode 100644 index 0000000..71ce053 --- /dev/null +++ b/lib/test/flow/types/declare_type_alias/basic.js @@ -0,0 +1 @@ +declare type x = number; diff --git a/lib/test/flow/types/declare_type_alias/basic.tree.json b/lib/test/flow/types/declare_type_alias/basic.tree.json new file mode 100644 index 0000000..4582c7b --- /dev/null +++ b/lib/test/flow/types/declare_type_alias/basic.tree.json @@ -0,0 +1,27 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "body":[ + { + "type":"DeclareTypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":23}}, + "range":[17,23] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/exact_objects/migrated_0000.js b/lib/test/flow/types/exact_objects/migrated_0000.js new file mode 100644 index 0000000..97cecce --- /dev/null +++ b/lib/test/flow/types/exact_objects/migrated_0000.js @@ -0,0 +1 @@ +var obj: {| x: number, y: string |} // no trailing comma diff --git a/lib/test/flow/types/exact_objects/migrated_0000.tree.json b/lib/test/flow/types/exact_objects/migrated_0000.tree.json new file mode 100644 index 0000000..ff3032c --- /dev/null +++ b/lib/test/flow/types/exact_objects/migrated_0000.tree.json @@ -0,0 +1,101 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":35}}, + "range":[4,35], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":35}}, + "range":[4,35], + "name":"obj", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":35}}, + "range":[7,35], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":35}}, + "range":[9,35], + "exact":true, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":21}}, + "range":[12,21], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":21}}, + "range":[15,21] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + }, + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":32}}, + "range":[23,32], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, + "range":[23,24], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":32}}, + "range":[26,32] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":56}}, + "range":[36,56], + "value":" no trailing comma" + } + ] +} diff --git a/lib/test/flow/types/exact_objects/migrated_0001.js b/lib/test/flow/types/exact_objects/migrated_0001.js new file mode 100644 index 0000000..264ea6f --- /dev/null +++ b/lib/test/flow/types/exact_objects/migrated_0001.js @@ -0,0 +1 @@ +var obj: {| x: number, y: string, |} // trailing comma diff --git a/lib/test/flow/types/exact_objects/migrated_0001.tree.json b/lib/test/flow/types/exact_objects/migrated_0001.tree.json new file mode 100644 index 0000000..f67b0c8 --- /dev/null +++ b/lib/test/flow/types/exact_objects/migrated_0001.tree.json @@ -0,0 +1,101 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":36}}, + "range":[4,36], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":36}}, + "range":[4,36], + "name":"obj", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":36}}, + "range":[7,36], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":36}}, + "range":[9,36], + "exact":true, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":21}}, + "range":[12,21], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":21}}, + "range":[15,21] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + }, + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":32}}, + "range":[23,32], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, + "range":[23,24], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":32}}, + "range":[26,32] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":54}}, + "range":[37,54], + "value":" trailing comma" + } + ] +} diff --git a/lib/test/flow/types/function_predicates/migrated_0000.js b/lib/test/flow/types/function_predicates/migrated_0000.js new file mode 100644 index 0000000..fbea2ab --- /dev/null +++ b/lib/test/flow/types/function_predicates/migrated_0000.js @@ -0,0 +1 @@ +declare function f(x: mixed): boolean %checks(x !== null); diff --git a/lib/test/flow/types/function_predicates/migrated_0000.tree.json b/lib/test/flow/types/function_predicates/migrated_0000.tree.json new file mode 100644 index 0000000..3c9b7b7 --- /dev/null +++ b/lib/test/flow/types/function_predicates/migrated_0000.tree.json @@ -0,0 +1,84 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "range":[0,58], + "body":[ + { + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":58}}, + "range":[0,58], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":37}}, + "range":[17,37], + "name":"f", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":37}}, + "range":[18,37], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":37}}, + "range":[18,37], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, + "range":[19,27], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "range":[19,20], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"MixedTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":27}}, + "range":[22,27] + }, + "optional":false + } + ], + "returnType":{ + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":37}}, + "range":[30,37] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":{ + "type":"DeclaredPredicate", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":57}}, + "range":[38,57], + "value":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":46},"end":{"line":1,"column":56}}, + "range":[46,56], + "operator":"!==", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":46},"end":{"line":1,"column":47}}, + "range":[46,47], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":52},"end":{"line":1,"column":56}}, + "range":[52,56], + "value":null, + "raw":"null" + } + } + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/function_predicates/migrated_0001.js b/lib/test/flow/types/function_predicates/migrated_0001.js new file mode 100644 index 0000000..63a1f01 --- /dev/null +++ b/lib/test/flow/types/function_predicates/migrated_0001.js @@ -0,0 +1 @@ +declare function f(x: mixed): boolean %checks(x !== null) diff --git a/lib/test/flow/types/function_predicates/migrated_0001.tree.json b/lib/test/flow/types/function_predicates/migrated_0001.tree.json new file mode 100644 index 0000000..8cf682d --- /dev/null +++ b/lib/test/flow/types/function_predicates/migrated_0001.tree.json @@ -0,0 +1,84 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, + "range":[0,57], + "body":[ + { + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, + "range":[0,57], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":37}}, + "range":[17,37], + "name":"f", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":37}}, + "range":[18,37], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":37}}, + "range":[18,37], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, + "range":[19,27], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "range":[19,20], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"MixedTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":27}}, + "range":[22,27] + }, + "optional":false + } + ], + "returnType":{ + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":37}}, + "range":[30,37] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":{ + "type":"DeclaredPredicate", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":57}}, + "range":[38,57], + "value":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":46},"end":{"line":1,"column":56}}, + "range":[46,56], + "operator":"!==", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":46},"end":{"line":1,"column":47}}, + "range":[46,47], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":52},"end":{"line":1,"column":56}}, + "range":[52,56], + "value":null, + "raw":"null" + } + } + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/function_predicates/migrated_0002.js b/lib/test/flow/types/function_predicates/migrated_0002.js new file mode 100644 index 0000000..2ee3192 --- /dev/null +++ b/lib/test/flow/types/function_predicates/migrated_0002.js @@ -0,0 +1 @@ +function foo(x: mixed): %checks { return x !== null } diff --git a/lib/test/flow/types/function_predicates/migrated_0002.tree.json b/lib/test/flow/types/function_predicates/migrated_0002.tree.json new file mode 100644 index 0000000..08df3a0 --- /dev/null +++ b/lib/test/flow/types/function_predicates/migrated_0002.tree.json @@ -0,0 +1,83 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "range":[0,53], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "range":[0,53], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":21}}, + "range":[13,21], + "name":"x", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":21}}, + "range":[14,21], + "typeAnnotation":{ + "type":"MixedTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, + "range":[16,21] + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":53}}, + "range":[32,53], + "body":[ + { + "type":"ReturnStatement", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":51}}, + "range":[34,51], + "argument":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":51}}, + "range":[41,51], + "operator":"!==", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":42}}, + "range":[41,42], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":47},"end":{"line":1,"column":51}}, + "range":[47,51], + "value":null, + "raw":"null" + } + } + } + ] + }, + "async":false, + "generator":false, + "predicate":{ + "type":"InferredPredicate", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":31}}, + "range":[24,31] + }, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/function_predicates/migrated_0003.js b/lib/test/flow/types/function_predicates/migrated_0003.js new file mode 100644 index 0000000..15a6d2f --- /dev/null +++ b/lib/test/flow/types/function_predicates/migrated_0003.js @@ -0,0 +1 @@ +var a1 = (x: mixed): %checks => x !== null; diff --git a/lib/test/flow/types/function_predicates/migrated_0003.tree.json b/lib/test/flow/types/function_predicates/migrated_0003.tree.json new file mode 100644 index 0000000..b7c82ef --- /dev/null +++ b/lib/test/flow/types/function_predicates/migrated_0003.tree.json @@ -0,0 +1,85 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "range":[0,43], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "range":[0,43], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":42}}, + "range":[4,42], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, + "range":[4,6], + "name":"a1", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":42}}, + "range":[9,42], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":18}}, + "range":[10,18], + "name":"x", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":18}}, + "range":[11,18], + "typeAnnotation":{ + "type":"MixedTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":18}}, + "range":[13,18] + } + }, + "optional":false + } + ], + "body":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":42}}, + "range":[32,42], + "operator":"!==", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, + "range":[32,33], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":42}}, + "range":[38,42], + "value":null, + "raw":"null" + } + }, + "async":false, + "generator":false, + "predicate":{ + "type":"InferredPredicate", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":28}}, + "range":[21,28] + }, + "expression":true, + "returnType":null, + "typeParameters":null + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/function_predicates/migrated_0004.js b/lib/test/flow/types/function_predicates/migrated_0004.js new file mode 100644 index 0000000..fc5d68f --- /dev/null +++ b/lib/test/flow/types/function_predicates/migrated_0004.js @@ -0,0 +1 @@ +(x): %checks => x !== null; diff --git a/lib/test/flow/types/function_predicates/migrated_0004.tree.json b/lib/test/flow/types/function_predicates/migrated_0004.tree.json new file mode 100644 index 0000000..bdd18a2 --- /dev/null +++ b/lib/test/flow/types/function_predicates/migrated_0004.tree.json @@ -0,0 +1,61 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "expression":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, + "range":[1,2], + "name":"x", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":26}}, + "range":[16,26], + "operator":"!==", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "range":[16,17], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":26}}, + "range":[22,26], + "value":null, + "raw":"null" + } + }, + "async":false, + "generator":false, + "predicate":{ + "type":"InferredPredicate", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, + "range":[5,12] + }, + "expression":true, + "returnType":null, + "typeParameters":null + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/function_predicates/migrated_0005.js b/lib/test/flow/types/function_predicates/migrated_0005.js new file mode 100644 index 0000000..0d32b73 --- /dev/null +++ b/lib/test/flow/types/function_predicates/migrated_0005.js @@ -0,0 +1 @@ +var a3: (x: mixed) => boolean %checks(x !== null); diff --git a/lib/test/flow/types/function_predicates/migrated_0005.tree.json b/lib/test/flow/types/function_predicates/migrated_0005.tree.json new file mode 100644 index 0000000..7db82c7 --- /dev/null +++ b/lib/test/flow/types/function_predicates/migrated_0005.tree.json @@ -0,0 +1,133 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":31}}, + "message":"Unexpected token `%`, expected the token `;`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":31}}, + "message":"Unexpected token `%`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "range":[0,50], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":29}}, + "range":[4,29], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":29}}, + "range":[4,29], + "name":"a3", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":29}}, + "range":[6,29], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":29}}, + "range":[8,29], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, + "range":[9,17], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"MixedTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":17}}, + "range":[12,17] + }, + "optional":false + } + ], + "returnType":{ + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":29}}, + "range":[22,29] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":50}}, + "range":[30,50], + "expression":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":49}}, + "range":[30,49], + "operator":"%", + "left":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":31}}, + "range":[30,31], + "value":null, + "raw":"null" + }, + "right":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":49}}, + "range":[31,49], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":37}}, + "range":[31,37], + "name":"checks", + "typeAnnotation":null, + "optional":false + }, + "typeArguments":null, + "arguments":[ + { + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":48}}, + "range":[38,48], + "operator":"!==", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":39}}, + "range":[38,39], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":44},"end":{"line":1,"column":48}}, + "range":[44,48], + "value":null, + "raw":"null" + } + } + ] + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/function_predicates/migrated_0006.js b/lib/test/flow/types/function_predicates/migrated_0006.js new file mode 100644 index 0000000..82d8ea0 --- /dev/null +++ b/lib/test/flow/types/function_predicates/migrated_0006.js @@ -0,0 +1 @@ +declare function f(x: mixed): boolean %checks(var x = 1; typeof x == "string"); diff --git a/lib/test/flow/types/function_predicates/migrated_0006.tree.json b/lib/test/flow/types/function_predicates/migrated_0006.tree.json new file mode 100644 index 0000000..52a671b --- /dev/null +++ b/lib/test/flow/types/function_predicates/migrated_0006.tree.json @@ -0,0 +1,158 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":46},"end":{"line":1,"column":49}}, + "message":"Unexpected token `var`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":46},"end":{"line":1,"column":49}}, + "message":"Unexpected identifier, expected the token `)`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":50},"end":{"line":1,"column":51}}, + "message":"Unexpected identifier, expected the token `;`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":77},"end":{"line":1,"column":78}}, + "message":"Unexpected token `)`, expected the end of an expression statement (`;`)" + }, + { + "loc":{"source":null,"start":{"line":1,"column":77},"end":{"line":1,"column":78}}, + "message":"Unexpected token `)`, expected the start of a statement" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":79}}, + "range":[0,79], + "body":[ + { + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":49}}, + "range":[0,49], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":37}}, + "range":[17,37], + "name":"f", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":37}}, + "range":[18,37], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":37}}, + "range":[18,37], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, + "range":[19,27], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "range":[19,20], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"MixedTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":27}}, + "range":[22,27] + }, + "optional":false + } + ], + "returnType":{ + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":37}}, + "range":[30,37] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":{ + "type":"DeclaredPredicate", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":49}}, + "range":[38,49], + "value":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":46},"end":{"line":1,"column":49}}, + "range":[46,49], + "value":null, + "raw":"null" + } + } + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":50},"end":{"line":1,"column":56}}, + "range":[50,56], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":50},"end":{"line":1,"column":55}}, + "range":[50,55], + "operator":"=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":50},"end":{"line":1,"column":51}}, + "range":[50,51], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":54},"end":{"line":1,"column":55}}, + "range":[54,55], + "value":1, + "raw":"1" + } + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":57},"end":{"line":1,"column":77}}, + "range":[57,77], + "expression":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":57},"end":{"line":1,"column":77}}, + "range":[57,77], + "operator":"==", + "left":{ + "type":"UnaryExpression", + "loc":{"source":null,"start":{"line":1,"column":57},"end":{"line":1,"column":65}}, + "range":[57,65], + "operator":"typeof", + "prefix":true, + "argument":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":64},"end":{"line":1,"column":65}}, + "range":[64,65], + "name":"x", + "typeAnnotation":null, + "optional":false + } + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":69},"end":{"line":1,"column":77}}, + "range":[69,77], + "value":"string", + "raw":"\"string\"" + } + }, + "directive":null + }, + { + "type":"EmptyStatement", + "loc":{"source":null,"start":{"line":1,"column":78},"end":{"line":1,"column":79}}, + "range":[78,79] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/inside_generics.js b/lib/test/flow/types/function_types_with_anonymous_parameters/inside_generics.js new file mode 100644 index 0000000..70b1d5f --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/inside_generics.js @@ -0,0 +1 @@ +type T = Array<(string) => number> diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/inside_generics.tree.json b/lib/test/flow/types/function_types_with_anonymous_parameters/inside_generics.tree.json new file mode 100644 index 0000000..ae6c555 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/inside_generics.tree.json @@ -0,0 +1,68 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "range":[0,34], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "range":[0,34], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":34}}, + "range":[9,34], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "range":[9,14], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":34}}, + "range":[14,34], + "params":[ + { + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":33}}, + "range":[15,33], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":22}}, + "range":[16,22], + "name":null, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":22}}, + "range":[16,22] + }, + "optional":false + } + ], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":33}}, + "range":[27,33] + }, + "rest":null, + "typeParameters":null + } + ] + } + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/inside_generics_inside_return.js b/lib/test/flow/types/function_types_with_anonymous_parameters/inside_generics_inside_return.js new file mode 100644 index 0000000..2797adf --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/inside_generics_inside_return.js @@ -0,0 +1 @@ +let x = (): Array<(string) => number> => [] diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/inside_generics_inside_return.tree.json b/lib/test/flow/types/function_types_with_anonymous_parameters/inside_generics_inside_return.tree.json new file mode 100644 index 0000000..a224970 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/inside_generics_inside_return.tree.json @@ -0,0 +1,98 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "range":[0,43], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "range":[0,43], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":43}}, + "range":[4,43], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":43}}, + "range":[8,43], + "id":null, + "params":[], + "body":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":43}}, + "range":[41,43], + "elements":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":37}}, + "range":[10,37], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":37}}, + "range":[12,37], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":17}}, + "range":[12,17], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":37}}, + "range":[17,37], + "params":[ + { + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":36}}, + "range":[18,36], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":25}}, + "range":[19,25], + "name":null, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":25}}, + "range":[19,25] + }, + "optional":false + } + ], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":36}}, + "range":[30,36] + }, + "rest":null, + "typeParameters":null + } + ] + } + } + }, + "typeParameters":null + } + } + ], + "kind":"let" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/invalid_some_named_some_anonymous.js b/lib/test/flow/types/function_types_with_anonymous_parameters/invalid_some_named_some_anonymous.js new file mode 100644 index 0000000..8c6fc6b --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/invalid_some_named_some_anonymous.js @@ -0,0 +1 @@ +type T = (arg: string number) => void diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/invalid_some_named_some_anonymous.tree.json b/lib/test/flow/types/function_types_with_anonymous_parameters/invalid_some_named_some_anonymous.tree.json new file mode 100644 index 0000000..8b1be24 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/invalid_some_named_some_anonymous.tree.json @@ -0,0 +1,61 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":28}}, + "message":"Unexpected token `number`, expected the token `,`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "range":[0,37], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "range":[0,37], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":37}}, + "range":[9,37], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":21}}, + "range":[10,21], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, + "range":[10,13], + "name":"arg", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":21}}, + "range":[15,21] + }, + "optional":false + } + ], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":37}}, + "range":[33,37] + }, + "rest":null, + "typeParameters":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0000.js b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0000.js new file mode 100644 index 0000000..d92d05d --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0000.js @@ -0,0 +1 @@ +type A = (string) => void diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0000.tree.json b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0000.tree.json new file mode 100644 index 0000000..ae1dfdc --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0000.tree.json @@ -0,0 +1,48 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":25}}, + "range":[9,25], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, + "range":[10,16], + "name":null, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, + "range":[10,16] + }, + "optional":false + } + ], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":25}}, + "range":[21,25] + }, + "rest":null, + "typeParameters":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0001.js b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0001.js new file mode 100644 index 0000000..1025170 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0001.js @@ -0,0 +1 @@ +type A = (string,) => void diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0001.tree.json b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0001.tree.json new file mode 100644 index 0000000..3500fb6 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0001.tree.json @@ -0,0 +1,48 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":26}}, + "range":[9,26], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, + "range":[10,16], + "name":null, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, + "range":[10,16] + }, + "optional":false + } + ], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":26}}, + "range":[22,26] + }, + "rest":null, + "typeParameters":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0002.js b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0002.js new file mode 100644 index 0000000..b0d08b1 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0002.js @@ -0,0 +1 @@ +type A = (Array) => void diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0002.tree.json b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0002.tree.json new file mode 100644 index 0000000..7b0ca45 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0002.tree.json @@ -0,0 +1,68 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":32}}, + "range":[9,32], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":23}}, + "range":[10,23], + "name":null, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":23}}, + "range":[10,23], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, + "range":[10,15], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":23}}, + "range":[15,23], + "params":[ + { + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":22}}, + "range":[16,22] + } + ] + } + }, + "optional":false + } + ], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":32}}, + "range":[28,32] + }, + "rest":null, + "typeParameters":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0003.js b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0003.js new file mode 100644 index 0000000..ef58131 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0003.js @@ -0,0 +1 @@ +type A = (Array,) => void diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0003.tree.json b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0003.tree.json new file mode 100644 index 0000000..e0a5918 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0003.tree.json @@ -0,0 +1,68 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":33}}, + "range":[9,33], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":23}}, + "range":[10,23], + "name":null, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":23}}, + "range":[10,23], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, + "range":[10,15], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":23}}, + "range":[15,23], + "params":[ + { + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":22}}, + "range":[16,22] + } + ] + } + }, + "optional":false + } + ], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":33}}, + "range":[29,33] + }, + "rest":null, + "typeParameters":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0004.js b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0004.js new file mode 100644 index 0000000..e7a8bfe --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0004.js @@ -0,0 +1 @@ +type A = (x: string, number) => void diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0004.tree.json b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0004.tree.json new file mode 100644 index 0000000..8bb8454 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0004.tree.json @@ -0,0 +1,67 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":36}}, + "range":[9,36], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":19}}, + "range":[10,19], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":19}}, + "range":[13,19] + }, + "optional":false + }, + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "range":[21,27], + "name":null, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "range":[21,27] + }, + "optional":false + } + ], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":36}}, + "range":[32,36] + }, + "rest":null, + "typeParameters":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0005.js b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0005.js new file mode 100644 index 0000000..a61e1f9 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0005.js @@ -0,0 +1 @@ +type A = (...Array) => void diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0005.tree.json b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0005.tree.json new file mode 100644 index 0000000..ab5710c --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0005.tree.json @@ -0,0 +1,66 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":35}}, + "range":[9,35], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":35}}, + "range":[31,35] + }, + "rest":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":26}}, + "range":[13,26], + "name":null, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":26}}, + "range":[13,26], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":18}}, + "range":[13,18], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":26}}, + "range":[18,26], + "params":[ + { + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":25}}, + "range":[19,25] + } + ] + } + }, + "optional":false + }, + "typeParameters":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0006.js b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0006.js new file mode 100644 index 0000000..154926d --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0006.js @@ -0,0 +1 @@ +type A = (Array, ...Array) => void diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0006.tree.json b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0006.tree.json new file mode 100644 index 0000000..c97fa3d --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0006.tree.json @@ -0,0 +1,99 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "range":[0,50], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "range":[0,50], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":50}}, + "range":[9,50], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":23}}, + "range":[10,23], + "name":null, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":23}}, + "range":[10,23], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, + "range":[10,15], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":23}}, + "range":[15,23], + "params":[ + { + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":22}}, + "range":[16,22] + } + ] + } + }, + "optional":false + } + ], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":46},"end":{"line":1,"column":50}}, + "range":[46,50] + }, + "rest":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":41}}, + "range":[28,41], + "name":null, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":41}}, + "range":[28,41], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":33}}, + "range":[28,33], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":41}}, + "range":[33,41], + "params":[ + { + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":40}}, + "range":[34,40] + } + ] + } + }, + "optional":false + }, + "typeParameters":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0007.js b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0007.js new file mode 100644 index 0000000..8e237b2 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0007.js @@ -0,0 +1,2 @@ +// Non-anonymous function types are allowed as arrow function return types +var f = (x): (x: number) => 123 => 123; diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0007.tree.json b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0007.tree.json new file mode 100644 index 0000000..766826f --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0007.tree.json @@ -0,0 +1,104 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":39}}, + "range":[75,114], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":39}}, + "range":[75,114], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":38}}, + "range":[79,113], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":5}}, + "range":[79,80], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":38}}, + "range":[83,113], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, + "range":[84,85], + "name":"x", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":35},"end":{"line":2,"column":38}}, + "range":[110,113], + "value":123, + "raw":"123" + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":31}}, + "range":[86,106], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":31}}, + "range":[88,106], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":23}}, + "range":[89,98], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":15}}, + "range":[89,90], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":23}}, + "range":[92,98] + }, + "optional":false + } + ], + "returnType":{ + "type":"NumberLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":28},"end":{"line":2,"column":31}}, + "range":[103,106], + "value":123, + "raw":"123" + }, + "rest":null, + "typeParameters":null + } + }, + "typeParameters":null + } + } + ], + "kind":"var" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":74}}, + "range":[0,74], + "value":" Non-anonymous function types are allowed as arrow function return types" + } + ] +} diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0008.js b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0008.js new file mode 100644 index 0000000..185c03e --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0008.js @@ -0,0 +1,3 @@ +// Anonymous function types are disallowed as arrow function return types +// So the `=>` clearly belongs to the arrow function +var f = (): (number) => 123; diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0008.tree.json b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0008.tree.json new file mode 100644 index 0000000..d804537 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0008.tree.json @@ -0,0 +1,71 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":28}}, + "range":[127,155], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":28}}, + "range":[127,155], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":27}}, + "range":[131,154], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":5}}, + "range":[131,132], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":27}}, + "range":[135,154], + "id":null, + "params":[], + "body":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":24},"end":{"line":3,"column":27}}, + "range":[151,154], + "value":123, + "raw":"123" + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":10},"end":{"line":3,"column":20}}, + "range":[137,147], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":13},"end":{"line":3,"column":19}}, + "range":[140,146] + } + }, + "typeParameters":null + } + } + ], + "kind":"var" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":73}}, + "range":[0,73], + "value":" Anonymous function types are disallowed as arrow function return types" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":52}}, + "range":[74,126], + "value":" So the `=>` clearly belongs to the arrow function" + } + ] +} diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0009.js b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0009.js new file mode 100644 index 0000000..6569a7b --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0009.js @@ -0,0 +1 @@ +var f = (): string | (number) => 123; diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0009.tree.json b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0009.tree.json new file mode 100644 index 0000000..3a3339e --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0009.tree.json @@ -0,0 +1,70 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "range":[0,37], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "range":[0,37], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":36}}, + "range":[4,36], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":36}}, + "range":[8,36], + "id":null, + "params":[], + "body":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":36}}, + "range":[33,36], + "value":123, + "raw":"123" + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":29}}, + "range":[10,29], + "typeAnnotation":{ + "type":"UnionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":29}}, + "range":[12,29], + "types":[ + { + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":18}}, + "range":[12,18] + }, + { + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":28}}, + "range":[22,28] + } + ] + } + }, + "typeParameters":null + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0010.js b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0010.js new file mode 100644 index 0000000..09d850f --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0010.js @@ -0,0 +1,3 @@ +// You can write anonymous function types as arrow function return types +// if you wrap them in parens +var f = (x): ((number) => 123) => 123; diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0010.tree.json b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0010.tree.json new file mode 100644 index 0000000..d0292ab --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0010.tree.json @@ -0,0 +1,103 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":38}}, + "range":[103,141], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":38}}, + "range":[103,141], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":37}}, + "range":[107,140], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":5}}, + "range":[107,108], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":37}}, + "range":[111,140], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":9},"end":{"line":3,"column":10}}, + "range":[112,113], + "name":"x", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":34},"end":{"line":3,"column":37}}, + "range":[137,140], + "value":123, + "raw":"123" + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":11},"end":{"line":3,"column":30}}, + "range":[114,133], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":14},"end":{"line":3,"column":29}}, + "range":[117,132], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":3,"column":15},"end":{"line":3,"column":21}}, + "range":[118,124], + "name":null, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":15},"end":{"line":3,"column":21}}, + "range":[118,124] + }, + "optional":false + } + ], + "returnType":{ + "type":"NumberLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":26},"end":{"line":3,"column":29}}, + "range":[129,132], + "value":123, + "raw":"123" + }, + "rest":null, + "typeParameters":null + } + }, + "typeParameters":null + } + } + ], + "kind":"var" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":72}}, + "range":[0,72], + "value":" You can write anonymous function types as arrow function return types" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":29}}, + "range":[73,102], + "value":" if you wrap them in parens" + } + ] +} diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0011.js b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0011.js new file mode 100644 index 0000000..0a48866 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0011.js @@ -0,0 +1,2 @@ +// Anonymous function types are disallowed as arrow function return types +var f = (x): (number) => 123 => 123; diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0011.tree.json b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0011.tree.json new file mode 100644 index 0000000..9df2ad7 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0011.tree.json @@ -0,0 +1,97 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":29},"end":{"line":2,"column":31}}, + "message":"Unexpected token `=>`, expected the token `;`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":29},"end":{"line":2,"column":31}}, + "message":"Unexpected token `=>`, expected the start of a statement" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":36}}, + "range":[74,110], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":28}}, + "range":[74,102], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":28}}, + "range":[78,102], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":5}}, + "range":[78,79], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":28}}, + "range":[82,102], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, + "range":[83,84], + "name":"x", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":25},"end":{"line":2,"column":28}}, + "range":[99,102], + "value":123, + "raw":"123" + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":21}}, + "range":[85,95], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":20}}, + "range":[88,94] + } + }, + "typeParameters":null + } + } + ], + "kind":"var" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":32},"end":{"line":2,"column":36}}, + "range":[106,110], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":32},"end":{"line":2,"column":35}}, + "range":[106,109], + "value":123, + "raw":"123" + }, + "directive":null + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":73}}, + "range":[0,73], + "value":" Anonymous function types are disallowed as arrow function return types" + } + ] +} diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0012.js b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0012.js new file mode 100644 index 0000000..5107d20 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0012.js @@ -0,0 +1,2 @@ +// Anonymous function types are disallowed as arrow function return types +var f = (x): string | (number) => 123 => 123; diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0012.tree.json b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0012.tree.json new file mode 100644 index 0000000..ce644d2 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0012.tree.json @@ -0,0 +1,109 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":38},"end":{"line":2,"column":40}}, + "message":"Unexpected token `=>`, expected the token `;`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":38},"end":{"line":2,"column":40}}, + "message":"Unexpected token `=>`, expected the start of a statement" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":45}}, + "range":[74,119], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":37}}, + "range":[74,111], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":37}}, + "range":[78,111], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":5}}, + "range":[78,79], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":37}}, + "range":[82,111], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, + "range":[83,84], + "name":"x", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":34},"end":{"line":2,"column":37}}, + "range":[108,111], + "value":123, + "raw":"123" + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":30}}, + "range":[85,104], + "typeAnnotation":{ + "type":"UnionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":30}}, + "range":[87,104], + "types":[ + { + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":19}}, + "range":[87,93] + }, + { + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":23},"end":{"line":2,"column":29}}, + "range":[97,103] + } + ] + } + }, + "typeParameters":null + } + } + ], + "kind":"var" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":41},"end":{"line":2,"column":45}}, + "range":[115,119], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":41},"end":{"line":2,"column":44}}, + "range":[115,118], + "value":123, + "raw":"123" + }, + "directive":null + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":73}}, + "range":[0,73], + "value":" Anonymous function types are disallowed as arrow function return types" + } + ] +} diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0013.js b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0013.js new file mode 100644 index 0000000..bbad97c --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0013.js @@ -0,0 +1,2 @@ +// Anonymous function types are disallowed as arrow function return types +var f = (x): ?(number) => 123 => 123; diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0013.tree.json b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0013.tree.json new file mode 100644 index 0000000..73cd5d4 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0013.tree.json @@ -0,0 +1,102 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":30},"end":{"line":2,"column":32}}, + "message":"Unexpected token `=>`, expected the token `;`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":30},"end":{"line":2,"column":32}}, + "message":"Unexpected token `=>`, expected the start of a statement" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":37}}, + "range":[74,111], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":29}}, + "range":[74,103], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":29}}, + "range":[78,103], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":5}}, + "range":[78,79], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":29}}, + "range":[82,103], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, + "range":[83,84], + "name":"x", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":26},"end":{"line":2,"column":29}}, + "range":[100,103], + "value":123, + "raw":"123" + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":22}}, + "range":[85,96], + "typeAnnotation":{ + "type":"NullableTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":22}}, + "range":[87,96], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":15},"end":{"line":2,"column":21}}, + "range":[89,95] + } + } + }, + "typeParameters":null + } + } + ], + "kind":"var" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":33},"end":{"line":2,"column":37}}, + "range":[107,111], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":33},"end":{"line":2,"column":36}}, + "range":[107,110], + "value":123, + "raw":"123" + }, + "directive":null + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":73}}, + "range":[0,73], + "value":" Anonymous function types are disallowed as arrow function return types" + } + ] +} diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0014.js b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0014.js new file mode 100644 index 0000000..8c0af33 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0014.js @@ -0,0 +1 @@ +type A = string => void diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0014.tree.json b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0014.tree.json new file mode 100644 index 0000000..5a3e7ee --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0014.tree.json @@ -0,0 +1,48 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":23}}, + "range":[9,23], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "range":[9,15], + "name":null, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "range":[9,15] + }, + "optional":false + } + ], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":23}}, + "range":[19,23] + }, + "rest":null, + "typeParameters":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0015.js b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0015.js new file mode 100644 index 0000000..c8d9391 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0015.js @@ -0,0 +1 @@ +type A = Array => void diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0015.tree.json b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0015.tree.json new file mode 100644 index 0000000..21612e2 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0015.tree.json @@ -0,0 +1,68 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":30}}, + "range":[9,30], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":22}}, + "range":[9,22], + "name":null, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":22}}, + "range":[9,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "range":[9,14], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":22}}, + "range":[14,22], + "params":[ + { + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":21}}, + "range":[15,21] + } + ] + } + }, + "optional":false + } + ], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":30}}, + "range":[26,30] + }, + "rest":null, + "typeParameters":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0016.js b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0016.js new file mode 100644 index 0000000..742a276 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0016.js @@ -0,0 +1,3 @@ +// Anonymous function types are disallowed as arrow function return types +// So the `=>` clearly belongs to the arrow function +var f = (): number => 123; diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0016.tree.json b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0016.tree.json new file mode 100644 index 0000000..9c7b9df --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0016.tree.json @@ -0,0 +1,71 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":26}}, + "range":[127,153], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":26}}, + "range":[127,153], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":25}}, + "range":[131,152], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":5}}, + "range":[131,132], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":25}}, + "range":[135,152], + "id":null, + "params":[], + "body":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":22},"end":{"line":3,"column":25}}, + "range":[149,152], + "value":123, + "raw":"123" + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":10},"end":{"line":3,"column":18}}, + "range":[137,145], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":12},"end":{"line":3,"column":18}}, + "range":[139,145] + } + }, + "typeParameters":null + } + } + ], + "kind":"var" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":73}}, + "range":[0,73], + "value":" Anonymous function types are disallowed as arrow function return types" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":52}}, + "range":[74,126], + "value":" So the `=>` clearly belongs to the arrow function" + } + ] +} diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0017.js b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0017.js new file mode 100644 index 0000000..a844c64 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0017.js @@ -0,0 +1,3 @@ +// Anonymous function types are disallowed as arrow function return types +// So the `=>` clearly belongs to the arrow function +var f = (): string | number => 123; diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0017.tree.json b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0017.tree.json new file mode 100644 index 0000000..abad455 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0017.tree.json @@ -0,0 +1,83 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":35}}, + "range":[127,162], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":35}}, + "range":[127,162], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":34}}, + "range":[131,161], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":5}}, + "range":[131,132], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":34}}, + "range":[135,161], + "id":null, + "params":[], + "body":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":31},"end":{"line":3,"column":34}}, + "range":[158,161], + "value":123, + "raw":"123" + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":10},"end":{"line":3,"column":27}}, + "range":[137,154], + "typeAnnotation":{ + "type":"UnionTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":12},"end":{"line":3,"column":27}}, + "range":[139,154], + "types":[ + { + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":12},"end":{"line":3,"column":18}}, + "range":[139,145] + }, + { + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":21},"end":{"line":3,"column":27}}, + "range":[148,154] + } + ] + } + }, + "typeParameters":null + } + } + ], + "kind":"var" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":73}}, + "range":[0,73], + "value":" Anonymous function types are disallowed as arrow function return types" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":52}}, + "range":[74,126], + "value":" So the `=>` clearly belongs to the arrow function" + } + ] +} diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0018.js b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0018.js new file mode 100644 index 0000000..d9fda13 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0018.js @@ -0,0 +1,3 @@ +// You can write anonymous function types as arrow function return types +// if you wrap them in parens +var f = (x): (number => 123) => 123; diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0018.tree.json b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0018.tree.json new file mode 100644 index 0000000..e2ca8f3 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0018.tree.json @@ -0,0 +1,103 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":36}}, + "range":[103,139], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":36}}, + "range":[103,139], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":35}}, + "range":[107,138], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":4},"end":{"line":3,"column":5}}, + "range":[107,108], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":3,"column":8},"end":{"line":3,"column":35}}, + "range":[111,138], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":9},"end":{"line":3,"column":10}}, + "range":[112,113], + "name":"x", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":32},"end":{"line":3,"column":35}}, + "range":[135,138], + "value":123, + "raw":"123" + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":11},"end":{"line":3,"column":28}}, + "range":[114,131], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":14},"end":{"line":3,"column":27}}, + "range":[117,130], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":3,"column":14},"end":{"line":3,"column":20}}, + "range":[117,123], + "name":null, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":14},"end":{"line":3,"column":20}}, + "range":[117,123] + }, + "optional":false + } + ], + "returnType":{ + "type":"NumberLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":24},"end":{"line":3,"column":27}}, + "range":[127,130], + "value":123, + "raw":"123" + }, + "rest":null, + "typeParameters":null + } + }, + "typeParameters":null + } + } + ], + "kind":"var" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":72}}, + "range":[0,72], + "value":" You can write anonymous function types as arrow function return types" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":29}}, + "range":[73,102], + "value":" if you wrap them in parens" + } + ] +} diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0019.js b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0019.js new file mode 100644 index 0000000..d28e435 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0019.js @@ -0,0 +1,2 @@ +// string | (number => boolean) +type A = string | number => boolean; diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0019.tree.json b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0019.tree.json new file mode 100644 index 0000000..3a00f67 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0019.tree.json @@ -0,0 +1,67 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":36}}, + "range":[32,68], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":36}}, + "range":[32,68], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":6}}, + "range":[37,38], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"UnionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":35}}, + "range":[41,67], + "types":[ + { + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":15}}, + "range":[41,47] + }, + { + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":18},"end":{"line":2,"column":35}}, + "range":[50,67], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":2,"column":18},"end":{"line":2,"column":24}}, + "range":[50,56], + "name":null, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":18},"end":{"line":2,"column":24}}, + "range":[50,56] + }, + "optional":false + } + ], + "returnType":{ + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":28},"end":{"line":2,"column":35}}, + "range":[60,67] + }, + "rest":null, + "typeParameters":null + } + ] + } + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "value":" string | (number => boolean)" + } + ] +} diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0020.js b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0020.js new file mode 100644 index 0000000..c8644d6 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0020.js @@ -0,0 +1,2 @@ +// string & (number => boolean) +type A = string & number => boolean; diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0020.tree.json b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0020.tree.json new file mode 100644 index 0000000..6edce81 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0020.tree.json @@ -0,0 +1,67 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":36}}, + "range":[32,68], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":36}}, + "range":[32,68], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":6}}, + "range":[37,38], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"IntersectionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":35}}, + "range":[41,67], + "types":[ + { + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":15}}, + "range":[41,47] + }, + { + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":18},"end":{"line":2,"column":35}}, + "range":[50,67], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":2,"column":18},"end":{"line":2,"column":24}}, + "range":[50,56], + "name":null, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":18},"end":{"line":2,"column":24}}, + "range":[50,56] + }, + "optional":false + } + ], + "returnType":{ + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":28},"end":{"line":2,"column":35}}, + "range":[60,67] + }, + "rest":null, + "typeParameters":null + } + ] + } + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "value":" string & (number => boolean)" + } + ] +} diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0021.js b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0021.js new file mode 100644 index 0000000..57d4e44 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0021.js @@ -0,0 +1,2 @@ +// (?number) => boolean +type A = ?number => boolean; diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0021.tree.json b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0021.tree.json new file mode 100644 index 0000000..04aeb66 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0021.tree.json @@ -0,0 +1,60 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":28}}, + "range":[24,52], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":28}}, + "range":[24,52], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":6}}, + "range":[29,30], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":27}}, + "range":[33,51], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":16}}, + "range":[33,40], + "name":null, + "typeAnnotation":{ + "type":"NullableTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":16}}, + "range":[33,40], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":16}}, + "range":[34,40] + } + }, + "optional":false + } + ], + "returnType":{ + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":20},"end":{"line":2,"column":27}}, + "range":[44,51] + }, + "rest":null, + "typeParameters":null + } + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "value":" (?number) => boolean" + } + ] +} diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0022.js b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0022.js new file mode 100644 index 0000000..5d440c2 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0022.js @@ -0,0 +1,2 @@ +// (number[]) => boolean +type A = number[] => boolean; diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0022.tree.json b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0022.tree.json new file mode 100644 index 0000000..a828b84 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0022.tree.json @@ -0,0 +1,60 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":29}}, + "range":[25,54], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":29}}, + "range":[25,54], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":6}}, + "range":[30,31], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":28}}, + "range":[34,53], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":17}}, + "range":[34,42], + "name":null, + "typeAnnotation":{ + "type":"ArrayTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":17}}, + "range":[34,42], + "elementType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":15}}, + "range":[34,40] + } + }, + "optional":false + } + ], + "returnType":{ + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":21},"end":{"line":2,"column":28}}, + "range":[46,53] + }, + "rest":null, + "typeParameters":null + } + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "value":" (number[]) => boolean" + } + ] +} diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0023.js b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0023.js new file mode 100644 index 0000000..c2bbde7 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0023.js @@ -0,0 +1 @@ +type A = (string => boolean) => number diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0023.tree.json b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0023.tree.json new file mode 100644 index 0000000..3e7da95 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0023.tree.json @@ -0,0 +1,69 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":38}}, + "range":[9,38], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":27}}, + "range":[10,27], + "name":null, + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":27}}, + "range":[10,27], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, + "range":[10,16], + "name":null, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, + "range":[10,16] + }, + "optional":false + } + ], + "returnType":{ + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":27}}, + "range":[20,27] + }, + "rest":null, + "typeParameters":null + }, + "optional":false + } + ], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":38}}, + "range":[32,38] + }, + "rest":null, + "typeParameters":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0024.js b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0024.js new file mode 100644 index 0000000..fd14835 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0024.js @@ -0,0 +1,2 @@ +// string => (boolean | number) +type A = string => boolean | number; diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0024.tree.json b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0024.tree.json new file mode 100644 index 0000000..181fd4c --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0024.tree.json @@ -0,0 +1,67 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":36}}, + "range":[32,68], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":36}}, + "range":[32,68], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":6}}, + "range":[37,38], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":35}}, + "range":[41,67], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":15}}, + "range":[41,47], + "name":null, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":15}}, + "range":[41,47] + }, + "optional":false + } + ], + "returnType":{ + "type":"UnionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":35}}, + "range":[51,67], + "types":[ + { + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":26}}, + "range":[51,58] + }, + { + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":29},"end":{"line":2,"column":35}}, + "range":[61,67] + } + ] + }, + "rest":null, + "typeParameters":null + } + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "value":" string => (boolean | number)" + } + ] +} diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0025.js b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0025.js new file mode 100644 index 0000000..7602a88 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0025.js @@ -0,0 +1,2 @@ +// Becomes string => (boolean => number) +type A = string => boolean => number; diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0025.tree.json b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0025.tree.json new file mode 100644 index 0000000..df6ccb2 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0025.tree.json @@ -0,0 +1,76 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":37}}, + "range":[41,78], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":37}}, + "range":[41,78], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":6}}, + "range":[46,47], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":36}}, + "range":[50,77], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":15}}, + "range":[50,56], + "name":null, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":15}}, + "range":[50,56] + }, + "optional":false + } + ], + "returnType":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":36}}, + "range":[60,77], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":26}}, + "range":[60,67], + "name":null, + "typeAnnotation":{ + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":26}}, + "range":[60,67] + }, + "optional":false + } + ], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":30},"end":{"line":2,"column":36}}, + "range":[71,77] + }, + "rest":null, + "typeParameters":null + }, + "rest":null, + "typeParameters":null + } + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "range":[0,40], + "value":" Becomes string => (boolean => number)" + } + ] +} diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0026.js b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0026.js new file mode 100644 index 0000000..c5a95ab --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0026.js @@ -0,0 +1,2 @@ +// Anonymous function types are disallowed as arrow function return types +var f = (x): number => 123 => 123; diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0026.tree.json b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0026.tree.json new file mode 100644 index 0000000..39fc22c --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0026.tree.json @@ -0,0 +1,97 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":27},"end":{"line":2,"column":29}}, + "message":"Unexpected token `=>`, expected the token `;`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":27},"end":{"line":2,"column":29}}, + "message":"Unexpected token `=>`, expected the start of a statement" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":34}}, + "range":[74,108], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":26}}, + "range":[74,100], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":26}}, + "range":[78,100], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":5}}, + "range":[78,79], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":26}}, + "range":[82,100], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, + "range":[83,84], + "name":"x", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":23},"end":{"line":2,"column":26}}, + "range":[97,100], + "value":123, + "raw":"123" + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":19}}, + "range":[85,93], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":19}}, + "range":[87,93] + } + }, + "typeParameters":null + } + } + ], + "kind":"var" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":30},"end":{"line":2,"column":34}}, + "range":[104,108], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":30},"end":{"line":2,"column":33}}, + "range":[104,107], + "value":123, + "raw":"123" + }, + "directive":null + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":73}}, + "range":[0,73], + "value":" Anonymous function types are disallowed as arrow function return types" + } + ] +} diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0027.js b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0027.js new file mode 100644 index 0000000..b770f46 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0027.js @@ -0,0 +1,2 @@ +// Anonymous function types are disallowed as arrow function return types +var f = (x): string | number => 123 => 123; diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0027.tree.json b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0027.tree.json new file mode 100644 index 0000000..ddf5a47 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/migrated_0027.tree.json @@ -0,0 +1,109 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":36},"end":{"line":2,"column":38}}, + "message":"Unexpected token `=>`, expected the token `;`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":36},"end":{"line":2,"column":38}}, + "message":"Unexpected token `=>`, expected the start of a statement" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":43}}, + "range":[74,117], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":35}}, + "range":[74,109], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":35}}, + "range":[78,109], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":5}}, + "range":[78,79], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":35}}, + "range":[82,109], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, + "range":[83,84], + "name":"x", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":32},"end":{"line":2,"column":35}}, + "range":[106,109], + "value":123, + "raw":"123" + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":28}}, + "range":[85,102], + "typeAnnotation":{ + "type":"UnionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":28}}, + "range":[87,102], + "types":[ + { + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":13},"end":{"line":2,"column":19}}, + "range":[87,93] + }, + { + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":22},"end":{"line":2,"column":28}}, + "range":[96,102] + } + ] + } + }, + "typeParameters":null + } + } + ], + "kind":"var" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":39},"end":{"line":2,"column":43}}, + "range":[113,117], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":39},"end":{"line":2,"column":42}}, + "range":[113,116], + "value":123, + "raw":"123" + }, + "directive":null + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":73}}, + "range":[0,73], + "value":" Anonymous function types are disallowed as arrow function return types" + } + ] +} diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/some_named_some_anonymous.js b/lib/test/flow/types/function_types_with_anonymous_parameters/some_named_some_anonymous.js new file mode 100644 index 0000000..ee6c187 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/some_named_some_anonymous.js @@ -0,0 +1 @@ +type T = (arg: string, number) => void diff --git a/lib/test/flow/types/function_types_with_anonymous_parameters/some_named_some_anonymous.tree.json b/lib/test/flow/types/function_types_with_anonymous_parameters/some_named_some_anonymous.tree.json new file mode 100644 index 0000000..553efc8 --- /dev/null +++ b/lib/test/flow/types/function_types_with_anonymous_parameters/some_named_some_anonymous.tree.json @@ -0,0 +1,67 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":38}}, + "range":[9,38], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":21}}, + "range":[10,21], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, + "range":[10,13], + "name":"arg", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":21}}, + "range":[15,21] + }, + "optional":false + }, + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":29}}, + "range":[23,29], + "name":null, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":29}}, + "range":[23,29] + }, + "optional":false + } + ], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":38}}, + "range":[34,38] + }, + "rest":null, + "typeParameters":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/grouping/function.js b/lib/test/flow/types/grouping/function.js new file mode 100644 index 0000000..5207583 --- /dev/null +++ b/lib/test/flow/types/grouping/function.js @@ -0,0 +1 @@ +type A = (B) => (C) diff --git a/lib/test/flow/types/grouping/function.tree.json b/lib/test/flow/types/grouping/function.tree.json new file mode 100644 index 0000000..e641ea4 --- /dev/null +++ b/lib/test/flow/types/grouping/function.tree.json @@ -0,0 +1,66 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "range":[0,19], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "range":[0,19], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":19}}, + "range":[9,19], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":null, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "optional":false + } + ], + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "range":[17,18], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "range":[17,18], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "rest":null, + "typeParameters":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/grouping/function_param.js b/lib/test/flow/types/grouping/function_param.js new file mode 100644 index 0000000..8edd306 --- /dev/null +++ b/lib/test/flow/types/grouping/function_param.js @@ -0,0 +1 @@ +type A = (b: (B)) => C diff --git a/lib/test/flow/types/grouping/function_param.tree.json b/lib/test/flow/types/grouping/function_param.tree.json new file mode 100644 index 0000000..b8a57e4 --- /dev/null +++ b/lib/test/flow/types/grouping/function_param.tree.json @@ -0,0 +1,73 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":22}}, + "range":[9,22], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, + "range":[10,16], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "optional":false + } + ], + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "rest":null, + "typeParameters":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/grouping/intersection.js b/lib/test/flow/types/grouping/intersection.js new file mode 100644 index 0000000..b3b3207 --- /dev/null +++ b/lib/test/flow/types/grouping/intersection.js @@ -0,0 +1 @@ +type A = B & (C) diff --git a/lib/test/flow/types/grouping/intersection.tree.json b/lib/test/flow/types/grouping/intersection.tree.json new file mode 100644 index 0000000..ccb77e9 --- /dev/null +++ b/lib/test/flow/types/grouping/intersection.tree.json @@ -0,0 +1,57 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"IntersectionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "types":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/grouping/intersection_of_union.js b/lib/test/flow/types/grouping/intersection_of_union.js new file mode 100644 index 0000000..4100a9a --- /dev/null +++ b/lib/test/flow/types/grouping/intersection_of_union.js @@ -0,0 +1 @@ +var a: number & (string | bool) diff --git a/lib/test/flow/types/grouping/intersection_of_union.tree.json b/lib/test/flow/types/grouping/intersection_of_union.tree.json new file mode 100644 index 0000000..96481e0 --- /dev/null +++ b/lib/test/flow/types/grouping/intersection_of_union.tree.json @@ -0,0 +1,63 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":31}}, + "range":[4,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":31}}, + "range":[4,31], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":31}}, + "range":[5,31], + "typeAnnotation":{ + "type":"IntersectionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":31}}, + "range":[7,31], + "types":[ + { + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, + "range":[7,13] + }, + { + "type":"UnionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":30}}, + "range":[17,30], + "types":[ + { + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":23}}, + "range":[17,23] + }, + { + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":30}}, + "range":[26,30] + } + ] + } + ] + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/grouping/method.js b/lib/test/flow/types/grouping/method.js new file mode 100644 index 0000000..45601af --- /dev/null +++ b/lib/test/flow/types/grouping/method.js @@ -0,0 +1,3 @@ +type A = { + b(): (B) +} diff --git a/lib/test/flow/types/grouping/method.tree.json b/lib/test/flow/types/grouping/method.tree.json new file mode 100644 index 0000000..ae2719d --- /dev/null +++ b/lib/test/flow/types/grouping/method.tree.json @@ -0,0 +1,75 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,23], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,23], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":3,"column":1}}, + "range":[9,23], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":10}}, + "range":[13,21], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[13,14], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":10}}, + "range":[13,21], + "params":[], + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "range":[19,20], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "range":[19,20], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "rest":null, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/grouping/migrated_0000.js b/lib/test/flow/types/grouping/migrated_0000.js new file mode 100644 index 0000000..77b7260 --- /dev/null +++ b/lib/test/flow/types/grouping/migrated_0000.js @@ -0,0 +1 @@ +var a: (number) diff --git a/lib/test/flow/types/grouping/migrated_0000.tree.json b/lib/test/flow/types/grouping/migrated_0000.tree.json new file mode 100644 index 0000000..a378f4c --- /dev/null +++ b/lib/test/flow/types/grouping/migrated_0000.tree.json @@ -0,0 +1,39 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":15}}, + "range":[4,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":15}}, + "range":[4,15], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":15}}, + "range":[5,15], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, + "range":[8,14] + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/grouping/migrated_0001.js b/lib/test/flow/types/grouping/migrated_0001.js new file mode 100644 index 0000000..4754f49 --- /dev/null +++ b/lib/test/flow/types/grouping/migrated_0001.js @@ -0,0 +1 @@ +var a: (() => number) | () => string diff --git a/lib/test/flow/types/grouping/migrated_0001.tree.json b/lib/test/flow/types/grouping/migrated_0001.tree.json new file mode 100644 index 0000000..63efddd --- /dev/null +++ b/lib/test/flow/types/grouping/migrated_0001.tree.json @@ -0,0 +1,67 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":36}}, + "range":[4,36], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":36}}, + "range":[4,36], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":36}}, + "range":[5,36], + "typeAnnotation":{ + "type":"UnionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":36}}, + "range":[8,36], + "types":[ + { + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":20}}, + "range":[8,20], + "params":[], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":20}}, + "range":[14,20] + }, + "rest":null, + "typeParameters":null + }, + { + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":36}}, + "range":[24,36], + "params":[], + "returnType":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":36}}, + "range":[30,36] + }, + "rest":null, + "typeParameters":null + } + ] + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/grouping/migrated_0003.js b/lib/test/flow/types/grouping/migrated_0003.js new file mode 100644 index 0000000..dbd1764 --- /dev/null +++ b/lib/test/flow/types/grouping/migrated_0003.js @@ -0,0 +1 @@ +var a: (typeof A) diff --git a/lib/test/flow/types/grouping/migrated_0003.tree.json b/lib/test/flow/types/grouping/migrated_0003.tree.json new file mode 100644 index 0000000..a517c68 --- /dev/null +++ b/lib/test/flow/types/grouping/migrated_0003.tree.json @@ -0,0 +1,53 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, + "range":[4,17], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, + "range":[4,17], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":17}}, + "range":[5,17], + "typeAnnotation":{ + "type":"TypeofTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":16}}, + "range":[8,16], + "argument":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/grouping/migrated_0004.js b/lib/test/flow/types/grouping/migrated_0004.js new file mode 100644 index 0000000..ce4d6fd --- /dev/null +++ b/lib/test/flow/types/grouping/migrated_0004.js @@ -0,0 +1 @@ +var a: Array<(number)> diff --git a/lib/test/flow/types/grouping/migrated_0004.tree.json b/lib/test/flow/types/grouping/migrated_0004.tree.json new file mode 100644 index 0000000..2c75c84 --- /dev/null +++ b/lib/test/flow/types/grouping/migrated_0004.tree.json @@ -0,0 +1,59 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":22}}, + "range":[4,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":22}}, + "range":[4,22], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":22}}, + "range":[5,22], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":22}}, + "range":[7,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, + "range":[7,12], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":22}}, + "range":[12,22], + "params":[ + { + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":20}}, + "range":[14,20] + } + ] + } + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/grouping/migrated_0005.js b/lib/test/flow/types/grouping/migrated_0005.js new file mode 100644 index 0000000..33fbd6a --- /dev/null +++ b/lib/test/flow/types/grouping/migrated_0005.js @@ -0,0 +1 @@ +var a: ([]) = [] diff --git a/lib/test/flow/types/grouping/migrated_0005.tree.json b/lib/test/flow/types/grouping/migrated_0005.tree.json new file mode 100644 index 0000000..b917563 --- /dev/null +++ b/lib/test/flow/types/grouping/migrated_0005.tree.json @@ -0,0 +1,45 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, + "range":[4,16], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, + "range":[4,11], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, + "range":[5,11], + "typeAnnotation":{ + "type":"TupleTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, + "range":[8,10], + "types":[] + } + }, + "optional":false + }, + "init":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, + "range":[14,16], + "elements":[] + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/grouping/migrated_0006.js b/lib/test/flow/types/grouping/migrated_0006.js new file mode 100644 index 0000000..5f12ba4 --- /dev/null +++ b/lib/test/flow/types/grouping/migrated_0006.js @@ -0,0 +1 @@ +var a: (number: number) => number = (number) => { return 123; } diff --git a/lib/test/flow/types/grouping/migrated_0006.tree.json b/lib/test/flow/types/grouping/migrated_0006.tree.json new file mode 100644 index 0000000..0541181 --- /dev/null +++ b/lib/test/flow/types/grouping/migrated_0006.tree.json @@ -0,0 +1,107 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "range":[0,63], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "range":[0,63], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":63}}, + "range":[4,63], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":33}}, + "range":[4,33], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":33}}, + "range":[5,33], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":33}}, + "range":[7,33], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":22}}, + "range":[8,22], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, + "range":[8,14], + "name":"number", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":22}}, + "range":[16,22] + }, + "optional":false + } + ], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":33}}, + "range":[27,33] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "init":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":63}}, + "range":[36,63], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":43}}, + "range":[37,43], + "name":"number", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":48},"end":{"line":1,"column":63}}, + "range":[48,63], + "body":[ + { + "type":"ReturnStatement", + "loc":{"source":null,"start":{"line":1,"column":50},"end":{"line":1,"column":61}}, + "range":[50,61], + "argument":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":57},"end":{"line":1,"column":60}}, + "range":[57,60], + "value":123, + "raw":"123" + } + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/grouping/nullable.js b/lib/test/flow/types/grouping/nullable.js new file mode 100644 index 0000000..e09d2cd --- /dev/null +++ b/lib/test/flow/types/grouping/nullable.js @@ -0,0 +1 @@ +type A = ?(?B) diff --git a/lib/test/flow/types/grouping/nullable.tree.json b/lib/test/flow/types/grouping/nullable.tree.json new file mode 100644 index 0000000..5d25259 --- /dev/null +++ b/lib/test/flow/types/grouping/nullable.tree.json @@ -0,0 +1,46 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"NullableTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "range":[9,14], + "typeAnnotation":{ + "type":"NullableTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, + "range":[11,13], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/grouping/object_type_call_property.js b/lib/test/flow/types/grouping/object_type_call_property.js new file mode 100644 index 0000000..ddb4b2d --- /dev/null +++ b/lib/test/flow/types/grouping/object_type_call_property.js @@ -0,0 +1,3 @@ +type A = { + (): (B) +} diff --git a/lib/test/flow/types/grouping/object_type_call_property.tree.json b/lib/test/flow/types/grouping/object_type_call_property.tree.json new file mode 100644 index 0000000..14f62ae --- /dev/null +++ b/lib/test/flow/types/grouping/object_type_call_property.tree.json @@ -0,0 +1,62 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,22], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":3,"column":1}}, + "range":[9,22], + "exact":false, + "inexact":false, + "properties":[], + "indexers":[], + "callProperties":[ + { + "type":"ObjectTypeCallProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "range":[13,20], + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":9}}, + "range":[13,20], + "params":[], + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":8}}, + "range":[18,19], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":8}}, + "range":[18,19], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "rest":null, + "typeParameters":null + }, + "static":false + } + ], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/grouping/object_type_indexer.js b/lib/test/flow/types/grouping/object_type_indexer.js new file mode 100644 index 0000000..d99dbe3 --- /dev/null +++ b/lib/test/flow/types/grouping/object_type_indexer.js @@ -0,0 +1,3 @@ +type A = { + [B]: (C) +} diff --git a/lib/test/flow/types/grouping/object_type_indexer.tree.json b/lib/test/flow/types/grouping/object_type_indexer.tree.json new file mode 100644 index 0000000..4e2100c --- /dev/null +++ b/lib/test/flow/types/grouping/object_type_indexer.tree.json @@ -0,0 +1,70 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,23], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,23], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":3,"column":1}}, + "range":[9,23], + "exact":false, + "inexact":false, + "properties":[], + "indexers":[ + { + "type":"ObjectTypeIndexer", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":10}}, + "range":[13,21], + "id":null, + "key":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":4}}, + "range":[14,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":3},"end":{"line":2,"column":4}}, + "range":[14,15], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "value":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "range":[19,20], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, + "range":[19,20], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "static":false, + "variance":null + } + ], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/grouping/object_type_property.js b/lib/test/flow/types/grouping/object_type_property.js new file mode 100644 index 0000000..984ad32 --- /dev/null +++ b/lib/test/flow/types/grouping/object_type_property.js @@ -0,0 +1,3 @@ +type A = { + b: (B) +} diff --git a/lib/test/flow/types/grouping/object_type_property.tree.json b/lib/test/flow/types/grouping/object_type_property.tree.json new file mode 100644 index 0000000..b09672f --- /dev/null +++ b/lib/test/flow/types/grouping/object_type_property.tree.json @@ -0,0 +1,67 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,21], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,21], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":3,"column":1}}, + "range":[9,21], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":8}}, + "range":[13,19], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":3}}, + "range":[13,14], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, + "range":[17,18], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, + "range":[17,18], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/grouping/object_type_spread_property.js b/lib/test/flow/types/grouping/object_type_spread_property.js new file mode 100644 index 0000000..f4fc177 --- /dev/null +++ b/lib/test/flow/types/grouping/object_type_spread_property.js @@ -0,0 +1,3 @@ +type A = { + ...(B) +} diff --git a/lib/test/flow/types/grouping/object_type_spread_property.tree.json b/lib/test/flow/types/grouping/object_type_spread_property.tree.json new file mode 100644 index 0000000..b846627 --- /dev/null +++ b/lib/test/flow/types/grouping/object_type_spread_property.tree.json @@ -0,0 +1,53 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,21], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,21], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":3,"column":1}}, + "range":[9,21], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeSpreadProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":8}}, + "range":[13,19], + "argument":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, + "range":[17,18], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, + "range":[17,18], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/grouping/typeof.js b/lib/test/flow/types/grouping/typeof.js new file mode 100644 index 0000000..ae9ff28 --- /dev/null +++ b/lib/test/flow/types/grouping/typeof.js @@ -0,0 +1 @@ +type A = typeof (B) diff --git a/lib/test/flow/types/grouping/typeof.tree.json b/lib/test/flow/types/grouping/typeof.tree.json new file mode 100644 index 0000000..d837a0e --- /dev/null +++ b/lib/test/flow/types/grouping/typeof.tree.json @@ -0,0 +1,41 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "range":[0,19], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "range":[0,19], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"TypeofTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":19}}, + "range":[9,19], + "argument":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "range":[17,18], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "range":[17,18], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/grouping/union.js b/lib/test/flow/types/grouping/union.js new file mode 100644 index 0000000..72e268c --- /dev/null +++ b/lib/test/flow/types/grouping/union.js @@ -0,0 +1 @@ +type A = B | (C) diff --git a/lib/test/flow/types/grouping/union.tree.json b/lib/test/flow/types/grouping/union.tree.json new file mode 100644 index 0000000..da29a29 --- /dev/null +++ b/lib/test/flow/types/grouping/union.tree.json @@ -0,0 +1,57 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"UnionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "types":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/grouping_invalid/migrated_0000.js b/lib/test/flow/types/grouping_invalid/migrated_0000.js new file mode 100644 index 0000000..26bd4a2 --- /dev/null +++ b/lib/test/flow/types/grouping_invalid/migrated_0000.js @@ -0,0 +1 @@ +var a: (true: number) => number = (number) => { return 123; } diff --git a/lib/test/flow/types/grouping_invalid/migrated_0000.tree.json b/lib/test/flow/types/grouping_invalid/migrated_0000.tree.json new file mode 100644 index 0000000..911be33 --- /dev/null +++ b/lib/test/flow/types/grouping_invalid/migrated_0000.tree.json @@ -0,0 +1,138 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "message":"Unexpected token `:`, expected the token `)`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":20}}, + "message":"Unexpected identifier, expected the token `;`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "message":"Unexpected token `)`, expected the end of an expression statement (`;`)" + }, + { + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "message":"Unexpected token `)`, expected the start of a statement" + }, + { + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, + "message":"Unexpected token `=>`, expected the start of a statement" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":61}}, + "range":[0,61], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, + "range":[4,13], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, + "range":[4,13], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":13}}, + "range":[5,13], + "typeAnnotation":{ + "type":"BooleanLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":12}}, + "range":[8,12], + "value":true, + "raw":"true" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":20}}, + "range":[14,20], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":20}}, + "range":[14,20], + "name":"number", + "typeAnnotation":null, + "optional":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":61}}, + "range":[25,61], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":61}}, + "range":[25,61], + "operator":"=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":31}}, + "range":[25,31], + "name":"number", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":61}}, + "range":[34,61], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":41}}, + "range":[35,41], + "name":"number", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":46},"end":{"line":1,"column":61}}, + "range":[46,61], + "body":[ + { + "type":"ReturnStatement", + "loc":{"source":null,"start":{"line":1,"column":48},"end":{"line":1,"column":59}}, + "range":[48,59], + "argument":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":55},"end":{"line":1,"column":58}}, + "range":[55,58], + "value":123, + "raw":"123" + } + } + ] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/import_type_shorthand/migrated_0000.js b/lib/test/flow/types/import_type_shorthand/migrated_0000.js new file mode 100644 index 0000000..762a6b0 --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/migrated_0000.js @@ -0,0 +1 @@ +import {type} from "foo"; diff --git a/lib/test/flow/types/import_type_shorthand/migrated_0000.tree.json b/lib/test/flow/types/import_type_shorthand/migrated_0000.tree.json new file mode 100644 index 0000000..0b64043 --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/migrated_0000.tree.json @@ -0,0 +1,45 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":12}}, + "range":[8,12], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":12}}, + "range":[8,12], + "name":"type", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":12}}, + "range":[8,12], + "name":"type", + "typeAnnotation":null, + "optional":false + }, + "importKind":null + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":24}}, + "range":[19,24], + "value":"foo", + "raw":"\"foo\"" + }, + "importKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/import_type_shorthand/migrated_0001.js b/lib/test/flow/types/import_type_shorthand/migrated_0001.js new file mode 100644 index 0000000..1562543 --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/migrated_0001.js @@ -0,0 +1 @@ +import {type t} from "foo"; diff --git a/lib/test/flow/types/import_type_shorthand/migrated_0001.tree.json b/lib/test/flow/types/import_type_shorthand/migrated_0001.tree.json new file mode 100644 index 0000000..e9323f2 --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/migrated_0001.tree.json @@ -0,0 +1,45 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "name":"t", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "name":"t", + "typeAnnotation":null, + "optional":false + }, + "importKind":"type" + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":26}}, + "range":[21,26], + "value":"foo", + "raw":"\"foo\"" + }, + "importKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/import_type_shorthand/migrated_0002.js b/lib/test/flow/types/import_type_shorthand/migrated_0002.js new file mode 100644 index 0000000..2c68158 --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/migrated_0002.js @@ -0,0 +1 @@ +import {type as} from "foo"; diff --git a/lib/test/flow/types/import_type_shorthand/migrated_0002.tree.json b/lib/test/flow/types/import_type_shorthand/migrated_0002.tree.json new file mode 100644 index 0000000..a70a9f1 --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/migrated_0002.tree.json @@ -0,0 +1,45 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, + "range":[13,15], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, + "range":[13,15], + "name":"as", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, + "range":[13,15], + "name":"as", + "typeAnnotation":null, + "optional":false + }, + "importKind":"type" + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":27}}, + "range":[22,27], + "value":"foo", + "raw":"\"foo\"" + }, + "importKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/import_type_shorthand/migrated_0003.js b/lib/test/flow/types/import_type_shorthand/migrated_0003.js new file mode 100644 index 0000000..9772d0d --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/migrated_0003.js @@ -0,0 +1 @@ +import {type t as u} from "foo"; diff --git a/lib/test/flow/types/import_type_shorthand/migrated_0003.tree.json b/lib/test/flow/types/import_type_shorthand/migrated_0003.tree.json new file mode 100644 index 0000000..b1772bf --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/migrated_0003.tree.json @@ -0,0 +1,45 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":19}}, + "range":[13,19], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "name":"t", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "name":"u", + "typeAnnotation":null, + "optional":false + }, + "importKind":"type" + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":31}}, + "range":[26,31], + "value":"foo", + "raw":"\"foo\"" + }, + "importKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/import_type_shorthand/migrated_0004.js b/lib/test/flow/types/import_type_shorthand/migrated_0004.js new file mode 100644 index 0000000..1ac1cea --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/migrated_0004.js @@ -0,0 +1 @@ +import {typeof t} from "foo"; diff --git a/lib/test/flow/types/import_type_shorthand/migrated_0004.tree.json b/lib/test/flow/types/import_type_shorthand/migrated_0004.tree.json new file mode 100644 index 0000000..03c7aa0 --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/migrated_0004.tree.json @@ -0,0 +1,45 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"t", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"t", + "typeAnnotation":null, + "optional":false + }, + "importKind":"typeof" + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":28}}, + "range":[23,28], + "value":"foo", + "raw":"\"foo\"" + }, + "importKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/import_type_shorthand/migrated_0005.js b/lib/test/flow/types/import_type_shorthand/migrated_0005.js new file mode 100644 index 0000000..c34de8f --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/migrated_0005.js @@ -0,0 +1 @@ +import {typeof as} from "foo"; diff --git a/lib/test/flow/types/import_type_shorthand/migrated_0005.tree.json b/lib/test/flow/types/import_type_shorthand/migrated_0005.tree.json new file mode 100644 index 0000000..c52498f --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/migrated_0005.tree.json @@ -0,0 +1,45 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, + "range":[15,17], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, + "range":[15,17], + "name":"as", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, + "range":[15,17], + "name":"as", + "typeAnnotation":null, + "optional":false + }, + "importKind":"typeof" + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":29}}, + "range":[24,29], + "value":"foo", + "raw":"\"foo\"" + }, + "importKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/import_type_shorthand/migrated_0006.js b/lib/test/flow/types/import_type_shorthand/migrated_0006.js new file mode 100644 index 0000000..94f071d --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/migrated_0006.js @@ -0,0 +1 @@ +import {typeof t as u} from "foo"; diff --git a/lib/test/flow/types/import_type_shorthand/migrated_0006.tree.json b/lib/test/flow/types/import_type_shorthand/migrated_0006.tree.json new file mode 100644 index 0000000..2922696 --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/migrated_0006.tree.json @@ -0,0 +1,45 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "range":[0,34], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "range":[0,34], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":21}}, + "range":[15,21], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"t", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "name":"u", + "typeAnnotation":null, + "optional":false + }, + "importKind":"typeof" + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":33}}, + "range":[28,33], + "value":"foo", + "raw":"\"foo\"" + }, + "importKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/import_type_shorthand/migrated_0007.js b/lib/test/flow/types/import_type_shorthand/migrated_0007.js new file mode 100644 index 0000000..0e5a01a --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/migrated_0007.js @@ -0,0 +1 @@ +import {type t as} from "foo"; diff --git a/lib/test/flow/types/import_type_shorthand/migrated_0007.tree.json b/lib/test/flow/types/import_type_shorthand/migrated_0007.tree.json new file mode 100644 index 0000000..d54a9c8 --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/migrated_0007.tree.json @@ -0,0 +1,145 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "message":"Unexpected token `}`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":23}}, + "message":"Missing comma between import specifiers" + }, + { + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":29}}, + "message":"Missing comma between import specifiers" + }, + { + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":29}}, + "message":"Unexpected string, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, + "message":"Missing comma between import specifiers" + }, + { + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, + "message":"Unexpected token `;`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the token `}`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the keyword `from`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,31], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,31], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":18}}, + "range":[13,18], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "name":"t", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "range":[17,18], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "importKind":"type" + }, + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":23}}, + "range":[19,23], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":23}}, + "range":[19,23], + "name":"from", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":23}}, + "range":[19,23], + "name":"from", + "typeAnnotation":null, + "optional":false + }, + "importKind":null + }, + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":29}}, + "range":[24,29], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":29}}, + "range":[24,29], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":29}}, + "range":[24,29], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "importKind":null + }, + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, + "range":[29,30], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, + "range":[29,30], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, + "range":[29,30], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "importKind":null + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "range":[31,31], + "value":"", + "raw":"" + }, + "importKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/import_type_shorthand/migrated_0008.js b/lib/test/flow/types/import_type_shorthand/migrated_0008.js new file mode 100644 index 0000000..2433929 --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/migrated_0008.js @@ -0,0 +1 @@ +import {typeof} from "foo"; diff --git a/lib/test/flow/types/import_type_shorthand/migrated_0008.tree.json b/lib/test/flow/types/import_type_shorthand/migrated_0008.tree.json new file mode 100644 index 0000000..e0b798f --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/migrated_0008.tree.json @@ -0,0 +1,51 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, + "message":"Unexpected token `typeof`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, + "range":[8,14], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, + "range":[8,14], + "name":"typeof", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, + "range":[8,14], + "name":"typeof", + "typeAnnotation":null, + "optional":false + }, + "importKind":null + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":26}}, + "range":[21,26], + "value":"foo", + "raw":"\"foo\"" + }, + "importKind":"value" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/import_type_shorthand/migrated_0009.js b/lib/test/flow/types/import_type_shorthand/migrated_0009.js new file mode 100644 index 0000000..19d1434 --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/migrated_0009.js @@ -0,0 +1 @@ +import type {type t} from "foo"; diff --git a/lib/test/flow/types/import_type_shorthand/migrated_0009.tree.json b/lib/test/flow/types/import_type_shorthand/migrated_0009.tree.json new file mode 100644 index 0000000..f28b2e8 --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/migrated_0009.tree.json @@ -0,0 +1,51 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":17}}, + "message":"The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "name":"t", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "name":"t", + "typeAnnotation":null, + "optional":false + }, + "importKind":null + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":31}}, + "range":[26,31], + "value":"foo", + "raw":"\"foo\"" + }, + "importKind":"type" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/import_type_shorthand/reserved_type.js b/lib/test/flow/types/import_type_shorthand/reserved_type.js new file mode 100644 index 0000000..218c1a7 --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/reserved_type.js @@ -0,0 +1,2 @@ +// error, `string` is a reserved type name +import { type string } from 'foo'; diff --git a/lib/test/flow/types/import_type_shorthand/reserved_type.tree.json b/lib/test/flow/types/import_type_shorthand/reserved_type.tree.json new file mode 100644 index 0000000..a01e2de --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/reserved_type.tree.json @@ -0,0 +1,58 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":20}}, + "message":"Unexpected reserved type" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":34}}, + "range":[43,77], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":34}}, + "range":[43,77], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":20}}, + "range":[57,63], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":20}}, + "range":[57,63], + "name":"string", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":20}}, + "range":[57,63], + "name":"string", + "typeAnnotation":null, + "optional":false + }, + "importKind":"type" + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":28},"end":{"line":2,"column":33}}, + "range":[71,76], + "value":"foo", + "raw":"'foo'" + }, + "importKind":"value" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "range":[0,42], + "value":" error, `string` is a reserved type name" + } + ] +} diff --git a/lib/test/flow/types/import_type_shorthand/type_as_as.js b/lib/test/flow/types/import_type_shorthand/type_as_as.js new file mode 100644 index 0000000..70f026d --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/type_as_as.js @@ -0,0 +1,2 @@ +// ok, a type named `as`, renamed to `x` +import { type as as x } from "ModuleName"; diff --git a/lib/test/flow/types/import_type_shorthand/type_as_as.tree.json b/lib/test/flow/types/import_type_shorthand/type_as_as.tree.json new file mode 100644 index 0000000..7cf6321 --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/type_as_as.tree.json @@ -0,0 +1,52 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":42}}, + "range":[41,83], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":42}}, + "range":[41,83], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":21}}, + "range":[55,62], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":16}}, + "range":[55,57], + "name":"as", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":20},"end":{"line":2,"column":21}}, + "range":[61,62], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "importKind":"type" + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":29},"end":{"line":2,"column":41}}, + "range":[70,82], + "value":"ModuleName", + "raw":"\"ModuleName\"" + }, + "importKind":"value" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "range":[0,40], + "value":" ok, a type named `as`, renamed to `x`" + } + ] +} diff --git a/lib/test/flow/types/import_type_shorthand/typeof_in_typeof.js b/lib/test/flow/types/import_type_shorthand/typeof_in_typeof.js new file mode 100644 index 0000000..4cff04a --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/typeof_in_typeof.js @@ -0,0 +1 @@ +import typeof {typeof t} from "foo"; diff --git a/lib/test/flow/types/import_type_shorthand/typeof_in_typeof.tree.json b/lib/test/flow/types/import_type_shorthand/typeof_in_typeof.tree.json new file mode 100644 index 0000000..cbad58f --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/typeof_in_typeof.tree.json @@ -0,0 +1,51 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":21}}, + "message":"The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, + "range":[22,23], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, + "range":[22,23], + "name":"t", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, + "range":[22,23], + "name":"t", + "typeAnnotation":null, + "optional":false + }, + "importKind":null + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":35}}, + "range":[30,35], + "value":"foo", + "raw":"\"foo\"" + }, + "importKind":"typeof" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/import_type_shorthand/typeof_in_typeof_reserved_type.js b/lib/test/flow/types/import_type_shorthand/typeof_in_typeof_reserved_type.js new file mode 100644 index 0000000..689b2ad --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/typeof_in_typeof_reserved_type.js @@ -0,0 +1,2 @@ +// 2 errors: typeof specifier in typeof declaration, and `string` is reserved +import typeof {typeof string} from "foo"; diff --git a/lib/test/flow/types/import_type_shorthand/typeof_in_typeof_reserved_type.tree.json b/lib/test/flow/types/import_type_shorthand/typeof_in_typeof_reserved_type.tree.json new file mode 100644 index 0000000..01c69dc --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/typeof_in_typeof_reserved_type.tree.json @@ -0,0 +1,62 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":15},"end":{"line":2,"column":21}}, + "message":"The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements" + }, + { + "loc":{"source":null,"start":{"line":2,"column":22},"end":{"line":2,"column":28}}, + "message":"Unexpected reserved type" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":41}}, + "range":[78,119], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":41}}, + "range":[78,119], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":2,"column":22},"end":{"line":2,"column":28}}, + "range":[100,106], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":22},"end":{"line":2,"column":28}}, + "range":[100,106], + "name":"string", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":22},"end":{"line":2,"column":28}}, + "range":[100,106], + "name":"string", + "typeAnnotation":null, + "optional":false + }, + "importKind":null + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":35},"end":{"line":2,"column":40}}, + "range":[113,118], + "value":"foo", + "raw":"\"foo\"" + }, + "importKind":"typeof" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":77}}, + "range":[0,77], + "value":" 2 errors: typeof specifier in typeof declaration, and `string` is reserved" + } + ] +} diff --git a/lib/test/flow/types/import_type_shorthand/typeof_in_typeof_reserved_value.js b/lib/test/flow/types/import_type_shorthand/typeof_in_typeof_reserved_value.js new file mode 100644 index 0000000..ab7ad86 --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/typeof_in_typeof_reserved_value.js @@ -0,0 +1,2 @@ +// error: typeof specifier in typeof declaration +import typeof {typeof switch} from "foo"; diff --git a/lib/test/flow/types/import_type_shorthand/typeof_in_typeof_reserved_value.tree.json b/lib/test/flow/types/import_type_shorthand/typeof_in_typeof_reserved_value.tree.json new file mode 100644 index 0000000..7497af0 --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/typeof_in_typeof_reserved_value.tree.json @@ -0,0 +1,58 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":15},"end":{"line":2,"column":21}}, + "message":"The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":41}}, + "range":[49,90], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":41}}, + "range":[49,90], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":2,"column":22},"end":{"line":2,"column":28}}, + "range":[71,77], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":22},"end":{"line":2,"column":28}}, + "range":[71,77], + "name":"switch", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":22},"end":{"line":2,"column":28}}, + "range":[71,77], + "name":"switch", + "typeAnnotation":null, + "optional":false + }, + "importKind":null + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":35},"end":{"line":2,"column":40}}, + "range":[84,89], + "value":"foo", + "raw":"\"foo\"" + }, + "importKind":"typeof" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "range":[0,48], + "value":" error: typeof specifier in typeof declaration" + } + ] +} diff --git a/lib/test/flow/types/import_type_shorthand/typeof_reserved_type.js b/lib/test/flow/types/import_type_shorthand/typeof_reserved_type.js new file mode 100644 index 0000000..d740d17 --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/typeof_reserved_type.js @@ -0,0 +1,2 @@ +// error, `string` is a reserved type name +import { typeof string } from "foo"; diff --git a/lib/test/flow/types/import_type_shorthand/typeof_reserved_type.tree.json b/lib/test/flow/types/import_type_shorthand/typeof_reserved_type.tree.json new file mode 100644 index 0000000..878808f --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/typeof_reserved_type.tree.json @@ -0,0 +1,58 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":22}}, + "message":"Unexpected reserved type" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":36}}, + "range":[43,79], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":36}}, + "range":[43,79], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":22}}, + "range":[59,65], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":22}}, + "range":[59,65], + "name":"string", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":22}}, + "range":[59,65], + "name":"string", + "typeAnnotation":null, + "optional":false + }, + "importKind":"typeof" + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":30},"end":{"line":2,"column":35}}, + "range":[73,78], + "value":"foo", + "raw":"\"foo\"" + }, + "importKind":"value" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "range":[0,42], + "value":" error, `string` is a reserved type name" + } + ] +} diff --git a/lib/test/flow/types/import_type_shorthand/typeof_reserved_value.js b/lib/test/flow/types/import_type_shorthand/typeof_reserved_value.js new file mode 100644 index 0000000..b4f1530 --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/typeof_reserved_value.js @@ -0,0 +1,2 @@ +// ok, `switch` is a reserved value but not reserved type name +import { typeof switch } from "foo"; diff --git a/lib/test/flow/types/import_type_shorthand/typeof_reserved_value.tree.json b/lib/test/flow/types/import_type_shorthand/typeof_reserved_value.tree.json new file mode 100644 index 0000000..8d01d8f --- /dev/null +++ b/lib/test/flow/types/import_type_shorthand/typeof_reserved_value.tree.json @@ -0,0 +1,52 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":36}}, + "range":[63,99], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":36}}, + "range":[63,99], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":22}}, + "range":[79,85], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":22}}, + "range":[79,85], + "name":"switch", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":22}}, + "range":[79,85], + "name":"switch", + "typeAnnotation":null, + "optional":false + }, + "importKind":"typeof" + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":30},"end":{"line":2,"column":35}}, + "range":[93,98], + "value":"foo", + "raw":"\"foo\"" + }, + "importKind":"value" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":62}}, + "range":[0,62], + "value":" ok, `switch` is a reserved value but not reserved type name" + } + ] +} diff --git a/lib/test/flow/types/import_types/default_reserved_type.js b/lib/test/flow/types/import_types/default_reserved_type.js new file mode 100644 index 0000000..b888c12 --- /dev/null +++ b/lib/test/flow/types/import_types/default_reserved_type.js @@ -0,0 +1,2 @@ +// error, `string` is a reserved type name +import type string from 'foo'; diff --git a/lib/test/flow/types/import_types/default_reserved_type.tree.json b/lib/test/flow/types/import_types/default_reserved_type.tree.json new file mode 100644 index 0000000..278e6b0 --- /dev/null +++ b/lib/test/flow/types/import_types/default_reserved_type.tree.json @@ -0,0 +1,49 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":18}}, + "message":"Unexpected reserved type" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":30}}, + "range":[43,73], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":30}}, + "range":[43,73], + "specifiers":[ + { + "type":"ImportDefaultSpecifier", + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":18}}, + "range":[55,61], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":18}}, + "range":[55,61], + "name":"string", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":24},"end":{"line":2,"column":29}}, + "range":[67,72], + "value":"foo", + "raw":"'foo'" + }, + "importKind":"type" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "range":[0,42], + "value":" error, `string` is a reserved type name" + } + ] +} diff --git a/lib/test/flow/types/import_types/default_reserved_value.js b/lib/test/flow/types/import_types/default_reserved_value.js new file mode 100644 index 0000000..a23ed7f --- /dev/null +++ b/lib/test/flow/types/import_types/default_reserved_value.js @@ -0,0 +1,2 @@ +// ok, because `switch` is not a reserved type name +import type switch from 'foo'; diff --git a/lib/test/flow/types/import_types/default_reserved_value.tree.json b/lib/test/flow/types/import_types/default_reserved_value.tree.json new file mode 100644 index 0000000..cb58f80 --- /dev/null +++ b/lib/test/flow/types/import_types/default_reserved_value.tree.json @@ -0,0 +1,43 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":30}}, + "range":[52,82], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":30}}, + "range":[52,82], + "specifiers":[ + { + "type":"ImportDefaultSpecifier", + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":18}}, + "range":[64,70], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":18}}, + "range":[64,70], + "name":"switch", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":24},"end":{"line":2,"column":29}}, + "range":[76,81], + "value":"foo", + "raw":"'foo'" + }, + "importKind":"type" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, + "range":[0,51], + "value":" ok, because `switch` is not a reserved type name" + } + ] +} diff --git a/lib/test/flow/types/import_types/migrated_0000.js b/lib/test/flow/types/import_types/migrated_0000.js new file mode 100644 index 0000000..2ede7e8 --- /dev/null +++ b/lib/test/flow/types/import_types/migrated_0000.js @@ -0,0 +1 @@ +import type "MyModule" diff --git a/lib/test/flow/types/import_types/migrated_0000.tree.json b/lib/test/flow/types/import_types/migrated_0000.tree.json new file mode 100644 index 0000000..b5206d1 --- /dev/null +++ b/lib/test/flow/types/import_types/migrated_0000.tree.json @@ -0,0 +1,46 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":22}}, + "message":"Unexpected string, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the keyword `from`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "specifiers":[ + { + "type":"ImportDefaultSpecifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":22}}, + "range":[12,22], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":22}}, + "range":[12,22], + "name":"", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":22}}, + "range":[22,22], + "value":"", + "raw":"" + }, + "importKind":"type" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/import_types/named_reserved_type.js b/lib/test/flow/types/import_types/named_reserved_type.js new file mode 100644 index 0000000..163109d --- /dev/null +++ b/lib/test/flow/types/import_types/named_reserved_type.js @@ -0,0 +1,2 @@ +// error, `string` is a reserved type name +import type { string } from 'foo'; diff --git a/lib/test/flow/types/import_types/named_reserved_type.tree.json b/lib/test/flow/types/import_types/named_reserved_type.tree.json new file mode 100644 index 0000000..1071ac5 --- /dev/null +++ b/lib/test/flow/types/import_types/named_reserved_type.tree.json @@ -0,0 +1,58 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":20}}, + "message":"Unexpected reserved type" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":34}}, + "range":[43,77], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":34}}, + "range":[43,77], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":20}}, + "range":[57,63], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":20}}, + "range":[57,63], + "name":"string", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":20}}, + "range":[57,63], + "name":"string", + "typeAnnotation":null, + "optional":false + }, + "importKind":null + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":28},"end":{"line":2,"column":33}}, + "range":[71,76], + "value":"foo", + "raw":"'foo'" + }, + "importKind":"type" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "range":[0,42], + "value":" error, `string` is a reserved type name" + } + ] +} diff --git a/lib/test/flow/types/import_types/named_reserved_value.js b/lib/test/flow/types/import_types/named_reserved_value.js new file mode 100644 index 0000000..7703060 --- /dev/null +++ b/lib/test/flow/types/import_types/named_reserved_value.js @@ -0,0 +1,2 @@ +// ok, reserved words are not reserved types +import type { switch } from 'foo'; diff --git a/lib/test/flow/types/import_types/named_reserved_value.tree.json b/lib/test/flow/types/import_types/named_reserved_value.tree.json new file mode 100644 index 0000000..3ab82dc --- /dev/null +++ b/lib/test/flow/types/import_types/named_reserved_value.tree.json @@ -0,0 +1,52 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":34}}, + "range":[45,79], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":34}}, + "range":[45,79], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":20}}, + "range":[59,65], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":20}}, + "range":[59,65], + "name":"switch", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":20}}, + "range":[59,65], + "name":"switch", + "typeAnnotation":null, + "optional":false + }, + "importKind":null + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":28},"end":{"line":2,"column":33}}, + "range":[73,78], + "value":"foo", + "raw":"'foo'" + }, + "importKind":"type" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":44}}, + "range":[0,44], + "value":" ok, reserved words are not reserved types" + } + ] +} diff --git a/lib/test/flow/types/import_types/namespace.js b/lib/test/flow/types/import_types/namespace.js new file mode 100644 index 0000000..793aa5d --- /dev/null +++ b/lib/test/flow/types/import_types/namespace.js @@ -0,0 +1 @@ +import type * as ns from "ModuleName"; diff --git a/lib/test/flow/types/import_types/namespace.tree.json b/lib/test/flow/types/import_types/namespace.tree.json new file mode 100644 index 0000000..8449840 --- /dev/null +++ b/lib/test/flow/types/import_types/namespace.tree.json @@ -0,0 +1,42 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "message":"Unexpected token `*`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "specifiers":[ + { + "type":"ImportNamespaceSpecifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":19}}, + "range":[12,19], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, + "range":[17,19], + "name":"ns", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":37}}, + "range":[25,37], + "value":"ModuleName", + "raw":"\"ModuleName\"" + }, + "importKind":"type" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/import_types/namespace_reserved_type.js b/lib/test/flow/types/import_types/namespace_reserved_type.js new file mode 100644 index 0000000..ac15a38 --- /dev/null +++ b/lib/test/flow/types/import_types/namespace_reserved_type.js @@ -0,0 +1,2 @@ +// error, `string` is a reserved type name +import type * as string from "ModuleName"; diff --git a/lib/test/flow/types/import_types/namespace_reserved_type.tree.json b/lib/test/flow/types/import_types/namespace_reserved_type.tree.json new file mode 100644 index 0000000..ef30c74 --- /dev/null +++ b/lib/test/flow/types/import_types/namespace_reserved_type.tree.json @@ -0,0 +1,53 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":13}}, + "message":"Unexpected token `*`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":23}}, + "message":"Unexpected reserved type" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":42}}, + "range":[43,85], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":42}}, + "range":[43,85], + "specifiers":[ + { + "type":"ImportNamespaceSpecifier", + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":23}}, + "range":[55,66], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":23}}, + "range":[60,66], + "name":"string", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":29},"end":{"line":2,"column":41}}, + "range":[72,84], + "value":"ModuleName", + "raw":"\"ModuleName\"" + }, + "importKind":"type" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "range":[0,42], + "value":" error, `string` is a reserved type name" + } + ] +} diff --git a/lib/test/flow/types/import_types/namespace_reserved_value.js b/lib/test/flow/types/import_types/namespace_reserved_value.js new file mode 100644 index 0000000..7636d26 --- /dev/null +++ b/lib/test/flow/types/import_types/namespace_reserved_value.js @@ -0,0 +1,2 @@ +// ok, `switch` is a reserved value but ok type name +import type * as switch from "ModuleName"; diff --git a/lib/test/flow/types/import_types/namespace_reserved_value.tree.json b/lib/test/flow/types/import_types/namespace_reserved_value.tree.json new file mode 100644 index 0000000..8e14309 --- /dev/null +++ b/lib/test/flow/types/import_types/namespace_reserved_value.tree.json @@ -0,0 +1,49 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":13}}, + "message":"Unexpected token `*`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":42}}, + "range":[53,95], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":42}}, + "range":[53,95], + "specifiers":[ + { + "type":"ImportNamespaceSpecifier", + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":23}}, + "range":[65,76], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":23}}, + "range":[70,76], + "name":"switch", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":29},"end":{"line":2,"column":41}}, + "range":[82,94], + "value":"ModuleName", + "raw":"\"ModuleName\"" + }, + "importKind":"type" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, + "range":[0,52], + "value":" ok, `switch` is a reserved value but ok type name" + } + ] +} diff --git a/lib/test/flow/types/import_types/typeof_default_reserved_type.js b/lib/test/flow/types/import_types/typeof_default_reserved_type.js new file mode 100644 index 0000000..13d707d --- /dev/null +++ b/lib/test/flow/types/import_types/typeof_default_reserved_type.js @@ -0,0 +1,2 @@ +// error, `string` is a reserved type name +import typeof string from 'foo'; diff --git a/lib/test/flow/types/import_types/typeof_default_reserved_type.tree.json b/lib/test/flow/types/import_types/typeof_default_reserved_type.tree.json new file mode 100644 index 0000000..8b43807 --- /dev/null +++ b/lib/test/flow/types/import_types/typeof_default_reserved_type.tree.json @@ -0,0 +1,49 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":20}}, + "message":"Unexpected reserved type" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":32}}, + "range":[43,75], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":32}}, + "range":[43,75], + "specifiers":[ + { + "type":"ImportDefaultSpecifier", + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":20}}, + "range":[57,63], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":20}}, + "range":[57,63], + "name":"string", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":26},"end":{"line":2,"column":31}}, + "range":[69,74], + "value":"foo", + "raw":"'foo'" + }, + "importKind":"typeof" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "range":[0,42], + "value":" error, `string` is a reserved type name" + } + ] +} diff --git a/lib/test/flow/types/import_types/typeof_named_reserved_type.js b/lib/test/flow/types/import_types/typeof_named_reserved_type.js new file mode 100644 index 0000000..395e7cd --- /dev/null +++ b/lib/test/flow/types/import_types/typeof_named_reserved_type.js @@ -0,0 +1,2 @@ +// error, `string` is a reserved type name +import typeof { string } from 'foo'; diff --git a/lib/test/flow/types/import_types/typeof_named_reserved_type.tree.json b/lib/test/flow/types/import_types/typeof_named_reserved_type.tree.json new file mode 100644 index 0000000..58312ce --- /dev/null +++ b/lib/test/flow/types/import_types/typeof_named_reserved_type.tree.json @@ -0,0 +1,58 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":22}}, + "message":"Unexpected reserved type" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":36}}, + "range":[43,79], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":36}}, + "range":[43,79], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":22}}, + "range":[59,65], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":22}}, + "range":[59,65], + "name":"string", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":22}}, + "range":[59,65], + "name":"string", + "typeAnnotation":null, + "optional":false + }, + "importKind":null + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":30},"end":{"line":2,"column":35}}, + "range":[73,78], + "value":"foo", + "raw":"'foo'" + }, + "importKind":"typeof" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "range":[0,42], + "value":" error, `string` is a reserved type name" + } + ] +} diff --git a/lib/test/flow/types/import_types/typeof_named_reserved_type_alias.js b/lib/test/flow/types/import_types/typeof_named_reserved_type_alias.js new file mode 100644 index 0000000..2decfd7 --- /dev/null +++ b/lib/test/flow/types/import_types/typeof_named_reserved_type_alias.js @@ -0,0 +1,2 @@ +// ok, `string` is a reserved type but it's renamed +import typeof { string as StringT } from 'foo'; diff --git a/lib/test/flow/types/import_types/typeof_named_reserved_type_alias.tree.json b/lib/test/flow/types/import_types/typeof_named_reserved_type_alias.tree.json new file mode 100644 index 0000000..63c2ab9 --- /dev/null +++ b/lib/test/flow/types/import_types/typeof_named_reserved_type_alias.tree.json @@ -0,0 +1,52 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":47}}, + "range":[52,99], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":47}}, + "range":[52,99], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":33}}, + "range":[68,85], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":22}}, + "range":[68,74], + "name":"string", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":26},"end":{"line":2,"column":33}}, + "range":[78,85], + "name":"StringT", + "typeAnnotation":null, + "optional":false + }, + "importKind":null + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":41},"end":{"line":2,"column":46}}, + "range":[93,98], + "value":"foo", + "raw":"'foo'" + }, + "importKind":"typeof" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, + "range":[0,51], + "value":" ok, `string` is a reserved type but it's renamed" + } + ] +} diff --git a/lib/test/flow/types/import_types/typeof_namespace_reserved_type.js b/lib/test/flow/types/import_types/typeof_namespace_reserved_type.js new file mode 100644 index 0000000..7a91202 --- /dev/null +++ b/lib/test/flow/types/import_types/typeof_namespace_reserved_type.js @@ -0,0 +1,2 @@ +// error, `string` is a reserved type name +import typeof * as string from "ModuleName"; diff --git a/lib/test/flow/types/import_types/typeof_namespace_reserved_type.tree.json b/lib/test/flow/types/import_types/typeof_namespace_reserved_type.tree.json new file mode 100644 index 0000000..c7881ae --- /dev/null +++ b/lib/test/flow/types/import_types/typeof_namespace_reserved_type.tree.json @@ -0,0 +1,49 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":25}}, + "message":"Unexpected reserved type" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":44}}, + "range":[43,87], + "body":[ + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":44}}, + "range":[43,87], + "specifiers":[ + { + "type":"ImportNamespaceSpecifier", + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":25}}, + "range":[57,68], + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":25}}, + "range":[62,68], + "name":"string", + "typeAnnotation":null, + "optional":false + } + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":31},"end":{"line":2,"column":43}}, + "range":[74,86], + "value":"ModuleName", + "raw":"\"ModuleName\"" + }, + "importKind":"typeof" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "range":[0,42], + "value":" error, `string` is a reserved type name" + } + ] +} diff --git a/lib/test/flow/types/instance_spread_invalid/migrated_0000.js b/lib/test/flow/types/instance_spread_invalid/migrated_0000.js new file mode 100644 index 0000000..19818a4 --- /dev/null +++ b/lib/test/flow/types/instance_spread_invalid/migrated_0000.js @@ -0,0 +1 @@ +interface I {...O} diff --git a/lib/test/flow/types/instance_spread_invalid/migrated_0000.tree.json b/lib/test/flow/types/instance_spread_invalid/migrated_0000.tree.json new file mode 100644 index 0000000..403d3ad --- /dev/null +++ b/lib/test/flow/types/instance_spread_invalid/migrated_0000.tree.json @@ -0,0 +1,39 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, + "message":"Spreading a type is only allowed inside an object type" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "body":[ + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"I", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":18}}, + "range":[12,18], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/instance_spread_invalid/migrated_0001.js b/lib/test/flow/types/instance_spread_invalid/migrated_0001.js new file mode 100644 index 0000000..2d66d8b --- /dev/null +++ b/lib/test/flow/types/instance_spread_invalid/migrated_0001.js @@ -0,0 +1 @@ +declare class C {...O} diff --git a/lib/test/flow/types/instance_spread_invalid/migrated_0001.tree.json b/lib/test/flow/types/instance_spread_invalid/migrated_0001.tree.json new file mode 100644 index 0000000..be73173 --- /dev/null +++ b/lib/test/flow/types/instance_spread_invalid/migrated_0001.tree.json @@ -0,0 +1,41 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "message":"Spreading a type is only allowed inside an object type" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":22}}, + "range":[16,22], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/interfaces/implements_reserved_type.js b/lib/test/flow/types/interfaces/implements_reserved_type.js new file mode 100644 index 0000000..ec65311 --- /dev/null +++ b/lib/test/flow/types/interfaces/implements_reserved_type.js @@ -0,0 +1,2 @@ +// error, `string` is a reserved type +class Foo implements string {} diff --git a/lib/test/flow/types/interfaces/implements_reserved_type.tree.json b/lib/test/flow/types/interfaces/implements_reserved_type.tree.json new file mode 100644 index 0000000..0a4634f --- /dev/null +++ b/lib/test/flow/types/interfaces/implements_reserved_type.tree.json @@ -0,0 +1,60 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":21},"end":{"line":2,"column":27}}, + "message":"Unexpected reserved type" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":30}}, + "range":[38,68], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":30}}, + "range":[38,68], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":9}}, + "range":[44,47], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":2,"column":28},"end":{"line":2,"column":30}}, + "range":[66,68], + "body":[] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[ + { + "type":"ClassImplements", + "loc":{"source":null,"start":{"line":2,"column":21},"end":{"line":2,"column":27}}, + "range":[59,65], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":21},"end":{"line":2,"column":27}}, + "range":[59,65], + "name":"string", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ], + "decorators":[] + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "range":[0,37], + "value":" error, `string` is a reserved type" + } + ] +} diff --git a/lib/test/flow/types/interfaces/implements_reserved_value.js b/lib/test/flow/types/interfaces/implements_reserved_value.js new file mode 100644 index 0000000..3760363 --- /dev/null +++ b/lib/test/flow/types/interfaces/implements_reserved_value.js @@ -0,0 +1,2 @@ +// ok, `implements` refers to types so reserved values are fine +class Foo implements switch {} diff --git a/lib/test/flow/types/interfaces/implements_reserved_value.tree.json b/lib/test/flow/types/interfaces/implements_reserved_value.tree.json new file mode 100644 index 0000000..12ef057 --- /dev/null +++ b/lib/test/flow/types/interfaces/implements_reserved_value.tree.json @@ -0,0 +1,54 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":30}}, + "range":[64,94], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":30}}, + "range":[64,94], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":9}}, + "range":[70,73], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":2,"column":28},"end":{"line":2,"column":30}}, + "range":[92,94], + "body":[] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[ + { + "type":"ClassImplements", + "loc":{"source":null,"start":{"line":2,"column":21},"end":{"line":2,"column":27}}, + "range":[85,91], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":21},"end":{"line":2,"column":27}}, + "range":[85,91], + "name":"switch", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ], + "decorators":[] + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "range":[0,63], + "value":" ok, `implements` refers to types so reserved values are fine" + } + ] +} diff --git a/lib/test/flow/types/interfaces/inline.js b/lib/test/flow/types/interfaces/inline.js new file mode 100644 index 0000000..1274778 --- /dev/null +++ b/lib/test/flow/types/interfaces/inline.js @@ -0,0 +1,4 @@ +type A = interface { p: string } +type B = interface extends A { q: number } + +function f(o: interface) {} diff --git a/lib/test/flow/types/interfaces/inline.tree.json b/lib/test/flow/types/interfaces/inline.tree.json new file mode 100644 index 0000000..d685d1b --- /dev/null +++ b/lib/test/flow/types/interfaces/inline.tree.json @@ -0,0 +1,251 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":4,"column":23},"end":{"line":4,"column":24}}, + "message":"Unexpected token `)`, expected the token `{`" + }, + { + "loc":{"source":null,"start":{"line":4,"column":25},"end":{"line":4,"column":26}}, + "message":"Unexpected token `{`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":4,"column":26},"end":{"line":4,"column":27}}, + "message":"Unexpected token `}`, expected the token `:`" + }, + { + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":0}}, + "message":"Unexpected end of input" + }, + { + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":0}}, + "message":"Unexpected end of input, expected the token `}`" + }, + { + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":0}}, + "message":"Unexpected end of input, expected the token `,`" + }, + { + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":0}}, + "message":"Rest parameter must be final parameter of an argument list" + }, + { + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":0}}, + "message":"Unexpected end of input, expected the token `)`" + }, + { + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":0}}, + "message":"Unexpected end of input, expected the token `{`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":5,"column":0}}, + "range":[0,105], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"InterfaceTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":32}}, + "range":[9,32], + "extends":[], + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":32}}, + "range":[19,32], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":30}}, + "range":[21,30], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "name":"p", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":30}}, + "range":[24,30] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":42}}, + "range":[33,75], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":6}}, + "range":[38,39], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"InterfaceTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":42}}, + "range":[42,75], + "extends":[ + { + "type":"InterfaceExtends", + "loc":{"source":null,"start":{"line":2,"column":27},"end":{"line":2,"column":28}}, + "range":[60,61], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":27},"end":{"line":2,"column":28}}, + "range":[60,61], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ], + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":29},"end":{"line":2,"column":42}}, + "range":[62,75], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":2,"column":31},"end":{"line":2,"column":40}}, + "range":[64,73], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":31},"end":{"line":2,"column":32}}, + "range":[64,65], + "name":"q", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":34},"end":{"line":2,"column":40}}, + "range":[67,73] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + }, + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":4,"column":0},"end":{"line":5,"column":0}}, + "range":[77,105], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":9},"end":{"line":4,"column":10}}, + "range":[86,87], + "name":"f", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":11},"end":{"line":5,"column":0}}, + "range":[88,105], + "name":"o", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":12},"end":{"line":5,"column":0}}, + "range":[89,105], + "typeAnnotation":{ + "type":"InterfaceTypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":14},"end":{"line":5,"column":0}}, + "range":[91,105], + "extends":[], + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":23},"end":{"line":5,"column":0}}, + "range":[100,105], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":4,"column":25},"end":{"line":4,"column":27}}, + "range":[102,104], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":25},"end":{"line":4,"column":26}}, + "range":[102,103], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":0}}, + "range":[105,105] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + }, + "optional":false + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":0}}, + "range":[105,105], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/interfaces/migrated_0000.js b/lib/test/flow/types/interfaces/migrated_0000.js new file mode 100644 index 0000000..e3589f0 --- /dev/null +++ b/lib/test/flow/types/interfaces/migrated_0000.js @@ -0,0 +1 @@ +interface A {} diff --git a/lib/test/flow/types/interfaces/migrated_0000.tree.json b/lib/test/flow/types/interfaces/migrated_0000.tree.json new file mode 100644 index 0000000..edee076 --- /dev/null +++ b/lib/test/flow/types/interfaces/migrated_0000.tree.json @@ -0,0 +1,33 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "body":[ + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, + "range":[12,14], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/interfaces/migrated_0001.js b/lib/test/flow/types/interfaces/migrated_0001.js new file mode 100644 index 0000000..2e67cbd --- /dev/null +++ b/lib/test/flow/types/interfaces/migrated_0001.js @@ -0,0 +1 @@ +interface A {} diff --git a/lib/test/flow/types/interfaces/migrated_0001.tree.json b/lib/test/flow/types/interfaces/migrated_0001.tree.json new file mode 100644 index 0000000..576cb87 --- /dev/null +++ b/lib/test/flow/types/interfaces/migrated_0001.tree.json @@ -0,0 +1,57 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "body":[ + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":17}}, + "range":[11,17], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "name":"T", + "bound":null, + "variance":null, + "default":null + }, + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"S", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, + "range":[18,20], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/interfaces/migrated_0002.js b/lib/test/flow/types/interfaces/migrated_0002.js new file mode 100644 index 0000000..a5da57e --- /dev/null +++ b/lib/test/flow/types/interfaces/migrated_0002.js @@ -0,0 +1 @@ +interface A { foo: number; } diff --git a/lib/test/flow/types/interfaces/migrated_0002.tree.json b/lib/test/flow/types/interfaces/migrated_0002.tree.json new file mode 100644 index 0000000..8b88e67 --- /dev/null +++ b/lib/test/flow/types/interfaces/migrated_0002.tree.json @@ -0,0 +1,58 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "body":[ + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":28}}, + "range":[12,28], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":25}}, + "range":[14,25], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, + "range":[14,17], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":25}}, + "range":[19,25] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/interfaces/migrated_0003.js b/lib/test/flow/types/interfaces/migrated_0003.js new file mode 100644 index 0000000..ed2a0f0 --- /dev/null +++ b/lib/test/flow/types/interfaces/migrated_0003.js @@ -0,0 +1 @@ +interface A extends B {} diff --git a/lib/test/flow/types/interfaces/migrated_0003.tree.json b/lib/test/flow/types/interfaces/migrated_0003.tree.json new file mode 100644 index 0000000..c349853 --- /dev/null +++ b/lib/test/flow/types/interfaces/migrated_0003.tree.json @@ -0,0 +1,48 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "body":[ + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, + "range":[22,24], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[ + { + "type":"InterfaceExtends", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/interfaces/migrated_0004.js b/lib/test/flow/types/interfaces/migrated_0004.js new file mode 100644 index 0000000..73796cc --- /dev/null +++ b/lib/test/flow/types/interfaces/migrated_0004.js @@ -0,0 +1 @@ +interface A extends B, C {} diff --git a/lib/test/flow/types/interfaces/migrated_0004.tree.json b/lib/test/flow/types/interfaces/migrated_0004.tree.json new file mode 100644 index 0000000..dccbc09 --- /dev/null +++ b/lib/test/flow/types/interfaces/migrated_0004.tree.json @@ -0,0 +1,62 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "body":[ + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, + "range":[25,27], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[ + { + "type":"InterfaceExtends", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + { + "type":"InterfaceExtends", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, + "range":[23,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, + "range":[23,24], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/interfaces/migrated_0005.js b/lib/test/flow/types/interfaces/migrated_0005.js new file mode 100644 index 0000000..32dcc8c --- /dev/null +++ b/lib/test/flow/types/interfaces/migrated_0005.js @@ -0,0 +1 @@ +interface A extends B {} diff --git a/lib/test/flow/types/interfaces/migrated_0005.tree.json b/lib/test/flow/types/interfaces/migrated_0005.tree.json new file mode 100644 index 0000000..d3bc572 --- /dev/null +++ b/lib/test/flow/types/interfaces/migrated_0005.tree.json @@ -0,0 +1,83 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "body":[ + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "range":[11,14], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "name":"T", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, + "range":[28,30], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[ + { + "type":"InterfaceExtends", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":27}}, + "range":[23,27], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":24}}, + "range":[23,24], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":27}}, + "range":[24,27], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, + "range":[25,26], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, + "range":[25,26], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + } + ] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/interfaces/migrated_0006.js b/lib/test/flow/types/interfaces/migrated_0006.js new file mode 100644 index 0000000..70c6150 --- /dev/null +++ b/lib/test/flow/types/interfaces/migrated_0006.js @@ -0,0 +1 @@ +class Foo implements Bar {} diff --git a/lib/test/flow/types/interfaces/migrated_0006.tree.json b/lib/test/flow/types/interfaces/migrated_0006.tree.json new file mode 100644 index 0000000..ec3d93d --- /dev/null +++ b/lib/test/flow/types/interfaces/migrated_0006.tree.json @@ -0,0 +1,47 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, + "range":[25,27], + "body":[] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[ + { + "type":"ClassImplements", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":24}}, + "range":[21,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":24}}, + "range":[21,24], + "name":"Bar", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/interfaces/migrated_0007.js b/lib/test/flow/types/interfaces/migrated_0007.js new file mode 100644 index 0000000..9be013b --- /dev/null +++ b/lib/test/flow/types/interfaces/migrated_0007.js @@ -0,0 +1 @@ +class Foo extends Bar implements Bat, Man {} diff --git a/lib/test/flow/types/interfaces/migrated_0007.tree.json b/lib/test/flow/types/interfaces/migrated_0007.tree.json new file mode 100644 index 0000000..8891c90 --- /dev/null +++ b/lib/test/flow/types/interfaces/migrated_0007.tree.json @@ -0,0 +1,79 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, + "range":[0,52], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, + "range":[0,52], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":50},"end":{"line":1,"column":52}}, + "range":[50,52], + "body":[] + }, + "superClass":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, + "range":[18,21], + "name":"Bar", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "superTypeParameters":null, + "implements":[ + { + "type":"ClassImplements", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":36}}, + "range":[33,36], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":36}}, + "range":[33,36], + "name":"Bat", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + { + "type":"ClassImplements", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":49}}, + "range":[38,49], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":41}}, + "range":[38,41], + "name":"Man", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":49}}, + "range":[41,49], + "params":[ + { + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":42},"end":{"line":1,"column":48}}, + "range":[42,48] + } + ] + } + } + ], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/interfaces/migrated_0008.js b/lib/test/flow/types/interfaces/migrated_0008.js new file mode 100644 index 0000000..63e5ed7 --- /dev/null +++ b/lib/test/flow/types/interfaces/migrated_0008.js @@ -0,0 +1 @@ +class Foo extends class Bar implements Bat {} {} diff --git a/lib/test/flow/types/interfaces/migrated_0008.tree.json b/lib/test/flow/types/interfaces/migrated_0008.tree.json new file mode 100644 index 0000000..10327bd --- /dev/null +++ b/lib/test/flow/types/interfaces/migrated_0008.tree.json @@ -0,0 +1,70 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "range":[0,48], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "range":[0,48], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":46},"end":{"line":1,"column":48}}, + "range":[46,48], + "body":[] + }, + "superClass":{ + "type":"ClassExpression", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":45}}, + "range":[18,45], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":27}}, + "range":[24,27], + "name":"Bar", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":43},"end":{"line":1,"column":45}}, + "range":[43,45], + "body":[] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[ + { + "type":"ClassImplements", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":42}}, + "range":[39,42], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":42}}, + "range":[39,42], + "name":"Bat", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ], + "decorators":[] + }, + "typeParameters":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/interfaces/migrated_0009.js b/lib/test/flow/types/interfaces/migrated_0009.js new file mode 100644 index 0000000..65185b3 --- /dev/null +++ b/lib/test/flow/types/interfaces/migrated_0009.js @@ -0,0 +1 @@ +class Foo extends class Bar implements Bat {} implements Man {} diff --git a/lib/test/flow/types/interfaces/migrated_0009.tree.json b/lib/test/flow/types/interfaces/migrated_0009.tree.json new file mode 100644 index 0000000..0c367c5 --- /dev/null +++ b/lib/test/flow/types/interfaces/migrated_0009.tree.json @@ -0,0 +1,85 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "range":[0,63], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "range":[0,63], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":9}}, + "range":[6,9], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":61},"end":{"line":1,"column":63}}, + "range":[61,63], + "body":[] + }, + "superClass":{ + "type":"ClassExpression", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":45}}, + "range":[18,45], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":27}}, + "range":[24,27], + "name":"Bar", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":43},"end":{"line":1,"column":45}}, + "range":[43,45], + "body":[] + }, + "superClass":null, + "typeParameters":null, + "superTypeParameters":null, + "implements":[ + { + "type":"ClassImplements", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":42}}, + "range":[39,42], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":42}}, + "range":[39,42], + "name":"Bat", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ], + "decorators":[] + }, + "typeParameters":null, + "superTypeParameters":null, + "implements":[ + { + "type":"ClassImplements", + "loc":{"source":null,"start":{"line":1,"column":57},"end":{"line":1,"column":60}}, + "range":[57,60], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":57},"end":{"line":1,"column":60}}, + "range":[57,60], + "name":"Man", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/interfaces/migrated_0010.js b/lib/test/flow/types/interfaces/migrated_0010.js new file mode 100644 index 0000000..d6a845c --- /dev/null +++ b/lib/test/flow/types/interfaces/migrated_0010.js @@ -0,0 +1 @@ +interface A {numVal: number; [index: number]: string}; diff --git a/lib/test/flow/types/interfaces/migrated_0010.tree.json b/lib/test/flow/types/interfaces/migrated_0010.tree.json new file mode 100644 index 0000000..ec89761 --- /dev/null +++ b/lib/test/flow/types/interfaces/migrated_0010.tree.json @@ -0,0 +1,89 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, + "range":[0,54], + "body":[ + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":53}}, + "range":[0,53], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":53}}, + "range":[12,53], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":27}}, + "range":[13,27], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":19}}, + "range":[13,19], + "name":"numVal", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "range":[21,27] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[ + { + "type":"ObjectTypeIndexer", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":52}}, + "range":[29,52], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":35}}, + "range":[30,35], + "name":"index", + "typeAnnotation":null, + "optional":false + }, + "key":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":43}}, + "range":[37,43] + }, + "value":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":46},"end":{"line":1,"column":52}}, + "range":[46,52] + }, + "static":false, + "variance":null + } + ], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + }, + { + "type":"EmptyStatement", + "loc":{"source":null,"start":{"line":1,"column":53},"end":{"line":1,"column":54}}, + "range":[53,54] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/interfaces/migrated_0011.js b/lib/test/flow/types/interfaces/migrated_0011.js new file mode 100644 index 0000000..c6329c6 --- /dev/null +++ b/lib/test/flow/types/interfaces/migrated_0011.js @@ -0,0 +1 @@ +interface A {[index: number]: string; [index2: string]: number}; diff --git a/lib/test/flow/types/interfaces/migrated_0011.tree.json b/lib/test/flow/types/interfaces/migrated_0011.tree.json new file mode 100644 index 0000000..64caa1d --- /dev/null +++ b/lib/test/flow/types/interfaces/migrated_0011.tree.json @@ -0,0 +1,89 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":64}}, + "range":[0,64], + "body":[ + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":63}}, + "range":[0,63], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":63}}, + "range":[12,63], + "exact":false, + "properties":[], + "indexers":[ + { + "type":"ObjectTypeIndexer", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":36}}, + "range":[13,36], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, + "range":[14,19], + "name":"index", + "typeAnnotation":null, + "optional":false + }, + "key":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "range":[21,27] + }, + "value":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":36}}, + "range":[30,36] + }, + "static":false, + "variance":null + }, + { + "type":"ObjectTypeIndexer", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":62}}, + "range":[38,62], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":45}}, + "range":[39,45], + "name":"index2", + "typeAnnotation":null, + "optional":false + }, + "key":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":47},"end":{"line":1,"column":53}}, + "range":[47,53] + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":56},"end":{"line":1,"column":62}}, + "range":[56,62] + }, + "static":false, + "variance":null + } + ], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + }, + { + "type":"EmptyStatement", + "loc":{"source":null,"start":{"line":1,"column":63},"end":{"line":1,"column":64}}, + "range":[63,64] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/interfaces/prop_named_static.js b/lib/test/flow/types/interfaces/prop_named_static.js new file mode 100644 index 0000000..bc24795 --- /dev/null +++ b/lib/test/flow/types/interfaces/prop_named_static.js @@ -0,0 +1,5 @@ +// OK: static is a valid identifier name +interface A { static: number } +interface B { static?: number } +interface C { static(): void } // method named static +interface D { static(x: X): X } // poly method named static diff --git a/lib/test/flow/types/interfaces/prop_named_static.tree.json b/lib/test/flow/types/interfaces/prop_named_static.tree.json new file mode 100644 index 0000000..32190b0 --- /dev/null +++ b/lib/test/flow/types/interfaces/prop_named_static.tree.json @@ -0,0 +1,296 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":5,"column":34}}, + "range":[41,192], + "body":[ + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":30}}, + "range":[41,71], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, + "range":[51,52], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":30}}, + "range":[53,71], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":28}}, + "range":[55,69], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":20}}, + "range":[55,61], + "name":"static", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":22},"end":{"line":2,"column":28}}, + "range":[63,69] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + }, + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":31}}, + "range":[72,103], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":10},"end":{"line":3,"column":11}}, + "range":[82,83], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":12},"end":{"line":3,"column":31}}, + "range":[84,103], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":3,"column":14},"end":{"line":3,"column":29}}, + "range":[86,101], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":14},"end":{"line":3,"column":20}}, + "range":[86,92], + "name":"static", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":3,"column":23},"end":{"line":3,"column":29}}, + "range":[95,101] + }, + "method":false, + "optional":true, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + }, + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":4,"column":0},"end":{"line":4,"column":30}}, + "range":[104,134], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":10},"end":{"line":4,"column":11}}, + "range":[114,115], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":12},"end":{"line":4,"column":30}}, + "range":[116,134], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":4,"column":14},"end":{"line":4,"column":28}}, + "range":[118,132], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":14},"end":{"line":4,"column":20}}, + "range":[118,124], + "name":"static", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":14},"end":{"line":4,"column":28}}, + "range":[118,132], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":24},"end":{"line":4,"column":28}}, + "range":[128,132] + }, + "rest":null, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + }, + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":34}}, + "range":[158,192], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":10},"end":{"line":5,"column":11}}, + "range":[168,169], + "name":"D", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":12},"end":{"line":5,"column":34}}, + "range":[170,192], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":5,"column":14},"end":{"line":5,"column":32}}, + "range":[172,190], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":14},"end":{"line":5,"column":20}}, + "range":[172,178], + "name":"static", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":14},"end":{"line":5,"column":32}}, + "range":[172,190], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":5,"column":24},"end":{"line":5,"column":28}}, + "range":[182,186], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":24},"end":{"line":5,"column":25}}, + "range":[182,183], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":27},"end":{"line":5,"column":28}}, + "range":[185,186], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":27},"end":{"line":5,"column":28}}, + "range":[185,186], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "optional":false + } + ], + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":31},"end":{"line":5,"column":32}}, + "range":[189,190], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":31},"end":{"line":5,"column":32}}, + "range":[189,190], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "rest":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":5,"column":20},"end":{"line":5,"column":23}}, + "range":[178,181], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":5,"column":21},"end":{"line":5,"column":22}}, + "range":[179,180], + "name":"X", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "range":[0,40], + "value":" OK: static is a valid identifier name" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":4,"column":31},"end":{"line":4,"column":53}}, + "range":[135,157], + "value":" method named static" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":5,"column":35},"end":{"line":5,"column":62}}, + "range":[193,220], + "value":" poly method named static" + } + ] +} diff --git a/lib/test/flow/types/interfaces/reserved_type.js b/lib/test/flow/types/interfaces/reserved_type.js new file mode 100644 index 0000000..e2181c3 --- /dev/null +++ b/lib/test/flow/types/interfaces/reserved_type.js @@ -0,0 +1,4 @@ +// error, interfaces define types and `string` is a reserved type name +interface string {} + +interface interface {} diff --git a/lib/test/flow/types/interfaces/reserved_type.tree.json b/lib/test/flow/types/interfaces/reserved_type.tree.json new file mode 100644 index 0000000..b801e9a --- /dev/null +++ b/lib/test/flow/types/interfaces/reserved_type.tree.json @@ -0,0 +1,75 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":16}}, + "message":"Unexpected reserved type" + }, + { + "loc":{"source":null,"start":{"line":4,"column":10},"end":{"line":4,"column":19}}, + "message":"Unexpected reserved type" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":4,"column":22}}, + "range":[71,114], + "body":[ + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":19}}, + "range":[71,90], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":16}}, + "range":[81,87], + "name":"string", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":19}}, + "range":[88,90], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + }, + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":4,"column":0},"end":{"line":4,"column":22}}, + "range":[92,114], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":10},"end":{"line":4,"column":19}}, + "range":[102,111], + "name":"interface", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":4,"column":20},"end":{"line":4,"column":22}}, + "range":[112,114], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":70}}, + "range":[0,70], + "value":" error, interfaces define types and `string` is a reserved type name" + } + ] +} diff --git a/lib/test/flow/types/interfaces/reserved_value.js b/lib/test/flow/types/interfaces/reserved_value.js new file mode 100644 index 0000000..18d588b --- /dev/null +++ b/lib/test/flow/types/interfaces/reserved_value.js @@ -0,0 +1,2 @@ +// ok, reserved values can be valid types +interface switch {} diff --git a/lib/test/flow/types/interfaces/reserved_value.tree.json b/lib/test/flow/types/interfaces/reserved_value.tree.json new file mode 100644 index 0000000..105e3a4 --- /dev/null +++ b/lib/test/flow/types/interfaces/reserved_value.tree.json @@ -0,0 +1,40 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":19}}, + "range":[42,61], + "body":[ + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":19}}, + "range":[42,61], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":16}}, + "range":[52,58], + "name":"switch", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":19}}, + "range":[59,61], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "range":[0,41], + "value":" ok, reserved values can be valid types" + } + ] +} diff --git a/lib/test/flow/types/invalid_keywords/migrated_0000.js b/lib/test/flow/types/invalid_keywords/migrated_0000.js new file mode 100644 index 0000000..31c1cb8 --- /dev/null +++ b/lib/test/flow/types/invalid_keywords/migrated_0000.js @@ -0,0 +1 @@ +type string = number; diff --git a/lib/test/flow/types/invalid_keywords/migrated_0000.tree.json b/lib/test/flow/types/invalid_keywords/migrated_0000.tree.json new file mode 100644 index 0000000..431a99c --- /dev/null +++ b/lib/test/flow/types/invalid_keywords/migrated_0000.tree.json @@ -0,0 +1,33 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, + "message":"Unexpected reserved type" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, + "range":[5,11], + "name":"string", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":20}}, + "range":[14,20] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/invalid_keywords/migrated_0001.js b/lib/test/flow/types/invalid_keywords/migrated_0001.js new file mode 100644 index 0000000..88905f3 --- /dev/null +++ b/lib/test/flow/types/invalid_keywords/migrated_0001.js @@ -0,0 +1 @@ +type foo = number diff --git a/lib/test/flow/types/invalid_keywords/migrated_0001.tree.json b/lib/test/flow/types/invalid_keywords/migrated_0001.tree.json new file mode 100644 index 0000000..6ca83de --- /dev/null +++ b/lib/test/flow/types/invalid_keywords/migrated_0001.tree.json @@ -0,0 +1,48 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "message":"Unexpected reserved type" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, + "range":[5,8], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":16}}, + "range":[8,16], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "range":[9,15], + "name":"number", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "right":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":25}}, + "range":[19,25] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/keyword_variable_collision/arguments.js b/lib/test/flow/types/keyword_variable_collision/arguments.js new file mode 100644 index 0000000..3003954 --- /dev/null +++ b/lib/test/flow/types/keyword_variable_collision/arguments.js @@ -0,0 +1 @@ +type arguments = string diff --git a/lib/test/flow/types/keyword_variable_collision/arguments.tree.json b/lib/test/flow/types/keyword_variable_collision/arguments.tree.json new file mode 100644 index 0000000..56384e6 --- /dev/null +++ b/lib/test/flow/types/keyword_variable_collision/arguments.tree.json @@ -0,0 +1,27 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":14}}, + "range":[5,14], + "name":"arguments", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":23}}, + "range":[17,23] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/keyword_variable_collision/arguments_strict.js b/lib/test/flow/types/keyword_variable_collision/arguments_strict.js new file mode 100644 index 0000000..80bd3d1 --- /dev/null +++ b/lib/test/flow/types/keyword_variable_collision/arguments_strict.js @@ -0,0 +1,2 @@ +"use strict"; +type arguments = string diff --git a/lib/test/flow/types/keyword_variable_collision/arguments_strict.tree.json b/lib/test/flow/types/keyword_variable_collision/arguments_strict.tree.json new file mode 100644 index 0000000..f6a247f --- /dev/null +++ b/lib/test/flow/types/keyword_variable_collision/arguments_strict.tree.json @@ -0,0 +1,40 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":23}}, + "range":[0,37], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "value":"use strict", + "raw":"\"use strict\"" + }, + "directive":"use strict" + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":23}}, + "range":[14,37], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":14}}, + "range":[19,28], + "name":"arguments", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":23}}, + "range":[31,37] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/keyword_variable_collision/eval.js b/lib/test/flow/types/keyword_variable_collision/eval.js new file mode 100644 index 0000000..8ae10dd --- /dev/null +++ b/lib/test/flow/types/keyword_variable_collision/eval.js @@ -0,0 +1 @@ +type eval = string diff --git a/lib/test/flow/types/keyword_variable_collision/eval.tree.json b/lib/test/flow/types/keyword_variable_collision/eval.tree.json new file mode 100644 index 0000000..daa074e --- /dev/null +++ b/lib/test/flow/types/keyword_variable_collision/eval.tree.json @@ -0,0 +1,27 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":9}}, + "range":[5,9], + "name":"eval", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":18}}, + "range":[12,18] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/keyword_variable_collision/eval_strict.js b/lib/test/flow/types/keyword_variable_collision/eval_strict.js new file mode 100644 index 0000000..33ca175 --- /dev/null +++ b/lib/test/flow/types/keyword_variable_collision/eval_strict.js @@ -0,0 +1,2 @@ +"use strict"; +type eval = string diff --git a/lib/test/flow/types/keyword_variable_collision/eval_strict.tree.json b/lib/test/flow/types/keyword_variable_collision/eval_strict.tree.json new file mode 100644 index 0000000..539efc3 --- /dev/null +++ b/lib/test/flow/types/keyword_variable_collision/eval_strict.tree.json @@ -0,0 +1,40 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":18}}, + "range":[0,32], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "value":"use strict", + "raw":"\"use strict\"" + }, + "directive":"use strict" + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":18}}, + "range":[14,32], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":9}}, + "range":[19,23], + "name":"eval", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":18}}, + "range":[26,32] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/keyword_variable_collision/opaque_collision.js b/lib/test/flow/types/keyword_variable_collision/opaque_collision.js new file mode 100644 index 0000000..ed40fba --- /dev/null +++ b/lib/test/flow/types/keyword_variable_collision/opaque_collision.js @@ -0,0 +1,2 @@ +opaque type opaque = number; +opaque type not_transparent = opaque; diff --git a/lib/test/flow/types/keyword_variable_collision/opaque_collision.tree.json b/lib/test/flow/types/keyword_variable_collision/opaque_collision.tree.json new file mode 100644 index 0000000..4de23aa --- /dev/null +++ b/lib/test/flow/types/keyword_variable_collision/opaque_collision.tree.json @@ -0,0 +1,57 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":37}}, + "range":[0,66], + "body":[ + { + "type":"OpaqueType", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":18}}, + "range":[12,18], + "name":"opaque", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "impltype":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "range":[21,27] + }, + "supertype":null + }, + { + "type":"OpaqueType", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":37}}, + "range":[29,66], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":27}}, + "range":[41,56], + "name":"not_transparent", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "impltype":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":30},"end":{"line":2,"column":36}}, + "range":[59,65], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":30},"end":{"line":2,"column":36}}, + "range":[59,65], + "name":"opaque", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "supertype":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/keyword_variable_collision/opaque_in_exp.js b/lib/test/flow/types/keyword_variable_collision/opaque_in_exp.js new file mode 100644 index 0000000..8bd643c --- /dev/null +++ b/lib/test/flow/types/keyword_variable_collision/opaque_in_exp.js @@ -0,0 +1,2 @@ +var opaque = 0; +opaque += 4; diff --git a/lib/test/flow/types/keyword_variable_collision/opaque_in_exp.tree.json b/lib/test/flow/types/keyword_variable_collision/opaque_in_exp.tree.json new file mode 100644 index 0000000..a8598ea --- /dev/null +++ b/lib/test/flow/types/keyword_variable_collision/opaque_in_exp.tree.json @@ -0,0 +1,63 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":12}}, + "range":[0,28], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":14}}, + "range":[4,14], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, + "range":[4,10], + "name":"opaque", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "value":0, + "raw":"0" + } + } + ], + "kind":"var" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":12}}, + "range":[16,28], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":11}}, + "range":[16,27], + "operator":"+=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":6}}, + "range":[16,22], + "name":"opaque", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, + "range":[26,27], + "value":4, + "raw":"4" + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/keyword_variable_collision/opaque_in_func.js b/lib/test/flow/types/keyword_variable_collision/opaque_in_func.js new file mode 100644 index 0000000..621f571 --- /dev/null +++ b/lib/test/flow/types/keyword_variable_collision/opaque_in_func.js @@ -0,0 +1 @@ +opaque(0); diff --git a/lib/test/flow/types/keyword_variable_collision/opaque_in_func.tree.json b/lib/test/flow/types/keyword_variable_collision/opaque_in_func.tree.json new file mode 100644 index 0000000..983fa04 --- /dev/null +++ b/lib/test/flow/types/keyword_variable_collision/opaque_in_func.tree.json @@ -0,0 +1,36 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "expression":{ + "type":"CallExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "range":[0,9], + "callee":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "name":"opaque", + "typeAnnotation":null, + "optional":false + }, + "arguments":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "range":[7,8], + "value":0, + "raw":"0" + } + ] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/member/migrated_0000.js b/lib/test/flow/types/member/migrated_0000.js new file mode 100644 index 0000000..4d6369e --- /dev/null +++ b/lib/test/flow/types/member/migrated_0000.js @@ -0,0 +1 @@ +var a : A.B diff --git a/lib/test/flow/types/member/migrated_0000.tree.json b/lib/test/flow/types/member/migrated_0000.tree.json new file mode 100644 index 0000000..6ce7669 --- /dev/null +++ b/lib/test/flow/types/member/migrated_0000.tree.json @@ -0,0 +1,61 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, + "range":[4,11], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, + "range":[4,11], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":11}}, + "range":[6,11], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":11}}, + "range":[8,11], + "id":{ + "type":"QualifiedTypeIdentifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":11}}, + "range":[8,11], + "qualification":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"B", + "typeAnnotation":null, + "optional":false + } + }, + "typeParameters":null + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/member/migrated_0001.js b/lib/test/flow/types/member/migrated_0001.js new file mode 100644 index 0000000..0601b63 --- /dev/null +++ b/lib/test/flow/types/member/migrated_0001.js @@ -0,0 +1 @@ +var a : A.B.C diff --git a/lib/test/flow/types/member/migrated_0001.tree.json b/lib/test/flow/types/member/migrated_0001.tree.json new file mode 100644 index 0000000..06489b8 --- /dev/null +++ b/lib/test/flow/types/member/migrated_0001.tree.json @@ -0,0 +1,74 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, + "range":[4,13], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, + "range":[4,13], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":13}}, + "range":[6,13], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, + "range":[8,13], + "id":{ + "type":"QualifiedTypeIdentifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":13}}, + "range":[8,13], + "qualification":{ + "type":"QualifiedTypeIdentifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":11}}, + "range":[8,11], + "qualification":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"B", + "typeAnnotation":null, + "optional":false + } + }, + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "name":"C", + "typeAnnotation":null, + "optional":false + } + }, + "typeParameters":null + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/member/migrated_0002.js b/lib/test/flow/types/member/migrated_0002.js new file mode 100644 index 0000000..6ea4200 --- /dev/null +++ b/lib/test/flow/types/member/migrated_0002.js @@ -0,0 +1 @@ +var a : A.B diff --git a/lib/test/flow/types/member/migrated_0002.tree.json b/lib/test/flow/types/member/migrated_0002.tree.json new file mode 100644 index 0000000..90ba543 --- /dev/null +++ b/lib/test/flow/types/member/migrated_0002.tree.json @@ -0,0 +1,81 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":14}}, + "range":[4,14], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":14}}, + "range":[4,14], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":14}}, + "range":[6,14], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":14}}, + "range":[8,14], + "id":{ + "type":"QualifiedTypeIdentifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":11}}, + "range":[8,11], + "qualification":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"B", + "typeAnnotation":null, + "optional":false + } + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "range":[11,14], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/member/migrated_0003.js b/lib/test/flow/types/member/migrated_0003.js new file mode 100644 index 0000000..2d08bd9 --- /dev/null +++ b/lib/test/flow/types/member/migrated_0003.js @@ -0,0 +1 @@ +var a : typeof A.B diff --git a/lib/test/flow/types/member/migrated_0003.tree.json b/lib/test/flow/types/member/migrated_0003.tree.json new file mode 100644 index 0000000..3e1fe1f --- /dev/null +++ b/lib/test/flow/types/member/migrated_0003.tree.json @@ -0,0 +1,86 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":21}}, + "range":[4,21], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":21}}, + "range":[4,21], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":21}}, + "range":[6,21], + "typeAnnotation":{ + "type":"TypeofTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":21}}, + "range":[8,21], + "argument":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":21}}, + "range":[15,21], + "id":{ + "type":"QualifiedTypeIdentifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, + "range":[15,18], + "qualification":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "range":[17,18], + "name":"B", + "typeAnnotation":null, + "optional":false + } + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, + "range":[18,21], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "range":[19,20], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, + "range":[19,20], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + } + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/member/reserved_words.js b/lib/test/flow/types/member/reserved_words.js new file mode 100644 index 0000000..2334325 --- /dev/null +++ b/lib/test/flow/types/member/reserved_words.js @@ -0,0 +1 @@ +var a: function.switch diff --git a/lib/test/flow/types/member/reserved_words.tree.json b/lib/test/flow/types/member/reserved_words.tree.json new file mode 100644 index 0000000..004ce3b --- /dev/null +++ b/lib/test/flow/types/member/reserved_words.tree.json @@ -0,0 +1,61 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":22}}, + "range":[4,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":22}}, + "range":[4,22], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":22}}, + "range":[5,22], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":22}}, + "range":[7,22], + "id":{ + "type":"QualifiedTypeIdentifier", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":22}}, + "range":[7,22], + "qualification":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":15}}, + "range":[7,15], + "name":"function", + "typeAnnotation":null, + "optional":false + }, + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":22}}, + "range":[16,22], + "name":"switch", + "typeAnnotation":null, + "optional":false + } + }, + "typeParameters":null + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/number_literal/migrated_0000.js b/lib/test/flow/types/number_literal/migrated_0000.js new file mode 100644 index 0000000..7d5aa98 --- /dev/null +++ b/lib/test/flow/types/number_literal/migrated_0000.js @@ -0,0 +1 @@ +var a: 123 diff --git a/lib/test/flow/types/number_literal/migrated_0000.tree.json b/lib/test/flow/types/number_literal/migrated_0000.tree.json new file mode 100644 index 0000000..d1b5e06 --- /dev/null +++ b/lib/test/flow/types/number_literal/migrated_0000.tree.json @@ -0,0 +1,41 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, + "range":[4,10], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, + "range":[4,10], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, + "range":[5,10], + "typeAnnotation":{ + "type":"NumberLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, + "range":[7,10], + "value":123, + "raw":"123" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/number_literal/migrated_0001.js b/lib/test/flow/types/number_literal/migrated_0001.js new file mode 100644 index 0000000..22d313c --- /dev/null +++ b/lib/test/flow/types/number_literal/migrated_0001.js @@ -0,0 +1 @@ +var a: 123.0 diff --git a/lib/test/flow/types/number_literal/migrated_0001.tree.json b/lib/test/flow/types/number_literal/migrated_0001.tree.json new file mode 100644 index 0000000..48f6fb2 --- /dev/null +++ b/lib/test/flow/types/number_literal/migrated_0001.tree.json @@ -0,0 +1,41 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, + "range":[4,12], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, + "range":[4,12], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, + "range":[5,12], + "typeAnnotation":{ + "type":"NumberLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, + "range":[7,12], + "value":123, + "raw":"123.0" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/number_literal/migrated_0002.js b/lib/test/flow/types/number_literal/migrated_0002.js new file mode 100644 index 0000000..170b974 --- /dev/null +++ b/lib/test/flow/types/number_literal/migrated_0002.js @@ -0,0 +1 @@ +var a: 0x7B diff --git a/lib/test/flow/types/number_literal/migrated_0002.tree.json b/lib/test/flow/types/number_literal/migrated_0002.tree.json new file mode 100644 index 0000000..2a398f5 --- /dev/null +++ b/lib/test/flow/types/number_literal/migrated_0002.tree.json @@ -0,0 +1,41 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, + "range":[4,11], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, + "range":[4,11], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, + "range":[5,11], + "typeAnnotation":{ + "type":"NumberLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, + "range":[7,11], + "value":123, + "raw":"0x7B" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/number_literal/migrated_0003.js b/lib/test/flow/types/number_literal/migrated_0003.js new file mode 100644 index 0000000..665417b --- /dev/null +++ b/lib/test/flow/types/number_literal/migrated_0003.js @@ -0,0 +1 @@ +var a: 0b1111011 diff --git a/lib/test/flow/types/number_literal/migrated_0003.tree.json b/lib/test/flow/types/number_literal/migrated_0003.tree.json new file mode 100644 index 0000000..edd6691 --- /dev/null +++ b/lib/test/flow/types/number_literal/migrated_0003.tree.json @@ -0,0 +1,41 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, + "range":[4,16], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, + "range":[4,16], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":16}}, + "range":[5,16], + "typeAnnotation":{ + "type":"NumberLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":16}}, + "range":[7,16], + "value":123, + "raw":"0b1111011" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/number_literal/migrated_0004.js b/lib/test/flow/types/number_literal/migrated_0004.js new file mode 100644 index 0000000..12b3ef2 --- /dev/null +++ b/lib/test/flow/types/number_literal/migrated_0004.js @@ -0,0 +1 @@ +var a: 0o173 diff --git a/lib/test/flow/types/number_literal/migrated_0004.tree.json b/lib/test/flow/types/number_literal/migrated_0004.tree.json new file mode 100644 index 0000000..ab480b6 --- /dev/null +++ b/lib/test/flow/types/number_literal/migrated_0004.tree.json @@ -0,0 +1,41 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, + "range":[4,12], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, + "range":[4,12], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, + "range":[5,12], + "typeAnnotation":{ + "type":"NumberLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, + "range":[7,12], + "value":123, + "raw":"0o173" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/number_literal/migrated_0005.js b/lib/test/flow/types/number_literal/migrated_0005.js new file mode 100644 index 0000000..9a40c71 --- /dev/null +++ b/lib/test/flow/types/number_literal/migrated_0005.js @@ -0,0 +1 @@ +var a: -123 diff --git a/lib/test/flow/types/number_literal/migrated_0005.tree.json b/lib/test/flow/types/number_literal/migrated_0005.tree.json new file mode 100644 index 0000000..f8b6ea6 --- /dev/null +++ b/lib/test/flow/types/number_literal/migrated_0005.tree.json @@ -0,0 +1,41 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, + "range":[4,11], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, + "range":[4,11], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, + "range":[5,11], + "typeAnnotation":{ + "type":"NumberLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, + "range":[7,11], + "value":-123, + "raw":"-123" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/number_literal/migrated_0006.js b/lib/test/flow/types/number_literal/migrated_0006.js new file mode 100644 index 0000000..fba106e --- /dev/null +++ b/lib/test/flow/types/number_literal/migrated_0006.js @@ -0,0 +1 @@ +var a: - 123 diff --git a/lib/test/flow/types/number_literal/migrated_0006.tree.json b/lib/test/flow/types/number_literal/migrated_0006.tree.json new file mode 100644 index 0000000..834df9a --- /dev/null +++ b/lib/test/flow/types/number_literal/migrated_0006.tree.json @@ -0,0 +1,41 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, + "range":[4,12], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, + "range":[4,12], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, + "range":[5,12], + "typeAnnotation":{ + "type":"NumberLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, + "range":[7,12], + "value":-123, + "raw":"- 123" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/number_literal/migrated_0007.js b/lib/test/flow/types/number_literal/migrated_0007.js new file mode 100644 index 0000000..ca6c402 --- /dev/null +++ b/lib/test/flow/types/number_literal/migrated_0007.js @@ -0,0 +1 @@ +var a: 25257156155 diff --git a/lib/test/flow/types/number_literal/migrated_0007.tree.json b/lib/test/flow/types/number_literal/migrated_0007.tree.json new file mode 100644 index 0000000..2c95998 --- /dev/null +++ b/lib/test/flow/types/number_literal/migrated_0007.tree.json @@ -0,0 +1,41 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":18}}, + "range":[4,18], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":18}}, + "range":[4,18], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":18}}, + "range":[5,18], + "typeAnnotation":{ + "type":"NumberLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":18}}, + "range":[7,18], + "value":25257156155, + "raw":"25257156155" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/number_literal/migrated_0008.js b/lib/test/flow/types/number_literal/migrated_0008.js new file mode 100644 index 0000000..cf60e0e --- /dev/null +++ b/lib/test/flow/types/number_literal/migrated_0008.js @@ -0,0 +1 @@ +var a: 0x5E1719E3B diff --git a/lib/test/flow/types/number_literal/migrated_0008.tree.json b/lib/test/flow/types/number_literal/migrated_0008.tree.json new file mode 100644 index 0000000..7846f58 --- /dev/null +++ b/lib/test/flow/types/number_literal/migrated_0008.tree.json @@ -0,0 +1,41 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":18}}, + "range":[4,18], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":18}}, + "range":[4,18], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":18}}, + "range":[5,18], + "typeAnnotation":{ + "type":"NumberLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":18}}, + "range":[7,18], + "value":25257156155, + "raw":"0x5E1719E3B" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/number_literal/migrated_0009.js b/lib/test/flow/types/number_literal/migrated_0009.js new file mode 100644 index 0000000..41efd1e --- /dev/null +++ b/lib/test/flow/types/number_literal/migrated_0009.js @@ -0,0 +1 @@ +var a: 0o274134317073 diff --git a/lib/test/flow/types/number_literal/migrated_0009.tree.json b/lib/test/flow/types/number_literal/migrated_0009.tree.json new file mode 100644 index 0000000..8f14970 --- /dev/null +++ b/lib/test/flow/types/number_literal/migrated_0009.tree.json @@ -0,0 +1,41 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":21}}, + "range":[4,21], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":21}}, + "range":[4,21], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":21}}, + "range":[5,21], + "typeAnnotation":{ + "type":"NumberLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":21}}, + "range":[7,21], + "value":25257156155, + "raw":"0o274134317073" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/number_literal/migrated_0010.js b/lib/test/flow/types/number_literal/migrated_0010.js new file mode 100644 index 0000000..c46eb8f --- /dev/null +++ b/lib/test/flow/types/number_literal/migrated_0010.js @@ -0,0 +1 @@ +var a: 1e5 diff --git a/lib/test/flow/types/number_literal/migrated_0010.tree.json b/lib/test/flow/types/number_literal/migrated_0010.tree.json new file mode 100644 index 0000000..ea752dc --- /dev/null +++ b/lib/test/flow/types/number_literal/migrated_0010.tree.json @@ -0,0 +1,41 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, + "range":[4,10], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, + "range":[4,10], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, + "range":[5,10], + "typeAnnotation":{ + "type":"NumberLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, + "range":[7,10], + "value":100000, + "raw":"1e5" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/number_literal_invalid/migrated_0000.js b/lib/test/flow/types/number_literal_invalid/migrated_0000.js new file mode 100644 index 0000000..46a8e53 --- /dev/null +++ b/lib/test/flow/types/number_literal_invalid/migrated_0000.js @@ -0,0 +1 @@ +var a: 0173 diff --git a/lib/test/flow/types/number_literal_invalid/migrated_0000.tree.json b/lib/test/flow/types/number_literal_invalid/migrated_0000.tree.json new file mode 100644 index 0000000..c999145 --- /dev/null +++ b/lib/test/flow/types/number_literal_invalid/migrated_0000.tree.json @@ -0,0 +1,47 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Octal literals are not allowed in strict mode." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "range":[0,11], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, + "range":[4,11], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, + "range":[4,11], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, + "range":[5,11], + "typeAnnotation":{ + "type":"NumberLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":11}}, + "range":[7,11], + "value":123, + "raw":"0173" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/number_literal_invalid/migrated_0001.js b/lib/test/flow/types/number_literal_invalid/migrated_0001.js new file mode 100644 index 0000000..050e126 --- /dev/null +++ b/lib/test/flow/types/number_literal_invalid/migrated_0001.js @@ -0,0 +1 @@ +var a: 123-3 diff --git a/lib/test/flow/types/number_literal_invalid/migrated_0001.tree.json b/lib/test/flow/types/number_literal_invalid/migrated_0001.tree.json new file mode 100644 index 0000000..3e78ced --- /dev/null +++ b/lib/test/flow/types/number_literal_invalid/migrated_0001.tree.json @@ -0,0 +1,67 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "message":"Unexpected token `-`, expected the token `;`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "range":[0,10], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, + "range":[4,10], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, + "range":[4,10], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, + "range":[5,10], + "typeAnnotation":{ + "type":"NumberLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, + "range":[7,10], + "value":123, + "raw":"123" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, + "range":[10,12], + "expression":{ + "type":"UnaryExpression", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, + "range":[10,12], + "operator":"-", + "prefix":true, + "argument":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "value":3, + "raw":"3" + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/object/indexers/reserved_type_indexer_name.js b/lib/test/flow/types/object/indexers/reserved_type_indexer_name.js new file mode 100644 index 0000000..8202426 --- /dev/null +++ b/lib/test/flow/types/object/indexers/reserved_type_indexer_name.js @@ -0,0 +1 @@ +type X = { [string: string]: string } diff --git a/lib/test/flow/types/object/indexers/reserved_type_indexer_name.tree.json b/lib/test/flow/types/object/indexers/reserved_type_indexer_name.tree.json new file mode 100644 index 0000000..a565e39 --- /dev/null +++ b/lib/test/flow/types/object/indexers/reserved_type_indexer_name.tree.json @@ -0,0 +1,59 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "range":[0,37], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "range":[0,37], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":37}}, + "range":[9,37], + "exact":false, + "inexact":false, + "properties":[], + "indexers":[ + { + "type":"ObjectTypeIndexer", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":35}}, + "range":[11,35], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":18}}, + "range":[12,18], + "name":"string", + "typeAnnotation":null, + "optional":false + }, + "key":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":26}}, + "range":[20,26] + }, + "value":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":35}}, + "range":[29,35] + }, + "static":false, + "variance":null + } + ], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/object/indexers/reserved_word_indexer_name.js b/lib/test/flow/types/object/indexers/reserved_word_indexer_name.js new file mode 100644 index 0000000..0bdee6f --- /dev/null +++ b/lib/test/flow/types/object/indexers/reserved_word_indexer_name.js @@ -0,0 +1 @@ +type X = { [switch: string]: string } diff --git a/lib/test/flow/types/object/indexers/reserved_word_indexer_name.tree.json b/lib/test/flow/types/object/indexers/reserved_word_indexer_name.tree.json new file mode 100644 index 0000000..2d4f09b --- /dev/null +++ b/lib/test/flow/types/object/indexers/reserved_word_indexer_name.tree.json @@ -0,0 +1,59 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "range":[0,37], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "range":[0,37], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":37}}, + "range":[9,37], + "exact":false, + "inexact":false, + "properties":[], + "indexers":[ + { + "type":"ObjectTypeIndexer", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":35}}, + "range":[11,35], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":18}}, + "range":[12,18], + "name":"switch", + "typeAnnotation":null, + "optional":false + }, + "key":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":26}}, + "range":[20,26] + }, + "value":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":35}}, + "range":[29,35] + }, + "static":false, + "variance":null + } + ], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/object/methods/generic_method.js b/lib/test/flow/types/object/methods/generic_method.js new file mode 100644 index 0000000..5e19ab4 --- /dev/null +++ b/lib/test/flow/types/object/methods/generic_method.js @@ -0,0 +1 @@ +type T = { foo(x: U): number; } diff --git a/lib/test/flow/types/object/methods/generic_method.tree.json b/lib/test/flow/types/object/methods/generic_method.tree.json new file mode 100644 index 0000000..650902c --- /dev/null +++ b/lib/test/flow/types/object/methods/generic_method.tree.json @@ -0,0 +1,110 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "range":[0,34], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "range":[0,34], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":34}}, + "range":[9,34], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":31}}, + "range":[11,31], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "range":[11,14], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":31}}, + "range":[11,31], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":22}}, + "range":[18,22], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "name":"U", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "optional":false + } + ], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":31}}, + "range":[25,31] + }, + "rest":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, + "range":[14,17], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"U", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/object/methods/method.js b/lib/test/flow/types/object/methods/method.js new file mode 100644 index 0000000..4a66010 --- /dev/null +++ b/lib/test/flow/types/object/methods/method.js @@ -0,0 +1 @@ +type T = { foo(): number }; diff --git a/lib/test/flow/types/object/methods/method.tree.json b/lib/test/flow/types/object/methods/method.tree.json new file mode 100644 index 0000000..e2bf5a5 --- /dev/null +++ b/lib/test/flow/types/object/methods/method.tree.json @@ -0,0 +1,66 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":26}}, + "range":[9,26], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":24}}, + "range":[11,24], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "range":[11,14], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":24}}, + "range":[11,24], + "params":[], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":24}}, + "range":[18,24] + }, + "rest":null, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/object/unexpected_proto.js b/lib/test/flow/types/object/unexpected_proto.js new file mode 100644 index 0000000..ed6b8a4 --- /dev/null +++ b/lib/test/flow/types/object/unexpected_proto.js @@ -0,0 +1,8 @@ +// error: object types don't have proto fields +type A = { proto x: X } + +// ok: prop named proto +type B = { proto: X } + +// ok: parsed as a method named proto +type C = { proto(): R } diff --git a/lib/test/flow/types/object/unexpected_proto.tree.json b/lib/test/flow/types/object/unexpected_proto.tree.json new file mode 100644 index 0000000..cb5a895 --- /dev/null +++ b/lib/test/flow/types/object/unexpected_proto.tree.json @@ -0,0 +1,249 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":18}}, + "message":"Unexpected identifier, expected the token `:`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":18},"end":{"line":2,"column":19}}, + "message":"Unexpected token `:`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":18},"end":{"line":2,"column":19}}, + "message":"Unexpected token `:`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":2,"column":20},"end":{"line":2,"column":21}}, + "message":"Unexpected identifier, expected the token `:`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":22},"end":{"line":2,"column":23}}, + "message":"Unexpected token `}`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":8,"column":23}}, + "range":[47,180], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":23}}, + "range":[47,70], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":6}}, + "range":[52,53], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":23}}, + "range":[56,70], + "inexact":false, + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":18}}, + "range":[58,65], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":16}}, + "range":[58,63], + "name":"proto", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":18},"end":{"line":2,"column":19}}, + "range":[65,66] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + }, + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":2,"column":18},"end":{"line":2,"column":21}}, + "range":[65,68], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":18},"end":{"line":2,"column":19}}, + "range":[65,66], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":22},"end":{"line":2,"column":23}}, + "range":[69,70] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":21}}, + "range":[96,117], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":5},"end":{"line":5,"column":6}}, + "range":[101,102], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":9},"end":{"line":5,"column":21}}, + "range":[105,117], + "inexact":false, + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":5,"column":11},"end":{"line":5,"column":19}}, + "range":[107,115], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":11},"end":{"line":5,"column":16}}, + "range":[107,112], + "name":"proto", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":18},"end":{"line":5,"column":19}}, + "range":[114,115], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":18},"end":{"line":5,"column":19}}, + "range":[114,115], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":8,"column":0},"end":{"line":8,"column":23}}, + "range":[157,180], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":8,"column":5},"end":{"line":8,"column":6}}, + "range":[162,163], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":8,"column":9},"end":{"line":8,"column":23}}, + "range":[166,180], + "inexact":false, + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":8,"column":11},"end":{"line":8,"column":21}}, + "range":[168,178], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":8,"column":11},"end":{"line":8,"column":16}}, + "range":[168,173], + "name":"proto", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":8,"column":11},"end":{"line":8,"column":21}}, + "range":[168,178], + "params":[], + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":8,"column":20},"end":{"line":8,"column":21}}, + "range":[177,178], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":8,"column":20},"end":{"line":8,"column":21}}, + "range":[177,178], + "name":"R", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "rest":null, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":46}}, + "range":[0,46], + "value":" error: object types don't have proto fields" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":4,"column":0},"end":{"line":4,"column":23}}, + "range":[72,95], + "value":" ok: prop named proto" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":37}}, + "range":[119,156], + "value":" ok: parsed as a method named proto" + } + ] +} diff --git a/lib/test/flow/types/object/unexpected_static.js b/lib/test/flow/types/object/unexpected_static.js new file mode 100644 index 0000000..6166c45 --- /dev/null +++ b/lib/test/flow/types/object/unexpected_static.js @@ -0,0 +1,26 @@ +// error: object types don't have static fields +type A = { static x: X } + +// error: object types don't have static fields (including indexers) +type B = { static [K]: V } + +// error: object types don't have static fields (including spread) +type C = { static ...X } + +// ok: prop named static +type D = { static: X } + +// error: static prop named static +type E = { static static: X } + +// ok: parsed as a method named static +type F = { static(): R } + +// ok: parsed as a poly method named static +type G = { static(): R } + +// error: static method named static +type H = { static static(): R } + +// error: static poly method named static +type I = { static static(): R } diff --git a/lib/test/flow/types/object/unexpected_static.tree.json b/lib/test/flow/types/object/unexpected_static.tree.json new file mode 100644 index 0000000..57a04ac --- /dev/null +++ b/lib/test/flow/types/object/unexpected_static.tree.json @@ -0,0 +1,793 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":18},"end":{"line":2,"column":19}}, + "message":"Unexpected identifier, expected the token `:`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":20}}, + "message":"Unexpected token `:`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":20}}, + "message":"Unexpected token `:`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":2,"column":21},"end":{"line":2,"column":22}}, + "message":"Unexpected identifier, expected the token `:`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":23},"end":{"line":2,"column":24}}, + "message":"Unexpected token `}`" + }, + { + "loc":{"source":null,"start":{"line":5,"column":18},"end":{"line":5,"column":19}}, + "message":"Unexpected token `[`, expected the token `:`" + }, + { + "loc":{"source":null,"start":{"line":5,"column":20},"end":{"line":5,"column":21}}, + "message":"Unexpected token `]`" + }, + { + "loc":{"source":null,"start":{"line":5,"column":20},"end":{"line":5,"column":21}}, + "message":"Unexpected token `]`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":8,"column":18},"end":{"line":8,"column":21}}, + "message":"Unexpected token `...`, expected the token `:`" + }, + { + "loc":{"source":null,"start":{"line":14,"column":18},"end":{"line":14,"column":24}}, + "message":"Use of future reserved word in strict mode" + }, + { + "loc":{"source":null,"start":{"line":14,"column":24},"end":{"line":14,"column":25}}, + "message":"Unexpected token `:`" + }, + { + "loc":{"source":null,"start":{"line":14,"column":24},"end":{"line":14,"column":25}}, + "message":"Unexpected token `:`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":14,"column":26},"end":{"line":14,"column":27}}, + "message":"Unexpected identifier, expected the token `:`" + }, + { + "loc":{"source":null,"start":{"line":14,"column":28},"end":{"line":14,"column":29}}, + "message":"Unexpected token `}`" + }, + { + "loc":{"source":null,"start":{"line":23,"column":18},"end":{"line":23,"column":24}}, + "message":"Use of future reserved word in strict mode" + }, + { + "loc":{"source":null,"start":{"line":23,"column":26},"end":{"line":23,"column":27}}, + "message":"Unexpected token `:`, expected the token `=>`" + }, + { + "loc":{"source":null,"start":{"line":26,"column":18},"end":{"line":26,"column":24}}, + "message":"Use of future reserved word in strict mode" + }, + { + "loc":{"source":null,"start":{"line":26,"column":29},"end":{"line":26,"column":30}}, + "message":"Unexpected token `:`, expected the token `=>`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":26,"column":34}}, + "range":[48,663], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":24}}, + "range":[48,72], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":6}}, + "range":[53,54], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":9},"end":{"line":2,"column":24}}, + "range":[57,72], + "inexact":false, + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":19}}, + "range":[59,67], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":17}}, + "range":[59,65], + "name":"static", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":20}}, + "range":[67,68] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + }, + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":22}}, + "range":[67,70], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":20}}, + "range":[67,68], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":23},"end":{"line":2,"column":24}}, + "range":[71,72] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":26}}, + "range":[143,169], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":5},"end":{"line":5,"column":6}}, + "range":[148,149], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":9},"end":{"line":5,"column":26}}, + "range":[152,169], + "inexact":false, + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":5,"column":11},"end":{"line":5,"column":20}}, + "range":[154,163], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":11},"end":{"line":5,"column":17}}, + "range":[154,160], + "name":"static", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":19},"end":{"line":5,"column":20}}, + "range":[162,163], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":19},"end":{"line":5,"column":20}}, + "range":[162,163], + "name":"K", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + }, + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":5,"column":20},"end":{"line":5,"column":24}}, + "range":[163,167], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":20},"end":{"line":5,"column":21}}, + "range":[163,164], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":5,"column":23},"end":{"line":5,"column":24}}, + "range":[166,167], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":23},"end":{"line":5,"column":24}}, + "range":[166,167], + "name":"V", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":8,"column":0},"end":{"line":8,"column":24}}, + "range":[238,262], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":8,"column":5},"end":{"line":8,"column":6}}, + "range":[243,244], + "name":"C", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":8,"column":9},"end":{"line":8,"column":24}}, + "range":[247,262], + "inexact":false, + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":8,"column":11},"end":{"line":8,"column":22}}, + "range":[249,260], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":8,"column":11},"end":{"line":8,"column":17}}, + "range":[249,255], + "name":"static", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":8,"column":21},"end":{"line":8,"column":22}}, + "range":[259,260], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":8,"column":21},"end":{"line":8,"column":22}}, + "range":[259,260], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":11,"column":22}}, + "range":[289,311], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":11,"column":5},"end":{"line":11,"column":6}}, + "range":[294,295], + "name":"D", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":11,"column":9},"end":{"line":11,"column":22}}, + "range":[298,311], + "inexact":false, + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":11,"column":11},"end":{"line":11,"column":20}}, + "range":[300,309], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":11,"column":11},"end":{"line":11,"column":17}}, + "range":[300,306], + "name":"static", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":11,"column":19},"end":{"line":11,"column":20}}, + "range":[308,309], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":11,"column":19},"end":{"line":11,"column":20}}, + "range":[308,309], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":14,"column":0},"end":{"line":14,"column":29}}, + "range":[348,377], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":14,"column":5},"end":{"line":14,"column":6}}, + "range":[353,354], + "name":"E", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":14,"column":9},"end":{"line":14,"column":29}}, + "range":[357,377], + "inexact":false, + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":14,"column":11},"end":{"line":14,"column":24}}, + "range":[359,372], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":14,"column":11},"end":{"line":14,"column":17}}, + "range":[359,365], + "name":"static", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":14,"column":24},"end":{"line":14,"column":25}}, + "range":[372,373] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + }, + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":14,"column":24},"end":{"line":14,"column":27}}, + "range":[372,375], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":14,"column":24},"end":{"line":14,"column":25}}, + "range":[372,373], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":14,"column":28},"end":{"line":14,"column":29}}, + "range":[376,377] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":17,"column":0},"end":{"line":17,"column":24}}, + "range":[418,442], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":17,"column":5},"end":{"line":17,"column":6}}, + "range":[423,424], + "name":"F", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":17,"column":9},"end":{"line":17,"column":24}}, + "range":[427,442], + "inexact":false, + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":17,"column":11},"end":{"line":17,"column":22}}, + "range":[429,440], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":17,"column":11},"end":{"line":17,"column":17}}, + "range":[429,435], + "name":"static", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":17,"column":11},"end":{"line":17,"column":22}}, + "range":[429,440], + "params":[], + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":17,"column":21},"end":{"line":17,"column":22}}, + "range":[439,440], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":17,"column":21},"end":{"line":17,"column":22}}, + "range":[439,440], + "name":"R", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "rest":null, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":20,"column":0},"end":{"line":20,"column":27}}, + "range":[488,515], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":20,"column":5},"end":{"line":20,"column":6}}, + "range":[493,494], + "name":"G", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":20,"column":9},"end":{"line":20,"column":27}}, + "range":[497,515], + "inexact":false, + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":20,"column":11},"end":{"line":20,"column":25}}, + "range":[499,513], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":20,"column":11},"end":{"line":20,"column":17}}, + "range":[499,505], + "name":"static", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":20,"column":11},"end":{"line":20,"column":25}}, + "range":[499,513], + "params":[], + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":20,"column":24},"end":{"line":20,"column":25}}, + "range":[512,513], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":20,"column":24},"end":{"line":20,"column":25}}, + "range":[512,513], + "name":"R", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "rest":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":20,"column":17},"end":{"line":20,"column":20}}, + "range":[505,508], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":20,"column":18},"end":{"line":20,"column":19}}, + "range":[506,507], + "name":"X", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":23,"column":0},"end":{"line":23,"column":31}}, + "range":[554,585], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":23,"column":5},"end":{"line":23,"column":6}}, + "range":[559,560], + "name":"H", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":23,"column":9},"end":{"line":23,"column":31}}, + "range":[563,585], + "inexact":false, + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":23,"column":11},"end":{"line":23,"column":29}}, + "range":[565,583], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":23,"column":11},"end":{"line":23,"column":17}}, + "range":[565,571], + "name":"static", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":23,"column":24},"end":{"line":23,"column":29}}, + "range":[578,583], + "params":[], + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":23,"column":28},"end":{"line":23,"column":29}}, + "range":[582,583], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":23,"column":28},"end":{"line":23,"column":29}}, + "range":[582,583], + "name":"R", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "rest":null, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + }, + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":26,"column":0},"end":{"line":26,"column":34}}, + "range":[629,663], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":26,"column":5},"end":{"line":26,"column":6}}, + "range":[634,635], + "name":"I", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":26,"column":9},"end":{"line":26,"column":34}}, + "range":[638,663], + "inexact":false, + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":26,"column":11},"end":{"line":26,"column":32}}, + "range":[640,661], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":26,"column":11},"end":{"line":26,"column":17}}, + "range":[640,646], + "name":"static", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":26,"column":24},"end":{"line":26,"column":32}}, + "range":[653,661], + "params":[], + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":26,"column":31},"end":{"line":26,"column":32}}, + "range":[660,661], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":26,"column":31},"end":{"line":26,"column":32}}, + "range":[660,661], + "name":"R", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "rest":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":26,"column":24},"end":{"line":26,"column":27}}, + "range":[653,656], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":26,"column":25},"end":{"line":26,"column":26}}, + "range":[654,655], + "name":"X", + "bound":null, + "variance":null, + "default":null + } + ] + } + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "range":[0,47], + "value":" error: object types don't have static fields" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":4,"column":0},"end":{"line":4,"column":68}}, + "range":[74,142], + "value":" error: object types don't have static fields (including indexers)" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":7,"column":0},"end":{"line":7,"column":66}}, + "range":[171,237], + "value":" error: object types don't have static fields (including spread)" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":10,"column":0},"end":{"line":10,"column":24}}, + "range":[264,288], + "value":" ok: prop named static" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":13,"column":0},"end":{"line":13,"column":34}}, + "range":[313,347], + "value":" error: static prop named static" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":16,"column":0},"end":{"line":16,"column":38}}, + "range":[379,417], + "value":" ok: parsed as a method named static" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":19,"column":0},"end":{"line":19,"column":43}}, + "range":[444,487], + "value":" ok: parsed as a poly method named static" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":22,"column":0},"end":{"line":22,"column":36}}, + "range":[517,553], + "value":" error: static method named static" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":25,"column":0},"end":{"line":25,"column":41}}, + "range":[587,628], + "value":" error: static poly method named static" + } + ] +} diff --git a/lib/test/flow/types/object_type_property_variance/migrated_0000.js b/lib/test/flow/types/object_type_property_variance/migrated_0000.js new file mode 100644 index 0000000..5b2b84b --- /dev/null +++ b/lib/test/flow/types/object_type_property_variance/migrated_0000.js @@ -0,0 +1 @@ +type X = {p:T} diff --git a/lib/test/flow/types/object_type_property_variance/migrated_0000.tree.json b/lib/test/flow/types/object_type_property_variance/migrated_0000.tree.json new file mode 100644 index 0000000..ecae131 --- /dev/null +++ b/lib/test/flow/types/object_type_property_variance/migrated_0000.tree.json @@ -0,0 +1,67 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "range":[0,14], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "range":[9,14], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, + "range":[10,13], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"p", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/object_type_property_variance/migrated_0001.js b/lib/test/flow/types/object_type_property_variance/migrated_0001.js new file mode 100644 index 0000000..5c99b46 --- /dev/null +++ b/lib/test/flow/types/object_type_property_variance/migrated_0001.js @@ -0,0 +1 @@ +type X = {+p:T} diff --git a/lib/test/flow/types/object_type_property_variance/migrated_0001.tree.json b/lib/test/flow/types/object_type_property_variance/migrated_0001.tree.json new file mode 100644 index 0000000..7017564 --- /dev/null +++ b/lib/test/flow/types/object_type_property_variance/migrated_0001.tree.json @@ -0,0 +1,72 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "range":[9,15], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, + "range":[10,14], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"p", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":{ + "type":"Variance", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "kind":"plus" + }, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/object_type_property_variance/migrated_0002.js b/lib/test/flow/types/object_type_property_variance/migrated_0002.js new file mode 100644 index 0000000..1e3d98d --- /dev/null +++ b/lib/test/flow/types/object_type_property_variance/migrated_0002.js @@ -0,0 +1 @@ +type X = {-p:T} diff --git a/lib/test/flow/types/object_type_property_variance/migrated_0002.tree.json b/lib/test/flow/types/object_type_property_variance/migrated_0002.tree.json new file mode 100644 index 0000000..abba0eb --- /dev/null +++ b/lib/test/flow/types/object_type_property_variance/migrated_0002.tree.json @@ -0,0 +1,72 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "range":[9,15], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, + "range":[10,14], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"p", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":{ + "type":"Variance", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "kind":"minus" + }, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/object_type_property_variance/migrated_0003.js b/lib/test/flow/types/object_type_property_variance/migrated_0003.js new file mode 100644 index 0000000..4ee06c8 --- /dev/null +++ b/lib/test/flow/types/object_type_property_variance/migrated_0003.js @@ -0,0 +1 @@ +type X = {m():T} diff --git a/lib/test/flow/types/object_type_property_variance/migrated_0003.tree.json b/lib/test/flow/types/object_type_property_variance/migrated_0003.tree.json new file mode 100644 index 0000000..d4064e4 --- /dev/null +++ b/lib/test/flow/types/object_type_property_variance/migrated_0003.tree.json @@ -0,0 +1,75 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, + "range":[10,15], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"m", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, + "range":[10,15], + "params":[], + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "rest":null, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/object_type_property_variance/migrated_0004.js b/lib/test/flow/types/object_type_property_variance/migrated_0004.js new file mode 100644 index 0000000..3a61721 --- /dev/null +++ b/lib/test/flow/types/object_type_property_variance/migrated_0004.js @@ -0,0 +1 @@ +type X = {+m():T} diff --git a/lib/test/flow/types/object_type_property_variance/migrated_0004.tree.json b/lib/test/flow/types/object_type_property_variance/migrated_0004.tree.json new file mode 100644 index 0000000..8fa99f6 --- /dev/null +++ b/lib/test/flow/types/object_type_property_variance/migrated_0004.tree.json @@ -0,0 +1,81 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "message":"Unexpected variance sigil" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, + "range":[9,17], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, + "range":[10,16], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"m", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, + "range":[10,16], + "params":[], + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "rest":null, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/object_type_property_variance/migrated_0005.js b/lib/test/flow/types/object_type_property_variance/migrated_0005.js new file mode 100644 index 0000000..d4e882d --- /dev/null +++ b/lib/test/flow/types/object_type_property_variance/migrated_0005.js @@ -0,0 +1 @@ +type X = {-m():T} diff --git a/lib/test/flow/types/object_type_property_variance/migrated_0005.tree.json b/lib/test/flow/types/object_type_property_variance/migrated_0005.tree.json new file mode 100644 index 0000000..8fa99f6 --- /dev/null +++ b/lib/test/flow/types/object_type_property_variance/migrated_0005.tree.json @@ -0,0 +1,81 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "message":"Unexpected variance sigil" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "range":[0,17], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, + "range":[9,17], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, + "range":[10,16], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"m", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, + "range":[10,16], + "params":[], + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "rest":null, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/object_type_property_variance/migrated_0006.js b/lib/test/flow/types/object_type_property_variance/migrated_0006.js new file mode 100644 index 0000000..7ef3dad --- /dev/null +++ b/lib/test/flow/types/object_type_property_variance/migrated_0006.js @@ -0,0 +1 @@ +type X = {[k:K]:V} diff --git a/lib/test/flow/types/object_type_property_variance/migrated_0006.tree.json b/lib/test/flow/types/object_type_property_variance/migrated_0006.tree.json new file mode 100644 index 0000000..7ba7094 --- /dev/null +++ b/lib/test/flow/types/object_type_property_variance/migrated_0006.tree.json @@ -0,0 +1,77 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":18}}, + "range":[9,18], + "exact":false, + "inexact":false, + "properties":[], + "indexers":[ + { + "type":"ObjectTypeIndexer", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":17}}, + "range":[10,17], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"k", + "typeAnnotation":null, + "optional":false + }, + "key":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "name":"K", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "value":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "range":[16,17], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "range":[16,17], + "name":"V", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "static":false, + "variance":null + } + ], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/object_type_property_variance/migrated_0007.js b/lib/test/flow/types/object_type_property_variance/migrated_0007.js new file mode 100644 index 0000000..0c7b18f --- /dev/null +++ b/lib/test/flow/types/object_type_property_variance/migrated_0007.js @@ -0,0 +1 @@ +type X = {+[k:K]:V} diff --git a/lib/test/flow/types/object_type_property_variance/migrated_0007.tree.json b/lib/test/flow/types/object_type_property_variance/migrated_0007.tree.json new file mode 100644 index 0000000..c73a440 --- /dev/null +++ b/lib/test/flow/types/object_type_property_variance/migrated_0007.tree.json @@ -0,0 +1,82 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "range":[0,19], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "range":[0,19], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":19}}, + "range":[9,19], + "exact":false, + "inexact":false, + "properties":[], + "indexers":[ + { + "type":"ObjectTypeIndexer", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":18}}, + "range":[10,18], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "name":"k", + "typeAnnotation":null, + "optional":false + }, + "key":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"K", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "value":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "range":[17,18], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "range":[17,18], + "name":"V", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "static":false, + "variance":{ + "type":"Variance", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "kind":"plus" + } + } + ], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/object_type_property_variance/migrated_0008.js b/lib/test/flow/types/object_type_property_variance/migrated_0008.js new file mode 100644 index 0000000..b86bc57 --- /dev/null +++ b/lib/test/flow/types/object_type_property_variance/migrated_0008.js @@ -0,0 +1 @@ +type X = {-[k:K]:V} diff --git a/lib/test/flow/types/object_type_property_variance/migrated_0008.tree.json b/lib/test/flow/types/object_type_property_variance/migrated_0008.tree.json new file mode 100644 index 0000000..f4b2850 --- /dev/null +++ b/lib/test/flow/types/object_type_property_variance/migrated_0008.tree.json @@ -0,0 +1,82 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "range":[0,19], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "range":[0,19], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":19}}, + "range":[9,19], + "exact":false, + "inexact":false, + "properties":[], + "indexers":[ + { + "type":"ObjectTypeIndexer", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":18}}, + "range":[10,18], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "name":"k", + "typeAnnotation":null, + "optional":false + }, + "key":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"K", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "value":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "range":[17,18], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, + "range":[17,18], + "name":"V", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "static":false, + "variance":{ + "type":"Variance", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "kind":"minus" + } + } + ], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/object_type_property_variance/migrated_0009.js b/lib/test/flow/types/object_type_property_variance/migrated_0009.js new file mode 100644 index 0000000..eabbe49 --- /dev/null +++ b/lib/test/flow/types/object_type_property_variance/migrated_0009.js @@ -0,0 +1 @@ +type X = {():T} diff --git a/lib/test/flow/types/object_type_property_variance/migrated_0009.tree.json b/lib/test/flow/types/object_type_property_variance/migrated_0009.tree.json new file mode 100644 index 0000000..abf8e72 --- /dev/null +++ b/lib/test/flow/types/object_type_property_variance/migrated_0009.tree.json @@ -0,0 +1,62 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "range":[9,15], + "exact":false, + "inexact":false, + "properties":[], + "indexers":[], + "callProperties":[ + { + "type":"ObjectTypeCallProperty", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, + "range":[10,14], + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, + "range":[10,14], + "params":[], + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "rest":null, + "typeParameters":null + }, + "static":false + } + ], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/object_type_property_variance/migrated_0010.js b/lib/test/flow/types/object_type_property_variance/migrated_0010.js new file mode 100644 index 0000000..1fd8ff2 --- /dev/null +++ b/lib/test/flow/types/object_type_property_variance/migrated_0010.js @@ -0,0 +1 @@ +type X = {+():T} diff --git a/lib/test/flow/types/object_type_property_variance/migrated_0010.tree.json b/lib/test/flow/types/object_type_property_variance/migrated_0010.tree.json new file mode 100644 index 0000000..9f8dd2b --- /dev/null +++ b/lib/test/flow/types/object_type_property_variance/migrated_0010.tree.json @@ -0,0 +1,68 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "message":"Unexpected variance sigil" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "exact":false, + "inexact":false, + "properties":[], + "indexers":[], + "callProperties":[ + { + "type":"ObjectTypeCallProperty", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, + "range":[10,15], + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":15}}, + "range":[11,15], + "params":[], + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "rest":null, + "typeParameters":null + }, + "static":false + } + ], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/object_type_property_variance/migrated_0011.js b/lib/test/flow/types/object_type_property_variance/migrated_0011.js new file mode 100644 index 0000000..c4a38e7 --- /dev/null +++ b/lib/test/flow/types/object_type_property_variance/migrated_0011.js @@ -0,0 +1 @@ +type X = {-():T} diff --git a/lib/test/flow/types/object_type_property_variance/migrated_0011.tree.json b/lib/test/flow/types/object_type_property_variance/migrated_0011.tree.json new file mode 100644 index 0000000..9f8dd2b --- /dev/null +++ b/lib/test/flow/types/object_type_property_variance/migrated_0011.tree.json @@ -0,0 +1,68 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "message":"Unexpected variance sigil" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"X", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "exact":false, + "inexact":false, + "properties":[], + "indexers":[], + "callProperties":[ + { + "type":"ObjectTypeCallProperty", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, + "range":[10,15], + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":15}}, + "range":[11,15], + "params":[], + "returnType":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "rest":null, + "typeParameters":null + }, + "static":false + } + ], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/object_type_spread/migrated_0000.js b/lib/test/flow/types/object_type_spread/migrated_0000.js new file mode 100644 index 0000000..8f9e26f --- /dev/null +++ b/lib/test/flow/types/object_type_spread/migrated_0000.js @@ -0,0 +1 @@ +type T = {...O} diff --git a/lib/test/flow/types/object_type_spread/migrated_0000.tree.json b/lib/test/flow/types/object_type_spread/migrated_0000.tree.json new file mode 100644 index 0000000..f0c16ce --- /dev/null +++ b/lib/test/flow/types/object_type_spread/migrated_0000.tree.json @@ -0,0 +1,53 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "range":[0,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "range":[9,15], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeSpreadProperty", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, + "range":[10,14], + "argument":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "name":"O", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/object_type_spread/migrated_0001.js b/lib/test/flow/types/object_type_spread/migrated_0001.js new file mode 100644 index 0000000..5b2f92e --- /dev/null +++ b/lib/test/flow/types/object_type_spread/migrated_0001.js @@ -0,0 +1 @@ +type T = {...O,} diff --git a/lib/test/flow/types/object_type_spread/migrated_0001.tree.json b/lib/test/flow/types/object_type_spread/migrated_0001.tree.json new file mode 100644 index 0000000..e20ad15 --- /dev/null +++ b/lib/test/flow/types/object_type_spread/migrated_0001.tree.json @@ -0,0 +1,53 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeSpreadProperty", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, + "range":[10,14], + "argument":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "name":"O", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/object_type_spread/migrated_0002.js b/lib/test/flow/types/object_type_spread/migrated_0002.js new file mode 100644 index 0000000..6910cd8 --- /dev/null +++ b/lib/test/flow/types/object_type_spread/migrated_0002.js @@ -0,0 +1 @@ +type T = {p:T, ...O} diff --git a/lib/test/flow/types/object_type_spread/migrated_0002.tree.json b/lib/test/flow/types/object_type_spread/migrated_0002.tree.json new file mode 100644 index 0000000..6a0678e --- /dev/null +++ b/lib/test/flow/types/object_type_spread/migrated_0002.tree.json @@ -0,0 +1,86 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":20}}, + "range":[9,20], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, + "range":[10,13], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"p", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + }, + { + "type":"ObjectTypeSpreadProperty", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":19}}, + "range":[15,19], + "argument":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "name":"O", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/object_type_spread/migrated_0003.js b/lib/test/flow/types/object_type_spread/migrated_0003.js new file mode 100644 index 0000000..49a0937 --- /dev/null +++ b/lib/test/flow/types/object_type_spread/migrated_0003.js @@ -0,0 +1 @@ +type T = {...O, p:T} diff --git a/lib/test/flow/types/object_type_spread/migrated_0003.tree.json b/lib/test/flow/types/object_type_spread/migrated_0003.tree.json new file mode 100644 index 0000000..b567924 --- /dev/null +++ b/lib/test/flow/types/object_type_spread/migrated_0003.tree.json @@ -0,0 +1,86 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "range":[0,20], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":20}}, + "range":[9,20], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeSpreadProperty", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":14}}, + "range":[10,14], + "argument":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "name":"O", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":19}}, + "range":[16,19], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "range":[16,17], + "name":"p", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/object_type_spread/migrated_0004.js b/lib/test/flow/types/object_type_spread/migrated_0004.js new file mode 100644 index 0000000..bf0cecf --- /dev/null +++ b/lib/test/flow/types/object_type_spread/migrated_0004.js @@ -0,0 +1 @@ +type T = {...O1, ...O2} diff --git a/lib/test/flow/types/object_type_spread/migrated_0004.tree.json b/lib/test/flow/types/object_type_spread/migrated_0004.tree.json new file mode 100644 index 0000000..1b0117a --- /dev/null +++ b/lib/test/flow/types/object_type_spread/migrated_0004.tree.json @@ -0,0 +1,72 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":23}}, + "range":[9,23], + "exact":false, + "inexact":false, + "properties":[ + { + "type":"ObjectTypeSpreadProperty", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, + "range":[10,15], + "argument":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, + "range":[13,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, + "range":[13,15], + "name":"O1", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + { + "type":"ObjectTypeSpreadProperty", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":22}}, + "range":[17,22], + "argument":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "range":[20,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "range":[20,22], + "name":"O2", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/object_type_spread/migrated_0005.js b/lib/test/flow/types/object_type_spread/migrated_0005.js new file mode 100644 index 0000000..4d4b9a0 --- /dev/null +++ b/lib/test/flow/types/object_type_spread/migrated_0005.js @@ -0,0 +1 @@ +type T = {+...O} diff --git a/lib/test/flow/types/object_type_spread/migrated_0005.tree.json b/lib/test/flow/types/object_type_spread/migrated_0005.tree.json new file mode 100644 index 0000000..dbdd014 --- /dev/null +++ b/lib/test/flow/types/object_type_spread/migrated_0005.tree.json @@ -0,0 +1,77 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "message":"Unexpected token `...`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "message":"Unexpected identifier, expected the token `:`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "message":"Unexpected token `}`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "inexact":false, + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, + "range":[10,15], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "range":[11,14], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":{ + "type":"Variance", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "kind":"plus" + }, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_init_eol.js b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_init_eol.js new file mode 100644 index 0000000..932699a --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_init_eol.js @@ -0,0 +1,2 @@ +declare export opaque type Foo: string = +declare export opaque type Bar: string; diff --git a/lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_init_eol.tree.json b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_init_eol.tree.json new file mode 100644 index 0000000..ed2ebd1 --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_init_eol.tree.json @@ -0,0 +1,70 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":40}}, + "message":"Unexpected token `=`. Initializers are not allowed in a `declare opaque type`." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":39}}, + "range":[0,80], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "range":[0,40], + "default":false, + "declaration":{ + "type":"DeclareOpaqueType", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":40}}, + "range":[15,40], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":30}}, + "range":[27,30], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "impltype":null, + "supertype":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":38}}, + "range":[32,38] + } + }, + "specifiers":[], + "source":null + }, + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":39}}, + "range":[41,80], + "default":false, + "declaration":{ + "type":"DeclareOpaqueType", + "loc":{"source":null,"start":{"line":2,"column":15},"end":{"line":2,"column":39}}, + "range":[56,80], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":27},"end":{"line":2,"column":30}}, + "range":[68,71], + "name":"Bar", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "impltype":null, + "supertype":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":32},"end":{"line":2,"column":38}}, + "range":[73,79] + } + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_neither.js b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_neither.js new file mode 100644 index 0000000..fedf0e5 --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_neither.js @@ -0,0 +1 @@ +declare export opaque type Foo diff --git a/lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_neither.tree.json b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_neither.tree.json new file mode 100644 index 0000000..92a8cc2 --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_neither.tree.json @@ -0,0 +1,32 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "default":false, + "declaration":{ + "type":"DeclareOpaqueType", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":30}}, + "range":[15,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":30}}, + "range":[27,30], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "impltype":null, + "supertype":null + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_st_no_t.js b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_st_no_t.js new file mode 100644 index 0000000..3d20f9e --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_st_no_t.js @@ -0,0 +1 @@ +declare export opaque type Foo: Bar diff --git a/lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_st_no_t.tree.json b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_st_no_t.tree.json new file mode 100644 index 0000000..d579379 --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_st_no_t.tree.json @@ -0,0 +1,45 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "default":false, + "declaration":{ + "type":"DeclareOpaqueType", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":35}}, + "range":[15,35], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":30}}, + "range":[27,30], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "impltype":null, + "supertype":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":35}}, + "range":[32,35], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":35}}, + "range":[32,35], + "name":"Bar", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_t_and_st.js b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_t_and_st.js new file mode 100644 index 0000000..ec2fa4b --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_t_and_st.js @@ -0,0 +1 @@ +declare export opaque type Foo: Bar = Baz diff --git a/lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_t_and_st.tree.json b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_t_and_st.tree.json new file mode 100644 index 0000000..7d34448 --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_t_and_st.tree.json @@ -0,0 +1,64 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":37}}, + "message":"Unexpected token `=`. Initializers are not allowed in a `declare opaque type`." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "range":[0,41], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "range":[0,41], + "default":false, + "declaration":{ + "type":"DeclareOpaqueType", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":41}}, + "range":[15,41], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":30}}, + "range":[27,30], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "impltype":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":41}}, + "range":[38,41], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":41}}, + "range":[38,41], + "name":"Baz", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "supertype":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":35}}, + "range":[32,35], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":35}}, + "range":[32,35], + "name":"Bar", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_t_no_st.js b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_t_no_st.js new file mode 100644 index 0000000..3bd35eb --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_t_no_st.js @@ -0,0 +1 @@ +declare export opaque type Foo = Bar diff --git a/lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_t_no_st.tree.json b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_t_no_st.tree.json new file mode 100644 index 0000000..2a0c951 --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_export_t_no_st.tree.json @@ -0,0 +1,51 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":32}}, + "message":"Unexpected token `=`. Initializers are not allowed in a `declare opaque type`." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "default":false, + "declaration":{ + "type":"DeclareOpaqueType", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":36}}, + "range":[15,36], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":30}}, + "range":[27,30], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "impltype":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":36}}, + "range":[33,36], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":36}}, + "range":[33,36], + "name":"Bar", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "supertype":null + }, + "specifiers":[], + "source":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/opaque_aliases/declare/opaque_declare_neither.js b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_neither.js new file mode 100644 index 0000000..6fd5fb2 --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_neither.js @@ -0,0 +1 @@ +declare opaque type Foo diff --git a/lib/test/flow/types/opaque_aliases/declare/opaque_declare_neither.tree.json b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_neither.tree.json new file mode 100644 index 0000000..0bd3cbc --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_neither.tree.json @@ -0,0 +1,24 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "body":[ + { + "type":"DeclareOpaqueType", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":23}}, + "range":[20,23], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "impltype":null, + "supertype":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/opaque_aliases/declare/opaque_declare_st_no_t.js b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_st_no_t.js new file mode 100644 index 0000000..8e71e6c --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_st_no_t.js @@ -0,0 +1 @@ +declare opaque type Test: Foo diff --git a/lib/test/flow/types/opaque_aliases/declare/opaque_declare_st_no_t.tree.json b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_st_no_t.tree.json new file mode 100644 index 0000000..785670a --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_st_no_t.tree.json @@ -0,0 +1,37 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "body":[ + { + "type":"DeclareOpaqueType", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":24}}, + "range":[20,24], + "name":"Test", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "impltype":null, + "supertype":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":29}}, + "range":[26,29], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":29}}, + "range":[26,29], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/opaque_aliases/declare/opaque_declare_t_and_st.js b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_t_and_st.js new file mode 100644 index 0000000..de48c54 --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_t_and_st.js @@ -0,0 +1 @@ +declare opaque type Foo: Bar = Baz diff --git a/lib/test/flow/types/opaque_aliases/declare/opaque_declare_t_and_st.tree.json b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_t_and_st.tree.json new file mode 100644 index 0000000..173e6bb --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_t_and_st.tree.json @@ -0,0 +1,56 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":30}}, + "message":"Unexpected token `=`. Initializers are not allowed in a `declare opaque type`." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "range":[0,34], + "body":[ + { + "type":"DeclareOpaqueType", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "range":[0,34], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":23}}, + "range":[20,23], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "impltype":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":34}}, + "range":[31,34], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":34}}, + "range":[31,34], + "name":"Baz", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "supertype":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":28}}, + "range":[25,28], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":28}}, + "range":[25,28], + "name":"Bar", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/opaque_aliases/declare/opaque_declare_t_no_st.js b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_t_no_st.js new file mode 100644 index 0000000..084079d --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_t_no_st.js @@ -0,0 +1 @@ +declare opaque type Foo = Bar diff --git a/lib/test/flow/types/opaque_aliases/declare/opaque_declare_t_no_st.tree.json b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_t_no_st.tree.json new file mode 100644 index 0000000..e92d652 --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/declare/opaque_declare_t_no_st.tree.json @@ -0,0 +1,43 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, + "message":"Unexpected token `=`. Initializers are not allowed in a `declare opaque type`." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "body":[ + { + "type":"DeclareOpaqueType", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":23}}, + "range":[20,23], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "impltype":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":29}}, + "range":[26,29], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":29}}, + "range":[26,29], + "name":"Bar", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "supertype":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/opaque_aliases/invalid/opaque_invalid1.js b/lib/test/flow/types/opaque_aliases/invalid/opaque_invalid1.js new file mode 100644 index 0000000..f10f5b9 --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/invalid/opaque_invalid1.js @@ -0,0 +1 @@ +export opaque potato FBID = number; diff --git a/lib/test/flow/types/opaque_aliases/invalid/opaque_invalid1.tree.json b/lib/test/flow/types/opaque_aliases/invalid/opaque_invalid1.tree.json new file mode 100644 index 0000000..2675109 --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/invalid/opaque_invalid1.tree.json @@ -0,0 +1,42 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":20}}, + "message":"Unexpected identifier, expected the token `type`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "declaration":{ + "type":"OpaqueType", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":35}}, + "range":[7,35], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":25}}, + "range":[21,25], + "name":"FBID", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "impltype":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":34}}, + "range":[28,34] + }, + "supertype":null + }, + "specifiers":[], + "source":null, + "exportKind":"type" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/opaque_aliases/invalid/opaque_invalid2.js b/lib/test/flow/types/opaque_aliases/invalid/opaque_invalid2.js new file mode 100644 index 0000000..bcdcd95 --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/invalid/opaque_invalid2.js @@ -0,0 +1 @@ +opaque potato FBID = number; diff --git a/lib/test/flow/types/opaque_aliases/invalid/opaque_invalid2.tree.json b/lib/test/flow/types/opaque_aliases/invalid/opaque_invalid2.tree.json new file mode 100644 index 0000000..7ca7836 --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/invalid/opaque_invalid2.tree.json @@ -0,0 +1,74 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, + "message":"Unexpected identifier, expected the end of an expression statement (`;`)" + }, + { + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":18}}, + "message":"Unexpected identifier, expected the end of an expression statement (`;`)" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "name":"opaque", + "typeAnnotation":null, + "optional":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, + "range":[7,13], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, + "range":[7,13], + "name":"potato", + "typeAnnotation":null, + "optional":false + }, + "directive":null + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":28}}, + "range":[14,28], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":27}}, + "range":[14,27], + "operator":"=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":18}}, + "range":[14,18], + "name":"FBID", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "range":[21,27], + "name":"number", + "typeAnnotation":null, + "optional":false + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/opaque_aliases/invalid/opaque_subtype_allow_export.js b/lib/test/flow/types/opaque_aliases/invalid/opaque_subtype_allow_export.js new file mode 100644 index 0000000..270b9f1 --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/invalid/opaque_subtype_allow_export.js @@ -0,0 +1,3 @@ +declare module 'foo' { + declare export opaque type MyType: number = string; +} diff --git a/lib/test/flow/types/opaque_aliases/invalid/opaque_subtype_allow_export.tree.json b/lib/test/flow/types/opaque_aliases/invalid/opaque_subtype_allow_export.tree.json new file mode 100644 index 0000000..9407259 --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/invalid/opaque_subtype_allow_export.tree.json @@ -0,0 +1,66 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":44},"end":{"line":2,"column":45}}, + "message":"Unexpected token `=`. Initializers are not allowed in a `declare opaque type`." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,78], + "body":[ + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,78], + "id":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "range":[15,20], + "value":"foo", + "raw":"'foo'" + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":3,"column":1}}, + "range":[21,78], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":53}}, + "range":[25,76], + "default":false, + "declaration":{ + "type":"DeclareOpaqueType", + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":53}}, + "range":[40,76], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":29},"end":{"line":2,"column":35}}, + "range":[52,58], + "name":"MyType", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "impltype":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":46},"end":{"line":2,"column":52}}, + "range":[69,75] + }, + "supertype":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":37},"end":{"line":2,"column":43}}, + "range":[60,66] + } + }, + "specifiers":[], + "source":null + } + ] + }, + "kind":"ES" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/opaque_aliases/invalid/opaque_subtype_invalid1.js b/lib/test/flow/types/opaque_aliases/invalid/opaque_subtype_invalid1.js new file mode 100644 index 0000000..16c8fa3 --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/invalid/opaque_subtype_invalid1.js @@ -0,0 +1 @@ +opaque Ident: Type = SuperType; diff --git a/lib/test/flow/types/opaque_aliases/invalid/opaque_subtype_invalid1.tree.json b/lib/test/flow/types/opaque_aliases/invalid/opaque_subtype_invalid1.tree.json new file mode 100644 index 0000000..b34f924 --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/invalid/opaque_subtype_invalid1.tree.json @@ -0,0 +1,69 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, + "message":"Unexpected identifier, expected the end of an expression statement (`;`)" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "name":"opaque", + "typeAnnotation":null, + "optional":false + }, + "directive":null + }, + { + "type":"LabeledStatement", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":31}}, + "range":[7,31], + "label":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, + "range":[7,12], + "name":"Ident", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":31}}, + "range":[14,31], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":30}}, + "range":[14,30], + "operator":"=", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":18}}, + "range":[14,18], + "name":"Type", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":30}}, + "range":[21,30], + "name":"SuperType", + "typeAnnotation":null, + "optional":false + } + }, + "directive":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/opaque_aliases/invalid/opaque_subtype_invalid2.js b/lib/test/flow/types/opaque_aliases/invalid/opaque_subtype_invalid2.js new file mode 100644 index 0000000..be9c43d --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/invalid/opaque_subtype_invalid2.js @@ -0,0 +1 @@ +export opaque potato: FBID = number; diff --git a/lib/test/flow/types/opaque_aliases/invalid/opaque_subtype_invalid2.tree.json b/lib/test/flow/types/opaque_aliases/invalid/opaque_subtype_invalid2.tree.json new file mode 100644 index 0000000..fcbec1b --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/invalid/opaque_subtype_invalid2.tree.json @@ -0,0 +1,89 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":20}}, + "message":"Unexpected identifier, expected the token `type`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "message":"Unexpected token `:`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":26}}, + "message":"Unexpected identifier, expected the token `=`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, + "message":"Unexpected token `=`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, + "message":"Unexpected token `=`, expected the token `;`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, + "message":"Invalid left-hand side in assignment" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "declaration":{ + "type":"OpaqueType", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":26}}, + "range":[7,26], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "name":"", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "impltype":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, + "range":[27,28] + }, + "supertype":null + }, + "specifiers":[], + "source":null, + "exportKind":"type" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":36}}, + "range":[27,36], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":35}}, + "range":[27,35], + "operator":"=", + "left":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":28}}, + "range":[27,28], + "value":null, + "raw":"null" + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":35}}, + "range":[29,35], + "name":"number", + "typeAnnotation":null, + "optional":false + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/opaque_aliases/invalid/opaque_subtype_invalid3.js b/lib/test/flow/types/opaque_aliases/invalid/opaque_subtype_invalid3.js new file mode 100644 index 0000000..04beb59 --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/invalid/opaque_subtype_invalid3.js @@ -0,0 +1 @@ +opaque stuff: Box = Container diff --git a/lib/test/flow/types/opaque_aliases/invalid/opaque_subtype_invalid3.tree.json b/lib/test/flow/types/opaque_aliases/invalid/opaque_subtype_invalid3.tree.json new file mode 100644 index 0000000..5216a49 --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/invalid/opaque_subtype_invalid3.tree.json @@ -0,0 +1,135 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, + "message":"Unexpected identifier, expected the end of an expression statement (`;`)" + }, + { + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "message":"Unexpected token `=`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":20}}, + "message":"Invalid left-hand side in assignment" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "name":"opaque", + "typeAnnotation":null, + "optional":false + }, + "directive":null + }, + { + "type":"LabeledStatement", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":35}}, + "range":[7,35], + "label":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, + "range":[7,12], + "name":"stuff", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":35}}, + "range":[14,35], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":35}}, + "range":[14,35], + "operator":"=", + "left":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":20}}, + "range":[14,20], + "operator":">", + "left":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, + "range":[14,19], + "operator":"<", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, + "range":[14,17], + "name":"Box", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "name":"T", + "typeAnnotation":null, + "optional":false + } + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "value":null, + "raw":"null" + } + }, + "right":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":35}}, + "range":[23,35], + "operator":">", + "left":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":34}}, + "range":[23,34], + "operator":"<", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":32}}, + "range":[23,32], + "name":"Container", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":34}}, + "range":[33,34], + "name":"T", + "typeAnnotation":null, + "optional":false + } + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "range":[36,36], + "value":null, + "raw":"null" + } + } + }, + "directive":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/opaque_aliases/invalid/opaque_type_allow_export.js b/lib/test/flow/types/opaque_aliases/invalid/opaque_type_allow_export.js new file mode 100644 index 0000000..2fb871d --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/invalid/opaque_type_allow_export.js @@ -0,0 +1,3 @@ +declare module 'foo' { + declare export opaque type MyType = string; +} diff --git a/lib/test/flow/types/opaque_aliases/invalid/opaque_type_allow_export.tree.json b/lib/test/flow/types/opaque_aliases/invalid/opaque_type_allow_export.tree.json new file mode 100644 index 0000000..dbc1de7 --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/invalid/opaque_type_allow_export.tree.json @@ -0,0 +1,62 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":36},"end":{"line":2,"column":37}}, + "message":"Unexpected token `=`. Initializers are not allowed in a `declare opaque type`." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,70], + "body":[ + { + "type":"DeclareModule", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,70], + "id":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "range":[15,20], + "value":"foo", + "raw":"'foo'" + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":3,"column":1}}, + "range":[21,70], + "body":[ + { + "type":"DeclareExportDeclaration", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":45}}, + "range":[25,68], + "default":false, + "declaration":{ + "type":"DeclareOpaqueType", + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":45}}, + "range":[40,68], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":29},"end":{"line":2,"column":35}}, + "range":[52,58], + "name":"MyType", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "impltype":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":38},"end":{"line":2,"column":44}}, + "range":[61,67] + }, + "supertype":null + }, + "specifiers":[], + "source":null + } + ] + }, + "kind":"ES" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/opaque_aliases/invalid/reserved_type.js b/lib/test/flow/types/opaque_aliases/invalid/reserved_type.js new file mode 100644 index 0000000..af9115c --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/invalid/reserved_type.js @@ -0,0 +1 @@ +opaque type string = number; diff --git a/lib/test/flow/types/opaque_aliases/invalid/reserved_type.tree.json b/lib/test/flow/types/opaque_aliases/invalid/reserved_type.tree.json new file mode 100644 index 0000000..6d21a6f --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/invalid/reserved_type.tree.json @@ -0,0 +1,34 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":18}}, + "message":"Unexpected reserved type" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "body":[ + { + "type":"OpaqueType", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":18}}, + "range":[12,18], + "name":"string", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "impltype":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "range":[21,27] + }, + "supertype":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/opaque_aliases/valid/declare_opaque.js b/lib/test/flow/types/opaque_aliases/valid/declare_opaque.js new file mode 100644 index 0000000..feead34 --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/valid/declare_opaque.js @@ -0,0 +1 @@ +declare opaque type FBID = number; diff --git a/lib/test/flow/types/opaque_aliases/valid/declare_opaque.tree.json b/lib/test/flow/types/opaque_aliases/valid/declare_opaque.tree.json new file mode 100644 index 0000000..02eeff4 --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/valid/declare_opaque.tree.json @@ -0,0 +1,34 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, + "message":"Unexpected token `=`. Initializers are not allowed in a `declare opaque type`." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "range":[0,34], + "body":[ + { + "type":"DeclareOpaqueType", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "range":[0,34], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":24}}, + "range":[20,24], + "name":"FBID", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "impltype":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":33}}, + "range":[27,33] + }, + "supertype":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/opaque_aliases/valid/opaque_subtype.js b/lib/test/flow/types/opaque_aliases/valid/opaque_subtype.js new file mode 100644 index 0000000..1d3425d --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/valid/opaque_subtype.js @@ -0,0 +1 @@ +opaque type Counter: Box = Container; diff --git a/lib/test/flow/types/opaque_aliases/valid/opaque_subtype.tree.json b/lib/test/flow/types/opaque_aliases/valid/opaque_subtype.tree.json new file mode 100644 index 0000000..721319e --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/valid/opaque_subtype.tree.json @@ -0,0 +1,90 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "range":[0,43], + "body":[ + { + "type":"OpaqueType", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "range":[0,43], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":19}}, + "range":[12,19], + "name":"Counter", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "impltype":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":42}}, + "range":[30,42], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":39}}, + "range":[30,39], + "name":"Container", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":42}}, + "range":[39,42], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":40},"end":{"line":1,"column":41}}, + "range":[40,41], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":40},"end":{"line":1,"column":41}}, + "range":[40,41], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + }, + "supertype":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "range":[21,27], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":24}}, + "range":[21,24], + "name":"Box", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":27}}, + "range":[24,27], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, + "range":[25,26], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, + "range":[25,26], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/opaque_aliases/valid/opaque_subtype_export.js b/lib/test/flow/types/opaque_aliases/valid/opaque_subtype_export.js new file mode 100644 index 0000000..517a125 --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/valid/opaque_subtype_export.js @@ -0,0 +1 @@ +export opaque type Counter: Box = Container; diff --git a/lib/test/flow/types/opaque_aliases/valid/opaque_subtype_export.tree.json b/lib/test/flow/types/opaque_aliases/valid/opaque_subtype_export.tree.json new file mode 100644 index 0000000..ccecb45 --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/valid/opaque_subtype_export.tree.json @@ -0,0 +1,98 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "range":[0,50], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "range":[0,50], + "declaration":{ + "type":"OpaqueType", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":50}}, + "range":[7,50], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":26}}, + "range":[19,26], + "name":"Counter", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "impltype":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":49}}, + "range":[37,49], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":46}}, + "range":[37,46], + "name":"Container", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":46},"end":{"line":1,"column":49}}, + "range":[46,49], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":47},"end":{"line":1,"column":48}}, + "range":[47,48], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":47},"end":{"line":1,"column":48}}, + "range":[47,48], + "name":"S", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + }, + "supertype":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":34}}, + "range":[28,34], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":31}}, + "range":[28,31], + "name":"Box", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":34}}, + "range":[31,34], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, + "range":[32,33], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":33}}, + "range":[32,33], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + } + }, + "specifiers":[], + "source":null, + "exportKind":"type" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/opaque_aliases/valid/opaque_type.js b/lib/test/flow/types/opaque_aliases/valid/opaque_type.js new file mode 100644 index 0000000..1208738 --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/valid/opaque_type.js @@ -0,0 +1 @@ +opaque type FBID = number; diff --git a/lib/test/flow/types/opaque_aliases/valid/opaque_type.tree.json b/lib/test/flow/types/opaque_aliases/valid/opaque_type.tree.json new file mode 100644 index 0000000..bc9e2f7 --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/valid/opaque_type.tree.json @@ -0,0 +1,28 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "body":[ + { + "type":"OpaqueType", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":16}}, + "range":[12,16], + "name":"FBID", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "impltype":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":25}}, + "range":[19,25] + }, + "supertype":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/opaque_aliases/valid/opaque_type_export.js b/lib/test/flow/types/opaque_aliases/valid/opaque_type_export.js new file mode 100644 index 0000000..ed5fb63 --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/valid/opaque_type_export.js @@ -0,0 +1 @@ +export opaque type FBID = number; diff --git a/lib/test/flow/types/opaque_aliases/valid/opaque_type_export.tree.json b/lib/test/flow/types/opaque_aliases/valid/opaque_type_export.tree.json new file mode 100644 index 0000000..ee1b272 --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/valid/opaque_type_export.tree.json @@ -0,0 +1,36 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "body":[ + { + "type":"ExportNamedDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "declaration":{ + "type":"OpaqueType", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":33}}, + "range":[7,33], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":23}}, + "range":[19,23], + "name":"FBID", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "impltype":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":32}}, + "range":[26,32] + }, + "supertype":null + }, + "specifiers":[], + "source":null, + "exportKind":"type" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/opaque_aliases/valid/reserved_value.js b/lib/test/flow/types/opaque_aliases/valid/reserved_value.js new file mode 100644 index 0000000..ee2234d --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/valid/reserved_value.js @@ -0,0 +1 @@ +opaque type switch = number; diff --git a/lib/test/flow/types/opaque_aliases/valid/reserved_value.tree.json b/lib/test/flow/types/opaque_aliases/valid/reserved_value.tree.json new file mode 100644 index 0000000..48a55cc --- /dev/null +++ b/lib/test/flow/types/opaque_aliases/valid/reserved_value.tree.json @@ -0,0 +1,28 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "body":[ + { + "type":"OpaqueType", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":18}}, + "range":[12,18], + "name":"switch", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "impltype":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "range":[21,27] + }, + "supertype":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/optional_indexer_name/migrated_0000.js b/lib/test/flow/types/optional_indexer_name/migrated_0000.js new file mode 100644 index 0000000..3846a5d --- /dev/null +++ b/lib/test/flow/types/optional_indexer_name/migrated_0000.js @@ -0,0 +1 @@ +type A = { [string]: number }; diff --git a/lib/test/flow/types/optional_indexer_name/migrated_0000.tree.json b/lib/test/flow/types/optional_indexer_name/migrated_0000.tree.json new file mode 100644 index 0000000..ed404f5 --- /dev/null +++ b/lib/test/flow/types/optional_indexer_name/migrated_0000.tree.json @@ -0,0 +1,52 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":29}}, + "range":[9,29], + "exact":false, + "inexact":false, + "properties":[], + "indexers":[ + { + "type":"ObjectTypeIndexer", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":27}}, + "range":[11,27], + "id":null, + "key":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":18}}, + "range":[12,18] + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "range":[21,27] + }, + "static":false, + "variance":null + } + ], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/optional_indexer_name/migrated_0001.js b/lib/test/flow/types/optional_indexer_name/migrated_0001.js new file mode 100644 index 0000000..dde03a4 --- /dev/null +++ b/lib/test/flow/types/optional_indexer_name/migrated_0001.js @@ -0,0 +1 @@ +type A = { [string | boolean]: number }; diff --git a/lib/test/flow/types/optional_indexer_name/migrated_0001.tree.json b/lib/test/flow/types/optional_indexer_name/migrated_0001.tree.json new file mode 100644 index 0000000..b8fbaeb --- /dev/null +++ b/lib/test/flow/types/optional_indexer_name/migrated_0001.tree.json @@ -0,0 +1,64 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "range":[0,40], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "range":[0,40], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":39}}, + "range":[9,39], + "exact":false, + "inexact":false, + "properties":[], + "indexers":[ + { + "type":"ObjectTypeIndexer", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":37}}, + "range":[11,37], + "id":null, + "key":{ + "type":"UnionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":28}}, + "range":[12,28], + "types":[ + { + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":18}}, + "range":[12,18] + }, + { + "type":"BooleanTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":28}}, + "range":[21,28] + } + ] + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":37}}, + "range":[31,37] + }, + "static":false, + "variance":null + } + ], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0000.js b/lib/test/flow/types/parameter_defaults/migrated_0000.js new file mode 100644 index 0000000..b1da946 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0000.js @@ -0,0 +1 @@ +type A = T diff --git a/lib/test/flow/types/parameter_defaults/migrated_0000.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0000.tree.json new file mode 100644 index 0000000..f1ca467 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0000.tree.json @@ -0,0 +1,55 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":18}}, + "range":[6,18], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":17}}, + "range":[7,17], + "name":"T", + "bound":null, + "variance":null, + "default":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":17}}, + "range":[11,17] + } + } + ] + }, + "right":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "range":[21,22], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0001.js b/lib/test/flow/types/parameter_defaults/migrated_0001.js new file mode 100644 index 0000000..1f96091 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0001.js @@ -0,0 +1 @@ +type A = T diff --git a/lib/test/flow/types/parameter_defaults/migrated_0001.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0001.tree.json new file mode 100644 index 0000000..0653a64 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0001.tree.json @@ -0,0 +1,69 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":27}}, + "range":[6,27], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":26}}, + "range":[7,26], + "name":"T", + "bound":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":17}}, + "range":[8,17], + "typeAnnotation":{ + "type":"NullableTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":17}}, + "range":[10,17], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":17}}, + "range":[11,17] + } + } + }, + "variance":null, + "default":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":26}}, + "range":[20,26] + } + } + ] + }, + "right":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":31}}, + "range":[30,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":31}}, + "range":[30,31], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0002.js b/lib/test/flow/types/parameter_defaults/migrated_0002.js new file mode 100644 index 0000000..1e96974 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0002.js @@ -0,0 +1 @@ +type A = T diff --git a/lib/test/flow/types/parameter_defaults/migrated_0002.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0002.tree.json new file mode 100644 index 0000000..abdeaed --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0002.tree.json @@ -0,0 +1,78 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "range":[0,34], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "range":[0,34], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":30}}, + "range":[6,30], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "range":[7,8], + "name":"S", + "bound":null, + "variance":null, + "default":null + }, + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":29}}, + "range":[10,29], + "name":"T", + "bound":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":20}}, + "range":[11,20], + "typeAnnotation":{ + "type":"NullableTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":20}}, + "range":[13,20], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":20}}, + "range":[14,20] + } + } + }, + "variance":null, + "default":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":29}}, + "range":[23,29] + } + } + ] + }, + "right":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":34}}, + "range":[33,34], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":34}}, + "range":[33,34], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0003.js b/lib/test/flow/types/parameter_defaults/migrated_0003.js new file mode 100644 index 0000000..cd4aafe --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0003.js @@ -0,0 +1 @@ +type A = T diff --git a/lib/test/flow/types/parameter_defaults/migrated_0003.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0003.tree.json new file mode 100644 index 0000000..70a7226 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0003.tree.json @@ -0,0 +1,82 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "range":[0,43], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "range":[0,43], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":39}}, + "range":[6,39], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":17}}, + "range":[7,17], + "name":"S", + "bound":null, + "variance":null, + "default":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":17}}, + "range":[11,17] + } + }, + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":38}}, + "range":[19,38], + "name":"T", + "bound":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":29}}, + "range":[20,29], + "typeAnnotation":{ + "type":"NullableTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":29}}, + "range":[22,29], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":29}}, + "range":[23,29] + } + } + }, + "variance":null, + "default":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":38}}, + "range":[32,38] + } + } + ] + }, + "right":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":42},"end":{"line":1,"column":43}}, + "range":[42,43], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":42},"end":{"line":1,"column":43}}, + "range":[42,43], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0004.js b/lib/test/flow/types/parameter_defaults/migrated_0004.js new file mode 100644 index 0000000..6b9148a --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0004.js @@ -0,0 +1 @@ +class A {} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0004.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0004.tree.json new file mode 100644 index 0000000..783737c --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0004.tree.json @@ -0,0 +1,51 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "range":[20,22], + "body":[] + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":19}}, + "range":[7,19], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":18}}, + "range":[8,18], + "name":"T", + "bound":null, + "variance":null, + "default":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":18}}, + "range":[12,18] + } + } + ] + }, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0005.js b/lib/test/flow/types/parameter_defaults/migrated_0005.js new file mode 100644 index 0000000..2ca459f --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0005.js @@ -0,0 +1 @@ +class A {} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0005.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0005.tree.json new file mode 100644 index 0000000..b859cc8 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0005.tree.json @@ -0,0 +1,65 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, + "range":[0,31], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, + "range":[29,31], + "body":[] + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":28}}, + "range":[7,28], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":27}}, + "range":[8,27], + "name":"T", + "bound":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":18}}, + "range":[9,18], + "typeAnnotation":{ + "type":"NullableTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":18}}, + "range":[11,18], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":18}}, + "range":[12,18] + } + } + }, + "variance":null, + "default":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "range":[21,27] + } + } + ] + }, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0006.js b/lib/test/flow/types/parameter_defaults/migrated_0006.js new file mode 100644 index 0000000..85d57bf --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0006.js @@ -0,0 +1 @@ +class A {} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0006.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0006.tree.json new file mode 100644 index 0000000..65d073f --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0006.tree.json @@ -0,0 +1,74 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "range":[0,34], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "range":[0,34], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":34}}, + "range":[32,34], + "body":[] + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":31}}, + "range":[7,31], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, + "range":[8,9], + "name":"S", + "bound":null, + "variance":null, + "default":null + }, + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":30}}, + "range":[11,30], + "name":"T", + "bound":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":21}}, + "range":[12,21], + "typeAnnotation":{ + "type":"NullableTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":21}}, + "range":[14,21], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":21}}, + "range":[15,21] + } + } + }, + "variance":null, + "default":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":30}}, + "range":[24,30] + } + } + ] + }, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0007.js b/lib/test/flow/types/parameter_defaults/migrated_0007.js new file mode 100644 index 0000000..339d8f8 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0007.js @@ -0,0 +1 @@ +class A {} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0007.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0007.tree.json new file mode 100644 index 0000000..a2a168f --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0007.tree.json @@ -0,0 +1,78 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "range":[0,43], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "range":[0,43], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":43}}, + "range":[41,43], + "body":[] + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":40}}, + "range":[7,40], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":18}}, + "range":[8,18], + "name":"S", + "bound":null, + "variance":null, + "default":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":18}}, + "range":[12,18] + } + }, + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":39}}, + "range":[20,39], + "name":"T", + "bound":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":30}}, + "range":[21,30], + "typeAnnotation":{ + "type":"NullableTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":30}}, + "range":[23,30], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":30}}, + "range":[24,30] + } + } + }, + "variance":null, + "default":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":39}}, + "range":[33,39] + } + } + ] + }, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0008.js b/lib/test/flow/types/parameter_defaults/migrated_0008.js new file mode 100644 index 0000000..ba92169 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0008.js @@ -0,0 +1 @@ +(class A {}) diff --git a/lib/test/flow/types/parameter_defaults/migrated_0008.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0008.tree.json new file mode 100644 index 0000000..ddad297 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0008.tree.json @@ -0,0 +1,57 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "expression":{ + "type":"ClassExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":23}}, + "range":[1,23], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "range":[7,8], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, + "range":[21,23], + "body":[] + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":20}}, + "range":[8,20], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":19}}, + "range":[9,19], + "name":"T", + "bound":null, + "variance":null, + "default":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":19}}, + "range":[13,19] + } + } + ] + }, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0009.js b/lib/test/flow/types/parameter_defaults/migrated_0009.js new file mode 100644 index 0000000..e404776 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0009.js @@ -0,0 +1 @@ +(class A {}) diff --git a/lib/test/flow/types/parameter_defaults/migrated_0009.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0009.tree.json new file mode 100644 index 0000000..bd721b0 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0009.tree.json @@ -0,0 +1,71 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "range":[0,33], + "expression":{ + "type":"ClassExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":32}}, + "range":[1,32], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "range":[7,8], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":32}}, + "range":[30,32], + "body":[] + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":29}}, + "range":[8,29], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":28}}, + "range":[9,28], + "name":"T", + "bound":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":19}}, + "range":[10,19], + "typeAnnotation":{ + "type":"NullableTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":19}}, + "range":[12,19], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":19}}, + "range":[13,19] + } + } + }, + "variance":null, + "default":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":28}}, + "range":[22,28] + } + } + ] + }, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0010.js b/lib/test/flow/types/parameter_defaults/migrated_0010.js new file mode 100644 index 0000000..ae806af --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0010.js @@ -0,0 +1 @@ +(class A {}) diff --git a/lib/test/flow/types/parameter_defaults/migrated_0010.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0010.tree.json new file mode 100644 index 0000000..577e99d --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0010.tree.json @@ -0,0 +1,80 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "expression":{ + "type":"ClassExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":35}}, + "range":[1,35], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "range":[7,8], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":35}}, + "range":[33,35], + "body":[] + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":32}}, + "range":[8,32], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "name":"S", + "bound":null, + "variance":null, + "default":null + }, + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":31}}, + "range":[12,31], + "name":"T", + "bound":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":22}}, + "range":[13,22], + "typeAnnotation":{ + "type":"NullableTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":22}}, + "range":[15,22], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":22}}, + "range":[16,22] + } + } + }, + "variance":null, + "default":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":31}}, + "range":[25,31] + } + } + ] + }, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0011.js b/lib/test/flow/types/parameter_defaults/migrated_0011.js new file mode 100644 index 0000000..825e6af --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0011.js @@ -0,0 +1 @@ +(class A {}) diff --git a/lib/test/flow/types/parameter_defaults/migrated_0011.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0011.tree.json new file mode 100644 index 0000000..bda2a7a --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0011.tree.json @@ -0,0 +1,84 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "range":[0,45], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":45}}, + "range":[0,45], + "expression":{ + "type":"ClassExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":44}}, + "range":[1,44], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "range":[7,8], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":42},"end":{"line":1,"column":44}}, + "range":[42,44], + "body":[] + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":41}}, + "range":[8,41], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":19}}, + "range":[9,19], + "name":"S", + "bound":null, + "variance":null, + "default":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":19}}, + "range":[13,19] + } + }, + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":40}}, + "range":[21,40], + "name":"T", + "bound":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":31}}, + "range":[22,31], + "typeAnnotation":{ + "type":"NullableTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":31}}, + "range":[24,31], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":31}}, + "range":[25,31] + } + } + }, + "variance":null, + "default":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":40}}, + "range":[34,40] + } + } + ] + }, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0012.js b/lib/test/flow/types/parameter_defaults/migrated_0012.js new file mode 100644 index 0000000..ea83fa7 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0012.js @@ -0,0 +1 @@ +declare class A {} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0012.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0012.tree.json new file mode 100644 index 0000000..5f2c773 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0012.tree.json @@ -0,0 +1,54 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}}, + "range":[0,30], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":27}}, + "range":[15,27], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":26}}, + "range":[16,26], + "name":"T", + "bound":null, + "variance":null, + "default":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":26}}, + "range":[20,26] + } + } + ] + }, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, + "range":[28,30], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0013.js b/lib/test/flow/types/parameter_defaults/migrated_0013.js new file mode 100644 index 0000000..44e1ea9 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0013.js @@ -0,0 +1 @@ +declare class A {} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0013.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0013.tree.json new file mode 100644 index 0000000..389bed9 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0013.tree.json @@ -0,0 +1,68 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "range":[0,39], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "range":[0,39], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":36}}, + "range":[15,36], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":35}}, + "range":[16,35], + "name":"T", + "bound":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":26}}, + "range":[17,26], + "typeAnnotation":{ + "type":"NullableTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":26}}, + "range":[19,26], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":26}}, + "range":[20,26] + } + } + }, + "variance":null, + "default":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":35}}, + "range":[29,35] + } + } + ] + }, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":39}}, + "range":[37,39], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0014.js b/lib/test/flow/types/parameter_defaults/migrated_0014.js new file mode 100644 index 0000000..707b402 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0014.js @@ -0,0 +1 @@ +declare class A {} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0014.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0014.tree.json new file mode 100644 index 0000000..00188cb --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0014.tree.json @@ -0,0 +1,77 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "range":[0,42], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "range":[0,42], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":39}}, + "range":[15,39], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "range":[16,17], + "name":"S", + "bound":null, + "variance":null, + "default":null + }, + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":38}}, + "range":[19,38], + "name":"T", + "bound":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":29}}, + "range":[20,29], + "typeAnnotation":{ + "type":"NullableTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":29}}, + "range":[22,29], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":29}}, + "range":[23,29] + } + } + }, + "variance":null, + "default":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":38}}, + "range":[32,38] + } + } + ] + }, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":40},"end":{"line":1,"column":42}}, + "range":[40,42], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0015.js b/lib/test/flow/types/parameter_defaults/migrated_0015.js new file mode 100644 index 0000000..a3be753 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0015.js @@ -0,0 +1 @@ +declare class A {} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0015.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0015.tree.json new file mode 100644 index 0000000..84569df --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0015.tree.json @@ -0,0 +1,81 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, + "range":[0,51], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":51}}, + "range":[0,51], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":48}}, + "range":[15,48], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":26}}, + "range":[16,26], + "name":"S", + "bound":null, + "variance":null, + "default":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":26}}, + "range":[20,26] + } + }, + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":47}}, + "range":[28,47], + "name":"T", + "bound":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":38}}, + "range":[29,38], + "typeAnnotation":{ + "type":"NullableTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":38}}, + "range":[31,38], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":32},"end":{"line":1,"column":38}}, + "range":[32,38] + } + } + }, + "variance":null, + "default":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":47}}, + "range":[41,47] + } + } + ] + }, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":49},"end":{"line":1,"column":51}}, + "range":[49,51], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0016.js b/lib/test/flow/types/parameter_defaults/migrated_0016.js new file mode 100644 index 0000000..a7a1a94 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0016.js @@ -0,0 +1 @@ +interface A {} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0016.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0016.tree.json new file mode 100644 index 0000000..04daa92 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0016.tree.json @@ -0,0 +1,52 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "body":[ + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":23}}, + "range":[11,23], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":22}}, + "range":[12,22], + "name":"T", + "bound":null, + "variance":null, + "default":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":22}}, + "range":[16,22] + } + } + ] + }, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, + "range":[24,26], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0017.js b/lib/test/flow/types/parameter_defaults/migrated_0017.js new file mode 100644 index 0000000..7a48269 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0017.js @@ -0,0 +1 @@ +interface A {} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0017.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0017.tree.json new file mode 100644 index 0000000..71d1d38 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0017.tree.json @@ -0,0 +1,66 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "body":[ + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":35}}, + "range":[0,35], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":32}}, + "range":[11,32], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":31}}, + "range":[12,31], + "name":"T", + "bound":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":22}}, + "range":[13,22], + "typeAnnotation":{ + "type":"NullableTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":22}}, + "range":[15,22], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":22}}, + "range":[16,22] + } + } + }, + "variance":null, + "default":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":31}}, + "range":[25,31] + } + } + ] + }, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":35}}, + "range":[33,35], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0018.js b/lib/test/flow/types/parameter_defaults/migrated_0018.js new file mode 100644 index 0000000..c7f17be --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0018.js @@ -0,0 +1 @@ +interface A {} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0018.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0018.tree.json new file mode 100644 index 0000000..1e9a4f3 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0018.tree.json @@ -0,0 +1,75 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "body":[ + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":38}}, + "range":[0,38], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":35}}, + "range":[11,35], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "range":[12,13], + "name":"S", + "bound":null, + "variance":null, + "default":null + }, + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":34}}, + "range":[15,34], + "name":"T", + "bound":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":25}}, + "range":[16,25], + "typeAnnotation":{ + "type":"NullableTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":25}}, + "range":[18,25], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":25}}, + "range":[19,25] + } + } + }, + "variance":null, + "default":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":34}}, + "range":[28,34] + } + } + ] + }, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":38}}, + "range":[36,38], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0019.js b/lib/test/flow/types/parameter_defaults/migrated_0019.js new file mode 100644 index 0000000..bc9df2f --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0019.js @@ -0,0 +1 @@ +interface A {} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0019.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0019.tree.json new file mode 100644 index 0000000..6767c8b --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0019.tree.json @@ -0,0 +1,79 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "range":[0,47], + "body":[ + { + "type":"InterfaceDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "range":[0,47], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "range":[10,11], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":44}}, + "range":[11,44], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":22}}, + "range":[12,22], + "name":"S", + "bound":null, + "variance":null, + "default":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":22}}, + "range":[16,22] + } + }, + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":43}}, + "range":[24,43], + "name":"T", + "bound":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":34}}, + "range":[25,34], + "typeAnnotation":{ + "type":"NullableTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":34}}, + "range":[27,34], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":34}}, + "range":[28,34] + } + } + }, + "variance":null, + "default":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":43}}, + "range":[37,43] + } + } + ] + }, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":45},"end":{"line":1,"column":47}}, + "range":[45,47], + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0020.js b/lib/test/flow/types/parameter_defaults/migrated_0020.js new file mode 100644 index 0000000..5044597 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0020.js @@ -0,0 +1 @@ +var x: Foo<> diff --git a/lib/test/flow/types/parameter_defaults/migrated_0020.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0020.tree.json new file mode 100644 index 0000000..05e7697 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0020.tree.json @@ -0,0 +1,53 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, + "range":[4,12], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, + "range":[4,12], + "name":"x", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, + "range":[5,12], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, + "range":[7,12], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, + "range":[7,10], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, + "range":[10,12], + "params":[] + } + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0021.js b/lib/test/flow/types/parameter_defaults/migrated_0021.js new file mode 100644 index 0000000..db9081a --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0021.js @@ -0,0 +1 @@ +class A extends B<> {} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0021.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0021.tree.json new file mode 100644 index 0000000..451d463 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0021.tree.json @@ -0,0 +1,44 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "range":[20,22], + "body":[] + }, + "superClass":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "range":[16,17], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "superTypeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":19}}, + "range":[17,19], + "params":[] + }, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0022.js b/lib/test/flow/types/parameter_defaults/migrated_0022.js new file mode 100644 index 0000000..86f5a8f --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0022.js @@ -0,0 +1 @@ +type A = T diff --git a/lib/test/flow/types/parameter_defaults/migrated_0022.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0022.tree.json new file mode 100644 index 0000000..95cf45a --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0022.tree.json @@ -0,0 +1,82 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "message":"Unexpected token `:`, expected the token `,`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "message":"Unexpected token `?`, expected an identifier" + }, + { + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "message":"Type parameter declaration needs a default, since a preceding type parameter declaration has a default." + }, + { + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "message":"Unexpected token `string`, expected the token `,`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":28}}, + "range":[6,28], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":17}}, + "range":[7,17], + "name":"T", + "bound":null, + "variance":null, + "default":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":17}}, + "range":[11,17] + } + }, + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "name":"", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "right":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":32}}, + "range":[31,32], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":32}}, + "range":[31,32], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0023.js b/lib/test/flow/types/parameter_defaults/migrated_0023.js new file mode 100644 index 0000000..d437a04 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0023.js @@ -0,0 +1 @@ +type A = T diff --git a/lib/test/flow/types/parameter_defaults/migrated_0023.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0023.tree.json new file mode 100644 index 0000000..bbe9d2f --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0023.tree.json @@ -0,0 +1,70 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":37}}, + "message":"Type parameter declaration needs a default, since a preceding type parameter declaration has a default." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "range":[0,42], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":42}}, + "range":[0,42], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":38}}, + "range":[6,38], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":26}}, + "range":[7,26], + "name":"HasDefault", + "bound":null, + "variance":null, + "default":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":26}}, + "range":[20,26] + } + }, + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":37}}, + "range":[28,37], + "name":"NoDefault", + "bound":null, + "variance":null, + "default":null + } + ] + }, + "right":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":42}}, + "range":[41,42], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":41},"end":{"line":1,"column":42}}, + "range":[41,42], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0024.js b/lib/test/flow/types/parameter_defaults/migrated_0024.js new file mode 100644 index 0000000..2b40a1b --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0024.js @@ -0,0 +1 @@ +class A extends B {} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0024.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0024.tree.json new file mode 100644 index 0000000..cd6392c --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0024.tree.json @@ -0,0 +1,70 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "message":"Unexpected token `=`, expected the token `,`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":30},"end":{"line":1,"column":32}}, + "range":[30,32], + "body":[] + }, + "typeParameters":null, + "superClass":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, + "range":[16,17], + "name":"B", + "typeAnnotation":null, + "optional":false + }, + "superTypeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":29}}, + "range":[17,29], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, + "range":[18,19], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + { + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":28}}, + "range":[22,28] + } + ] + }, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0025.js b/lib/test/flow/types/parameter_defaults/migrated_0025.js new file mode 100644 index 0000000..646522d --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0025.js @@ -0,0 +1 @@ +var x: Array diff --git a/lib/test/flow/types/parameter_defaults/migrated_0025.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0025.tree.json new file mode 100644 index 0000000..b892d63 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0025.tree.json @@ -0,0 +1,79 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "message":"Unexpected token `=`, expected the token `,`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":24}}, + "range":[4,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":24}}, + "range":[4,24], + "name":"x", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":24}}, + "range":[5,24], + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":24}}, + "range":[7,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, + "range":[7,12], + "name":"Array", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":24}}, + "range":[12,24], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + { + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":23}}, + "range":[17,23] + } + ] + } + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0026.js b/lib/test/flow/types/parameter_defaults/migrated_0026.js new file mode 100644 index 0000000..3223246 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0026.js @@ -0,0 +1 @@ +function foo() {} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0026.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0026.tree.json new file mode 100644 index 0000000..5f42722 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0026.tree.json @@ -0,0 +1,53 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "range":[0,29], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, + "range":[27,29], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":24}}, + "range":[12,24], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":23}}, + "range":[13,23], + "name":"T", + "bound":null, + "variance":null, + "default":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":23}}, + "range":[17,23] + } + } + ] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0027.js b/lib/test/flow/types/parameter_defaults/migrated_0027.js new file mode 100644 index 0000000..018ada1 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0027.js @@ -0,0 +1 @@ +declare function foo() {} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0027.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0027.tree.json new file mode 100644 index 0000000..2ee1c75 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0027.tree.json @@ -0,0 +1,81 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":36}}, + "message":"Unexpected token `{`, expected the token `:`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":37}}, + "message":"Unexpected token `}`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":37}}, + "message":"Unexpected token `}`, expected the start of a statement" + }, + { + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "message":"Unexpected end of input, expected the start of a statement" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":2,"column":0}}, + "range":[0,38], + "body":[ + { + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, + "range":[0,36], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":37}}, + "range":[17,37], + "name":"foo", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":37}}, + "range":[20,37], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":37}}, + "range":[20,37], + "params":[], + "returnType":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":37}}, + "range":[36,37] + }, + "rest":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":32}}, + "range":[20,32], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":31}}, + "range":[21,31], + "name":"T", + "bound":null, + "variance":null, + "default":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":31}}, + "range":[25,31] + } + } + ] + } + } + }, + "optional":false + }, + "predicate":null + }, + { + "type":"EmptyStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":0}}, + "range":[38,38] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0028.js b/lib/test/flow/types/parameter_defaults/migrated_0028.js new file mode 100644 index 0000000..4f7aff2 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0028.js @@ -0,0 +1 @@ +({ foo() {} }) diff --git a/lib/test/flow/types/parameter_defaults/migrated_0028.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0028.tree.json new file mode 100644 index 0000000..373e67a --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0028.tree.json @@ -0,0 +1,76 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "expression":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":25}}, + "range":[1,25], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":23}}, + "range":[3,23], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":3},"end":{"line":1,"column":6}}, + "range":[3,6], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":23}}, + "range":[6,23], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, + "range":[21,23], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":18}}, + "range":[6,18], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":17}}, + "range":[7,17], + "name":"T", + "bound":null, + "variance":null, + "default":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":17}}, + "range":[11,17] + } + } + ] + } + }, + "kind":"init", + "method":true, + "shorthand":false, + "computed":false + } + ] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0029.js b/lib/test/flow/types/parameter_defaults/migrated_0029.js new file mode 100644 index 0000000..d96ea24 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0029.js @@ -0,0 +1 @@ +class A { foo() {} } diff --git a/lib/test/flow/types/parameter_defaults/migrated_0029.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0029.tree.json new file mode 100644 index 0000000..68e5570 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0029.tree.json @@ -0,0 +1,88 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "body":[ + { + "type":"ClassDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, + "range":[6,7], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":32}}, + "range":[8,32], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":30}}, + "range":[10,30], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, + "range":[10,13], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":30}}, + "range":[13,30], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, + "range":[28,30], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":25}}, + "range":[13,25], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":24}}, + "range":[14,24], + "name":"T", + "bound":null, + "variance":null, + "default":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":24}}, + "range":[18,24] + } + } + ] + } + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0030.js b/lib/test/flow/types/parameter_defaults/migrated_0030.js new file mode 100644 index 0000000..5839f8e --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0030.js @@ -0,0 +1 @@ +(class A { foo() {} }) diff --git a/lib/test/flow/types/parameter_defaults/migrated_0030.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0030.tree.json new file mode 100644 index 0000000..2acfbcc --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0030.tree.json @@ -0,0 +1,94 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "range":[0,34], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "range":[0,34], + "expression":{ + "type":"ClassExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":33}}, + "range":[1,33], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "range":[7,8], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ClassBody", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":33}}, + "range":[9,33], + "body":[ + { + "type":"MethodDefinition", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":31}}, + "range":[11,31], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "range":[11,14], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":31}}, + "range":[14,31], + "id":null, + "params":[], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, + "range":[29,31], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":26}}, + "range":[14,26], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":25}}, + "range":[15,25], + "name":"T", + "bound":null, + "variance":null, + "default":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":25}}, + "range":[19,25] + } + } + ] + } + }, + "kind":"method", + "static":false, + "computed":false, + "decorators":[] + } + ] + }, + "typeParameters":null, + "superClass":null, + "superTypeParameters":null, + "implements":[], + "decorators":[] + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0031.js b/lib/test/flow/types/parameter_defaults/migrated_0031.js new file mode 100644 index 0000000..742685c --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0031.js @@ -0,0 +1 @@ +declare class A { foo(): void } diff --git a/lib/test/flow/types/parameter_defaults/migrated_0031.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0031.tree.json new file mode 100644 index 0000000..3d268c6 --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0031.tree.json @@ -0,0 +1,87 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "range":[0,43], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "range":[0,43], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":43}}, + "range":[16,43], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":41}}, + "range":[18,41], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, + "range":[18,21], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":41}}, + "range":[18,41], + "params":[], + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":41}}, + "range":[37,41] + }, + "rest":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":33}}, + "range":[21,33], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":32}}, + "range":[22,32], + "name":"T", + "bound":null, + "variance":null, + "default":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":32}}, + "range":[26,32] + } + } + ] + } + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/parameter_defaults/migrated_0032.js b/lib/test/flow/types/parameter_defaults/migrated_0032.js new file mode 100644 index 0000000..a32fe3f --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0032.js @@ -0,0 +1 @@ +() => 123 diff --git a/lib/test/flow/types/parameter_defaults/migrated_0032.tree.json b/lib/test/flow/types/parameter_defaults/migrated_0032.tree.json new file mode 100644 index 0000000..cda84de --- /dev/null +++ b/lib/test/flow/types/parameter_defaults/migrated_0032.tree.json @@ -0,0 +1,53 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "expression":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "range":[0,21], + "id":null, + "params":[], + "body":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, + "range":[18,21], + "value":123, + "raw":"123" + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":null, + "typeParameters":{ + "type":"TypeParameterDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "params":[ + { + "type":"TypeParameter", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":11}}, + "range":[1,11], + "name":"T", + "bound":null, + "variance":null, + "default":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":11}}, + "range":[5,11] + } + } + ] + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/reserved/reserved.js b/lib/test/flow/types/reserved/reserved.js new file mode 100644 index 0000000..0bd9c5c --- /dev/null +++ b/lib/test/flow/types/reserved/reserved.js @@ -0,0 +1,11 @@ +let y: extends = 123; // Should not parse + +import {type interface} from 'foo'; // Should not parse +import {type extends} from 'foo'; // Should not parse +import type {interface} from 'foo'; // Should not parse +import type {extends} from 'foo'; // Should not parse + +import {type interface as a} from 'foo'; // Should parse +import {type extends as b} from 'foo'; // Should parse +import type {interface as a} from 'foo'; // Should parse +import type {extends as b} from 'foo'; // Should parse diff --git a/lib/test/flow/types/reserved/reserved.tree.json b/lib/test/flow/types/reserved/reserved.tree.json new file mode 100644 index 0000000..d7936f4 --- /dev/null +++ b/lib/test/flow/types/reserved/reserved.tree.json @@ -0,0 +1,454 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":14}}, + "message":"Unexpected token `extends`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":14}}, + "message":"Unexpected token `extends`, expected the token `;`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":14}}, + "message":"Unexpected token `extends`, expected the start of a statement" + }, + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "message":"Unexpected token `=`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "message":"Invalid left-hand side in assignment" + }, + { + "loc":{"source":null,"start":{"line":3,"column":13},"end":{"line":3,"column":22}}, + "message":"Unexpected reserved type" + }, + { + "loc":{"source":null,"start":{"line":4,"column":13},"end":{"line":4,"column":20}}, + "message":"Unexpected reserved type" + }, + { + "loc":{"source":null,"start":{"line":5,"column":13},"end":{"line":5,"column":22}}, + "message":"Unexpected reserved type" + }, + { + "loc":{"source":null,"start":{"line":6,"column":13},"end":{"line":6,"column":20}}, + "message":"Unexpected reserved type" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":11,"column":38}}, + "range":[0,471], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "range":[0,6], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, + "range":[4,6], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, + "range":[4,6], + "name":"y", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":14}}, + "range":[7,14] + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"let" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":21}}, + "range":[15,21], + "expression":{ + "type":"AssignmentExpression", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "range":[15,20], + "operator":"=", + "left":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "range":[15,16], + "value":null, + "raw":"null" + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":20}}, + "range":[17,20], + "value":123, + "raw":"123" + } + }, + "directive":null + }, + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":35}}, + "range":[43,78], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":3,"column":13},"end":{"line":3,"column":22}}, + "range":[56,65], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":13},"end":{"line":3,"column":22}}, + "range":[56,65], + "name":"interface", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":3,"column":13},"end":{"line":3,"column":22}}, + "range":[56,65], + "name":"interface", + "typeAnnotation":null, + "optional":false + }, + "importKind":"type" + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":3,"column":29},"end":{"line":3,"column":34}}, + "range":[72,77], + "value":"foo", + "raw":"'foo'" + }, + "importKind":"value" + }, + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":4,"column":0},"end":{"line":4,"column":33}}, + "range":[99,132], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":4,"column":13},"end":{"line":4,"column":20}}, + "range":[112,119], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":13},"end":{"line":4,"column":20}}, + "range":[112,119], + "name":"extends", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":4,"column":13},"end":{"line":4,"column":20}}, + "range":[112,119], + "name":"extends", + "typeAnnotation":null, + "optional":false + }, + "importKind":"type" + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":4,"column":27},"end":{"line":4,"column":32}}, + "range":[126,131], + "value":"foo", + "raw":"'foo'" + }, + "importKind":"value" + }, + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":5,"column":0},"end":{"line":5,"column":35}}, + "range":[153,188], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":5,"column":13},"end":{"line":5,"column":22}}, + "range":[166,175], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":13},"end":{"line":5,"column":22}}, + "range":[166,175], + "name":"interface", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":5,"column":13},"end":{"line":5,"column":22}}, + "range":[166,175], + "name":"interface", + "typeAnnotation":null, + "optional":false + }, + "importKind":null + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":5,"column":29},"end":{"line":5,"column":34}}, + "range":[182,187], + "value":"foo", + "raw":"'foo'" + }, + "importKind":"type" + }, + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":6,"column":0},"end":{"line":6,"column":33}}, + "range":[209,242], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":6,"column":13},"end":{"line":6,"column":20}}, + "range":[222,229], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":13},"end":{"line":6,"column":20}}, + "range":[222,229], + "name":"extends", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":6,"column":13},"end":{"line":6,"column":20}}, + "range":[222,229], + "name":"extends", + "typeAnnotation":null, + "optional":false + }, + "importKind":null + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":6,"column":27},"end":{"line":6,"column":32}}, + "range":[236,241], + "value":"foo", + "raw":"'foo'" + }, + "importKind":"type" + }, + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":8,"column":0},"end":{"line":8,"column":40}}, + "range":[264,304], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":8,"column":13},"end":{"line":8,"column":27}}, + "range":[277,291], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":8,"column":13},"end":{"line":8,"column":22}}, + "range":[277,286], + "name":"interface", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":8,"column":26},"end":{"line":8,"column":27}}, + "range":[290,291], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "importKind":"type" + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":8,"column":34},"end":{"line":8,"column":39}}, + "range":[298,303], + "value":"foo", + "raw":"'foo'" + }, + "importKind":"value" + }, + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":9,"column":0},"end":{"line":9,"column":38}}, + "range":[321,359], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":9,"column":13},"end":{"line":9,"column":25}}, + "range":[334,346], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":13},"end":{"line":9,"column":20}}, + "range":[334,341], + "name":"extends", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":9,"column":24},"end":{"line":9,"column":25}}, + "range":[345,346], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "importKind":"type" + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":9,"column":32},"end":{"line":9,"column":37}}, + "range":[353,358], + "value":"foo", + "raw":"'foo'" + }, + "importKind":"value" + }, + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":10,"column":0},"end":{"line":10,"column":40}}, + "range":[376,416], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":10,"column":13},"end":{"line":10,"column":27}}, + "range":[389,403], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":10,"column":13},"end":{"line":10,"column":22}}, + "range":[389,398], + "name":"interface", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":10,"column":26},"end":{"line":10,"column":27}}, + "range":[402,403], + "name":"a", + "typeAnnotation":null, + "optional":false + }, + "importKind":null + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":10,"column":34},"end":{"line":10,"column":39}}, + "range":[410,415], + "value":"foo", + "raw":"'foo'" + }, + "importKind":"type" + }, + { + "type":"ImportDeclaration", + "loc":{"source":null,"start":{"line":11,"column":0},"end":{"line":11,"column":38}}, + "range":[433,471], + "specifiers":[ + { + "type":"ImportSpecifier", + "loc":{"source":null,"start":{"line":11,"column":13},"end":{"line":11,"column":25}}, + "range":[446,458], + "imported":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":11,"column":13},"end":{"line":11,"column":20}}, + "range":[446,453], + "name":"extends", + "typeAnnotation":null, + "optional":false + }, + "local":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":11,"column":24},"end":{"line":11,"column":25}}, + "range":[457,458], + "name":"b", + "typeAnnotation":null, + "optional":false + }, + "importKind":null + } + ], + "source":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":11,"column":32},"end":{"line":11,"column":37}}, + "range":[465,470], + "value":"foo", + "raw":"'foo'" + }, + "importKind":"type" + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":41}}, + "range":[22,41], + "value":" Should not parse" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":3,"column":36},"end":{"line":3,"column":55}}, + "range":[79,98], + "value":" Should not parse" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":4,"column":34},"end":{"line":4,"column":53}}, + "range":[133,152], + "value":" Should not parse" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":5,"column":36},"end":{"line":5,"column":55}}, + "range":[189,208], + "value":" Should not parse" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":6,"column":34},"end":{"line":6,"column":53}}, + "range":[243,262], + "value":" Should not parse" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":8,"column":41},"end":{"line":8,"column":56}}, + "range":[305,320], + "value":" Should parse" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":9,"column":39},"end":{"line":9,"column":54}}, + "range":[360,375], + "value":" Should parse" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":10,"column":41},"end":{"line":10,"column":56}}, + "range":[417,432], + "value":" Should parse" + }, + { + "type":"Line", + "loc":{"source":null,"start":{"line":11,"column":39},"end":{"line":11,"column":54}}, + "range":[472,487], + "value":" Should parse" + } + ] +} diff --git a/lib/test/flow/types/string_literal/migrated_0000.js b/lib/test/flow/types/string_literal/migrated_0000.js new file mode 100644 index 0000000..7ecd6d3 --- /dev/null +++ b/lib/test/flow/types/string_literal/migrated_0000.js @@ -0,0 +1 @@ +var a: "duck" diff --git a/lib/test/flow/types/string_literal/migrated_0000.tree.json b/lib/test/flow/types/string_literal/migrated_0000.tree.json new file mode 100644 index 0000000..9986da7 --- /dev/null +++ b/lib/test/flow/types/string_literal/migrated_0000.tree.json @@ -0,0 +1,41 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, + "range":[4,13], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, + "range":[4,13], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":13}}, + "range":[5,13], + "typeAnnotation":{ + "type":"StringLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, + "range":[7,13], + "value":"duck", + "raw":"\"duck\"" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/string_literal/migrated_0001.js b/lib/test/flow/types/string_literal/migrated_0001.js new file mode 100644 index 0000000..cd1fd2f --- /dev/null +++ b/lib/test/flow/types/string_literal/migrated_0001.js @@ -0,0 +1 @@ +var a: 'duck' diff --git a/lib/test/flow/types/string_literal/migrated_0001.tree.json b/lib/test/flow/types/string_literal/migrated_0001.tree.json new file mode 100644 index 0000000..b9e1619 --- /dev/null +++ b/lib/test/flow/types/string_literal/migrated_0001.tree.json @@ -0,0 +1,41 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, + "range":[4,13], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, + "range":[4,13], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":13}}, + "range":[5,13], + "typeAnnotation":{ + "type":"StringLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, + "range":[7,13], + "value":"duck", + "raw":"'duck'" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/string_literal/migrated_0002.js b/lib/test/flow/types/string_literal/migrated_0002.js new file mode 100644 index 0000000..ff68fdf --- /dev/null +++ b/lib/test/flow/types/string_literal/migrated_0002.js @@ -0,0 +1 @@ +var a: "foo bar" diff --git a/lib/test/flow/types/string_literal/migrated_0002.tree.json b/lib/test/flow/types/string_literal/migrated_0002.tree.json new file mode 100644 index 0000000..368c478 --- /dev/null +++ b/lib/test/flow/types/string_literal/migrated_0002.tree.json @@ -0,0 +1,41 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, + "range":[4,16], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, + "range":[4,16], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":16}}, + "range":[5,16], + "typeAnnotation":{ + "type":"StringLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":16}}, + "range":[7,16], + "value":"foo bar", + "raw":"\"foo bar\"" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/string_literal_invalid/migrated_0000.js b/lib/test/flow/types/string_literal_invalid/migrated_0000.js new file mode 100644 index 0000000..0332a9f --- /dev/null +++ b/lib/test/flow/types/string_literal_invalid/migrated_0000.js @@ -0,0 +1 @@ +var a: "\01" diff --git a/lib/test/flow/types/string_literal_invalid/migrated_0000.tree.json b/lib/test/flow/types/string_literal_invalid/migrated_0000.tree.json new file mode 100644 index 0000000..cf84caf --- /dev/null +++ b/lib/test/flow/types/string_literal_invalid/migrated_0000.tree.json @@ -0,0 +1,47 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, + "message":"Octal literals are not allowed in strict mode." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "range":[0,12], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, + "range":[4,12], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, + "range":[4,12], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, + "range":[5,12], + "typeAnnotation":{ + "type":"StringLiteralTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":12}}, + "range":[7,12], + "value":"\u0001", + "raw":"\"\\01\"" + } + }, + "optional":false + }, + "init":null + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/this_constraints/declare_class_getter.js b/lib/test/flow/types/this_constraints/declare_class_getter.js new file mode 100644 index 0000000..9df2f04 --- /dev/null +++ b/lib/test/flow/types/this_constraints/declare_class_getter.js @@ -0,0 +1,3 @@ +declare class A { + get prop(this: {...}): string; +} diff --git a/lib/test/flow/types/this_constraints/declare_class_getter.tree.json b/lib/test/flow/types/this_constraints/declare_class_getter.tree.json new file mode 100644 index 0000000..46de40e --- /dev/null +++ b/lib/test/flow/types/this_constraints/declare_class_getter.tree.json @@ -0,0 +1,92 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":10}}, + "message":"A getter cannot have a `this` parameter." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,52], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,52], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":3,"column":1}}, + "range":[16,52], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":31}}, + "range":[20,49], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":10}}, + "range":[24,28], + "name":"prop", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":31}}, + "range":[20,49], + "params":[], + "this":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":22}}, + "range":[29,40], + "name":null, + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":22}}, + "range":[35,40], + "inexact":true, + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "optional":false + }, + "returnType":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":25},"end":{"line":2,"column":31}}, + "range":[43,49] + }, + "rest":null, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"get" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/this_constraints/declare_class_method_0.js b/lib/test/flow/types/this_constraints/declare_class_method_0.js new file mode 100644 index 0000000..99eb37b --- /dev/null +++ b/lib/test/flow/types/this_constraints/declare_class_method_0.js @@ -0,0 +1,3 @@ +declare class A { + fn(this: {...}): void; +} diff --git a/lib/test/flow/types/this_constraints/declare_class_method_0.tree.json b/lib/test/flow/types/this_constraints/declare_class_method_0.tree.json new file mode 100644 index 0000000..6d39d21 --- /dev/null +++ b/lib/test/flow/types/this_constraints/declare_class_method_0.tree.json @@ -0,0 +1,86 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,44], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,44], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":3,"column":1}}, + "range":[16,44], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":23}}, + "range":[20,41], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "range":[20,22], + "name":"fn", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":23}}, + "range":[20,41], + "params":[], + "this":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":16}}, + "range":[23,34], + "name":null, + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":16}}, + "range":[29,34], + "inexact":true, + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "optional":false + }, + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":23}}, + "range":[37,41] + }, + "rest":null, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/this_constraints/declare_class_method_1.js b/lib/test/flow/types/this_constraints/declare_class_method_1.js new file mode 100644 index 0000000..39b657c --- /dev/null +++ b/lib/test/flow/types/this_constraints/declare_class_method_1.js @@ -0,0 +1,3 @@ +declare class A { + fn(this: {...}, x: number): void; +} diff --git a/lib/test/flow/types/this_constraints/declare_class_method_1.tree.json b/lib/test/flow/types/this_constraints/declare_class_method_1.tree.json new file mode 100644 index 0000000..2777e30 --- /dev/null +++ b/lib/test/flow/types/this_constraints/declare_class_method_1.tree.json @@ -0,0 +1,106 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,55], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,55], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":3,"column":1}}, + "range":[16,55], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":34}}, + "range":[20,52], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "range":[20,22], + "name":"fn", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":34}}, + "range":[20,52], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":2,"column":18},"end":{"line":2,"column":27}}, + "range":[36,45], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":18},"end":{"line":2,"column":19}}, + "range":[36,37], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":21},"end":{"line":2,"column":27}}, + "range":[39,45] + }, + "optional":false + } + ], + "this":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":16}}, + "range":[23,34], + "name":null, + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":16}}, + "range":[29,34], + "inexact":true, + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "optional":false + }, + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":30},"end":{"line":2,"column":34}}, + "range":[48,52] + }, + "rest":null, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/this_constraints/declare_class_method_2.js b/lib/test/flow/types/this_constraints/declare_class_method_2.js new file mode 100644 index 0000000..b64e9e6 --- /dev/null +++ b/lib/test/flow/types/this_constraints/declare_class_method_2.js @@ -0,0 +1,3 @@ +declare class A { + fn(this: {...}, x: number, y: string): void; +} diff --git a/lib/test/flow/types/this_constraints/declare_class_method_2.tree.json b/lib/test/flow/types/this_constraints/declare_class_method_2.tree.json new file mode 100644 index 0000000..cac8beb --- /dev/null +++ b/lib/test/flow/types/this_constraints/declare_class_method_2.tree.json @@ -0,0 +1,125 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,66], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,66], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":3,"column":1}}, + "range":[16,66], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":45}}, + "range":[20,63], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "range":[20,22], + "name":"fn", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":45}}, + "range":[20,63], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":2,"column":18},"end":{"line":2,"column":27}}, + "range":[36,45], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":18},"end":{"line":2,"column":19}}, + "range":[36,37], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":21},"end":{"line":2,"column":27}}, + "range":[39,45] + }, + "optional":false + }, + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":2,"column":29},"end":{"line":2,"column":38}}, + "range":[47,56], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":29},"end":{"line":2,"column":30}}, + "range":[47,48], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":32},"end":{"line":2,"column":38}}, + "range":[50,56] + }, + "optional":false + } + ], + "this":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":16}}, + "range":[23,34], + "name":null, + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":16}}, + "range":[29,34], + "inexact":true, + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "optional":false + }, + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":41},"end":{"line":2,"column":45}}, + "range":[59,63] + }, + "rest":null, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/this_constraints/declare_class_setter.js b/lib/test/flow/types/this_constraints/declare_class_setter.js new file mode 100644 index 0000000..1d45980 --- /dev/null +++ b/lib/test/flow/types/this_constraints/declare_class_setter.js @@ -0,0 +1,3 @@ +declare class A { + set prop(this: {...}, value: string): void; +} diff --git a/lib/test/flow/types/this_constraints/declare_class_setter.tree.json b/lib/test/flow/types/this_constraints/declare_class_setter.tree.json new file mode 100644 index 0000000..6dd69bc --- /dev/null +++ b/lib/test/flow/types/this_constraints/declare_class_setter.tree.json @@ -0,0 +1,112 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":10}}, + "message":"A setter cannot have a `this` parameter." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,65], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,65], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":3,"column":1}}, + "range":[16,65], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":44}}, + "range":[20,62], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":10}}, + "range":[24,28], + "name":"prop", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":44}}, + "range":[20,62], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":2,"column":24},"end":{"line":2,"column":37}}, + "range":[42,55], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":24},"end":{"line":2,"column":29}}, + "range":[42,47], + "name":"value", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":31},"end":{"line":2,"column":37}}, + "range":[49,55] + }, + "optional":false + } + ], + "this":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":22}}, + "range":[29,40], + "name":null, + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":22}}, + "range":[35,40], + "inexact":true, + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "optional":false + }, + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":40},"end":{"line":2,"column":44}}, + "range":[58,62] + }, + "rest":null, + "typeParameters":null + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"set" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/this_constraints/declare_function_0.js b/lib/test/flow/types/this_constraints/declare_function_0.js new file mode 100644 index 0000000..b2ed7d3 --- /dev/null +++ b/lib/test/flow/types/this_constraints/declare_function_0.js @@ -0,0 +1 @@ +declare function fn(this: {...}): void; diff --git a/lib/test/flow/types/this_constraints/declare_function_0.tree.json b/lib/test/flow/types/this_constraints/declare_function_0.tree.json new file mode 100644 index 0000000..0cbb4f3 --- /dev/null +++ b/lib/test/flow/types/this_constraints/declare_function_0.tree.json @@ -0,0 +1,57 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "range":[0,39], + "body":[ + { + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "range":[0,39], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":38}}, + "range":[17,38], + "name":"fn", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":38}}, + "range":[19,38], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":38}}, + "range":[19,38], + "params":[], + "this":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":31}}, + "range":[20,31], + "name":null, + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":31}}, + "range":[26,31], + "inexact":true, + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "optional":false + }, + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":34},"end":{"line":1,"column":38}}, + "range":[34,38] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/this_constraints/declare_function_1.js b/lib/test/flow/types/this_constraints/declare_function_1.js new file mode 100644 index 0000000..021b53e --- /dev/null +++ b/lib/test/flow/types/this_constraints/declare_function_1.js @@ -0,0 +1 @@ +declare function fn(this: {...}, x: number): void; diff --git a/lib/test/flow/types/this_constraints/declare_function_1.tree.json b/lib/test/flow/types/this_constraints/declare_function_1.tree.json new file mode 100644 index 0000000..086a587 --- /dev/null +++ b/lib/test/flow/types/this_constraints/declare_function_1.tree.json @@ -0,0 +1,77 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "range":[0,50], + "body":[ + { + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "range":[0,50], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":49}}, + "range":[17,49], + "name":"fn", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":49}}, + "range":[19,49], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":49}}, + "range":[19,49], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":42}}, + "range":[33,42], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":34}}, + "range":[33,34], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":42}}, + "range":[36,42] + }, + "optional":false + } + ], + "this":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":31}}, + "range":[20,31], + "name":null, + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":31}}, + "range":[26,31], + "inexact":true, + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "optional":false + }, + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":45},"end":{"line":1,"column":49}}, + "range":[45,49] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/this_constraints/declare_function_2.js b/lib/test/flow/types/this_constraints/declare_function_2.js new file mode 100644 index 0000000..9ca1465 --- /dev/null +++ b/lib/test/flow/types/this_constraints/declare_function_2.js @@ -0,0 +1 @@ +declare function fn(this: {...}, x: number, y: string): void; diff --git a/lib/test/flow/types/this_constraints/declare_function_2.tree.json b/lib/test/flow/types/this_constraints/declare_function_2.tree.json new file mode 100644 index 0000000..a5b93d8 --- /dev/null +++ b/lib/test/flow/types/this_constraints/declare_function_2.tree.json @@ -0,0 +1,96 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":61}}, + "range":[0,61], + "body":[ + { + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":61}}, + "range":[0,61], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":60}}, + "range":[17,60], + "name":"fn", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":60}}, + "range":[19,60], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":60}}, + "range":[19,60], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":42}}, + "range":[33,42], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":34}}, + "range":[33,34], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":36},"end":{"line":1,"column":42}}, + "range":[36,42] + }, + "optional":false + }, + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":44},"end":{"line":1,"column":53}}, + "range":[44,53], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":44},"end":{"line":1,"column":45}}, + "range":[44,45], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":47},"end":{"line":1,"column":53}}, + "range":[47,53] + }, + "optional":false + } + ], + "this":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":31}}, + "range":[20,31], + "name":null, + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":31}}, + "range":[26,31], + "inexact":true, + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "optional":false + }, + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":56},"end":{"line":1,"column":60}}, + "range":[56,60] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/this_constraints/error_not_first.js b/lib/test/flow/types/this_constraints/error_not_first.js new file mode 100644 index 0000000..0ace6be --- /dev/null +++ b/lib/test/flow/types/this_constraints/error_not_first.js @@ -0,0 +1 @@ +declare function fn(x: number, this: {...}): void; diff --git a/lib/test/flow/types/this_constraints/error_not_first.tree.json b/lib/test/flow/types/this_constraints/error_not_first.tree.json new file mode 100644 index 0000000..a944113 --- /dev/null +++ b/lib/test/flow/types/this_constraints/error_not_first.tree.json @@ -0,0 +1,83 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":35}}, + "message":"The `this` parameter must be the first function parameter." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "range":[0,50], + "body":[ + { + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "range":[0,50], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":49}}, + "range":[17,49], + "name":"fn", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":49}}, + "range":[19,49], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":49}}, + "range":[19,49], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":29}}, + "range":[20,29], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":21}}, + "range":[20,21], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":29}}, + "range":[23,29] + }, + "optional":false + } + ], + "this":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":31},"end":{"line":1,"column":42}}, + "range":[31,42], + "name":null, + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":42}}, + "range":[37,42], + "inexact":true, + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "optional":false + }, + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":45},"end":{"line":1,"column":49}}, + "range":[45,49] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/this_constraints/error_optional.js b/lib/test/flow/types/this_constraints/error_optional.js new file mode 100644 index 0000000..50439d3 --- /dev/null +++ b/lib/test/flow/types/this_constraints/error_optional.js @@ -0,0 +1 @@ +declare function fn(this?: {...}): void; diff --git a/lib/test/flow/types/this_constraints/error_optional.tree.json b/lib/test/flow/types/this_constraints/error_optional.tree.json new file mode 100644 index 0000000..329b338 --- /dev/null +++ b/lib/test/flow/types/this_constraints/error_optional.tree.json @@ -0,0 +1,88 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, + "message":"The `this` parameter cannot be optional." + }, + { + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, + "message":"Unexpected token `?`, expected the token `:`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, + "message":"Unexpected token `:`" + }, + { + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, + "message":"Unexpected token `:`, expected the token `,`" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "range":[0,40], + "body":[ + { + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "range":[0,40], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":39}}, + "range":[17,39], + "name":"fn", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":39}}, + "range":[19,39], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":39}}, + "range":[19,39], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":32}}, + "range":[27,32], + "name":null, + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":32}}, + "range":[27,32], + "inexact":true, + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "optional":false + } + ], + "this":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":25}}, + "range":[20,25], + "name":null, + "typeAnnotation":{ + "type":"AnyTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":25},"end":{"line":1,"column":26}}, + "range":[25,26] + }, + "optional":false + }, + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":39}}, + "range":[35,39] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/this_constraints/error_repeated.js b/lib/test/flow/types/this_constraints/error_repeated.js new file mode 100644 index 0000000..9a68e46 --- /dev/null +++ b/lib/test/flow/types/this_constraints/error_repeated.js @@ -0,0 +1 @@ +declare function fn(this: {...}, this: {...}): void; diff --git a/lib/test/flow/types/this_constraints/error_repeated.tree.json b/lib/test/flow/types/this_constraints/error_repeated.tree.json new file mode 100644 index 0000000..b72e023 --- /dev/null +++ b/lib/test/flow/types/this_constraints/error_repeated.tree.json @@ -0,0 +1,63 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":37}}, + "message":"The `this` parameter must be the first function parameter." + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, + "range":[0,52], + "body":[ + { + "type":"DeclareFunction", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":52}}, + "range":[0,52], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":51}}, + "range":[17,51], + "name":"fn", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":51}}, + "range":[19,51], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":51}}, + "range":[19,51], + "params":[], + "this":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":44}}, + "range":[33,44], + "name":null, + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":39},"end":{"line":1,"column":44}}, + "range":[39,44], + "inexact":true, + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "optional":false + }, + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":47},"end":{"line":1,"column":51}}, + "range":[47,51] + }, + "rest":null, + "typeParameters":null + } + }, + "optional":false + }, + "predicate":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/this_constraints/function_type_0.js b/lib/test/flow/types/this_constraints/function_type_0.js new file mode 100644 index 0000000..53c508b --- /dev/null +++ b/lib/test/flow/types/this_constraints/function_type_0.js @@ -0,0 +1 @@ +type Fn = (this: {...}) => void; diff --git a/lib/test/flow/types/this_constraints/function_type_0.tree.json b/lib/test/flow/types/this_constraints/function_type_0.tree.json new file mode 100644 index 0000000..bb5773f --- /dev/null +++ b/lib/test/flow/types/this_constraints/function_type_0.tree.json @@ -0,0 +1,53 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "range":[0,32], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, + "range":[5,7], + "name":"Fn", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":31}}, + "range":[10,31], + "params":[], + "this":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":22}}, + "range":[11,22], + "name":null, + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":22}}, + "range":[17,22], + "inexact":true, + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "optional":false + }, + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":31}}, + "range":[27,31] + }, + "rest":null, + "typeParameters":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/this_constraints/function_type_1.js b/lib/test/flow/types/this_constraints/function_type_1.js new file mode 100644 index 0000000..987c7bb --- /dev/null +++ b/lib/test/flow/types/this_constraints/function_type_1.js @@ -0,0 +1 @@ +type Fn = (this: {...}, x: string) => void; diff --git a/lib/test/flow/types/this_constraints/function_type_1.tree.json b/lib/test/flow/types/this_constraints/function_type_1.tree.json new file mode 100644 index 0000000..575626b --- /dev/null +++ b/lib/test/flow/types/this_constraints/function_type_1.tree.json @@ -0,0 +1,73 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "range":[0,43], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "range":[0,43], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, + "range":[5,7], + "name":"Fn", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":42}}, + "range":[10,42], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":33}}, + "range":[24,33], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, + "range":[24,25], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":33}}, + "range":[27,33] + }, + "optional":false + } + ], + "this":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":22}}, + "range":[11,22], + "name":null, + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":22}}, + "range":[17,22], + "inexact":true, + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "optional":false + }, + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":42}}, + "range":[38,42] + }, + "rest":null, + "typeParameters":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/this_constraints/function_type_2.js b/lib/test/flow/types/this_constraints/function_type_2.js new file mode 100644 index 0000000..aa91d5a --- /dev/null +++ b/lib/test/flow/types/this_constraints/function_type_2.js @@ -0,0 +1 @@ +type Fn = (this: {...}, x: string, y: number) => void; diff --git a/lib/test/flow/types/this_constraints/function_type_2.tree.json b/lib/test/flow/types/this_constraints/function_type_2.tree.json new file mode 100644 index 0000000..b62fc99 --- /dev/null +++ b/lib/test/flow/types/this_constraints/function_type_2.tree.json @@ -0,0 +1,92 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, + "range":[0,54], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":54}}, + "range":[0,54], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, + "range":[5,7], + "name":"Fn", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":53}}, + "range":[10,53], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":33}}, + "range":[24,33], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":25}}, + "range":[24,25], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":33}}, + "range":[27,33] + }, + "optional":false + }, + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":44}}, + "range":[35,44], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":35},"end":{"line":1,"column":36}}, + "range":[35,36], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":38},"end":{"line":1,"column":44}}, + "range":[38,44] + }, + "optional":false + } + ], + "this":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":22}}, + "range":[11,22], + "name":null, + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":22}}, + "range":[17,22], + "inexact":true, + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "optional":false + }, + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":49},"end":{"line":1,"column":53}}, + "range":[49,53] + }, + "rest":null, + "typeParameters":null + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/this_constraints/no_ambiguity_with_anonymous_this_0.js b/lib/test/flow/types/this_constraints/no_ambiguity_with_anonymous_this_0.js new file mode 100644 index 0000000..d519061 --- /dev/null +++ b/lib/test/flow/types/this_constraints/no_ambiguity_with_anonymous_this_0.js @@ -0,0 +1,3 @@ +declare class A { + fn(this): void; +} diff --git a/lib/test/flow/types/this_constraints/no_ambiguity_with_anonymous_this_0.tree.json b/lib/test/flow/types/this_constraints/no_ambiguity_with_anonymous_this_0.tree.json new file mode 100644 index 0000000..bff0c5c --- /dev/null +++ b/lib/test/flow/types/this_constraints/no_ambiguity_with_anonymous_this_0.tree.json @@ -0,0 +1,91 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,37], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,37], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":3,"column":1}}, + "range":[16,37], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "range":[20,34], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "range":[20,22], + "name":"fn", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "range":[20,34], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":9}}, + "range":[23,27], + "name":null, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":9}}, + "range":[23,27], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":9}}, + "range":[23,27], + "name":"this", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "optional":false + } + ], + "this":null, + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":16}}, + "range":[30,34] + }, + "rest":null, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/this_constraints/no_ambiguity_with_anonymous_this_1.js b/lib/test/flow/types/this_constraints/no_ambiguity_with_anonymous_this_1.js new file mode 100644 index 0000000..c56f524 --- /dev/null +++ b/lib/test/flow/types/this_constraints/no_ambiguity_with_anonymous_this_1.js @@ -0,0 +1,3 @@ +declare class A { + fn(this, string): void; +} diff --git a/lib/test/flow/types/this_constraints/no_ambiguity_with_anonymous_this_1.tree.json b/lib/test/flow/types/this_constraints/no_ambiguity_with_anonymous_this_1.tree.json new file mode 100644 index 0000000..d80feda --- /dev/null +++ b/lib/test/flow/types/this_constraints/no_ambiguity_with_anonymous_this_1.tree.json @@ -0,0 +1,103 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,45], + "body":[ + { + "type":"DeclareClass", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,45], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "range":[14,15], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "body":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":3,"column":1}}, + "range":[16,45], + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":24}}, + "range":[20,42], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "range":[20,22], + "name":"fn", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":24}}, + "range":[20,42], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":9}}, + "range":[23,27], + "name":null, + "typeAnnotation":{ + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":9}}, + "range":[23,27], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":9}}, + "range":[23,27], + "name":"this", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + }, + "optional":false + }, + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":17}}, + "range":[29,35], + "name":null, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":17}}, + "range":[29,35] + }, + "optional":false + } + ], + "this":null, + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":20},"end":{"line":2,"column":24}}, + "range":[38,42] + }, + "rest":null, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "extends":[], + "implements":[], + "mixins":[] + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/this_constraints/object_type_method_0.js b/lib/test/flow/types/this_constraints/object_type_method_0.js new file mode 100644 index 0000000..a1270fd --- /dev/null +++ b/lib/test/flow/types/this_constraints/object_type_method_0.js @@ -0,0 +1,3 @@ +type A = { + fn(this: {...}): void; +} diff --git a/lib/test/flow/types/this_constraints/object_type_method_0.tree.json b/lib/test/flow/types/this_constraints/object_type_method_0.tree.json new file mode 100644 index 0000000..fe08b69 --- /dev/null +++ b/lib/test/flow/types/this_constraints/object_type_method_0.tree.json @@ -0,0 +1,84 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,37], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,37], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":3,"column":1}}, + "range":[9,37], + "inexact":false, + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":23}}, + "range":[13,34], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "range":[13,15], + "name":"fn", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":23}}, + "range":[13,34], + "params":[], + "this":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":16}}, + "range":[16,27], + "name":null, + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":16}}, + "range":[22,27], + "inexact":true, + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "optional":false + }, + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":23}}, + "range":[30,34] + }, + "rest":null, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/this_constraints/object_type_method_1.js b/lib/test/flow/types/this_constraints/object_type_method_1.js new file mode 100644 index 0000000..320a844 --- /dev/null +++ b/lib/test/flow/types/this_constraints/object_type_method_1.js @@ -0,0 +1,3 @@ +type A = { + fn(this: {...}, x: string): void; +} diff --git a/lib/test/flow/types/this_constraints/object_type_method_1.tree.json b/lib/test/flow/types/this_constraints/object_type_method_1.tree.json new file mode 100644 index 0000000..2981dc5 --- /dev/null +++ b/lib/test/flow/types/this_constraints/object_type_method_1.tree.json @@ -0,0 +1,104 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,48], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,48], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":3,"column":1}}, + "range":[9,48], + "inexact":false, + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":34}}, + "range":[13,45], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "range":[13,15], + "name":"fn", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":34}}, + "range":[13,45], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":2,"column":18},"end":{"line":2,"column":27}}, + "range":[29,38], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":18},"end":{"line":2,"column":19}}, + "range":[29,30], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":21},"end":{"line":2,"column":27}}, + "range":[32,38] + }, + "optional":false + } + ], + "this":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":16}}, + "range":[16,27], + "name":null, + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":16}}, + "range":[22,27], + "inexact":true, + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "optional":false + }, + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":30},"end":{"line":2,"column":34}}, + "range":[41,45] + }, + "rest":null, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/this_constraints/object_type_method_2.js b/lib/test/flow/types/this_constraints/object_type_method_2.js new file mode 100644 index 0000000..a8d44a2 --- /dev/null +++ b/lib/test/flow/types/this_constraints/object_type_method_2.js @@ -0,0 +1,3 @@ +type A = { + fn(this: {...}, x: string, y: number): void; +} diff --git a/lib/test/flow/types/this_constraints/object_type_method_2.tree.json b/lib/test/flow/types/this_constraints/object_type_method_2.tree.json new file mode 100644 index 0000000..b046394 --- /dev/null +++ b/lib/test/flow/types/this_constraints/object_type_method_2.tree.json @@ -0,0 +1,123 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,59], + "body":[ + { + "type":"TypeAlias", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "range":[0,59], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, + "range":[5,6], + "name":"A", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null, + "right":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":3,"column":1}}, + "range":[9,59], + "inexact":false, + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":45}}, + "range":[13,56], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "range":[13,15], + "name":"fn", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":45}}, + "range":[13,56], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":2,"column":18},"end":{"line":2,"column":27}}, + "range":[29,38], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":18},"end":{"line":2,"column":19}}, + "range":[29,30], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":21},"end":{"line":2,"column":27}}, + "range":[32,38] + }, + "optional":false + }, + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":2,"column":29},"end":{"line":2,"column":38}}, + "range":[40,49], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":29},"end":{"line":2,"column":30}}, + "range":[40,41], + "name":"y", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":32},"end":{"line":2,"column":38}}, + "range":[43,49] + }, + "optional":false + } + ], + "this":{ + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":16}}, + "range":[16,27], + "name":null, + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":11},"end":{"line":2,"column":16}}, + "range":[22,27], + "inexact":true, + "exact":false, + "properties":[], + "indexers":[], + "callProperties":[], + "internalSlots":[] + }, + "optional":false + }, + "returnType":{ + "type":"VoidTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":41},"end":{"line":2,"column":45}}, + "range":[52,56] + }, + "rest":null, + "typeParameters":null + }, + "method":true, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/tuples/migrated_0000.js b/lib/test/flow/types/tuples/migrated_0000.js new file mode 100644 index 0000000..e72437e --- /dev/null +++ b/lib/test/flow/types/tuples/migrated_0000.js @@ -0,0 +1 @@ +var a : [] = []; diff --git a/lib/test/flow/types/tuples/migrated_0000.tree.json b/lib/test/flow/types/tuples/migrated_0000.tree.json new file mode 100644 index 0000000..54ccfee --- /dev/null +++ b/lib/test/flow/types/tuples/migrated_0000.tree.json @@ -0,0 +1,45 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "range":[0,16], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":15}}, + "range":[4,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":10}}, + "range":[4,10], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":10}}, + "range":[6,10], + "typeAnnotation":{ + "type":"TupleTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":10}}, + "range":[8,10], + "types":[] + } + }, + "optional":false + }, + "init":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, + "range":[13,15], + "elements":[] + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/tuples/migrated_0001.js b/lib/test/flow/types/tuples/migrated_0001.js new file mode 100644 index 0000000..2c8236e --- /dev/null +++ b/lib/test/flow/types/tuples/migrated_0001.js @@ -0,0 +1 @@ +var a : [Foo] = [foo]; diff --git a/lib/test/flow/types/tuples/migrated_0001.tree.json b/lib/test/flow/types/tuples/migrated_0001.tree.json new file mode 100644 index 0000000..8ec90b9 --- /dev/null +++ b/lib/test/flow/types/tuples/migrated_0001.tree.json @@ -0,0 +1,89 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "range":[0,25], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":24}}, + "range":[4,24], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":16}}, + "range":[4,16], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":16}}, + "range":[6,16], + "typeAnnotation":{ + "type":"TupleTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":16}}, + "range":[8,16], + "types":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "range":[9,15], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":12}}, + "range":[9,12], + "name":"Foo", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":{ + "type":"TypeParameterInstantiation", + "loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":15}}, + "range":[12,15], + "params":[ + { + "type":"GenericTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "range":[13,14], + "name":"T", + "typeAnnotation":null, + "optional":false + }, + "typeParameters":null + } + ] + } + } + ] + } + }, + "optional":false + }, + "init":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":24}}, + "range":[19,24], + "elements":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":23}}, + "range":[20,23], + "name":"foo", + "typeAnnotation":null, + "optional":false + } + ] + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/tuples/migrated_0002.js b/lib/test/flow/types/tuples/migrated_0002.js new file mode 100644 index 0000000..ad93e2b --- /dev/null +++ b/lib/test/flow/types/tuples/migrated_0002.js @@ -0,0 +1 @@ +var a : [number,] = [123,]; diff --git a/lib/test/flow/types/tuples/migrated_0002.tree.json b/lib/test/flow/types/tuples/migrated_0002.tree.json new file mode 100644 index 0000000..39cd7b4 --- /dev/null +++ b/lib/test/flow/types/tuples/migrated_0002.tree.json @@ -0,0 +1,59 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, + "range":[0,27], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":26}}, + "range":[4,26], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":17}}, + "range":[4,17], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":17}}, + "range":[6,17], + "typeAnnotation":{ + "type":"TupleTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":17}}, + "range":[8,17], + "types":[ + { + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "range":[9,15] + } + ] + } + }, + "optional":false + }, + "init":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":26}}, + "range":[20,26], + "elements":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":24}}, + "range":[21,24], + "value":123, + "raw":"123" + } + ] + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/tuples/migrated_0003.js b/lib/test/flow/types/tuples/migrated_0003.js new file mode 100644 index 0000000..3a3034a --- /dev/null +++ b/lib/test/flow/types/tuples/migrated_0003.js @@ -0,0 +1 @@ +var a : [number, string] = [123, "duck"]; diff --git a/lib/test/flow/types/tuples/migrated_0003.tree.json b/lib/test/flow/types/tuples/migrated_0003.tree.json new file mode 100644 index 0000000..e3fa94b --- /dev/null +++ b/lib/test/flow/types/tuples/migrated_0003.tree.json @@ -0,0 +1,71 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "range":[0,41], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":41}}, + "range":[0,41], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":40}}, + "range":[4,40], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":24}}, + "range":[4,24], + "name":"a", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":24}}, + "range":[6,24], + "typeAnnotation":{ + "type":"TupleTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":24}}, + "range":[8,24], + "types":[ + { + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "range":[9,15] + }, + { + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":23}}, + "range":[17,23] + } + ] + } + }, + "optional":false + }, + "init":{ + "type":"ArrayExpression", + "loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":40}}, + "range":[27,40], + "elements":[ + { + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":28},"end":{"line":1,"column":31}}, + "range":[28,31], + "value":123, + "raw":"123" + }, + { + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":33},"end":{"line":1,"column":39}}, + "range":[33,39], + "value":"duck", + "raw":"\"duck\"" + } + ] + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/typecasts/migrated_0000.js b/lib/test/flow/types/typecasts/migrated_0000.js new file mode 100644 index 0000000..47ddc92 --- /dev/null +++ b/lib/test/flow/types/typecasts/migrated_0000.js @@ -0,0 +1 @@ +(xxx: number) diff --git a/lib/test/flow/types/typecasts/migrated_0000.tree.json b/lib/test/flow/types/typecasts/migrated_0000.tree.json new file mode 100644 index 0000000..88f7af0 --- /dev/null +++ b/lib/test/flow/types/typecasts/migrated_0000.tree.json @@ -0,0 +1,37 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"TypeCastExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, + "range":[0,13], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, + "range":[1,4], + "name":"xxx", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":12}}, + "range":[4,12], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, + "range":[6,12] + } + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/typecasts/migrated_0001.js b/lib/test/flow/types/typecasts/migrated_0001.js new file mode 100644 index 0000000..f46b829 --- /dev/null +++ b/lib/test/flow/types/typecasts/migrated_0001.js @@ -0,0 +1 @@ +({xxx: 0, yyy: "hey"}: {xxx: number; yyy: string}) diff --git a/lib/test/flow/types/typecasts/migrated_0001.tree.json b/lib/test/flow/types/typecasts/migrated_0001.tree.json new file mode 100644 index 0000000..c11e815 --- /dev/null +++ b/lib/test/flow/types/typecasts/migrated_0001.tree.json @@ -0,0 +1,139 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "range":[0,50], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "range":[0,50], + "expression":{ + "type":"TypeCastExpression", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "range":[0,50], + "expression":{ + "type":"ObjectExpression", + "loc":{"source":null,"start":{"line":1,"column":1},"end":{"line":1,"column":21}}, + "range":[1,21], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":8}}, + "range":[2,8], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, + "range":[2,5], + "name":"xxx", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, + "range":[7,8], + "value":0, + "raw":"0" + }, + "kind":"init", + "method":false, + "shorthand":false, + "computed":false + }, + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":20}}, + "range":[10,20], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":13}}, + "range":[10,13], + "name":"yyy", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "range":[15,20], + "value":"hey", + "raw":"\"hey\"" + }, + "kind":"init", + "method":false, + "shorthand":false, + "computed":false + } + ] + }, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":49}}, + "range":[21,49], + "typeAnnotation":{ + "type":"ObjectTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":23},"end":{"line":1,"column":49}}, + "range":[23,49], + "inexact":false, + "exact":false, + "properties":[ + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":35}}, + "range":[24,35], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":27}}, + "range":[24,27], + "name":"xxx", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":29},"end":{"line":1,"column":35}}, + "range":[29,35] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + }, + { + "type":"ObjectTypeProperty", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":48}}, + "range":[37,48], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":37},"end":{"line":1,"column":40}}, + "range":[37,40], + "name":"yyy", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":1,"column":42},"end":{"line":1,"column":48}}, + "range":[42,48] + }, + "method":false, + "optional":false, + "static":false, + "proto":false, + "variance":null, + "kind":"init" + } + ], + "indexers":[], + "callProperties":[], + "internalSlots":[] + } + } + }, + "directive":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/types/typecasts/migrated_0002.js b/lib/test/flow/types/typecasts/migrated_0002.js new file mode 100644 index 0000000..2920f54 --- /dev/null +++ b/lib/test/flow/types/typecasts/migrated_0002.js @@ -0,0 +1,2 @@ +// distinguish between function type params and typecasts +((xxx) => xxx + 1: (xxx: number) => number) diff --git a/lib/test/flow/types/typecasts/migrated_0002.tree.json b/lib/test/flow/types/typecasts/migrated_0002.tree.json new file mode 100644 index 0000000..b607e55 --- /dev/null +++ b/lib/test/flow/types/typecasts/migrated_0002.tree.json @@ -0,0 +1,107 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":43}}, + "range":[58,101], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":43}}, + "range":[58,101], + "expression":{ + "type":"TypeCastExpression", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":43}}, + "range":[58,101], + "expression":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":2,"column":1},"end":{"line":2,"column":17}}, + "range":[59,75], + "id":null, + "params":[ + { + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "range":[60,63], + "name":"xxx", + "typeAnnotation":null, + "optional":false + } + ], + "body":{ + "type":"BinaryExpression", + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":17}}, + "range":[68,75], + "operator":"+", + "left":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":10},"end":{"line":2,"column":13}}, + "range":[68,71], + "name":"xxx", + "typeAnnotation":null, + "optional":false + }, + "right":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":17}}, + "range":[74,75], + "value":1, + "raw":"1" + } + }, + "async":false, + "generator":false, + "predicate":null, + "expression":true, + "returnType":null, + "typeParameters":null + }, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":42}}, + "range":[75,100], + "typeAnnotation":{ + "type":"FunctionTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":42}}, + "range":[77,100], + "params":[ + { + "type":"FunctionTypeParam", + "loc":{"source":null,"start":{"line":2,"column":20},"end":{"line":2,"column":31}}, + "range":[78,89], + "name":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":20},"end":{"line":2,"column":23}}, + "range":[78,81], + "name":"xxx", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":25},"end":{"line":2,"column":31}}, + "range":[83,89] + }, + "optional":false + } + ], + "returnType":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":36},"end":{"line":2,"column":42}}, + "range":[94,100] + }, + "rest":null, + "typeParameters":null + } + } + }, + "directive":null + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":57}}, + "range":[0,57], + "value":" distinguish between function type params and typecasts" + } + ] +} diff --git a/lib/test/flow/types/typecasts/migrated_0003.js b/lib/test/flow/types/typecasts/migrated_0003.js new file mode 100644 index 0000000..3456bf1 --- /dev/null +++ b/lib/test/flow/types/typecasts/migrated_0003.js @@ -0,0 +1,2 @@ +// parens disambiguate groups from casts +((xxx: number), (yyy: string)) diff --git a/lib/test/flow/types/typecasts/migrated_0003.tree.json b/lib/test/flow/types/typecasts/migrated_0003.tree.json new file mode 100644 index 0000000..7eded58 --- /dev/null +++ b/lib/test/flow/types/typecasts/migrated_0003.tree.json @@ -0,0 +1,74 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":30}}, + "range":[41,71], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":30}}, + "range":[41,71], + "expression":{ + "type":"SequenceExpression", + "loc":{"source":null,"start":{"line":2,"column":1},"end":{"line":2,"column":29}}, + "range":[42,70], + "expressions":[ + { + "type":"TypeCastExpression", + "loc":{"source":null,"start":{"line":2,"column":1},"end":{"line":2,"column":14}}, + "range":[42,55], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, + "range":[43,46], + "name":"xxx", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":13}}, + "range":[46,54], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":13}}, + "range":[48,54] + } + } + }, + { + "type":"TypeCastExpression", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":29}}, + "range":[57,70], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":20}}, + "range":[58,61], + "name":"yyy", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":20},"end":{"line":2,"column":28}}, + "range":[61,69], + "typeAnnotation":{ + "type":"StringTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":22},"end":{"line":2,"column":28}}, + "range":[63,69] + } + } + } + ] + }, + "directive":null + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "range":[0,40], + "value":" parens disambiguate groups from casts" + } + ] +} diff --git a/lib/test/flow/types/typecasts_invalid/migrated_0000.js b/lib/test/flow/types/typecasts_invalid/migrated_0000.js new file mode 100644 index 0000000..a48d5f9 --- /dev/null +++ b/lib/test/flow/types/typecasts_invalid/migrated_0000.js @@ -0,0 +1,2 @@ +// Must be parenthesized +var x: number = 0: number; diff --git a/lib/test/flow/types/typecasts_invalid/migrated_0000.tree.json b/lib/test/flow/types/typecasts_invalid/migrated_0000.tree.json new file mode 100644 index 0000000..550ec8d --- /dev/null +++ b/lib/test/flow/types/typecasts_invalid/migrated_0000.tree.json @@ -0,0 +1,76 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":18}}, + "message":"Unexpected token `:`, expected the token `;`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":17},"end":{"line":2,"column":18}}, + "message":"Unexpected token `:`, expected the start of a statement" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":26}}, + "range":[25,51], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":17}}, + "range":[25,42], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":17}}, + "range":[29,42], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":13}}, + "range":[29,38], + "name":"x", + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":5},"end":{"line":2,"column":13}}, + "range":[30,38], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":7},"end":{"line":2,"column":13}}, + "range":[32,38] + } + }, + "optional":false + }, + "init":{ + "type":"Literal", + "loc":{"source":null,"start":{"line":2,"column":16},"end":{"line":2,"column":17}}, + "range":[41,42], + "value":0, + "raw":"0" + } + } + ], + "kind":"var" + }, + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":26}}, + "range":[44,51], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":25}}, + "range":[44,50], + "name":"number", + "typeAnnotation":null, + "optional":false + }, + "directive":null + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "value":" Must be parenthesized" + } + ] +} diff --git a/lib/test/flow/types/typecasts_invalid/migrated_0001.js b/lib/test/flow/types/typecasts_invalid/migrated_0001.js new file mode 100644 index 0000000..6b6df40 --- /dev/null +++ b/lib/test/flow/types/typecasts_invalid/migrated_0001.js @@ -0,0 +1,2 @@ +// Must be parenthesized even within groups +(xxx: number, yyy: string) diff --git a/lib/test/flow/types/typecasts_invalid/migrated_0001.tree.json b/lib/test/flow/types/typecasts_invalid/migrated_0001.tree.json new file mode 100644 index 0000000..f8b1c5b --- /dev/null +++ b/lib/test/flow/types/typecasts_invalid/migrated_0001.tree.json @@ -0,0 +1,98 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":2,"column":12},"end":{"line":2,"column":13}}, + "message":"Unexpected token `,`, expected the token `)`" + }, + { + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":17}}, + "message":"Unexpected identifier, expected the end of an expression statement (`;`)" + }, + { + "loc":{"source":null,"start":{"line":2,"column":25},"end":{"line":2,"column":26}}, + "message":"Unexpected token `)`, expected the end of an expression statement (`;`)" + }, + { + "loc":{"source":null,"start":{"line":2,"column":25},"end":{"line":2,"column":26}}, + "message":"Unexpected token `)`, expected the start of a statement" + }, + { + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":0}}, + "message":"Unexpected end of input, expected the start of a statement" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":3,"column":0}}, + "range":[44,71], + "body":[ + { + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":13}}, + "range":[44,57], + "expression":{ + "type":"TypeCastExpression", + "loc":{"source":null,"start":{"line":2,"column":0},"end":{"line":2,"column":13}}, + "range":[44,57], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":1},"end":{"line":2,"column":4}}, + "range":[45,48], + "name":"xxx", + "typeAnnotation":null, + "optional":false + }, + "typeAnnotation":{ + "type":"TypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":4},"end":{"line":2,"column":12}}, + "range":[48,56], + "typeAnnotation":{ + "type":"NumberTypeAnnotation", + "loc":{"source":null,"start":{"line":2,"column":6},"end":{"line":2,"column":12}}, + "range":[50,56] + } + } + }, + "directive":null + }, + { + "type":"LabeledStatement", + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":25}}, + "range":[58,69], + "label":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":14},"end":{"line":2,"column":17}}, + "range":[58,61], + "name":"yyy", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"ExpressionStatement", + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":25}}, + "range":[63,69], + "expression":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":2,"column":19},"end":{"line":2,"column":25}}, + "range":[63,69], + "name":"string", + "typeAnnotation":null, + "optional":false + }, + "directive":null + } + }, + { + "type":"EmptyStatement", + "loc":{"source":null,"start":{"line":3,"column":0},"end":{"line":3,"column":0}}, + "range":[71,71] + } + ], + "comments":[ + { + "type":"Line", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "range":[0,43], + "value":" Must be parenthesized even within groups" + } + ] +} diff --git a/lib/test/flow/uninitialized_const_bindings/migrated_0000.js b/lib/test/flow/uninitialized_const_bindings/migrated_0000.js new file mode 100644 index 0000000..6042b43 --- /dev/null +++ b/lib/test/flow/uninitialized_const_bindings/migrated_0000.js @@ -0,0 +1 @@ +for (const x in xs) {} diff --git a/lib/test/flow/uninitialized_const_bindings/migrated_0000.tree.json b/lib/test/flow/uninitialized_const_bindings/migrated_0000.tree.json new file mode 100644 index 0000000..c94bbe9 --- /dev/null +++ b/lib/test/flow/uninitialized_const_bindings/migrated_0000.tree.json @@ -0,0 +1,50 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "body":[ + { + "type":"ForInStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "left":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, + "range":[5,12], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":null + } + ], + "kind":"const" + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, + "range":[16,18], + "name":"xs", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "range":[20,22], + "body":[] + }, + "each":false + } + ], + "comments":[] +} diff --git a/lib/test/flow/uninitialized_const_bindings/migrated_0001.js b/lib/test/flow/uninitialized_const_bindings/migrated_0001.js new file mode 100644 index 0000000..51373d2 --- /dev/null +++ b/lib/test/flow/uninitialized_const_bindings/migrated_0001.js @@ -0,0 +1 @@ +for (const x of xs) {} diff --git a/lib/test/flow/uninitialized_const_bindings/migrated_0001.tree.json b/lib/test/flow/uninitialized_const_bindings/migrated_0001.tree.json new file mode 100644 index 0000000..417eb64 --- /dev/null +++ b/lib/test/flow/uninitialized_const_bindings/migrated_0001.tree.json @@ -0,0 +1,50 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "body":[ + { + "type":"ForOfStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "left":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, + "range":[5,12], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":null + } + ], + "kind":"const" + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, + "range":[16,18], + "name":"xs", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "range":[20,22], + "body":[] + }, + "await":false + } + ], + "comments":[] +} diff --git a/lib/test/flow/uninitialized_const_bindings_invalid/migrated_0000.js b/lib/test/flow/uninitialized_const_bindings_invalid/migrated_0000.js new file mode 100644 index 0000000..8fc915d --- /dev/null +++ b/lib/test/flow/uninitialized_const_bindings_invalid/migrated_0000.js @@ -0,0 +1 @@ +for (const x;;) {} diff --git a/lib/test/flow/uninitialized_const_bindings_invalid/migrated_0000.tree.json b/lib/test/flow/uninitialized_const_bindings_invalid/migrated_0000.tree.json new file mode 100644 index 0000000..c7c1e60 --- /dev/null +++ b/lib/test/flow/uninitialized_const_bindings_invalid/migrated_0000.tree.json @@ -0,0 +1,49 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "message":"Const must be initialized" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "body":[ + { + "type":"ForStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "range":[0,18], + "init":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":12}}, + "range":[5,12], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, + "range":[11,12], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":null + } + ], + "kind":"const" + }, + "test":null, + "update":null, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, + "range":[16,18], + "body":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/uninitialized_destructured_bindings/migrated_0000.js b/lib/test/flow/uninitialized_destructured_bindings/migrated_0000.js new file mode 100644 index 0000000..e9c88fc --- /dev/null +++ b/lib/test/flow/uninitialized_destructured_bindings/migrated_0000.js @@ -0,0 +1 @@ +function x({ foo }) {} diff --git a/lib/test/flow/uninitialized_destructured_bindings/migrated_0000.tree.json b/lib/test/flow/uninitialized_destructured_bindings/migrated_0000.tree.json new file mode 100644 index 0000000..ee22ee9 --- /dev/null +++ b/lib/test/flow/uninitialized_destructured_bindings/migrated_0000.tree.json @@ -0,0 +1,68 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "body":[ + { + "type":"FunctionDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "range":[9,10], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "params":[ + { + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":18}}, + "range":[11,18], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, + "range":[13,16], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, + "range":[13,16], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, + "range":[13,16], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ], + "typeAnnotation":null + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "range":[20,22], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + ], + "comments":[] +} diff --git a/lib/test/flow/uninitialized_destructured_bindings/migrated_0001.js b/lib/test/flow/uninitialized_destructured_bindings/migrated_0001.js new file mode 100644 index 0000000..a37d00b --- /dev/null +++ b/lib/test/flow/uninitialized_destructured_bindings/migrated_0001.js @@ -0,0 +1 @@ +var x = function({ foo }) {} diff --git a/lib/test/flow/uninitialized_destructured_bindings/migrated_0001.tree.json b/lib/test/flow/uninitialized_destructured_bindings/migrated_0001.tree.json new file mode 100644 index 0000000..9705865 --- /dev/null +++ b/lib/test/flow/uninitialized_destructured_bindings/migrated_0001.tree.json @@ -0,0 +1,82 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":28}}, + "range":[4,28], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"FunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":28}}, + "range":[8,28], + "id":null, + "params":[ + { + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":1,"column":17},"end":{"line":1,"column":24}}, + "range":[17,24], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, + "range":[19,22], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, + "range":[19,22], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":19},"end":{"line":1,"column":22}}, + "range":[19,22], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ], + "typeAnnotation":null + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":28}}, + "range":[26,28], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/uninitialized_destructured_bindings/migrated_0002.js b/lib/test/flow/uninitialized_destructured_bindings/migrated_0002.js new file mode 100644 index 0000000..8234171 --- /dev/null +++ b/lib/test/flow/uninitialized_destructured_bindings/migrated_0002.js @@ -0,0 +1 @@ +var x = ({ foo }) => {} diff --git a/lib/test/flow/uninitialized_destructured_bindings/migrated_0002.tree.json b/lib/test/flow/uninitialized_destructured_bindings/migrated_0002.tree.json new file mode 100644 index 0000000..9d7a5a0 --- /dev/null +++ b/lib/test/flow/uninitialized_destructured_bindings/migrated_0002.tree.json @@ -0,0 +1,82 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "body":[ + { + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "range":[0,23], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":23}}, + "range":[4,23], + "id":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "range":[4,5], + "name":"x", + "typeAnnotation":null, + "optional":false + }, + "init":{ + "type":"ArrowFunctionExpression", + "loc":{"source":null,"start":{"line":1,"column":8},"end":{"line":1,"column":23}}, + "range":[8,23], + "id":null, + "params":[ + { + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "range":[11,14], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "range":[11,14], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "range":[11,14], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ], + "typeAnnotation":null + } + ], + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, + "range":[21,23], + "body":[] + }, + "async":false, + "generator":false, + "predicate":null, + "expression":false, + "returnType":null, + "typeParameters":null + } + } + ], + "kind":"var" + } + ], + "comments":[] +} diff --git a/lib/test/flow/uninitialized_destructured_bindings/migrated_0003.js b/lib/test/flow/uninitialized_destructured_bindings/migrated_0003.js new file mode 100644 index 0000000..2fd9d86 --- /dev/null +++ b/lib/test/flow/uninitialized_destructured_bindings/migrated_0003.js @@ -0,0 +1 @@ +for (var { foo } of xs) {} diff --git a/lib/test/flow/uninitialized_destructured_bindings/migrated_0003.tree.json b/lib/test/flow/uninitialized_destructured_bindings/migrated_0003.tree.json new file mode 100644 index 0000000..23b8a57 --- /dev/null +++ b/lib/test/flow/uninitialized_destructured_bindings/migrated_0003.tree.json @@ -0,0 +1,75 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "body":[ + { + "type":"ForOfStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "left":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":16}}, + "range":[5,16], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "id":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "range":[11,14], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "range":[11,14], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "range":[11,14], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ], + "typeAnnotation":null + }, + "init":null + } + ], + "kind":"var" + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "range":[20,22], + "name":"xs", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, + "range":[24,26], + "body":[] + }, + "await":false + } + ], + "comments":[] +} diff --git a/lib/test/flow/uninitialized_destructured_bindings/migrated_0004.js b/lib/test/flow/uninitialized_destructured_bindings/migrated_0004.js new file mode 100644 index 0000000..eb2d19e --- /dev/null +++ b/lib/test/flow/uninitialized_destructured_bindings/migrated_0004.js @@ -0,0 +1 @@ +for (let { foo } of xs) {} diff --git a/lib/test/flow/uninitialized_destructured_bindings/migrated_0004.tree.json b/lib/test/flow/uninitialized_destructured_bindings/migrated_0004.tree.json new file mode 100644 index 0000000..d05ec14 --- /dev/null +++ b/lib/test/flow/uninitialized_destructured_bindings/migrated_0004.tree.json @@ -0,0 +1,75 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "body":[ + { + "type":"ForOfStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "left":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":16}}, + "range":[5,16], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "id":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "range":[11,14], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "range":[11,14], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "range":[11,14], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ], + "typeAnnotation":null + }, + "init":null + } + ], + "kind":"let" + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "range":[20,22], + "name":"xs", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, + "range":[24,26], + "body":[] + }, + "await":false + } + ], + "comments":[] +} diff --git a/lib/test/flow/uninitialized_destructured_bindings/migrated_0005.js b/lib/test/flow/uninitialized_destructured_bindings/migrated_0005.js new file mode 100644 index 0000000..bd67ae3 --- /dev/null +++ b/lib/test/flow/uninitialized_destructured_bindings/migrated_0005.js @@ -0,0 +1 @@ +for (const { foo } of xs) {} diff --git a/lib/test/flow/uninitialized_destructured_bindings/migrated_0005.tree.json b/lib/test/flow/uninitialized_destructured_bindings/migrated_0005.tree.json new file mode 100644 index 0000000..421fff7 --- /dev/null +++ b/lib/test/flow/uninitialized_destructured_bindings/migrated_0005.tree.json @@ -0,0 +1,75 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "body":[ + { + "type":"ForOfStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "left":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":18}}, + "range":[5,18], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":18}}, + "range":[11,18], + "id":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":18}}, + "range":[11,18], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, + "range":[13,16], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, + "range":[13,16], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, + "range":[13,16], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ], + "typeAnnotation":null + }, + "init":null + } + ], + "kind":"const" + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, + "range":[22,24], + "name":"xs", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":28}}, + "range":[26,28], + "body":[] + }, + "await":false + } + ], + "comments":[] +} diff --git a/lib/test/flow/uninitialized_destructured_bindings/migrated_0006.js b/lib/test/flow/uninitialized_destructured_bindings/migrated_0006.js new file mode 100644 index 0000000..e01f6ee --- /dev/null +++ b/lib/test/flow/uninitialized_destructured_bindings/migrated_0006.js @@ -0,0 +1 @@ +for (var { foo } in xs) {} diff --git a/lib/test/flow/uninitialized_destructured_bindings/migrated_0006.tree.json b/lib/test/flow/uninitialized_destructured_bindings/migrated_0006.tree.json new file mode 100644 index 0000000..1d0746a --- /dev/null +++ b/lib/test/flow/uninitialized_destructured_bindings/migrated_0006.tree.json @@ -0,0 +1,75 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "body":[ + { + "type":"ForInStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "left":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":16}}, + "range":[5,16], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "id":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "range":[11,14], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "range":[11,14], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "range":[11,14], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ], + "typeAnnotation":null + }, + "init":null + } + ], + "kind":"var" + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "range":[20,22], + "name":"xs", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, + "range":[24,26], + "body":[] + }, + "each":false + } + ], + "comments":[] +} diff --git a/lib/test/flow/uninitialized_destructured_bindings/migrated_0007.js b/lib/test/flow/uninitialized_destructured_bindings/migrated_0007.js new file mode 100644 index 0000000..dd81136 --- /dev/null +++ b/lib/test/flow/uninitialized_destructured_bindings/migrated_0007.js @@ -0,0 +1 @@ +for (let { foo } in xs) {} diff --git a/lib/test/flow/uninitialized_destructured_bindings/migrated_0007.tree.json b/lib/test/flow/uninitialized_destructured_bindings/migrated_0007.tree.json new file mode 100644 index 0000000..1153c23 --- /dev/null +++ b/lib/test/flow/uninitialized_destructured_bindings/migrated_0007.tree.json @@ -0,0 +1,75 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "body":[ + { + "type":"ForInStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "range":[0,26], + "left":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":16}}, + "range":[5,16], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "id":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "range":[11,14], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "range":[11,14], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "range":[11,14], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ], + "typeAnnotation":null + }, + "init":null + } + ], + "kind":"let" + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "range":[20,22], + "name":"xs", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":24},"end":{"line":1,"column":26}}, + "range":[24,26], + "body":[] + }, + "each":false + } + ], + "comments":[] +} diff --git a/lib/test/flow/uninitialized_destructured_bindings/migrated_0008.js b/lib/test/flow/uninitialized_destructured_bindings/migrated_0008.js new file mode 100644 index 0000000..bd90ab1 --- /dev/null +++ b/lib/test/flow/uninitialized_destructured_bindings/migrated_0008.js @@ -0,0 +1 @@ +for (const { foo } in xs) {} diff --git a/lib/test/flow/uninitialized_destructured_bindings/migrated_0008.tree.json b/lib/test/flow/uninitialized_destructured_bindings/migrated_0008.tree.json new file mode 100644 index 0000000..a7d7353 --- /dev/null +++ b/lib/test/flow/uninitialized_destructured_bindings/migrated_0008.tree.json @@ -0,0 +1,75 @@ +{ + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "body":[ + { + "type":"ForInStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "range":[0,28], + "left":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":18}}, + "range":[5,18], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":18}}, + "range":[11,18], + "id":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":18}}, + "range":[11,18], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, + "range":[13,16], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, + "range":[13,16], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, + "range":[13,16], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ], + "typeAnnotation":null + }, + "init":null + } + ], + "kind":"const" + }, + "right":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, + "range":[22,24], + "name":"xs", + "typeAnnotation":null, + "optional":false + }, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":26},"end":{"line":1,"column":28}}, + "range":[26,28], + "body":[] + }, + "each":false + } + ], + "comments":[] +} diff --git a/lib/test/flow/uninitialized_destructured_bindings_invalid/migrated_0000.js b/lib/test/flow/uninitialized_destructured_bindings_invalid/migrated_0000.js new file mode 100644 index 0000000..961f8ba --- /dev/null +++ b/lib/test/flow/uninitialized_destructured_bindings_invalid/migrated_0000.js @@ -0,0 +1 @@ +for (var { foo };;) {} diff --git a/lib/test/flow/uninitialized_destructured_bindings_invalid/migrated_0000.tree.json b/lib/test/flow/uninitialized_destructured_bindings_invalid/migrated_0000.tree.json new file mode 100644 index 0000000..08fb3c9 --- /dev/null +++ b/lib/test/flow/uninitialized_destructured_bindings_invalid/migrated_0000.tree.json @@ -0,0 +1,74 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "message":"Destructuring assignment must be initialized" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "body":[ + { + "type":"ForStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "init":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":16}}, + "range":[5,16], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "id":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "range":[11,14], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "range":[11,14], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "range":[11,14], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ], + "typeAnnotation":null + }, + "init":null + } + ], + "kind":"var" + }, + "test":null, + "update":null, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "range":[20,22], + "body":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/uninitialized_destructured_bindings_invalid/migrated_0001.js b/lib/test/flow/uninitialized_destructured_bindings_invalid/migrated_0001.js new file mode 100644 index 0000000..2106aca --- /dev/null +++ b/lib/test/flow/uninitialized_destructured_bindings_invalid/migrated_0001.js @@ -0,0 +1 @@ +for (let { foo };;) {} diff --git a/lib/test/flow/uninitialized_destructured_bindings_invalid/migrated_0001.tree.json b/lib/test/flow/uninitialized_destructured_bindings_invalid/migrated_0001.tree.json new file mode 100644 index 0000000..e5d0498 --- /dev/null +++ b/lib/test/flow/uninitialized_destructured_bindings_invalid/migrated_0001.tree.json @@ -0,0 +1,74 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "message":"Destructuring assignment must be initialized" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "body":[ + { + "type":"ForStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, + "range":[0,22], + "init":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":16}}, + "range":[5,16], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "id":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "range":[9,16], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "range":[11,14], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "range":[11,14], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, + "range":[11,14], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ], + "typeAnnotation":null + }, + "init":null + } + ], + "kind":"let" + }, + "test":null, + "update":null, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "range":[20,22], + "body":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/flow/uninitialized_destructured_bindings_invalid/migrated_0002.js b/lib/test/flow/uninitialized_destructured_bindings_invalid/migrated_0002.js new file mode 100644 index 0000000..3b58571 --- /dev/null +++ b/lib/test/flow/uninitialized_destructured_bindings_invalid/migrated_0002.js @@ -0,0 +1 @@ +for (const { foo };;) {} diff --git a/lib/test/flow/uninitialized_destructured_bindings_invalid/migrated_0002.tree.json b/lib/test/flow/uninitialized_destructured_bindings_invalid/migrated_0002.tree.json new file mode 100644 index 0000000..0be9a49 --- /dev/null +++ b/lib/test/flow/uninitialized_destructured_bindings_invalid/migrated_0002.tree.json @@ -0,0 +1,78 @@ +{ + "errors":[ + { + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":18}}, + "message":"Destructuring assignment must be initialized" + }, + { + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":18}}, + "message":"Const must be initialized" + } + ], + "type":"Program", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "body":[ + { + "type":"ForStatement", + "loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":24}}, + "range":[0,24], + "init":{ + "type":"VariableDeclaration", + "loc":{"source":null,"start":{"line":1,"column":5},"end":{"line":1,"column":18}}, + "range":[5,18], + "declarations":[ + { + "type":"VariableDeclarator", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":18}}, + "range":[11,18], + "id":{ + "type":"ObjectPattern", + "loc":{"source":null,"start":{"line":1,"column":11},"end":{"line":1,"column":18}}, + "range":[11,18], + "properties":[ + { + "type":"Property", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, + "range":[13,16], + "key":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, + "range":[13,16], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "value":{ + "type":"Identifier", + "loc":{"source":null,"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, + "range":[13,16], + "name":"foo", + "typeAnnotation":null, + "optional":false + }, + "kind":"init", + "method":false, + "shorthand":true, + "computed":false + } + ], + "typeAnnotation":null + }, + "init":null + } + ], + "kind":"const" + }, + "test":null, + "update":null, + "body":{ + "type":"BlockStatement", + "loc":{"source":null,"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, + "range":[22,24], + "body":[] + } + } + ], + "comments":[] +} diff --git a/lib/test/test262_baseline.txt b/lib/test/test262_baseline.txt new file mode 100644 index 0000000..38505fb --- /dev/null +++ b/lib/test/test262_baseline.txt @@ -0,0 +1,11057 @@ +annexB/language/comments/multi-line-html-close.js (strict mode) + Unexpected token `>` at (26, 4) to (26, 5) +annexB/language/comments/multi-line-html-close.js (default) + Unexpected token `>` at (26, 4) to (26, 5) +annexB/language/comments/single-line-html-close-asi.js (strict mode) + Unexpected token `>` at (27, 2) to (27, 3) +annexB/language/comments/single-line-html-close-asi.js (default) + Unexpected token `>` at (27, 2) to (27, 3) +annexB/language/comments/single-line-html-close-unicode-separators.js (strict mode) + Unexpected token `>` at (37, 2) to (37, 3) +annexB/language/comments/single-line-html-close-unicode-separators.js (default) + Unexpected token `>` at (37, 2) to (37, 3) +annexB/language/comments/single-line-html-close.js (strict mode) + Unexpected token `>` at (25, 2) to (25, 3) +annexB/language/comments/single-line-html-close.js (default) + Unexpected token `>` at (25, 2) to (25, 3) +annexB/language/comments/single-line-html-open.js (strict mode) + Unexpected token `!`, expected an identifier at (22, 1) to (22, 2) +annexB/language/comments/single-line-html-open.js (default) + Unexpected token `!`, expected an identifier at (22, 1) to (22, 2) +annexB/language/expressions/object/__proto__-duplicate.js (strict mode) + Missing parse error +annexB/language/expressions/object/__proto__-duplicate.js (default) + Missing parse error +annexB/language/statements/for-in/nonstrict-initializer.js (default) + Invalid left-hand side in for-in at (11, 7) to (11, 24) +built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_F-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_F-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_F.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_F.js (default) + Missing parse error +built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Invalid-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Invalid-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Invalid.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Invalid.js (default) + Missing parse error +built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_N-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_N-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_N.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_N.js (default) + Missing parse error +built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_No-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_No-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_No.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_No.js (default) + Missing parse error +built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_T-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_T-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_T.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_T.js (default) + Missing parse error +built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Y-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Y-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Y.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Y.js (default) + Missing parse error +built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Yes-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Yes-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Yes.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Yes.js (default) + Missing parse error +built-ins/RegExp/property-escapes/character-class-range-end.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/character-class-range-end.js (default) + Missing parse error +built-ins/RegExp/property-escapes/character-class-range-no-dash-end.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/character-class-range-no-dash-end.js (default) + Missing parse error +built-ins/RegExp/property-escapes/character-class-range-no-dash-start.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/character-class-range-no-dash-start.js (default) + Missing parse error +built-ins/RegExp/property-escapes/character-class-range-start.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/character-class-range-start.js (default) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Block-implicit-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Block-implicit-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Block-implicit.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Block-implicit.js (default) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Script-implicit-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Script-implicit-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Script-implicit.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Script-implicit.js (default) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Script-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Script-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Script.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Script.js (default) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-Is-prefix-Script-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-Is-prefix-Script-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-Is-prefix-Script.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-Is-prefix-Script.js (default) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-circumflex-negation-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-circumflex-negation-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-circumflex-negation.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-circumflex-negation.js (default) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-empty-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-empty-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-empty.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-empty.js (default) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-invalid-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-invalid-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-invalid.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-invalid.js (default) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-no-braces-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-no-braces-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-no-braces-value-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-no-braces-value-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-no-braces-value.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-no-braces-value.js (default) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-no-braces.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-no-braces.js (default) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-separator-and-value-only-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-separator-and-value-only-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-separator-and-value-only.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-separator-and-value-only.js (default) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-separator-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-separator-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-separator-only-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-separator-only-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-separator-only.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-separator-only.js (default) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-separator.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-separator.js (default) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-unclosed-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-unclosed-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-unclosed.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-unclosed.js (default) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-unopened-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-unopened-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-unopened.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/grammar-extension-unopened.js (default) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-01-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-01-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-01.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-01.js (default) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-02-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-02-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-02.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-02.js (default) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-03-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-03-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-03.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-03.js (default) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-04-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-04-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-04.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-04.js (default) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-05-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-05-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-05.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-05.js (default) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-06-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-06-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-06.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-06.js (default) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-07-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-07-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-07.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-07.js (default) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-08-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-08-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-08.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-08.js (default) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-09-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-09-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-09.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-09.js (default) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-10-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-10-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-10.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-10.js (default) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-11-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-11-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-11.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-11.js (default) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-12-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-12-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-12.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-12.js (default) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-13-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-13-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-13.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-13.js (default) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-14-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-14-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-14.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/loose-matching-14.js (default) + Missing parse error +built-ins/RegExp/property-escapes/non-binary-property-without-value-General_Category-equals-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/non-binary-property-without-value-General_Category-equals-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/non-binary-property-without-value-General_Category-equals.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/non-binary-property-without-value-General_Category-equals.js (default) + Missing parse error +built-ins/RegExp/property-escapes/non-binary-property-without-value-General_Category-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/non-binary-property-without-value-General_Category-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/non-binary-property-without-value-General_Category.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/non-binary-property-without-value-General_Category.js (default) + Missing parse error +built-ins/RegExp/property-escapes/non-binary-property-without-value-Script-equals-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/non-binary-property-without-value-Script-equals-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/non-binary-property-without-value-Script-equals.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/non-binary-property-without-value-Script-equals.js (default) + Missing parse error +built-ins/RegExp/property-escapes/non-binary-property-without-value-Script-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/non-binary-property-without-value-Script-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/non-binary-property-without-value-Script.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/non-binary-property-without-value-Script.js (default) + Missing parse error +built-ins/RegExp/property-escapes/non-binary-property-without-value-Script_Extensions-equals-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/non-binary-property-without-value-Script_Extensions-equals-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/non-binary-property-without-value-Script_Extensions-equals.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/non-binary-property-without-value-Script_Extensions-equals.js (default) + Missing parse error +built-ins/RegExp/property-escapes/non-binary-property-without-value-Script_Extensions-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/non-binary-property-without-value-Script_Extensions-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/non-binary-property-without-value-Script_Extensions.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/non-binary-property-without-value-Script_Extensions.js (default) + Missing parse error +built-ins/RegExp/property-escapes/non-existent-binary-property-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/non-existent-binary-property-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/non-existent-binary-property.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/non-existent-binary-property.js (default) + Missing parse error +built-ins/RegExp/property-escapes/non-existent-property-and-value-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/non-existent-property-and-value-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/non-existent-property-and-value.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/non-existent-property-and-value.js (default) + Missing parse error +built-ins/RegExp/property-escapes/non-existent-property-existing-value-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/non-existent-property-existing-value-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/non-existent-property-existing-value.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/non-existent-property-existing-value.js (default) + Missing parse error +built-ins/RegExp/property-escapes/non-existent-property-value-General_Category-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/non-existent-property-value-General_Category-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/non-existent-property-value-Script-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/non-existent-property-value-Script-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/non-existent-property-value-Script.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/non-existent-property-value-Script.js (default) + Missing parse error +built-ins/RegExp/property-escapes/non-existent-property-value-Script_Extensions-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/non-existent-property-value-Script_Extensions-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/non-existent-property-value-Script_Extensions.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/non-existent-property-value-Script_Extensions.js (default) + Missing parse error +built-ins/RegExp/property-escapes/non-existent-property-value-general-category.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/non-existent-property-value-general-category.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Composition_Exclusion-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Composition_Exclusion-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Composition_Exclusion.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Composition_Exclusion.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFC-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFC-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFC.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFC.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFD-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFD-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFD.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFD.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFKC-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFKC-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFKC.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFKC.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFKD-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFKD-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFKD.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFKD.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-FC_NFKC_Closure-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-FC_NFKC_Closure-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-FC_NFKC_Closure.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-FC_NFKC_Closure.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Full_Composition_Exclusion-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Full_Composition_Exclusion-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Full_Composition_Exclusion.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Full_Composition_Exclusion.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Grapheme_Link-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Grapheme_Link-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Grapheme_Link.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Grapheme_Link.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Hyphen-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Hyphen-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Hyphen.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Hyphen.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Alphabetic-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Alphabetic-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Alphabetic.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Alphabetic.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Default_Ignorable_Code_Point-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Default_Ignorable_Code_Point-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Default_Ignorable_Code_Point.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Default_Ignorable_Code_Point.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Grapheme_Extend-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Grapheme_Extend-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Grapheme_Extend.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Grapheme_Extend.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Other_ID_Continue-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Other_ID_Continue-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Other_ID_Continue.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Other_ID_Continue.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Other_ID_Start-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Other_ID_Start-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Other_ID_Start.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Other_ID_Start.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Lowercase-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Lowercase-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Lowercase.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Lowercase.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Math-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Math-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Math.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Math.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Uppercase-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Uppercase-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Uppercase.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Uppercase.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Prepended_Concatenation_Mark-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Prepended_Concatenation_Mark-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Prepended_Concatenation_Mark.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-binary-property-Prepended_Concatenation_Mark.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-property-Block-with-value-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-property-Block-with-value-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-property-Block-with-value.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-property-Block-with-value.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-property-FC_NFKC_Closure-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-property-FC_NFKC_Closure-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-property-FC_NFKC_Closure.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-property-FC_NFKC_Closure.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-property-Line_Break-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-property-Line_Break-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-property-Line_Break-with-value-negated.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-property-Line_Break-with-value-negated.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-property-Line_Break-with-value.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-property-Line_Break-with-value.js (default) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-property-Line_Break.js (strict mode) + Missing parse error +built-ins/RegExp/property-escapes/unsupported-property-Line_Break.js (default) + Missing parse error +language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-multiple.js (strict mode) + Classes may not have private methods. at (60, 2) to (65, 3) +language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-multiple.js (default) + Classes may not have private methods. at (60, 2) to (65, 3) +language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-null.js (strict mode) + Classes may not have private methods. at (60, 2) to (65, 3) +language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-null.js (default) + Classes may not have private methods. at (60, 2) to (65, 3) +language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-single-args.js (strict mode) + Classes may not have private methods. at (60, 2) to (64, 3) +language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-single-args.js (default) + Classes may not have private methods. at (60, 2) to (64, 3) +language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-spread-operator.js (strict mode) + Classes may not have private methods. at (62, 2) to (69, 3) +language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-spread-operator.js (default) + Classes may not have private methods. at (62, 2) to (69, 3) +language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-undefined.js (strict mode) + Classes may not have private methods. at (60, 2) to (65, 3) +language/arguments-object/cls-decl-async-private-gen-meth-args-trailing-comma-undefined.js (default) + Classes may not have private methods. at (60, 2) to (65, 3) +language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-multiple.js (strict mode) + Classes may not have private methods. at (41, 2) to (46, 3) +language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-multiple.js (default) + Classes may not have private methods. at (41, 2) to (46, 3) +language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-null.js (strict mode) + Classes may not have private methods. at (41, 2) to (46, 3) +language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-null.js (default) + Classes may not have private methods. at (41, 2) to (46, 3) +language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-single-args.js (strict mode) + Classes may not have private methods. at (41, 2) to (45, 3) +language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-single-args.js (default) + Classes may not have private methods. at (41, 2) to (45, 3) +language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-spread-operator.js (strict mode) + Classes may not have private methods. at (43, 2) to (50, 3) +language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-spread-operator.js (default) + Classes may not have private methods. at (43, 2) to (50, 3) +language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-undefined.js (strict mode) + Classes may not have private methods. at (41, 2) to (46, 3) +language/arguments-object/cls-decl-async-private-gen-meth-static-args-trailing-comma-undefined.js (default) + Classes may not have private methods. at (41, 2) to (46, 3) +language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-multiple.js (strict mode) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-multiple.js (default) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-null.js (strict mode) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-null.js (default) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-single-args.js (strict mode) + Classes may not have private methods. at (36, 2) to (40, 3) +language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-single-args.js (default) + Classes may not have private methods. at (36, 2) to (40, 3) +language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-spread-operator.js (strict mode) + Classes may not have private methods. at (38, 2) to (45, 3) +language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-spread-operator.js (default) + Classes may not have private methods. at (38, 2) to (45, 3) +language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-undefined.js (strict mode) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-decl-private-gen-meth-args-trailing-comma-undefined.js (default) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-multiple.js (strict mode) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-multiple.js (default) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-null.js (strict mode) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-null.js (default) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-single-args.js (strict mode) + Classes may not have private methods. at (36, 2) to (40, 3) +language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-single-args.js (default) + Classes may not have private methods. at (36, 2) to (40, 3) +language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-spread-operator.js (strict mode) + Classes may not have private methods. at (38, 2) to (45, 3) +language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-spread-operator.js (default) + Classes may not have private methods. at (38, 2) to (45, 3) +language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-undefined.js (strict mode) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-decl-private-gen-meth-static-args-trailing-comma-undefined.js (default) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-decl-private-meth-args-trailing-comma-multiple.js (strict mode) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-decl-private-meth-args-trailing-comma-multiple.js (default) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-decl-private-meth-args-trailing-comma-null.js (strict mode) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-decl-private-meth-args-trailing-comma-null.js (default) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-decl-private-meth-args-trailing-comma-single-args.js (strict mode) + Classes may not have private methods. at (36, 2) to (40, 3) +language/arguments-object/cls-decl-private-meth-args-trailing-comma-single-args.js (default) + Classes may not have private methods. at (36, 2) to (40, 3) +language/arguments-object/cls-decl-private-meth-args-trailing-comma-spread-operator.js (strict mode) + Classes may not have private methods. at (38, 2) to (45, 3) +language/arguments-object/cls-decl-private-meth-args-trailing-comma-spread-operator.js (default) + Classes may not have private methods. at (38, 2) to (45, 3) +language/arguments-object/cls-decl-private-meth-args-trailing-comma-undefined.js (strict mode) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-decl-private-meth-args-trailing-comma-undefined.js (default) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-multiple.js (strict mode) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-multiple.js (default) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-null.js (strict mode) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-null.js (default) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-single-args.js (strict mode) + Classes may not have private methods. at (36, 2) to (40, 3) +language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-single-args.js (default) + Classes may not have private methods. at (36, 2) to (40, 3) +language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-spread-operator.js (strict mode) + Classes may not have private methods. at (38, 2) to (45, 3) +language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-spread-operator.js (default) + Classes may not have private methods. at (38, 2) to (45, 3) +language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-undefined.js (strict mode) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-decl-private-meth-static-args-trailing-comma-undefined.js (default) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-multiple.js (strict mode) + Classes may not have private methods. at (62, 2) to (67, 3) +language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-multiple.js (default) + Classes may not have private methods. at (62, 2) to (67, 3) +language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-null.js (strict mode) + Classes may not have private methods. at (62, 2) to (67, 3) +language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-null.js (default) + Classes may not have private methods. at (62, 2) to (67, 3) +language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-single-args.js (strict mode) + Classes may not have private methods. at (62, 2) to (66, 3) +language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-single-args.js (default) + Classes may not have private methods. at (62, 2) to (66, 3) +language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-spread-operator.js (strict mode) + Classes may not have private methods. at (64, 2) to (71, 3) +language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-spread-operator.js (default) + Classes may not have private methods. at (64, 2) to (71, 3) +language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-undefined.js (strict mode) + Classes may not have private methods. at (62, 2) to (67, 3) +language/arguments-object/cls-expr-async-private-gen-meth-args-trailing-comma-undefined.js (default) + Classes may not have private methods. at (62, 2) to (67, 3) +language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-multiple.js (strict mode) + Classes may not have private methods. at (62, 2) to (67, 3) +language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-multiple.js (default) + Classes may not have private methods. at (62, 2) to (67, 3) +language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-null.js (strict mode) + Classes may not have private methods. at (62, 2) to (67, 3) +language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-null.js (default) + Classes may not have private methods. at (62, 2) to (67, 3) +language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-single-args.js (strict mode) + Classes may not have private methods. at (62, 2) to (66, 3) +language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-single-args.js (default) + Classes may not have private methods. at (62, 2) to (66, 3) +language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-spread-operator.js (strict mode) + Classes may not have private methods. at (64, 2) to (71, 3) +language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-spread-operator.js (default) + Classes may not have private methods. at (64, 2) to (71, 3) +language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-undefined.js (strict mode) + Classes may not have private methods. at (62, 2) to (67, 3) +language/arguments-object/cls-expr-async-private-gen-meth-static-args-trailing-comma-undefined.js (default) + Classes may not have private methods. at (62, 2) to (67, 3) +language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-multiple.js (strict mode) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-multiple.js (default) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-null.js (strict mode) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-null.js (default) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-single-args.js (strict mode) + Classes may not have private methods. at (36, 2) to (40, 3) +language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-single-args.js (default) + Classes may not have private methods. at (36, 2) to (40, 3) +language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-spread-operator.js (strict mode) + Classes may not have private methods. at (38, 2) to (45, 3) +language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-spread-operator.js (default) + Classes may not have private methods. at (38, 2) to (45, 3) +language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-undefined.js (strict mode) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-expr-private-gen-meth-args-trailing-comma-undefined.js (default) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-multiple.js (strict mode) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-multiple.js (default) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-null.js (strict mode) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-null.js (default) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-single-args.js (strict mode) + Classes may not have private methods. at (36, 2) to (40, 3) +language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-single-args.js (default) + Classes may not have private methods. at (36, 2) to (40, 3) +language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-spread-operator.js (strict mode) + Classes may not have private methods. at (38, 2) to (45, 3) +language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-spread-operator.js (default) + Classes may not have private methods. at (38, 2) to (45, 3) +language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-undefined.js (strict mode) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-expr-private-gen-meth-static-args-trailing-comma-undefined.js (default) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-expr-private-meth-args-trailing-comma-multiple.js (strict mode) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-expr-private-meth-args-trailing-comma-multiple.js (default) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-expr-private-meth-args-trailing-comma-null.js (strict mode) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-expr-private-meth-args-trailing-comma-null.js (default) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-expr-private-meth-args-trailing-comma-single-args.js (strict mode) + Classes may not have private methods. at (36, 2) to (40, 3) +language/arguments-object/cls-expr-private-meth-args-trailing-comma-single-args.js (default) + Classes may not have private methods. at (36, 2) to (40, 3) +language/arguments-object/cls-expr-private-meth-args-trailing-comma-spread-operator.js (strict mode) + Classes may not have private methods. at (38, 2) to (45, 3) +language/arguments-object/cls-expr-private-meth-args-trailing-comma-spread-operator.js (default) + Classes may not have private methods. at (38, 2) to (45, 3) +language/arguments-object/cls-expr-private-meth-args-trailing-comma-undefined.js (strict mode) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-expr-private-meth-args-trailing-comma-undefined.js (default) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-multiple.js (strict mode) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-multiple.js (default) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-null.js (strict mode) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-null.js (default) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-single-args.js (strict mode) + Classes may not have private methods. at (36, 2) to (40, 3) +language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-single-args.js (default) + Classes may not have private methods. at (36, 2) to (40, 3) +language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-spread-operator.js (strict mode) + Classes may not have private methods. at (38, 2) to (45, 3) +language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-spread-operator.js (default) + Classes may not have private methods. at (38, 2) to (45, 3) +language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-undefined.js (strict mode) + Classes may not have private methods. at (36, 2) to (41, 3) +language/arguments-object/cls-expr-private-meth-static-args-trailing-comma-undefined.js (default) + Classes may not have private methods. at (36, 2) to (41, 3) +language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-function.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-function.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-generator.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-generator.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-class.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-class.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-const.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-const.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-function.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-function.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-generator.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-generator.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-let.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-let.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-var.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-var.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-function.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-function.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-generator.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-generator.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-class.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-class.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-const.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-const.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-function.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-function.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-generator.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-generator.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-let.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-let.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-var.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-var.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-async-function.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-async-function.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-async-generator.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-async-generator.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-class.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-class.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-const.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-const.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-function.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-function.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-generator.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-generator.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-let.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-let.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-var.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-var.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-async-function.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-async-function.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-async-generator.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-async-generator.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-class.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-class.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-const.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-const.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-function.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-function.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-generator.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-generator.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-let.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-let.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-var.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-var.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-async-function.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-async-function.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-async-generator.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-async-generator.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-class.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-class.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-const.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-const.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-function.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-function.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-generator.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-generator.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-let.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-let.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-var-declaration-nested-in-function.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-var-declaration-nested-in-function.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-async-function.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-async-function.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-async-generator.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-async-generator.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-class.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-class.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-const.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-const.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-function.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-generator.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-generator.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-let.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-let.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-var.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-var.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-function.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-function.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-generator.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-generator.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-class.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-class.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-const.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-const.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-function.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-function.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-generator.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-generator.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-let.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-let.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-var.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-var.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-async-function.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-async-function.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-async-generator.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-async-generator.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-class.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-class.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-const.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-const.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-function.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-function.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-generator.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-generator.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-let.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-let.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-async-function.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-async-function.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-async-generator.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-async-generator.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-class.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-class.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-const.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-const.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-function.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-function.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-generator.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-generator.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-let.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-let.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-async-function.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-async-function.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-async-generator.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-async-generator.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-class.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-class.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-const.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-const.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-function.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-function.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-generator.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-generator.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-let.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-let.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-var.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-var.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-async-function.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-async-function.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-async-generator.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-async-generator.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-class.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-class.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-const.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-const.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-function.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-function.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-generator.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-generator.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-let.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-let.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-async-function.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-async-function.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-async-generator.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-async-generator.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-class.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-class.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-const.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-const.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-function.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-function.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-generator.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-generator.js (default) + Missing parse error +language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-let.js (strict mode) + Missing parse error +language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-let.js (default) + Missing parse error +language/expressions/arrow-function/params-duplicate.js (default) + Missing parse error +language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates.js (default) + Missing parse error +language/expressions/arrow-function/syntax/early-errors/use-strict-with-non-simple-param.js (strict mode) + Missing parse error +language/expressions/arrow-function/syntax/early-errors/use-strict-with-non-simple-param.js (default) + Missing parse error +language/expressions/async-arrow-function/await-as-param-ident-nested-arrow-parameter-position.js (strict mode) + Missing parse error +language/expressions/async-arrow-function/await-as-param-ident-nested-arrow-parameter-position.js (default) + Missing parse error +language/expressions/async-arrow-function/await-as-param-nested-arrow-body-position.js (strict mode) + Missing parse error +language/expressions/async-arrow-function/await-as-param-nested-arrow-body-position.js (default) + Missing parse error +language/expressions/async-arrow-function/await-as-param-nested-arrow-parameter-position.js (strict mode) + Missing parse error +language/expressions/async-arrow-function/await-as-param-nested-arrow-parameter-position.js (default) + Missing parse error +language/expressions/async-arrow-function/await-as-param-rest-nested-arrow-parameter-position.js (strict mode) + Missing parse error +language/expressions/async-arrow-function/await-as-param-rest-nested-arrow-parameter-position.js (default) + Missing parse error +language/expressions/async-arrow-function/early-errors-arrow-NSPL-with-USD.js (strict mode) + Missing parse error +language/expressions/async-arrow-function/early-errors-arrow-NSPL-with-USD.js (default) + Missing parse error +language/expressions/async-arrow-function/early-errors-arrow-await-in-formals-default.js (strict mode) + Missing parse error +language/expressions/async-arrow-function/early-errors-arrow-await-in-formals-default.js (default) + Missing parse error +language/expressions/async-arrow-function/early-errors-arrow-await-in-formals.js (strict mode) + Missing parse error +language/expressions/async-arrow-function/early-errors-arrow-await-in-formals.js (default) + Missing parse error +language/expressions/async-arrow-function/early-errors-arrow-duplicate-parameters.js (default) + Missing parse error +language/expressions/async-arrow-function/early-errors-arrow-formals-body-duplicate.js (strict mode) + Missing parse error +language/expressions/async-arrow-function/early-errors-arrow-formals-body-duplicate.js (default) + Missing parse error +language/expressions/async-function/early-errors-expression-NSPL-with-USD.js (strict mode) + Missing parse error +language/expressions/async-function/early-errors-expression-NSPL-with-USD.js (default) + Missing parse error +language/expressions/async-function/early-errors-expression-formals-body-duplicate.js (strict mode) + Missing parse error +language/expressions/async-function/early-errors-expression-formals-body-duplicate.js (default) + Missing parse error +language/expressions/async-generator/early-errors-expression-NSPL-with-USD.js (strict mode) + Missing parse error +language/expressions/async-generator/early-errors-expression-NSPL-with-USD.js (default) + Missing parse error +language/expressions/async-generator/early-errors-expression-formals-body-duplicate-const.js (strict mode) + Missing parse error +language/expressions/async-generator/early-errors-expression-formals-body-duplicate-const.js (default) + Missing parse error +language/expressions/async-generator/early-errors-expression-formals-body-duplicate-let.js (strict mode) + Missing parse error +language/expressions/async-generator/early-errors-expression-formals-body-duplicate-let.js (default) + Missing parse error +language/expressions/async-generator/early-errors-expression-formals-contains-await-expr.js (strict mode) + Missing parse error +language/expressions/async-generator/early-errors-expression-formals-contains-await-expr.js (default) + Missing parse error +language/expressions/class/class-name-ident-await-escaped-module.js (strict mode) + Missing parse error +language/expressions/class/class-name-ident-await-escaped-module.js (default) + Missing parse error +language/expressions/class/class-name-ident-await-module.js (strict mode) + Missing parse error +language/expressions/class/class-name-ident-await-module.js (default) + Missing parse error +language/expressions/class/dstr/async-private-gen-meth-ary-init-iter-close.js (strict mode) + Classes may not have private methods. at (70, 2) to (73, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-init-iter-close.js (default) + Classes may not have private methods. at (70, 2) to (73, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-init-iter-no-close.js (strict mode) + Classes may not have private methods. at (70, 2) to (73, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-init-iter-no-close.js (default) + Classes may not have private methods. at (70, 2) to (73, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-name-iter-val.js (strict mode) + Classes may not have private methods. at (67, 2) to (72, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-name-iter-val.js (default) + Classes may not have private methods. at (67, 2) to (72, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elem-init.js (strict mode) + Classes may not have private methods. at (59, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elem-init.js (default) + Classes may not have private methods. at (59, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elem-iter.js (strict mode) + Classes may not have private methods. at (60, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elem-iter.js (default) + Classes may not have private methods. at (60, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elision-init.js (strict mode) + Classes may not have private methods. at (67, 2) to (71, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elision-init.js (default) + Classes may not have private methods. at (67, 2) to (71, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elision-iter.js (strict mode) + Classes may not have private methods. at (65, 2) to (68, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elision-iter.js (default) + Classes may not have private methods. at (65, 2) to (68, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-empty-init.js (strict mode) + Classes may not have private methods. at (63, 2) to (67, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-empty-init.js (default) + Classes may not have private methods. at (63, 2) to (67, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-empty-iter.js (strict mode) + Classes may not have private methods. at (61, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-empty-iter.js (default) + Classes may not have private methods. at (61, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-rest-init.js (strict mode) + Classes may not have private methods. at (60, 2) to (68, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-rest-init.js (default) + Classes may not have private methods. at (60, 2) to (68, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-rest-iter.js (strict mode) + Classes may not have private methods. at (62, 2) to (71, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-rest-iter.js (default) + Classes may not have private methods. at (62, 2) to (71, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-exhausted.js (strict mode) + Classes may not have private methods. at (60, 2) to (63, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-exhausted.js (default) + Classes may not have private methods. at (60, 2) to (63, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (61, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (61, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (61, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js (default) + Classes may not have private methods. at (61, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (61, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (61, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (61, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (61, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (62, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (62, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-hole.js (strict mode) + Classes may not have private methods. at (55, 2) to (59, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-hole.js (default) + Classes may not have private methods. at (55, 2) to (59, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-skipped.js (strict mode) + Classes may not have private methods. at (61, 2) to (68, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-skipped.js (default) + Classes may not have private methods. at (61, 2) to (68, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-undef.js (strict mode) + Classes may not have private methods. at (59, 2) to (62, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-undef.js (default) + Classes may not have private methods. at (59, 2) to (62, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-complete.js (strict mode) + Classes may not have private methods. at (63, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-complete.js (default) + Classes may not have private methods. at (63, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-done.js (strict mode) + Classes may not have private methods. at (58, 2) to (61, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-done.js (default) + Classes may not have private methods. at (58, 2) to (61, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-val.js (strict mode) + Classes may not have private methods. at (67, 2) to (72, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-val.js (default) + Classes may not have private methods. at (67, 2) to (72, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-id-init.js (strict mode) + Classes may not have private methods. at (59, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-id-init.js (default) + Classes may not have private methods. at (59, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-id.js (strict mode) + Classes may not have private methods. at (59, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-id.js (default) + Classes may not have private methods. at (59, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-prop-id-init.js (strict mode) + Classes may not have private methods. at (59, 2) to (74, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-prop-id-init.js (default) + Classes may not have private methods. at (59, 2) to (74, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-prop-id.js (strict mode) + Classes may not have private methods. at (59, 2) to (74, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-prop-id.js (default) + Classes may not have private methods. at (59, 2) to (74, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elision-exhausted.js (strict mode) + Classes may not have private methods. at (66, 2) to (69, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elision-exhausted.js (default) + Classes may not have private methods. at (66, 2) to (69, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elision.js (strict mode) + Classes may not have private methods. at (74, 2) to (78, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elision.js (default) + Classes may not have private methods. at (74, 2) to (78, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-empty.js (strict mode) + Classes may not have private methods. at (58, 2) to (61, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-empty.js (default) + Classes may not have private methods. at (58, 2) to (61, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-elem.js (strict mode) + Classes may not have private methods. at (80, 2) to (85, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-elem.js (default) + Classes may not have private methods. at (80, 2) to (85, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-elision.js (strict mode) + Classes may not have private methods. at (87, 2) to (91, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-elision.js (default) + Classes may not have private methods. at (87, 2) to (91, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-empty.js (strict mode) + Classes may not have private methods. at (71, 2) to (74, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-empty.js (default) + Classes may not have private methods. at (71, 2) to (74, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-rest.js (strict mode) + Classes may not have private methods. at (61, 2) to (70, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-rest.js (default) + Classes may not have private methods. at (61, 2) to (70, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-id-elision.js (strict mode) + Classes may not have private methods. at (58, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-id-elision.js (default) + Classes may not have private methods. at (58, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-id-exhausted.js (strict mode) + Classes may not have private methods. at (58, 2) to (62, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-id-exhausted.js (default) + Classes may not have private methods. at (58, 2) to (62, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-id.js (strict mode) + Classes may not have private methods. at (55, 2) to (63, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-id.js (default) + Classes may not have private methods. at (55, 2) to (63, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-obj-id.js (strict mode) + Classes may not have private methods. at (60, 2) to (63, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-obj-id.js (default) + Classes may not have private methods. at (60, 2) to (63, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-obj-prop-id.js (strict mode) + Classes may not have private methods. at (61, 2) to (70, 3) +language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-obj-prop-id.js (default) + Classes may not have private methods. at (61, 2) to (70, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-init-iter-close.js (strict mode) + Classes may not have private methods. at (70, 2) to (73, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-init-iter-close.js (default) + Classes may not have private methods. at (70, 2) to (73, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-init-iter-no-close.js (strict mode) + Classes may not have private methods. at (70, 2) to (73, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-init-iter-no-close.js (default) + Classes may not have private methods. at (70, 2) to (73, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-name-iter-val.js (strict mode) + Classes may not have private methods. at (67, 2) to (72, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-name-iter-val.js (default) + Classes may not have private methods. at (67, 2) to (72, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js (strict mode) + Classes may not have private methods. at (59, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js (default) + Classes may not have private methods. at (59, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js (strict mode) + Classes may not have private methods. at (60, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js (default) + Classes may not have private methods. at (60, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js (strict mode) + Classes may not have private methods. at (67, 2) to (71, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js (default) + Classes may not have private methods. at (67, 2) to (71, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js (strict mode) + Classes may not have private methods. at (65, 2) to (68, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js (default) + Classes may not have private methods. at (65, 2) to (68, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js (strict mode) + Classes may not have private methods. at (63, 2) to (67, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js (default) + Classes may not have private methods. at (63, 2) to (67, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js (strict mode) + Classes may not have private methods. at (61, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js (default) + Classes may not have private methods. at (61, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js (strict mode) + Classes may not have private methods. at (60, 2) to (68, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js (default) + Classes may not have private methods. at (60, 2) to (68, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js (strict mode) + Classes may not have private methods. at (62, 2) to (71, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js (default) + Classes may not have private methods. at (62, 2) to (71, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js (strict mode) + Classes may not have private methods. at (60, 2) to (63, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js (default) + Classes may not have private methods. at (60, 2) to (63, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (61, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (61, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (61, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js (default) + Classes may not have private methods. at (61, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (61, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (61, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (61, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (61, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (62, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (62, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js (strict mode) + Classes may not have private methods. at (55, 2) to (59, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js (default) + Classes may not have private methods. at (55, 2) to (59, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js (strict mode) + Classes may not have private methods. at (61, 2) to (68, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js (default) + Classes may not have private methods. at (61, 2) to (68, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js (strict mode) + Classes may not have private methods. at (59, 2) to (62, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js (default) + Classes may not have private methods. at (59, 2) to (62, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js (strict mode) + Classes may not have private methods. at (63, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js (default) + Classes may not have private methods. at (63, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js (strict mode) + Classes may not have private methods. at (58, 2) to (61, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js (default) + Classes may not have private methods. at (58, 2) to (61, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js (strict mode) + Classes may not have private methods. at (67, 2) to (72, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js (default) + Classes may not have private methods. at (67, 2) to (72, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js (strict mode) + Classes may not have private methods. at (59, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js (default) + Classes may not have private methods. at (59, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-id.js (strict mode) + Classes may not have private methods. at (59, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-id.js (default) + Classes may not have private methods. at (59, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js (strict mode) + Classes may not have private methods. at (59, 2) to (74, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js (default) + Classes may not have private methods. at (59, 2) to (74, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js (strict mode) + Classes may not have private methods. at (59, 2) to (74, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js (default) + Classes may not have private methods. at (59, 2) to (74, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elision-exhausted.js (strict mode) + Classes may not have private methods. at (66, 2) to (69, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elision-exhausted.js (default) + Classes may not have private methods. at (66, 2) to (69, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elision.js (strict mode) + Classes may not have private methods. at (74, 2) to (78, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elision.js (default) + Classes may not have private methods. at (74, 2) to (78, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-empty.js (strict mode) + Classes may not have private methods. at (58, 2) to (61, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-empty.js (default) + Classes may not have private methods. at (58, 2) to (61, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-elem.js (strict mode) + Classes may not have private methods. at (80, 2) to (85, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-elem.js (default) + Classes may not have private methods. at (80, 2) to (85, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-elision.js (strict mode) + Classes may not have private methods. at (87, 2) to (91, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-elision.js (default) + Classes may not have private methods. at (87, 2) to (91, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-empty.js (strict mode) + Classes may not have private methods. at (71, 2) to (74, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-empty.js (default) + Classes may not have private methods. at (71, 2) to (74, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-rest.js (strict mode) + Classes may not have private methods. at (61, 2) to (70, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-rest.js (default) + Classes may not have private methods. at (61, 2) to (70, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id-elision.js (strict mode) + Classes may not have private methods. at (58, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id-elision.js (default) + Classes may not have private methods. at (58, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js (strict mode) + Classes may not have private methods. at (58, 2) to (62, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js (default) + Classes may not have private methods. at (58, 2) to (62, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id.js (strict mode) + Classes may not have private methods. at (55, 2) to (63, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id.js (default) + Classes may not have private methods. at (55, 2) to (63, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-obj-id.js (strict mode) + Classes may not have private methods. at (60, 2) to (63, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-obj-id.js (default) + Classes may not have private methods. at (60, 2) to (63, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js (strict mode) + Classes may not have private methods. at (61, 2) to (70, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js (default) + Classes may not have private methods. at (61, 2) to (70, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-empty.js (strict mode) + Classes may not have private methods. at (59, 2) to (62, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-empty.js (default) + Classes may not have private methods. at (59, 2) to (62, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (60, 2) to (63, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (60, 2) to (63, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (60, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js (default) + Classes may not have private methods. at (60, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (60, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (60, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (60, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (60, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (61, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (61, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-skipped.js (strict mode) + Classes may not have private methods. at (60, 2) to (67, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-skipped.js (default) + Classes may not have private methods. at (60, 2) to (67, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (54, 2) to (57, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-trailing-comma.js (default) + Classes may not have private methods. at (54, 2) to (57, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary-init.js (strict mode) + Classes may not have private methods. at (57, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary-init.js (default) + Classes may not have private methods. at (57, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js (strict mode) + Classes may not have private methods. at (54, 2) to (57, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js (default) + Classes may not have private methods. at (54, 2) to (57, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary.js (strict mode) + Classes may not have private methods. at (55, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary.js (default) + Classes may not have private methods. at (55, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js (strict mode) + Classes may not have private methods. at (59, 2) to (79, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js (default) + Classes may not have private methods. at (59, 2) to (79, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-init.js (strict mode) + Classes may not have private methods. at (54, 2) to (60, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-init.js (default) + Classes may not have private methods. at (54, 2) to (60, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (54, 2) to (61, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js (default) + Classes may not have private methods. at (54, 2) to (61, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id.js (strict mode) + Classes may not have private methods. at (54, 2) to (60, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id.js (default) + Classes may not have private methods. at (54, 2) to (60, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-obj-init.js (strict mode) + Classes may not have private methods. at (57, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-obj-init.js (default) + Classes may not have private methods. at (57, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-obj.js (strict mode) + Classes may not have private methods. at (55, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-obj.js (default) + Classes may not have private methods. at (55, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-getter.js (strict mode) + Classes may not have private methods. at (49, 2) to (59, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-getter.js (default) + Classes may not have private methods. at (49, 2) to (59, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js (strict mode) + Classes may not have private methods. at (50, 2) to (67, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js (default) + Classes may not have private methods. at (50, 2) to (67, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-val-obj.js (strict mode) + Classes may not have private methods. at (48, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-val-obj.js (default) + Classes may not have private methods. at (48, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-empty.js (strict mode) + Classes may not have private methods. at (59, 2) to (62, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-empty.js (default) + Classes may not have private methods. at (59, 2) to (62, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (60, 2) to (63, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (60, 2) to (63, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (60, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-class.js (default) + Classes may not have private methods. at (60, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (60, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (60, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (60, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (60, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (61, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (61, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-skipped.js (strict mode) + Classes may not have private methods. at (60, 2) to (67, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-skipped.js (default) + Classes may not have private methods. at (60, 2) to (67, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (54, 2) to (57, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-trailing-comma.js (default) + Classes may not have private methods. at (54, 2) to (57, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary-init.js (strict mode) + Classes may not have private methods. at (57, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary-init.js (default) + Classes may not have private methods. at (57, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary-trailing-comma.js (strict mode) + Classes may not have private methods. at (54, 2) to (57, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary-trailing-comma.js (default) + Classes may not have private methods. at (54, 2) to (57, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary.js (strict mode) + Classes may not have private methods. at (55, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary.js (default) + Classes may not have private methods. at (55, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-init-skipped.js (strict mode) + Classes may not have private methods. at (59, 2) to (79, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-init-skipped.js (default) + Classes may not have private methods. at (59, 2) to (79, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-init.js (strict mode) + Classes may not have private methods. at (54, 2) to (60, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-init.js (default) + Classes may not have private methods. at (54, 2) to (60, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (54, 2) to (61, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-trailing-comma.js (default) + Classes may not have private methods. at (54, 2) to (61, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-id.js (strict mode) + Classes may not have private methods. at (54, 2) to (60, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-id.js (default) + Classes may not have private methods. at (54, 2) to (60, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-obj-init.js (strict mode) + Classes may not have private methods. at (57, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-obj-init.js (default) + Classes may not have private methods. at (57, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-obj.js (strict mode) + Classes may not have private methods. at (55, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-obj.js (default) + Classes may not have private methods. at (55, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-rest-getter.js (strict mode) + Classes may not have private methods. at (49, 2) to (59, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-rest-getter.js (default) + Classes may not have private methods. at (49, 2) to (59, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-rest-skip-non-enumerable.js (strict mode) + Classes may not have private methods. at (50, 2) to (67, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-rest-skip-non-enumerable.js (default) + Classes may not have private methods. at (50, 2) to (67, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-rest-val-obj.js (strict mode) + Classes may not have private methods. at (48, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-rest-val-obj.js (default) + Classes may not have private methods. at (48, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-init-iter-close.js (strict mode) + Classes may not have private methods. at (70, 2) to (73, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-init-iter-close.js (default) + Classes may not have private methods. at (70, 2) to (73, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-init-iter-no-close.js (strict mode) + Classes may not have private methods. at (70, 2) to (73, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-init-iter-no-close.js (default) + Classes may not have private methods. at (70, 2) to (73, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-name-iter-val.js (strict mode) + Classes may not have private methods. at (67, 2) to (72, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-name-iter-val.js (default) + Classes may not have private methods. at (67, 2) to (72, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elem-init.js (strict mode) + Classes may not have private methods. at (59, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elem-init.js (default) + Classes may not have private methods. at (59, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js (strict mode) + Classes may not have private methods. at (60, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js (default) + Classes may not have private methods. at (60, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elision-init.js (strict mode) + Classes may not have private methods. at (67, 2) to (71, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elision-init.js (default) + Classes may not have private methods. at (67, 2) to (71, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elision-iter.js (strict mode) + Classes may not have private methods. at (65, 2) to (68, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elision-iter.js (default) + Classes may not have private methods. at (65, 2) to (68, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-empty-init.js (strict mode) + Classes may not have private methods. at (63, 2) to (67, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-empty-init.js (default) + Classes may not have private methods. at (63, 2) to (67, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-empty-iter.js (strict mode) + Classes may not have private methods. at (61, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-empty-iter.js (default) + Classes may not have private methods. at (61, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-rest-init.js (strict mode) + Classes may not have private methods. at (60, 2) to (68, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-rest-init.js (default) + Classes may not have private methods. at (60, 2) to (68, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js (strict mode) + Classes may not have private methods. at (62, 2) to (71, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js (default) + Classes may not have private methods. at (62, 2) to (71, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-exhausted.js (strict mode) + Classes may not have private methods. at (60, 2) to (63, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-exhausted.js (default) + Classes may not have private methods. at (60, 2) to (63, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (61, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (61, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (61, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js (default) + Classes may not have private methods. at (61, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (61, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (61, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (61, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (61, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (62, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (62, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-hole.js (strict mode) + Classes may not have private methods. at (55, 2) to (59, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-hole.js (default) + Classes may not have private methods. at (55, 2) to (59, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-skipped.js (strict mode) + Classes may not have private methods. at (61, 2) to (68, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-skipped.js (default) + Classes may not have private methods. at (61, 2) to (68, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-undef.js (strict mode) + Classes may not have private methods. at (59, 2) to (62, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-undef.js (default) + Classes may not have private methods. at (59, 2) to (62, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-complete.js (strict mode) + Classes may not have private methods. at (63, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-complete.js (default) + Classes may not have private methods. at (63, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-done.js (strict mode) + Classes may not have private methods. at (58, 2) to (61, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-done.js (default) + Classes may not have private methods. at (58, 2) to (61, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-val.js (strict mode) + Classes may not have private methods. at (67, 2) to (72, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-val.js (default) + Classes may not have private methods. at (67, 2) to (72, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-id-init.js (strict mode) + Classes may not have private methods. at (59, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-id-init.js (default) + Classes may not have private methods. at (59, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-id.js (strict mode) + Classes may not have private methods. at (59, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-id.js (default) + Classes may not have private methods. at (59, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js (strict mode) + Classes may not have private methods. at (59, 2) to (74, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js (default) + Classes may not have private methods. at (59, 2) to (74, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-prop-id.js (strict mode) + Classes may not have private methods. at (59, 2) to (74, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-prop-id.js (default) + Classes may not have private methods. at (59, 2) to (74, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elision-exhausted.js (strict mode) + Classes may not have private methods. at (66, 2) to (69, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elision-exhausted.js (default) + Classes may not have private methods. at (66, 2) to (69, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elision.js (strict mode) + Classes may not have private methods. at (74, 2) to (78, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elision.js (default) + Classes may not have private methods. at (74, 2) to (78, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-empty.js (strict mode) + Classes may not have private methods. at (58, 2) to (61, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-empty.js (default) + Classes may not have private methods. at (58, 2) to (61, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-elem.js (strict mode) + Classes may not have private methods. at (80, 2) to (85, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-elem.js (default) + Classes may not have private methods. at (80, 2) to (85, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-elision.js (strict mode) + Classes may not have private methods. at (87, 2) to (91, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-elision.js (default) + Classes may not have private methods. at (87, 2) to (91, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-empty.js (strict mode) + Classes may not have private methods. at (71, 2) to (74, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-empty.js (default) + Classes may not have private methods. at (71, 2) to (74, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-rest.js (strict mode) + Classes may not have private methods. at (61, 2) to (70, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-rest.js (default) + Classes may not have private methods. at (61, 2) to (70, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id-elision.js (strict mode) + Classes may not have private methods. at (58, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id-elision.js (default) + Classes may not have private methods. at (58, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id-exhausted.js (strict mode) + Classes may not have private methods. at (58, 2) to (62, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id-exhausted.js (default) + Classes may not have private methods. at (58, 2) to (62, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id.js (strict mode) + Classes may not have private methods. at (55, 2) to (63, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id.js (default) + Classes may not have private methods. at (55, 2) to (63, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-obj-id.js (strict mode) + Classes may not have private methods. at (60, 2) to (63, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-obj-id.js (default) + Classes may not have private methods. at (60, 2) to (63, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-obj-prop-id.js (strict mode) + Classes may not have private methods. at (61, 2) to (70, 3) +language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-obj-prop-id.js (default) + Classes may not have private methods. at (61, 2) to (70, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-init-iter-close.js (strict mode) + Classes may not have private methods. at (70, 2) to (73, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-init-iter-close.js (default) + Classes may not have private methods. at (70, 2) to (73, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-init-iter-no-close.js (strict mode) + Classes may not have private methods. at (70, 2) to (73, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-init-iter-no-close.js (default) + Classes may not have private methods. at (70, 2) to (73, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-name-iter-val.js (strict mode) + Classes may not have private methods. at (67, 2) to (72, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-name-iter-val.js (default) + Classes may not have private methods. at (67, 2) to (72, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js (strict mode) + Classes may not have private methods. at (59, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js (default) + Classes may not have private methods. at (59, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js (strict mode) + Classes may not have private methods. at (60, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js (default) + Classes may not have private methods. at (60, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js (strict mode) + Classes may not have private methods. at (67, 2) to (71, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js (default) + Classes may not have private methods. at (67, 2) to (71, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js (strict mode) + Classes may not have private methods. at (65, 2) to (68, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js (default) + Classes may not have private methods. at (65, 2) to (68, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js (strict mode) + Classes may not have private methods. at (63, 2) to (67, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js (default) + Classes may not have private methods. at (63, 2) to (67, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js (strict mode) + Classes may not have private methods. at (61, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js (default) + Classes may not have private methods. at (61, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js (strict mode) + Classes may not have private methods. at (60, 2) to (68, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js (default) + Classes may not have private methods. at (60, 2) to (68, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js (strict mode) + Classes may not have private methods. at (62, 2) to (71, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js (default) + Classes may not have private methods. at (62, 2) to (71, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js (strict mode) + Classes may not have private methods. at (60, 2) to (63, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js (default) + Classes may not have private methods. at (60, 2) to (63, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (61, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (61, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (61, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js (default) + Classes may not have private methods. at (61, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (61, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (61, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (61, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (61, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (62, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (62, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js (strict mode) + Classes may not have private methods. at (55, 2) to (59, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js (default) + Classes may not have private methods. at (55, 2) to (59, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js (strict mode) + Classes may not have private methods. at (61, 2) to (68, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js (default) + Classes may not have private methods. at (61, 2) to (68, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js (strict mode) + Classes may not have private methods. at (59, 2) to (62, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js (default) + Classes may not have private methods. at (59, 2) to (62, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js (strict mode) + Classes may not have private methods. at (63, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js (default) + Classes may not have private methods. at (63, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js (strict mode) + Classes may not have private methods. at (58, 2) to (61, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js (default) + Classes may not have private methods. at (58, 2) to (61, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js (strict mode) + Classes may not have private methods. at (67, 2) to (72, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js (default) + Classes may not have private methods. at (67, 2) to (72, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js (strict mode) + Classes may not have private methods. at (59, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js (default) + Classes may not have private methods. at (59, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js (strict mode) + Classes may not have private methods. at (59, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js (default) + Classes may not have private methods. at (59, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js (strict mode) + Classes may not have private methods. at (59, 2) to (74, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js (default) + Classes may not have private methods. at (59, 2) to (74, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js (strict mode) + Classes may not have private methods. at (59, 2) to (74, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js (default) + Classes may not have private methods. at (59, 2) to (74, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elision-exhausted.js (strict mode) + Classes may not have private methods. at (66, 2) to (69, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elision-exhausted.js (default) + Classes may not have private methods. at (66, 2) to (69, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elision.js (strict mode) + Classes may not have private methods. at (74, 2) to (78, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elision.js (default) + Classes may not have private methods. at (74, 2) to (78, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-empty.js (strict mode) + Classes may not have private methods. at (58, 2) to (61, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-empty.js (default) + Classes may not have private methods. at (58, 2) to (61, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js (strict mode) + Classes may not have private methods. at (80, 2) to (85, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js (default) + Classes may not have private methods. at (80, 2) to (85, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js (strict mode) + Classes may not have private methods. at (87, 2) to (91, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js (default) + Classes may not have private methods. at (87, 2) to (91, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js (strict mode) + Classes may not have private methods. at (71, 2) to (74, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js (default) + Classes may not have private methods. at (71, 2) to (74, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js (strict mode) + Classes may not have private methods. at (61, 2) to (70, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js (default) + Classes may not have private methods. at (61, 2) to (70, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id-elision.js (strict mode) + Classes may not have private methods. at (58, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id-elision.js (default) + Classes may not have private methods. at (58, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js (strict mode) + Classes may not have private methods. at (58, 2) to (62, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js (default) + Classes may not have private methods. at (58, 2) to (62, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id.js (strict mode) + Classes may not have private methods. at (55, 2) to (63, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id.js (default) + Classes may not have private methods. at (55, 2) to (63, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js (strict mode) + Classes may not have private methods. at (60, 2) to (63, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js (default) + Classes may not have private methods. at (60, 2) to (63, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js (strict mode) + Classes may not have private methods. at (61, 2) to (70, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js (default) + Classes may not have private methods. at (61, 2) to (70, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-empty.js (strict mode) + Classes may not have private methods. at (59, 2) to (62, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-empty.js (default) + Classes may not have private methods. at (59, 2) to (62, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (60, 2) to (63, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (60, 2) to (63, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (60, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js (default) + Classes may not have private methods. at (60, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (60, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (60, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (60, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (60, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (61, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (61, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-skipped.js (strict mode) + Classes may not have private methods. at (60, 2) to (67, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-skipped.js (default) + Classes may not have private methods. at (60, 2) to (67, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (54, 2) to (57, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js (default) + Classes may not have private methods. at (54, 2) to (57, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js (strict mode) + Classes may not have private methods. at (57, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js (default) + Classes may not have private methods. at (57, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js (strict mode) + Classes may not have private methods. at (54, 2) to (57, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js (default) + Classes may not have private methods. at (54, 2) to (57, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary.js (strict mode) + Classes may not have private methods. at (55, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary.js (default) + Classes may not have private methods. at (55, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js (strict mode) + Classes may not have private methods. at (59, 2) to (79, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js (default) + Classes may not have private methods. at (59, 2) to (79, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-init.js (strict mode) + Classes may not have private methods. at (54, 2) to (60, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-init.js (default) + Classes may not have private methods. at (54, 2) to (60, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (54, 2) to (61, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js (default) + Classes may not have private methods. at (54, 2) to (61, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id.js (strict mode) + Classes may not have private methods. at (54, 2) to (60, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id.js (default) + Classes may not have private methods. at (54, 2) to (60, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js (strict mode) + Classes may not have private methods. at (57, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js (default) + Classes may not have private methods. at (57, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-obj.js (strict mode) + Classes may not have private methods. at (55, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-obj.js (default) + Classes may not have private methods. at (55, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-getter.js (strict mode) + Classes may not have private methods. at (49, 2) to (59, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-getter.js (default) + Classes may not have private methods. at (49, 2) to (59, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js (strict mode) + Classes may not have private methods. at (50, 2) to (67, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js (default) + Classes may not have private methods. at (50, 2) to (67, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js (strict mode) + Classes may not have private methods. at (48, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js (default) + Classes may not have private methods. at (48, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-empty.js (strict mode) + Classes may not have private methods. at (59, 2) to (62, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-empty.js (default) + Classes may not have private methods. at (59, 2) to (62, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (60, 2) to (63, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (60, 2) to (63, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (60, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-class.js (default) + Classes may not have private methods. at (60, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (60, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (60, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (60, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (60, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (61, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (61, 2) to (65, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-skipped.js (strict mode) + Classes may not have private methods. at (60, 2) to (67, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-skipped.js (default) + Classes may not have private methods. at (60, 2) to (67, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (54, 2) to (57, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-trailing-comma.js (default) + Classes may not have private methods. at (54, 2) to (57, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary-init.js (strict mode) + Classes may not have private methods. at (57, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary-init.js (default) + Classes may not have private methods. at (57, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js (strict mode) + Classes may not have private methods. at (54, 2) to (57, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js (default) + Classes may not have private methods. at (54, 2) to (57, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary.js (strict mode) + Classes may not have private methods. at (55, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary.js (default) + Classes may not have private methods. at (55, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-init-skipped.js (strict mode) + Classes may not have private methods. at (59, 2) to (79, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-init-skipped.js (default) + Classes may not have private methods. at (59, 2) to (79, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-init.js (strict mode) + Classes may not have private methods. at (54, 2) to (60, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-init.js (default) + Classes may not have private methods. at (54, 2) to (60, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (54, 2) to (61, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-trailing-comma.js (default) + Classes may not have private methods. at (54, 2) to (61, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id.js (strict mode) + Classes may not have private methods. at (54, 2) to (60, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id.js (default) + Classes may not have private methods. at (54, 2) to (60, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-obj-init.js (strict mode) + Classes may not have private methods. at (57, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-obj-init.js (default) + Classes may not have private methods. at (57, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-obj.js (strict mode) + Classes may not have private methods. at (55, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-obj.js (default) + Classes may not have private methods. at (55, 2) to (64, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-getter.js (strict mode) + Classes may not have private methods. at (49, 2) to (59, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-getter.js (default) + Classes may not have private methods. at (49, 2) to (59, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js (strict mode) + Classes may not have private methods. at (50, 2) to (67, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js (default) + Classes may not have private methods. at (50, 2) to (67, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-val-obj.js (strict mode) + Classes may not have private methods. at (48, 2) to (66, 3) +language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-val-obj.js (default) + Classes may not have private methods. at (48, 2) to (66, 3) +language/expressions/class/dstr/private-gen-meth-ary-init-iter-close.js (strict mode) + Classes may not have private methods. at (89, 2) to (92, 3) +language/expressions/class/dstr/private-gen-meth-ary-init-iter-close.js (default) + Classes may not have private methods. at (89, 2) to (92, 3) +language/expressions/class/dstr/private-gen-meth-ary-init-iter-no-close.js (strict mode) + Classes may not have private methods. at (89, 2) to (92, 3) +language/expressions/class/dstr/private-gen-meth-ary-init-iter-no-close.js (default) + Classes may not have private methods. at (89, 2) to (92, 3) +language/expressions/class/dstr/private-gen-meth-ary-name-iter-val.js (strict mode) + Classes may not have private methods. at (86, 2) to (91, 3) +language/expressions/class/dstr/private-gen-meth-ary-name-iter-val.js (default) + Classes may not have private methods. at (86, 2) to (91, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elem-init.js (strict mode) + Classes may not have private methods. at (78, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elem-init.js (default) + Classes may not have private methods. at (78, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elem-iter.js (strict mode) + Classes may not have private methods. at (79, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elem-iter.js (default) + Classes may not have private methods. at (79, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elision-init.js (strict mode) + Classes may not have private methods. at (86, 2) to (90, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elision-init.js (default) + Classes may not have private methods. at (86, 2) to (90, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elision-iter.js (strict mode) + Classes may not have private methods. at (84, 2) to (87, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elision-iter.js (default) + Classes may not have private methods. at (84, 2) to (87, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-empty-init.js (strict mode) + Classes may not have private methods. at (82, 2) to (86, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-empty-init.js (default) + Classes may not have private methods. at (82, 2) to (86, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-empty-iter.js (strict mode) + Classes may not have private methods. at (80, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-empty-iter.js (default) + Classes may not have private methods. at (80, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-rest-init.js (strict mode) + Classes may not have private methods. at (79, 2) to (87, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-rest-init.js (default) + Classes may not have private methods. at (79, 2) to (87, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-rest-iter.js (strict mode) + Classes may not have private methods. at (81, 2) to (90, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-rest-iter.js (default) + Classes may not have private methods. at (81, 2) to (90, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-exhausted.js (strict mode) + Classes may not have private methods. at (79, 2) to (82, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-exhausted.js (default) + Classes may not have private methods. at (79, 2) to (82, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (80, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (80, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (80, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js (default) + Classes may not have private methods. at (80, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (80, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (80, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (80, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (80, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (81, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (81, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-hole.js (strict mode) + Classes may not have private methods. at (74, 2) to (78, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-hole.js (default) + Classes may not have private methods. at (74, 2) to (78, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-skipped.js (strict mode) + Classes may not have private methods. at (80, 2) to (87, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-skipped.js (default) + Classes may not have private methods. at (80, 2) to (87, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-undef.js (strict mode) + Classes may not have private methods. at (78, 2) to (81, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-undef.js (default) + Classes may not have private methods. at (78, 2) to (81, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-complete.js (strict mode) + Classes may not have private methods. at (82, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-complete.js (default) + Classes may not have private methods. at (82, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-done.js (strict mode) + Classes may not have private methods. at (77, 2) to (80, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-done.js (default) + Classes may not have private methods. at (77, 2) to (80, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-val.js (strict mode) + Classes may not have private methods. at (86, 2) to (91, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-val.js (default) + Classes may not have private methods. at (86, 2) to (91, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-obj-id-init.js (strict mode) + Classes may not have private methods. at (78, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-obj-id-init.js (default) + Classes may not have private methods. at (78, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-obj-id.js (strict mode) + Classes may not have private methods. at (78, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-obj-id.js (default) + Classes may not have private methods. at (78, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-obj-prop-id-init.js (strict mode) + Classes may not have private methods. at (78, 2) to (93, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-obj-prop-id-init.js (default) + Classes may not have private methods. at (78, 2) to (93, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-obj-prop-id.js (strict mode) + Classes may not have private methods. at (78, 2) to (93, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-obj-prop-id.js (default) + Classes may not have private methods. at (78, 2) to (93, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elision-exhausted.js (strict mode) + Classes may not have private methods. at (85, 2) to (88, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elision-exhausted.js (default) + Classes may not have private methods. at (85, 2) to (88, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elision.js (strict mode) + Classes may not have private methods. at (93, 2) to (97, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-elision.js (default) + Classes may not have private methods. at (93, 2) to (97, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-empty.js (strict mode) + Classes may not have private methods. at (77, 2) to (80, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-empty.js (default) + Classes may not have private methods. at (77, 2) to (80, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-ary-elem.js (strict mode) + Classes may not have private methods. at (99, 2) to (104, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-ary-elem.js (default) + Classes may not have private methods. at (99, 2) to (104, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-ary-elision.js (strict mode) + Classes may not have private methods. at (106, 2) to (110, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-ary-elision.js (default) + Classes may not have private methods. at (106, 2) to (110, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-ary-empty.js (strict mode) + Classes may not have private methods. at (90, 2) to (93, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-ary-empty.js (default) + Classes may not have private methods. at (90, 2) to (93, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-ary-rest.js (strict mode) + Classes may not have private methods. at (80, 2) to (89, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-ary-rest.js (default) + Classes may not have private methods. at (80, 2) to (89, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-id-elision.js (strict mode) + Classes may not have private methods. at (77, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-id-elision.js (default) + Classes may not have private methods. at (77, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-id-exhausted.js (strict mode) + Classes may not have private methods. at (77, 2) to (81, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-id-exhausted.js (default) + Classes may not have private methods. at (77, 2) to (81, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-id.js (strict mode) + Classes may not have private methods. at (74, 2) to (82, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-id.js (default) + Classes may not have private methods. at (74, 2) to (82, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-obj-id.js (strict mode) + Classes may not have private methods. at (79, 2) to (82, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-obj-id.js (default) + Classes may not have private methods. at (79, 2) to (82, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-obj-prop-id.js (strict mode) + Classes may not have private methods. at (80, 2) to (89, 3) +language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-obj-prop-id.js (default) + Classes may not have private methods. at (80, 2) to (89, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-init-iter-close.js (strict mode) + Classes may not have private methods. at (89, 2) to (92, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-init-iter-close.js (default) + Classes may not have private methods. at (89, 2) to (92, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-init-iter-no-close.js (strict mode) + Classes may not have private methods. at (89, 2) to (92, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-init-iter-no-close.js (default) + Classes may not have private methods. at (89, 2) to (92, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-name-iter-val.js (strict mode) + Classes may not have private methods. at (86, 2) to (91, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-name-iter-val.js (default) + Classes may not have private methods. at (86, 2) to (91, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js (strict mode) + Classes may not have private methods. at (78, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js (default) + Classes may not have private methods. at (78, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js (strict mode) + Classes may not have private methods. at (79, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js (default) + Classes may not have private methods. at (79, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js (strict mode) + Classes may not have private methods. at (86, 2) to (90, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js (default) + Classes may not have private methods. at (86, 2) to (90, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js (strict mode) + Classes may not have private methods. at (84, 2) to (87, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js (default) + Classes may not have private methods. at (84, 2) to (87, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js (strict mode) + Classes may not have private methods. at (82, 2) to (86, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js (default) + Classes may not have private methods. at (82, 2) to (86, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js (strict mode) + Classes may not have private methods. at (80, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js (default) + Classes may not have private methods. at (80, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js (strict mode) + Classes may not have private methods. at (79, 2) to (87, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js (default) + Classes may not have private methods. at (79, 2) to (87, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js (strict mode) + Classes may not have private methods. at (81, 2) to (90, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js (default) + Classes may not have private methods. at (81, 2) to (90, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js (strict mode) + Classes may not have private methods. at (79, 2) to (82, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js (default) + Classes may not have private methods. at (79, 2) to (82, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (80, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (80, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (80, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js (default) + Classes may not have private methods. at (80, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (80, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (80, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (80, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (80, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (81, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (81, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js (strict mode) + Classes may not have private methods. at (74, 2) to (78, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js (default) + Classes may not have private methods. at (74, 2) to (78, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js (strict mode) + Classes may not have private methods. at (80, 2) to (87, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js (default) + Classes may not have private methods. at (80, 2) to (87, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js (strict mode) + Classes may not have private methods. at (78, 2) to (81, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js (default) + Classes may not have private methods. at (78, 2) to (81, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js (strict mode) + Classes may not have private methods. at (82, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js (default) + Classes may not have private methods. at (82, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js (strict mode) + Classes may not have private methods. at (77, 2) to (80, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js (default) + Classes may not have private methods. at (77, 2) to (80, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js (strict mode) + Classes may not have private methods. at (86, 2) to (91, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js (default) + Classes may not have private methods. at (86, 2) to (91, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js (strict mode) + Classes may not have private methods. at (78, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js (default) + Classes may not have private methods. at (78, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-id.js (strict mode) + Classes may not have private methods. at (78, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-id.js (default) + Classes may not have private methods. at (78, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js (strict mode) + Classes may not have private methods. at (78, 2) to (93, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js (default) + Classes may not have private methods. at (78, 2) to (93, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js (strict mode) + Classes may not have private methods. at (78, 2) to (93, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js (default) + Classes may not have private methods. at (78, 2) to (93, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elision-exhausted.js (strict mode) + Classes may not have private methods. at (85, 2) to (88, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elision-exhausted.js (default) + Classes may not have private methods. at (85, 2) to (88, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elision.js (strict mode) + Classes may not have private methods. at (93, 2) to (97, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elision.js (default) + Classes may not have private methods. at (93, 2) to (97, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-empty.js (strict mode) + Classes may not have private methods. at (77, 2) to (80, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-empty.js (default) + Classes may not have private methods. at (77, 2) to (80, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-elem.js (strict mode) + Classes may not have private methods. at (99, 2) to (104, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-elem.js (default) + Classes may not have private methods. at (99, 2) to (104, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-elision.js (strict mode) + Classes may not have private methods. at (106, 2) to (110, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-elision.js (default) + Classes may not have private methods. at (106, 2) to (110, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-empty.js (strict mode) + Classes may not have private methods. at (90, 2) to (93, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-empty.js (default) + Classes may not have private methods. at (90, 2) to (93, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-rest.js (strict mode) + Classes may not have private methods. at (80, 2) to (89, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-rest.js (default) + Classes may not have private methods. at (80, 2) to (89, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id-elision.js (strict mode) + Classes may not have private methods. at (77, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id-elision.js (default) + Classes may not have private methods. at (77, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js (strict mode) + Classes may not have private methods. at (77, 2) to (81, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js (default) + Classes may not have private methods. at (77, 2) to (81, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id.js (strict mode) + Classes may not have private methods. at (74, 2) to (82, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id.js (default) + Classes may not have private methods. at (74, 2) to (82, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-obj-id.js (strict mode) + Classes may not have private methods. at (79, 2) to (82, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-obj-id.js (default) + Classes may not have private methods. at (79, 2) to (82, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js (strict mode) + Classes may not have private methods. at (80, 2) to (89, 3) +language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js (default) + Classes may not have private methods. at (80, 2) to (89, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-empty.js (strict mode) + Classes may not have private methods. at (78, 2) to (81, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-empty.js (default) + Classes may not have private methods. at (78, 2) to (81, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (79, 2) to (82, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (79, 2) to (82, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (79, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js (default) + Classes may not have private methods. at (79, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (79, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (79, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (79, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (79, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (80, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (80, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-skipped.js (strict mode) + Classes may not have private methods. at (79, 2) to (86, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-skipped.js (default) + Classes may not have private methods. at (79, 2) to (86, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (73, 2) to (76, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-trailing-comma.js (default) + Classes may not have private methods. at (73, 2) to (76, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary-init.js (strict mode) + Classes may not have private methods. at (76, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary-init.js (default) + Classes may not have private methods. at (76, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js (strict mode) + Classes may not have private methods. at (73, 2) to (76, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js (default) + Classes may not have private methods. at (73, 2) to (76, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary.js (strict mode) + Classes may not have private methods. at (74, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary.js (default) + Classes may not have private methods. at (74, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js (strict mode) + Classes may not have private methods. at (78, 2) to (98, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js (default) + Classes may not have private methods. at (78, 2) to (98, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-init.js (strict mode) + Classes may not have private methods. at (73, 2) to (79, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-init.js (default) + Classes may not have private methods. at (73, 2) to (79, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (73, 2) to (80, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js (default) + Classes may not have private methods. at (73, 2) to (80, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id.js (strict mode) + Classes may not have private methods. at (73, 2) to (79, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id.js (default) + Classes may not have private methods. at (73, 2) to (79, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-obj-init.js (strict mode) + Classes may not have private methods. at (76, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-obj-init.js (default) + Classes may not have private methods. at (76, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-obj.js (strict mode) + Classes may not have private methods. at (74, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-obj.js (default) + Classes may not have private methods. at (74, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-getter.js (strict mode) + Classes may not have private methods. at (68, 2) to (78, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-getter.js (default) + Classes may not have private methods. at (68, 2) to (78, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js (strict mode) + Classes may not have private methods. at (69, 2) to (86, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js (default) + Classes may not have private methods. at (69, 2) to (86, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-val-obj.js (strict mode) + Classes may not have private methods. at (67, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-val-obj.js (default) + Classes may not have private methods. at (67, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-empty.js (strict mode) + Classes may not have private methods. at (78, 2) to (81, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-empty.js (default) + Classes may not have private methods. at (78, 2) to (81, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (79, 2) to (82, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (79, 2) to (82, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (79, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-class.js (default) + Classes may not have private methods. at (79, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (79, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (79, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (79, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (79, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (80, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (80, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-skipped.js (strict mode) + Classes may not have private methods. at (79, 2) to (86, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-skipped.js (default) + Classes may not have private methods. at (79, 2) to (86, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (73, 2) to (76, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-trailing-comma.js (default) + Classes may not have private methods. at (73, 2) to (76, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-ary-init.js (strict mode) + Classes may not have private methods. at (76, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-ary-init.js (default) + Classes may not have private methods. at (76, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-ary-trailing-comma.js (strict mode) + Classes may not have private methods. at (73, 2) to (76, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-ary-trailing-comma.js (default) + Classes may not have private methods. at (73, 2) to (76, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-ary.js (strict mode) + Classes may not have private methods. at (74, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-ary.js (default) + Classes may not have private methods. at (74, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-id-init-skipped.js (strict mode) + Classes may not have private methods. at (78, 2) to (98, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-id-init-skipped.js (default) + Classes may not have private methods. at (78, 2) to (98, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-id-init.js (strict mode) + Classes may not have private methods. at (73, 2) to (79, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-id-init.js (default) + Classes may not have private methods. at (73, 2) to (79, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (73, 2) to (80, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-id-trailing-comma.js (default) + Classes may not have private methods. at (73, 2) to (80, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-id.js (strict mode) + Classes may not have private methods. at (73, 2) to (79, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-id.js (default) + Classes may not have private methods. at (73, 2) to (79, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-obj-init.js (strict mode) + Classes may not have private methods. at (76, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-obj-init.js (default) + Classes may not have private methods. at (76, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-obj.js (strict mode) + Classes may not have private methods. at (74, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-obj.js (default) + Classes may not have private methods. at (74, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-rest-getter.js (strict mode) + Classes may not have private methods. at (68, 2) to (78, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-rest-getter.js (default) + Classes may not have private methods. at (68, 2) to (78, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-rest-skip-non-enumerable.js (strict mode) + Classes may not have private methods. at (69, 2) to (86, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-rest-skip-non-enumerable.js (default) + Classes may not have private methods. at (69, 2) to (86, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-rest-val-obj.js (strict mode) + Classes may not have private methods. at (67, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-obj-ptrn-rest-val-obj.js (default) + Classes may not have private methods. at (67, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-init-iter-close.js (strict mode) + Classes may not have private methods. at (89, 2) to (92, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-init-iter-close.js (default) + Classes may not have private methods. at (89, 2) to (92, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-init-iter-no-close.js (strict mode) + Classes may not have private methods. at (89, 2) to (92, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-init-iter-no-close.js (default) + Classes may not have private methods. at (89, 2) to (92, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-name-iter-val.js (strict mode) + Classes may not have private methods. at (86, 2) to (91, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-name-iter-val.js (default) + Classes may not have private methods. at (86, 2) to (91, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elem-init.js (strict mode) + Classes may not have private methods. at (78, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elem-init.js (default) + Classes may not have private methods. at (78, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js (strict mode) + Classes may not have private methods. at (79, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js (default) + Classes may not have private methods. at (79, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elision-init.js (strict mode) + Classes may not have private methods. at (86, 2) to (90, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elision-init.js (default) + Classes may not have private methods. at (86, 2) to (90, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elision-iter.js (strict mode) + Classes may not have private methods. at (84, 2) to (87, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elision-iter.js (default) + Classes may not have private methods. at (84, 2) to (87, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-empty-init.js (strict mode) + Classes may not have private methods. at (82, 2) to (86, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-empty-init.js (default) + Classes may not have private methods. at (82, 2) to (86, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-empty-iter.js (strict mode) + Classes may not have private methods. at (80, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-empty-iter.js (default) + Classes may not have private methods. at (80, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-rest-init.js (strict mode) + Classes may not have private methods. at (79, 2) to (87, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-rest-init.js (default) + Classes may not have private methods. at (79, 2) to (87, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js (strict mode) + Classes may not have private methods. at (81, 2) to (90, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js (default) + Classes may not have private methods. at (81, 2) to (90, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-exhausted.js (strict mode) + Classes may not have private methods. at (79, 2) to (82, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-exhausted.js (default) + Classes may not have private methods. at (79, 2) to (82, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (80, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (80, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (80, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js (default) + Classes may not have private methods. at (80, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (80, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (80, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (80, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (80, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (81, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (81, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-hole.js (strict mode) + Classes may not have private methods. at (74, 2) to (78, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-hole.js (default) + Classes may not have private methods. at (74, 2) to (78, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-skipped.js (strict mode) + Classes may not have private methods. at (80, 2) to (87, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-skipped.js (default) + Classes may not have private methods. at (80, 2) to (87, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-undef.js (strict mode) + Classes may not have private methods. at (78, 2) to (81, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-undef.js (default) + Classes may not have private methods. at (78, 2) to (81, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-complete.js (strict mode) + Classes may not have private methods. at (82, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-complete.js (default) + Classes may not have private methods. at (82, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-done.js (strict mode) + Classes may not have private methods. at (77, 2) to (80, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-done.js (default) + Classes may not have private methods. at (77, 2) to (80, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-val.js (strict mode) + Classes may not have private methods. at (86, 2) to (91, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-val.js (default) + Classes may not have private methods. at (86, 2) to (91, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-id-init.js (strict mode) + Classes may not have private methods. at (78, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-id-init.js (default) + Classes may not have private methods. at (78, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-id.js (strict mode) + Classes may not have private methods. at (78, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-id.js (default) + Classes may not have private methods. at (78, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js (strict mode) + Classes may not have private methods. at (78, 2) to (93, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js (default) + Classes may not have private methods. at (78, 2) to (93, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-prop-id.js (strict mode) + Classes may not have private methods. at (78, 2) to (93, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-prop-id.js (default) + Classes may not have private methods. at (78, 2) to (93, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elision-exhausted.js (strict mode) + Classes may not have private methods. at (85, 2) to (88, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elision-exhausted.js (default) + Classes may not have private methods. at (85, 2) to (88, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elision.js (strict mode) + Classes may not have private methods. at (93, 2) to (97, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elision.js (default) + Classes may not have private methods. at (93, 2) to (97, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-empty.js (strict mode) + Classes may not have private methods. at (77, 2) to (80, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-empty.js (default) + Classes may not have private methods. at (77, 2) to (80, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-elem.js (strict mode) + Classes may not have private methods. at (99, 2) to (104, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-elem.js (default) + Classes may not have private methods. at (99, 2) to (104, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-elision.js (strict mode) + Classes may not have private methods. at (106, 2) to (110, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-elision.js (default) + Classes may not have private methods. at (106, 2) to (110, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-empty.js (strict mode) + Classes may not have private methods. at (90, 2) to (93, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-empty.js (default) + Classes may not have private methods. at (90, 2) to (93, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-rest.js (strict mode) + Classes may not have private methods. at (80, 2) to (89, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-rest.js (default) + Classes may not have private methods. at (80, 2) to (89, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-id-elision.js (strict mode) + Classes may not have private methods. at (77, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-id-elision.js (default) + Classes may not have private methods. at (77, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-id-exhausted.js (strict mode) + Classes may not have private methods. at (77, 2) to (81, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-id-exhausted.js (default) + Classes may not have private methods. at (77, 2) to (81, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-id.js (strict mode) + Classes may not have private methods. at (74, 2) to (82, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-id.js (default) + Classes may not have private methods. at (74, 2) to (82, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-obj-id.js (strict mode) + Classes may not have private methods. at (79, 2) to (82, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-obj-id.js (default) + Classes may not have private methods. at (79, 2) to (82, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-obj-prop-id.js (strict mode) + Classes may not have private methods. at (80, 2) to (89, 3) +language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-obj-prop-id.js (default) + Classes may not have private methods. at (80, 2) to (89, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-init-iter-close.js (strict mode) + Classes may not have private methods. at (89, 2) to (92, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-init-iter-close.js (default) + Classes may not have private methods. at (89, 2) to (92, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-init-iter-no-close.js (strict mode) + Classes may not have private methods. at (89, 2) to (92, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-init-iter-no-close.js (default) + Classes may not have private methods. at (89, 2) to (92, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-name-iter-val.js (strict mode) + Classes may not have private methods. at (86, 2) to (91, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-name-iter-val.js (default) + Classes may not have private methods. at (86, 2) to (91, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js (strict mode) + Classes may not have private methods. at (78, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js (default) + Classes may not have private methods. at (78, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js (strict mode) + Classes may not have private methods. at (79, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js (default) + Classes may not have private methods. at (79, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js (strict mode) + Classes may not have private methods. at (86, 2) to (90, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js (default) + Classes may not have private methods. at (86, 2) to (90, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js (strict mode) + Classes may not have private methods. at (84, 2) to (87, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js (default) + Classes may not have private methods. at (84, 2) to (87, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js (strict mode) + Classes may not have private methods. at (82, 2) to (86, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js (default) + Classes may not have private methods. at (82, 2) to (86, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js (strict mode) + Classes may not have private methods. at (80, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js (default) + Classes may not have private methods. at (80, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js (strict mode) + Classes may not have private methods. at (79, 2) to (87, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js (default) + Classes may not have private methods. at (79, 2) to (87, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js (strict mode) + Classes may not have private methods. at (81, 2) to (90, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js (default) + Classes may not have private methods. at (81, 2) to (90, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js (strict mode) + Classes may not have private methods. at (79, 2) to (82, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js (default) + Classes may not have private methods. at (79, 2) to (82, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (80, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (80, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (80, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js (default) + Classes may not have private methods. at (80, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (80, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (80, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (80, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (80, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (81, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (81, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js (strict mode) + Classes may not have private methods. at (74, 2) to (78, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js (default) + Classes may not have private methods. at (74, 2) to (78, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js (strict mode) + Classes may not have private methods. at (80, 2) to (87, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js (default) + Classes may not have private methods. at (80, 2) to (87, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js (strict mode) + Classes may not have private methods. at (78, 2) to (81, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js (default) + Classes may not have private methods. at (78, 2) to (81, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js (strict mode) + Classes may not have private methods. at (82, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js (default) + Classes may not have private methods. at (82, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js (strict mode) + Classes may not have private methods. at (77, 2) to (80, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js (default) + Classes may not have private methods. at (77, 2) to (80, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js (strict mode) + Classes may not have private methods. at (86, 2) to (91, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js (default) + Classes may not have private methods. at (86, 2) to (91, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js (strict mode) + Classes may not have private methods. at (78, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js (default) + Classes may not have private methods. at (78, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js (strict mode) + Classes may not have private methods. at (78, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js (default) + Classes may not have private methods. at (78, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js (strict mode) + Classes may not have private methods. at (78, 2) to (93, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js (default) + Classes may not have private methods. at (78, 2) to (93, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js (strict mode) + Classes may not have private methods. at (78, 2) to (93, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js (default) + Classes may not have private methods. at (78, 2) to (93, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elision-exhausted.js (strict mode) + Classes may not have private methods. at (85, 2) to (88, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elision-exhausted.js (default) + Classes may not have private methods. at (85, 2) to (88, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elision.js (strict mode) + Classes may not have private methods. at (93, 2) to (97, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elision.js (default) + Classes may not have private methods. at (93, 2) to (97, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-empty.js (strict mode) + Classes may not have private methods. at (77, 2) to (80, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-empty.js (default) + Classes may not have private methods. at (77, 2) to (80, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js (strict mode) + Classes may not have private methods. at (99, 2) to (104, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js (default) + Classes may not have private methods. at (99, 2) to (104, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js (strict mode) + Classes may not have private methods. at (106, 2) to (110, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js (default) + Classes may not have private methods. at (106, 2) to (110, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js (strict mode) + Classes may not have private methods. at (90, 2) to (93, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js (default) + Classes may not have private methods. at (90, 2) to (93, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js (strict mode) + Classes may not have private methods. at (80, 2) to (89, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js (default) + Classes may not have private methods. at (80, 2) to (89, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id-elision.js (strict mode) + Classes may not have private methods. at (77, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id-elision.js (default) + Classes may not have private methods. at (77, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js (strict mode) + Classes may not have private methods. at (77, 2) to (81, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js (default) + Classes may not have private methods. at (77, 2) to (81, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id.js (strict mode) + Classes may not have private methods. at (74, 2) to (82, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id.js (default) + Classes may not have private methods. at (74, 2) to (82, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js (strict mode) + Classes may not have private methods. at (79, 2) to (82, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js (default) + Classes may not have private methods. at (79, 2) to (82, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js (strict mode) + Classes may not have private methods. at (80, 2) to (89, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js (default) + Classes may not have private methods. at (80, 2) to (89, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-empty.js (strict mode) + Classes may not have private methods. at (78, 2) to (81, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-empty.js (default) + Classes may not have private methods. at (78, 2) to (81, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (79, 2) to (82, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (79, 2) to (82, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (79, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js (default) + Classes may not have private methods. at (79, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (79, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (79, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (79, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (79, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (80, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (80, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-skipped.js (strict mode) + Classes may not have private methods. at (79, 2) to (86, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-skipped.js (default) + Classes may not have private methods. at (79, 2) to (86, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (73, 2) to (76, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js (default) + Classes may not have private methods. at (73, 2) to (76, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js (strict mode) + Classes may not have private methods. at (76, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js (default) + Classes may not have private methods. at (76, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js (strict mode) + Classes may not have private methods. at (73, 2) to (76, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js (default) + Classes may not have private methods. at (73, 2) to (76, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary.js (strict mode) + Classes may not have private methods. at (74, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary.js (default) + Classes may not have private methods. at (74, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js (strict mode) + Classes may not have private methods. at (78, 2) to (98, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js (default) + Classes may not have private methods. at (78, 2) to (98, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-init.js (strict mode) + Classes may not have private methods. at (73, 2) to (79, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-init.js (default) + Classes may not have private methods. at (73, 2) to (79, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (73, 2) to (80, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js (default) + Classes may not have private methods. at (73, 2) to (80, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id.js (strict mode) + Classes may not have private methods. at (73, 2) to (79, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id.js (default) + Classes may not have private methods. at (73, 2) to (79, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js (strict mode) + Classes may not have private methods. at (76, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js (default) + Classes may not have private methods. at (76, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-obj.js (strict mode) + Classes may not have private methods. at (74, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-obj.js (default) + Classes may not have private methods. at (74, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-getter.js (strict mode) + Classes may not have private methods. at (68, 2) to (78, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-getter.js (default) + Classes may not have private methods. at (68, 2) to (78, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js (strict mode) + Classes may not have private methods. at (69, 2) to (86, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js (default) + Classes may not have private methods. at (69, 2) to (86, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js (strict mode) + Classes may not have private methods. at (67, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js (default) + Classes may not have private methods. at (67, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-empty.js (strict mode) + Classes may not have private methods. at (78, 2) to (81, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-empty.js (default) + Classes may not have private methods. at (78, 2) to (81, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (79, 2) to (82, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (79, 2) to (82, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (79, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-class.js (default) + Classes may not have private methods. at (79, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (79, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (79, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (79, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (79, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (80, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (80, 2) to (84, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-skipped.js (strict mode) + Classes may not have private methods. at (79, 2) to (86, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-skipped.js (default) + Classes may not have private methods. at (79, 2) to (86, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (73, 2) to (76, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-trailing-comma.js (default) + Classes may not have private methods. at (73, 2) to (76, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary-init.js (strict mode) + Classes may not have private methods. at (76, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary-init.js (default) + Classes may not have private methods. at (76, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js (strict mode) + Classes may not have private methods. at (73, 2) to (76, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js (default) + Classes may not have private methods. at (73, 2) to (76, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary.js (strict mode) + Classes may not have private methods. at (74, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary.js (default) + Classes may not have private methods. at (74, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-init-skipped.js (strict mode) + Classes may not have private methods. at (78, 2) to (98, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-init-skipped.js (default) + Classes may not have private methods. at (78, 2) to (98, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-init.js (strict mode) + Classes may not have private methods. at (73, 2) to (79, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-init.js (default) + Classes may not have private methods. at (73, 2) to (79, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (73, 2) to (80, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-trailing-comma.js (default) + Classes may not have private methods. at (73, 2) to (80, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-id.js (strict mode) + Classes may not have private methods. at (73, 2) to (79, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-id.js (default) + Classes may not have private methods. at (73, 2) to (79, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-obj-init.js (strict mode) + Classes may not have private methods. at (76, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-obj-init.js (default) + Classes may not have private methods. at (76, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-obj.js (strict mode) + Classes may not have private methods. at (74, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-obj.js (default) + Classes may not have private methods. at (74, 2) to (83, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-rest-getter.js (strict mode) + Classes may not have private methods. at (68, 2) to (78, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-rest-getter.js (default) + Classes may not have private methods. at (68, 2) to (78, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js (strict mode) + Classes may not have private methods. at (69, 2) to (86, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js (default) + Classes may not have private methods. at (69, 2) to (86, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-rest-val-obj.js (strict mode) + Classes may not have private methods. at (67, 2) to (85, 3) +language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-rest-val-obj.js (default) + Classes may not have private methods. at (67, 2) to (85, 3) +language/expressions/class/dstr/private-meth-ary-init-iter-close.js (strict mode) + Classes may not have private methods. at (86, 2) to (89, 3) +language/expressions/class/dstr/private-meth-ary-init-iter-close.js (default) + Classes may not have private methods. at (86, 2) to (89, 3) +language/expressions/class/dstr/private-meth-ary-init-iter-no-close.js (strict mode) + Classes may not have private methods. at (86, 2) to (89, 3) +language/expressions/class/dstr/private-meth-ary-init-iter-no-close.js (default) + Classes may not have private methods. at (86, 2) to (89, 3) +language/expressions/class/dstr/private-meth-ary-name-iter-val.js (strict mode) + Classes may not have private methods. at (83, 2) to (88, 3) +language/expressions/class/dstr/private-meth-ary-name-iter-val.js (default) + Classes may not have private methods. at (83, 2) to (88, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-elem-init.js (strict mode) + Classes may not have private methods. at (75, 2) to (80, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-elem-init.js (default) + Classes may not have private methods. at (75, 2) to (80, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-elem-iter.js (strict mode) + Classes may not have private methods. at (76, 2) to (81, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-elem-iter.js (default) + Classes may not have private methods. at (76, 2) to (81, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-elision-init.js (strict mode) + Classes may not have private methods. at (83, 2) to (87, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-elision-init.js (default) + Classes may not have private methods. at (83, 2) to (87, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-elision-iter.js (strict mode) + Classes may not have private methods. at (81, 2) to (84, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-elision-iter.js (default) + Classes may not have private methods. at (81, 2) to (84, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-empty-init.js (strict mode) + Classes may not have private methods. at (79, 2) to (83, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-empty-init.js (default) + Classes may not have private methods. at (79, 2) to (83, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-empty-iter.js (strict mode) + Classes may not have private methods. at (77, 2) to (80, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-empty-iter.js (default) + Classes may not have private methods. at (77, 2) to (80, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-rest-init.js (strict mode) + Classes may not have private methods. at (76, 2) to (84, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-rest-init.js (default) + Classes may not have private methods. at (76, 2) to (84, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-rest-iter.js (strict mode) + Classes may not have private methods. at (78, 2) to (87, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-rest-iter.js (default) + Classes may not have private methods. at (78, 2) to (87, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-exhausted.js (strict mode) + Classes may not have private methods. at (76, 2) to (79, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-exhausted.js (default) + Classes may not have private methods. at (76, 2) to (79, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (77, 2) to (80, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (77, 2) to (80, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (77, 2) to (82, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-class.js (default) + Classes may not have private methods. at (77, 2) to (82, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (77, 2) to (81, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (77, 2) to (81, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (77, 2) to (81, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (77, 2) to (81, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (78, 2) to (82, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (78, 2) to (82, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-hole.js (strict mode) + Classes may not have private methods. at (71, 2) to (75, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-hole.js (default) + Classes may not have private methods. at (71, 2) to (75, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-skipped.js (strict mode) + Classes may not have private methods. at (77, 2) to (84, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-skipped.js (default) + Classes may not have private methods. at (77, 2) to (84, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-undef.js (strict mode) + Classes may not have private methods. at (75, 2) to (78, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-undef.js (default) + Classes may not have private methods. at (75, 2) to (78, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-iter-complete.js (strict mode) + Classes may not have private methods. at (79, 2) to (82, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-iter-complete.js (default) + Classes may not have private methods. at (79, 2) to (82, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-iter-done.js (strict mode) + Classes may not have private methods. at (74, 2) to (77, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-iter-done.js (default) + Classes may not have private methods. at (74, 2) to (77, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-iter-val.js (strict mode) + Classes may not have private methods. at (83, 2) to (88, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-iter-val.js (default) + Classes may not have private methods. at (83, 2) to (88, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-obj-id-init.js (strict mode) + Classes may not have private methods. at (75, 2) to (80, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-obj-id-init.js (default) + Classes may not have private methods. at (75, 2) to (80, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-obj-id.js (strict mode) + Classes may not have private methods. at (75, 2) to (80, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-obj-id.js (default) + Classes may not have private methods. at (75, 2) to (80, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-obj-prop-id-init.js (strict mode) + Classes may not have private methods. at (75, 2) to (90, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-obj-prop-id-init.js (default) + Classes may not have private methods. at (75, 2) to (90, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-obj-prop-id.js (strict mode) + Classes may not have private methods. at (75, 2) to (90, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elem-obj-prop-id.js (default) + Classes may not have private methods. at (75, 2) to (90, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elision-exhausted.js (strict mode) + Classes may not have private methods. at (82, 2) to (85, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elision-exhausted.js (default) + Classes may not have private methods. at (82, 2) to (85, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elision.js (strict mode) + Classes may not have private methods. at (90, 2) to (94, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-elision.js (default) + Classes may not have private methods. at (90, 2) to (94, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-empty.js (strict mode) + Classes may not have private methods. at (74, 2) to (77, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-empty.js (default) + Classes may not have private methods. at (74, 2) to (77, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-rest-ary-elem.js (strict mode) + Classes may not have private methods. at (96, 2) to (101, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-rest-ary-elem.js (default) + Classes may not have private methods. at (96, 2) to (101, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-rest-ary-elision.js (strict mode) + Classes may not have private methods. at (103, 2) to (107, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-rest-ary-elision.js (default) + Classes may not have private methods. at (103, 2) to (107, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-rest-ary-empty.js (strict mode) + Classes may not have private methods. at (87, 2) to (90, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-rest-ary-empty.js (default) + Classes may not have private methods. at (87, 2) to (90, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-rest-ary-rest.js (strict mode) + Classes may not have private methods. at (77, 2) to (86, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-rest-ary-rest.js (default) + Classes may not have private methods. at (77, 2) to (86, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-rest-id-elision.js (strict mode) + Classes may not have private methods. at (74, 2) to (82, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-rest-id-elision.js (default) + Classes may not have private methods. at (74, 2) to (82, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-rest-id-exhausted.js (strict mode) + Classes may not have private methods. at (74, 2) to (78, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-rest-id-exhausted.js (default) + Classes may not have private methods. at (74, 2) to (78, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-rest-id.js (strict mode) + Classes may not have private methods. at (71, 2) to (79, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-rest-id.js (default) + Classes may not have private methods. at (71, 2) to (79, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-rest-obj-id.js (strict mode) + Classes may not have private methods. at (76, 2) to (79, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-rest-obj-id.js (default) + Classes may not have private methods. at (76, 2) to (79, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-rest-obj-prop-id.js (strict mode) + Classes may not have private methods. at (77, 2) to (86, 3) +language/expressions/class/dstr/private-meth-ary-ptrn-rest-obj-prop-id.js (default) + Classes may not have private methods. at (77, 2) to (86, 3) +language/expressions/class/dstr/private-meth-dflt-ary-init-iter-close.js (strict mode) + Classes may not have private methods. at (86, 2) to (89, 3) +language/expressions/class/dstr/private-meth-dflt-ary-init-iter-close.js (default) + Classes may not have private methods. at (86, 2) to (89, 3) +language/expressions/class/dstr/private-meth-dflt-ary-init-iter-no-close.js (strict mode) + Classes may not have private methods. at (86, 2) to (89, 3) +language/expressions/class/dstr/private-meth-dflt-ary-init-iter-no-close.js (default) + Classes may not have private methods. at (86, 2) to (89, 3) +language/expressions/class/dstr/private-meth-dflt-ary-name-iter-val.js (strict mode) + Classes may not have private methods. at (83, 2) to (88, 3) +language/expressions/class/dstr/private-meth-dflt-ary-name-iter-val.js (default) + Classes may not have private methods. at (83, 2) to (88, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elem-init.js (strict mode) + Classes may not have private methods. at (75, 2) to (80, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elem-init.js (default) + Classes may not have private methods. at (75, 2) to (80, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elem-iter.js (strict mode) + Classes may not have private methods. at (76, 2) to (81, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elem-iter.js (default) + Classes may not have private methods. at (76, 2) to (81, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elision-init.js (strict mode) + Classes may not have private methods. at (83, 2) to (87, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elision-init.js (default) + Classes may not have private methods. at (83, 2) to (87, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elision-iter.js (strict mode) + Classes may not have private methods. at (81, 2) to (84, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elision-iter.js (default) + Classes may not have private methods. at (81, 2) to (84, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-empty-init.js (strict mode) + Classes may not have private methods. at (79, 2) to (83, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-empty-init.js (default) + Classes may not have private methods. at (79, 2) to (83, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-empty-iter.js (strict mode) + Classes may not have private methods. at (77, 2) to (80, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-empty-iter.js (default) + Classes may not have private methods. at (77, 2) to (80, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-rest-init.js (strict mode) + Classes may not have private methods. at (76, 2) to (84, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-rest-init.js (default) + Classes may not have private methods. at (76, 2) to (84, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-rest-iter.js (strict mode) + Classes may not have private methods. at (78, 2) to (87, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-rest-iter.js (default) + Classes may not have private methods. at (78, 2) to (87, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-exhausted.js (strict mode) + Classes may not have private methods. at (76, 2) to (79, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-exhausted.js (default) + Classes may not have private methods. at (76, 2) to (79, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (77, 2) to (80, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (77, 2) to (80, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (77, 2) to (82, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js (default) + Classes may not have private methods. at (77, 2) to (82, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (77, 2) to (81, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (77, 2) to (81, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (77, 2) to (81, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (77, 2) to (81, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (78, 2) to (82, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (78, 2) to (82, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-hole.js (strict mode) + Classes may not have private methods. at (71, 2) to (75, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-hole.js (default) + Classes may not have private methods. at (71, 2) to (75, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-skipped.js (strict mode) + Classes may not have private methods. at (77, 2) to (84, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-skipped.js (default) + Classes may not have private methods. at (77, 2) to (84, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-undef.js (strict mode) + Classes may not have private methods. at (75, 2) to (78, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-undef.js (default) + Classes may not have private methods. at (75, 2) to (78, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-complete.js (strict mode) + Classes may not have private methods. at (79, 2) to (82, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-complete.js (default) + Classes may not have private methods. at (79, 2) to (82, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-done.js (strict mode) + Classes may not have private methods. at (74, 2) to (77, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-done.js (default) + Classes may not have private methods. at (74, 2) to (77, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-val.js (strict mode) + Classes may not have private methods. at (83, 2) to (88, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-val.js (default) + Classes may not have private methods. at (83, 2) to (88, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-id-init.js (strict mode) + Classes may not have private methods. at (75, 2) to (80, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-id-init.js (default) + Classes may not have private methods. at (75, 2) to (80, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-id.js (strict mode) + Classes may not have private methods. at (75, 2) to (80, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-id.js (default) + Classes may not have private methods. at (75, 2) to (80, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js (strict mode) + Classes may not have private methods. at (75, 2) to (90, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js (default) + Classes may not have private methods. at (75, 2) to (90, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-prop-id.js (strict mode) + Classes may not have private methods. at (75, 2) to (90, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-prop-id.js (default) + Classes may not have private methods. at (75, 2) to (90, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elision-exhausted.js (strict mode) + Classes may not have private methods. at (82, 2) to (85, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elision-exhausted.js (default) + Classes may not have private methods. at (82, 2) to (85, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elision.js (strict mode) + Classes may not have private methods. at (90, 2) to (94, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elision.js (default) + Classes may not have private methods. at (90, 2) to (94, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-empty.js (strict mode) + Classes may not have private methods. at (74, 2) to (77, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-empty.js (default) + Classes may not have private methods. at (74, 2) to (77, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-elem.js (strict mode) + Classes may not have private methods. at (96, 2) to (101, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-elem.js (default) + Classes may not have private methods. at (96, 2) to (101, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-elision.js (strict mode) + Classes may not have private methods. at (103, 2) to (107, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-elision.js (default) + Classes may not have private methods. at (103, 2) to (107, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-empty.js (strict mode) + Classes may not have private methods. at (87, 2) to (90, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-empty.js (default) + Classes may not have private methods. at (87, 2) to (90, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-rest.js (strict mode) + Classes may not have private methods. at (77, 2) to (86, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-rest.js (default) + Classes may not have private methods. at (77, 2) to (86, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-id-elision.js (strict mode) + Classes may not have private methods. at (74, 2) to (82, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-id-elision.js (default) + Classes may not have private methods. at (74, 2) to (82, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-id-exhausted.js (strict mode) + Classes may not have private methods. at (74, 2) to (78, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-id-exhausted.js (default) + Classes may not have private methods. at (74, 2) to (78, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-id.js (strict mode) + Classes may not have private methods. at (71, 2) to (79, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-id.js (default) + Classes may not have private methods. at (71, 2) to (79, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-obj-id.js (strict mode) + Classes may not have private methods. at (76, 2) to (79, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-obj-id.js (default) + Classes may not have private methods. at (76, 2) to (79, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-obj-prop-id.js (strict mode) + Classes may not have private methods. at (77, 2) to (86, 3) +language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-obj-prop-id.js (default) + Classes may not have private methods. at (77, 2) to (86, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-empty.js (strict mode) + Classes may not have private methods. at (75, 2) to (78, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-empty.js (default) + Classes may not have private methods. at (75, 2) to (78, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (76, 2) to (79, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (76, 2) to (79, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (76, 2) to (81, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-class.js (default) + Classes may not have private methods. at (76, 2) to (81, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (76, 2) to (80, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (76, 2) to (80, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (76, 2) to (80, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (76, 2) to (80, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (77, 2) to (81, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (77, 2) to (81, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-skipped.js (strict mode) + Classes may not have private methods. at (76, 2) to (83, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-skipped.js (default) + Classes may not have private methods. at (76, 2) to (83, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (70, 2) to (73, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-trailing-comma.js (default) + Classes may not have private methods. at (70, 2) to (73, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-ary-init.js (strict mode) + Classes may not have private methods. at (73, 2) to (82, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-ary-init.js (default) + Classes may not have private methods. at (73, 2) to (82, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js (strict mode) + Classes may not have private methods. at (70, 2) to (73, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js (default) + Classes may not have private methods. at (70, 2) to (73, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-ary.js (strict mode) + Classes may not have private methods. at (71, 2) to (80, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-ary.js (default) + Classes may not have private methods. at (71, 2) to (80, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-id-init-skipped.js (strict mode) + Classes may not have private methods. at (75, 2) to (95, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-id-init-skipped.js (default) + Classes may not have private methods. at (75, 2) to (95, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-id-init.js (strict mode) + Classes may not have private methods. at (70, 2) to (76, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-id-init.js (default) + Classes may not have private methods. at (70, 2) to (76, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (70, 2) to (77, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-id-trailing-comma.js (default) + Classes may not have private methods. at (70, 2) to (77, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-id.js (strict mode) + Classes may not have private methods. at (70, 2) to (76, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-id.js (default) + Classes may not have private methods. at (70, 2) to (76, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-obj-init.js (strict mode) + Classes may not have private methods. at (73, 2) to (82, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-obj-init.js (default) + Classes may not have private methods. at (73, 2) to (82, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-obj.js (strict mode) + Classes may not have private methods. at (71, 2) to (80, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-obj.js (default) + Classes may not have private methods. at (71, 2) to (80, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-rest-getter.js (strict mode) + Classes may not have private methods. at (65, 2) to (75, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-rest-getter.js (default) + Classes may not have private methods. at (65, 2) to (75, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js (strict mode) + Classes may not have private methods. at (66, 2) to (83, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js (default) + Classes may not have private methods. at (66, 2) to (83, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-rest-val-obj.js (strict mode) + Classes may not have private methods. at (64, 2) to (82, 3) +language/expressions/class/dstr/private-meth-dflt-obj-ptrn-rest-val-obj.js (default) + Classes may not have private methods. at (64, 2) to (82, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-empty.js (strict mode) + Classes may not have private methods. at (75, 2) to (78, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-empty.js (default) + Classes may not have private methods. at (75, 2) to (78, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (76, 2) to (79, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (76, 2) to (79, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (76, 2) to (81, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-id-init-fn-name-class.js (default) + Classes may not have private methods. at (76, 2) to (81, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (76, 2) to (80, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (76, 2) to (80, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (76, 2) to (80, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (76, 2) to (80, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (77, 2) to (81, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (77, 2) to (81, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-id-init-skipped.js (strict mode) + Classes may not have private methods. at (76, 2) to (83, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-id-init-skipped.js (default) + Classes may not have private methods. at (76, 2) to (83, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (70, 2) to (73, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-id-trailing-comma.js (default) + Classes may not have private methods. at (70, 2) to (73, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-prop-ary-init.js (strict mode) + Classes may not have private methods. at (73, 2) to (82, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-prop-ary-init.js (default) + Classes may not have private methods. at (73, 2) to (82, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-prop-ary-trailing-comma.js (strict mode) + Classes may not have private methods. at (70, 2) to (73, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-prop-ary-trailing-comma.js (default) + Classes may not have private methods. at (70, 2) to (73, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-prop-ary.js (strict mode) + Classes may not have private methods. at (71, 2) to (80, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-prop-ary.js (default) + Classes may not have private methods. at (71, 2) to (80, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-prop-id-init-skipped.js (strict mode) + Classes may not have private methods. at (75, 2) to (95, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-prop-id-init-skipped.js (default) + Classes may not have private methods. at (75, 2) to (95, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-prop-id-init.js (strict mode) + Classes may not have private methods. at (70, 2) to (76, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-prop-id-init.js (default) + Classes may not have private methods. at (70, 2) to (76, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-prop-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (70, 2) to (77, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-prop-id-trailing-comma.js (default) + Classes may not have private methods. at (70, 2) to (77, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-prop-id.js (strict mode) + Classes may not have private methods. at (70, 2) to (76, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-prop-id.js (default) + Classes may not have private methods. at (70, 2) to (76, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-prop-obj-init.js (strict mode) + Classes may not have private methods. at (73, 2) to (82, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-prop-obj-init.js (default) + Classes may not have private methods. at (73, 2) to (82, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-prop-obj.js (strict mode) + Classes may not have private methods. at (71, 2) to (80, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-prop-obj.js (default) + Classes may not have private methods. at (71, 2) to (80, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-rest-getter.js (strict mode) + Classes may not have private methods. at (65, 2) to (75, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-rest-getter.js (default) + Classes may not have private methods. at (65, 2) to (75, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-rest-skip-non-enumerable.js (strict mode) + Classes may not have private methods. at (66, 2) to (83, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-rest-skip-non-enumerable.js (default) + Classes may not have private methods. at (66, 2) to (83, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-rest-val-obj.js (strict mode) + Classes may not have private methods. at (64, 2) to (82, 3) +language/expressions/class/dstr/private-meth-obj-ptrn-rest-val-obj.js (default) + Classes may not have private methods. at (64, 2) to (82, 3) +language/expressions/class/dstr/private-meth-static-ary-init-iter-close.js (strict mode) + Classes may not have private methods. at (86, 2) to (89, 3) +language/expressions/class/dstr/private-meth-static-ary-init-iter-close.js (default) + Classes may not have private methods. at (86, 2) to (89, 3) +language/expressions/class/dstr/private-meth-static-ary-init-iter-no-close.js (strict mode) + Classes may not have private methods. at (86, 2) to (89, 3) +language/expressions/class/dstr/private-meth-static-ary-init-iter-no-close.js (default) + Classes may not have private methods. at (86, 2) to (89, 3) +language/expressions/class/dstr/private-meth-static-ary-name-iter-val.js (strict mode) + Classes may not have private methods. at (83, 2) to (88, 3) +language/expressions/class/dstr/private-meth-static-ary-name-iter-val.js (default) + Classes may not have private methods. at (83, 2) to (88, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-elem-init.js (strict mode) + Classes may not have private methods. at (75, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-elem-init.js (default) + Classes may not have private methods. at (75, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-elem-iter.js (strict mode) + Classes may not have private methods. at (76, 2) to (81, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-elem-iter.js (default) + Classes may not have private methods. at (76, 2) to (81, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-elision-init.js (strict mode) + Classes may not have private methods. at (83, 2) to (87, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-elision-init.js (default) + Classes may not have private methods. at (83, 2) to (87, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-elision-iter.js (strict mode) + Classes may not have private methods. at (81, 2) to (84, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-elision-iter.js (default) + Classes may not have private methods. at (81, 2) to (84, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-empty-init.js (strict mode) + Classes may not have private methods. at (79, 2) to (83, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-empty-init.js (default) + Classes may not have private methods. at (79, 2) to (83, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-empty-iter.js (strict mode) + Classes may not have private methods. at (77, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-empty-iter.js (default) + Classes may not have private methods. at (77, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-rest-init.js (strict mode) + Classes may not have private methods. at (76, 2) to (84, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-rest-init.js (default) + Classes may not have private methods. at (76, 2) to (84, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-rest-iter.js (strict mode) + Classes may not have private methods. at (78, 2) to (87, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-rest-iter.js (default) + Classes may not have private methods. at (78, 2) to (87, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-exhausted.js (strict mode) + Classes may not have private methods. at (76, 2) to (79, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-exhausted.js (default) + Classes may not have private methods. at (76, 2) to (79, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (77, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (77, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (77, 2) to (82, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-class.js (default) + Classes may not have private methods. at (77, 2) to (82, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (77, 2) to (81, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (77, 2) to (81, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (77, 2) to (81, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (77, 2) to (81, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (78, 2) to (82, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (78, 2) to (82, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-hole.js (strict mode) + Classes may not have private methods. at (71, 2) to (75, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-hole.js (default) + Classes may not have private methods. at (71, 2) to (75, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-skipped.js (strict mode) + Classes may not have private methods. at (77, 2) to (84, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-skipped.js (default) + Classes may not have private methods. at (77, 2) to (84, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-undef.js (strict mode) + Classes may not have private methods. at (75, 2) to (78, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-undef.js (default) + Classes may not have private methods. at (75, 2) to (78, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-complete.js (strict mode) + Classes may not have private methods. at (79, 2) to (82, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-complete.js (default) + Classes may not have private methods. at (79, 2) to (82, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-done.js (strict mode) + Classes may not have private methods. at (74, 2) to (77, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-done.js (default) + Classes may not have private methods. at (74, 2) to (77, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-val.js (strict mode) + Classes may not have private methods. at (83, 2) to (88, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-val.js (default) + Classes may not have private methods. at (83, 2) to (88, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-obj-id-init.js (strict mode) + Classes may not have private methods. at (75, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-obj-id-init.js (default) + Classes may not have private methods. at (75, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-obj-id.js (strict mode) + Classes may not have private methods. at (75, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-obj-id.js (default) + Classes may not have private methods. at (75, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-obj-prop-id-init.js (strict mode) + Classes may not have private methods. at (75, 2) to (90, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-obj-prop-id-init.js (default) + Classes may not have private methods. at (75, 2) to (90, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-obj-prop-id.js (strict mode) + Classes may not have private methods. at (75, 2) to (90, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-obj-prop-id.js (default) + Classes may not have private methods. at (75, 2) to (90, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elision-exhausted.js (strict mode) + Classes may not have private methods. at (82, 2) to (85, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elision-exhausted.js (default) + Classes may not have private methods. at (82, 2) to (85, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elision.js (strict mode) + Classes may not have private methods. at (90, 2) to (94, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-elision.js (default) + Classes may not have private methods. at (90, 2) to (94, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-empty.js (strict mode) + Classes may not have private methods. at (74, 2) to (77, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-empty.js (default) + Classes may not have private methods. at (74, 2) to (77, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-ary-elem.js (strict mode) + Classes may not have private methods. at (96, 2) to (101, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-ary-elem.js (default) + Classes may not have private methods. at (96, 2) to (101, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-ary-elision.js (strict mode) + Classes may not have private methods. at (103, 2) to (107, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-ary-elision.js (default) + Classes may not have private methods. at (103, 2) to (107, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-ary-empty.js (strict mode) + Classes may not have private methods. at (87, 2) to (90, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-ary-empty.js (default) + Classes may not have private methods. at (87, 2) to (90, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-ary-rest.js (strict mode) + Classes may not have private methods. at (77, 2) to (86, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-ary-rest.js (default) + Classes may not have private methods. at (77, 2) to (86, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-id-elision.js (strict mode) + Classes may not have private methods. at (74, 2) to (82, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-id-elision.js (default) + Classes may not have private methods. at (74, 2) to (82, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-id-exhausted.js (strict mode) + Classes may not have private methods. at (74, 2) to (78, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-id-exhausted.js (default) + Classes may not have private methods. at (74, 2) to (78, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-id.js (strict mode) + Classes may not have private methods. at (71, 2) to (79, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-id.js (default) + Classes may not have private methods. at (71, 2) to (79, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-obj-id.js (strict mode) + Classes may not have private methods. at (76, 2) to (79, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-obj-id.js (default) + Classes may not have private methods. at (76, 2) to (79, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-obj-prop-id.js (strict mode) + Classes may not have private methods. at (77, 2) to (86, 3) +language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-obj-prop-id.js (default) + Classes may not have private methods. at (77, 2) to (86, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-init-iter-close.js (strict mode) + Classes may not have private methods. at (86, 2) to (89, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-init-iter-close.js (default) + Classes may not have private methods. at (86, 2) to (89, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-init-iter-no-close.js (strict mode) + Classes may not have private methods. at (86, 2) to (89, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-init-iter-no-close.js (default) + Classes may not have private methods. at (86, 2) to (89, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-name-iter-val.js (strict mode) + Classes may not have private methods. at (83, 2) to (88, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-name-iter-val.js (default) + Classes may not have private methods. at (83, 2) to (88, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js (strict mode) + Classes may not have private methods. at (75, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js (default) + Classes may not have private methods. at (75, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js (strict mode) + Classes may not have private methods. at (76, 2) to (81, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js (default) + Classes may not have private methods. at (76, 2) to (81, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js (strict mode) + Classes may not have private methods. at (83, 2) to (87, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js (default) + Classes may not have private methods. at (83, 2) to (87, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js (strict mode) + Classes may not have private methods. at (81, 2) to (84, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js (default) + Classes may not have private methods. at (81, 2) to (84, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js (strict mode) + Classes may not have private methods. at (79, 2) to (83, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js (default) + Classes may not have private methods. at (79, 2) to (83, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js (strict mode) + Classes may not have private methods. at (77, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js (default) + Classes may not have private methods. at (77, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js (strict mode) + Classes may not have private methods. at (76, 2) to (84, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js (default) + Classes may not have private methods. at (76, 2) to (84, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js (strict mode) + Classes may not have private methods. at (78, 2) to (87, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js (default) + Classes may not have private methods. at (78, 2) to (87, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js (strict mode) + Classes may not have private methods. at (76, 2) to (79, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js (default) + Classes may not have private methods. at (76, 2) to (79, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (77, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (77, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (77, 2) to (82, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js (default) + Classes may not have private methods. at (77, 2) to (82, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (77, 2) to (81, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (77, 2) to (81, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (77, 2) to (81, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (77, 2) to (81, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (78, 2) to (82, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (78, 2) to (82, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-hole.js (strict mode) + Classes may not have private methods. at (71, 2) to (75, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-hole.js (default) + Classes may not have private methods. at (71, 2) to (75, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js (strict mode) + Classes may not have private methods. at (77, 2) to (84, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js (default) + Classes may not have private methods. at (77, 2) to (84, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-undef.js (strict mode) + Classes may not have private methods. at (75, 2) to (78, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-undef.js (default) + Classes may not have private methods. at (75, 2) to (78, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js (strict mode) + Classes may not have private methods. at (79, 2) to (82, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js (default) + Classes may not have private methods. at (79, 2) to (82, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-done.js (strict mode) + Classes may not have private methods. at (74, 2) to (77, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-done.js (default) + Classes may not have private methods. at (74, 2) to (77, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-val.js (strict mode) + Classes may not have private methods. at (83, 2) to (88, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-val.js (default) + Classes may not have private methods. at (83, 2) to (88, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-id-init.js (strict mode) + Classes may not have private methods. at (75, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-id-init.js (default) + Classes may not have private methods. at (75, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-id.js (strict mode) + Classes may not have private methods. at (75, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-id.js (default) + Classes may not have private methods. at (75, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js (strict mode) + Classes may not have private methods. at (75, 2) to (90, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js (default) + Classes may not have private methods. at (75, 2) to (90, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js (strict mode) + Classes may not have private methods. at (75, 2) to (90, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js (default) + Classes may not have private methods. at (75, 2) to (90, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elision-exhausted.js (strict mode) + Classes may not have private methods. at (82, 2) to (85, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elision-exhausted.js (default) + Classes may not have private methods. at (82, 2) to (85, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elision.js (strict mode) + Classes may not have private methods. at (90, 2) to (94, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elision.js (default) + Classes may not have private methods. at (90, 2) to (94, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-empty.js (strict mode) + Classes may not have private methods. at (74, 2) to (77, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-empty.js (default) + Classes may not have private methods. at (74, 2) to (77, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-elem.js (strict mode) + Classes may not have private methods. at (96, 2) to (101, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-elem.js (default) + Classes may not have private methods. at (96, 2) to (101, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-elision.js (strict mode) + Classes may not have private methods. at (103, 2) to (107, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-elision.js (default) + Classes may not have private methods. at (103, 2) to (107, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-empty.js (strict mode) + Classes may not have private methods. at (87, 2) to (90, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-empty.js (default) + Classes may not have private methods. at (87, 2) to (90, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-rest.js (strict mode) + Classes may not have private methods. at (77, 2) to (86, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-rest.js (default) + Classes may not have private methods. at (77, 2) to (86, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id-elision.js (strict mode) + Classes may not have private methods. at (74, 2) to (82, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id-elision.js (default) + Classes may not have private methods. at (74, 2) to (82, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id-exhausted.js (strict mode) + Classes may not have private methods. at (74, 2) to (78, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id-exhausted.js (default) + Classes may not have private methods. at (74, 2) to (78, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id.js (strict mode) + Classes may not have private methods. at (71, 2) to (79, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id.js (default) + Classes may not have private methods. at (71, 2) to (79, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-obj-id.js (strict mode) + Classes may not have private methods. at (76, 2) to (79, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-obj-id.js (default) + Classes may not have private methods. at (76, 2) to (79, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js (strict mode) + Classes may not have private methods. at (77, 2) to (86, 3) +language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js (default) + Classes may not have private methods. at (77, 2) to (86, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-empty.js (strict mode) + Classes may not have private methods. at (75, 2) to (78, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-empty.js (default) + Classes may not have private methods. at (75, 2) to (78, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (76, 2) to (79, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (76, 2) to (79, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (76, 2) to (81, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js (default) + Classes may not have private methods. at (76, 2) to (81, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (76, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (76, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (76, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (76, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (77, 2) to (81, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (77, 2) to (81, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-skipped.js (strict mode) + Classes may not have private methods. at (76, 2) to (83, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-skipped.js (default) + Classes may not have private methods. at (76, 2) to (83, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (70, 2) to (73, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-trailing-comma.js (default) + Classes may not have private methods. at (70, 2) to (73, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary-init.js (strict mode) + Classes may not have private methods. at (73, 2) to (82, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary-init.js (default) + Classes may not have private methods. at (73, 2) to (82, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js (strict mode) + Classes may not have private methods. at (70, 2) to (73, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js (default) + Classes may not have private methods. at (70, 2) to (73, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary.js (strict mode) + Classes may not have private methods. at (71, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary.js (default) + Classes may not have private methods. at (71, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js (strict mode) + Classes may not have private methods. at (75, 2) to (95, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js (default) + Classes may not have private methods. at (75, 2) to (95, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-init.js (strict mode) + Classes may not have private methods. at (70, 2) to (76, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-init.js (default) + Classes may not have private methods. at (70, 2) to (76, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (70, 2) to (77, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js (default) + Classes may not have private methods. at (70, 2) to (77, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id.js (strict mode) + Classes may not have private methods. at (70, 2) to (76, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id.js (default) + Classes may not have private methods. at (70, 2) to (76, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-obj-init.js (strict mode) + Classes may not have private methods. at (73, 2) to (82, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-obj-init.js (default) + Classes may not have private methods. at (73, 2) to (82, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-obj.js (strict mode) + Classes may not have private methods. at (71, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-obj.js (default) + Classes may not have private methods. at (71, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-rest-getter.js (strict mode) + Classes may not have private methods. at (65, 2) to (75, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-rest-getter.js (default) + Classes may not have private methods. at (65, 2) to (75, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js (strict mode) + Classes may not have private methods. at (66, 2) to (83, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js (default) + Classes may not have private methods. at (66, 2) to (83, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-rest-val-obj.js (strict mode) + Classes may not have private methods. at (64, 2) to (82, 3) +language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-rest-val-obj.js (default) + Classes may not have private methods. at (64, 2) to (82, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-empty.js (strict mode) + Classes may not have private methods. at (75, 2) to (78, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-empty.js (default) + Classes may not have private methods. at (75, 2) to (78, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (76, 2) to (79, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (76, 2) to (79, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (76, 2) to (81, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-class.js (default) + Classes may not have private methods. at (76, 2) to (81, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (76, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (76, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (76, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (76, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (77, 2) to (81, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (77, 2) to (81, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-skipped.js (strict mode) + Classes may not have private methods. at (76, 2) to (83, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-skipped.js (default) + Classes may not have private methods. at (76, 2) to (83, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (70, 2) to (73, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-id-trailing-comma.js (default) + Classes may not have private methods. at (70, 2) to (73, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-ary-init.js (strict mode) + Classes may not have private methods. at (73, 2) to (82, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-ary-init.js (default) + Classes may not have private methods. at (73, 2) to (82, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-ary-trailing-comma.js (strict mode) + Classes may not have private methods. at (70, 2) to (73, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-ary-trailing-comma.js (default) + Classes may not have private methods. at (70, 2) to (73, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-ary.js (strict mode) + Classes may not have private methods. at (71, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-ary.js (default) + Classes may not have private methods. at (71, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-id-init-skipped.js (strict mode) + Classes may not have private methods. at (75, 2) to (95, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-id-init-skipped.js (default) + Classes may not have private methods. at (75, 2) to (95, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-id-init.js (strict mode) + Classes may not have private methods. at (70, 2) to (76, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-id-init.js (default) + Classes may not have private methods. at (70, 2) to (76, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (70, 2) to (77, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-id-trailing-comma.js (default) + Classes may not have private methods. at (70, 2) to (77, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-id.js (strict mode) + Classes may not have private methods. at (70, 2) to (76, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-id.js (default) + Classes may not have private methods. at (70, 2) to (76, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-obj-init.js (strict mode) + Classes may not have private methods. at (73, 2) to (82, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-obj-init.js (default) + Classes may not have private methods. at (73, 2) to (82, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-obj.js (strict mode) + Classes may not have private methods. at (71, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-obj.js (default) + Classes may not have private methods. at (71, 2) to (80, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-rest-getter.js (strict mode) + Classes may not have private methods. at (65, 2) to (75, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-rest-getter.js (default) + Classes may not have private methods. at (65, 2) to (75, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-rest-skip-non-enumerable.js (strict mode) + Classes may not have private methods. at (66, 2) to (83, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-rest-skip-non-enumerable.js (default) + Classes may not have private methods. at (66, 2) to (83, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-rest-val-obj.js (strict mode) + Classes may not have private methods. at (64, 2) to (82, 3) +language/expressions/class/dstr/private-meth-static-obj-ptrn-rest-val-obj.js (default) + Classes may not have private methods. at (64, 2) to (82, 3) +language/expressions/class/elements/after-same-line-gen-private-method-usage.js (strict mode) + Classes may not have private methods. at (26, 22) to (26, 48) +language/expressions/class/elements/after-same-line-gen-private-method-usage.js (default) + Classes may not have private methods. at (26, 22) to (26, 48) +language/expressions/class/elements/after-same-line-gen-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/after-same-line-gen-rs-private-method-alt.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/after-same-line-gen-rs-private-method.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/after-same-line-gen-rs-private-method.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/after-same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 22) to (65, 3) +language/expressions/class/elements/after-same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 22) to (65, 3) +language/expressions/class/elements/after-same-line-gen-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 22) to (65, 3) +language/expressions/class/elements/after-same-line-gen-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 22) to (65, 3) +language/expressions/class/elements/after-same-line-gen-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 22) to (65, 3) +language/expressions/class/elements/after-same-line-gen-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 22) to (65, 3) +language/expressions/class/elements/after-same-line-gen-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 22) to (65, 3) +language/expressions/class/elements/after-same-line-gen-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 22) to (65, 3) +language/expressions/class/elements/after-same-line-gen-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 22) to (65, 3) +language/expressions/class/elements/after-same-line-gen-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 22) to (65, 3) +language/expressions/class/elements/after-same-line-gen-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 22) to (65, 3) +language/expressions/class/elements/after-same-line-gen-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 22) to (65, 3) +language/expressions/class/elements/after-same-line-gen-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (60, 22) to (62, 3) +language/expressions/class/elements/after-same-line-gen-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (60, 22) to (62, 3) +language/expressions/class/elements/after-same-line-gen-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (60, 22) to (62, 3) +language/expressions/class/elements/after-same-line-gen-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (60, 22) to (62, 3) +language/expressions/class/elements/after-same-line-gen-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (29, 2) to (32, 3) +language/expressions/class/elements/after-same-line-gen-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (29, 2) to (32, 3) +language/expressions/class/elements/after-same-line-gen-static-private-methods.js (strict mode) + Classes may not have private methods. at (29, 2) to (31, 3) +language/expressions/class/elements/after-same-line-gen-static-private-methods.js (default) + Classes may not have private methods. at (29, 2) to (31, 3) +language/expressions/class/elements/after-same-line-method-private-method-usage.js (strict mode) + Classes may not have private methods. at (26, 21) to (26, 47) +language/expressions/class/elements/after-same-line-method-private-method-usage.js (default) + Classes may not have private methods. at (26, 21) to (26, 47) +language/expressions/class/elements/after-same-line-method-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/after-same-line-method-rs-private-method-alt.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/after-same-line-method-rs-private-method.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/after-same-line-method-rs-private-method.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/after-same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 21) to (65, 3) +language/expressions/class/elements/after-same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 21) to (65, 3) +language/expressions/class/elements/after-same-line-method-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 21) to (65, 3) +language/expressions/class/elements/after-same-line-method-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 21) to (65, 3) +language/expressions/class/elements/after-same-line-method-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 21) to (65, 3) +language/expressions/class/elements/after-same-line-method-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 21) to (65, 3) +language/expressions/class/elements/after-same-line-method-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 21) to (65, 3) +language/expressions/class/elements/after-same-line-method-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 21) to (65, 3) +language/expressions/class/elements/after-same-line-method-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 21) to (65, 3) +language/expressions/class/elements/after-same-line-method-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 21) to (65, 3) +language/expressions/class/elements/after-same-line-method-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 21) to (65, 3) +language/expressions/class/elements/after-same-line-method-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 21) to (65, 3) +language/expressions/class/elements/after-same-line-method-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (60, 21) to (62, 3) +language/expressions/class/elements/after-same-line-method-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (60, 21) to (62, 3) +language/expressions/class/elements/after-same-line-method-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (60, 21) to (62, 3) +language/expressions/class/elements/after-same-line-method-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (60, 21) to (62, 3) +language/expressions/class/elements/after-same-line-method-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (29, 2) to (32, 3) +language/expressions/class/elements/after-same-line-method-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (29, 2) to (32, 3) +language/expressions/class/elements/after-same-line-method-static-private-methods.js (strict mode) + Classes may not have private methods. at (29, 2) to (31, 3) +language/expressions/class/elements/after-same-line-method-static-private-methods.js (default) + Classes may not have private methods. at (29, 2) to (31, 3) +language/expressions/class/elements/after-same-line-static-async-gen-private-method-usage.js (strict mode) + Classes may not have private methods. at (26, 35) to (26, 61) +language/expressions/class/elements/after-same-line-static-async-gen-private-method-usage.js (default) + Classes may not have private methods. at (26, 35) to (26, 61) +language/expressions/class/elements/after-same-line-static-async-gen-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/after-same-line-static-async-gen-rs-private-method-alt.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/after-same-line-static-async-gen-rs-private-method.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/after-same-line-static-async-gen-rs-private-method.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 35) to (65, 3) +language/expressions/class/elements/after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 35) to (65, 3) +language/expressions/class/elements/after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 35) to (65, 3) +language/expressions/class/elements/after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 35) to (65, 3) +language/expressions/class/elements/after-same-line-static-async-gen-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 35) to (65, 3) +language/expressions/class/elements/after-same-line-static-async-gen-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 35) to (65, 3) +language/expressions/class/elements/after-same-line-static-async-gen-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 35) to (65, 3) +language/expressions/class/elements/after-same-line-static-async-gen-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 35) to (65, 3) +language/expressions/class/elements/after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 35) to (65, 3) +language/expressions/class/elements/after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 35) to (65, 3) +language/expressions/class/elements/after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 35) to (65, 3) +language/expressions/class/elements/after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 35) to (65, 3) +language/expressions/class/elements/after-same-line-static-async-gen-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (60, 35) to (62, 3) +language/expressions/class/elements/after-same-line-static-async-gen-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (60, 35) to (62, 3) +language/expressions/class/elements/after-same-line-static-async-gen-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (60, 35) to (62, 3) +language/expressions/class/elements/after-same-line-static-async-gen-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (60, 35) to (62, 3) +language/expressions/class/elements/after-same-line-static-async-gen-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (29, 2) to (32, 3) +language/expressions/class/elements/after-same-line-static-async-gen-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (29, 2) to (32, 3) +language/expressions/class/elements/after-same-line-static-async-gen-static-private-methods.js (strict mode) + Classes may not have private methods. at (29, 2) to (31, 3) +language/expressions/class/elements/after-same-line-static-async-gen-static-private-methods.js (default) + Classes may not have private methods. at (29, 2) to (31, 3) +language/expressions/class/elements/after-same-line-static-async-method-private-method-usage.js (strict mode) + Classes may not have private methods. at (26, 34) to (26, 60) +language/expressions/class/elements/after-same-line-static-async-method-private-method-usage.js (default) + Classes may not have private methods. at (26, 34) to (26, 60) +language/expressions/class/elements/after-same-line-static-async-method-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/after-same-line-static-async-method-rs-private-method-alt.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/after-same-line-static-async-method-rs-private-method.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/after-same-line-static-async-method-rs-private-method.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 34) to (65, 3) +language/expressions/class/elements/after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 34) to (65, 3) +language/expressions/class/elements/after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 34) to (65, 3) +language/expressions/class/elements/after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 34) to (65, 3) +language/expressions/class/elements/after-same-line-static-async-method-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 34) to (65, 3) +language/expressions/class/elements/after-same-line-static-async-method-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 34) to (65, 3) +language/expressions/class/elements/after-same-line-static-async-method-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 34) to (65, 3) +language/expressions/class/elements/after-same-line-static-async-method-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 34) to (65, 3) +language/expressions/class/elements/after-same-line-static-async-method-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 34) to (65, 3) +language/expressions/class/elements/after-same-line-static-async-method-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 34) to (65, 3) +language/expressions/class/elements/after-same-line-static-async-method-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 34) to (65, 3) +language/expressions/class/elements/after-same-line-static-async-method-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 34) to (65, 3) +language/expressions/class/elements/after-same-line-static-async-method-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (60, 34) to (62, 3) +language/expressions/class/elements/after-same-line-static-async-method-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (60, 34) to (62, 3) +language/expressions/class/elements/after-same-line-static-async-method-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (60, 34) to (62, 3) +language/expressions/class/elements/after-same-line-static-async-method-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (60, 34) to (62, 3) +language/expressions/class/elements/after-same-line-static-async-method-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (29, 2) to (32, 3) +language/expressions/class/elements/after-same-line-static-async-method-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (29, 2) to (32, 3) +language/expressions/class/elements/after-same-line-static-async-method-static-private-methods.js (strict mode) + Classes may not have private methods. at (29, 2) to (31, 3) +language/expressions/class/elements/after-same-line-static-async-method-static-private-methods.js (default) + Classes may not have private methods. at (29, 2) to (31, 3) +language/expressions/class/elements/after-same-line-static-gen-private-method-usage.js (strict mode) + Classes may not have private methods. at (26, 29) to (26, 55) +language/expressions/class/elements/after-same-line-static-gen-private-method-usage.js (default) + Classes may not have private methods. at (26, 29) to (26, 55) +language/expressions/class/elements/after-same-line-static-gen-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/after-same-line-static-gen-rs-private-method-alt.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/after-same-line-static-gen-rs-private-method.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/after-same-line-static-gen-rs-private-method.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 29) to (65, 3) +language/expressions/class/elements/after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 29) to (65, 3) +language/expressions/class/elements/after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 29) to (65, 3) +language/expressions/class/elements/after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 29) to (65, 3) +language/expressions/class/elements/after-same-line-static-gen-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 29) to (65, 3) +language/expressions/class/elements/after-same-line-static-gen-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 29) to (65, 3) +language/expressions/class/elements/after-same-line-static-gen-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 29) to (65, 3) +language/expressions/class/elements/after-same-line-static-gen-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 29) to (65, 3) +language/expressions/class/elements/after-same-line-static-gen-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 29) to (65, 3) +language/expressions/class/elements/after-same-line-static-gen-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 29) to (65, 3) +language/expressions/class/elements/after-same-line-static-gen-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 29) to (65, 3) +language/expressions/class/elements/after-same-line-static-gen-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 29) to (65, 3) +language/expressions/class/elements/after-same-line-static-gen-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (60, 29) to (62, 3) +language/expressions/class/elements/after-same-line-static-gen-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (60, 29) to (62, 3) +language/expressions/class/elements/after-same-line-static-gen-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (60, 29) to (62, 3) +language/expressions/class/elements/after-same-line-static-gen-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (60, 29) to (62, 3) +language/expressions/class/elements/after-same-line-static-gen-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (29, 2) to (32, 3) +language/expressions/class/elements/after-same-line-static-gen-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (29, 2) to (32, 3) +language/expressions/class/elements/after-same-line-static-gen-static-private-methods.js (strict mode) + Classes may not have private methods. at (29, 2) to (31, 3) +language/expressions/class/elements/after-same-line-static-gen-static-private-methods.js (default) + Classes may not have private methods. at (29, 2) to (31, 3) +language/expressions/class/elements/after-same-line-static-method-private-method-usage.js (strict mode) + Classes may not have private methods. at (26, 28) to (26, 54) +language/expressions/class/elements/after-same-line-static-method-private-method-usage.js (default) + Classes may not have private methods. at (26, 28) to (26, 54) +language/expressions/class/elements/after-same-line-static-method-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/after-same-line-static-method-rs-private-method-alt.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/after-same-line-static-method-rs-private-method.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/after-same-line-static-method-rs-private-method.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/after-same-line-static-method-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 28) to (65, 3) +language/expressions/class/elements/after-same-line-static-method-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 28) to (65, 3) +language/expressions/class/elements/after-same-line-static-method-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 28) to (65, 3) +language/expressions/class/elements/after-same-line-static-method-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 28) to (65, 3) +language/expressions/class/elements/after-same-line-static-method-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 28) to (65, 3) +language/expressions/class/elements/after-same-line-static-method-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 28) to (65, 3) +language/expressions/class/elements/after-same-line-static-method-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 28) to (65, 3) +language/expressions/class/elements/after-same-line-static-method-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 28) to (65, 3) +language/expressions/class/elements/after-same-line-static-method-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 28) to (65, 3) +language/expressions/class/elements/after-same-line-static-method-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 28) to (65, 3) +language/expressions/class/elements/after-same-line-static-method-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 28) to (65, 3) +language/expressions/class/elements/after-same-line-static-method-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 28) to (65, 3) +language/expressions/class/elements/after-same-line-static-method-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (60, 28) to (62, 3) +language/expressions/class/elements/after-same-line-static-method-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (60, 28) to (62, 3) +language/expressions/class/elements/after-same-line-static-method-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (60, 28) to (62, 3) +language/expressions/class/elements/after-same-line-static-method-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (60, 28) to (62, 3) +language/expressions/class/elements/after-same-line-static-method-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (29, 2) to (32, 3) +language/expressions/class/elements/after-same-line-static-method-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (29, 2) to (32, 3) +language/expressions/class/elements/after-same-line-static-method-static-private-methods.js (strict mode) + Classes may not have private methods. at (29, 2) to (31, 3) +language/expressions/class/elements/after-same-line-static-method-static-private-methods.js (default) + Classes may not have private methods. at (29, 2) to (31, 3) +language/expressions/class/elements/arrow-fnc-init-err-contains-arguments.js (strict mode) + Missing parse error +language/expressions/class/elements/arrow-fnc-init-err-contains-arguments.js (default) + Missing parse error +language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-catch.js (strict mode) + Classes may not have private methods. at (28, 4) to (32, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-catch.js (default) + Classes may not have private methods. at (28, 4) to (32, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-for-await-of-async-iterator.js (strict mode) + Classes may not have private methods. at (32, 4) to (37, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-for-await-of-async-iterator.js (default) + Classes may not have private methods. at (32, 4) to (37, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-for-await-of-sync-iterator.js (strict mode) + Classes may not have private methods. at (32, 4) to (37, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-for-await-of-sync-iterator.js (default) + Classes may not have private methods. at (32, 4) to (37, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-yield-star-async-iterator.js (strict mode) + Classes may not have private methods. at (32, 4) to (36, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-yield-star-async-iterator.js (default) + Classes may not have private methods. at (32, 4) to (36, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-yield-star-sync-iterator.js (strict mode) + Classes may not have private methods. at (32, 4) to (35, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-yield-star-sync-iterator.js (default) + Classes may not have private methods. at (32, 4) to (35, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next.js (strict mode) + Classes may not have private methods. at (28, 4) to (32, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next.js (default) + Classes may not have private methods. at (28, 4) to (32, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-spread-arr-multiple.js (strict mode) + Classes may not have private methods. at (36, 4) to (39, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-spread-arr-multiple.js (default) + Classes may not have private methods. at (36, 4) to (39, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-spread-arr-single.js (strict mode) + Classes may not have private methods. at (34, 4) to (37, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-spread-arr-single.js (default) + Classes may not have private methods. at (34, 4) to (37, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-spread-obj.js (strict mode) + Classes may not have private methods. at (35, 4) to (42, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-spread-obj.js (default) + Classes may not have private methods. at (35, 4) to (42, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-async-next.js (strict mode) + Classes may not have private methods. at (139, 4) to (149, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-async-next.js (default) + Classes may not have private methods. at (139, 4) to (149, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-async-return.js (strict mode) + Classes may not have private methods. at (158, 4) to (163, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-async-return.js (default) + Classes may not have private methods. at (158, 4) to (163, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-async-throw.js (strict mode) + Classes may not have private methods. at (158, 4) to (168, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-async-throw.js (default) + Classes may not have private methods. at (158, 4) to (168, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-expr-abrupt.js (strict mode) + Classes may not have private methods. at (39, 4) to (44, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-expr-abrupt.js (default) + Classes may not have private methods. at (39, 4) to (44, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-get-abrupt.js (strict mode) + Classes may not have private methods. at (59, 4) to (64, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-get-abrupt.js (default) + Classes may not have private methods. at (59, 4) to (64, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-boolean-throw.js (strict mode) + Classes may not have private methods. at (58, 4) to (63, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-boolean-throw.js (default) + Classes may not have private methods. at (58, 4) to (63, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-number-throw.js (strict mode) + Classes may not have private methods. at (58, 4) to (63, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-number-throw.js (default) + Classes may not have private methods. at (58, 4) to (63, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-object-throw.js (strict mode) + Classes may not have private methods. at (58, 4) to (63, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-object-throw.js (default) + Classes may not have private methods. at (58, 4) to (63, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-string-throw.js (strict mode) + Classes may not have private methods. at (58, 4) to (63, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-string-throw.js (default) + Classes may not have private methods. at (58, 4) to (63, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-symbol-throw.js (strict mode) + Classes may not have private methods. at (58, 4) to (63, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-symbol-throw.js (default) + Classes may not have private methods. at (58, 4) to (63, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-null-sync-get-abrupt.js (strict mode) + Classes may not have private methods. at (63, 4) to (68, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-null-sync-get-abrupt.js (default) + Classes may not have private methods. at (63, 4) to (68, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-abrupt.js (strict mode) + Classes may not have private methods. at (55, 4) to (60, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-abrupt.js (default) + Classes may not have private methods. at (55, 4) to (60, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-boolean-throw.js (strict mode) + Classes may not have private methods. at (55, 4) to (60, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-boolean-throw.js (default) + Classes may not have private methods. at (55, 4) to (60, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-null-throw.js (strict mode) + Classes may not have private methods. at (55, 4) to (60, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-null-throw.js (default) + Classes may not have private methods. at (55, 4) to (60, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-number-throw.js (strict mode) + Classes may not have private methods. at (55, 4) to (60, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-number-throw.js (default) + Classes may not have private methods. at (55, 4) to (60, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-string-throw.js (strict mode) + Classes may not have private methods. at (55, 4) to (60, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-string-throw.js (default) + Classes may not have private methods. at (55, 4) to (60, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-symbol-throw.js (strict mode) + Classes may not have private methods. at (55, 4) to (60, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-symbol-throw.js (default) + Classes may not have private methods. at (55, 4) to (60, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-undefined-throw.js (strict mode) + Classes may not have private methods. at (55, 4) to (60, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-undefined-throw.js (default) + Classes may not have private methods. at (55, 4) to (60, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-undefined-sync-get-abrupt.js (strict mode) + Classes may not have private methods. at (63, 4) to (68, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-async-undefined-sync-get-abrupt.js (default) + Classes may not have private methods. at (63, 4) to (68, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-get-abrupt.js (strict mode) + Classes may not have private methods. at (58, 4) to (63, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-get-abrupt.js (default) + Classes may not have private methods. at (58, 4) to (63, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-boolean-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-boolean-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-number-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-number-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-object-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-object-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-string-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-string-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-symbol-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-symbol-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-abrupt.js (strict mode) + Classes may not have private methods. at (52, 4) to (57, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-abrupt.js (default) + Classes may not have private methods. at (52, 4) to (57, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-boolean-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-boolean-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-null-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-null-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-number-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-number-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-string-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-string-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-symbol-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-symbol-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-undefined-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-undefined-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-call-done-get-abrupt.js (strict mode) + Classes may not have private methods. at (58, 4) to (63, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-call-done-get-abrupt.js (default) + Classes may not have private methods. at (58, 4) to (63, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-call-returns-abrupt.js (strict mode) + Classes may not have private methods. at (50, 4) to (55, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-call-returns-abrupt.js (default) + Classes may not have private methods. at (50, 4) to (55, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-call-value-get-abrupt.js (strict mode) + Classes may not have private methods. at (60, 4) to (65, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-call-value-get-abrupt.js (default) + Classes may not have private methods. at (60, 4) to (65, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-get-abrupt.js (strict mode) + Classes may not have private methods. at (50, 4) to (55, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-get-abrupt.js (default) + Classes may not have private methods. at (50, 4) to (55, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-non-object-ignores-then.js (strict mode) + Classes may not have private methods. at (70, 4) to (75, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-non-object-ignores-then.js (default) + Classes may not have private methods. at (70, 4) to (75, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-boolean-throw.js (strict mode) + Classes may not have private methods. at (47, 4) to (52, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-boolean-throw.js (default) + Classes may not have private methods. at (47, 4) to (52, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-null-throw.js (strict mode) + Classes may not have private methods. at (47, 4) to (52, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-null-throw.js (default) + Classes may not have private methods. at (47, 4) to (52, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-number-throw.js (strict mode) + Classes may not have private methods. at (47, 4) to (52, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-number-throw.js (default) + Classes may not have private methods. at (47, 4) to (52, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-object-throw.js (strict mode) + Classes may not have private methods. at (47, 4) to (52, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-object-throw.js (default) + Classes may not have private methods. at (47, 4) to (52, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-string-throw.js (strict mode) + Classes may not have private methods. at (47, 4) to (52, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-string-throw.js (default) + Classes may not have private methods. at (47, 4) to (52, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-symbol-throw.js (strict mode) + Classes may not have private methods. at (47, 4) to (52, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-symbol-throw.js (default) + Classes may not have private methods. at (47, 4) to (52, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-undefined-throw.js (strict mode) + Classes may not have private methods. at (47, 4) to (52, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-not-callable-undefined-throw.js (default) + Classes may not have private methods. at (47, 4) to (52, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-get-abrupt.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-get-abrupt.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-boolean-fulfillpromise.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-boolean-fulfillpromise.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-null-fulfillpromise.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-null-fulfillpromise.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-number-fulfillpromise.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-number-fulfillpromise.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-object-fulfillpromise.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-object-fulfillpromise.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-string-fulfillpromise.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-string-fulfillpromise.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-symbol-fulfillpromise.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-symbol-fulfillpromise.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-undefined-fulfillpromise.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-undefined-fulfillpromise.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-returns-abrupt.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-next-then-returns-abrupt.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-sync-next.js (strict mode) + Classes may not have private methods. at (158, 4) to (168, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-sync-next.js (default) + Classes may not have private methods. at (158, 4) to (168, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-sync-return.js (strict mode) + Classes may not have private methods. at (138, 4) to (143, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-sync-return.js (default) + Classes may not have private methods. at (138, 4) to (143, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-sync-throw.js (strict mode) + Classes may not have private methods. at (136, 4) to (146, 5) +language/expressions/class/elements/async-gen-private-method-static/yield-star-sync-throw.js (default) + Classes may not have private methods. at (136, 4) to (146, 5) +language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-catch.js (strict mode) + Classes may not have private methods. at (28, 4) to (32, 5) +language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-catch.js (default) + Classes may not have private methods. at (28, 4) to (32, 5) +language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-for-await-of-async-iterator.js (strict mode) + Classes may not have private methods. at (32, 4) to (37, 5) +language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-for-await-of-async-iterator.js (default) + Classes may not have private methods. at (32, 4) to (37, 5) +language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-for-await-of-sync-iterator.js (strict mode) + Classes may not have private methods. at (32, 4) to (37, 5) +language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-for-await-of-sync-iterator.js (default) + Classes may not have private methods. at (32, 4) to (37, 5) +language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-yield-star-async-iterator.js (strict mode) + Classes may not have private methods. at (32, 4) to (36, 5) +language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-yield-star-async-iterator.js (default) + Classes may not have private methods. at (32, 4) to (36, 5) +language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-yield-star-sync-iterator.js (strict mode) + Classes may not have private methods. at (32, 4) to (35, 5) +language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-yield-star-sync-iterator.js (default) + Classes may not have private methods. at (32, 4) to (35, 5) +language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next.js (strict mode) + Classes may not have private methods. at (28, 4) to (32, 5) +language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next.js (default) + Classes may not have private methods. at (28, 4) to (32, 5) +language/expressions/class/elements/async-gen-private-method/yield-spread-arr-multiple.js (strict mode) + Classes may not have private methods. at (36, 4) to (39, 5) +language/expressions/class/elements/async-gen-private-method/yield-spread-arr-multiple.js (default) + Classes may not have private methods. at (36, 4) to (39, 5) +language/expressions/class/elements/async-gen-private-method/yield-spread-arr-single.js (strict mode) + Classes may not have private methods. at (34, 4) to (37, 5) +language/expressions/class/elements/async-gen-private-method/yield-spread-arr-single.js (default) + Classes may not have private methods. at (34, 4) to (37, 5) +language/expressions/class/elements/async-gen-private-method/yield-spread-obj.js (strict mode) + Classes may not have private methods. at (35, 4) to (42, 5) +language/expressions/class/elements/async-gen-private-method/yield-spread-obj.js (default) + Classes may not have private methods. at (35, 4) to (42, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-async-next.js (strict mode) + Classes may not have private methods. at (139, 4) to (149, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-async-next.js (default) + Classes may not have private methods. at (139, 4) to (149, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-async-return.js (strict mode) + Classes may not have private methods. at (158, 4) to (163, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-async-return.js (default) + Classes may not have private methods. at (158, 4) to (163, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-async-throw.js (strict mode) + Classes may not have private methods. at (158, 4) to (168, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-async-throw.js (default) + Classes may not have private methods. at (158, 4) to (168, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-expr-abrupt.js (strict mode) + Classes may not have private methods. at (39, 4) to (44, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-expr-abrupt.js (default) + Classes may not have private methods. at (39, 4) to (44, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-get-abrupt.js (strict mode) + Classes may not have private methods. at (59, 4) to (64, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-get-abrupt.js (default) + Classes may not have private methods. at (59, 4) to (64, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-boolean-throw.js (strict mode) + Classes may not have private methods. at (58, 4) to (63, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-boolean-throw.js (default) + Classes may not have private methods. at (58, 4) to (63, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-number-throw.js (strict mode) + Classes may not have private methods. at (58, 4) to (63, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-number-throw.js (default) + Classes may not have private methods. at (58, 4) to (63, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-object-throw.js (strict mode) + Classes may not have private methods. at (58, 4) to (63, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-object-throw.js (default) + Classes may not have private methods. at (58, 4) to (63, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-string-throw.js (strict mode) + Classes may not have private methods. at (58, 4) to (63, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-string-throw.js (default) + Classes may not have private methods. at (58, 4) to (63, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-symbol-throw.js (strict mode) + Classes may not have private methods. at (58, 4) to (63, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-symbol-throw.js (default) + Classes may not have private methods. at (58, 4) to (63, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-null-sync-get-abrupt.js (strict mode) + Classes may not have private methods. at (63, 4) to (68, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-null-sync-get-abrupt.js (default) + Classes may not have private methods. at (63, 4) to (68, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-abrupt.js (strict mode) + Classes may not have private methods. at (55, 4) to (60, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-abrupt.js (default) + Classes may not have private methods. at (55, 4) to (60, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-boolean-throw.js (strict mode) + Classes may not have private methods. at (55, 4) to (60, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-boolean-throw.js (default) + Classes may not have private methods. at (55, 4) to (60, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-null-throw.js (strict mode) + Classes may not have private methods. at (55, 4) to (60, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-null-throw.js (default) + Classes may not have private methods. at (55, 4) to (60, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-number-throw.js (strict mode) + Classes may not have private methods. at (55, 4) to (60, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-number-throw.js (default) + Classes may not have private methods. at (55, 4) to (60, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-string-throw.js (strict mode) + Classes may not have private methods. at (55, 4) to (60, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-string-throw.js (default) + Classes may not have private methods. at (55, 4) to (60, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-symbol-throw.js (strict mode) + Classes may not have private methods. at (55, 4) to (60, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-symbol-throw.js (default) + Classes may not have private methods. at (55, 4) to (60, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-undefined-throw.js (strict mode) + Classes may not have private methods. at (55, 4) to (60, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-returns-undefined-throw.js (default) + Classes may not have private methods. at (55, 4) to (60, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-undefined-sync-get-abrupt.js (strict mode) + Classes may not have private methods. at (63, 4) to (68, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-async-undefined-sync-get-abrupt.js (default) + Classes may not have private methods. at (63, 4) to (68, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-get-abrupt.js (strict mode) + Classes may not have private methods. at (58, 4) to (63, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-get-abrupt.js (default) + Classes may not have private methods. at (58, 4) to (63, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-boolean-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-boolean-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-number-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-number-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-object-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-object-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-string-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-string-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-symbol-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-symbol-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-abrupt.js (strict mode) + Classes may not have private methods. at (52, 4) to (57, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-abrupt.js (default) + Classes may not have private methods. at (52, 4) to (57, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-boolean-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-boolean-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-null-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-null-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-number-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-number-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-string-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-string-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-symbol-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-symbol-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-undefined-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-undefined-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-call-done-get-abrupt.js (strict mode) + Classes may not have private methods. at (58, 4) to (63, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-call-done-get-abrupt.js (default) + Classes may not have private methods. at (58, 4) to (63, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-call-returns-abrupt.js (strict mode) + Classes may not have private methods. at (50, 4) to (55, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-call-returns-abrupt.js (default) + Classes may not have private methods. at (50, 4) to (55, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-call-value-get-abrupt.js (strict mode) + Classes may not have private methods. at (60, 4) to (65, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-call-value-get-abrupt.js (default) + Classes may not have private methods. at (60, 4) to (65, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-get-abrupt.js (strict mode) + Classes may not have private methods. at (50, 4) to (55, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-get-abrupt.js (default) + Classes may not have private methods. at (50, 4) to (55, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-non-object-ignores-then.js (strict mode) + Classes may not have private methods. at (70, 4) to (75, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-non-object-ignores-then.js (default) + Classes may not have private methods. at (70, 4) to (75, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-boolean-throw.js (strict mode) + Classes may not have private methods. at (47, 4) to (52, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-boolean-throw.js (default) + Classes may not have private methods. at (47, 4) to (52, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-null-throw.js (strict mode) + Classes may not have private methods. at (47, 4) to (52, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-null-throw.js (default) + Classes may not have private methods. at (47, 4) to (52, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-number-throw.js (strict mode) + Classes may not have private methods. at (47, 4) to (52, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-number-throw.js (default) + Classes may not have private methods. at (47, 4) to (52, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-object-throw.js (strict mode) + Classes may not have private methods. at (47, 4) to (52, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-object-throw.js (default) + Classes may not have private methods. at (47, 4) to (52, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-string-throw.js (strict mode) + Classes may not have private methods. at (47, 4) to (52, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-string-throw.js (default) + Classes may not have private methods. at (47, 4) to (52, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-symbol-throw.js (strict mode) + Classes may not have private methods. at (47, 4) to (52, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-symbol-throw.js (default) + Classes may not have private methods. at (47, 4) to (52, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-undefined-throw.js (strict mode) + Classes may not have private methods. at (47, 4) to (52, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-not-callable-undefined-throw.js (default) + Classes may not have private methods. at (47, 4) to (52, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-then-get-abrupt.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-then-get-abrupt.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-boolean-fulfillpromise.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-boolean-fulfillpromise.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-null-fulfillpromise.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-null-fulfillpromise.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-number-fulfillpromise.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-number-fulfillpromise.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-object-fulfillpromise.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-object-fulfillpromise.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-string-fulfillpromise.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-string-fulfillpromise.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-symbol-fulfillpromise.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-symbol-fulfillpromise.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-undefined-fulfillpromise.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-then-non-callable-undefined-fulfillpromise.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-then-returns-abrupt.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-next-then-returns-abrupt.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-sync-next.js (strict mode) + Classes may not have private methods. at (158, 4) to (168, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-sync-next.js (default) + Classes may not have private methods. at (158, 4) to (168, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-sync-return.js (strict mode) + Classes may not have private methods. at (138, 4) to (143, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-sync-return.js (default) + Classes may not have private methods. at (138, 4) to (143, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-sync-throw.js (strict mode) + Classes may not have private methods. at (136, 4) to (146, 5) +language/expressions/class/elements/async-gen-private-method/yield-star-sync-throw.js (default) + Classes may not have private methods. at (136, 4) to (146, 5) +language/expressions/class/elements/comp-name-init-err-contains-arguments.js (strict mode) + Missing parse error +language/expressions/class/elements/comp-name-init-err-contains-arguments.js (default) + Missing parse error +language/expressions/class/elements/equality-init-err-contains-arguments.js (strict mode) + Missing parse error +language/expressions/class/elements/equality-init-err-contains-arguments.js (default) + Missing parse error +language/expressions/class/elements/fields-asi-same-line-2.js (strict mode) + Missing parse error +language/expressions/class/elements/fields-asi-same-line-2.js (default) + Missing parse error +language/expressions/class/elements/fields-multiple-definitions-static-private-methods-proxy.js (strict mode) + Classes may not have private methods. at (27, 2) to (29, 3) +language/expressions/class/elements/fields-multiple-definitions-static-private-methods-proxy.js (default) + Classes may not have private methods. at (27, 2) to (29, 3) +language/expressions/class/elements/gen-private-method-static/yield-spread-arr-multiple.js (strict mode) + Classes may not have private methods. at (35, 4) to (38, 5) +language/expressions/class/elements/gen-private-method-static/yield-spread-arr-multiple.js (default) + Classes may not have private methods. at (35, 4) to (38, 5) +language/expressions/class/elements/gen-private-method-static/yield-spread-arr-single.js (strict mode) + Classes may not have private methods. at (32, 4) to (35, 5) +language/expressions/class/elements/gen-private-method-static/yield-spread-arr-single.js (default) + Classes may not have private methods. at (32, 4) to (35, 5) +language/expressions/class/elements/gen-private-method-static/yield-spread-obj.js (strict mode) + Classes may not have private methods. at (34, 4) to (41, 5) +language/expressions/class/elements/gen-private-method-static/yield-spread-obj.js (default) + Classes may not have private methods. at (34, 4) to (41, 5) +language/expressions/class/elements/gen-private-method/yield-spread-arr-multiple.js (strict mode) + Classes may not have private methods. at (35, 4) to (38, 5) +language/expressions/class/elements/gen-private-method/yield-spread-arr-multiple.js (default) + Classes may not have private methods. at (35, 4) to (38, 5) +language/expressions/class/elements/gen-private-method/yield-spread-arr-single.js (strict mode) + Classes may not have private methods. at (32, 4) to (35, 5) +language/expressions/class/elements/gen-private-method/yield-spread-arr-single.js (default) + Classes may not have private methods. at (32, 4) to (35, 5) +language/expressions/class/elements/gen-private-method/yield-spread-obj.js (strict mode) + Classes may not have private methods. at (34, 4) to (41, 5) +language/expressions/class/elements/gen-private-method/yield-spread-obj.js (default) + Classes may not have private methods. at (34, 4) to (41, 5) +language/expressions/class/elements/literal-name-init-err-contains-arguments.js (strict mode) + Missing parse error +language/expressions/class/elements/literal-name-init-err-contains-arguments.js (default) + Missing parse error +language/expressions/class/elements/multiple-definitions-private-method-usage.js (strict mode) + Classes may not have private methods. at (28, 2) to (28, 28) +language/expressions/class/elements/multiple-definitions-private-method-usage.js (default) + Classes may not have private methods. at (28, 2) to (28, 28) +language/expressions/class/elements/multiple-definitions-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (61, 2) to (63, 3) +language/expressions/class/elements/multiple-definitions-rs-private-method-alt.js (default) + Classes may not have private methods. at (61, 2) to (63, 3) +language/expressions/class/elements/multiple-definitions-rs-private-method.js (strict mode) + Classes may not have private methods. at (61, 2) to (63, 3) +language/expressions/class/elements/multiple-definitions-rs-private-method.js (default) + Classes may not have private methods. at (61, 2) to (63, 3) +language/expressions/class/elements/multiple-definitions-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (65, 2) to (67, 3) +language/expressions/class/elements/multiple-definitions-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (65, 2) to (67, 3) +language/expressions/class/elements/multiple-definitions-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (65, 2) to (67, 3) +language/expressions/class/elements/multiple-definitions-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (65, 2) to (67, 3) +language/expressions/class/elements/multiple-definitions-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (65, 2) to (67, 3) +language/expressions/class/elements/multiple-definitions-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (65, 2) to (67, 3) +language/expressions/class/elements/multiple-definitions-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (65, 2) to (67, 3) +language/expressions/class/elements/multiple-definitions-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (65, 2) to (67, 3) +language/expressions/class/elements/multiple-definitions-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (65, 2) to (67, 3) +language/expressions/class/elements/multiple-definitions-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (65, 2) to (67, 3) +language/expressions/class/elements/multiple-definitions-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (65, 2) to (67, 3) +language/expressions/class/elements/multiple-definitions-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (65, 2) to (67, 3) +language/expressions/class/elements/multiple-definitions-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (62, 2) to (64, 3) +language/expressions/class/elements/multiple-definitions-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (62, 2) to (64, 3) +language/expressions/class/elements/multiple-definitions-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (62, 2) to (64, 3) +language/expressions/class/elements/multiple-definitions-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (62, 2) to (64, 3) +language/expressions/class/elements/multiple-definitions-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (33, 2) to (36, 3) +language/expressions/class/elements/multiple-definitions-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (33, 2) to (36, 3) +language/expressions/class/elements/multiple-definitions-static-private-methods.js (strict mode) + Classes may not have private methods. at (33, 2) to (35, 3) +language/expressions/class/elements/multiple-definitions-static-private-methods.js (default) + Classes may not have private methods. at (33, 2) to (35, 3) +language/expressions/class/elements/multiple-stacked-definitions-private-method-usage.js (strict mode) + Classes may not have private methods. at (26, 2) to (26, 28) +language/expressions/class/elements/multiple-stacked-definitions-private-method-usage.js (default) + Classes may not have private methods. at (26, 2) to (26, 28) +language/expressions/class/elements/multiple-stacked-definitions-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/multiple-stacked-definitions-rs-private-method-alt.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/multiple-stacked-definitions-rs-private-method.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/multiple-stacked-definitions-rs-private-method.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/multiple-stacked-definitions-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/multiple-stacked-definitions-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/multiple-stacked-definitions-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/multiple-stacked-definitions-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/multiple-stacked-definitions-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/multiple-stacked-definitions-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/multiple-stacked-definitions-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/multiple-stacked-definitions-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/multiple-stacked-definitions-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (60, 2) to (62, 3) +language/expressions/class/elements/multiple-stacked-definitions-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (60, 2) to (62, 3) +language/expressions/class/elements/multiple-stacked-definitions-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (60, 2) to (62, 3) +language/expressions/class/elements/multiple-stacked-definitions-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (60, 2) to (62, 3) +language/expressions/class/elements/multiple-stacked-definitions-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (31, 2) to (34, 3) +language/expressions/class/elements/multiple-stacked-definitions-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (31, 2) to (34, 3) +language/expressions/class/elements/multiple-stacked-definitions-static-private-methods.js (strict mode) + Classes may not have private methods. at (31, 2) to (33, 3) +language/expressions/class/elements/multiple-stacked-definitions-static-private-methods.js (default) + Classes may not have private methods. at (31, 2) to (33, 3) +language/expressions/class/elements/new-no-sc-line-method-private-method-usage.js (strict mode) + Classes may not have private methods. at (26, 2) to (26, 28) +language/expressions/class/elements/new-no-sc-line-method-private-method-usage.js (default) + Classes may not have private methods. at (26, 2) to (26, 28) +language/expressions/class/elements/new-no-sc-line-method-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/new-no-sc-line-method-rs-private-method-alt.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/new-no-sc-line-method-rs-private-method.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/new-no-sc-line-method-rs-private-method.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-no-sc-line-method-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-no-sc-line-method-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-no-sc-line-method-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-no-sc-line-method-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-no-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-no-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-no-sc-line-method-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-no-sc-line-method-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-no-sc-line-method-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (60, 2) to (62, 3) +language/expressions/class/elements/new-no-sc-line-method-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (60, 2) to (62, 3) +language/expressions/class/elements/new-no-sc-line-method-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (60, 2) to (62, 3) +language/expressions/class/elements/new-no-sc-line-method-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (60, 2) to (62, 3) +language/expressions/class/elements/new-no-sc-line-method-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (30, 2) to (33, 3) +language/expressions/class/elements/new-no-sc-line-method-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (30, 2) to (33, 3) +language/expressions/class/elements/new-no-sc-line-method-static-private-methods.js (strict mode) + Classes may not have private methods. at (30, 2) to (32, 3) +language/expressions/class/elements/new-no-sc-line-method-static-private-methods.js (default) + Classes may not have private methods. at (30, 2) to (32, 3) +language/expressions/class/elements/new-sc-line-gen-private-method-usage.js (strict mode) + Classes may not have private methods. at (26, 2) to (26, 28) +language/expressions/class/elements/new-sc-line-gen-private-method-usage.js (default) + Classes may not have private methods. at (26, 2) to (26, 28) +language/expressions/class/elements/new-sc-line-gen-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/new-sc-line-gen-rs-private-method-alt.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/new-sc-line-gen-rs-private-method.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/new-sc-line-gen-rs-private-method.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/new-sc-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-sc-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-sc-line-gen-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-sc-line-gen-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-sc-line-gen-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-sc-line-gen-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-sc-line-gen-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-sc-line-gen-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-sc-line-gen-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-sc-line-gen-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-sc-line-gen-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-sc-line-gen-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-sc-line-gen-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (60, 2) to (62, 3) +language/expressions/class/elements/new-sc-line-gen-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (60, 2) to (62, 3) +language/expressions/class/elements/new-sc-line-gen-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (60, 2) to (62, 3) +language/expressions/class/elements/new-sc-line-gen-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (60, 2) to (62, 3) +language/expressions/class/elements/new-sc-line-gen-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (30, 2) to (33, 3) +language/expressions/class/elements/new-sc-line-gen-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (30, 2) to (33, 3) +language/expressions/class/elements/new-sc-line-gen-static-private-methods.js (strict mode) + Classes may not have private methods. at (30, 2) to (32, 3) +language/expressions/class/elements/new-sc-line-gen-static-private-methods.js (default) + Classes may not have private methods. at (30, 2) to (32, 3) +language/expressions/class/elements/new-sc-line-method-private-method-usage.js (strict mode) + Classes may not have private methods. at (26, 2) to (26, 28) +language/expressions/class/elements/new-sc-line-method-private-method-usage.js (default) + Classes may not have private methods. at (26, 2) to (26, 28) +language/expressions/class/elements/new-sc-line-method-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/new-sc-line-method-rs-private-method-alt.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/new-sc-line-method-rs-private-method.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/new-sc-line-method-rs-private-method.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/new-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-sc-line-method-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-sc-line-method-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-sc-line-method-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-sc-line-method-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-sc-line-method-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-sc-line-method-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-sc-line-method-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-sc-line-method-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/new-sc-line-method-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (60, 2) to (62, 3) +language/expressions/class/elements/new-sc-line-method-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (60, 2) to (62, 3) +language/expressions/class/elements/new-sc-line-method-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (60, 2) to (62, 3) +language/expressions/class/elements/new-sc-line-method-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (60, 2) to (62, 3) +language/expressions/class/elements/new-sc-line-method-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (30, 2) to (33, 3) +language/expressions/class/elements/new-sc-line-method-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (30, 2) to (33, 3) +language/expressions/class/elements/new-sc-line-method-static-private-methods.js (strict mode) + Classes may not have private methods. at (30, 2) to (32, 3) +language/expressions/class/elements/new-sc-line-method-static-private-methods.js (default) + Classes may not have private methods. at (30, 2) to (32, 3) +language/expressions/class/elements/private-arrow-fnc-init-err-contains-arguments.js (strict mode) + Missing parse error +language/expressions/class/elements/private-arrow-fnc-init-err-contains-arguments.js (default) + Missing parse error +language/expressions/class/elements/private-literal-name-init-err-contains-arguments.js (strict mode) + Missing parse error +language/expressions/class/elements/private-literal-name-init-err-contains-arguments.js (default) + Missing parse error +language/expressions/class/elements/private-methods/prod-private-async-generator.js (strict mode) + Classes may not have private methods. at (89, 2) to (89, 29) +language/expressions/class/elements/private-methods/prod-private-async-generator.js (default) + Classes may not have private methods. at (89, 2) to (89, 29) +language/expressions/class/elements/private-methods/prod-private-async-method.js (strict mode) + Classes may not have private methods. at (89, 2) to (89, 27) +language/expressions/class/elements/private-methods/prod-private-async-method.js (default) + Classes may not have private methods. at (89, 2) to (89, 27) +language/expressions/class/elements/private-methods/prod-private-generator.js (strict mode) + Classes may not have private methods. at (87, 2) to (87, 23) +language/expressions/class/elements/private-methods/prod-private-generator.js (default) + Classes may not have private methods. at (87, 2) to (87, 23) +language/expressions/class/elements/private-methods/prod-private-method-initialize-order.js (strict mode) + Classes may not have private methods. at (104, 2) to (104, 21) +language/expressions/class/elements/private-methods/prod-private-method-initialize-order.js (default) + Classes may not have private methods. at (104, 2) to (104, 21) +language/expressions/class/elements/private-methods/prod-private-method.js (strict mode) + Classes may not have private methods. at (87, 2) to (87, 21) +language/expressions/class/elements/private-methods/prod-private-method.js (default) + Classes may not have private methods. at (87, 2) to (87, 21) +language/expressions/class/elements/private-ternary-init-err-contains-arguments.js (strict mode) + Missing parse error +language/expressions/class/elements/private-ternary-init-err-contains-arguments.js (default) + Missing parse error +language/expressions/class/elements/private-typeof-init-err-contains-arguments.js (strict mode) + Missing parse error +language/expressions/class/elements/private-typeof-init-err-contains-arguments.js (default) + Missing parse error +language/expressions/class/elements/regular-definitions-private-method-usage.js (strict mode) + Classes may not have private methods. at (25, 2) to (25, 28) +language/expressions/class/elements/regular-definitions-private-method-usage.js (default) + Classes may not have private methods. at (25, 2) to (25, 28) +language/expressions/class/elements/regular-definitions-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (58, 2) to (60, 3) +language/expressions/class/elements/regular-definitions-rs-private-method-alt.js (default) + Classes may not have private methods. at (58, 2) to (60, 3) +language/expressions/class/elements/regular-definitions-rs-private-method.js (strict mode) + Classes may not have private methods. at (58, 2) to (60, 3) +language/expressions/class/elements/regular-definitions-rs-private-method.js (default) + Classes may not have private methods. at (58, 2) to (60, 3) +language/expressions/class/elements/regular-definitions-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (62, 2) to (64, 3) +language/expressions/class/elements/regular-definitions-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (62, 2) to (64, 3) +language/expressions/class/elements/regular-definitions-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (62, 2) to (64, 3) +language/expressions/class/elements/regular-definitions-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (62, 2) to (64, 3) +language/expressions/class/elements/regular-definitions-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (62, 2) to (64, 3) +language/expressions/class/elements/regular-definitions-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (62, 2) to (64, 3) +language/expressions/class/elements/regular-definitions-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (62, 2) to (64, 3) +language/expressions/class/elements/regular-definitions-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (62, 2) to (64, 3) +language/expressions/class/elements/regular-definitions-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (62, 2) to (64, 3) +language/expressions/class/elements/regular-definitions-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (62, 2) to (64, 3) +language/expressions/class/elements/regular-definitions-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (62, 2) to (64, 3) +language/expressions/class/elements/regular-definitions-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (62, 2) to (64, 3) +language/expressions/class/elements/regular-definitions-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/regular-definitions-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/regular-definitions-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/regular-definitions-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/regular-definitions-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (28, 2) to (31, 3) +language/expressions/class/elements/regular-definitions-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (28, 2) to (31, 3) +language/expressions/class/elements/regular-definitions-static-private-methods.js (strict mode) + Classes may not have private methods. at (28, 2) to (30, 3) +language/expressions/class/elements/regular-definitions-static-private-methods.js (default) + Classes may not have private methods. at (28, 2) to (30, 3) +language/expressions/class/elements/same-line-async-gen-private-method-usage.js (strict mode) + Classes may not have private methods. at (26, 28) to (26, 54) +language/expressions/class/elements/same-line-async-gen-private-method-usage.js (default) + Classes may not have private methods. at (26, 28) to (26, 54) +language/expressions/class/elements/same-line-async-gen-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/same-line-async-gen-rs-private-method-alt.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/same-line-async-gen-rs-private-method.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/same-line-async-gen-rs-private-method.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/same-line-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 28) to (65, 3) +language/expressions/class/elements/same-line-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 28) to (65, 3) +language/expressions/class/elements/same-line-async-gen-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 28) to (65, 3) +language/expressions/class/elements/same-line-async-gen-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 28) to (65, 3) +language/expressions/class/elements/same-line-async-gen-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 28) to (65, 3) +language/expressions/class/elements/same-line-async-gen-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 28) to (65, 3) +language/expressions/class/elements/same-line-async-gen-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 28) to (65, 3) +language/expressions/class/elements/same-line-async-gen-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 28) to (65, 3) +language/expressions/class/elements/same-line-async-gen-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 28) to (65, 3) +language/expressions/class/elements/same-line-async-gen-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 28) to (65, 3) +language/expressions/class/elements/same-line-async-gen-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 28) to (65, 3) +language/expressions/class/elements/same-line-async-gen-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 28) to (65, 3) +language/expressions/class/elements/same-line-async-gen-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (60, 28) to (62, 3) +language/expressions/class/elements/same-line-async-gen-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (60, 28) to (62, 3) +language/expressions/class/elements/same-line-async-gen-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (60, 28) to (62, 3) +language/expressions/class/elements/same-line-async-gen-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (60, 28) to (62, 3) +language/expressions/class/elements/same-line-async-gen-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (29, 2) to (32, 3) +language/expressions/class/elements/same-line-async-gen-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (29, 2) to (32, 3) +language/expressions/class/elements/same-line-async-gen-static-private-methods.js (strict mode) + Classes may not have private methods. at (29, 2) to (31, 3) +language/expressions/class/elements/same-line-async-gen-static-private-methods.js (default) + Classes may not have private methods. at (29, 2) to (31, 3) +language/expressions/class/elements/same-line-async-method-private-method-usage.js (strict mode) + Classes may not have private methods. at (26, 27) to (26, 53) +language/expressions/class/elements/same-line-async-method-private-method-usage.js (default) + Classes may not have private methods. at (26, 27) to (26, 53) +language/expressions/class/elements/same-line-async-method-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/same-line-async-method-rs-private-method-alt.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/same-line-async-method-rs-private-method.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/same-line-async-method-rs-private-method.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/same-line-async-method-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 27) to (65, 3) +language/expressions/class/elements/same-line-async-method-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 27) to (65, 3) +language/expressions/class/elements/same-line-async-method-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 27) to (65, 3) +language/expressions/class/elements/same-line-async-method-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 27) to (65, 3) +language/expressions/class/elements/same-line-async-method-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 27) to (65, 3) +language/expressions/class/elements/same-line-async-method-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 27) to (65, 3) +language/expressions/class/elements/same-line-async-method-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 27) to (65, 3) +language/expressions/class/elements/same-line-async-method-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 27) to (65, 3) +language/expressions/class/elements/same-line-async-method-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 27) to (65, 3) +language/expressions/class/elements/same-line-async-method-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 27) to (65, 3) +language/expressions/class/elements/same-line-async-method-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 27) to (65, 3) +language/expressions/class/elements/same-line-async-method-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 27) to (65, 3) +language/expressions/class/elements/same-line-async-method-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (60, 27) to (62, 3) +language/expressions/class/elements/same-line-async-method-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (60, 27) to (62, 3) +language/expressions/class/elements/same-line-async-method-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (60, 27) to (62, 3) +language/expressions/class/elements/same-line-async-method-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (60, 27) to (62, 3) +language/expressions/class/elements/same-line-async-method-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (29, 2) to (32, 3) +language/expressions/class/elements/same-line-async-method-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (29, 2) to (32, 3) +language/expressions/class/elements/same-line-async-method-static-private-methods.js (strict mode) + Classes may not have private methods. at (29, 2) to (31, 3) +language/expressions/class/elements/same-line-async-method-static-private-methods.js (default) + Classes may not have private methods. at (29, 2) to (31, 3) +language/expressions/class/elements/same-line-gen-private-method-usage.js (strict mode) + Classes may not have private methods. at (26, 2) to (26, 28) +language/expressions/class/elements/same-line-gen-private-method-usage.js (default) + Classes may not have private methods. at (26, 2) to (26, 28) +language/expressions/class/elements/same-line-gen-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/same-line-gen-rs-private-method-alt.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/same-line-gen-rs-private-method.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/same-line-gen-rs-private-method.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/same-line-gen-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/same-line-gen-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/same-line-gen-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/same-line-gen-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/same-line-gen-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/same-line-gen-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/same-line-gen-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/same-line-gen-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/same-line-gen-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/same-line-gen-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/same-line-gen-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (60, 2) to (62, 3) +language/expressions/class/elements/same-line-gen-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (60, 2) to (62, 3) +language/expressions/class/elements/same-line-gen-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (60, 2) to (62, 3) +language/expressions/class/elements/same-line-gen-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (60, 2) to (62, 3) +language/expressions/class/elements/same-line-gen-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (29, 2) to (32, 3) +language/expressions/class/elements/same-line-gen-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (29, 2) to (32, 3) +language/expressions/class/elements/same-line-gen-static-private-methods.js (strict mode) + Classes may not have private methods. at (29, 2) to (31, 3) +language/expressions/class/elements/same-line-gen-static-private-methods.js (default) + Classes may not have private methods. at (29, 2) to (31, 3) +language/expressions/class/elements/same-line-method-private-method-usage.js (strict mode) + Classes may not have private methods. at (26, 2) to (26, 28) +language/expressions/class/elements/same-line-method-private-method-usage.js (default) + Classes may not have private methods. at (26, 2) to (26, 28) +language/expressions/class/elements/same-line-method-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/same-line-method-rs-private-method-alt.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/same-line-method-rs-private-method.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/same-line-method-rs-private-method.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/same-line-method-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/same-line-method-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/same-line-method-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/same-line-method-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/same-line-method-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/same-line-method-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/same-line-method-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/same-line-method-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/same-line-method-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/same-line-method-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/expressions/class/elements/same-line-method-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (60, 2) to (62, 3) +language/expressions/class/elements/same-line-method-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (60, 2) to (62, 3) +language/expressions/class/elements/same-line-method-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (60, 2) to (62, 3) +language/expressions/class/elements/same-line-method-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (60, 2) to (62, 3) +language/expressions/class/elements/same-line-method-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (29, 2) to (32, 3) +language/expressions/class/elements/same-line-method-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (29, 2) to (32, 3) +language/expressions/class/elements/same-line-method-static-private-methods.js (strict mode) + Classes may not have private methods. at (29, 2) to (31, 3) +language/expressions/class/elements/same-line-method-static-private-methods.js (default) + Classes may not have private methods. at (29, 2) to (31, 3) +language/expressions/class/elements/static-comp-name-init-err-contains-arguments.js (strict mode) + Missing parse error +language/expressions/class/elements/static-comp-name-init-err-contains-arguments.js (default) + Missing parse error +language/expressions/class/elements/static-literal-init-err-contains-arguments.js (strict mode) + Missing parse error +language/expressions/class/elements/static-literal-init-err-contains-arguments.js (default) + Missing parse error +language/expressions/class/elements/static-private-init-err-contains-arguments.js (strict mode) + Missing parse error +language/expressions/class/elements/static-private-init-err-contains-arguments.js (default) + Missing parse error +language/expressions/class/elements/static-private-methods-proxy-default-handler-throws.js (strict mode) + Classes may not have private methods. at (18, 2) to (20, 3) +language/expressions/class/elements/static-private-methods-proxy-default-handler-throws.js (default) + Classes may not have private methods. at (18, 2) to (20, 3) +language/expressions/class/elements/static-string-literal-name-init-err-contains-arguments.js (strict mode) + Missing parse error +language/expressions/class/elements/static-string-literal-name-init-err-contains-arguments.js (default) + Missing parse error +language/expressions/class/elements/string-literal-name-init-err-contains-arguments.js (strict mode) + Missing parse error +language/expressions/class/elements/string-literal-name-init-err-contains-arguments.js (default) + Missing parse error +language/expressions/class/elements/syntax/early-errors/grammar-ctor-super-no-heritage.js (strict mode) + Missing parse error +language/expressions/class/elements/syntax/early-errors/grammar-ctor-super-no-heritage.js (default) + Missing parse error +language/expressions/class/elements/syntax/early-errors/grammar-field-identifier-invalid-zwj-error.js (strict mode) + Missing parse error +language/expressions/class/elements/syntax/early-errors/grammar-field-identifier-invalid-zwj-error.js (default) + Missing parse error +language/expressions/class/elements/syntax/early-errors/grammar-field-identifier-invalid-zwnj-error.js (strict mode) + Missing parse error +language/expressions/class/elements/syntax/early-errors/grammar-field-identifier-invalid-zwnj-error.js (default) + Missing parse error +language/expressions/class/elements/syntax/early-errors/grammar-privatename-identifier-invalid-zwj-error.js (strict mode) + Missing parse error +language/expressions/class/elements/syntax/early-errors/grammar-privatename-identifier-invalid-zwj-error.js (default) + Missing parse error +language/expressions/class/elements/syntax/early-errors/grammar-privatename-identifier-invalid-zwnj-error.js (strict mode) + Missing parse error +language/expressions/class/elements/syntax/early-errors/grammar-privatename-identifier-invalid-zwnj-error.js (default) + Missing parse error +language/expressions/class/elements/syntax/early-errors/grammar-special-meth-ctor-async-gen.js (strict mode) + Missing parse error +language/expressions/class/elements/syntax/early-errors/grammar-special-meth-ctor-async-gen.js (default) + Missing parse error +language/expressions/class/elements/syntax/early-errors/grammar-special-meth-ctor-async-meth.js (strict mode) + Missing parse error +language/expressions/class/elements/syntax/early-errors/grammar-special-meth-ctor-async-meth.js (default) + Missing parse error +language/expressions/class/elements/syntax/early-errors/grammar-special-meth-ctor-gen.js (strict mode) + Missing parse error +language/expressions/class/elements/syntax/early-errors/grammar-special-meth-ctor-gen.js (default) + Missing parse error +language/expressions/class/elements/syntax/early-errors/grammar-special-meth-ctor-get.js (strict mode) + Missing parse error +language/expressions/class/elements/syntax/early-errors/grammar-special-meth-ctor-get.js (default) + Missing parse error +language/expressions/class/elements/syntax/early-errors/grammar-special-meth-ctor-set.js (strict mode) + Missing parse error +language/expressions/class/elements/syntax/early-errors/grammar-special-meth-ctor-set.js (default) + Missing parse error +language/expressions/class/elements/syntax/early-errors/grammar-static-async-gen-meth-prototype.js (strict mode) + Missing parse error +language/expressions/class/elements/syntax/early-errors/grammar-static-async-gen-meth-prototype.js (default) + Missing parse error +language/expressions/class/elements/syntax/early-errors/grammar-static-async-meth-prototype.js (strict mode) + Missing parse error +language/expressions/class/elements/syntax/early-errors/grammar-static-async-meth-prototype.js (default) + Missing parse error +language/expressions/class/elements/syntax/early-errors/grammar-static-gen-meth-prototype.js (strict mode) + Missing parse error +language/expressions/class/elements/syntax/early-errors/grammar-static-gen-meth-prototype.js (default) + Missing parse error +language/expressions/class/elements/syntax/early-errors/grammar-static-get-meth-prototype.js (strict mode) + Missing parse error +language/expressions/class/elements/syntax/early-errors/grammar-static-get-meth-prototype.js (default) + Missing parse error +language/expressions/class/elements/syntax/early-errors/grammar-static-meth-prototype.js (strict mode) + Missing parse error +language/expressions/class/elements/syntax/early-errors/grammar-static-meth-prototype.js (default) + Missing parse error +language/expressions/class/elements/syntax/early-errors/grammar-static-set-meth-prototype.js (strict mode) + Missing parse error +language/expressions/class/elements/syntax/early-errors/grammar-static-set-meth-prototype.js (default) + Missing parse error +language/expressions/class/elements/syntax/valid/grammar-privatemeth-duplicate-meth-nestedclassmeth.js (strict mode) + Classes may not have private methods. at (21, 6) to (21, 13) +language/expressions/class/elements/syntax/valid/grammar-privatemeth-duplicate-meth-nestedclassmeth.js (default) + Classes may not have private methods. at (21, 6) to (21, 13) +language/expressions/class/elements/syntax/valid/grammar-static-private-async-gen-meth-prototype.js (strict mode) + Classes may not have private methods. at (19, 2) to (19, 32) +language/expressions/class/elements/syntax/valid/grammar-static-private-async-gen-meth-prototype.js (default) + Classes may not have private methods. at (19, 2) to (19, 32) +language/expressions/class/elements/syntax/valid/grammar-static-private-async-meth-prototype.js (strict mode) + Classes may not have private methods. at (19, 2) to (19, 30) +language/expressions/class/elements/syntax/valid/grammar-static-private-async-meth-prototype.js (default) + Classes may not have private methods. at (19, 2) to (19, 30) +language/expressions/class/elements/syntax/valid/grammar-static-private-gen-meth-prototype.js (strict mode) + Classes may not have private methods. at (19, 2) to (19, 26) +language/expressions/class/elements/syntax/valid/grammar-static-private-gen-meth-prototype.js (default) + Classes may not have private methods. at (19, 2) to (19, 26) +language/expressions/class/elements/syntax/valid/grammar-static-private-meth-prototype.js (strict mode) + Classes may not have private methods. at (19, 2) to (19, 24) +language/expressions/class/elements/syntax/valid/grammar-static-private-meth-prototype.js (default) + Classes may not have private methods. at (19, 2) to (19, 24) +language/expressions/class/elements/ternary-init-err-contains-arguments.js (strict mode) + Missing parse error +language/expressions/class/elements/ternary-init-err-contains-arguments.js (default) + Missing parse error +language/expressions/class/elements/typeof-init-err-contains-arguments.js (strict mode) + Missing parse error +language/expressions/class/elements/typeof-init-err-contains-arguments.js (default) + Missing parse error +language/expressions/class/elements/wrapped-in-sc-private-method-usage.js (strict mode) + Classes may not have private methods. at (26, 8) to (26, 34) +language/expressions/class/elements/wrapped-in-sc-private-method-usage.js (default) + Classes may not have private methods. at (26, 8) to (26, 34) +language/expressions/class/elements/wrapped-in-sc-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/wrapped-in-sc-rs-private-method-alt.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/wrapped-in-sc-rs-private-method.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/wrapped-in-sc-rs-private-method.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/expressions/class/elements/wrapped-in-sc-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 8) to (65, 3) +language/expressions/class/elements/wrapped-in-sc-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 8) to (65, 3) +language/expressions/class/elements/wrapped-in-sc-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 8) to (65, 3) +language/expressions/class/elements/wrapped-in-sc-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 8) to (65, 3) +language/expressions/class/elements/wrapped-in-sc-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 8) to (65, 3) +language/expressions/class/elements/wrapped-in-sc-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 8) to (65, 3) +language/expressions/class/elements/wrapped-in-sc-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 8) to (65, 3) +language/expressions/class/elements/wrapped-in-sc-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 8) to (65, 3) +language/expressions/class/elements/wrapped-in-sc-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 8) to (65, 3) +language/expressions/class/elements/wrapped-in-sc-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 8) to (65, 3) +language/expressions/class/elements/wrapped-in-sc-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 8) to (65, 3) +language/expressions/class/elements/wrapped-in-sc-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 8) to (65, 3) +language/expressions/class/elements/wrapped-in-sc-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (60, 8) to (62, 3) +language/expressions/class/elements/wrapped-in-sc-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (60, 8) to (62, 3) +language/expressions/class/elements/wrapped-in-sc-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (60, 8) to (62, 3) +language/expressions/class/elements/wrapped-in-sc-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (60, 8) to (62, 3) +language/expressions/class/elements/wrapped-in-sc-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (30, 2) to (33, 3) +language/expressions/class/elements/wrapped-in-sc-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (30, 2) to (33, 3) +language/expressions/class/elements/wrapped-in-sc-static-private-methods.js (strict mode) + Classes may not have private methods. at (30, 2) to (32, 3) +language/expressions/class/elements/wrapped-in-sc-static-private-methods.js (default) + Classes may not have private methods. at (30, 2) to (32, 3) +language/expressions/dynamic-import/assignment-expression/import-meta.js (strict mode) + Unexpected token `.`, expected the token `(` at (22, 23) to (22, 24) +language/expressions/dynamic-import/assignment-expression/import-meta.js (default) + Unexpected token `.`, expected the token `(` at (22, 23) to (22, 24) +language/expressions/function/use-strict-with-non-simple-param.js (strict mode) + Missing parse error +language/expressions/function/use-strict-with-non-simple-param.js (default) + Missing parse error +language/expressions/generators/use-strict-with-non-simple-param.js (strict mode) + Missing parse error +language/expressions/generators/use-strict-with-non-simple-param.js (default) + Missing parse error +language/expressions/import.meta/distinct-for-each-module.js (strict mode) + Unexpected token `.`, expected the token `(` at (28, 26) to (28, 27) +language/expressions/import.meta/distinct-for-each-module.js (default) + Unexpected token `.`, expected the token `(` at (28, 26) to (28, 27) +language/expressions/import.meta/import-meta-is-an-ordinary-object.js (strict mode) + Unexpected token `.`, expected the token `(` at (27, 30) to (27, 31) +language/expressions/import.meta/import-meta-is-an-ordinary-object.js (default) + Unexpected token `.`, expected the token `(` at (27, 30) to (27, 31) +language/expressions/import.meta/same-object-returned.js (strict mode) + Unexpected token `.`, expected the token `(` at (27, 14) to (27, 15) +language/expressions/import.meta/same-object-returned.js (default) + Unexpected token `.`, expected the token `(` at (27, 14) to (27, 15) +language/expressions/import.meta/syntax/goal-module-nested-function.js (strict mode) + Unexpected token `.`, expected the token `(` at (15, 8) to (15, 9) +language/expressions/import.meta/syntax/goal-module-nested-function.js (default) + Unexpected token `.`, expected the token `(` at (15, 8) to (15, 9) +language/expressions/import.meta/syntax/goal-module.js (strict mode) + Unexpected token `.`, expected an identifier at (14, 6) to (14, 7) +language/expressions/import.meta/syntax/goal-module.js (default) + Unexpected token `.`, expected an identifier at (14, 6) to (14, 7) +language/expressions/object/method-definition/early-errors-object-async-method-duplicate-parameters.js (default) + Missing parse error +language/expressions/object/method-definition/early-errors-object-method-NSPL-with-USD.js (strict mode) + Missing parse error +language/expressions/object/method-definition/early-errors-object-method-NSPL-with-USD.js (default) + Missing parse error +language/expressions/object/method-definition/early-errors-object-method-await-in-formals-default.js (strict mode) + Missing parse error +language/expressions/object/method-definition/early-errors-object-method-await-in-formals-default.js (default) + Missing parse error +language/expressions/object/method-definition/early-errors-object-method-await-in-formals.js (strict mode) + Missing parse error +language/expressions/object/method-definition/early-errors-object-method-await-in-formals.js (default) + Missing parse error +language/expressions/object/method-definition/early-errors-object-method-duplicate-parameters.js (default) + Missing parse error +language/expressions/object/method-definition/generator-param-redecl-const.js (strict mode) + Missing parse error +language/expressions/object/method-definition/generator-param-redecl-const.js (default) + Missing parse error +language/expressions/object/method-definition/generator-param-redecl-let.js (strict mode) + Missing parse error +language/expressions/object/method-definition/generator-param-redecl-let.js (default) + Missing parse error +language/expressions/object/method-definition/generator-use-strict-with-non-simple-param.js (strict mode) + Missing parse error +language/expressions/object/method-definition/generator-use-strict-with-non-simple-param.js (default) + Missing parse error +language/expressions/object/method-definition/name-param-redecl.js (strict mode) + Missing parse error +language/expressions/object/method-definition/name-param-redecl.js (default) + Missing parse error +language/expressions/object/method-definition/setter-use-strict-with-non-simple-param.js (strict mode) + Missing parse error +language/expressions/object/method-definition/setter-use-strict-with-non-simple-param.js (default) + Missing parse error +language/expressions/object/method-definition/use-strict-with-non-simple-param.js (strict mode) + Missing parse error +language/expressions/object/method-definition/use-strict-with-non-simple-param.js (default) + Missing parse error +language/expressions/tagged-template/invalid-escape-sequences.js (strict mode) + Unexpected token ILLEGAL at (21, 4) to (21, 5) +language/expressions/tagged-template/invalid-escape-sequences.js (default) + Unexpected token ILLEGAL at (21, 4) to (21, 5) +language/expressions/template-literal/invalid-legacy-octal-escape-sequence.js (strict mode) + Missing parse error +language/expressions/template-literal/invalid-legacy-octal-escape-sequence.js (default) + Missing parse error +language/global-code/export.js (strict mode) + Missing parse error +language/global-code/export.js (default) + Missing parse error +language/global-code/import.js (strict mode) + Missing parse error +language/global-code/import.js (default) + Missing parse error +language/global-code/new.target-arrow.js (strict mode) + Missing parse error +language/global-code/new.target-arrow.js (default) + Missing parse error +language/import/dup-bound-names.js (strict mode) + Missing parse error +language/import/dup-bound-names.js (default) + Missing parse error +language/line-terminators/invalid-string-cr.js (strict mode) + Missing parse error +language/line-terminators/invalid-string-cr.js (default) + Missing parse error +language/literals/regexp/early-err-dup-flag.js (strict mode) + Missing parse error +language/literals/regexp/early-err-dup-flag.js (default) + Missing parse error +language/literals/regexp/early-err-pattern.js (strict mode) + Missing parse error +language/literals/regexp/early-err-pattern.js (default) + Missing parse error +language/literals/regexp/invalid-braced-quantifier-exact.js (strict mode) + Missing parse error +language/literals/regexp/invalid-braced-quantifier-exact.js (default) + Missing parse error +language/literals/regexp/invalid-braced-quantifier-lower.js (strict mode) + Missing parse error +language/literals/regexp/invalid-braced-quantifier-lower.js (default) + Missing parse error +language/literals/regexp/invalid-braced-quantifier-range.js (strict mode) + Missing parse error +language/literals/regexp/invalid-braced-quantifier-range.js (default) + Missing parse error +language/literals/regexp/invalid-optional-lookbehind.js (strict mode) + Missing parse error +language/literals/regexp/invalid-optional-lookbehind.js (default) + Missing parse error +language/literals/regexp/invalid-optional-negative-lookbehind.js (strict mode) + Missing parse error +language/literals/regexp/invalid-optional-negative-lookbehind.js (default) + Missing parse error +language/literals/regexp/invalid-range-lookbehind.js (strict mode) + Missing parse error +language/literals/regexp/invalid-range-lookbehind.js (default) + Missing parse error +language/literals/regexp/invalid-range-negative-lookbehind.js (strict mode) + Missing parse error +language/literals/regexp/invalid-range-negative-lookbehind.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-dangling-groupname-2-u.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-dangling-groupname-2-u.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-dangling-groupname-2.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-dangling-groupname-2.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-dangling-groupname-3-u.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-dangling-groupname-3-u.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-dangling-groupname-3.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-dangling-groupname-3.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-dangling-groupname-4-u.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-dangling-groupname-4-u.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-dangling-groupname-4.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-dangling-groupname-4.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-dangling-groupname-5.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-dangling-groupname-5.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-dangling-groupname-u.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-dangling-groupname-u.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-dangling-groupname-without-group-u.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-dangling-groupname-without-group-u.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-dangling-groupname.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-dangling-groupname.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-2-u.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-2-u.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-2.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-2.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-u.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-u.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-duplicate-groupspecifier.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-duplicate-groupspecifier.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-empty-groupspecifier-u.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-empty-groupspecifier-u.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-empty-groupspecifier.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-empty-groupspecifier.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-identity-escape-in-capture-u.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-identity-escape-in-capture-u.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-incomplete-groupname-2-u.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-incomplete-groupname-2-u.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-incomplete-groupname-2.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-incomplete-groupname-2.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-incomplete-groupname-3-u.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-incomplete-groupname-3-u.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-incomplete-groupname-3.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-incomplete-groupname-3.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-incomplete-groupname-4.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-incomplete-groupname-4.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-incomplete-groupname-5.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-incomplete-groupname-5.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-incomplete-groupname-6.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-incomplete-groupname-6.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-incomplete-groupname-u.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-incomplete-groupname-u.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-incomplete-groupname-without-group-2-u.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-incomplete-groupname-without-group-2-u.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-incomplete-groupname-without-group-3-u.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-incomplete-groupname-without-group-3-u.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-incomplete-groupname-without-group-u.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-incomplete-groupname-without-group-u.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-incomplete-groupname.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-incomplete-groupname.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-4-u.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-4-u.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-4.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-4.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-2-u.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-2-u.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-2.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-2.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-3.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-3.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-4-u.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-4-u.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-4.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-4.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-5-u.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-5-u.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-5.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-5.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-6.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-6.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-7.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-7.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-8-u.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-8-u.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-8.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-8.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-9-u.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-9-u.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-u.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-u.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-numeric-groupspecifier-u.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-numeric-groupspecifier-u.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-numeric-groupspecifier.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-numeric-groupspecifier.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-punctuator-starting-groupspecifier-u.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-punctuator-starting-groupspecifier-u.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-punctuator-starting-groupspecifier.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-punctuator-starting-groupspecifier.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-punctuator-within-groupspecifier-u.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-punctuator-within-groupspecifier-u.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-punctuator-within-groupspecifier.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-punctuator-within-groupspecifier.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-u-escape-in-groupspecifier-2.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-u-escape-in-groupspecifier-2.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-u-escape-in-groupspecifier.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-u-escape-in-groupspecifier.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-unterminated-groupspecifier-u.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-unterminated-groupspecifier-u.js (default) + Missing parse error +language/literals/regexp/named-groups/invalid-unterminated-groupspecifier.js (strict mode) + Missing parse error +language/literals/regexp/named-groups/invalid-unterminated-groupspecifier.js (default) + Missing parse error +language/literals/regexp/u-dec-esc.js (strict mode) + Missing parse error +language/literals/regexp/u-dec-esc.js (default) + Missing parse error +language/literals/regexp/u-invalid-class-escape.js (strict mode) + Missing parse error +language/literals/regexp/u-invalid-class-escape.js (default) + Missing parse error +language/literals/regexp/u-invalid-extended-pattern-char.js (strict mode) + Missing parse error +language/literals/regexp/u-invalid-extended-pattern-char.js (default) + Missing parse error +language/literals/regexp/u-invalid-identity-escape.js (strict mode) + Missing parse error +language/literals/regexp/u-invalid-identity-escape.js (default) + Missing parse error +language/literals/regexp/u-invalid-legacy-octal-escape.js (strict mode) + Missing parse error +language/literals/regexp/u-invalid-legacy-octal-escape.js (default) + Missing parse error +language/literals/regexp/u-invalid-non-empty-class-ranges-no-dash-a.js (strict mode) + Missing parse error +language/literals/regexp/u-invalid-non-empty-class-ranges-no-dash-a.js (default) + Missing parse error +language/literals/regexp/u-invalid-non-empty-class-ranges-no-dash-ab.js (strict mode) + Missing parse error +language/literals/regexp/u-invalid-non-empty-class-ranges-no-dash-ab.js (default) + Missing parse error +language/literals/regexp/u-invalid-non-empty-class-ranges-no-dash-b.js (strict mode) + Missing parse error +language/literals/regexp/u-invalid-non-empty-class-ranges-no-dash-b.js (default) + Missing parse error +language/literals/regexp/u-invalid-non-empty-class-ranges.js (strict mode) + Missing parse error +language/literals/regexp/u-invalid-non-empty-class-ranges.js (default) + Missing parse error +language/literals/regexp/u-invalid-oob-decimal-escape.js (strict mode) + Missing parse error +language/literals/regexp/u-invalid-oob-decimal-escape.js (default) + Missing parse error +language/literals/regexp/u-invalid-optional-lookahead.js (strict mode) + Missing parse error +language/literals/regexp/u-invalid-optional-lookahead.js (default) + Missing parse error +language/literals/regexp/u-invalid-optional-lookbehind.js (strict mode) + Missing parse error +language/literals/regexp/u-invalid-optional-lookbehind.js (default) + Missing parse error +language/literals/regexp/u-invalid-optional-negative-lookahead.js (strict mode) + Missing parse error +language/literals/regexp/u-invalid-optional-negative-lookahead.js (default) + Missing parse error +language/literals/regexp/u-invalid-optional-negative-lookbehind.js (strict mode) + Missing parse error +language/literals/regexp/u-invalid-optional-negative-lookbehind.js (default) + Missing parse error +language/literals/regexp/u-invalid-range-lookahead.js (strict mode) + Missing parse error +language/literals/regexp/u-invalid-range-lookahead.js (default) + Missing parse error +language/literals/regexp/u-invalid-range-lookbehind.js (strict mode) + Missing parse error +language/literals/regexp/u-invalid-range-lookbehind.js (default) + Missing parse error +language/literals/regexp/u-invalid-range-negative-lookahead.js (strict mode) + Missing parse error +language/literals/regexp/u-invalid-range-negative-lookahead.js (default) + Missing parse error +language/literals/regexp/u-invalid-range-negative-lookbehind.js (strict mode) + Missing parse error +language/literals/regexp/u-invalid-range-negative-lookbehind.js (default) + Missing parse error +language/literals/regexp/u-unicode-esc-bounds.js (strict mode) + Missing parse error +language/literals/regexp/u-unicode-esc-bounds.js (default) + Missing parse error +language/literals/regexp/u-unicode-esc-non-hex.js (strict mode) + Missing parse error +language/literals/regexp/u-unicode-esc-non-hex.js (default) + Missing parse error +language/literals/regexp/unicode-escape-nls-err.js (strict mode) + Missing parse error +language/literals/regexp/unicode-escape-nls-err.js (default) + Missing parse error +language/literals/string/legacy-non-octal-escape-sequence-strict.js (strict mode) + Missing parse error +language/module-code/early-export-global.js (strict mode) + Missing parse error +language/module-code/early-export-global.js (default) + Missing parse error +language/module-code/early-export-unresolvable.js (strict mode) + Missing parse error +language/module-code/early-export-unresolvable.js (default) + Missing parse error +language/module-code/early-import-arguments.js (strict mode) + Missing parse error +language/module-code/early-import-arguments.js (default) + Missing parse error +language/module-code/early-import-as-arguments.js (strict mode) + Missing parse error +language/module-code/early-import-as-arguments.js (default) + Missing parse error +language/module-code/early-import-as-eval.js (strict mode) + Missing parse error +language/module-code/early-import-as-eval.js (default) + Missing parse error +language/module-code/early-import-eval.js (strict mode) + Missing parse error +language/module-code/early-import-eval.js (default) + Missing parse error +language/module-code/early-lex-and-var.js (strict mode) + Missing parse error +language/module-code/early-lex-and-var.js (default) + Missing parse error +language/module-code/early-strict-mode.js (default) + Missing parse error +language/module-code/eval-rqstd-once.js (strict mode) + Type declarations are not allowed in untyped mode at (26, 12) to (26, 15) +language/module-code/eval-rqstd-once.js (default) + Type declarations are not allowed in untyped mode at (26, 12) to (26, 15) +language/module-code/eval-rqstd-order.js (strict mode) + Type declarations are not allowed in untyped mode at (40, 12) to (40, 15) +language/module-code/eval-rqstd-order.js (default) + Type declarations are not allowed in untyped mode at (40, 12) to (40, 15) +language/module-code/eval-self-once.js (strict mode) + Type declarations are not allowed in untyped mode at (35, 12) to (35, 15) +language/module-code/eval-self-once.js (default) + Type declarations are not allowed in untyped mode at (35, 12) to (35, 15) +language/module-code/instn-once.js (strict mode) + Type declarations are not allowed in untyped mode at (34, 12) to (34, 15) +language/module-code/instn-once.js (default) + Type declarations are not allowed in untyped mode at (34, 12) to (34, 15) +language/module-code/parse-err-hoist-lex-fun.js (strict mode) + Missing parse error +language/module-code/parse-err-hoist-lex-fun.js (default) + Missing parse error +language/module-code/parse-err-hoist-lex-gen.js (strict mode) + Missing parse error +language/module-code/parse-err-hoist-lex-gen.js (default) + Missing parse error +language/module-code/parse-err-yield.js (default) + Missing parse error +language/reserved-words/await-module.js (strict mode) + Missing parse error +language/reserved-words/await-module.js (default) + Missing parse error +language/statements/async-function/early-errors-declaration-NSPL-with-USD.js (strict mode) + Missing parse error +language/statements/async-function/early-errors-declaration-NSPL-with-USD.js (default) + Missing parse error +language/statements/async-function/early-errors-declaration-formals-body-duplicate.js (strict mode) + Missing parse error +language/statements/async-function/early-errors-declaration-formals-body-duplicate.js (default) + Missing parse error +language/statements/class/class-name-ident-await-escaped-module.js (strict mode) + Missing parse error +language/statements/class/class-name-ident-await-escaped-module.js (default) + Missing parse error +language/statements/class/class-name-ident-await-module.js (strict mode) + Missing parse error +language/statements/class/class-name-ident-await-module.js (default) + Missing parse error +language/statements/class/definition/early-errors-class-method-NSPL-with-USD.js (strict mode) + Missing parse error +language/statements/class/definition/early-errors-class-method-NSPL-with-USD.js (default) + Missing parse error +language/statements/class/definition/early-errors-class-method-await-in-formals-default.js (strict mode) + Missing parse error +language/statements/class/definition/early-errors-class-method-await-in-formals-default.js (default) + Missing parse error +language/statements/class/definition/early-errors-class-method-await-in-formals.js (strict mode) + Missing parse error +language/statements/class/definition/early-errors-class-method-await-in-formals.js (default) + Missing parse error +language/statements/class/dstr/async-private-gen-meth-ary-init-iter-close.js (strict mode) + Classes may not have private methods. at (69, 2) to (72, 3) +language/statements/class/dstr/async-private-gen-meth-ary-init-iter-close.js (default) + Classes may not have private methods. at (69, 2) to (72, 3) +language/statements/class/dstr/async-private-gen-meth-ary-init-iter-no-close.js (strict mode) + Classes may not have private methods. at (69, 2) to (72, 3) +language/statements/class/dstr/async-private-gen-meth-ary-init-iter-no-close.js (default) + Classes may not have private methods. at (69, 2) to (72, 3) +language/statements/class/dstr/async-private-gen-meth-ary-name-iter-val.js (strict mode) + Classes may not have private methods. at (66, 2) to (71, 3) +language/statements/class/dstr/async-private-gen-meth-ary-name-iter-val.js (default) + Classes may not have private methods. at (66, 2) to (71, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elem-init.js (strict mode) + Classes may not have private methods. at (58, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elem-init.js (default) + Classes may not have private methods. at (58, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elem-iter.js (strict mode) + Classes may not have private methods. at (59, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elem-iter.js (default) + Classes may not have private methods. at (59, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elision-init.js (strict mode) + Classes may not have private methods. at (66, 2) to (70, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elision-init.js (default) + Classes may not have private methods. at (66, 2) to (70, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elision-iter.js (strict mode) + Classes may not have private methods. at (64, 2) to (67, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elision-iter.js (default) + Classes may not have private methods. at (64, 2) to (67, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-empty-init.js (strict mode) + Classes may not have private methods. at (62, 2) to (66, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-empty-init.js (default) + Classes may not have private methods. at (62, 2) to (66, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-empty-iter.js (strict mode) + Classes may not have private methods. at (60, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-empty-iter.js (default) + Classes may not have private methods. at (60, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-rest-init.js (strict mode) + Classes may not have private methods. at (59, 2) to (67, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-rest-init.js (default) + Classes may not have private methods. at (59, 2) to (67, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-rest-iter.js (strict mode) + Classes may not have private methods. at (61, 2) to (70, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-rest-iter.js (default) + Classes may not have private methods. at (61, 2) to (70, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-exhausted.js (strict mode) + Classes may not have private methods. at (59, 2) to (62, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-exhausted.js (default) + Classes may not have private methods. at (59, 2) to (62, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (60, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (60, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (60, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js (default) + Classes may not have private methods. at (60, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (60, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (60, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (60, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (60, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (61, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (61, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-hole.js (strict mode) + Classes may not have private methods. at (54, 2) to (58, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-hole.js (default) + Classes may not have private methods. at (54, 2) to (58, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-skipped.js (strict mode) + Classes may not have private methods. at (60, 2) to (67, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-skipped.js (default) + Classes may not have private methods. at (60, 2) to (67, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-undef.js (strict mode) + Classes may not have private methods. at (58, 2) to (61, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-undef.js (default) + Classes may not have private methods. at (58, 2) to (61, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-complete.js (strict mode) + Classes may not have private methods. at (62, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-complete.js (default) + Classes may not have private methods. at (62, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-done.js (strict mode) + Classes may not have private methods. at (57, 2) to (60, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-done.js (default) + Classes may not have private methods. at (57, 2) to (60, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-val.js (strict mode) + Classes may not have private methods. at (66, 2) to (71, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-val.js (default) + Classes may not have private methods. at (66, 2) to (71, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-id-init.js (strict mode) + Classes may not have private methods. at (58, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-id-init.js (default) + Classes may not have private methods. at (58, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-id.js (strict mode) + Classes may not have private methods. at (58, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-id.js (default) + Classes may not have private methods. at (58, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-prop-id-init.js (strict mode) + Classes may not have private methods. at (58, 2) to (73, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-prop-id-init.js (default) + Classes may not have private methods. at (58, 2) to (73, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-prop-id.js (strict mode) + Classes may not have private methods. at (58, 2) to (73, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-prop-id.js (default) + Classes may not have private methods. at (58, 2) to (73, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elision-exhausted.js (strict mode) + Classes may not have private methods. at (65, 2) to (68, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elision-exhausted.js (default) + Classes may not have private methods. at (65, 2) to (68, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elision.js (strict mode) + Classes may not have private methods. at (73, 2) to (77, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elision.js (default) + Classes may not have private methods. at (73, 2) to (77, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-empty.js (strict mode) + Classes may not have private methods. at (57, 2) to (60, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-empty.js (default) + Classes may not have private methods. at (57, 2) to (60, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-elem.js (strict mode) + Classes may not have private methods. at (79, 2) to (84, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-elem.js (default) + Classes may not have private methods. at (79, 2) to (84, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-elision.js (strict mode) + Classes may not have private methods. at (86, 2) to (90, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-elision.js (default) + Classes may not have private methods. at (86, 2) to (90, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-empty.js (strict mode) + Classes may not have private methods. at (70, 2) to (73, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-empty.js (default) + Classes may not have private methods. at (70, 2) to (73, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-rest.js (strict mode) + Classes may not have private methods. at (60, 2) to (69, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-rest.js (default) + Classes may not have private methods. at (60, 2) to (69, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-id-elision.js (strict mode) + Classes may not have private methods. at (57, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-id-elision.js (default) + Classes may not have private methods. at (57, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-id-exhausted.js (strict mode) + Classes may not have private methods. at (57, 2) to (61, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-id-exhausted.js (default) + Classes may not have private methods. at (57, 2) to (61, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-id.js (strict mode) + Classes may not have private methods. at (54, 2) to (62, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-id.js (default) + Classes may not have private methods. at (54, 2) to (62, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-obj-id.js (strict mode) + Classes may not have private methods. at (59, 2) to (62, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-obj-id.js (default) + Classes may not have private methods. at (59, 2) to (62, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-obj-prop-id.js (strict mode) + Classes may not have private methods. at (60, 2) to (69, 3) +language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-obj-prop-id.js (default) + Classes may not have private methods. at (60, 2) to (69, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-init-iter-close.js (strict mode) + Classes may not have private methods. at (69, 2) to (72, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-init-iter-close.js (default) + Classes may not have private methods. at (69, 2) to (72, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-init-iter-no-close.js (strict mode) + Classes may not have private methods. at (69, 2) to (72, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-init-iter-no-close.js (default) + Classes may not have private methods. at (69, 2) to (72, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-name-iter-val.js (strict mode) + Classes may not have private methods. at (66, 2) to (71, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-name-iter-val.js (default) + Classes may not have private methods. at (66, 2) to (71, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js (strict mode) + Classes may not have private methods. at (58, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js (default) + Classes may not have private methods. at (58, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js (strict mode) + Classes may not have private methods. at (59, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js (default) + Classes may not have private methods. at (59, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js (strict mode) + Classes may not have private methods. at (66, 2) to (70, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js (default) + Classes may not have private methods. at (66, 2) to (70, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js (strict mode) + Classes may not have private methods. at (64, 2) to (67, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js (default) + Classes may not have private methods. at (64, 2) to (67, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js (strict mode) + Classes may not have private methods. at (62, 2) to (66, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js (default) + Classes may not have private methods. at (62, 2) to (66, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js (strict mode) + Classes may not have private methods. at (60, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js (default) + Classes may not have private methods. at (60, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js (strict mode) + Classes may not have private methods. at (59, 2) to (67, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js (default) + Classes may not have private methods. at (59, 2) to (67, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js (strict mode) + Classes may not have private methods. at (61, 2) to (70, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js (default) + Classes may not have private methods. at (61, 2) to (70, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js (strict mode) + Classes may not have private methods. at (59, 2) to (62, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js (default) + Classes may not have private methods. at (59, 2) to (62, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (60, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (60, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (60, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js (default) + Classes may not have private methods. at (60, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (60, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (60, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (60, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (60, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (61, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (61, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js (strict mode) + Classes may not have private methods. at (54, 2) to (58, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js (default) + Classes may not have private methods. at (54, 2) to (58, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js (strict mode) + Classes may not have private methods. at (60, 2) to (67, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js (default) + Classes may not have private methods. at (60, 2) to (67, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js (strict mode) + Classes may not have private methods. at (58, 2) to (61, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js (default) + Classes may not have private methods. at (58, 2) to (61, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js (strict mode) + Classes may not have private methods. at (62, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js (default) + Classes may not have private methods. at (62, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js (strict mode) + Classes may not have private methods. at (57, 2) to (60, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js (default) + Classes may not have private methods. at (57, 2) to (60, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js (strict mode) + Classes may not have private methods. at (66, 2) to (71, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js (default) + Classes may not have private methods. at (66, 2) to (71, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js (strict mode) + Classes may not have private methods. at (58, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js (default) + Classes may not have private methods. at (58, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-id.js (strict mode) + Classes may not have private methods. at (58, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-id.js (default) + Classes may not have private methods. at (58, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js (strict mode) + Classes may not have private methods. at (58, 2) to (73, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js (default) + Classes may not have private methods. at (58, 2) to (73, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js (strict mode) + Classes may not have private methods. at (58, 2) to (73, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js (default) + Classes may not have private methods. at (58, 2) to (73, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elision-exhausted.js (strict mode) + Classes may not have private methods. at (65, 2) to (68, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elision-exhausted.js (default) + Classes may not have private methods. at (65, 2) to (68, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elision.js (strict mode) + Classes may not have private methods. at (73, 2) to (77, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elision.js (default) + Classes may not have private methods. at (73, 2) to (77, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-empty.js (strict mode) + Classes may not have private methods. at (57, 2) to (60, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-empty.js (default) + Classes may not have private methods. at (57, 2) to (60, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-elem.js (strict mode) + Classes may not have private methods. at (79, 2) to (84, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-elem.js (default) + Classes may not have private methods. at (79, 2) to (84, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-elision.js (strict mode) + Classes may not have private methods. at (86, 2) to (90, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-elision.js (default) + Classes may not have private methods. at (86, 2) to (90, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-empty.js (strict mode) + Classes may not have private methods. at (70, 2) to (73, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-empty.js (default) + Classes may not have private methods. at (70, 2) to (73, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-rest.js (strict mode) + Classes may not have private methods. at (60, 2) to (69, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-rest.js (default) + Classes may not have private methods. at (60, 2) to (69, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id-elision.js (strict mode) + Classes may not have private methods. at (57, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id-elision.js (default) + Classes may not have private methods. at (57, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js (strict mode) + Classes may not have private methods. at (57, 2) to (61, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js (default) + Classes may not have private methods. at (57, 2) to (61, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id.js (strict mode) + Classes may not have private methods. at (54, 2) to (62, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id.js (default) + Classes may not have private methods. at (54, 2) to (62, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-obj-id.js (strict mode) + Classes may not have private methods. at (59, 2) to (62, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-obj-id.js (default) + Classes may not have private methods. at (59, 2) to (62, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js (strict mode) + Classes may not have private methods. at (60, 2) to (69, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js (default) + Classes may not have private methods. at (60, 2) to (69, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-empty.js (strict mode) + Classes may not have private methods. at (58, 2) to (61, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-empty.js (default) + Classes may not have private methods. at (58, 2) to (61, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (59, 2) to (62, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (59, 2) to (62, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (59, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js (default) + Classes may not have private methods. at (59, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (59, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (59, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (59, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (59, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (60, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (60, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-skipped.js (strict mode) + Classes may not have private methods. at (59, 2) to (66, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-skipped.js (default) + Classes may not have private methods. at (59, 2) to (66, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (53, 2) to (56, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-trailing-comma.js (default) + Classes may not have private methods. at (53, 2) to (56, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary-init.js (strict mode) + Classes may not have private methods. at (56, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary-init.js (default) + Classes may not have private methods. at (56, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js (strict mode) + Classes may not have private methods. at (53, 2) to (56, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js (default) + Classes may not have private methods. at (53, 2) to (56, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary.js (strict mode) + Classes may not have private methods. at (54, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary.js (default) + Classes may not have private methods. at (54, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js (strict mode) + Classes may not have private methods. at (58, 2) to (78, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js (default) + Classes may not have private methods. at (58, 2) to (78, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-init.js (strict mode) + Classes may not have private methods. at (53, 2) to (59, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-init.js (default) + Classes may not have private methods. at (53, 2) to (59, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (53, 2) to (60, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js (default) + Classes may not have private methods. at (53, 2) to (60, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id.js (strict mode) + Classes may not have private methods. at (53, 2) to (59, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id.js (default) + Classes may not have private methods. at (53, 2) to (59, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-obj-init.js (strict mode) + Classes may not have private methods. at (56, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-obj-init.js (default) + Classes may not have private methods. at (56, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-obj.js (strict mode) + Classes may not have private methods. at (54, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-obj.js (default) + Classes may not have private methods. at (54, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-getter.js (strict mode) + Classes may not have private methods. at (48, 2) to (58, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-getter.js (default) + Classes may not have private methods. at (48, 2) to (58, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js (strict mode) + Classes may not have private methods. at (49, 2) to (66, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js (default) + Classes may not have private methods. at (49, 2) to (66, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-val-obj.js (strict mode) + Classes may not have private methods. at (47, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-val-obj.js (default) + Classes may not have private methods. at (47, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-empty.js (strict mode) + Classes may not have private methods. at (58, 2) to (61, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-empty.js (default) + Classes may not have private methods. at (58, 2) to (61, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (59, 2) to (62, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (59, 2) to (62, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (59, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-class.js (default) + Classes may not have private methods. at (59, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (59, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (59, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (59, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (59, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (60, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (60, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-skipped.js (strict mode) + Classes may not have private methods. at (59, 2) to (66, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-skipped.js (default) + Classes may not have private methods. at (59, 2) to (66, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (53, 2) to (56, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-trailing-comma.js (default) + Classes may not have private methods. at (53, 2) to (56, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary-init.js (strict mode) + Classes may not have private methods. at (56, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary-init.js (default) + Classes may not have private methods. at (56, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary-trailing-comma.js (strict mode) + Classes may not have private methods. at (53, 2) to (56, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary-trailing-comma.js (default) + Classes may not have private methods. at (53, 2) to (56, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary.js (strict mode) + Classes may not have private methods. at (54, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary.js (default) + Classes may not have private methods. at (54, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-init-skipped.js (strict mode) + Classes may not have private methods. at (58, 2) to (78, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-init-skipped.js (default) + Classes may not have private methods. at (58, 2) to (78, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-init.js (strict mode) + Classes may not have private methods. at (53, 2) to (59, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-init.js (default) + Classes may not have private methods. at (53, 2) to (59, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (53, 2) to (60, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-trailing-comma.js (default) + Classes may not have private methods. at (53, 2) to (60, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-id.js (strict mode) + Classes may not have private methods. at (53, 2) to (59, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-id.js (default) + Classes may not have private methods. at (53, 2) to (59, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-obj-init.js (strict mode) + Classes may not have private methods. at (56, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-obj-init.js (default) + Classes may not have private methods. at (56, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-obj.js (strict mode) + Classes may not have private methods. at (54, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-obj.js (default) + Classes may not have private methods. at (54, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-rest-getter.js (strict mode) + Classes may not have private methods. at (48, 2) to (58, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-rest-getter.js (default) + Classes may not have private methods. at (48, 2) to (58, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-rest-skip-non-enumerable.js (strict mode) + Classes may not have private methods. at (49, 2) to (66, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-rest-skip-non-enumerable.js (default) + Classes may not have private methods. at (49, 2) to (66, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-rest-val-obj.js (strict mode) + Classes may not have private methods. at (47, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-obj-ptrn-rest-val-obj.js (default) + Classes may not have private methods. at (47, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-init-iter-close.js (strict mode) + Classes may not have private methods. at (69, 2) to (72, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-init-iter-close.js (default) + Classes may not have private methods. at (69, 2) to (72, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-init-iter-no-close.js (strict mode) + Classes may not have private methods. at (69, 2) to (72, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-init-iter-no-close.js (default) + Classes may not have private methods. at (69, 2) to (72, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-name-iter-val.js (strict mode) + Classes may not have private methods. at (66, 2) to (71, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-name-iter-val.js (default) + Classes may not have private methods. at (66, 2) to (71, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elem-init.js (strict mode) + Classes may not have private methods. at (58, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elem-init.js (default) + Classes may not have private methods. at (58, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js (strict mode) + Classes may not have private methods. at (59, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js (default) + Classes may not have private methods. at (59, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elision-init.js (strict mode) + Classes may not have private methods. at (66, 2) to (70, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elision-init.js (default) + Classes may not have private methods. at (66, 2) to (70, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elision-iter.js (strict mode) + Classes may not have private methods. at (64, 2) to (67, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elision-iter.js (default) + Classes may not have private methods. at (64, 2) to (67, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-empty-init.js (strict mode) + Classes may not have private methods. at (62, 2) to (66, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-empty-init.js (default) + Classes may not have private methods. at (62, 2) to (66, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-empty-iter.js (strict mode) + Classes may not have private methods. at (60, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-empty-iter.js (default) + Classes may not have private methods. at (60, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-rest-init.js (strict mode) + Classes may not have private methods. at (59, 2) to (67, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-rest-init.js (default) + Classes may not have private methods. at (59, 2) to (67, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js (strict mode) + Classes may not have private methods. at (61, 2) to (70, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js (default) + Classes may not have private methods. at (61, 2) to (70, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-exhausted.js (strict mode) + Classes may not have private methods. at (59, 2) to (62, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-exhausted.js (default) + Classes may not have private methods. at (59, 2) to (62, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (60, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (60, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (60, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js (default) + Classes may not have private methods. at (60, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (60, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (60, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (60, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (60, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (61, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (61, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-hole.js (strict mode) + Classes may not have private methods. at (54, 2) to (58, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-hole.js (default) + Classes may not have private methods. at (54, 2) to (58, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-skipped.js (strict mode) + Classes may not have private methods. at (60, 2) to (67, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-skipped.js (default) + Classes may not have private methods. at (60, 2) to (67, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-undef.js (strict mode) + Classes may not have private methods. at (58, 2) to (61, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-undef.js (default) + Classes may not have private methods. at (58, 2) to (61, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-complete.js (strict mode) + Classes may not have private methods. at (62, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-complete.js (default) + Classes may not have private methods. at (62, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-done.js (strict mode) + Classes may not have private methods. at (57, 2) to (60, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-done.js (default) + Classes may not have private methods. at (57, 2) to (60, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-val.js (strict mode) + Classes may not have private methods. at (66, 2) to (71, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-val.js (default) + Classes may not have private methods. at (66, 2) to (71, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-id-init.js (strict mode) + Classes may not have private methods. at (58, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-id-init.js (default) + Classes may not have private methods. at (58, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-id.js (strict mode) + Classes may not have private methods. at (58, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-id.js (default) + Classes may not have private methods. at (58, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js (strict mode) + Classes may not have private methods. at (58, 2) to (73, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js (default) + Classes may not have private methods. at (58, 2) to (73, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-prop-id.js (strict mode) + Classes may not have private methods. at (58, 2) to (73, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-prop-id.js (default) + Classes may not have private methods. at (58, 2) to (73, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elision-exhausted.js (strict mode) + Classes may not have private methods. at (65, 2) to (68, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elision-exhausted.js (default) + Classes may not have private methods. at (65, 2) to (68, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elision.js (strict mode) + Classes may not have private methods. at (73, 2) to (77, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elision.js (default) + Classes may not have private methods. at (73, 2) to (77, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-empty.js (strict mode) + Classes may not have private methods. at (57, 2) to (60, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-empty.js (default) + Classes may not have private methods. at (57, 2) to (60, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-elem.js (strict mode) + Classes may not have private methods. at (79, 2) to (84, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-elem.js (default) + Classes may not have private methods. at (79, 2) to (84, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-elision.js (strict mode) + Classes may not have private methods. at (86, 2) to (90, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-elision.js (default) + Classes may not have private methods. at (86, 2) to (90, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-empty.js (strict mode) + Classes may not have private methods. at (70, 2) to (73, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-empty.js (default) + Classes may not have private methods. at (70, 2) to (73, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-rest.js (strict mode) + Classes may not have private methods. at (60, 2) to (69, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-rest.js (default) + Classes may not have private methods. at (60, 2) to (69, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id-elision.js (strict mode) + Classes may not have private methods. at (57, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id-elision.js (default) + Classes may not have private methods. at (57, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id-exhausted.js (strict mode) + Classes may not have private methods. at (57, 2) to (61, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id-exhausted.js (default) + Classes may not have private methods. at (57, 2) to (61, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id.js (strict mode) + Classes may not have private methods. at (54, 2) to (62, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id.js (default) + Classes may not have private methods. at (54, 2) to (62, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-obj-id.js (strict mode) + Classes may not have private methods. at (59, 2) to (62, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-obj-id.js (default) + Classes may not have private methods. at (59, 2) to (62, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-obj-prop-id.js (strict mode) + Classes may not have private methods. at (60, 2) to (69, 3) +language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-obj-prop-id.js (default) + Classes may not have private methods. at (60, 2) to (69, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-init-iter-close.js (strict mode) + Classes may not have private methods. at (69, 2) to (72, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-init-iter-close.js (default) + Classes may not have private methods. at (69, 2) to (72, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-init-iter-no-close.js (strict mode) + Classes may not have private methods. at (69, 2) to (72, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-init-iter-no-close.js (default) + Classes may not have private methods. at (69, 2) to (72, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-name-iter-val.js (strict mode) + Classes may not have private methods. at (66, 2) to (71, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-name-iter-val.js (default) + Classes may not have private methods. at (66, 2) to (71, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js (strict mode) + Classes may not have private methods. at (58, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js (default) + Classes may not have private methods. at (58, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js (strict mode) + Classes may not have private methods. at (59, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js (default) + Classes may not have private methods. at (59, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js (strict mode) + Classes may not have private methods. at (66, 2) to (70, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js (default) + Classes may not have private methods. at (66, 2) to (70, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js (strict mode) + Classes may not have private methods. at (64, 2) to (67, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js (default) + Classes may not have private methods. at (64, 2) to (67, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js (strict mode) + Classes may not have private methods. at (62, 2) to (66, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js (default) + Classes may not have private methods. at (62, 2) to (66, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js (strict mode) + Classes may not have private methods. at (60, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js (default) + Classes may not have private methods. at (60, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js (strict mode) + Classes may not have private methods. at (59, 2) to (67, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js (default) + Classes may not have private methods. at (59, 2) to (67, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js (strict mode) + Classes may not have private methods. at (61, 2) to (70, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js (default) + Classes may not have private methods. at (61, 2) to (70, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js (strict mode) + Classes may not have private methods. at (59, 2) to (62, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js (default) + Classes may not have private methods. at (59, 2) to (62, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (60, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (60, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (60, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js (default) + Classes may not have private methods. at (60, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (60, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (60, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (60, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (60, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (61, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (61, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js (strict mode) + Classes may not have private methods. at (54, 2) to (58, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js (default) + Classes may not have private methods. at (54, 2) to (58, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js (strict mode) + Classes may not have private methods. at (60, 2) to (67, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js (default) + Classes may not have private methods. at (60, 2) to (67, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js (strict mode) + Classes may not have private methods. at (58, 2) to (61, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js (default) + Classes may not have private methods. at (58, 2) to (61, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js (strict mode) + Classes may not have private methods. at (62, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js (default) + Classes may not have private methods. at (62, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js (strict mode) + Classes may not have private methods. at (57, 2) to (60, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js (default) + Classes may not have private methods. at (57, 2) to (60, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js (strict mode) + Classes may not have private methods. at (66, 2) to (71, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js (default) + Classes may not have private methods. at (66, 2) to (71, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js (strict mode) + Classes may not have private methods. at (58, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js (default) + Classes may not have private methods. at (58, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js (strict mode) + Classes may not have private methods. at (58, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js (default) + Classes may not have private methods. at (58, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js (strict mode) + Classes may not have private methods. at (58, 2) to (73, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js (default) + Classes may not have private methods. at (58, 2) to (73, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js (strict mode) + Classes may not have private methods. at (58, 2) to (73, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js (default) + Classes may not have private methods. at (58, 2) to (73, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elision-exhausted.js (strict mode) + Classes may not have private methods. at (65, 2) to (68, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elision-exhausted.js (default) + Classes may not have private methods. at (65, 2) to (68, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elision.js (strict mode) + Classes may not have private methods. at (73, 2) to (77, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elision.js (default) + Classes may not have private methods. at (73, 2) to (77, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-empty.js (strict mode) + Classes may not have private methods. at (57, 2) to (60, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-empty.js (default) + Classes may not have private methods. at (57, 2) to (60, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js (strict mode) + Classes may not have private methods. at (79, 2) to (84, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js (default) + Classes may not have private methods. at (79, 2) to (84, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js (strict mode) + Classes may not have private methods. at (86, 2) to (90, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js (default) + Classes may not have private methods. at (86, 2) to (90, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js (strict mode) + Classes may not have private methods. at (70, 2) to (73, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js (default) + Classes may not have private methods. at (70, 2) to (73, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js (strict mode) + Classes may not have private methods. at (60, 2) to (69, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js (default) + Classes may not have private methods. at (60, 2) to (69, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id-elision.js (strict mode) + Classes may not have private methods. at (57, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id-elision.js (default) + Classes may not have private methods. at (57, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js (strict mode) + Classes may not have private methods. at (57, 2) to (61, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js (default) + Classes may not have private methods. at (57, 2) to (61, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id.js (strict mode) + Classes may not have private methods. at (54, 2) to (62, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id.js (default) + Classes may not have private methods. at (54, 2) to (62, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js (strict mode) + Classes may not have private methods. at (59, 2) to (62, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js (default) + Classes may not have private methods. at (59, 2) to (62, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js (strict mode) + Classes may not have private methods. at (60, 2) to (69, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js (default) + Classes may not have private methods. at (60, 2) to (69, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-empty.js (strict mode) + Classes may not have private methods. at (58, 2) to (61, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-empty.js (default) + Classes may not have private methods. at (58, 2) to (61, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (59, 2) to (62, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (59, 2) to (62, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (59, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js (default) + Classes may not have private methods. at (59, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (59, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (59, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (59, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (59, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (60, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (60, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-skipped.js (strict mode) + Classes may not have private methods. at (59, 2) to (66, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-skipped.js (default) + Classes may not have private methods. at (59, 2) to (66, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (53, 2) to (56, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js (default) + Classes may not have private methods. at (53, 2) to (56, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js (strict mode) + Classes may not have private methods. at (56, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js (default) + Classes may not have private methods. at (56, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js (strict mode) + Classes may not have private methods. at (53, 2) to (56, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js (default) + Classes may not have private methods. at (53, 2) to (56, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary.js (strict mode) + Classes may not have private methods. at (54, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary.js (default) + Classes may not have private methods. at (54, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js (strict mode) + Classes may not have private methods. at (58, 2) to (78, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js (default) + Classes may not have private methods. at (58, 2) to (78, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-init.js (strict mode) + Classes may not have private methods. at (53, 2) to (59, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-init.js (default) + Classes may not have private methods. at (53, 2) to (59, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (53, 2) to (60, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js (default) + Classes may not have private methods. at (53, 2) to (60, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id.js (strict mode) + Classes may not have private methods. at (53, 2) to (59, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id.js (default) + Classes may not have private methods. at (53, 2) to (59, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js (strict mode) + Classes may not have private methods. at (56, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js (default) + Classes may not have private methods. at (56, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-obj.js (strict mode) + Classes may not have private methods. at (54, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-obj.js (default) + Classes may not have private methods. at (54, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-getter.js (strict mode) + Classes may not have private methods. at (48, 2) to (58, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-getter.js (default) + Classes may not have private methods. at (48, 2) to (58, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js (strict mode) + Classes may not have private methods. at (49, 2) to (66, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js (default) + Classes may not have private methods. at (49, 2) to (66, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js (strict mode) + Classes may not have private methods. at (47, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js (default) + Classes may not have private methods. at (47, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-empty.js (strict mode) + Classes may not have private methods. at (58, 2) to (61, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-empty.js (default) + Classes may not have private methods. at (58, 2) to (61, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (59, 2) to (62, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (59, 2) to (62, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (59, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-class.js (default) + Classes may not have private methods. at (59, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (59, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (59, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (59, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (59, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (60, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (60, 2) to (64, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-skipped.js (strict mode) + Classes may not have private methods. at (59, 2) to (66, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-skipped.js (default) + Classes may not have private methods. at (59, 2) to (66, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (53, 2) to (56, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-trailing-comma.js (default) + Classes may not have private methods. at (53, 2) to (56, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary-init.js (strict mode) + Classes may not have private methods. at (56, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary-init.js (default) + Classes may not have private methods. at (56, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js (strict mode) + Classes may not have private methods. at (53, 2) to (56, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js (default) + Classes may not have private methods. at (53, 2) to (56, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary.js (strict mode) + Classes may not have private methods. at (54, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary.js (default) + Classes may not have private methods. at (54, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-init-skipped.js (strict mode) + Classes may not have private methods. at (58, 2) to (78, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-init-skipped.js (default) + Classes may not have private methods. at (58, 2) to (78, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-init.js (strict mode) + Classes may not have private methods. at (53, 2) to (59, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-init.js (default) + Classes may not have private methods. at (53, 2) to (59, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (53, 2) to (60, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-trailing-comma.js (default) + Classes may not have private methods. at (53, 2) to (60, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id.js (strict mode) + Classes may not have private methods. at (53, 2) to (59, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id.js (default) + Classes may not have private methods. at (53, 2) to (59, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-obj-init.js (strict mode) + Classes may not have private methods. at (56, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-obj-init.js (default) + Classes may not have private methods. at (56, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-obj.js (strict mode) + Classes may not have private methods. at (54, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-obj.js (default) + Classes may not have private methods. at (54, 2) to (63, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-getter.js (strict mode) + Classes may not have private methods. at (48, 2) to (58, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-getter.js (default) + Classes may not have private methods. at (48, 2) to (58, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js (strict mode) + Classes may not have private methods. at (49, 2) to (66, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js (default) + Classes may not have private methods. at (49, 2) to (66, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-val-obj.js (strict mode) + Classes may not have private methods. at (47, 2) to (65, 3) +language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-val-obj.js (default) + Classes may not have private methods. at (47, 2) to (65, 3) +language/statements/class/dstr/private-gen-meth-ary-init-iter-close.js (strict mode) + Classes may not have private methods. at (87, 2) to (90, 3) +language/statements/class/dstr/private-gen-meth-ary-init-iter-close.js (default) + Classes may not have private methods. at (87, 2) to (90, 3) +language/statements/class/dstr/private-gen-meth-ary-init-iter-no-close.js (strict mode) + Classes may not have private methods. at (87, 2) to (90, 3) +language/statements/class/dstr/private-gen-meth-ary-init-iter-no-close.js (default) + Classes may not have private methods. at (87, 2) to (90, 3) +language/statements/class/dstr/private-gen-meth-ary-name-iter-val.js (strict mode) + Classes may not have private methods. at (84, 2) to (89, 3) +language/statements/class/dstr/private-gen-meth-ary-name-iter-val.js (default) + Classes may not have private methods. at (84, 2) to (89, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elem-init.js (strict mode) + Classes may not have private methods. at (76, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elem-init.js (default) + Classes may not have private methods. at (76, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elem-iter.js (strict mode) + Classes may not have private methods. at (77, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elem-iter.js (default) + Classes may not have private methods. at (77, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elision-init.js (strict mode) + Classes may not have private methods. at (84, 2) to (88, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elision-init.js (default) + Classes may not have private methods. at (84, 2) to (88, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elision-iter.js (strict mode) + Classes may not have private methods. at (82, 2) to (85, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elision-iter.js (default) + Classes may not have private methods. at (82, 2) to (85, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-empty-init.js (strict mode) + Classes may not have private methods. at (80, 2) to (84, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-empty-init.js (default) + Classes may not have private methods. at (80, 2) to (84, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-empty-iter.js (strict mode) + Classes may not have private methods. at (78, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-empty-iter.js (default) + Classes may not have private methods. at (78, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-rest-init.js (strict mode) + Classes may not have private methods. at (77, 2) to (85, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-rest-init.js (default) + Classes may not have private methods. at (77, 2) to (85, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-rest-iter.js (strict mode) + Classes may not have private methods. at (79, 2) to (88, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-rest-iter.js (default) + Classes may not have private methods. at (79, 2) to (88, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-exhausted.js (strict mode) + Classes may not have private methods. at (77, 2) to (80, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-exhausted.js (default) + Classes may not have private methods. at (77, 2) to (80, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (78, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (78, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (78, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js (default) + Classes may not have private methods. at (78, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (78, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (78, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (78, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (78, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (79, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (79, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-hole.js (strict mode) + Classes may not have private methods. at (72, 2) to (76, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-hole.js (default) + Classes may not have private methods. at (72, 2) to (76, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-skipped.js (strict mode) + Classes may not have private methods. at (78, 2) to (85, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-skipped.js (default) + Classes may not have private methods. at (78, 2) to (85, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-undef.js (strict mode) + Classes may not have private methods. at (76, 2) to (79, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-undef.js (default) + Classes may not have private methods. at (76, 2) to (79, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-complete.js (strict mode) + Classes may not have private methods. at (80, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-complete.js (default) + Classes may not have private methods. at (80, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-done.js (strict mode) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-done.js (default) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-val.js (strict mode) + Classes may not have private methods. at (84, 2) to (89, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-val.js (default) + Classes may not have private methods. at (84, 2) to (89, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-obj-id-init.js (strict mode) + Classes may not have private methods. at (76, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-obj-id-init.js (default) + Classes may not have private methods. at (76, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-obj-id.js (strict mode) + Classes may not have private methods. at (76, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-obj-id.js (default) + Classes may not have private methods. at (76, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-obj-prop-id-init.js (strict mode) + Classes may not have private methods. at (76, 2) to (91, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-obj-prop-id-init.js (default) + Classes may not have private methods. at (76, 2) to (91, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-obj-prop-id.js (strict mode) + Classes may not have private methods. at (76, 2) to (91, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-obj-prop-id.js (default) + Classes may not have private methods. at (76, 2) to (91, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elision-exhausted.js (strict mode) + Classes may not have private methods. at (83, 2) to (86, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elision-exhausted.js (default) + Classes may not have private methods. at (83, 2) to (86, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elision.js (strict mode) + Classes may not have private methods. at (91, 2) to (95, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-elision.js (default) + Classes may not have private methods. at (91, 2) to (95, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-empty.js (strict mode) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-empty.js (default) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-ary-elem.js (strict mode) + Classes may not have private methods. at (97, 2) to (102, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-ary-elem.js (default) + Classes may not have private methods. at (97, 2) to (102, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-ary-elision.js (strict mode) + Classes may not have private methods. at (104, 2) to (108, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-ary-elision.js (default) + Classes may not have private methods. at (104, 2) to (108, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-ary-empty.js (strict mode) + Classes may not have private methods. at (88, 2) to (91, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-ary-empty.js (default) + Classes may not have private methods. at (88, 2) to (91, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-ary-rest.js (strict mode) + Classes may not have private methods. at (78, 2) to (87, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-ary-rest.js (default) + Classes may not have private methods. at (78, 2) to (87, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-id-elision.js (strict mode) + Classes may not have private methods. at (75, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-id-elision.js (default) + Classes may not have private methods. at (75, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-id-exhausted.js (strict mode) + Classes may not have private methods. at (75, 2) to (79, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-id-exhausted.js (default) + Classes may not have private methods. at (75, 2) to (79, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-id.js (strict mode) + Classes may not have private methods. at (72, 2) to (80, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-id.js (default) + Classes may not have private methods. at (72, 2) to (80, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-obj-id.js (strict mode) + Classes may not have private methods. at (77, 2) to (80, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-obj-id.js (default) + Classes may not have private methods. at (77, 2) to (80, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-obj-prop-id.js (strict mode) + Classes may not have private methods. at (78, 2) to (87, 3) +language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-obj-prop-id.js (default) + Classes may not have private methods. at (78, 2) to (87, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-init-iter-close.js (strict mode) + Classes may not have private methods. at (87, 2) to (90, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-init-iter-close.js (default) + Classes may not have private methods. at (87, 2) to (90, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-init-iter-no-close.js (strict mode) + Classes may not have private methods. at (87, 2) to (90, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-init-iter-no-close.js (default) + Classes may not have private methods. at (87, 2) to (90, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-name-iter-val.js (strict mode) + Classes may not have private methods. at (84, 2) to (89, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-name-iter-val.js (default) + Classes may not have private methods. at (84, 2) to (89, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js (strict mode) + Classes may not have private methods. at (76, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js (default) + Classes may not have private methods. at (76, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js (strict mode) + Classes may not have private methods. at (77, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js (default) + Classes may not have private methods. at (77, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js (strict mode) + Classes may not have private methods. at (84, 2) to (88, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js (default) + Classes may not have private methods. at (84, 2) to (88, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js (strict mode) + Classes may not have private methods. at (82, 2) to (85, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js (default) + Classes may not have private methods. at (82, 2) to (85, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js (strict mode) + Classes may not have private methods. at (80, 2) to (84, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js (default) + Classes may not have private methods. at (80, 2) to (84, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js (strict mode) + Classes may not have private methods. at (78, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js (default) + Classes may not have private methods. at (78, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js (strict mode) + Classes may not have private methods. at (77, 2) to (85, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js (default) + Classes may not have private methods. at (77, 2) to (85, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js (strict mode) + Classes may not have private methods. at (79, 2) to (88, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js (default) + Classes may not have private methods. at (79, 2) to (88, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js (strict mode) + Classes may not have private methods. at (77, 2) to (80, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js (default) + Classes may not have private methods. at (77, 2) to (80, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (78, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (78, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (78, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js (default) + Classes may not have private methods. at (78, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (78, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (78, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (78, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (78, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (79, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (79, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js (strict mode) + Classes may not have private methods. at (72, 2) to (76, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js (default) + Classes may not have private methods. at (72, 2) to (76, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js (strict mode) + Classes may not have private methods. at (78, 2) to (85, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js (default) + Classes may not have private methods. at (78, 2) to (85, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js (strict mode) + Classes may not have private methods. at (76, 2) to (79, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js (default) + Classes may not have private methods. at (76, 2) to (79, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js (strict mode) + Classes may not have private methods. at (80, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js (default) + Classes may not have private methods. at (80, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js (strict mode) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js (default) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js (strict mode) + Classes may not have private methods. at (84, 2) to (89, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js (default) + Classes may not have private methods. at (84, 2) to (89, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js (strict mode) + Classes may not have private methods. at (76, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js (default) + Classes may not have private methods. at (76, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-id.js (strict mode) + Classes may not have private methods. at (76, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-id.js (default) + Classes may not have private methods. at (76, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js (strict mode) + Classes may not have private methods. at (76, 2) to (91, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js (default) + Classes may not have private methods. at (76, 2) to (91, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js (strict mode) + Classes may not have private methods. at (76, 2) to (91, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js (default) + Classes may not have private methods. at (76, 2) to (91, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elision-exhausted.js (strict mode) + Classes may not have private methods. at (83, 2) to (86, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elision-exhausted.js (default) + Classes may not have private methods. at (83, 2) to (86, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elision.js (strict mode) + Classes may not have private methods. at (91, 2) to (95, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elision.js (default) + Classes may not have private methods. at (91, 2) to (95, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-empty.js (strict mode) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-empty.js (default) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-elem.js (strict mode) + Classes may not have private methods. at (97, 2) to (102, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-elem.js (default) + Classes may not have private methods. at (97, 2) to (102, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-elision.js (strict mode) + Classes may not have private methods. at (104, 2) to (108, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-elision.js (default) + Classes may not have private methods. at (104, 2) to (108, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-empty.js (strict mode) + Classes may not have private methods. at (88, 2) to (91, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-empty.js (default) + Classes may not have private methods. at (88, 2) to (91, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-rest.js (strict mode) + Classes may not have private methods. at (78, 2) to (87, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-rest.js (default) + Classes may not have private methods. at (78, 2) to (87, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id-elision.js (strict mode) + Classes may not have private methods. at (75, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id-elision.js (default) + Classes may not have private methods. at (75, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js (strict mode) + Classes may not have private methods. at (75, 2) to (79, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js (default) + Classes may not have private methods. at (75, 2) to (79, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id.js (strict mode) + Classes may not have private methods. at (72, 2) to (80, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id.js (default) + Classes may not have private methods. at (72, 2) to (80, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-obj-id.js (strict mode) + Classes may not have private methods. at (77, 2) to (80, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-obj-id.js (default) + Classes may not have private methods. at (77, 2) to (80, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js (strict mode) + Classes may not have private methods. at (78, 2) to (87, 3) +language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js (default) + Classes may not have private methods. at (78, 2) to (87, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-empty.js (strict mode) + Classes may not have private methods. at (76, 2) to (79, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-empty.js (default) + Classes may not have private methods. at (76, 2) to (79, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (77, 2) to (80, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (77, 2) to (80, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (77, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js (default) + Classes may not have private methods. at (77, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (77, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (77, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (77, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (77, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (78, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (78, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-skipped.js (strict mode) + Classes may not have private methods. at (77, 2) to (84, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-skipped.js (default) + Classes may not have private methods. at (77, 2) to (84, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (71, 2) to (74, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-trailing-comma.js (default) + Classes may not have private methods. at (71, 2) to (74, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary-init.js (strict mode) + Classes may not have private methods. at (74, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary-init.js (default) + Classes may not have private methods. at (74, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js (strict mode) + Classes may not have private methods. at (71, 2) to (74, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js (default) + Classes may not have private methods. at (71, 2) to (74, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary.js (strict mode) + Classes may not have private methods. at (72, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary.js (default) + Classes may not have private methods. at (72, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js (strict mode) + Classes may not have private methods. at (76, 2) to (96, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js (default) + Classes may not have private methods. at (76, 2) to (96, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-init.js (strict mode) + Classes may not have private methods. at (71, 2) to (77, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-init.js (default) + Classes may not have private methods. at (71, 2) to (77, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (71, 2) to (78, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js (default) + Classes may not have private methods. at (71, 2) to (78, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id.js (strict mode) + Classes may not have private methods. at (71, 2) to (77, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id.js (default) + Classes may not have private methods. at (71, 2) to (77, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-obj-init.js (strict mode) + Classes may not have private methods. at (74, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-obj-init.js (default) + Classes may not have private methods. at (74, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-obj.js (strict mode) + Classes may not have private methods. at (72, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-obj.js (default) + Classes may not have private methods. at (72, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-getter.js (strict mode) + Classes may not have private methods. at (66, 2) to (76, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-getter.js (default) + Classes may not have private methods. at (66, 2) to (76, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js (strict mode) + Classes may not have private methods. at (67, 2) to (84, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js (default) + Classes may not have private methods. at (67, 2) to (84, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-val-obj.js (strict mode) + Classes may not have private methods. at (65, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-val-obj.js (default) + Classes may not have private methods. at (65, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-empty.js (strict mode) + Classes may not have private methods. at (76, 2) to (79, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-empty.js (default) + Classes may not have private methods. at (76, 2) to (79, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (77, 2) to (80, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (77, 2) to (80, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (77, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-class.js (default) + Classes may not have private methods. at (77, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (77, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (77, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (77, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (77, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (78, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (78, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-skipped.js (strict mode) + Classes may not have private methods. at (77, 2) to (84, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-skipped.js (default) + Classes may not have private methods. at (77, 2) to (84, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (71, 2) to (74, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-id-trailing-comma.js (default) + Classes may not have private methods. at (71, 2) to (74, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-ary-init.js (strict mode) + Classes may not have private methods. at (74, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-ary-init.js (default) + Classes may not have private methods. at (74, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-ary-trailing-comma.js (strict mode) + Classes may not have private methods. at (71, 2) to (74, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-ary-trailing-comma.js (default) + Classes may not have private methods. at (71, 2) to (74, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-ary.js (strict mode) + Classes may not have private methods. at (72, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-ary.js (default) + Classes may not have private methods. at (72, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-id-init-skipped.js (strict mode) + Classes may not have private methods. at (76, 2) to (96, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-id-init-skipped.js (default) + Classes may not have private methods. at (76, 2) to (96, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-id-init.js (strict mode) + Classes may not have private methods. at (71, 2) to (77, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-id-init.js (default) + Classes may not have private methods. at (71, 2) to (77, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (71, 2) to (78, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-id-trailing-comma.js (default) + Classes may not have private methods. at (71, 2) to (78, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-id.js (strict mode) + Classes may not have private methods. at (71, 2) to (77, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-id.js (default) + Classes may not have private methods. at (71, 2) to (77, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-obj-init.js (strict mode) + Classes may not have private methods. at (74, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-obj-init.js (default) + Classes may not have private methods. at (74, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-obj.js (strict mode) + Classes may not have private methods. at (72, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-obj.js (default) + Classes may not have private methods. at (72, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-rest-getter.js (strict mode) + Classes may not have private methods. at (66, 2) to (76, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-rest-getter.js (default) + Classes may not have private methods. at (66, 2) to (76, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-rest-skip-non-enumerable.js (strict mode) + Classes may not have private methods. at (67, 2) to (84, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-rest-skip-non-enumerable.js (default) + Classes may not have private methods. at (67, 2) to (84, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-rest-val-obj.js (strict mode) + Classes may not have private methods. at (65, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-obj-ptrn-rest-val-obj.js (default) + Classes may not have private methods. at (65, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-static-ary-init-iter-close.js (strict mode) + Classes may not have private methods. at (87, 2) to (90, 3) +language/statements/class/dstr/private-gen-meth-static-ary-init-iter-close.js (default) + Classes may not have private methods. at (87, 2) to (90, 3) +language/statements/class/dstr/private-gen-meth-static-ary-init-iter-no-close.js (strict mode) + Classes may not have private methods. at (87, 2) to (90, 3) +language/statements/class/dstr/private-gen-meth-static-ary-init-iter-no-close.js (default) + Classes may not have private methods. at (87, 2) to (90, 3) +language/statements/class/dstr/private-gen-meth-static-ary-name-iter-val.js (strict mode) + Classes may not have private methods. at (84, 2) to (89, 3) +language/statements/class/dstr/private-gen-meth-static-ary-name-iter-val.js (default) + Classes may not have private methods. at (84, 2) to (89, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elem-init.js (strict mode) + Classes may not have private methods. at (76, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elem-init.js (default) + Classes may not have private methods. at (76, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js (strict mode) + Classes may not have private methods. at (77, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js (default) + Classes may not have private methods. at (77, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elision-init.js (strict mode) + Classes may not have private methods. at (84, 2) to (88, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elision-init.js (default) + Classes may not have private methods. at (84, 2) to (88, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elision-iter.js (strict mode) + Classes may not have private methods. at (82, 2) to (85, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elision-iter.js (default) + Classes may not have private methods. at (82, 2) to (85, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-empty-init.js (strict mode) + Classes may not have private methods. at (80, 2) to (84, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-empty-init.js (default) + Classes may not have private methods. at (80, 2) to (84, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-empty-iter.js (strict mode) + Classes may not have private methods. at (78, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-empty-iter.js (default) + Classes may not have private methods. at (78, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-rest-init.js (strict mode) + Classes may not have private methods. at (77, 2) to (85, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-rest-init.js (default) + Classes may not have private methods. at (77, 2) to (85, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js (strict mode) + Classes may not have private methods. at (79, 2) to (88, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js (default) + Classes may not have private methods. at (79, 2) to (88, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-exhausted.js (strict mode) + Classes may not have private methods. at (77, 2) to (80, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-exhausted.js (default) + Classes may not have private methods. at (77, 2) to (80, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (78, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (78, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (78, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js (default) + Classes may not have private methods. at (78, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (78, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (78, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (78, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (78, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (79, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (79, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-hole.js (strict mode) + Classes may not have private methods. at (72, 2) to (76, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-hole.js (default) + Classes may not have private methods. at (72, 2) to (76, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-skipped.js (strict mode) + Classes may not have private methods. at (78, 2) to (85, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-skipped.js (default) + Classes may not have private methods. at (78, 2) to (85, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-undef.js (strict mode) + Classes may not have private methods. at (76, 2) to (79, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-undef.js (default) + Classes may not have private methods. at (76, 2) to (79, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-complete.js (strict mode) + Classes may not have private methods. at (80, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-complete.js (default) + Classes may not have private methods. at (80, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-done.js (strict mode) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-done.js (default) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-val.js (strict mode) + Classes may not have private methods. at (84, 2) to (89, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-val.js (default) + Classes may not have private methods. at (84, 2) to (89, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-id-init.js (strict mode) + Classes may not have private methods. at (76, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-id-init.js (default) + Classes may not have private methods. at (76, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-id.js (strict mode) + Classes may not have private methods. at (76, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-id.js (default) + Classes may not have private methods. at (76, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js (strict mode) + Classes may not have private methods. at (76, 2) to (91, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js (default) + Classes may not have private methods. at (76, 2) to (91, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-prop-id.js (strict mode) + Classes may not have private methods. at (76, 2) to (91, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-prop-id.js (default) + Classes may not have private methods. at (76, 2) to (91, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elision-exhausted.js (strict mode) + Classes may not have private methods. at (83, 2) to (86, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elision-exhausted.js (default) + Classes may not have private methods. at (83, 2) to (86, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elision.js (strict mode) + Classes may not have private methods. at (91, 2) to (95, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elision.js (default) + Classes may not have private methods. at (91, 2) to (95, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-empty.js (strict mode) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-empty.js (default) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-elem.js (strict mode) + Classes may not have private methods. at (97, 2) to (102, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-elem.js (default) + Classes may not have private methods. at (97, 2) to (102, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-elision.js (strict mode) + Classes may not have private methods. at (104, 2) to (108, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-elision.js (default) + Classes may not have private methods. at (104, 2) to (108, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-empty.js (strict mode) + Classes may not have private methods. at (88, 2) to (91, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-empty.js (default) + Classes may not have private methods. at (88, 2) to (91, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-rest.js (strict mode) + Classes may not have private methods. at (78, 2) to (87, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-rest.js (default) + Classes may not have private methods. at (78, 2) to (87, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-id-elision.js (strict mode) + Classes may not have private methods. at (75, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-id-elision.js (default) + Classes may not have private methods. at (75, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-id-exhausted.js (strict mode) + Classes may not have private methods. at (75, 2) to (79, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-id-exhausted.js (default) + Classes may not have private methods. at (75, 2) to (79, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-id.js (strict mode) + Classes may not have private methods. at (72, 2) to (80, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-id.js (default) + Classes may not have private methods. at (72, 2) to (80, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-obj-id.js (strict mode) + Classes may not have private methods. at (77, 2) to (80, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-obj-id.js (default) + Classes may not have private methods. at (77, 2) to (80, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-obj-prop-id.js (strict mode) + Classes may not have private methods. at (78, 2) to (87, 3) +language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-obj-prop-id.js (default) + Classes may not have private methods. at (78, 2) to (87, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-init-iter-close.js (strict mode) + Classes may not have private methods. at (87, 2) to (90, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-init-iter-close.js (default) + Classes may not have private methods. at (87, 2) to (90, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-init-iter-no-close.js (strict mode) + Classes may not have private methods. at (87, 2) to (90, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-init-iter-no-close.js (default) + Classes may not have private methods. at (87, 2) to (90, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-name-iter-val.js (strict mode) + Classes may not have private methods. at (84, 2) to (89, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-name-iter-val.js (default) + Classes may not have private methods. at (84, 2) to (89, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js (strict mode) + Classes may not have private methods. at (76, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js (default) + Classes may not have private methods. at (76, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js (strict mode) + Classes may not have private methods. at (77, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js (default) + Classes may not have private methods. at (77, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js (strict mode) + Classes may not have private methods. at (84, 2) to (88, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js (default) + Classes may not have private methods. at (84, 2) to (88, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js (strict mode) + Classes may not have private methods. at (82, 2) to (85, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js (default) + Classes may not have private methods. at (82, 2) to (85, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js (strict mode) + Classes may not have private methods. at (80, 2) to (84, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js (default) + Classes may not have private methods. at (80, 2) to (84, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js (strict mode) + Classes may not have private methods. at (78, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js (default) + Classes may not have private methods. at (78, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js (strict mode) + Classes may not have private methods. at (77, 2) to (85, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js (default) + Classes may not have private methods. at (77, 2) to (85, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js (strict mode) + Classes may not have private methods. at (79, 2) to (88, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js (default) + Classes may not have private methods. at (79, 2) to (88, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js (strict mode) + Classes may not have private methods. at (77, 2) to (80, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js (default) + Classes may not have private methods. at (77, 2) to (80, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (78, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (78, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (78, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js (default) + Classes may not have private methods. at (78, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (78, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (78, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (78, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (78, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (79, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (79, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js (strict mode) + Classes may not have private methods. at (72, 2) to (76, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js (default) + Classes may not have private methods. at (72, 2) to (76, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js (strict mode) + Classes may not have private methods. at (78, 2) to (85, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js (default) + Classes may not have private methods. at (78, 2) to (85, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js (strict mode) + Classes may not have private methods. at (76, 2) to (79, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js (default) + Classes may not have private methods. at (76, 2) to (79, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js (strict mode) + Classes may not have private methods. at (80, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js (default) + Classes may not have private methods. at (80, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js (strict mode) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js (default) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js (strict mode) + Classes may not have private methods. at (84, 2) to (89, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js (default) + Classes may not have private methods. at (84, 2) to (89, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js (strict mode) + Classes may not have private methods. at (76, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js (default) + Classes may not have private methods. at (76, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js (strict mode) + Classes may not have private methods. at (76, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js (default) + Classes may not have private methods. at (76, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js (strict mode) + Classes may not have private methods. at (76, 2) to (91, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js (default) + Classes may not have private methods. at (76, 2) to (91, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js (strict mode) + Classes may not have private methods. at (76, 2) to (91, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js (default) + Classes may not have private methods. at (76, 2) to (91, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elision-exhausted.js (strict mode) + Classes may not have private methods. at (83, 2) to (86, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elision-exhausted.js (default) + Classes may not have private methods. at (83, 2) to (86, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elision.js (strict mode) + Classes may not have private methods. at (91, 2) to (95, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elision.js (default) + Classes may not have private methods. at (91, 2) to (95, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-empty.js (strict mode) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-empty.js (default) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js (strict mode) + Classes may not have private methods. at (97, 2) to (102, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js (default) + Classes may not have private methods. at (97, 2) to (102, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js (strict mode) + Classes may not have private methods. at (104, 2) to (108, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js (default) + Classes may not have private methods. at (104, 2) to (108, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js (strict mode) + Classes may not have private methods. at (88, 2) to (91, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js (default) + Classes may not have private methods. at (88, 2) to (91, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js (strict mode) + Classes may not have private methods. at (78, 2) to (87, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js (default) + Classes may not have private methods. at (78, 2) to (87, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id-elision.js (strict mode) + Classes may not have private methods. at (75, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id-elision.js (default) + Classes may not have private methods. at (75, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js (strict mode) + Classes may not have private methods. at (75, 2) to (79, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js (default) + Classes may not have private methods. at (75, 2) to (79, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id.js (strict mode) + Classes may not have private methods. at (72, 2) to (80, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id.js (default) + Classes may not have private methods. at (72, 2) to (80, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js (strict mode) + Classes may not have private methods. at (77, 2) to (80, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js (default) + Classes may not have private methods. at (77, 2) to (80, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js (strict mode) + Classes may not have private methods. at (78, 2) to (87, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js (default) + Classes may not have private methods. at (78, 2) to (87, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-empty.js (strict mode) + Classes may not have private methods. at (76, 2) to (79, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-empty.js (default) + Classes may not have private methods. at (76, 2) to (79, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (77, 2) to (80, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (77, 2) to (80, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (77, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js (default) + Classes may not have private methods. at (77, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (77, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (77, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (77, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (77, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (78, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (78, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-skipped.js (strict mode) + Classes may not have private methods. at (77, 2) to (84, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-skipped.js (default) + Classes may not have private methods. at (77, 2) to (84, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (71, 2) to (74, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js (default) + Classes may not have private methods. at (71, 2) to (74, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js (strict mode) + Classes may not have private methods. at (74, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js (default) + Classes may not have private methods. at (74, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js (strict mode) + Classes may not have private methods. at (71, 2) to (74, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js (default) + Classes may not have private methods. at (71, 2) to (74, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary.js (strict mode) + Classes may not have private methods. at (72, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary.js (default) + Classes may not have private methods. at (72, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js (strict mode) + Classes may not have private methods. at (76, 2) to (96, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js (default) + Classes may not have private methods. at (76, 2) to (96, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-init.js (strict mode) + Classes may not have private methods. at (71, 2) to (77, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-init.js (default) + Classes may not have private methods. at (71, 2) to (77, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (71, 2) to (78, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js (default) + Classes may not have private methods. at (71, 2) to (78, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id.js (strict mode) + Classes may not have private methods. at (71, 2) to (77, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id.js (default) + Classes may not have private methods. at (71, 2) to (77, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js (strict mode) + Classes may not have private methods. at (74, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js (default) + Classes may not have private methods. at (74, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-obj.js (strict mode) + Classes may not have private methods. at (72, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-obj.js (default) + Classes may not have private methods. at (72, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-getter.js (strict mode) + Classes may not have private methods. at (66, 2) to (76, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-getter.js (default) + Classes may not have private methods. at (66, 2) to (76, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js (strict mode) + Classes may not have private methods. at (67, 2) to (84, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js (default) + Classes may not have private methods. at (67, 2) to (84, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js (strict mode) + Classes may not have private methods. at (65, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js (default) + Classes may not have private methods. at (65, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-empty.js (strict mode) + Classes may not have private methods. at (76, 2) to (79, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-empty.js (default) + Classes may not have private methods. at (76, 2) to (79, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (77, 2) to (80, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (77, 2) to (80, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (77, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-class.js (default) + Classes may not have private methods. at (77, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (77, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (77, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (77, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (77, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (78, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (78, 2) to (82, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-skipped.js (strict mode) + Classes may not have private methods. at (77, 2) to (84, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-skipped.js (default) + Classes may not have private methods. at (77, 2) to (84, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (71, 2) to (74, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-trailing-comma.js (default) + Classes may not have private methods. at (71, 2) to (74, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary-init.js (strict mode) + Classes may not have private methods. at (74, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary-init.js (default) + Classes may not have private methods. at (74, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js (strict mode) + Classes may not have private methods. at (71, 2) to (74, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js (default) + Classes may not have private methods. at (71, 2) to (74, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary.js (strict mode) + Classes may not have private methods. at (72, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary.js (default) + Classes may not have private methods. at (72, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-init-skipped.js (strict mode) + Classes may not have private methods. at (76, 2) to (96, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-init-skipped.js (default) + Classes may not have private methods. at (76, 2) to (96, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-init.js (strict mode) + Classes may not have private methods. at (71, 2) to (77, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-init.js (default) + Classes may not have private methods. at (71, 2) to (77, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (71, 2) to (78, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-trailing-comma.js (default) + Classes may not have private methods. at (71, 2) to (78, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-id.js (strict mode) + Classes may not have private methods. at (71, 2) to (77, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-id.js (default) + Classes may not have private methods. at (71, 2) to (77, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-obj-init.js (strict mode) + Classes may not have private methods. at (74, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-obj-init.js (default) + Classes may not have private methods. at (74, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-obj.js (strict mode) + Classes may not have private methods. at (72, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-obj.js (default) + Classes may not have private methods. at (72, 2) to (81, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-rest-getter.js (strict mode) + Classes may not have private methods. at (66, 2) to (76, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-rest-getter.js (default) + Classes may not have private methods. at (66, 2) to (76, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js (strict mode) + Classes may not have private methods. at (67, 2) to (84, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js (default) + Classes may not have private methods. at (67, 2) to (84, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-rest-val-obj.js (strict mode) + Classes may not have private methods. at (65, 2) to (83, 3) +language/statements/class/dstr/private-gen-meth-static-obj-ptrn-rest-val-obj.js (default) + Classes may not have private methods. at (65, 2) to (83, 3) +language/statements/class/dstr/private-meth-ary-init-iter-close.js (strict mode) + Classes may not have private methods. at (85, 2) to (88, 3) +language/statements/class/dstr/private-meth-ary-init-iter-close.js (default) + Classes may not have private methods. at (85, 2) to (88, 3) +language/statements/class/dstr/private-meth-ary-init-iter-no-close.js (strict mode) + Classes may not have private methods. at (85, 2) to (88, 3) +language/statements/class/dstr/private-meth-ary-init-iter-no-close.js (default) + Classes may not have private methods. at (85, 2) to (88, 3) +language/statements/class/dstr/private-meth-ary-name-iter-val.js (strict mode) + Classes may not have private methods. at (82, 2) to (87, 3) +language/statements/class/dstr/private-meth-ary-name-iter-val.js (default) + Classes may not have private methods. at (82, 2) to (87, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-elem-init.js (strict mode) + Classes may not have private methods. at (74, 2) to (79, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-elem-init.js (default) + Classes may not have private methods. at (74, 2) to (79, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-elem-iter.js (strict mode) + Classes may not have private methods. at (75, 2) to (80, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-elem-iter.js (default) + Classes may not have private methods. at (75, 2) to (80, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-elision-init.js (strict mode) + Classes may not have private methods. at (82, 2) to (86, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-elision-init.js (default) + Classes may not have private methods. at (82, 2) to (86, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-elision-iter.js (strict mode) + Classes may not have private methods. at (80, 2) to (83, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-elision-iter.js (default) + Classes may not have private methods. at (80, 2) to (83, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-empty-init.js (strict mode) + Classes may not have private methods. at (78, 2) to (82, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-empty-init.js (default) + Classes may not have private methods. at (78, 2) to (82, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-empty-iter.js (strict mode) + Classes may not have private methods. at (76, 2) to (79, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-empty-iter.js (default) + Classes may not have private methods. at (76, 2) to (79, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-rest-init.js (strict mode) + Classes may not have private methods. at (75, 2) to (83, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-rest-init.js (default) + Classes may not have private methods. at (75, 2) to (83, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-rest-iter.js (strict mode) + Classes may not have private methods. at (77, 2) to (86, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-rest-iter.js (default) + Classes may not have private methods. at (77, 2) to (86, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-exhausted.js (strict mode) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-exhausted.js (default) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (76, 2) to (79, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (76, 2) to (79, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (76, 2) to (81, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-class.js (default) + Classes may not have private methods. at (76, 2) to (81, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (76, 2) to (80, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (76, 2) to (80, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (76, 2) to (80, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (76, 2) to (80, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (77, 2) to (81, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (77, 2) to (81, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-hole.js (strict mode) + Classes may not have private methods. at (70, 2) to (74, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-hole.js (default) + Classes may not have private methods. at (70, 2) to (74, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-skipped.js (strict mode) + Classes may not have private methods. at (76, 2) to (83, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-skipped.js (default) + Classes may not have private methods. at (76, 2) to (83, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-undef.js (strict mode) + Classes may not have private methods. at (74, 2) to (77, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-undef.js (default) + Classes may not have private methods. at (74, 2) to (77, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-id-iter-complete.js (strict mode) + Classes may not have private methods. at (78, 2) to (81, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-id-iter-complete.js (default) + Classes may not have private methods. at (78, 2) to (81, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-id-iter-done.js (strict mode) + Classes may not have private methods. at (73, 2) to (76, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-id-iter-done.js (default) + Classes may not have private methods. at (73, 2) to (76, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-id-iter-val.js (strict mode) + Classes may not have private methods. at (82, 2) to (87, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-id-iter-val.js (default) + Classes may not have private methods. at (82, 2) to (87, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-obj-id-init.js (strict mode) + Classes may not have private methods. at (74, 2) to (79, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-obj-id-init.js (default) + Classes may not have private methods. at (74, 2) to (79, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-obj-id.js (strict mode) + Classes may not have private methods. at (74, 2) to (79, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-obj-id.js (default) + Classes may not have private methods. at (74, 2) to (79, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-obj-prop-id-init.js (strict mode) + Classes may not have private methods. at (74, 2) to (89, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-obj-prop-id-init.js (default) + Classes may not have private methods. at (74, 2) to (89, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-obj-prop-id.js (strict mode) + Classes may not have private methods. at (74, 2) to (89, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elem-obj-prop-id.js (default) + Classes may not have private methods. at (74, 2) to (89, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elision-exhausted.js (strict mode) + Classes may not have private methods. at (81, 2) to (84, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elision-exhausted.js (default) + Classes may not have private methods. at (81, 2) to (84, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elision.js (strict mode) + Classes may not have private methods. at (89, 2) to (93, 3) +language/statements/class/dstr/private-meth-ary-ptrn-elision.js (default) + Classes may not have private methods. at (89, 2) to (93, 3) +language/statements/class/dstr/private-meth-ary-ptrn-empty.js (strict mode) + Classes may not have private methods. at (73, 2) to (76, 3) +language/statements/class/dstr/private-meth-ary-ptrn-empty.js (default) + Classes may not have private methods. at (73, 2) to (76, 3) +language/statements/class/dstr/private-meth-ary-ptrn-rest-ary-elem.js (strict mode) + Classes may not have private methods. at (95, 2) to (100, 3) +language/statements/class/dstr/private-meth-ary-ptrn-rest-ary-elem.js (default) + Classes may not have private methods. at (95, 2) to (100, 3) +language/statements/class/dstr/private-meth-ary-ptrn-rest-ary-elision.js (strict mode) + Classes may not have private methods. at (102, 2) to (106, 3) +language/statements/class/dstr/private-meth-ary-ptrn-rest-ary-elision.js (default) + Classes may not have private methods. at (102, 2) to (106, 3) +language/statements/class/dstr/private-meth-ary-ptrn-rest-ary-empty.js (strict mode) + Classes may not have private methods. at (86, 2) to (89, 3) +language/statements/class/dstr/private-meth-ary-ptrn-rest-ary-empty.js (default) + Classes may not have private methods. at (86, 2) to (89, 3) +language/statements/class/dstr/private-meth-ary-ptrn-rest-ary-rest.js (strict mode) + Classes may not have private methods. at (76, 2) to (85, 3) +language/statements/class/dstr/private-meth-ary-ptrn-rest-ary-rest.js (default) + Classes may not have private methods. at (76, 2) to (85, 3) +language/statements/class/dstr/private-meth-ary-ptrn-rest-id-elision.js (strict mode) + Classes may not have private methods. at (73, 2) to (81, 3) +language/statements/class/dstr/private-meth-ary-ptrn-rest-id-elision.js (default) + Classes may not have private methods. at (73, 2) to (81, 3) +language/statements/class/dstr/private-meth-ary-ptrn-rest-id-exhausted.js (strict mode) + Classes may not have private methods. at (73, 2) to (77, 3) +language/statements/class/dstr/private-meth-ary-ptrn-rest-id-exhausted.js (default) + Classes may not have private methods. at (73, 2) to (77, 3) +language/statements/class/dstr/private-meth-ary-ptrn-rest-id.js (strict mode) + Classes may not have private methods. at (70, 2) to (78, 3) +language/statements/class/dstr/private-meth-ary-ptrn-rest-id.js (default) + Classes may not have private methods. at (70, 2) to (78, 3) +language/statements/class/dstr/private-meth-ary-ptrn-rest-obj-id.js (strict mode) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-meth-ary-ptrn-rest-obj-id.js (default) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-meth-ary-ptrn-rest-obj-prop-id.js (strict mode) + Classes may not have private methods. at (76, 2) to (85, 3) +language/statements/class/dstr/private-meth-ary-ptrn-rest-obj-prop-id.js (default) + Classes may not have private methods. at (76, 2) to (85, 3) +language/statements/class/dstr/private-meth-dflt-ary-init-iter-close.js (strict mode) + Classes may not have private methods. at (85, 2) to (88, 3) +language/statements/class/dstr/private-meth-dflt-ary-init-iter-close.js (default) + Classes may not have private methods. at (85, 2) to (88, 3) +language/statements/class/dstr/private-meth-dflt-ary-init-iter-no-close.js (strict mode) + Classes may not have private methods. at (85, 2) to (88, 3) +language/statements/class/dstr/private-meth-dflt-ary-init-iter-no-close.js (default) + Classes may not have private methods. at (85, 2) to (88, 3) +language/statements/class/dstr/private-meth-dflt-ary-name-iter-val.js (strict mode) + Classes may not have private methods. at (82, 2) to (87, 3) +language/statements/class/dstr/private-meth-dflt-ary-name-iter-val.js (default) + Classes may not have private methods. at (82, 2) to (87, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elem-init.js (strict mode) + Classes may not have private methods. at (74, 2) to (79, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elem-init.js (default) + Classes may not have private methods. at (74, 2) to (79, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elem-iter.js (strict mode) + Classes may not have private methods. at (75, 2) to (80, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elem-iter.js (default) + Classes may not have private methods. at (75, 2) to (80, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elision-init.js (strict mode) + Classes may not have private methods. at (82, 2) to (86, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elision-init.js (default) + Classes may not have private methods. at (82, 2) to (86, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elision-iter.js (strict mode) + Classes may not have private methods. at (80, 2) to (83, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elision-iter.js (default) + Classes may not have private methods. at (80, 2) to (83, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-empty-init.js (strict mode) + Classes may not have private methods. at (78, 2) to (82, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-empty-init.js (default) + Classes may not have private methods. at (78, 2) to (82, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-empty-iter.js (strict mode) + Classes may not have private methods. at (76, 2) to (79, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-empty-iter.js (default) + Classes may not have private methods. at (76, 2) to (79, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-rest-init.js (strict mode) + Classes may not have private methods. at (75, 2) to (83, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-rest-init.js (default) + Classes may not have private methods. at (75, 2) to (83, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-rest-iter.js (strict mode) + Classes may not have private methods. at (77, 2) to (86, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-rest-iter.js (default) + Classes may not have private methods. at (77, 2) to (86, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-exhausted.js (strict mode) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-exhausted.js (default) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (76, 2) to (79, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (76, 2) to (79, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (76, 2) to (81, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js (default) + Classes may not have private methods. at (76, 2) to (81, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (76, 2) to (80, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (76, 2) to (80, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (76, 2) to (80, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (76, 2) to (80, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (77, 2) to (81, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (77, 2) to (81, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-hole.js (strict mode) + Classes may not have private methods. at (70, 2) to (74, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-hole.js (default) + Classes may not have private methods. at (70, 2) to (74, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-skipped.js (strict mode) + Classes may not have private methods. at (76, 2) to (83, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-skipped.js (default) + Classes may not have private methods. at (76, 2) to (83, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-undef.js (strict mode) + Classes may not have private methods. at (74, 2) to (77, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-undef.js (default) + Classes may not have private methods. at (74, 2) to (77, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-complete.js (strict mode) + Classes may not have private methods. at (78, 2) to (81, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-complete.js (default) + Classes may not have private methods. at (78, 2) to (81, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-done.js (strict mode) + Classes may not have private methods. at (73, 2) to (76, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-done.js (default) + Classes may not have private methods. at (73, 2) to (76, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-val.js (strict mode) + Classes may not have private methods. at (82, 2) to (87, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-val.js (default) + Classes may not have private methods. at (82, 2) to (87, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-id-init.js (strict mode) + Classes may not have private methods. at (74, 2) to (79, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-id-init.js (default) + Classes may not have private methods. at (74, 2) to (79, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-id.js (strict mode) + Classes may not have private methods. at (74, 2) to (79, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-id.js (default) + Classes may not have private methods. at (74, 2) to (79, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js (strict mode) + Classes may not have private methods. at (74, 2) to (89, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js (default) + Classes may not have private methods. at (74, 2) to (89, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-prop-id.js (strict mode) + Classes may not have private methods. at (74, 2) to (89, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-prop-id.js (default) + Classes may not have private methods. at (74, 2) to (89, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elision-exhausted.js (strict mode) + Classes may not have private methods. at (81, 2) to (84, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elision-exhausted.js (default) + Classes may not have private methods. at (81, 2) to (84, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elision.js (strict mode) + Classes may not have private methods. at (89, 2) to (93, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-elision.js (default) + Classes may not have private methods. at (89, 2) to (93, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-empty.js (strict mode) + Classes may not have private methods. at (73, 2) to (76, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-empty.js (default) + Classes may not have private methods. at (73, 2) to (76, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-elem.js (strict mode) + Classes may not have private methods. at (95, 2) to (100, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-elem.js (default) + Classes may not have private methods. at (95, 2) to (100, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-elision.js (strict mode) + Classes may not have private methods. at (102, 2) to (106, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-elision.js (default) + Classes may not have private methods. at (102, 2) to (106, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-empty.js (strict mode) + Classes may not have private methods. at (86, 2) to (89, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-empty.js (default) + Classes may not have private methods. at (86, 2) to (89, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-rest.js (strict mode) + Classes may not have private methods. at (76, 2) to (85, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-rest.js (default) + Classes may not have private methods. at (76, 2) to (85, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-id-elision.js (strict mode) + Classes may not have private methods. at (73, 2) to (81, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-id-elision.js (default) + Classes may not have private methods. at (73, 2) to (81, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-id-exhausted.js (strict mode) + Classes may not have private methods. at (73, 2) to (77, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-id-exhausted.js (default) + Classes may not have private methods. at (73, 2) to (77, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-id.js (strict mode) + Classes may not have private methods. at (70, 2) to (78, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-id.js (default) + Classes may not have private methods. at (70, 2) to (78, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-obj-id.js (strict mode) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-obj-id.js (default) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-obj-prop-id.js (strict mode) + Classes may not have private methods. at (76, 2) to (85, 3) +language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-obj-prop-id.js (default) + Classes may not have private methods. at (76, 2) to (85, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-empty.js (strict mode) + Classes may not have private methods. at (74, 2) to (77, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-empty.js (default) + Classes may not have private methods. at (74, 2) to (77, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (75, 2) to (80, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-class.js (default) + Classes may not have private methods. at (75, 2) to (80, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (75, 2) to (79, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (75, 2) to (79, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (75, 2) to (79, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (75, 2) to (79, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (76, 2) to (80, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (76, 2) to (80, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-skipped.js (strict mode) + Classes may not have private methods. at (75, 2) to (82, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-skipped.js (default) + Classes may not have private methods. at (75, 2) to (82, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (69, 2) to (72, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-trailing-comma.js (default) + Classes may not have private methods. at (69, 2) to (72, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-ary-init.js (strict mode) + Classes may not have private methods. at (72, 2) to (81, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-ary-init.js (default) + Classes may not have private methods. at (72, 2) to (81, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js (strict mode) + Classes may not have private methods. at (69, 2) to (72, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js (default) + Classes may not have private methods. at (69, 2) to (72, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-ary.js (strict mode) + Classes may not have private methods. at (70, 2) to (79, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-ary.js (default) + Classes may not have private methods. at (70, 2) to (79, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-id-init-skipped.js (strict mode) + Classes may not have private methods. at (74, 2) to (94, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-id-init-skipped.js (default) + Classes may not have private methods. at (74, 2) to (94, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-id-init.js (strict mode) + Classes may not have private methods. at (69, 2) to (75, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-id-init.js (default) + Classes may not have private methods. at (69, 2) to (75, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (69, 2) to (76, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-id-trailing-comma.js (default) + Classes may not have private methods. at (69, 2) to (76, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-id.js (strict mode) + Classes may not have private methods. at (69, 2) to (75, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-id.js (default) + Classes may not have private methods. at (69, 2) to (75, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-obj-init.js (strict mode) + Classes may not have private methods. at (72, 2) to (81, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-obj-init.js (default) + Classes may not have private methods. at (72, 2) to (81, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-obj.js (strict mode) + Classes may not have private methods. at (70, 2) to (79, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-obj.js (default) + Classes may not have private methods. at (70, 2) to (79, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-rest-getter.js (strict mode) + Classes may not have private methods. at (64, 2) to (74, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-rest-getter.js (default) + Classes may not have private methods. at (64, 2) to (74, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js (strict mode) + Classes may not have private methods. at (65, 2) to (82, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js (default) + Classes may not have private methods. at (65, 2) to (82, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-rest-val-obj.js (strict mode) + Classes may not have private methods. at (63, 2) to (81, 3) +language/statements/class/dstr/private-meth-dflt-obj-ptrn-rest-val-obj.js (default) + Classes may not have private methods. at (63, 2) to (81, 3) +language/statements/class/dstr/private-meth-obj-ptrn-empty.js (strict mode) + Classes may not have private methods. at (74, 2) to (77, 3) +language/statements/class/dstr/private-meth-obj-ptrn-empty.js (default) + Classes may not have private methods. at (74, 2) to (77, 3) +language/statements/class/dstr/private-meth-obj-ptrn-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-meth-obj-ptrn-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-meth-obj-ptrn-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (75, 2) to (80, 3) +language/statements/class/dstr/private-meth-obj-ptrn-id-init-fn-name-class.js (default) + Classes may not have private methods. at (75, 2) to (80, 3) +language/statements/class/dstr/private-meth-obj-ptrn-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (75, 2) to (79, 3) +language/statements/class/dstr/private-meth-obj-ptrn-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (75, 2) to (79, 3) +language/statements/class/dstr/private-meth-obj-ptrn-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (75, 2) to (79, 3) +language/statements/class/dstr/private-meth-obj-ptrn-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (75, 2) to (79, 3) +language/statements/class/dstr/private-meth-obj-ptrn-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (76, 2) to (80, 3) +language/statements/class/dstr/private-meth-obj-ptrn-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (76, 2) to (80, 3) +language/statements/class/dstr/private-meth-obj-ptrn-id-init-skipped.js (strict mode) + Classes may not have private methods. at (75, 2) to (82, 3) +language/statements/class/dstr/private-meth-obj-ptrn-id-init-skipped.js (default) + Classes may not have private methods. at (75, 2) to (82, 3) +language/statements/class/dstr/private-meth-obj-ptrn-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (69, 2) to (72, 3) +language/statements/class/dstr/private-meth-obj-ptrn-id-trailing-comma.js (default) + Classes may not have private methods. at (69, 2) to (72, 3) +language/statements/class/dstr/private-meth-obj-ptrn-prop-ary-init.js (strict mode) + Classes may not have private methods. at (72, 2) to (81, 3) +language/statements/class/dstr/private-meth-obj-ptrn-prop-ary-init.js (default) + Classes may not have private methods. at (72, 2) to (81, 3) +language/statements/class/dstr/private-meth-obj-ptrn-prop-ary-trailing-comma.js (strict mode) + Classes may not have private methods. at (69, 2) to (72, 3) +language/statements/class/dstr/private-meth-obj-ptrn-prop-ary-trailing-comma.js (default) + Classes may not have private methods. at (69, 2) to (72, 3) +language/statements/class/dstr/private-meth-obj-ptrn-prop-ary.js (strict mode) + Classes may not have private methods. at (70, 2) to (79, 3) +language/statements/class/dstr/private-meth-obj-ptrn-prop-ary.js (default) + Classes may not have private methods. at (70, 2) to (79, 3) +language/statements/class/dstr/private-meth-obj-ptrn-prop-id-init-skipped.js (strict mode) + Classes may not have private methods. at (74, 2) to (94, 3) +language/statements/class/dstr/private-meth-obj-ptrn-prop-id-init-skipped.js (default) + Classes may not have private methods. at (74, 2) to (94, 3) +language/statements/class/dstr/private-meth-obj-ptrn-prop-id-init.js (strict mode) + Classes may not have private methods. at (69, 2) to (75, 3) +language/statements/class/dstr/private-meth-obj-ptrn-prop-id-init.js (default) + Classes may not have private methods. at (69, 2) to (75, 3) +language/statements/class/dstr/private-meth-obj-ptrn-prop-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (69, 2) to (76, 3) +language/statements/class/dstr/private-meth-obj-ptrn-prop-id-trailing-comma.js (default) + Classes may not have private methods. at (69, 2) to (76, 3) +language/statements/class/dstr/private-meth-obj-ptrn-prop-id.js (strict mode) + Classes may not have private methods. at (69, 2) to (75, 3) +language/statements/class/dstr/private-meth-obj-ptrn-prop-id.js (default) + Classes may not have private methods. at (69, 2) to (75, 3) +language/statements/class/dstr/private-meth-obj-ptrn-prop-obj-init.js (strict mode) + Classes may not have private methods. at (72, 2) to (81, 3) +language/statements/class/dstr/private-meth-obj-ptrn-prop-obj-init.js (default) + Classes may not have private methods. at (72, 2) to (81, 3) +language/statements/class/dstr/private-meth-obj-ptrn-prop-obj.js (strict mode) + Classes may not have private methods. at (70, 2) to (79, 3) +language/statements/class/dstr/private-meth-obj-ptrn-prop-obj.js (default) + Classes may not have private methods. at (70, 2) to (79, 3) +language/statements/class/dstr/private-meth-obj-ptrn-rest-getter.js (strict mode) + Classes may not have private methods. at (64, 2) to (74, 3) +language/statements/class/dstr/private-meth-obj-ptrn-rest-getter.js (default) + Classes may not have private methods. at (64, 2) to (74, 3) +language/statements/class/dstr/private-meth-obj-ptrn-rest-skip-non-enumerable.js (strict mode) + Classes may not have private methods. at (65, 2) to (82, 3) +language/statements/class/dstr/private-meth-obj-ptrn-rest-skip-non-enumerable.js (default) + Classes may not have private methods. at (65, 2) to (82, 3) +language/statements/class/dstr/private-meth-obj-ptrn-rest-val-obj.js (strict mode) + Classes may not have private methods. at (63, 2) to (81, 3) +language/statements/class/dstr/private-meth-obj-ptrn-rest-val-obj.js (default) + Classes may not have private methods. at (63, 2) to (81, 3) +language/statements/class/dstr/private-meth-static-ary-init-iter-close.js (strict mode) + Classes may not have private methods. at (85, 2) to (88, 3) +language/statements/class/dstr/private-meth-static-ary-init-iter-close.js (default) + Classes may not have private methods. at (85, 2) to (88, 3) +language/statements/class/dstr/private-meth-static-ary-init-iter-no-close.js (strict mode) + Classes may not have private methods. at (85, 2) to (88, 3) +language/statements/class/dstr/private-meth-static-ary-init-iter-no-close.js (default) + Classes may not have private methods. at (85, 2) to (88, 3) +language/statements/class/dstr/private-meth-static-ary-name-iter-val.js (strict mode) + Classes may not have private methods. at (82, 2) to (87, 3) +language/statements/class/dstr/private-meth-static-ary-name-iter-val.js (default) + Classes may not have private methods. at (82, 2) to (87, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-elem-init.js (strict mode) + Classes may not have private methods. at (74, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-elem-init.js (default) + Classes may not have private methods. at (74, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-elem-iter.js (strict mode) + Classes may not have private methods. at (75, 2) to (80, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-elem-iter.js (default) + Classes may not have private methods. at (75, 2) to (80, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-elision-init.js (strict mode) + Classes may not have private methods. at (82, 2) to (86, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-elision-init.js (default) + Classes may not have private methods. at (82, 2) to (86, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-elision-iter.js (strict mode) + Classes may not have private methods. at (80, 2) to (83, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-elision-iter.js (default) + Classes may not have private methods. at (80, 2) to (83, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-empty-init.js (strict mode) + Classes may not have private methods. at (78, 2) to (82, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-empty-init.js (default) + Classes may not have private methods. at (78, 2) to (82, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-empty-iter.js (strict mode) + Classes may not have private methods. at (76, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-empty-iter.js (default) + Classes may not have private methods. at (76, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-rest-init.js (strict mode) + Classes may not have private methods. at (75, 2) to (83, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-rest-init.js (default) + Classes may not have private methods. at (75, 2) to (83, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-rest-iter.js (strict mode) + Classes may not have private methods. at (77, 2) to (86, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-rest-iter.js (default) + Classes may not have private methods. at (77, 2) to (86, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-exhausted.js (strict mode) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-exhausted.js (default) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (76, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (76, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (76, 2) to (81, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-class.js (default) + Classes may not have private methods. at (76, 2) to (81, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (76, 2) to (80, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (76, 2) to (80, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (76, 2) to (80, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (76, 2) to (80, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (77, 2) to (81, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (77, 2) to (81, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-hole.js (strict mode) + Classes may not have private methods. at (70, 2) to (74, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-hole.js (default) + Classes may not have private methods. at (70, 2) to (74, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-skipped.js (strict mode) + Classes may not have private methods. at (76, 2) to (83, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-skipped.js (default) + Classes may not have private methods. at (76, 2) to (83, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-undef.js (strict mode) + Classes may not have private methods. at (74, 2) to (77, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-undef.js (default) + Classes may not have private methods. at (74, 2) to (77, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-complete.js (strict mode) + Classes may not have private methods. at (78, 2) to (81, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-complete.js (default) + Classes may not have private methods. at (78, 2) to (81, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-done.js (strict mode) + Classes may not have private methods. at (73, 2) to (76, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-done.js (default) + Classes may not have private methods. at (73, 2) to (76, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-val.js (strict mode) + Classes may not have private methods. at (82, 2) to (87, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-val.js (default) + Classes may not have private methods. at (82, 2) to (87, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-obj-id-init.js (strict mode) + Classes may not have private methods. at (74, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-obj-id-init.js (default) + Classes may not have private methods. at (74, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-obj-id.js (strict mode) + Classes may not have private methods. at (74, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-obj-id.js (default) + Classes may not have private methods. at (74, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-obj-prop-id-init.js (strict mode) + Classes may not have private methods. at (74, 2) to (89, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-obj-prop-id-init.js (default) + Classes may not have private methods. at (74, 2) to (89, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-obj-prop-id.js (strict mode) + Classes may not have private methods. at (74, 2) to (89, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elem-obj-prop-id.js (default) + Classes may not have private methods. at (74, 2) to (89, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elision-exhausted.js (strict mode) + Classes may not have private methods. at (81, 2) to (84, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elision-exhausted.js (default) + Classes may not have private methods. at (81, 2) to (84, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elision.js (strict mode) + Classes may not have private methods. at (89, 2) to (93, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-elision.js (default) + Classes may not have private methods. at (89, 2) to (93, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-empty.js (strict mode) + Classes may not have private methods. at (73, 2) to (76, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-empty.js (default) + Classes may not have private methods. at (73, 2) to (76, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-rest-ary-elem.js (strict mode) + Classes may not have private methods. at (95, 2) to (100, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-rest-ary-elem.js (default) + Classes may not have private methods. at (95, 2) to (100, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-rest-ary-elision.js (strict mode) + Classes may not have private methods. at (102, 2) to (106, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-rest-ary-elision.js (default) + Classes may not have private methods. at (102, 2) to (106, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-rest-ary-empty.js (strict mode) + Classes may not have private methods. at (86, 2) to (89, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-rest-ary-empty.js (default) + Classes may not have private methods. at (86, 2) to (89, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-rest-ary-rest.js (strict mode) + Classes may not have private methods. at (76, 2) to (85, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-rest-ary-rest.js (default) + Classes may not have private methods. at (76, 2) to (85, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-rest-id-elision.js (strict mode) + Classes may not have private methods. at (73, 2) to (81, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-rest-id-elision.js (default) + Classes may not have private methods. at (73, 2) to (81, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-rest-id-exhausted.js (strict mode) + Classes may not have private methods. at (73, 2) to (77, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-rest-id-exhausted.js (default) + Classes may not have private methods. at (73, 2) to (77, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-rest-id.js (strict mode) + Classes may not have private methods. at (70, 2) to (78, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-rest-id.js (default) + Classes may not have private methods. at (70, 2) to (78, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-rest-obj-id.js (strict mode) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-rest-obj-id.js (default) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-rest-obj-prop-id.js (strict mode) + Classes may not have private methods. at (76, 2) to (85, 3) +language/statements/class/dstr/private-meth-static-ary-ptrn-rest-obj-prop-id.js (default) + Classes may not have private methods. at (76, 2) to (85, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-init-iter-close.js (strict mode) + Classes may not have private methods. at (85, 2) to (88, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-init-iter-close.js (default) + Classes may not have private methods. at (85, 2) to (88, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-init-iter-no-close.js (strict mode) + Classes may not have private methods. at (85, 2) to (88, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-init-iter-no-close.js (default) + Classes may not have private methods. at (85, 2) to (88, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-name-iter-val.js (strict mode) + Classes may not have private methods. at (82, 2) to (87, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-name-iter-val.js (default) + Classes may not have private methods. at (82, 2) to (87, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js (strict mode) + Classes may not have private methods. at (74, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js (default) + Classes may not have private methods. at (74, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js (strict mode) + Classes may not have private methods. at (75, 2) to (80, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js (default) + Classes may not have private methods. at (75, 2) to (80, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js (strict mode) + Classes may not have private methods. at (82, 2) to (86, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js (default) + Classes may not have private methods. at (82, 2) to (86, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js (strict mode) + Classes may not have private methods. at (80, 2) to (83, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js (default) + Classes may not have private methods. at (80, 2) to (83, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js (strict mode) + Classes may not have private methods. at (78, 2) to (82, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js (default) + Classes may not have private methods. at (78, 2) to (82, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js (strict mode) + Classes may not have private methods. at (76, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js (default) + Classes may not have private methods. at (76, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js (strict mode) + Classes may not have private methods. at (75, 2) to (83, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js (default) + Classes may not have private methods. at (75, 2) to (83, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js (strict mode) + Classes may not have private methods. at (77, 2) to (86, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js (default) + Classes may not have private methods. at (77, 2) to (86, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js (strict mode) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js (default) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (76, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (76, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (76, 2) to (81, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js (default) + Classes may not have private methods. at (76, 2) to (81, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (76, 2) to (80, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (76, 2) to (80, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (76, 2) to (80, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (76, 2) to (80, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (77, 2) to (81, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (77, 2) to (81, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-hole.js (strict mode) + Classes may not have private methods. at (70, 2) to (74, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-hole.js (default) + Classes may not have private methods. at (70, 2) to (74, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js (strict mode) + Classes may not have private methods. at (76, 2) to (83, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js (default) + Classes may not have private methods. at (76, 2) to (83, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-undef.js (strict mode) + Classes may not have private methods. at (74, 2) to (77, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-undef.js (default) + Classes may not have private methods. at (74, 2) to (77, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js (strict mode) + Classes may not have private methods. at (78, 2) to (81, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js (default) + Classes may not have private methods. at (78, 2) to (81, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-done.js (strict mode) + Classes may not have private methods. at (73, 2) to (76, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-done.js (default) + Classes may not have private methods. at (73, 2) to (76, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-val.js (strict mode) + Classes may not have private methods. at (82, 2) to (87, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-val.js (default) + Classes may not have private methods. at (82, 2) to (87, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-id-init.js (strict mode) + Classes may not have private methods. at (74, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-id-init.js (default) + Classes may not have private methods. at (74, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-id.js (strict mode) + Classes may not have private methods. at (74, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-id.js (default) + Classes may not have private methods. at (74, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js (strict mode) + Classes may not have private methods. at (74, 2) to (89, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js (default) + Classes may not have private methods. at (74, 2) to (89, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js (strict mode) + Classes may not have private methods. at (74, 2) to (89, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js (default) + Classes may not have private methods. at (74, 2) to (89, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elision-exhausted.js (strict mode) + Classes may not have private methods. at (81, 2) to (84, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elision-exhausted.js (default) + Classes may not have private methods. at (81, 2) to (84, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elision.js (strict mode) + Classes may not have private methods. at (89, 2) to (93, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elision.js (default) + Classes may not have private methods. at (89, 2) to (93, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-empty.js (strict mode) + Classes may not have private methods. at (73, 2) to (76, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-empty.js (default) + Classes may not have private methods. at (73, 2) to (76, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-elem.js (strict mode) + Classes may not have private methods. at (95, 2) to (100, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-elem.js (default) + Classes may not have private methods. at (95, 2) to (100, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-elision.js (strict mode) + Classes may not have private methods. at (102, 2) to (106, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-elision.js (default) + Classes may not have private methods. at (102, 2) to (106, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-empty.js (strict mode) + Classes may not have private methods. at (86, 2) to (89, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-empty.js (default) + Classes may not have private methods. at (86, 2) to (89, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-rest.js (strict mode) + Classes may not have private methods. at (76, 2) to (85, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-rest.js (default) + Classes may not have private methods. at (76, 2) to (85, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id-elision.js (strict mode) + Classes may not have private methods. at (73, 2) to (81, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id-elision.js (default) + Classes may not have private methods. at (73, 2) to (81, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id-exhausted.js (strict mode) + Classes may not have private methods. at (73, 2) to (77, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id-exhausted.js (default) + Classes may not have private methods. at (73, 2) to (77, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id.js (strict mode) + Classes may not have private methods. at (70, 2) to (78, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id.js (default) + Classes may not have private methods. at (70, 2) to (78, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-obj-id.js (strict mode) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-obj-id.js (default) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js (strict mode) + Classes may not have private methods. at (76, 2) to (85, 3) +language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js (default) + Classes may not have private methods. at (76, 2) to (85, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-empty.js (strict mode) + Classes may not have private methods. at (74, 2) to (77, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-empty.js (default) + Classes may not have private methods. at (74, 2) to (77, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (75, 2) to (80, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js (default) + Classes may not have private methods. at (75, 2) to (80, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (75, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (75, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (75, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (75, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (76, 2) to (80, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (76, 2) to (80, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-skipped.js (strict mode) + Classes may not have private methods. at (75, 2) to (82, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-skipped.js (default) + Classes may not have private methods. at (75, 2) to (82, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (69, 2) to (72, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-trailing-comma.js (default) + Classes may not have private methods. at (69, 2) to (72, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary-init.js (strict mode) + Classes may not have private methods. at (72, 2) to (81, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary-init.js (default) + Classes may not have private methods. at (72, 2) to (81, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js (strict mode) + Classes may not have private methods. at (69, 2) to (72, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js (default) + Classes may not have private methods. at (69, 2) to (72, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary.js (strict mode) + Classes may not have private methods. at (70, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary.js (default) + Classes may not have private methods. at (70, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js (strict mode) + Classes may not have private methods. at (74, 2) to (94, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js (default) + Classes may not have private methods. at (74, 2) to (94, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-init.js (strict mode) + Classes may not have private methods. at (69, 2) to (75, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-init.js (default) + Classes may not have private methods. at (69, 2) to (75, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (69, 2) to (76, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js (default) + Classes may not have private methods. at (69, 2) to (76, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id.js (strict mode) + Classes may not have private methods. at (69, 2) to (75, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id.js (default) + Classes may not have private methods. at (69, 2) to (75, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-obj-init.js (strict mode) + Classes may not have private methods. at (72, 2) to (81, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-obj-init.js (default) + Classes may not have private methods. at (72, 2) to (81, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-obj.js (strict mode) + Classes may not have private methods. at (70, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-obj.js (default) + Classes may not have private methods. at (70, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-rest-getter.js (strict mode) + Classes may not have private methods. at (64, 2) to (74, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-rest-getter.js (default) + Classes may not have private methods. at (64, 2) to (74, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js (strict mode) + Classes may not have private methods. at (65, 2) to (82, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js (default) + Classes may not have private methods. at (65, 2) to (82, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-rest-val-obj.js (strict mode) + Classes may not have private methods. at (63, 2) to (81, 3) +language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-rest-val-obj.js (default) + Classes may not have private methods. at (63, 2) to (81, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-empty.js (strict mode) + Classes may not have private methods. at (74, 2) to (77, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-empty.js (default) + Classes may not have private methods. at (74, 2) to (77, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-arrow.js (strict mode) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-arrow.js (default) + Classes may not have private methods. at (75, 2) to (78, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-class.js (strict mode) + Classes may not have private methods. at (75, 2) to (80, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-class.js (default) + Classes may not have private methods. at (75, 2) to (80, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-cover.js (strict mode) + Classes may not have private methods. at (75, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-cover.js (default) + Classes may not have private methods. at (75, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-fn.js (strict mode) + Classes may not have private methods. at (75, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-fn.js (default) + Classes may not have private methods. at (75, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-gen.js (strict mode) + Classes may not have private methods. at (76, 2) to (80, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-gen.js (default) + Classes may not have private methods. at (76, 2) to (80, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-skipped.js (strict mode) + Classes may not have private methods. at (75, 2) to (82, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-skipped.js (default) + Classes may not have private methods. at (75, 2) to (82, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (69, 2) to (72, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-id-trailing-comma.js (default) + Classes may not have private methods. at (69, 2) to (72, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-prop-ary-init.js (strict mode) + Classes may not have private methods. at (72, 2) to (81, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-prop-ary-init.js (default) + Classes may not have private methods. at (72, 2) to (81, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-prop-ary-trailing-comma.js (strict mode) + Classes may not have private methods. at (69, 2) to (72, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-prop-ary-trailing-comma.js (default) + Classes may not have private methods. at (69, 2) to (72, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-prop-ary.js (strict mode) + Classes may not have private methods. at (70, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-prop-ary.js (default) + Classes may not have private methods. at (70, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-prop-id-init-skipped.js (strict mode) + Classes may not have private methods. at (74, 2) to (94, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-prop-id-init-skipped.js (default) + Classes may not have private methods. at (74, 2) to (94, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-prop-id-init.js (strict mode) + Classes may not have private methods. at (69, 2) to (75, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-prop-id-init.js (default) + Classes may not have private methods. at (69, 2) to (75, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-prop-id-trailing-comma.js (strict mode) + Classes may not have private methods. at (69, 2) to (76, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-prop-id-trailing-comma.js (default) + Classes may not have private methods. at (69, 2) to (76, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-prop-id.js (strict mode) + Classes may not have private methods. at (69, 2) to (75, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-prop-id.js (default) + Classes may not have private methods. at (69, 2) to (75, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-prop-obj-init.js (strict mode) + Classes may not have private methods. at (72, 2) to (81, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-prop-obj-init.js (default) + Classes may not have private methods. at (72, 2) to (81, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-prop-obj.js (strict mode) + Classes may not have private methods. at (70, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-prop-obj.js (default) + Classes may not have private methods. at (70, 2) to (79, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-rest-getter.js (strict mode) + Classes may not have private methods. at (64, 2) to (74, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-rest-getter.js (default) + Classes may not have private methods. at (64, 2) to (74, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-rest-skip-non-enumerable.js (strict mode) + Classes may not have private methods. at (65, 2) to (82, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-rest-skip-non-enumerable.js (default) + Classes may not have private methods. at (65, 2) to (82, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-rest-val-obj.js (strict mode) + Classes may not have private methods. at (63, 2) to (81, 3) +language/statements/class/dstr/private-meth-static-obj-ptrn-rest-val-obj.js (default) + Classes may not have private methods. at (63, 2) to (81, 3) +language/statements/class/elements/after-same-line-gen-private-method-usage.js (strict mode) + Classes may not have private methods. at (26, 22) to (26, 48) +language/statements/class/elements/after-same-line-gen-private-method-usage.js (default) + Classes may not have private methods. at (26, 22) to (26, 48) +language/statements/class/elements/after-same-line-gen-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/after-same-line-gen-rs-private-method-alt.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/after-same-line-gen-rs-private-method.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/after-same-line-gen-rs-private-method.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/after-same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 22) to (65, 3) +language/statements/class/elements/after-same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 22) to (65, 3) +language/statements/class/elements/after-same-line-gen-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 22) to (65, 3) +language/statements/class/elements/after-same-line-gen-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 22) to (65, 3) +language/statements/class/elements/after-same-line-gen-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 22) to (65, 3) +language/statements/class/elements/after-same-line-gen-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 22) to (65, 3) +language/statements/class/elements/after-same-line-gen-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 22) to (65, 3) +language/statements/class/elements/after-same-line-gen-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 22) to (65, 3) +language/statements/class/elements/after-same-line-gen-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 22) to (65, 3) +language/statements/class/elements/after-same-line-gen-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 22) to (65, 3) +language/statements/class/elements/after-same-line-gen-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 22) to (65, 3) +language/statements/class/elements/after-same-line-gen-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 22) to (65, 3) +language/statements/class/elements/after-same-line-gen-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (60, 22) to (62, 3) +language/statements/class/elements/after-same-line-gen-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (60, 22) to (62, 3) +language/statements/class/elements/after-same-line-gen-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (60, 22) to (62, 3) +language/statements/class/elements/after-same-line-gen-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (60, 22) to (62, 3) +language/statements/class/elements/after-same-line-gen-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (29, 2) to (32, 3) +language/statements/class/elements/after-same-line-gen-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (29, 2) to (32, 3) +language/statements/class/elements/after-same-line-gen-static-private-methods.js (strict mode) + Classes may not have private methods. at (29, 2) to (31, 3) +language/statements/class/elements/after-same-line-gen-static-private-methods.js (default) + Classes may not have private methods. at (29, 2) to (31, 3) +language/statements/class/elements/after-same-line-method-private-method-usage.js (strict mode) + Classes may not have private methods. at (26, 21) to (26, 47) +language/statements/class/elements/after-same-line-method-private-method-usage.js (default) + Classes may not have private methods. at (26, 21) to (26, 47) +language/statements/class/elements/after-same-line-method-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/after-same-line-method-rs-private-method-alt.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/after-same-line-method-rs-private-method.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/after-same-line-method-rs-private-method.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/after-same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 21) to (65, 3) +language/statements/class/elements/after-same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 21) to (65, 3) +language/statements/class/elements/after-same-line-method-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 21) to (65, 3) +language/statements/class/elements/after-same-line-method-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 21) to (65, 3) +language/statements/class/elements/after-same-line-method-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 21) to (65, 3) +language/statements/class/elements/after-same-line-method-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 21) to (65, 3) +language/statements/class/elements/after-same-line-method-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 21) to (65, 3) +language/statements/class/elements/after-same-line-method-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 21) to (65, 3) +language/statements/class/elements/after-same-line-method-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 21) to (65, 3) +language/statements/class/elements/after-same-line-method-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 21) to (65, 3) +language/statements/class/elements/after-same-line-method-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 21) to (65, 3) +language/statements/class/elements/after-same-line-method-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 21) to (65, 3) +language/statements/class/elements/after-same-line-method-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (60, 21) to (62, 3) +language/statements/class/elements/after-same-line-method-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (60, 21) to (62, 3) +language/statements/class/elements/after-same-line-method-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (60, 21) to (62, 3) +language/statements/class/elements/after-same-line-method-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (60, 21) to (62, 3) +language/statements/class/elements/after-same-line-method-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (29, 2) to (32, 3) +language/statements/class/elements/after-same-line-method-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (29, 2) to (32, 3) +language/statements/class/elements/after-same-line-method-static-private-methods.js (strict mode) + Classes may not have private methods. at (29, 2) to (31, 3) +language/statements/class/elements/after-same-line-method-static-private-methods.js (default) + Classes may not have private methods. at (29, 2) to (31, 3) +language/statements/class/elements/after-same-line-static-async-gen-private-method-usage.js (strict mode) + Classes may not have private methods. at (26, 35) to (26, 61) +language/statements/class/elements/after-same-line-static-async-gen-private-method-usage.js (default) + Classes may not have private methods. at (26, 35) to (26, 61) +language/statements/class/elements/after-same-line-static-async-gen-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/after-same-line-static-async-gen-rs-private-method-alt.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/after-same-line-static-async-gen-rs-private-method.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/after-same-line-static-async-gen-rs-private-method.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 35) to (65, 3) +language/statements/class/elements/after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 35) to (65, 3) +language/statements/class/elements/after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 35) to (65, 3) +language/statements/class/elements/after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 35) to (65, 3) +language/statements/class/elements/after-same-line-static-async-gen-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 35) to (65, 3) +language/statements/class/elements/after-same-line-static-async-gen-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 35) to (65, 3) +language/statements/class/elements/after-same-line-static-async-gen-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 35) to (65, 3) +language/statements/class/elements/after-same-line-static-async-gen-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 35) to (65, 3) +language/statements/class/elements/after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 35) to (65, 3) +language/statements/class/elements/after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 35) to (65, 3) +language/statements/class/elements/after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 35) to (65, 3) +language/statements/class/elements/after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 35) to (65, 3) +language/statements/class/elements/after-same-line-static-async-gen-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (60, 35) to (62, 3) +language/statements/class/elements/after-same-line-static-async-gen-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (60, 35) to (62, 3) +language/statements/class/elements/after-same-line-static-async-gen-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (60, 35) to (62, 3) +language/statements/class/elements/after-same-line-static-async-gen-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (60, 35) to (62, 3) +language/statements/class/elements/after-same-line-static-async-gen-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (29, 2) to (32, 3) +language/statements/class/elements/after-same-line-static-async-gen-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (29, 2) to (32, 3) +language/statements/class/elements/after-same-line-static-async-gen-static-private-methods.js (strict mode) + Classes may not have private methods. at (29, 2) to (31, 3) +language/statements/class/elements/after-same-line-static-async-gen-static-private-methods.js (default) + Classes may not have private methods. at (29, 2) to (31, 3) +language/statements/class/elements/after-same-line-static-async-method-private-method-usage.js (strict mode) + Classes may not have private methods. at (26, 34) to (26, 60) +language/statements/class/elements/after-same-line-static-async-method-private-method-usage.js (default) + Classes may not have private methods. at (26, 34) to (26, 60) +language/statements/class/elements/after-same-line-static-async-method-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/after-same-line-static-async-method-rs-private-method-alt.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/after-same-line-static-async-method-rs-private-method.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/after-same-line-static-async-method-rs-private-method.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 34) to (65, 3) +language/statements/class/elements/after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 34) to (65, 3) +language/statements/class/elements/after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 34) to (65, 3) +language/statements/class/elements/after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 34) to (65, 3) +language/statements/class/elements/after-same-line-static-async-method-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 34) to (65, 3) +language/statements/class/elements/after-same-line-static-async-method-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 34) to (65, 3) +language/statements/class/elements/after-same-line-static-async-method-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 34) to (65, 3) +language/statements/class/elements/after-same-line-static-async-method-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 34) to (65, 3) +language/statements/class/elements/after-same-line-static-async-method-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 34) to (65, 3) +language/statements/class/elements/after-same-line-static-async-method-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 34) to (65, 3) +language/statements/class/elements/after-same-line-static-async-method-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 34) to (65, 3) +language/statements/class/elements/after-same-line-static-async-method-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 34) to (65, 3) +language/statements/class/elements/after-same-line-static-async-method-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (60, 34) to (62, 3) +language/statements/class/elements/after-same-line-static-async-method-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (60, 34) to (62, 3) +language/statements/class/elements/after-same-line-static-async-method-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (60, 34) to (62, 3) +language/statements/class/elements/after-same-line-static-async-method-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (60, 34) to (62, 3) +language/statements/class/elements/after-same-line-static-async-method-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (29, 2) to (32, 3) +language/statements/class/elements/after-same-line-static-async-method-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (29, 2) to (32, 3) +language/statements/class/elements/after-same-line-static-async-method-static-private-methods.js (strict mode) + Classes may not have private methods. at (29, 2) to (31, 3) +language/statements/class/elements/after-same-line-static-async-method-static-private-methods.js (default) + Classes may not have private methods. at (29, 2) to (31, 3) +language/statements/class/elements/after-same-line-static-gen-private-method-usage.js (strict mode) + Classes may not have private methods. at (26, 29) to (26, 55) +language/statements/class/elements/after-same-line-static-gen-private-method-usage.js (default) + Classes may not have private methods. at (26, 29) to (26, 55) +language/statements/class/elements/after-same-line-static-gen-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/after-same-line-static-gen-rs-private-method-alt.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/after-same-line-static-gen-rs-private-method.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/after-same-line-static-gen-rs-private-method.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 29) to (65, 3) +language/statements/class/elements/after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 29) to (65, 3) +language/statements/class/elements/after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 29) to (65, 3) +language/statements/class/elements/after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 29) to (65, 3) +language/statements/class/elements/after-same-line-static-gen-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 29) to (65, 3) +language/statements/class/elements/after-same-line-static-gen-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 29) to (65, 3) +language/statements/class/elements/after-same-line-static-gen-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 29) to (65, 3) +language/statements/class/elements/after-same-line-static-gen-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 29) to (65, 3) +language/statements/class/elements/after-same-line-static-gen-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 29) to (65, 3) +language/statements/class/elements/after-same-line-static-gen-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 29) to (65, 3) +language/statements/class/elements/after-same-line-static-gen-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 29) to (65, 3) +language/statements/class/elements/after-same-line-static-gen-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 29) to (65, 3) +language/statements/class/elements/after-same-line-static-gen-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (60, 29) to (62, 3) +language/statements/class/elements/after-same-line-static-gen-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (60, 29) to (62, 3) +language/statements/class/elements/after-same-line-static-gen-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (60, 29) to (62, 3) +language/statements/class/elements/after-same-line-static-gen-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (60, 29) to (62, 3) +language/statements/class/elements/after-same-line-static-gen-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (29, 2) to (32, 3) +language/statements/class/elements/after-same-line-static-gen-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (29, 2) to (32, 3) +language/statements/class/elements/after-same-line-static-gen-static-private-methods.js (strict mode) + Classes may not have private methods. at (29, 2) to (31, 3) +language/statements/class/elements/after-same-line-static-gen-static-private-methods.js (default) + Classes may not have private methods. at (29, 2) to (31, 3) +language/statements/class/elements/after-same-line-static-method-private-method-usage.js (strict mode) + Classes may not have private methods. at (26, 28) to (26, 54) +language/statements/class/elements/after-same-line-static-method-private-method-usage.js (default) + Classes may not have private methods. at (26, 28) to (26, 54) +language/statements/class/elements/after-same-line-static-method-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/after-same-line-static-method-rs-private-method-alt.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/after-same-line-static-method-rs-private-method.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/after-same-line-static-method-rs-private-method.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/after-same-line-static-method-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 28) to (65, 3) +language/statements/class/elements/after-same-line-static-method-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 28) to (65, 3) +language/statements/class/elements/after-same-line-static-method-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 28) to (65, 3) +language/statements/class/elements/after-same-line-static-method-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 28) to (65, 3) +language/statements/class/elements/after-same-line-static-method-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 28) to (65, 3) +language/statements/class/elements/after-same-line-static-method-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 28) to (65, 3) +language/statements/class/elements/after-same-line-static-method-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 28) to (65, 3) +language/statements/class/elements/after-same-line-static-method-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 28) to (65, 3) +language/statements/class/elements/after-same-line-static-method-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 28) to (65, 3) +language/statements/class/elements/after-same-line-static-method-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 28) to (65, 3) +language/statements/class/elements/after-same-line-static-method-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 28) to (65, 3) +language/statements/class/elements/after-same-line-static-method-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 28) to (65, 3) +language/statements/class/elements/after-same-line-static-method-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (60, 28) to (62, 3) +language/statements/class/elements/after-same-line-static-method-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (60, 28) to (62, 3) +language/statements/class/elements/after-same-line-static-method-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (60, 28) to (62, 3) +language/statements/class/elements/after-same-line-static-method-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (60, 28) to (62, 3) +language/statements/class/elements/after-same-line-static-method-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (29, 2) to (32, 3) +language/statements/class/elements/after-same-line-static-method-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (29, 2) to (32, 3) +language/statements/class/elements/after-same-line-static-method-static-private-methods.js (strict mode) + Classes may not have private methods. at (29, 2) to (31, 3) +language/statements/class/elements/after-same-line-static-method-static-private-methods.js (default) + Classes may not have private methods. at (29, 2) to (31, 3) +language/statements/class/elements/arrow-fnc-init-err-contains-arguments.js (strict mode) + Missing parse error +language/statements/class/elements/arrow-fnc-init-err-contains-arguments.js (default) + Missing parse error +language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-catch.js (strict mode) + Classes may not have private methods. at (28, 4) to (32, 5) +language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-catch.js (default) + Classes may not have private methods. at (28, 4) to (32, 5) +language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-for-await-of-async-iterator.js (strict mode) + Classes may not have private methods. at (32, 4) to (37, 5) +language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-for-await-of-async-iterator.js (default) + Classes may not have private methods. at (32, 4) to (37, 5) +language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-for-await-of-sync-iterator.js (strict mode) + Classes may not have private methods. at (32, 4) to (37, 5) +language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-for-await-of-sync-iterator.js (default) + Classes may not have private methods. at (32, 4) to (37, 5) +language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-yield-star-async-iterator.js (strict mode) + Classes may not have private methods. at (32, 4) to (36, 5) +language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-yield-star-async-iterator.js (default) + Classes may not have private methods. at (32, 4) to (36, 5) +language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-yield-star-sync-iterator.js (strict mode) + Classes may not have private methods. at (32, 4) to (35, 5) +language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-yield-star-sync-iterator.js (default) + Classes may not have private methods. at (32, 4) to (35, 5) +language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next.js (strict mode) + Classes may not have private methods. at (28, 4) to (32, 5) +language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next.js (default) + Classes may not have private methods. at (28, 4) to (32, 5) +language/statements/class/elements/async-gen-private-method-static/yield-spread-arr-multiple.js (strict mode) + Classes may not have private methods. at (36, 4) to (39, 5) +language/statements/class/elements/async-gen-private-method-static/yield-spread-arr-multiple.js (default) + Classes may not have private methods. at (36, 4) to (39, 5) +language/statements/class/elements/async-gen-private-method-static/yield-spread-arr-single.js (strict mode) + Classes may not have private methods. at (34, 4) to (37, 5) +language/statements/class/elements/async-gen-private-method-static/yield-spread-arr-single.js (default) + Classes may not have private methods. at (34, 4) to (37, 5) +language/statements/class/elements/async-gen-private-method-static/yield-spread-obj.js (strict mode) + Classes may not have private methods. at (35, 4) to (42, 5) +language/statements/class/elements/async-gen-private-method-static/yield-spread-obj.js (default) + Classes may not have private methods. at (35, 4) to (42, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-async-next.js (strict mode) + Classes may not have private methods. at (139, 4) to (149, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-async-next.js (default) + Classes may not have private methods. at (139, 4) to (149, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-async-return.js (strict mode) + Classes may not have private methods. at (158, 4) to (163, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-async-return.js (default) + Classes may not have private methods. at (158, 4) to (163, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-async-throw.js (strict mode) + Classes may not have private methods. at (158, 4) to (168, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-async-throw.js (default) + Classes may not have private methods. at (158, 4) to (168, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-expr-abrupt.js (strict mode) + Classes may not have private methods. at (39, 4) to (44, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-expr-abrupt.js (default) + Classes may not have private methods. at (39, 4) to (44, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-get-abrupt.js (strict mode) + Classes may not have private methods. at (59, 4) to (64, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-get-abrupt.js (default) + Classes may not have private methods. at (59, 4) to (64, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-boolean-throw.js (strict mode) + Classes may not have private methods. at (58, 4) to (63, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-boolean-throw.js (default) + Classes may not have private methods. at (58, 4) to (63, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-number-throw.js (strict mode) + Classes may not have private methods. at (58, 4) to (63, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-number-throw.js (default) + Classes may not have private methods. at (58, 4) to (63, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-object-throw.js (strict mode) + Classes may not have private methods. at (58, 4) to (63, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-object-throw.js (default) + Classes may not have private methods. at (58, 4) to (63, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-string-throw.js (strict mode) + Classes may not have private methods. at (58, 4) to (63, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-string-throw.js (default) + Classes may not have private methods. at (58, 4) to (63, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-symbol-throw.js (strict mode) + Classes may not have private methods. at (58, 4) to (63, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-symbol-throw.js (default) + Classes may not have private methods. at (58, 4) to (63, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-null-sync-get-abrupt.js (strict mode) + Classes may not have private methods. at (63, 4) to (68, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-null-sync-get-abrupt.js (default) + Classes may not have private methods. at (63, 4) to (68, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-abrupt.js (strict mode) + Classes may not have private methods. at (55, 4) to (60, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-abrupt.js (default) + Classes may not have private methods. at (55, 4) to (60, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-boolean-throw.js (strict mode) + Classes may not have private methods. at (55, 4) to (60, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-boolean-throw.js (default) + Classes may not have private methods. at (55, 4) to (60, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-null-throw.js (strict mode) + Classes may not have private methods. at (55, 4) to (60, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-null-throw.js (default) + Classes may not have private methods. at (55, 4) to (60, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-number-throw.js (strict mode) + Classes may not have private methods. at (55, 4) to (60, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-number-throw.js (default) + Classes may not have private methods. at (55, 4) to (60, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-string-throw.js (strict mode) + Classes may not have private methods. at (55, 4) to (60, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-string-throw.js (default) + Classes may not have private methods. at (55, 4) to (60, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-symbol-throw.js (strict mode) + Classes may not have private methods. at (55, 4) to (60, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-symbol-throw.js (default) + Classes may not have private methods. at (55, 4) to (60, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-undefined-throw.js (strict mode) + Classes may not have private methods. at (55, 4) to (60, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-undefined-throw.js (default) + Classes may not have private methods. at (55, 4) to (60, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-undefined-sync-get-abrupt.js (strict mode) + Classes may not have private methods. at (63, 4) to (68, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-undefined-sync-get-abrupt.js (default) + Classes may not have private methods. at (63, 4) to (68, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-get-abrupt.js (strict mode) + Classes may not have private methods. at (58, 4) to (63, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-get-abrupt.js (default) + Classes may not have private methods. at (58, 4) to (63, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-boolean-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-boolean-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-number-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-number-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-object-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-object-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-string-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-string-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-symbol-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-symbol-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-abrupt.js (strict mode) + Classes may not have private methods. at (52, 4) to (57, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-abrupt.js (default) + Classes may not have private methods. at (52, 4) to (57, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-boolean-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-boolean-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-null-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-null-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-number-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-number-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-string-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-string-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-symbol-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-symbol-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-undefined-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-undefined-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-call-done-get-abrupt.js (strict mode) + Classes may not have private methods. at (58, 4) to (63, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-call-done-get-abrupt.js (default) + Classes may not have private methods. at (58, 4) to (63, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-call-returns-abrupt.js (strict mode) + Classes may not have private methods. at (50, 4) to (55, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-call-returns-abrupt.js (default) + Classes may not have private methods. at (50, 4) to (55, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-call-value-get-abrupt.js (strict mode) + Classes may not have private methods. at (60, 4) to (65, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-call-value-get-abrupt.js (default) + Classes may not have private methods. at (60, 4) to (65, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-get-abrupt.js (strict mode) + Classes may not have private methods. at (50, 4) to (55, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-get-abrupt.js (default) + Classes may not have private methods. at (50, 4) to (55, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-non-object-ignores-then.js (strict mode) + Classes may not have private methods. at (70, 4) to (75, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-non-object-ignores-then.js (default) + Classes may not have private methods. at (70, 4) to (75, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-boolean-throw.js (strict mode) + Classes may not have private methods. at (47, 4) to (52, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-boolean-throw.js (default) + Classes may not have private methods. at (47, 4) to (52, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-null-throw.js (strict mode) + Classes may not have private methods. at (47, 4) to (52, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-null-throw.js (default) + Classes may not have private methods. at (47, 4) to (52, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-number-throw.js (strict mode) + Classes may not have private methods. at (47, 4) to (52, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-number-throw.js (default) + Classes may not have private methods. at (47, 4) to (52, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-object-throw.js (strict mode) + Classes may not have private methods. at (47, 4) to (52, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-object-throw.js (default) + Classes may not have private methods. at (47, 4) to (52, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-string-throw.js (strict mode) + Classes may not have private methods. at (47, 4) to (52, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-string-throw.js (default) + Classes may not have private methods. at (47, 4) to (52, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-symbol-throw.js (strict mode) + Classes may not have private methods. at (47, 4) to (52, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-symbol-throw.js (default) + Classes may not have private methods. at (47, 4) to (52, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-undefined-throw.js (strict mode) + Classes may not have private methods. at (47, 4) to (52, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-undefined-throw.js (default) + Classes may not have private methods. at (47, 4) to (52, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-get-abrupt.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-get-abrupt.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-boolean-fulfillpromise.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-boolean-fulfillpromise.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-null-fulfillpromise.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-null-fulfillpromise.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-number-fulfillpromise.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-number-fulfillpromise.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-object-fulfillpromise.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-object-fulfillpromise.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-string-fulfillpromise.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-string-fulfillpromise.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-symbol-fulfillpromise.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-symbol-fulfillpromise.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-undefined-fulfillpromise.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-undefined-fulfillpromise.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-returns-abrupt.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-returns-abrupt.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-sync-next.js (strict mode) + Classes may not have private methods. at (158, 4) to (168, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-sync-next.js (default) + Classes may not have private methods. at (158, 4) to (168, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-sync-return.js (strict mode) + Classes may not have private methods. at (138, 4) to (143, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-sync-return.js (default) + Classes may not have private methods. at (138, 4) to (143, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-sync-throw.js (strict mode) + Classes may not have private methods. at (136, 4) to (146, 5) +language/statements/class/elements/async-gen-private-method-static/yield-star-sync-throw.js (default) + Classes may not have private methods. at (136, 4) to (146, 5) +language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-catch.js (strict mode) + Classes may not have private methods. at (28, 4) to (32, 5) +language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-catch.js (default) + Classes may not have private methods. at (28, 4) to (32, 5) +language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-for-await-of-async-iterator.js (strict mode) + Classes may not have private methods. at (32, 4) to (37, 5) +language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-for-await-of-async-iterator.js (default) + Classes may not have private methods. at (32, 4) to (37, 5) +language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-for-await-of-sync-iterator.js (strict mode) + Classes may not have private methods. at (32, 4) to (37, 5) +language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-for-await-of-sync-iterator.js (default) + Classes may not have private methods. at (32, 4) to (37, 5) +language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-yield-star-async-iterator.js (strict mode) + Classes may not have private methods. at (32, 4) to (36, 5) +language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-yield-star-async-iterator.js (default) + Classes may not have private methods. at (32, 4) to (36, 5) +language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-yield-star-sync-iterator.js (strict mode) + Classes may not have private methods. at (32, 4) to (35, 5) +language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-yield-star-sync-iterator.js (default) + Classes may not have private methods. at (32, 4) to (35, 5) +language/statements/class/elements/async-gen-private-method/yield-promise-reject-next.js (strict mode) + Classes may not have private methods. at (28, 4) to (32, 5) +language/statements/class/elements/async-gen-private-method/yield-promise-reject-next.js (default) + Classes may not have private methods. at (28, 4) to (32, 5) +language/statements/class/elements/async-gen-private-method/yield-spread-arr-multiple.js (strict mode) + Classes may not have private methods. at (36, 4) to (39, 5) +language/statements/class/elements/async-gen-private-method/yield-spread-arr-multiple.js (default) + Classes may not have private methods. at (36, 4) to (39, 5) +language/statements/class/elements/async-gen-private-method/yield-spread-arr-single.js (strict mode) + Classes may not have private methods. at (34, 4) to (37, 5) +language/statements/class/elements/async-gen-private-method/yield-spread-arr-single.js (default) + Classes may not have private methods. at (34, 4) to (37, 5) +language/statements/class/elements/async-gen-private-method/yield-spread-obj.js (strict mode) + Classes may not have private methods. at (35, 4) to (42, 5) +language/statements/class/elements/async-gen-private-method/yield-spread-obj.js (default) + Classes may not have private methods. at (35, 4) to (42, 5) +language/statements/class/elements/async-gen-private-method/yield-star-async-next.js (strict mode) + Classes may not have private methods. at (139, 4) to (149, 5) +language/statements/class/elements/async-gen-private-method/yield-star-async-next.js (default) + Classes may not have private methods. at (139, 4) to (149, 5) +language/statements/class/elements/async-gen-private-method/yield-star-async-return.js (strict mode) + Classes may not have private methods. at (158, 4) to (163, 5) +language/statements/class/elements/async-gen-private-method/yield-star-async-return.js (default) + Classes may not have private methods. at (158, 4) to (163, 5) +language/statements/class/elements/async-gen-private-method/yield-star-async-throw.js (strict mode) + Classes may not have private methods. at (158, 4) to (168, 5) +language/statements/class/elements/async-gen-private-method/yield-star-async-throw.js (default) + Classes may not have private methods. at (158, 4) to (168, 5) +language/statements/class/elements/async-gen-private-method/yield-star-expr-abrupt.js (strict mode) + Classes may not have private methods. at (39, 4) to (44, 5) +language/statements/class/elements/async-gen-private-method/yield-star-expr-abrupt.js (default) + Classes may not have private methods. at (39, 4) to (44, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-get-abrupt.js (strict mode) + Classes may not have private methods. at (59, 4) to (64, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-get-abrupt.js (default) + Classes may not have private methods. at (59, 4) to (64, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-boolean-throw.js (strict mode) + Classes may not have private methods. at (58, 4) to (63, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-boolean-throw.js (default) + Classes may not have private methods. at (58, 4) to (63, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-number-throw.js (strict mode) + Classes may not have private methods. at (58, 4) to (63, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-number-throw.js (default) + Classes may not have private methods. at (58, 4) to (63, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-object-throw.js (strict mode) + Classes may not have private methods. at (58, 4) to (63, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-object-throw.js (default) + Classes may not have private methods. at (58, 4) to (63, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-string-throw.js (strict mode) + Classes may not have private methods. at (58, 4) to (63, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-string-throw.js (default) + Classes may not have private methods. at (58, 4) to (63, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-symbol-throw.js (strict mode) + Classes may not have private methods. at (58, 4) to (63, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-symbol-throw.js (default) + Classes may not have private methods. at (58, 4) to (63, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-null-sync-get-abrupt.js (strict mode) + Classes may not have private methods. at (63, 4) to (68, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-null-sync-get-abrupt.js (default) + Classes may not have private methods. at (63, 4) to (68, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-abrupt.js (strict mode) + Classes may not have private methods. at (55, 4) to (60, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-abrupt.js (default) + Classes may not have private methods. at (55, 4) to (60, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-boolean-throw.js (strict mode) + Classes may not have private methods. at (55, 4) to (60, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-boolean-throw.js (default) + Classes may not have private methods. at (55, 4) to (60, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-null-throw.js (strict mode) + Classes may not have private methods. at (55, 4) to (60, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-null-throw.js (default) + Classes may not have private methods. at (55, 4) to (60, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-number-throw.js (strict mode) + Classes may not have private methods. at (55, 4) to (60, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-number-throw.js (default) + Classes may not have private methods. at (55, 4) to (60, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-string-throw.js (strict mode) + Classes may not have private methods. at (55, 4) to (60, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-string-throw.js (default) + Classes may not have private methods. at (55, 4) to (60, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-symbol-throw.js (strict mode) + Classes may not have private methods. at (55, 4) to (60, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-symbol-throw.js (default) + Classes may not have private methods. at (55, 4) to (60, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-undefined-throw.js (strict mode) + Classes may not have private methods. at (55, 4) to (60, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-undefined-throw.js (default) + Classes may not have private methods. at (55, 4) to (60, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-undefined-sync-get-abrupt.js (strict mode) + Classes may not have private methods. at (63, 4) to (68, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-undefined-sync-get-abrupt.js (default) + Classes may not have private methods. at (63, 4) to (68, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-get-abrupt.js (strict mode) + Classes may not have private methods. at (58, 4) to (63, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-get-abrupt.js (default) + Classes may not have private methods. at (58, 4) to (63, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-boolean-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-boolean-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-number-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-number-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-object-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-object-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-string-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-string-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-symbol-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-symbol-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-abrupt.js (strict mode) + Classes may not have private methods. at (52, 4) to (57, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-abrupt.js (default) + Classes may not have private methods. at (52, 4) to (57, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-boolean-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-boolean-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-null-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-null-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-number-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-number-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-string-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-string-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-symbol-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-symbol-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-undefined-throw.js (strict mode) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-undefined-throw.js (default) + Classes may not have private methods. at (57, 4) to (62, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-call-done-get-abrupt.js (strict mode) + Classes may not have private methods. at (58, 4) to (63, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-call-done-get-abrupt.js (default) + Classes may not have private methods. at (58, 4) to (63, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-call-returns-abrupt.js (strict mode) + Classes may not have private methods. at (50, 4) to (55, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-call-returns-abrupt.js (default) + Classes may not have private methods. at (50, 4) to (55, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-call-value-get-abrupt.js (strict mode) + Classes may not have private methods. at (60, 4) to (65, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-call-value-get-abrupt.js (default) + Classes may not have private methods. at (60, 4) to (65, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-get-abrupt.js (strict mode) + Classes may not have private methods. at (50, 4) to (55, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-get-abrupt.js (default) + Classes may not have private methods. at (50, 4) to (55, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-non-object-ignores-then.js (strict mode) + Classes may not have private methods. at (70, 4) to (75, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-non-object-ignores-then.js (default) + Classes may not have private methods. at (70, 4) to (75, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-boolean-throw.js (strict mode) + Classes may not have private methods. at (47, 4) to (52, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-boolean-throw.js (default) + Classes may not have private methods. at (47, 4) to (52, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-null-throw.js (strict mode) + Classes may not have private methods. at (47, 4) to (52, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-null-throw.js (default) + Classes may not have private methods. at (47, 4) to (52, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-number-throw.js (strict mode) + Classes may not have private methods. at (47, 4) to (52, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-number-throw.js (default) + Classes may not have private methods. at (47, 4) to (52, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-object-throw.js (strict mode) + Classes may not have private methods. at (47, 4) to (52, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-object-throw.js (default) + Classes may not have private methods. at (47, 4) to (52, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-string-throw.js (strict mode) + Classes may not have private methods. at (47, 4) to (52, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-string-throw.js (default) + Classes may not have private methods. at (47, 4) to (52, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-symbol-throw.js (strict mode) + Classes may not have private methods. at (47, 4) to (52, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-symbol-throw.js (default) + Classes may not have private methods. at (47, 4) to (52, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-undefined-throw.js (strict mode) + Classes may not have private methods. at (47, 4) to (52, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-undefined-throw.js (default) + Classes may not have private methods. at (47, 4) to (52, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-then-get-abrupt.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-then-get-abrupt.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-boolean-fulfillpromise.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-boolean-fulfillpromise.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-null-fulfillpromise.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-null-fulfillpromise.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-number-fulfillpromise.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-number-fulfillpromise.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-object-fulfillpromise.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-object-fulfillpromise.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-string-fulfillpromise.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-string-fulfillpromise.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-symbol-fulfillpromise.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-symbol-fulfillpromise.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-undefined-fulfillpromise.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-undefined-fulfillpromise.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-then-returns-abrupt.js (strict mode) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method/yield-star-next-then-returns-abrupt.js (default) + Classes may not have private methods. at (74, 4) to (79, 5) +language/statements/class/elements/async-gen-private-method/yield-star-sync-next.js (strict mode) + Classes may not have private methods. at (158, 4) to (168, 5) +language/statements/class/elements/async-gen-private-method/yield-star-sync-next.js (default) + Classes may not have private methods. at (158, 4) to (168, 5) +language/statements/class/elements/async-gen-private-method/yield-star-sync-return.js (strict mode) + Classes may not have private methods. at (138, 4) to (143, 5) +language/statements/class/elements/async-gen-private-method/yield-star-sync-return.js (default) + Classes may not have private methods. at (138, 4) to (143, 5) +language/statements/class/elements/async-gen-private-method/yield-star-sync-throw.js (strict mode) + Classes may not have private methods. at (136, 4) to (146, 5) +language/statements/class/elements/async-gen-private-method/yield-star-sync-throw.js (default) + Classes may not have private methods. at (136, 4) to (146, 5) +language/statements/class/elements/comp-name-init-err-contains-arguments.js (strict mode) + Missing parse error +language/statements/class/elements/comp-name-init-err-contains-arguments.js (default) + Missing parse error +language/statements/class/elements/equality-init-err-contains-arguments.js (strict mode) + Missing parse error +language/statements/class/elements/equality-init-err-contains-arguments.js (default) + Missing parse error +language/statements/class/elements/fields-asi-same-line-2.js (strict mode) + Missing parse error +language/statements/class/elements/fields-asi-same-line-2.js (default) + Missing parse error +language/statements/class/elements/gen-private-method-static/yield-spread-arr-multiple.js (strict mode) + Classes may not have private methods. at (35, 4) to (38, 5) +language/statements/class/elements/gen-private-method-static/yield-spread-arr-multiple.js (default) + Classes may not have private methods. at (35, 4) to (38, 5) +language/statements/class/elements/gen-private-method-static/yield-spread-arr-single.js (strict mode) + Classes may not have private methods. at (32, 4) to (35, 5) +language/statements/class/elements/gen-private-method-static/yield-spread-arr-single.js (default) + Classes may not have private methods. at (32, 4) to (35, 5) +language/statements/class/elements/gen-private-method-static/yield-spread-obj.js (strict mode) + Classes may not have private methods. at (34, 4) to (41, 5) +language/statements/class/elements/gen-private-method-static/yield-spread-obj.js (default) + Classes may not have private methods. at (34, 4) to (41, 5) +language/statements/class/elements/gen-private-method/yield-spread-arr-multiple.js (strict mode) + Classes may not have private methods. at (35, 4) to (38, 5) +language/statements/class/elements/gen-private-method/yield-spread-arr-multiple.js (default) + Classes may not have private methods. at (35, 4) to (38, 5) +language/statements/class/elements/gen-private-method/yield-spread-arr-single.js (strict mode) + Classes may not have private methods. at (32, 4) to (35, 5) +language/statements/class/elements/gen-private-method/yield-spread-arr-single.js (default) + Classes may not have private methods. at (32, 4) to (35, 5) +language/statements/class/elements/gen-private-method/yield-spread-obj.js (strict mode) + Classes may not have private methods. at (34, 4) to (41, 5) +language/statements/class/elements/gen-private-method/yield-spread-obj.js (default) + Classes may not have private methods. at (34, 4) to (41, 5) +language/statements/class/elements/literal-name-init-err-contains-arguments.js (strict mode) + Missing parse error +language/statements/class/elements/literal-name-init-err-contains-arguments.js (default) + Missing parse error +language/statements/class/elements/multiple-definitions-private-method-usage.js (strict mode) + Classes may not have private methods. at (28, 2) to (28, 28) +language/statements/class/elements/multiple-definitions-private-method-usage.js (default) + Classes may not have private methods. at (28, 2) to (28, 28) +language/statements/class/elements/multiple-definitions-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (61, 2) to (63, 3) +language/statements/class/elements/multiple-definitions-rs-private-method-alt.js (default) + Classes may not have private methods. at (61, 2) to (63, 3) +language/statements/class/elements/multiple-definitions-rs-private-method.js (strict mode) + Classes may not have private methods. at (61, 2) to (63, 3) +language/statements/class/elements/multiple-definitions-rs-private-method.js (default) + Classes may not have private methods. at (61, 2) to (63, 3) +language/statements/class/elements/multiple-definitions-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (65, 2) to (67, 3) +language/statements/class/elements/multiple-definitions-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (65, 2) to (67, 3) +language/statements/class/elements/multiple-definitions-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (65, 2) to (67, 3) +language/statements/class/elements/multiple-definitions-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (65, 2) to (67, 3) +language/statements/class/elements/multiple-definitions-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (65, 2) to (67, 3) +language/statements/class/elements/multiple-definitions-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (65, 2) to (67, 3) +language/statements/class/elements/multiple-definitions-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (65, 2) to (67, 3) +language/statements/class/elements/multiple-definitions-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (65, 2) to (67, 3) +language/statements/class/elements/multiple-definitions-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (65, 2) to (67, 3) +language/statements/class/elements/multiple-definitions-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (65, 2) to (67, 3) +language/statements/class/elements/multiple-definitions-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (65, 2) to (67, 3) +language/statements/class/elements/multiple-definitions-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (65, 2) to (67, 3) +language/statements/class/elements/multiple-definitions-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (62, 2) to (64, 3) +language/statements/class/elements/multiple-definitions-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (62, 2) to (64, 3) +language/statements/class/elements/multiple-definitions-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (62, 2) to (64, 3) +language/statements/class/elements/multiple-definitions-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (62, 2) to (64, 3) +language/statements/class/elements/multiple-definitions-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (33, 2) to (36, 3) +language/statements/class/elements/multiple-definitions-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (33, 2) to (36, 3) +language/statements/class/elements/multiple-definitions-static-private-methods.js (strict mode) + Classes may not have private methods. at (33, 2) to (35, 3) +language/statements/class/elements/multiple-definitions-static-private-methods.js (default) + Classes may not have private methods. at (33, 2) to (35, 3) +language/statements/class/elements/multiple-stacked-definitions-private-method-usage.js (strict mode) + Classes may not have private methods. at (26, 2) to (26, 28) +language/statements/class/elements/multiple-stacked-definitions-private-method-usage.js (default) + Classes may not have private methods. at (26, 2) to (26, 28) +language/statements/class/elements/multiple-stacked-definitions-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/multiple-stacked-definitions-rs-private-method-alt.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/multiple-stacked-definitions-rs-private-method.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/multiple-stacked-definitions-rs-private-method.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/multiple-stacked-definitions-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/multiple-stacked-definitions-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/multiple-stacked-definitions-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/multiple-stacked-definitions-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/multiple-stacked-definitions-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/multiple-stacked-definitions-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/multiple-stacked-definitions-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/multiple-stacked-definitions-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/multiple-stacked-definitions-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (60, 2) to (62, 3) +language/statements/class/elements/multiple-stacked-definitions-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (60, 2) to (62, 3) +language/statements/class/elements/multiple-stacked-definitions-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (60, 2) to (62, 3) +language/statements/class/elements/multiple-stacked-definitions-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (60, 2) to (62, 3) +language/statements/class/elements/multiple-stacked-definitions-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (31, 2) to (34, 3) +language/statements/class/elements/multiple-stacked-definitions-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (31, 2) to (34, 3) +language/statements/class/elements/multiple-stacked-definitions-static-private-methods.js (strict mode) + Classes may not have private methods. at (31, 2) to (33, 3) +language/statements/class/elements/multiple-stacked-definitions-static-private-methods.js (default) + Classes may not have private methods. at (31, 2) to (33, 3) +language/statements/class/elements/new-no-sc-line-method-private-method-usage.js (strict mode) + Classes may not have private methods. at (26, 2) to (26, 28) +language/statements/class/elements/new-no-sc-line-method-private-method-usage.js (default) + Classes may not have private methods. at (26, 2) to (26, 28) +language/statements/class/elements/new-no-sc-line-method-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/new-no-sc-line-method-rs-private-method-alt.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/new-no-sc-line-method-rs-private-method.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/new-no-sc-line-method-rs-private-method.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-no-sc-line-method-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-no-sc-line-method-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-no-sc-line-method-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-no-sc-line-method-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-no-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-no-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-no-sc-line-method-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-no-sc-line-method-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-no-sc-line-method-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (60, 2) to (62, 3) +language/statements/class/elements/new-no-sc-line-method-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (60, 2) to (62, 3) +language/statements/class/elements/new-no-sc-line-method-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (60, 2) to (62, 3) +language/statements/class/elements/new-no-sc-line-method-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (60, 2) to (62, 3) +language/statements/class/elements/new-no-sc-line-method-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (30, 2) to (33, 3) +language/statements/class/elements/new-no-sc-line-method-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (30, 2) to (33, 3) +language/statements/class/elements/new-no-sc-line-method-static-private-methods.js (strict mode) + Classes may not have private methods. at (30, 2) to (32, 3) +language/statements/class/elements/new-no-sc-line-method-static-private-methods.js (default) + Classes may not have private methods. at (30, 2) to (32, 3) +language/statements/class/elements/new-sc-line-gen-private-method-usage.js (strict mode) + Classes may not have private methods. at (26, 2) to (26, 28) +language/statements/class/elements/new-sc-line-gen-private-method-usage.js (default) + Classes may not have private methods. at (26, 2) to (26, 28) +language/statements/class/elements/new-sc-line-gen-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/new-sc-line-gen-rs-private-method-alt.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/new-sc-line-gen-rs-private-method.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/new-sc-line-gen-rs-private-method.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/new-sc-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-sc-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-sc-line-gen-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-sc-line-gen-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-sc-line-gen-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-sc-line-gen-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-sc-line-gen-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-sc-line-gen-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-sc-line-gen-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-sc-line-gen-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-sc-line-gen-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-sc-line-gen-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-sc-line-gen-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (60, 2) to (62, 3) +language/statements/class/elements/new-sc-line-gen-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (60, 2) to (62, 3) +language/statements/class/elements/new-sc-line-gen-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (60, 2) to (62, 3) +language/statements/class/elements/new-sc-line-gen-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (60, 2) to (62, 3) +language/statements/class/elements/new-sc-line-gen-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (30, 2) to (33, 3) +language/statements/class/elements/new-sc-line-gen-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (30, 2) to (33, 3) +language/statements/class/elements/new-sc-line-gen-static-private-methods.js (strict mode) + Classes may not have private methods. at (30, 2) to (32, 3) +language/statements/class/elements/new-sc-line-gen-static-private-methods.js (default) + Classes may not have private methods. at (30, 2) to (32, 3) +language/statements/class/elements/new-sc-line-method-private-method-usage.js (strict mode) + Classes may not have private methods. at (26, 2) to (26, 28) +language/statements/class/elements/new-sc-line-method-private-method-usage.js (default) + Classes may not have private methods. at (26, 2) to (26, 28) +language/statements/class/elements/new-sc-line-method-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/new-sc-line-method-rs-private-method-alt.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/new-sc-line-method-rs-private-method.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/new-sc-line-method-rs-private-method.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/new-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-sc-line-method-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-sc-line-method-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-sc-line-method-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-sc-line-method-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-sc-line-method-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-sc-line-method-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-sc-line-method-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-sc-line-method-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/new-sc-line-method-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (60, 2) to (62, 3) +language/statements/class/elements/new-sc-line-method-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (60, 2) to (62, 3) +language/statements/class/elements/new-sc-line-method-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (60, 2) to (62, 3) +language/statements/class/elements/new-sc-line-method-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (60, 2) to (62, 3) +language/statements/class/elements/new-sc-line-method-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (30, 2) to (33, 3) +language/statements/class/elements/new-sc-line-method-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (30, 2) to (33, 3) +language/statements/class/elements/new-sc-line-method-static-private-methods.js (strict mode) + Classes may not have private methods. at (30, 2) to (32, 3) +language/statements/class/elements/new-sc-line-method-static-private-methods.js (default) + Classes may not have private methods. at (30, 2) to (32, 3) +language/statements/class/elements/private-arrow-fnc-init-err-contains-arguments.js (strict mode) + Missing parse error +language/statements/class/elements/private-arrow-fnc-init-err-contains-arguments.js (default) + Missing parse error +language/statements/class/elements/private-literal-name-init-err-contains-arguments.js (strict mode) + Missing parse error +language/statements/class/elements/private-literal-name-init-err-contains-arguments.js (default) + Missing parse error +language/statements/class/elements/private-method-brand-check-multiple-evaluations-of-class.js (strict mode) + Classes may not have private methods. at (24, 4) to (24, 30) +language/statements/class/elements/private-method-brand-check-multiple-evaluations-of-class.js (default) + Classes may not have private methods. at (24, 4) to (24, 30) +language/statements/class/elements/private-method-brand-check-super-class.js (strict mode) + Classes may not have private methods. at (26, 2) to (26, 37) +language/statements/class/elements/private-method-brand-check-super-class.js (default) + Classes may not have private methods. at (26, 2) to (26, 37) +language/statements/class/elements/private-method-brand-check.js (strict mode) + Classes may not have private methods. at (31, 2) to (31, 28) +language/statements/class/elements/private-method-brand-check.js (default) + Classes may not have private methods. at (31, 2) to (31, 28) +language/statements/class/elements/private-methods/prod-private-async-generator.js (strict mode) + Classes may not have private methods. at (88, 2) to (88, 29) +language/statements/class/elements/private-methods/prod-private-async-generator.js (default) + Classes may not have private methods. at (88, 2) to (88, 29) +language/statements/class/elements/private-methods/prod-private-async-method.js (strict mode) + Classes may not have private methods. at (88, 2) to (88, 27) +language/statements/class/elements/private-methods/prod-private-async-method.js (default) + Classes may not have private methods. at (88, 2) to (88, 27) +language/statements/class/elements/private-methods/prod-private-generator.js (strict mode) + Classes may not have private methods. at (86, 2) to (86, 23) +language/statements/class/elements/private-methods/prod-private-generator.js (default) + Classes may not have private methods. at (86, 2) to (86, 23) +language/statements/class/elements/private-methods/prod-private-method-initialize-order.js (strict mode) + Classes may not have private methods. at (103, 2) to (103, 21) +language/statements/class/elements/private-methods/prod-private-method-initialize-order.js (default) + Classes may not have private methods. at (103, 2) to (103, 21) +language/statements/class/elements/private-methods/prod-private-method.js (strict mode) + Classes may not have private methods. at (86, 2) to (86, 21) +language/statements/class/elements/private-methods/prod-private-method.js (default) + Classes may not have private methods. at (86, 2) to (86, 21) +language/statements/class/elements/private-ternary-init-err-contains-arguments.js (strict mode) + Missing parse error +language/statements/class/elements/private-ternary-init-err-contains-arguments.js (default) + Missing parse error +language/statements/class/elements/private-typeof-init-err-contains-arguments.js (strict mode) + Missing parse error +language/statements/class/elements/private-typeof-init-err-contains-arguments.js (default) + Missing parse error +language/statements/class/elements/privatemethods-on-proxy.js (strict mode) + Classes may not have private methods. at (42, 2) to (44, 3) +language/statements/class/elements/privatemethods-on-proxy.js (default) + Classes may not have private methods. at (42, 2) to (44, 3) +language/statements/class/elements/regular-definitions-private-method-usage.js (strict mode) + Classes may not have private methods. at (25, 2) to (25, 28) +language/statements/class/elements/regular-definitions-private-method-usage.js (default) + Classes may not have private methods. at (25, 2) to (25, 28) +language/statements/class/elements/regular-definitions-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (58, 2) to (60, 3) +language/statements/class/elements/regular-definitions-rs-private-method-alt.js (default) + Classes may not have private methods. at (58, 2) to (60, 3) +language/statements/class/elements/regular-definitions-rs-private-method.js (strict mode) + Classes may not have private methods. at (58, 2) to (60, 3) +language/statements/class/elements/regular-definitions-rs-private-method.js (default) + Classes may not have private methods. at (58, 2) to (60, 3) +language/statements/class/elements/regular-definitions-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (62, 2) to (64, 3) +language/statements/class/elements/regular-definitions-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (62, 2) to (64, 3) +language/statements/class/elements/regular-definitions-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (62, 2) to (64, 3) +language/statements/class/elements/regular-definitions-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (62, 2) to (64, 3) +language/statements/class/elements/regular-definitions-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (62, 2) to (64, 3) +language/statements/class/elements/regular-definitions-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (62, 2) to (64, 3) +language/statements/class/elements/regular-definitions-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (62, 2) to (64, 3) +language/statements/class/elements/regular-definitions-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (62, 2) to (64, 3) +language/statements/class/elements/regular-definitions-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (62, 2) to (64, 3) +language/statements/class/elements/regular-definitions-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (62, 2) to (64, 3) +language/statements/class/elements/regular-definitions-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (62, 2) to (64, 3) +language/statements/class/elements/regular-definitions-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (62, 2) to (64, 3) +language/statements/class/elements/regular-definitions-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/regular-definitions-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/regular-definitions-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/regular-definitions-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/regular-definitions-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (28, 2) to (31, 3) +language/statements/class/elements/regular-definitions-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (28, 2) to (31, 3) +language/statements/class/elements/regular-definitions-static-private-methods.js (strict mode) + Classes may not have private methods. at (28, 2) to (30, 3) +language/statements/class/elements/regular-definitions-static-private-methods.js (default) + Classes may not have private methods. at (28, 2) to (30, 3) +language/statements/class/elements/same-line-async-gen-private-method-usage.js (strict mode) + Classes may not have private methods. at (26, 28) to (26, 54) +language/statements/class/elements/same-line-async-gen-private-method-usage.js (default) + Classes may not have private methods. at (26, 28) to (26, 54) +language/statements/class/elements/same-line-async-gen-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/same-line-async-gen-rs-private-method-alt.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/same-line-async-gen-rs-private-method.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/same-line-async-gen-rs-private-method.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/same-line-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 28) to (65, 3) +language/statements/class/elements/same-line-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 28) to (65, 3) +language/statements/class/elements/same-line-async-gen-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 28) to (65, 3) +language/statements/class/elements/same-line-async-gen-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 28) to (65, 3) +language/statements/class/elements/same-line-async-gen-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 28) to (65, 3) +language/statements/class/elements/same-line-async-gen-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 28) to (65, 3) +language/statements/class/elements/same-line-async-gen-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 28) to (65, 3) +language/statements/class/elements/same-line-async-gen-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 28) to (65, 3) +language/statements/class/elements/same-line-async-gen-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 28) to (65, 3) +language/statements/class/elements/same-line-async-gen-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 28) to (65, 3) +language/statements/class/elements/same-line-async-gen-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 28) to (65, 3) +language/statements/class/elements/same-line-async-gen-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 28) to (65, 3) +language/statements/class/elements/same-line-async-gen-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (60, 28) to (62, 3) +language/statements/class/elements/same-line-async-gen-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (60, 28) to (62, 3) +language/statements/class/elements/same-line-async-gen-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (60, 28) to (62, 3) +language/statements/class/elements/same-line-async-gen-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (60, 28) to (62, 3) +language/statements/class/elements/same-line-async-gen-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (29, 2) to (32, 3) +language/statements/class/elements/same-line-async-gen-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (29, 2) to (32, 3) +language/statements/class/elements/same-line-async-gen-static-private-methods.js (strict mode) + Classes may not have private methods. at (29, 2) to (31, 3) +language/statements/class/elements/same-line-async-gen-static-private-methods.js (default) + Classes may not have private methods. at (29, 2) to (31, 3) +language/statements/class/elements/same-line-async-method-private-method-usage.js (strict mode) + Classes may not have private methods. at (26, 27) to (26, 53) +language/statements/class/elements/same-line-async-method-private-method-usage.js (default) + Classes may not have private methods. at (26, 27) to (26, 53) +language/statements/class/elements/same-line-async-method-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/same-line-async-method-rs-private-method-alt.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/same-line-async-method-rs-private-method.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/same-line-async-method-rs-private-method.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/same-line-async-method-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 27) to (65, 3) +language/statements/class/elements/same-line-async-method-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 27) to (65, 3) +language/statements/class/elements/same-line-async-method-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 27) to (65, 3) +language/statements/class/elements/same-line-async-method-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 27) to (65, 3) +language/statements/class/elements/same-line-async-method-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 27) to (65, 3) +language/statements/class/elements/same-line-async-method-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 27) to (65, 3) +language/statements/class/elements/same-line-async-method-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 27) to (65, 3) +language/statements/class/elements/same-line-async-method-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 27) to (65, 3) +language/statements/class/elements/same-line-async-method-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 27) to (65, 3) +language/statements/class/elements/same-line-async-method-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 27) to (65, 3) +language/statements/class/elements/same-line-async-method-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 27) to (65, 3) +language/statements/class/elements/same-line-async-method-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 27) to (65, 3) +language/statements/class/elements/same-line-async-method-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (60, 27) to (62, 3) +language/statements/class/elements/same-line-async-method-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (60, 27) to (62, 3) +language/statements/class/elements/same-line-async-method-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (60, 27) to (62, 3) +language/statements/class/elements/same-line-async-method-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (60, 27) to (62, 3) +language/statements/class/elements/same-line-async-method-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (29, 2) to (32, 3) +language/statements/class/elements/same-line-async-method-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (29, 2) to (32, 3) +language/statements/class/elements/same-line-async-method-static-private-methods.js (strict mode) + Classes may not have private methods. at (29, 2) to (31, 3) +language/statements/class/elements/same-line-async-method-static-private-methods.js (default) + Classes may not have private methods. at (29, 2) to (31, 3) +language/statements/class/elements/same-line-gen-private-method-usage.js (strict mode) + Classes may not have private methods. at (26, 2) to (26, 28) +language/statements/class/elements/same-line-gen-private-method-usage.js (default) + Classes may not have private methods. at (26, 2) to (26, 28) +language/statements/class/elements/same-line-gen-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/same-line-gen-rs-private-method-alt.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/same-line-gen-rs-private-method.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/same-line-gen-rs-private-method.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/same-line-gen-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/same-line-gen-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/same-line-gen-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/same-line-gen-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/same-line-gen-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/same-line-gen-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/same-line-gen-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/same-line-gen-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/same-line-gen-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/same-line-gen-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/same-line-gen-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (60, 2) to (62, 3) +language/statements/class/elements/same-line-gen-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (60, 2) to (62, 3) +language/statements/class/elements/same-line-gen-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (60, 2) to (62, 3) +language/statements/class/elements/same-line-gen-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (60, 2) to (62, 3) +language/statements/class/elements/same-line-gen-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (29, 2) to (32, 3) +language/statements/class/elements/same-line-gen-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (29, 2) to (32, 3) +language/statements/class/elements/same-line-gen-static-private-methods.js (strict mode) + Classes may not have private methods. at (29, 2) to (31, 3) +language/statements/class/elements/same-line-gen-static-private-methods.js (default) + Classes may not have private methods. at (29, 2) to (31, 3) +language/statements/class/elements/same-line-method-private-method-usage.js (strict mode) + Classes may not have private methods. at (26, 2) to (26, 28) +language/statements/class/elements/same-line-method-private-method-usage.js (default) + Classes may not have private methods. at (26, 2) to (26, 28) +language/statements/class/elements/same-line-method-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/same-line-method-rs-private-method-alt.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/same-line-method-rs-private-method.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/same-line-method-rs-private-method.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/same-line-method-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/same-line-method-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/same-line-method-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/same-line-method-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/same-line-method-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/same-line-method-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/same-line-method-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/same-line-method-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/same-line-method-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/same-line-method-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 2) to (65, 3) +language/statements/class/elements/same-line-method-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (60, 2) to (62, 3) +language/statements/class/elements/same-line-method-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (60, 2) to (62, 3) +language/statements/class/elements/same-line-method-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (60, 2) to (62, 3) +language/statements/class/elements/same-line-method-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (60, 2) to (62, 3) +language/statements/class/elements/same-line-method-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (29, 2) to (32, 3) +language/statements/class/elements/same-line-method-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (29, 2) to (32, 3) +language/statements/class/elements/same-line-method-static-private-methods.js (strict mode) + Classes may not have private methods. at (29, 2) to (31, 3) +language/statements/class/elements/same-line-method-static-private-methods.js (default) + Classes may not have private methods. at (29, 2) to (31, 3) +language/statements/class/elements/static-comp-name-init-err-contains-arguments.js (strict mode) + Missing parse error +language/statements/class/elements/static-comp-name-init-err-contains-arguments.js (default) + Missing parse error +language/statements/class/elements/static-literal-init-err-contains-arguments.js (strict mode) + Missing parse error +language/statements/class/elements/static-literal-init-err-contains-arguments.js (default) + Missing parse error +language/statements/class/elements/static-private-init-err-contains-arguments.js (strict mode) + Missing parse error +language/statements/class/elements/static-private-init-err-contains-arguments.js (default) + Missing parse error +language/statements/class/elements/static-string-literal-name-init-err-contains-arguments.js (strict mode) + Missing parse error +language/statements/class/elements/static-string-literal-name-init-err-contains-arguments.js (default) + Missing parse error +language/statements/class/elements/string-literal-name-init-err-contains-arguments.js (strict mode) + Missing parse error +language/statements/class/elements/string-literal-name-init-err-contains-arguments.js (default) + Missing parse error +language/statements/class/elements/syntax/early-errors/grammar-ctor-super-no-heritage.js (strict mode) + Missing parse error +language/statements/class/elements/syntax/early-errors/grammar-ctor-super-no-heritage.js (default) + Missing parse error +language/statements/class/elements/syntax/early-errors/grammar-field-identifier-invalid-zwj-error.js (strict mode) + Missing parse error +language/statements/class/elements/syntax/early-errors/grammar-field-identifier-invalid-zwj-error.js (default) + Missing parse error +language/statements/class/elements/syntax/early-errors/grammar-field-identifier-invalid-zwnj-error.js (strict mode) + Missing parse error +language/statements/class/elements/syntax/early-errors/grammar-field-identifier-invalid-zwnj-error.js (default) + Missing parse error +language/statements/class/elements/syntax/early-errors/grammar-privatename-identifier-invalid-zwj-error.js (strict mode) + Missing parse error +language/statements/class/elements/syntax/early-errors/grammar-privatename-identifier-invalid-zwj-error.js (default) + Missing parse error +language/statements/class/elements/syntax/early-errors/grammar-privatename-identifier-invalid-zwnj-error.js (strict mode) + Missing parse error +language/statements/class/elements/syntax/early-errors/grammar-privatename-identifier-invalid-zwnj-error.js (default) + Missing parse error +language/statements/class/elements/syntax/early-errors/grammar-special-meth-ctor-async-gen.js (strict mode) + Missing parse error +language/statements/class/elements/syntax/early-errors/grammar-special-meth-ctor-async-gen.js (default) + Missing parse error +language/statements/class/elements/syntax/early-errors/grammar-special-meth-ctor-async-meth.js (strict mode) + Missing parse error +language/statements/class/elements/syntax/early-errors/grammar-special-meth-ctor-async-meth.js (default) + Missing parse error +language/statements/class/elements/syntax/early-errors/grammar-special-meth-ctor-gen.js (strict mode) + Missing parse error +language/statements/class/elements/syntax/early-errors/grammar-special-meth-ctor-gen.js (default) + Missing parse error +language/statements/class/elements/syntax/early-errors/grammar-special-meth-ctor-get.js (strict mode) + Missing parse error +language/statements/class/elements/syntax/early-errors/grammar-special-meth-ctor-get.js (default) + Missing parse error +language/statements/class/elements/syntax/early-errors/grammar-special-meth-ctor-set.js (strict mode) + Missing parse error +language/statements/class/elements/syntax/early-errors/grammar-special-meth-ctor-set.js (default) + Missing parse error +language/statements/class/elements/syntax/early-errors/grammar-static-async-gen-meth-prototype.js (strict mode) + Missing parse error +language/statements/class/elements/syntax/early-errors/grammar-static-async-gen-meth-prototype.js (default) + Missing parse error +language/statements/class/elements/syntax/early-errors/grammar-static-async-meth-prototype.js (strict mode) + Missing parse error +language/statements/class/elements/syntax/early-errors/grammar-static-async-meth-prototype.js (default) + Missing parse error +language/statements/class/elements/syntax/early-errors/grammar-static-gen-meth-prototype.js (strict mode) + Missing parse error +language/statements/class/elements/syntax/early-errors/grammar-static-gen-meth-prototype.js (default) + Missing parse error +language/statements/class/elements/syntax/early-errors/grammar-static-get-meth-prototype.js (strict mode) + Missing parse error +language/statements/class/elements/syntax/early-errors/grammar-static-get-meth-prototype.js (default) + Missing parse error +language/statements/class/elements/syntax/early-errors/grammar-static-meth-prototype.js (strict mode) + Missing parse error +language/statements/class/elements/syntax/early-errors/grammar-static-meth-prototype.js (default) + Missing parse error +language/statements/class/elements/syntax/early-errors/grammar-static-set-meth-prototype.js (strict mode) + Missing parse error +language/statements/class/elements/syntax/early-errors/grammar-static-set-meth-prototype.js (default) + Missing parse error +language/statements/class/elements/syntax/valid/grammar-privatemeth-duplicate-meth-nestedclassmeth.js (strict mode) + Classes may not have private methods. at (21, 6) to (21, 13) +language/statements/class/elements/syntax/valid/grammar-privatemeth-duplicate-meth-nestedclassmeth.js (default) + Classes may not have private methods. at (21, 6) to (21, 13) +language/statements/class/elements/syntax/valid/grammar-static-private-async-gen-meth-prototype.js (strict mode) + Classes may not have private methods. at (19, 2) to (19, 32) +language/statements/class/elements/syntax/valid/grammar-static-private-async-gen-meth-prototype.js (default) + Classes may not have private methods. at (19, 2) to (19, 32) +language/statements/class/elements/syntax/valid/grammar-static-private-async-meth-prototype.js (strict mode) + Classes may not have private methods. at (19, 2) to (19, 30) +language/statements/class/elements/syntax/valid/grammar-static-private-async-meth-prototype.js (default) + Classes may not have private methods. at (19, 2) to (19, 30) +language/statements/class/elements/syntax/valid/grammar-static-private-gen-meth-prototype.js (strict mode) + Classes may not have private methods. at (19, 2) to (19, 26) +language/statements/class/elements/syntax/valid/grammar-static-private-gen-meth-prototype.js (default) + Classes may not have private methods. at (19, 2) to (19, 26) +language/statements/class/elements/syntax/valid/grammar-static-private-meth-prototype.js (strict mode) + Classes may not have private methods. at (19, 2) to (19, 24) +language/statements/class/elements/syntax/valid/grammar-static-private-meth-prototype.js (default) + Classes may not have private methods. at (19, 2) to (19, 24) +language/statements/class/elements/ternary-init-err-contains-arguments.js (strict mode) + Missing parse error +language/statements/class/elements/ternary-init-err-contains-arguments.js (default) + Missing parse error +language/statements/class/elements/typeof-init-err-contains-arguments.js (strict mode) + Missing parse error +language/statements/class/elements/typeof-init-err-contains-arguments.js (default) + Missing parse error +language/statements/class/elements/wrapped-in-sc-private-method-usage.js (strict mode) + Classes may not have private methods. at (26, 8) to (26, 34) +language/statements/class/elements/wrapped-in-sc-private-method-usage.js (default) + Classes may not have private methods. at (26, 8) to (26, 34) +language/statements/class/elements/wrapped-in-sc-rs-private-method-alt.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/wrapped-in-sc-rs-private-method-alt.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/wrapped-in-sc-rs-private-method.js (strict mode) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/wrapped-in-sc-rs-private-method.js (default) + Classes may not have private methods. at (59, 2) to (61, 3) +language/statements/class/elements/wrapped-in-sc-rs-static-async-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 8) to (65, 3) +language/statements/class/elements/wrapped-in-sc-rs-static-async-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 8) to (65, 3) +language/statements/class/elements/wrapped-in-sc-rs-static-async-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 8) to (65, 3) +language/statements/class/elements/wrapped-in-sc-rs-static-async-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 8) to (65, 3) +language/statements/class/elements/wrapped-in-sc-rs-static-async-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 8) to (65, 3) +language/statements/class/elements/wrapped-in-sc-rs-static-async-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 8) to (65, 3) +language/statements/class/elements/wrapped-in-sc-rs-static-async-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 8) to (65, 3) +language/statements/class/elements/wrapped-in-sc-rs-static-async-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 8) to (65, 3) +language/statements/class/elements/wrapped-in-sc-rs-static-generator-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (63, 8) to (65, 3) +language/statements/class/elements/wrapped-in-sc-rs-static-generator-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (63, 8) to (65, 3) +language/statements/class/elements/wrapped-in-sc-rs-static-generator-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (63, 8) to (65, 3) +language/statements/class/elements/wrapped-in-sc-rs-static-generator-method-privatename-identifier.js (default) + Classes may not have private methods. at (63, 8) to (65, 3) +language/statements/class/elements/wrapped-in-sc-rs-static-method-privatename-identifier-alt.js (strict mode) + Classes may not have private methods. at (60, 8) to (62, 3) +language/statements/class/elements/wrapped-in-sc-rs-static-method-privatename-identifier-alt.js (default) + Classes may not have private methods. at (60, 8) to (62, 3) +language/statements/class/elements/wrapped-in-sc-rs-static-method-privatename-identifier.js (strict mode) + Classes may not have private methods. at (60, 8) to (62, 3) +language/statements/class/elements/wrapped-in-sc-rs-static-method-privatename-identifier.js (default) + Classes may not have private methods. at (60, 8) to (62, 3) +language/statements/class/elements/wrapped-in-sc-static-private-methods-with-fields.js (strict mode) + Classes may not have private methods. at (30, 2) to (33, 3) +language/statements/class/elements/wrapped-in-sc-static-private-methods-with-fields.js (default) + Classes may not have private methods. at (30, 2) to (33, 3) +language/statements/class/elements/wrapped-in-sc-static-private-methods.js (strict mode) + Classes may not have private methods. at (30, 2) to (32, 3) +language/statements/class/elements/wrapped-in-sc-static-private-methods.js (default) + Classes may not have private methods. at (30, 2) to (32, 3) +language/statements/class/syntax/early-errors/class-definition-evaluation-block-duplicate-binding.js (strict mode) + Missing parse error +language/statements/class/syntax/early-errors/class-definition-evaluation-block-duplicate-binding.js (default) + Missing parse error +language/statements/class/syntax/early-errors/class-definition-evaluation-scriptbody-duplicate-binding.js (strict mode) + Missing parse error +language/statements/class/syntax/early-errors/class-definition-evaluation-scriptbody-duplicate-binding.js (default) + Missing parse error +language/statements/const/redeclaration-error-from-within-strict-mode-function-const.js (default) + Missing parse error +language/statements/for-in/head-const-bound-names-dup.js (strict mode) + Missing parse error +language/statements/for-in/head-const-bound-names-dup.js (default) + Missing parse error +language/statements/for-in/head-const-bound-names-in-stmt.js (strict mode) + Missing parse error +language/statements/for-in/head-const-bound-names-in-stmt.js (default) + Missing parse error +language/statements/for-in/head-let-bound-names-dup.js (strict mode) + Missing parse error +language/statements/for-in/head-let-bound-names-dup.js (default) + Missing parse error +language/statements/for-in/head-let-bound-names-in-stmt.js (strict mode) + Missing parse error +language/statements/for-in/head-let-bound-names-in-stmt.js (default) + Missing parse error +language/statements/for-in/head-lhs-let.js (default) + Unexpected token `in` at (27, 10) to (27, 12) +language/statements/for-in/identifier-let-allowed-as-lefthandside-expression-not-strict.js (default) + Unexpected token `in` at (12, 9) to (12, 11) +language/statements/for-of/head-const-bound-names-dup.js (strict mode) + Missing parse error +language/statements/for-of/head-const-bound-names-dup.js (default) + Missing parse error +language/statements/for-of/head-const-bound-names-in-stmt.js (strict mode) + Missing parse error +language/statements/for-of/head-const-bound-names-in-stmt.js (default) + Missing parse error +language/statements/for-of/head-let-bound-names-dup.js (strict mode) + Missing parse error +language/statements/for-of/head-let-bound-names-dup.js (default) + Missing parse error +language/statements/for-of/head-let-bound-names-in-stmt.js (strict mode) + Missing parse error +language/statements/for-of/head-let-bound-names-in-stmt.js (default) + Missing parse error +language/statements/for/head-let-bound-names-in-stmt.js (strict mode) + Missing parse error +language/statements/for/head-let-bound-names-in-stmt.js (default) + Missing parse error +language/statements/for/head-lhs-let.js (default) + Unexpected token `=`, expected an identifier at (25, 4) to (25, 5) +language/statements/function/use-strict-with-non-simple-param.js (strict mode) + Missing parse error +language/statements/function/use-strict-with-non-simple-param.js (default) + Missing parse error +language/statements/generators/use-strict-with-non-simple-param.js (strict mode) + Missing parse error +language/statements/generators/use-strict-with-non-simple-param.js (default) + Missing parse error +language/statements/labeled/continue.js (strict mode) + Missing parse error +language/statements/labeled/continue.js (default) + Missing parse error +language/statements/labeled/value-await-module-escaped.js (strict mode) + Missing parse error +language/statements/labeled/value-await-module-escaped.js (default) + Missing parse error +language/statements/labeled/value-await-module.js (strict mode) + Missing parse error +language/statements/labeled/value-await-module.js (default) + Missing parse error +language/statements/let/redeclaration-error-from-within-strict-mode-function.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-function.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-function.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-generator.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-generator.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-class.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-class.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-const.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-const.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-function.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-function.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-generator.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-generator.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-let.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-let.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-var.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-var.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-function.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-function.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-generator.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-generator.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-class.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-class.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-const.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-const.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-function.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-function.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-generator.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-generator.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-let.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-let.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-var.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-var.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-async-function.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-async-function.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-async-generator.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-async-generator.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-class.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-class.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-const.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-const.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-function.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-function.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-generator.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-generator.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-let.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-let.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-var.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-var.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-async-function.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-async-function.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-async-generator.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-async-generator.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-class.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-class.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-const.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-const.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-function.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-function.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-generator.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-generator.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-let.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-let.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-var.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-var.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-async-function.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-async-function.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-async-generator.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-async-generator.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-class.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-class.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-const.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-const.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-function.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-generator.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-generator.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-let.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-let.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-var.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-var.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-function.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-function.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-generator.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-generator.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-class.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-class.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-const.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-const.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-function.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-function.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-generator.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-generator.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-let.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-let.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-var.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-var.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-async-function.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-async-function.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-async-generator.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-async-generator.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-class.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-class.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-const.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-const.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-function.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-function.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-generator.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-generator.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-let.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-let.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-var.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-var.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-async-function.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-async-function.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-async-generator.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-async-generator.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-class.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-class.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-const.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-const.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-function.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-function.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-generator.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-generator.js (default) + Missing parse error +language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-let.js (strict mode) + Missing parse error +language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-let.js (default) + Missing parse error +language/statements/try/early-catch-duplicates.js (strict mode) + Missing parse error +language/statements/try/early-catch-duplicates.js (default) + Missing parse error +language/statements/try/early-catch-function.js (strict mode) + Missing parse error +language/statements/try/early-catch-function.js (default) + Missing parse error +language/statements/try/early-catch-lex.js (strict mode) + Missing parse error +language/statements/try/early-catch-lex.js (default) + Missing parse error + +=== Summary === +Passed: 64222 (92.10%) +Failed: 5512 (7.90%) + +Features: + Proxy: 661/663 (99.70%) + Symbol.asyncIterator: 716/1068 (67.04%) + Symbol.iterator: 2722/3290 (82.74%) + arrow-function: 108/118 (91.53%) + async-functions: 719/907 (79.27%) + async-iteration: 7688/9388 (81.89%) + class: 3562/7578 (47.00%) + class-fields-private: 1572/1736 (90.55%) + class-fields-public: 2432/3388 (71.78%) + class-methods-private: 1098/3082 (35.63%) + class-static-fields-private: 568/640 (88.75%) + class-static-fields-public: 42/54 (77.78%) + class-static-methods-private: 308/2756 (11.18%) + computed-property-names: 312/318 (98.11%) + default-parameters: 3436/4380 (78.45%) + destructuring-binding: 10835/12723 (85.16%) + dynamic-import: 1034/1036 (99.81%) + export-star-as-namespace-from-module: 28/36 (77.78%) + generators: 6021/7653 (78.68%) + import.meta: 34/46 (73.91%) + let: 131/135 (97.04%) + new.target: 92/94 (97.87%) + numeric-separator-literal: 202/204 (99.02%) + object-rest: 530/674 (78.64%) + object-spread: 216/232 (93.10%) + regexp-named-groups: 50/162 (30.86%) + regexp-unicode-property-escapes: 792/1076 (73.61%) diff --git a/lib/token.ml b/lib/token.ml index dae847f..4001c23 100644 --- a/lib/token.ml +++ b/lib/token.ml @@ -1,15 +1,26 @@ -(** - * Copyright (c) 2013-present, Facebook, Inc. +(* + * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. *) type t = - | T_NUMBER of { kind: number_type; raw: string } + | T_NUMBER of { + kind: number_type; + raw: string; + } + | T_BIGINT of { + kind: bigint_type; + raw: string; + } | T_STRING of (Loc.t * string * string * bool) (* loc, value, raw, octal *) | T_TEMPLATE_PART of (Loc.t * template_part * bool) (* loc, value, is_tail *) - | T_IDENTIFIER of { loc: Loc.t; value: string; raw: string } + | T_IDENTIFIER of { + loc: Loc.t; + value: string; + raw: string; + } | T_REGEXP of (Loc.t * string * string) (* /pattern/flags *) (* Syntax *) | T_LCURLY @@ -136,9 +147,21 @@ type t = | T_EMPTY_TYPE | T_BOOLEAN_TYPE of bool_or_boolean | T_NUMBER_TYPE - | T_NUMBER_SINGLETON_TYPE of { kind: number_type; value: float; raw: string } + | T_BIGINT_TYPE + | T_NUMBER_SINGLETON_TYPE of { + kind: number_type; + value: float; + raw: string; + } + | T_BIGINT_SINGLETON_TYPE of { + kind: bigint_type; + approx_value: float; + (* Warning! Might lose precision! *) + raw: string; + } | T_STRING_TYPE | T_VOID_TYPE + | T_SYMBOL_TYPE (* `bool` and `boolean` are equivalent annotations, but we need to track which one was used for when it might be an identifier, as in @@ -151,12 +174,20 @@ and bool_or_boolean = and number_type = | BINARY | LEGACY_OCTAL + | LEGACY_NON_OCTAL (* NonOctalDecimalIntegerLiteral in Annex B *) | OCTAL | NORMAL +and bigint_type = + | BIG_BINARY + | BIG_OCTAL + | BIG_NORMAL + and template_part = { - cooked: string; (* string after processing special chars *) - raw: string; (* string as specified in source *) + cooked: string; + (* string after processing special chars *) + raw: string; + (* string as specified in source *) literal: string; (* same as raw, plus characters like ` and ${ *) } @@ -165,6 +196,7 @@ and template_part = { (*****************************************************************************) let token_to_string = function | T_NUMBER _ -> "T_NUMBER" + | T_BIGINT _ -> "T_BIGINT" | T_STRING _ -> "T_STRING" | T_TEMPLATE_PART _ -> "T_TEMPLATE_PART" | T_IDENTIFIER _ -> "T_IDENTIFIER" @@ -182,7 +214,7 @@ let token_to_string = function | T_WHILE -> "T_WHILE" | T_WITH -> "T_WITH" | T_CONST -> "T_CONST" - | T_LET -> "T_LET" + | T_LET -> "T_LET" | T_NULL -> "T_NULL" | T_FALSE -> "T_FALSE" | T_TRUE -> "T_TRUE" @@ -203,9 +235,9 @@ let token_to_string = function | T_TYPEOF -> "T_TYPEOF" | T_VOID -> "T_VOID" | T_ENUM -> "T_ENUM" - | T_EXPORT -> "T_EXPORT" + | T_EXPORT -> "T_EXPORT" | T_IMPORT -> "T_IMPORT" - | T_SUPER -> "T_SUPER" + | T_SUPER -> "T_SUPER" | T_IMPLEMENTS -> "T_IMPLEMENTS" | T_INTERFACE -> "T_INTERFACE" | T_PACKAGE -> "T_PACKAGE" @@ -290,12 +322,16 @@ let token_to_string = function | T_EMPTY_TYPE -> "T_EMPTY_TYPE" | T_BOOLEAN_TYPE _ -> "T_BOOLEAN_TYPE" | T_NUMBER_TYPE -> "T_NUMBER_TYPE" + | T_BIGINT_TYPE -> "T_BIGINT_TYPE" | T_NUMBER_SINGLETON_TYPE _ -> "T_NUMBER_SINGLETON_TYPE" + | T_BIGINT_SINGLETON_TYPE _ -> "T_BIGINT_SINGLETON_TYPE" | T_STRING_TYPE -> "T_STRING_TYPE" | T_VOID_TYPE -> "T_VOID_TYPE" + | T_SYMBOL_TYPE -> "T_SYMBOL_TYPE" let value_of_token = function | T_NUMBER { raw; _ } -> raw + | T_BIGINT { raw; _ } -> raw | T_STRING (_, _, raw, _) -> raw | T_TEMPLATE_PART (_, { literal; _ }, _) -> literal | T_IDENTIFIER { raw; _ } -> raw @@ -410,15 +446,52 @@ let value_of_token = function | T_BIT_NOT -> "~" | T_INCR -> "++" | T_DECR -> "--" + (* Extra tokens *) | T_ERROR raw -> raw | T_EOF -> "" | T_JSX_IDENTIFIER { raw } -> raw | T_JSX_TEXT (_, _, raw) -> raw + (* Type primitives *) | T_ANY_TYPE -> "any" | T_MIXED_TYPE -> "mixed" | T_EMPTY_TYPE -> "empty" - | T_BOOLEAN_TYPE kind -> begin match kind with BOOL -> "bool" | BOOLEAN -> "boolean" end + | T_BOOLEAN_TYPE kind -> + begin + match kind with + | BOOL -> "bool" + | BOOLEAN -> "boolean" + end | T_NUMBER_TYPE -> "number" + | T_BIGINT_TYPE -> "bigint" | T_NUMBER_SINGLETON_TYPE { raw; _ } -> raw + | T_BIGINT_SINGLETON_TYPE { raw; _ } -> raw | T_STRING_TYPE -> "string" | T_VOID_TYPE -> "void" + | T_SYMBOL_TYPE -> "symbol" + +let quote_token_value value = Printf.sprintf "token `%s`" value + +let explanation_of_token ?(use_article = false) token = + let (value, article) = + match token with + | T_NUMBER_SINGLETON_TYPE _ + | T_NUMBER _ -> + ("number", "a") + | T_BIGINT_SINGLETON_TYPE _ + | T_BIGINT _ -> + ("bigint", "a") + | T_JSX_TEXT _ + | T_STRING _ -> + ("string", "a") + | T_TEMPLATE_PART _ -> ("template literal part", "a") + | T_JSX_IDENTIFIER _ + | T_IDENTIFIER _ -> + ("identifier", "an") + | T_REGEXP _ -> ("regexp", "a") + | T_EOF -> ("end of input", "the") + | _ -> (quote_token_value (value_of_token token), "the") + in + if use_article then + article ^ " " ^ value + else + value diff --git a/lib/token_translator.ml b/lib/token_translator.ml index ac1e937..5d25de1 100644 --- a/lib/token_translator.ml +++ b/lib/token_translator.ml @@ -1,50 +1,60 @@ -(** - * Copyright (c) 2013-present, Facebook, Inc. +(* + * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. *) - -module Translate (Impl : Translator_intf.S) : (sig +module Translate (Impl : Translator_intf.S) : sig type t - val token: Parser_env.token_sink_result -> t - val token_list: Parser_env.token_sink_result list -> t -end with type t = Impl.t) = struct - type t = Impl.t - let token { Parser_env.token_loc; token; token_context } = - let open Loc in + val token : Offset_utils.t -> Parser_env.token_sink_result -> t - Impl.obj [ - ("type", Impl.string (Token.token_to_string token)); - ("context", Impl.string Parser_env.Lex_mode.( - match token_context with - | NORMAL -> "normal" - | TYPE -> "type" - | JSX_TAG -> "jsxTag" - | JSX_CHILD -> "jsxChild" - | TEMPLATE -> "template" - | REGEXP -> "regexp" - )); - ("loc", Impl.obj [ - ("start", Impl.obj [ - ("line", Impl.number (float token_loc.start.line)); - ("column", Impl.number (float token_loc.start.column)); - ]); - ("end", Impl.obj [ - ("line", Impl.number (float token_loc._end.line)); - ("column", Impl.number (float token_loc._end.column)); - ]); - ]); - ("range", Impl.array [ - Impl.number (float token_loc.start.offset); - Impl.number (float token_loc._end.offset); - ]); - ("value", Impl.string (Token.value_of_token token)); - ] + val token_list : Offset_utils.t -> Parser_env.token_sink_result list -> t +end +with type t = Impl.t = struct + type t = Impl.t - let token_list tokens = - Impl.array (List.rev_map token tokens |> List.rev) + let token offset_table { Parser_env.token_loc; token; token_context } = + Loc.( + Impl.obj + [ + ("type", Impl.string (Token.token_to_string token)); + ( "context", + Impl.string + Parser_env.Lex_mode.( + match token_context with + | NORMAL -> "normal" + | TYPE -> "type" + | JSX_TAG -> "jsxTag" + | JSX_CHILD -> "jsxChild" + | TEMPLATE -> "template" + | REGEXP -> "regexp") ); + ( "loc", + Impl.obj + [ + ( "start", + Impl.obj + [ + ("line", Impl.number (float token_loc.start.line)); + ("column", Impl.number (float token_loc.start.column)); + ] ); + ( "end", + Impl.obj + [ + ("line", Impl.number (float token_loc._end.line)); + ("column", Impl.number (float token_loc._end.column)); + ] ); + ] ); + ( "range", + Impl.array + [ + Impl.number (float (Offset_utils.offset offset_table token_loc.start)); + Impl.number (float (Offset_utils.offset offset_table token_loc._end)); + ] ); + ("value", Impl.string (Token.value_of_token token)); + ]) + let token_list offset_table tokens = + Impl.array (List.rev_map (token offset_table) tokens |> List.rev) end diff --git a/lib/translator_intf.ml b/lib/translator_intf.ml index fdc0124..0cbe9ea 100644 --- a/lib/translator_intf.ml +++ b/lib/translator_intf.ml @@ -1,5 +1,5 @@ -(** - * Copyright (c) 2013-present, Facebook, Inc. +(* + * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,11 +7,20 @@ module type S = sig type t - val string: string -> t - val bool: bool -> t - val obj: (string * t) list -> t - val array: t list -> t - val number: float -> t - val null: t - val regexp: Loc.t -> string -> string -> t + + val string : string -> t + + val bool : bool -> t + + val obj : (string * t) list -> t + + val array : t list -> t + + val number : float -> t + + val int : int -> t + + val null : t + + val regexp : Loc.t -> string -> string -> t end diff --git a/lib/type_parser.ml b/lib/type_parser.ml index b2806ec..dbdc119 100644 --- a/lib/type_parser.ml +++ b/lib/type_parser.ml @@ -1,99 +1,147 @@ -(** - * Copyright (c) 2013-present, Facebook, Inc. +(* + * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. *) +module Ast = Flow_ast open Token open Parser_env -open Ast +open Flow_ast open Parser_common -module Error = Parse_error +open Comment_attachment module type TYPE = sig - val _type : env -> Loc.t Ast.Type.t - val type_identifier : env -> Loc.t * string - val type_parameter_declaration : env -> Loc.t Ast.Type.ParameterDeclaration.t option - val type_parameter_declaration_with_defaults : env -> Loc.t Ast.Type.ParameterDeclaration.t option - val type_parameter_instantiation : env -> Loc.t Ast.Type.ParameterInstantiation.t option - val generic : env -> Loc.t * Loc.t Ast.Type.Generic.t - val _object : allow_static:bool -> allow_proto:bool -> env -> Loc.t * Loc.t Type.Object.t - val interface_helper : env -> Loc.t Type.Interface.t - val function_param_list : env -> Loc.t Type.Function.Params.t - val annotation : env -> Loc.t Ast.Type.annotation - val annotation_opt : env -> Loc.t Ast.Type.annotation option - val predicate_opt : env -> Loc.t Ast.Type.Predicate.t option - val annotation_and_predicate_opt : env -> Loc.t Ast.Type.annotation option * Loc.t Ast.Type.Predicate.t option + val _type : env -> (Loc.t, Loc.t) Ast.Type.t + + val type_identifier : env -> (Loc.t, Loc.t) Ast.Identifier.t + + val type_params : env -> (Loc.t, Loc.t) Ast.Type.TypeParams.t option + + val type_args : env -> (Loc.t, Loc.t) Ast.Type.TypeArgs.t option + + val generic : env -> Loc.t * (Loc.t, Loc.t) Ast.Type.Generic.t + + val _object : is_class:bool -> env -> Loc.t * (Loc.t, Loc.t) Type.Object.t + + val interface_helper : + env -> + (Loc.t * (Loc.t, Loc.t) Ast.Type.Generic.t) list * (Loc.t * (Loc.t, Loc.t) Ast.Type.Object.t) + + val function_param_list : env -> (Loc.t, Loc.t) Type.Function.Params.t + + val annotation : env -> (Loc.t, Loc.t) Ast.Type.annotation + + val annotation_opt : env -> (Loc.t, Loc.t) Ast.Type.annotation_or_hint + + val predicate_opt : env -> (Loc.t, Loc.t) Ast.Type.Predicate.t option + + val annotation_and_predicate_opt : + env -> (Loc.t, Loc.t) Ast.Type.annotation_or_hint * (Loc.t, Loc.t) Ast.Type.Predicate.t option end -module Type (Parse: Parser_common.PARSER) : TYPE = struct +module Type (Parse : Parser_common.PARSER) : TYPE = struct type param_list_or_type = - | ParamList of Loc.t Type.Function.Params.t' - | Type of Loc.t Type.t + | ParamList of (Loc.t, Loc.t) Type.Function.Params.t' + | Type of (Loc.t, Loc.t) Type.t + + let maybe_variance env = + let loc = Peek.loc env in + match Peek.token env with + | T_PLUS -> + let leading = Peek.comments env in + Eat.token env; + Some + ( loc, + { Variance.kind = Variance.Plus; comments = Flow_ast_utils.mk_comments_opt ~leading () } + ) + | T_MINUS -> + let leading = Peek.comments env in + Eat.token env; + Some + ( loc, + { Variance.kind = Variance.Minus; comments = Flow_ast_utils.mk_comments_opt ~leading () } + ) + | _ -> None let rec _type env = union env and annotation env = - if not (should_parse_types env) - then error env Error.UnexpectedTypeAnnotation; - with_loc (fun env -> - Expect.token env T_COLON; - _type env - ) env - - and variance env = - let loc = Peek.loc env in - match Peek.token env with - | T_PLUS -> - Eat.token env; - Some (loc, Variance.Plus) - | T_MINUS -> - Eat.token env; - Some (loc, Variance.Minus) - | _ -> - None + if not (should_parse_types env) then error env Parse_error.UnexpectedTypeAnnotation; + with_loc + (fun env -> + Expect.token env T_COLON; + _type env) + env and union env = - let _ = Expect.maybe env T_BIT_OR in + let leading = + if Peek.token env = T_BIT_OR then ( + let leading = Peek.comments env in + Eat.token env; + leading + ) else + [] + in let left = intersection env in - union_with env left + union_with env ~leading left and union_with = - let rec unions acc env = + let rec unions leading acc env = match Peek.token env with | T_BIT_OR -> - Expect.token env T_BIT_OR; - unions (intersection env::acc) env + Expect.token env T_BIT_OR; + unions leading (intersection env :: acc) env | _ -> - match List.rev acc with - | t0::t1::ts -> Type.Union (t0, t1, ts) - | _ -> assert false - in fun env left -> - if Peek.token env = T_BIT_OR - then with_loc ~start_loc:(fst left) (unions [left]) env - else left + (match List.rev acc with + | t0 :: t1 :: ts -> + Type.Union + { + Type.Union.types = (t0, t1, ts); + comments = Flow_ast_utils.mk_comments_opt ~leading (); + } + | _ -> assert false) + in + fun env ?(leading = []) left -> + if Peek.token env = T_BIT_OR then + with_loc ~start_loc:(fst left) (unions leading [left]) env + else + left and intersection env = - let _ = Expect.maybe env T_BIT_AND in + let leading = + if Peek.token env = T_BIT_AND then ( + let leading = Peek.comments env in + Eat.token env; + leading + ) else + [] + in let left = anon_function_without_parens env in - intersection_with env left + intersection_with env ~leading left and intersection_with = - let rec intersections acc env = + let rec intersections leading acc env = match Peek.token env with | T_BIT_AND -> - Expect.token env T_BIT_AND; - intersections (anon_function_without_parens env::acc) env + Expect.token env T_BIT_AND; + intersections leading (anon_function_without_parens env :: acc) env | _ -> - match List.rev acc with - | t0::t1::ts -> Type.Intersection (t0, t1, ts) - | _ -> assert false - in fun env left -> - if Peek.token env = T_BIT_AND - then with_loc ~start_loc:(fst left) (intersections [left]) env - else left - + (match List.rev acc with + | t0 :: t1 :: ts -> + Type.Intersection + { + Type.Intersection.types = (t0, t1, ts); + comments = Flow_ast_utils.mk_comments_opt ~leading (); + } + | _ -> assert false) + in + fun env ?(leading = []) left -> + if Peek.token env = T_BIT_AND then + with_loc ~start_loc:(fst left) (intersections leading [left]) env + else + left and anon_function_without_parens env = let param = prefix env in @@ -101,13 +149,18 @@ module Type (Parse: Parser_common.PARSER) : TYPE = struct and anon_function_without_parens_with env param = match Peek.token env with - | T_ARROW when not (no_anon_function_type env)-> - let start_loc, tparams, params = + | T_ARROW when not (no_anon_function_type env) -> + let (start_loc, tparams, params) = let param = anonymous_function_param env param in - fst param, None, (fst param, { Ast.Type.Function.Params. - params = [param]; - rest = None; - }) + ( fst param, + None, + ( fst param, + { + Ast.Type.Function.Params.params = [param]; + this_ = None; + rest = None; + comments = None; + } ) ) in function_with_params env start_loc tparams params | _ -> param @@ -115,511 +168,826 @@ module Type (Parse: Parser_common.PARSER) : TYPE = struct and prefix env = match Peek.token env with | T_PLING -> - with_loc (fun env -> + with_loc + (fun env -> + let leading = Peek.comments env in Expect.token env T_PLING; - Type.Nullable (prefix env) - ) env - | _ -> - postfix env + Type.Nullable + { + Type.Nullable.argument = prefix env; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + }) + env + | _ -> postfix env and postfix env = let t = primary env in postfix_with env t and postfix_with env t = - if not (Peek.is_line_terminator env) && Expect.maybe env T_LBRACKET - then begin - let t = with_loc ~start_loc:(fst t) (fun env -> - Expect.token env T_RBRACKET; - Type.Array t - ) env in + if (not (Peek.is_line_terminator env)) && Eat.maybe env T_LBRACKET then + let t = + with_loc + ~start_loc:(fst t) + (fun env -> + Expect.token env T_RBRACKET; + let trailing = Eat.trailing_comments env in + Type.Array + { Type.Array.argument = t; comments = Flow_ast_utils.mk_comments_opt ~trailing () }) + env + in postfix_with env t - end else t + else + t and primary env = let loc = Peek.loc env in match Peek.token env with | T_MULT -> - Expect.token env T_MULT; - loc, Type.Exists + let leading = Peek.comments env in + Expect.token env T_MULT; + let trailing = Eat.trailing_comments env in + (loc, Type.Exists (Flow_ast_utils.mk_comments_opt ~leading ~trailing ())) | T_LESS_THAN -> _function env | T_LPAREN -> function_or_group env | T_LCURLY | T_LCURLYBAR -> - let loc, o = _object env - ~allow_static:false ~allow_proto:false ~allow_exact:true ~allow_spread:true in - loc, Type.Object o + let (loc, o) = _object env ~is_class:false ~allow_exact:true ~allow_spread:true in + (loc, Type.Object o) | T_INTERFACE -> - with_loc (fun env -> - Expect.token env T_INTERFACE; - Type.Interface (interface_helper env) - ) env + with_loc + (fun env -> + let leading = Peek.comments env in + Expect.token env T_INTERFACE; + let (extends, body) = interface_helper env in + Type.Interface + { Type.Interface.extends; body; comments = Flow_ast_utils.mk_comments_opt ~leading () }) + env | T_TYPEOF -> - with_loc (fun env -> + with_loc + (fun env -> + let leading = Peek.comments env in Expect.token env T_TYPEOF; - Type.Typeof (primary env) - ) env + Type.Typeof + { + Type.Typeof.argument = primary env; + internal = false; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + }) + env | T_LBRACKET -> tuple env | T_IDENTIFIER _ | T_STATIC (* `static` is reserved in strict mode, but still an identifier *) -> - let loc, g = generic env in - loc, Type.Generic g - | T_STRING (loc, value, raw, octal) -> - if octal then strict_error env Error.StrictOctalLiteral; - Expect.token env (T_STRING (loc, value, raw, octal)); - loc, Type.StringLiteral { - Ast.StringLiteral.value; - raw; - } + let (loc, g) = generic env in + (loc, Type.Generic g) + | T_STRING (loc, value, raw, octal) -> + if octal then strict_error env Parse_error.StrictOctalLiteral; + let leading = Peek.comments env in + Expect.token env (T_STRING (loc, value, raw, octal)); + let trailing = Eat.trailing_comments env in + ( loc, + Type.StringLiteral + { + Ast.StringLiteral.value; + raw; + comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + } ) | T_NUMBER_SINGLETON_TYPE { kind; value; raw } -> - Expect.token env (T_NUMBER_SINGLETON_TYPE { kind; value; raw }); - if kind = LEGACY_OCTAL - then strict_error env Error.StrictOctalLiteral; - loc, Type.NumberLiteral { - Ast.NumberLiteral.value; - raw; - } + let leading = Peek.comments env in + Expect.token env (T_NUMBER_SINGLETON_TYPE { kind; value; raw }); + let trailing = Eat.trailing_comments env in + if kind = LEGACY_OCTAL then strict_error env Parse_error.StrictOctalLiteral; + ( loc, + Type.NumberLiteral + { + Ast.NumberLiteral.value; + raw; + comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + } ) + | T_BIGINT_SINGLETON_TYPE { kind; approx_value; raw } -> + let bigint = raw in + let leading = Peek.comments env in + Expect.token env (T_BIGINT_SINGLETON_TYPE { kind; approx_value; raw }); + let trailing = Eat.trailing_comments env in + ( loc, + Type.BigIntLiteral + { + Ast.BigIntLiteral.approx_value; + bigint; + comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + } ) | (T_TRUE | T_FALSE) as token -> - Expect.token env token; - let value = token = T_TRUE in - loc, Type.BooleanLiteral value - | token -> - match primitive token with - | Some t -> - Expect.token env token; - loc, t - | None -> - error_unexpected env; - loc, Type.Any - - and primitive = function - | T_ANY_TYPE -> Some Type.Any - | T_MIXED_TYPE -> Some Type.Mixed - | T_EMPTY_TYPE -> Some Type.Empty - | T_BOOLEAN_TYPE _ -> Some Type.Boolean - | T_NUMBER_TYPE -> Some Type.Number - | T_STRING_TYPE -> Some Type.String - | T_VOID_TYPE -> Some Type.Void - | T_NULL -> Some Type.Null + let leading = Peek.comments env in + Expect.token env token; + let trailing = Eat.trailing_comments env in + let value = token = T_TRUE in + ( loc, + Type.BooleanLiteral + { BooleanLiteral.value; comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () } + ) + | _ -> + (match primitive env with + | Some t -> (loc, t) + | None -> + error_unexpected env; + (loc, Type.Any None)) + + and is_primitive = function + | T_ANY_TYPE + | T_MIXED_TYPE + | T_EMPTY_TYPE + | T_BOOLEAN_TYPE _ + | T_NUMBER_TYPE + | T_BIGINT_TYPE + | T_STRING_TYPE + | T_SYMBOL_TYPE + | T_VOID_TYPE + | T_NULL -> + true + | _ -> false + + and primitive env = + let leading = Peek.comments env in + let token = Peek.token env in + match token with + | T_ANY_TYPE -> + Eat.token env; + let trailing = Eat.trailing_comments env in + Some (Type.Any (Flow_ast_utils.mk_comments_opt ~leading ~trailing ())) + | T_MIXED_TYPE -> + Eat.token env; + let trailing = Eat.trailing_comments env in + Some (Type.Mixed (Flow_ast_utils.mk_comments_opt ~leading ~trailing ())) + | T_EMPTY_TYPE -> + Eat.token env; + let trailing = Eat.trailing_comments env in + Some (Type.Empty (Flow_ast_utils.mk_comments_opt ~leading ~trailing ())) + | T_BOOLEAN_TYPE _ -> + Eat.token env; + let trailing = Eat.trailing_comments env in + Some (Type.Boolean (Flow_ast_utils.mk_comments_opt ~leading ~trailing ())) + | T_NUMBER_TYPE -> + Eat.token env; + let trailing = Eat.trailing_comments env in + Some (Type.Number (Flow_ast_utils.mk_comments_opt ~leading ~trailing ())) + | T_BIGINT_TYPE -> + Eat.token env; + let trailing = Eat.trailing_comments env in + Some (Type.BigInt (Flow_ast_utils.mk_comments_opt ~leading ~trailing ())) + | T_STRING_TYPE -> + Eat.token env; + let trailing = Eat.trailing_comments env in + Some (Type.String (Flow_ast_utils.mk_comments_opt ~leading ~trailing ())) + | T_SYMBOL_TYPE -> + Eat.token env; + let trailing = Eat.trailing_comments env in + Some (Type.Symbol (Flow_ast_utils.mk_comments_opt ~leading ~trailing ())) + | T_VOID_TYPE -> + Eat.token env; + let trailing = Eat.trailing_comments env in + Some (Type.Void (Flow_ast_utils.mk_comments_opt ~leading ~trailing ())) + | T_NULL -> + Eat.token env; + let trailing = Eat.trailing_comments env in + Some (Type.Null (Flow_ast_utils.mk_comments_opt ~leading ~trailing ())) | _ -> None and tuple = let rec types env acc = match Peek.token env with | T_EOF - | T_RBRACKET -> List.rev acc + | T_RBRACKET -> + List.rev acc | _ -> - let acc = (_type env)::acc in - (* Trailing comma support (like [number, string,]) *) - if Peek.token env <> T_RBRACKET then Expect.token env T_COMMA; - types env acc - - in fun env -> - with_loc (fun env -> - Expect.token env T_LBRACKET; - let tl = types env [] in - Expect.token env T_RBRACKET; - Type.Tuple tl - ) env + let acc = _type env :: acc in + (* Trailing comma support (like [number, string,]) *) + if Peek.token env <> T_RBRACKET then Expect.token env T_COMMA; + types env acc + in + fun env -> + with_loc + (fun env -> + let leading = Peek.comments env in + Expect.token env T_LBRACKET; + let tl = types (with_no_anon_function_type false env) [] in + Expect.token env T_RBRACKET; + let trailing = Eat.trailing_comments env in + Type.Tuple + { + Type.Tuple.types = tl; + comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + }) + env and anonymous_function_param _env annot = - fst annot, Type.Function.Param.({ - name = None; - annot; - optional = false; - }) - - - and function_param_with_id env name = - if not (should_parse_types env) - then error env Error.UnexpectedTypeAnnotation; - with_loc ~start_loc:(fst name) (fun env -> - let optional = Expect.maybe env T_PLING in - Expect.token env T_COLON; - let annot = _type env in - { Type.Function.Param. - name = Some name; - annot; - optional; - } - ) env + (fst annot, Type.Function.Param.{ name = None; annot; optional = false }) + + and function_param_with_id env = + with_loc + (fun env -> + Eat.push_lex_mode env Lex_mode.NORMAL; + let name = Parse.identifier env in + Eat.pop_lex_mode env; + if not (should_parse_types env) then error env Parse_error.UnexpectedTypeAnnotation; + let optional = Eat.maybe env T_PLING in + Expect.token env T_COLON; + let annot = _type env in + { Type.Function.Param.name = Some name; annot; optional }) + env and function_param_list_without_parens = let param env = match Peek.ith_token ~i:1 env with - | T_COLON | T_PLING -> - let id = Parse.identifier env in - function_param_with_id env id + | T_COLON + | T_PLING -> + function_param_with_id env | _ -> - let annot = _type env in - anonymous_function_param env annot - - in let rec param_list env acc = + let annot = _type env in + anonymous_function_param env annot + in + let rec param_list env this_ acc = match Peek.token env with - | T_EOF - | T_ELLIPSIS - | T_RPAREN as t -> + | (T_EOF | T_ELLIPSIS | T_RPAREN) as t -> let rest = - if t = T_ELLIPSIS then begin - let rest = with_loc (fun env -> - Expect.token env T_ELLIPSIS; - { Type.Function.RestParam.argument = param env } - ) env in + if t = T_ELLIPSIS then + let rest = + with_loc + (fun env -> + let leading = Peek.comments env in + Expect.token env T_ELLIPSIS; + { + Type.Function.RestParam.argument = param env; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + }) + env + in Some rest - end else + else None in - { Ast.Type.Function.Params.params = List.rev acc; rest; } + { Ast.Type.Function.Params.params = List.rev acc; rest; this_; comments = None } + | T_IDENTIFIER { raw = "this"; _ } + when Peek.ith_token ~i:1 env == T_COLON || Peek.ith_token ~i:1 env == T_PLING -> + if this_ <> None || acc <> [] then error env Parse_error.ThisParamMustBeFirst; + let this_ = + with_loc + (fun env -> + let leading = Peek.comments env in + Eat.token env; + if Peek.token env == T_PLING then error env Parse_error.ThisParamMayNotBeOptional; + { + Type.Function.ThisParam.annot = annotation env; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + }) + env + in + if Peek.token env <> T_RPAREN then Expect.token env T_COMMA; + param_list env (Some this_) acc | _ -> - let acc = (param env)::acc in - if Peek.token env <> T_RPAREN - then Expect.token env T_COMMA; - param_list env acc - - in fun env -> param_list env + let acc = param env :: acc in + if Peek.token env <> T_RPAREN then Expect.token env T_COMMA; + param_list env this_ acc + in + (fun env -> param_list env None) and function_param_list env = - with_loc (fun env -> - Expect.token env T_LPAREN; - let ret = function_param_list_without_parens env [] in - Expect.token env T_RPAREN; - ret - ) env + with_loc + (fun env -> + let leading = Peek.comments env in + Expect.token env T_LPAREN; + let params = function_param_list_without_parens env [] in + let internal = Peek.comments env in + Expect.token env T_RPAREN; + let trailing = Eat.trailing_comments env in + { + params with + Ast.Type.Function.Params.comments = + Flow_ast_utils.mk_comments_with_internal_opt ~leading ~trailing ~internal; + }) + env and param_list_or_type env = + let leading = Peek.comments env in Expect.token env T_LPAREN; let ret = let env = with_no_anon_function_type false env in match Peek.token env with | T_EOF | T_ELLIPSIS -> - (* (... is definitely the beginning of a param list *) - ParamList (function_param_list_without_parens env []) + (* (... is definitely the beginning of a param list *) + ParamList (function_param_list_without_parens env []) | T_RPAREN -> - (* () or is definitely a param list *) - ParamList ({ Ast.Type.Function.Params.params = []; rest = None }) + (* () or is definitely a param list *) + ParamList + { Ast.Type.Function.Params.this_ = None; params = []; rest = None; comments = None } | T_IDENTIFIER _ | T_STATIC (* `static` is reserved in strict mode, but still an identifier *) -> - (* This could be a function parameter or a generic type *) - function_param_or_generic_type env - | token -> - (match primitive token with - | None -> - (* All params start with an identifier or `...` *) - Type (_type env) - | Some _ -> - (* Don't know if this is (number) or (number: number). The first - * is a type, the second is a param. *) - match Peek.ith_token ~i:1 env with - | T_PLING | T_COLON -> - (* Ok this is definitely a parameter *) - ParamList (function_param_list_without_parens env []) - | _ -> - Type (_type env) - ) + (* This could be a function parameter or a generic type *) + function_param_or_generic_type env + | token when is_primitive token -> + (* Don't know if this is (number) or (number: number). The first + * is a type, the second is a param. *) + (match Peek.ith_token ~i:1 env with + | T_PLING + | T_COLON -> + (* Ok this is definitely a parameter *) + ParamList (function_param_list_without_parens env []) + | _ -> Type (_type env)) + | _ -> + (* All params start with an identifier or `...` *) + Type (_type env) in (* Now that we allow anonymous parameters in function types, we need to * disambiguate a little bit more *) - let ret = match ret with - | ParamList _ -> ret - | Type _ when no_anon_function_type env -> ret - | Type t -> + let ret = + match ret with + | ParamList _ -> ret + | Type _ when no_anon_function_type env -> ret + | Type t -> (match Peek.token env with | T_RPAREN -> - (* Reinterpret `(type) =>` as a ParamList *) - if Peek.ith_token ~i:1 env = T_ARROW - then - let param = anonymous_function_param env t in - ParamList (function_param_list_without_parens env [param]) - else Type t - | T_COMMA -> - (* Reinterpret `(type,` as a ParamList *) - Expect.token env T_COMMA; + (* Reinterpret `(type) =>` as a ParamList *) + if Peek.ith_token ~i:1 env = T_ARROW then let param = anonymous_function_param env t in ParamList (function_param_list_without_parens env [param]) - | _ -> ret) in + else + Type t + | T_COMMA -> + (* Reinterpret `(type,` as a ParamList *) + Expect.token env T_COMMA; + let param = anonymous_function_param env t in + ParamList (function_param_list_without_parens env [param]) + | _ -> ret) + in + let internal = Peek.comments env in Expect.token env T_RPAREN; + let trailing = Eat.trailing_comments env in + let ret = + match ret with + | ParamList params -> + ParamList + { + params with + Ast.Type.Function.Params.comments = + Flow_ast_utils.mk_comments_with_internal_opt ~leading ~trailing ~internal; + } + | Type t -> Type (add_comments t leading trailing) + in ret and function_param_or_generic_type env = match Peek.ith_token ~i:1 env with - | T_PLING (* optional param *) + | T_PLING + (* optional param *) | T_COLON -> - let id = Parse.identifier env in - let param = function_param_with_id env id in - ignore (Expect.maybe env T_COMMA); - ParamList (function_param_list_without_parens env [param]) + ParamList (function_param_list_without_parens env []) | _ -> - let id = type_identifier env in - Type ( - generic_type_with_identifier env id - |> postfix_with env - |> anon_function_without_parens_with env - |> intersection_with env - |> union_with env - ) + let id = type_identifier env in + Type + ( generic_type_with_identifier env id + |> postfix_with env + |> anon_function_without_parens_with env + |> intersection_with env + |> union_with env ) and function_or_group env = let start_loc = Peek.loc env in match with_loc param_list_or_type env with - | loc, ParamList params -> function_with_params env start_loc None (loc, params) - | _, Type _type -> _type + | (loc, ParamList params) -> function_with_params env start_loc None (loc, params) + | (_, Type _type) -> _type and _function env = let start_loc = Peek.loc env in - let tparams = type_parameter_declaration ~allow_default:false env in + let tparams = type_params_remove_trailing env (type_params env) in let params = function_param_list env in function_with_params env start_loc tparams params - and function_with_params env start_loc tparams (params: Loc.t Ast.Type.Function.Params.t) = - with_loc ~start_loc (fun env -> - Expect.token env T_ARROW; - let return = _type env in - Type.(Function { Function.params; return; tparams }) - ) env + and function_with_params + env start_loc tparams (params : (Loc.t, Loc.t) Ast.Type.Function.Params.t) = + with_loc + ~start_loc + (fun env -> + Expect.token env T_ARROW; + let return = _type env in + Type.(Function { Function.params; return; tparams; comments = None })) + env and _object = let methodish env start_loc tparams = - with_loc ~start_loc (fun env -> - let params = function_param_list env in - Expect.token env T_COLON; - let return = _type env in - { Type.Function. - params; - return; - tparams; - } - ) env - - in let method_property env start_loc static key = - let tparams = type_parameter_declaration ~allow_default:false env in + with_loc + ~start_loc + (fun env -> + let params = function_param_list env in + Expect.token env T_COLON; + let return = _type env in + { Type.Function.params; return; tparams; comments = None }) + env + in + let method_property env start_loc static key ~leading = + let key = object_key_remove_trailing env key in + let tparams = type_params_remove_trailing env (type_params env) in let value = methodish env start_loc tparams in - let value = fst value, Type.Function (snd value) in - Type.Object.(Property (fst value, Property.({ - key; - value = Init value; - optional = false; - static = static <> None; - proto = false; - _method = true; - variance = None; - }))) - - in let call_property env start_loc static = - let prop = with_loc ~start_loc (fun env -> - let tparams = type_parameter_declaration ~allow_default:false env in - let value = methodish env (Peek.loc env) tparams in - Type.Object.CallProperty.({ - value; - static = static <> None; - }) - ) env in + let value = (fst value, Type.Function (snd value)) in + Type.Object.( + Property + ( fst value, + { + Property.key; + value = Property.Init value; + optional = false; + static = static <> None; + proto = false; + _method = true; + variance = None; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + } )) + in + let call_property env start_loc static ~leading = + let prop = + with_loc + ~start_loc + (fun env -> + let start_loc = Peek.loc env in + let tparams = type_params_remove_trailing env (type_params env) in + let value = methodish env start_loc tparams in + Type.Object.CallProperty. + { + value; + static = static <> None; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + }) + env + in Type.Object.CallProperty prop - - in let init_property env start_loc ~variance ~static ~proto key = + in + let init_property env start_loc ~variance ~static ~proto ~leading key = ignore proto; - if not (should_parse_types env) - then error env Error.UnexpectedTypeAnnotation; - let prop = with_loc ~start_loc (fun env -> - let optional = Expect.maybe env T_PLING in - Expect.token env T_COLON; - let value = _type env in - Type.Object.Property.({ - key; - value = Init value; - optional; - static = static <> None; - proto = proto <> None; - _method = false; - variance; - }) - ) env in + if not (should_parse_types env) then error env Parse_error.UnexpectedTypeAnnotation; + let prop = + with_loc + ~start_loc + (fun env -> + let optional = Eat.maybe env T_PLING in + Expect.token env T_COLON; + let value = _type env in + Type.Object.Property. + { + key; + value = Init value; + optional; + static = static <> None; + proto = proto <> None; + _method = false; + variance; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + }) + env + in Type.Object.Property prop - - in let getter_or_setter ~is_getter env start_loc static key = - let prop = with_loc ~start_loc (fun env -> - let value = methodish env start_loc None in - let (key_loc, key) = key in - let (_, { Type.Function.params; _ }) = value in - begin match is_getter, params with - | true, (_, { Type.Function.Params.params = []; rest = None }) -> () - | false, (_, { Type.Function.Params.rest = Some _; _ }) -> - (* rest params don't make sense on a setter *) - error_at env (key_loc, Error.SetterArity) - | false, (_, { Type.Function.Params.params = [_]; _ }) -> () - | true, _ -> error_at env (key_loc, Error.GetterArity) - | false, _ -> error_at env (key_loc, Error.SetterArity) - end; - Type.Object.Property.({ - key; - value = if is_getter then Get value else Set value; - optional = false; - static = static <> None; - proto = false; - _method = false; - variance = None; - }) - ) env in + in + let getter_or_setter ~is_getter ~leading env start_loc static key = + let prop = + with_loc + ~start_loc + (fun env -> + let (key_loc, key) = key in + let key = object_key_remove_trailing env key in + let value = methodish env start_loc None in + let (_, { Type.Function.params; _ }) = value in + begin + match (is_getter, params) with + | (true, (_, { Type.Function.Params.this_ = Some _; _ })) -> + error_at env (key_loc, Parse_error.GetterMayNotHaveThisParam) + | (false, (_, { Type.Function.Params.this_ = Some _; _ })) -> + error_at env (key_loc, Parse_error.SetterMayNotHaveThisParam) + | ( true, + (_, { Type.Function.Params.params = []; rest = None; this_ = None; comments = _ }) + ) -> + () + | (false, (_, { Type.Function.Params.rest = Some _; _ })) -> + (* rest params don't make sense on a setter *) + error_at env (key_loc, Parse_error.SetterArity) + | (false, (_, { Type.Function.Params.params = [_]; _ })) -> () + | (true, _) -> error_at env (key_loc, Parse_error.GetterArity) + | (false, _) -> error_at env (key_loc, Parse_error.SetterArity) + end; + Type.Object.Property. + { + key; + value = + ( if is_getter then + Get value + else + Set value ); + optional = false; + static = static <> None; + proto = false; + _method = false; + variance = None; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + }) + env + in Type.Object.Property prop - - in let indexer_property env start_loc static variance = - let indexer = with_loc ~start_loc (fun env -> - (* Note: T_LBRACKET has already been consumed *) - let id = - if Peek.ith_token ~i:1 env = T_COLON - then begin - let id = identifier_name env in + in + let indexer_property env start_loc static variance ~leading = + let indexer = + with_loc + ~start_loc + (fun env -> + let leading = leading @ Peek.comments env in + Expect.token env T_LBRACKET; + let id = + if Peek.ith_token ~i:1 env = T_COLON then ( + let id = identifier_name env in + Expect.token env T_COLON; + Some id + ) else + None + in + let key = _type env in + Expect.token env T_RBRACKET; + let trailing = Eat.trailing_comments env in Expect.token env T_COLON; - Some id - end else None in - let key = _type env in - Expect.token env T_RBRACKET; - Expect.token env T_COLON; - let value = _type env in - { Type.Object.Indexer. - id; - key; - value; - static = static <> None; - variance; - } - ) env in + let value = _type env in + { + Type.Object.Indexer.id; + key; + value; + static = static <> None; + variance; + comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + }) + env + in Type.Object.Indexer indexer - - in let internal_slot env start_loc static = - let islot = with_loc ~start_loc (fun env -> - (* Note: First T_LBRACKET has already been consumed *) - Expect.token env T_LBRACKET; - let id = identifier_name env in - Expect.token env T_RBRACKET; - Expect.token env T_RBRACKET; - let optional, _method, value = match Peek.token env with - | T_LESS_THAN - | T_LPAREN -> - let tparams = type_parameter_declaration ~allow_default:false env in - let value = - let fn_loc, fn = methodish env start_loc tparams in - fn_loc, Type.Function fn - in - false, true, value - | _ -> - let optional = Expect.maybe env T_PLING in - Expect.token env T_COLON; - let value = _type env in - optional, false, value - in - { Type.Object.InternalSlot. - id; - value; - optional; - static = static <> None; - _method; - } - ) env in + in + let internal_slot env start_loc static ~leading = + let islot = + with_loc + ~start_loc + (fun env -> + let leading = leading @ Peek.comments env in + Expect.token env T_LBRACKET; + Expect.token env T_LBRACKET; + let id = identifier_name env in + Expect.token env T_RBRACKET; + Expect.token env T_RBRACKET; + let (optional, _method, value, trailing) = + match Peek.token env with + | T_LESS_THAN + | T_LPAREN -> + let tparams = type_params_remove_trailing env (type_params env) in + let value = + let (fn_loc, fn) = methodish env start_loc tparams in + (fn_loc, Type.Function fn) + in + (false, true, value, []) + | _ -> + let optional = Eat.maybe env T_PLING in + let trailing = Eat.trailing_comments env in + Expect.token env T_COLON; + let value = _type env in + (optional, false, value, trailing) + in + { + Type.Object.InternalSlot.id; + value; + optional; + static = static <> None; + _method; + comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + }) + env + in Type.Object.InternalSlot islot - - in let spread_property env start_loc = - let spread = with_loc ~start_loc (fun env -> - Expect.token env T_ELLIPSIS; - { Type.Object.SpreadProperty. - argument = _type env; - } - ) env in + (* Expects the T_ELLIPSIS has already been eaten *) + in + let spread_property env start_loc ~leading = + let spread = + with_loc + ~start_loc + (fun env -> + { + Type.Object.SpreadProperty.argument = _type env; + comments = Flow_ast_utils.mk_comments_opt ~leading (); + }) + env + in Type.Object.SpreadProperty spread - - in let semicolon exact env = + in + let semicolon exact env = match Peek.token env with - | T_COMMA | T_SEMICOLON -> Eat.token env + | T_COMMA + | T_SEMICOLON -> + Eat.token env | T_RCURLYBAR when exact -> () | T_RCURLY when not exact -> () | _ -> error_unexpected env + in + let error_unexpected_variance env = function + | Some (loc, _) -> error_at env (loc, Parse_error.UnexpectedVariance) + | None -> () + in + let error_unexpected_proto env = function + | Some loc -> error_at env (loc, Parse_error.UnexpectedProto) + | None -> () + in + let error_invalid_property_name env is_class static key = + let is_static = static <> None in + let is_constructor = String.equal "constructor" in + let is_prototype = String.equal "prototype" in + match key with + | Expression.Object.Property.Identifier (loc, { Identifier.name; comments = _ }) + when is_class && (is_constructor name || (is_static && is_prototype name)) -> + error_at + env + (loc, Parse_error.InvalidFieldName { name; static = is_static; private_ = false }) + | _ -> () + in + let rec properties + ~is_class ~allow_inexact ~allow_spread ~exact env ((props, inexact, internal) as acc) = + (* no `static ...A` *) + assert (not (is_class && allow_spread)); - in let error_unexpected_variance env = function - | Some (loc, _) -> error_at env (loc, Error.UnexpectedVariance) - | None -> () - - in let error_unexpected_proto env = function - | Some loc -> error_at env (loc, Error.UnexpectedProto) - | None -> () + (* allow_inexact implies allow_spread *) + assert ((not allow_inexact) || allow_spread); - in let rec properties ~allow_static ~allow_proto ~allow_spread ~exact env acc = - assert (not (allow_static && allow_spread)); (* no `static ...A` *) let start_loc = Peek.loc env in match Peek.token env with - | T_EOF -> List.rev acc - | T_RCURLYBAR when exact -> List.rev acc - | T_RCURLY when not exact -> List.rev acc + | T_EOF -> (List.rev props, inexact, internal) + | T_RCURLYBAR when exact -> (List.rev props, inexact, internal) + | T_RCURLY when not exact -> (List.rev props, inexact, internal) | T_ELLIPSIS when allow_spread -> - let prop = spread_property env start_loc in - semicolon exact env; - properties ~allow_static ~allow_proto ~allow_spread ~exact env (prop::acc) + let leading = Peek.comments env in + Eat.token env; + begin + match Peek.token env with + | T_COMMA + | T_SEMICOLON + | T_RCURLY + | T_RCURLYBAR -> + semicolon exact env; + begin + match Peek.token env with + | T_RCURLY when allow_inexact -> (List.rev props, true, leading) + | T_RCURLYBAR -> + error_at env (start_loc, Parse_error.InexactInsideExact); + (List.rev props, inexact, internal) + | _ -> + error_at env (start_loc, Parse_error.UnexpectedExplicitInexactInObject); + properties ~is_class ~allow_inexact ~allow_spread ~exact env acc + end + | _ -> + let prop = spread_property env start_loc leading in + semicolon exact env; + properties + ~is_class + ~allow_inexact + ~allow_spread + ~exact + env + (prop :: props, inexact, internal) + end + (* In this case, allow_spread is false, so we may assume allow_inexact is false based on our + * assertion at the top of this function. Thus, any T_ELLIPSIS here is not allowed. + *) + | T_ELLIPSIS -> + Eat.token env; + begin + match Peek.token env with + | T_COMMA + | T_SEMICOLON + | T_RCURLY + | T_RCURLYBAR -> + error_at env (start_loc, Parse_error.InexactInsideNonObject); + semicolon exact env; + properties ~is_class ~allow_inexact ~allow_spread ~exact env acc + | _ -> + error_list env (Peek.errors env); + error_at env (start_loc, Parse_error.UnexpectedSpreadType); + + (* It's likely the user is trying to spread something here, so we can + * eat what they try to spread to try to continue parsing the remaining + * properties. + *) + Eat.token env; + semicolon exact env; + properties ~is_class ~allow_inexact ~allow_spread ~exact env acc + end | _ -> - let prop = property env start_loc ~allow_static ~allow_proto - ~variance:None ~static:None ~proto:None in + let prop = + property + env + start_loc + ~is_class + ~allow_static:is_class + ~allow_proto:is_class + ~variance:None + ~static:None + ~proto:None + ~leading:[] + in semicolon exact env; - properties ~allow_static ~allow_proto ~allow_spread ~exact env (prop::acc) - - and property env ~allow_static ~allow_proto ~variance ~static ~proto start_loc = + properties + ~is_class + ~allow_inexact + ~allow_spread + ~exact + env + (prop :: props, inexact, internal) + and property + env ~is_class ~allow_static ~allow_proto ~variance ~static ~proto ~leading start_loc = match Peek.token env with - | T_PLUS when variance = None -> - let loc = Peek.loc env in - Eat.token env; - let variance = Some (loc, Variance.Plus) in - property env ~allow_static:false ~allow_proto:false ~variance ~static ~proto start_loc - | T_MINUS when variance = None -> - let loc = Peek.loc env in - Eat.token env; - let variance = Some (loc, Variance.Minus) in - property env ~allow_static:false ~allow_proto:false ~variance ~static ~proto start_loc + | T_PLUS + | T_MINUS + when variance = None -> + let variance = maybe_variance env in + property + env + ~is_class + ~allow_static:false + ~allow_proto:false + ~variance + ~static + ~proto + ~leading + start_loc | T_STATIC when allow_static -> - assert (variance = None); (* if we parsed variance, allow_static = false *) + assert (variance = None); + + (* if we parsed variance, allow_static = false *) let static = Some (Peek.loc env) in + let leading = leading @ Peek.comments env in Eat.token env; - property env ~allow_static:false ~allow_proto:false ~variance ~static ~proto start_loc + property + env + ~is_class + ~allow_static:false + ~allow_proto:false + ~variance + ~static + ~proto + ~leading + start_loc | T_IDENTIFIER { raw = "proto"; _ } when allow_proto -> - assert (variance = None); (* if we parsed variance, allow_proto = false *) + assert (variance = None); + + (* if we parsed variance, allow_proto = false *) let proto = Some (Peek.loc env) in + let leading = leading @ Peek.comments env in Eat.token env; - property env ~allow_static:false ~allow_proto:false ~variance ~static ~proto start_loc + property + env + ~is_class + ~allow_static:false + ~allow_proto:false + ~variance + ~static + ~proto + ~leading + start_loc | T_LBRACKET -> error_unexpected_proto env proto; - Expect.token env T_LBRACKET; - (match Peek.token env with + (match Peek.ith_token ~i:1 env with | T_LBRACKET -> error_unexpected_variance env variance; - internal_slot env start_loc static - | _ -> - indexer_property env start_loc static variance) + internal_slot env start_loc static ~leading + | _ -> indexer_property env start_loc static variance ~leading) | T_LESS_THAN | T_LPAREN -> (* Note that `static(): void` is a static callable property if we successfully parsed the static modifier above. *) error_unexpected_proto env proto; error_unexpected_variance env variance; - call_property env start_loc static + call_property env start_loc static ~leading | token -> - match static, proto, token with - | Some _, Some _, _ -> failwith "Can not have both `static` and `proto`" - | Some static_loc, None, (T_PLING | T_COLON) -> + (match (static, proto, token) with + | (Some _, Some _, _) -> failwith "Can not have both `static` and `proto`" + | (Some static_loc, None, (T_PLING | T_COLON)) -> (* We speculatively parsed `static` as a static modifier, but now that we've parsed the next token, we changed our minds and want to parse `static` as the key of a named property. *) - let key = Expression.Object.Property.Identifier ( - static_loc, - "static" - ) in + let key = + Expression.Object.Property.Identifier + (Flow_ast_utils.ident_of_source + (static_loc, "static") + ?comments:(Flow_ast_utils.mk_comments_opt ~leading ())) + in let static = None in - init_property env start_loc ~variance ~static ~proto key - | None, Some proto_loc, (T_PLING | T_COLON) -> + init_property env start_loc ~variance ~static ~proto ~leading:[] key + | (None, Some proto_loc, (T_PLING | T_COLON)) -> (* We speculatively parsed `proto` as a proto modifier, but now that we've parsed the next token, we changed our minds and want to parse `proto` as the key of a named property. *) - let key = Expression.Object.Property.Identifier ( - proto_loc, - "proto" - ) in + let key = + Expression.Object.Property.Identifier + (Flow_ast_utils.ident_of_source + (proto_loc, "proto") + ?comments:(Flow_ast_utils.mk_comments_opt ~leading ())) + in let proto = None in - init_property env start_loc ~variance ~static ~proto key + init_property env start_loc ~variance ~static ~proto ~leading:[] key | _ -> let object_key env = Eat.push_lex_mode env Lex_mode.NORMAL; @@ -627,188 +995,322 @@ module Type (Parse: Parser_common.PARSER) : TYPE = struct Eat.pop_lex_mode env; result in - match object_key env with - | _, (Expression.Object.Property.Identifier - (_, ("get" | "set" as name)) as key) -> - begin match Peek.token env with + let leading_key = Peek.comments env in + (match object_key env with + | ( _, + ( Expression.Object.Property.Identifier + (_, { Identifier.name = ("get" | "set") as name; comments = _ }) as key ) ) -> + begin + match Peek.token env with | T_LESS_THAN | T_LPAREN -> error_unexpected_proto env proto; error_unexpected_variance env variance; - method_property env start_loc static key + method_property env start_loc static key leading | T_COLON | T_PLING -> - init_property env start_loc ~variance ~static ~proto key + init_property env start_loc ~variance ~static ~proto ~leading key | _ -> + ignore (object_key_remove_trailing env key); let key = object_key env in let is_getter = name = "get" in + let leading = leading @ leading_key in error_unexpected_proto env proto; error_unexpected_variance env variance; - getter_or_setter ~is_getter env start_loc static key - end - | _, key -> - begin match Peek.token env with + getter_or_setter ~is_getter ~leading env start_loc static key + end + | (_, key) -> + begin + match Peek.token env with | T_LESS_THAN | T_LPAREN -> error_unexpected_proto env proto; error_unexpected_variance env variance; - method_property env start_loc static key + method_property env start_loc static key leading | _ -> - init_property env start_loc ~variance ~static ~proto key - end - - in fun ~allow_static ~allow_proto ~allow_exact ~allow_spread env -> + error_invalid_property_name env is_class static key; + init_property env start_loc ~variance ~static ~proto ~leading key + end)) + in + fun ~is_class ~allow_exact ~allow_spread env -> let exact = allow_exact && Peek.token env = T_LCURLYBAR in - with_loc (fun env -> - Expect.token env (if exact then T_LCURLYBAR else T_LCURLY); - let properties = properties ~allow_static ~allow_proto ~exact ~allow_spread env [] in - Expect.token env (if exact then T_RCURLYBAR else T_RCURLY); - { Type.Object.exact; properties; } - ) env + let allow_inexact = allow_exact && not exact in + with_loc + (fun env -> + let leading = Peek.comments env in + Expect.token + env + ( if exact then + T_LCURLYBAR + else + T_LCURLY ); + let (properties, inexact, internal) = + let env = with_no_anon_function_type false env in + properties ~is_class ~allow_inexact ~exact ~allow_spread env ([], false, []) + in + let internal = internal @ Peek.comments env in + Expect.token + env + ( if exact then + T_RCURLYBAR + else + T_RCURLY ); + let trailing = Eat.trailing_comments env in + + (* inexact = true iff `...` was used to indicate inexactnes *) + { + Type.Object.exact; + properties; + inexact; + comments = Flow_ast_utils.mk_comments_with_internal_opt ~leading ~trailing ~internal; + }) + env and interface_helper = let rec supers env acc = let super = generic env in - let acc = super::acc in + let acc = super :: acc in match Peek.token env with | T_COMMA -> - Expect.token env T_COMMA; - supers env acc + Expect.token env T_COMMA; + supers env acc | _ -> List.rev acc - - in fun env -> - let extends = if Peek.token env = T_EXTENDS - then begin - Expect.token env T_EXTENDS; - supers env [] - end else [] in - let body = _object env - ~allow_exact:false ~allow_spread:false - ~allow_static:false ~allow_proto:false + in + fun env -> + let extends = + if Peek.token env = T_EXTENDS then ( + Expect.token env T_EXTENDS; + let extends = supers env [] in + generic_type_list_remove_trailing env extends + ) else + [] in - { Type.Interface.extends; body } + let body = _object env ~allow_exact:false ~allow_spread:false ~is_class:false in + (extends, body) and type_identifier env = - let loc, name = identifier_name env in + let (loc, { Identifier.name; comments }) = identifier_name env in if is_reserved_type name then error_at env (loc, Parse_error.UnexpectedReservedType); - loc, name - - and bounded_type env = with_loc (fun env -> - let name = type_identifier env in - let bound = if Peek.token env = T_COLON then Some (annotation env) else None in - name, bound - ) env - - and type_parameter_declaration = - let rec params env ~allow_default ~require_default acc = Type.ParameterDeclaration.TypeParam.( - let variance = variance env in - let loc, (name, bound) = bounded_type env in - let default, require_default = match allow_default, Peek.token env with - | false, _ -> None, false - | true, T_ASSIGN -> - Eat.token env; - Some (_type env), true - | true, _ -> - if require_default - then error_at env (loc, Error.MissingTypeParamDefault); - None, require_default in - let param = loc, { - name; - bound; - variance; - default; - } in - let acc = param::acc in - match Peek.token env with - | T_EOF - | T_GREATER_THAN -> List.rev acc - | _ -> - Expect.token env T_COMMA; - if Peek.token env = T_GREATER_THAN - then List.rev acc - else params env ~allow_default ~require_default acc - ) - in fun ~allow_default env -> - if Peek.token env = T_LESS_THAN - then begin - if not (should_parse_types env) - then error env Error.UnexpectedTypeAnnotation; - Some (with_loc (fun env -> - Expect.token env T_LESS_THAN; - let params = params env ~allow_default ~require_default:false [] in - Expect.token env T_GREATER_THAN; - params - ) env) - end else None - - and type_parameter_instantiation = + (loc, { Identifier.name; comments }) + + and bounded_type env = + with_loc + (fun env -> + let name = type_identifier env in + let bound = + if Peek.token env = T_COLON then + Ast.Type.Available (annotation env) + else + Ast.Type.Missing (Peek.loc_skip_lookahead env) + in + (name, bound)) + env + + and type_params = + let rec params env ~require_default acc = + Type.TypeParam.( + let (loc, (variance, name, bound, default, require_default)) = + with_loc + (fun env -> + let variance = maybe_variance env in + let (loc, (name, bound)) = bounded_type env in + let (default, require_default) = + match Peek.token env with + | T_ASSIGN -> + Eat.token env; + (Some (_type env), true) + | _ -> + if require_default then error_at env (loc, Parse_error.MissingTypeParamDefault); + (None, require_default) + in + (variance, name, bound, default, require_default)) + env + in + let param = (loc, { name; bound; variance; default }) in + let acc = param :: acc in + match Peek.token env with + | T_EOF + | T_GREATER_THAN -> + List.rev acc + | _ -> + Expect.token env T_COMMA; + if Peek.token env = T_GREATER_THAN then + List.rev acc + else + params env ~require_default acc) + in + fun env -> + if Peek.token env = T_LESS_THAN then ( + if not (should_parse_types env) then error env Parse_error.UnexpectedTypeAnnotation; + Some + (with_loc + (fun env -> + let leading = Peek.comments env in + Expect.token env T_LESS_THAN; + let params = params env ~require_default:false [] in + let internal = Peek.comments env in + Expect.token env T_GREATER_THAN; + let trailing = Eat.trailing_comments env in + { + Type.TypeParams.params; + comments = + Flow_ast_utils.mk_comments_with_internal_opt ~leading ~trailing ~internal; + }) + env) + ) else + None + + and type_args = let rec args env acc = match Peek.token env with | T_EOF - | T_GREATER_THAN -> List.rev acc + | T_GREATER_THAN -> + List.rev acc | _ -> - let acc = (_type env)::acc in - if Peek.token env <> T_GREATER_THAN - then Expect.token env T_COMMA; + let acc = _type env :: acc in + if Peek.token env <> T_GREATER_THAN then Expect.token env T_COMMA; args env acc - - in fun env -> - if Peek.token env = T_LESS_THAN then - Some (with_loc (fun env -> - Expect.token env T_LESS_THAN; - let args = args env [] in - Expect.token env T_GREATER_THAN; - args - ) env) - else None + in + fun env -> + if Peek.token env = T_LESS_THAN then + Some + (with_loc + (fun env -> + let leading = Peek.comments env in + Expect.token env T_LESS_THAN; + let env = with_no_anon_function_type false env in + let arguments = args env [] in + let internal = Peek.comments env in + Expect.token env T_GREATER_THAN; + let trailing = Eat.trailing_comments env in + { + Type.TypeArgs.arguments; + comments = + Flow_ast_utils.mk_comments_with_internal_opt ~leading ~trailing ~internal; + }) + env) + else + None and generic env = raw_generic_with_identifier env (type_identifier env) and raw_generic_with_identifier = let rec identifier env (q_loc, qualification) = - if Peek.token env = T_PERIOD - then begin - let loc, q = with_loc ~start_loc:q_loc (fun env -> - Expect.token env T_PERIOD; - let id = type_identifier env in - { Type.Generic.Identifier. - qualification; - id; - } - ) env in + if Peek.token env = T_PERIOD then + let (loc, q) = + with_loc + ~start_loc:q_loc + (fun env -> + Expect.token env T_PERIOD; + let id = type_identifier env in + { Type.Generic.Identifier.qualification; id }) + env + in let qualification = Type.Generic.Identifier.Qualified (loc, q) in identifier env (loc, qualification) - end else (q_loc, qualification) - - in fun env id -> - with_loc ~start_loc:(fst id) (fun env -> - let id = fst id, Type.Generic.Identifier.Unqualified id in - let _id_loc, id = identifier env id in - let targs = type_parameter_instantiation env in - { Type.Generic.id; targs } - ) env + else + (q_loc, qualification) + in + fun env id -> + with_loc + ~start_loc:(fst id) + (fun env -> + let id = (fst id, Type.Generic.Identifier.Unqualified id) in + let id = + let (_id_loc, id) = identifier env id in + if Peek.token env <> T_LESS_THAN then + id + else + let { remove_trailing; _ } = trailing_and_remover env in + remove_trailing id (fun remover id -> remover#generic_identifier_type id) + in + let targs = type_args env in + { Type.Generic.id; targs; comments = None }) + env and generic_type_with_identifier env id = - let loc, generic = raw_generic_with_identifier env id in - loc, Type.Generic generic + let (loc, generic) = raw_generic_with_identifier env id in + (loc, Type.Generic generic) and annotation_opt env = match Peek.token env with - | T_COLON -> Some (annotation env) - | _ -> None + | T_COLON -> Type.Available (annotation env) + | _ -> Type.Missing (Peek.loc_skip_lookahead env) + + and add_comments (loc, t) leading trailing = + let merge_comments inner = + Flow_ast_utils.merge_comments + ~inner + ~outer:(Flow_ast_utils.mk_comments_opt ~leading ~trailing ()) + in + let merge_comments_with_internal inner = + Flow_ast_utils.merge_comments_with_internal + ~inner + ~outer:(Flow_ast_utils.mk_comments_opt ~leading ~trailing ()) + in + let open Ast.Type in + ( loc, + match t with + | Any comments -> Any (merge_comments comments) + | Mixed comments -> Mixed (merge_comments comments) + | Empty comments -> Empty (merge_comments comments) + | Void comments -> Void (merge_comments comments) + | Null comments -> Null (merge_comments comments) + | Number comments -> Number (merge_comments comments) + | BigInt comments -> BigInt (merge_comments comments) + | String comments -> String (merge_comments comments) + | Boolean comments -> Boolean (merge_comments comments) + | Symbol comments -> Symbol (merge_comments comments) + | Exists comments -> Exists (merge_comments comments) + | Nullable ({ Nullable.comments; _ } as t) -> + Nullable { t with Nullable.comments = merge_comments comments } + | Function ({ Function.comments; _ } as t) -> + Function { t with Function.comments = merge_comments comments } + | Object ({ Object.comments; _ } as t) -> + Object { t with Object.comments = merge_comments_with_internal comments } + | Interface ({ Interface.comments; _ } as t) -> + Interface { t with Interface.comments = merge_comments comments } + | Array ({ Array.comments; _ } as t) -> + Array { t with Array.comments = merge_comments comments } + | Generic ({ Generic.comments; _ } as t) -> + Generic { t with Generic.comments = merge_comments comments } + | Union ({ Union.comments; _ } as t) -> + Union { t with Union.comments = merge_comments comments } + | Intersection ({ Intersection.comments; _ } as t) -> + Intersection { t with Intersection.comments = merge_comments comments } + | Typeof ({ Typeof.comments; _ } as t) -> + Typeof { t with Typeof.comments = merge_comments comments } + | Tuple ({ Tuple.comments; _ } as t) -> + Tuple { t with Tuple.comments = merge_comments comments } + | StringLiteral ({ StringLiteral.comments; _ } as t) -> + StringLiteral { t with StringLiteral.comments = merge_comments comments } + | NumberLiteral ({ NumberLiteral.comments; _ } as t) -> + NumberLiteral { t with NumberLiteral.comments = merge_comments comments } + | BigIntLiteral ({ BigIntLiteral.comments; _ } as t) -> + BigIntLiteral { t with BigIntLiteral.comments = merge_comments comments } + | BooleanLiteral ({ BooleanLiteral.comments; _ } as t) -> + BooleanLiteral { t with BooleanLiteral.comments = merge_comments comments } ) - let predicate = with_loc (fun env -> - Expect.token env T_CHECKS; - if Peek.token env = T_LPAREN then begin - Expect.token env T_LPAREN; - Eat.push_lex_mode env Lex_mode.NORMAL; - let exp = Parse.conditional env in - Eat.pop_lex_mode env; - Expect.token env T_RPAREN; - Ast.Type.Predicate.Declared exp - end else - Ast.Type.Predicate.Inferred - ) + let predicate = + with_loc (fun env -> + let open Ast.Type.Predicate in + let leading = Peek.comments env in + Expect.token env T_CHECKS; + if Peek.token env = T_LPAREN then ( + let leading = leading @ Peek.comments env in + Expect.token env T_LPAREN; + Eat.push_lex_mode env Lex_mode.NORMAL; + let exp = Parse.conditional env in + Eat.pop_lex_mode env; + Expect.token env T_RPAREN; + let trailing = Eat.trailing_comments env in + { kind = Declared exp; comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing () } + ) else + let trailing = Eat.trailing_comments env in + { + kind = Ast.Type.Predicate.Inferred; + comments = Flow_ast_utils.mk_comments_opt ~leading ~trailing (); + }) let predicate_opt env = let env = with_no_anon_function_type false env in @@ -817,15 +1319,22 @@ module Type (Parse: Parser_common.PARSER) : TYPE = struct | _ -> None let annotation_and_predicate_opt env = - match Peek.token env, Peek.ith_token ~i:1 env with - | T_COLON, T_CHECKS -> + let open Ast.Type in + match (Peek.token env, Peek.ith_token ~i:1 env) with + | (T_COLON, T_CHECKS) -> Expect.token env T_COLON; - (None, predicate_opt env) - | T_COLON, _ -> - let annotation = annotation_opt env in - let predicate = predicate_opt env in - (annotation, predicate) - | _ -> None, None + (Missing (Peek.loc_skip_lookahead env), predicate_opt env) + | (T_COLON, _) -> + let annotation = + let annotation = annotation_opt env in + if Peek.token env = T_CHECKS then + type_annotation_hint_remove_trailing env annotation + else + annotation + in + let predicate = predicate_opt env in + (annotation, predicate) + | _ -> (Missing (Peek.loc_skip_lookahead env), None) let wrap f env = let env = env |> with_strict true in @@ -835,19 +1344,26 @@ module Type (Parse: Parser_common.PARSER) : TYPE = struct ret let _type = wrap _type + let type_identifier = wrap type_identifier - let type_parameter_declaration_with_defaults = - wrap (type_parameter_declaration ~allow_default:true) - let type_parameter_declaration = - wrap (type_parameter_declaration ~allow_default:false) - let type_parameter_instantiation = wrap type_parameter_instantiation - let _object ~allow_static ~allow_proto env = - wrap (_object ~allow_static ~allow_proto ~allow_exact:false ~allow_spread:false) env + + let type_params = wrap type_params + + let type_args = wrap type_args + + let _object ~is_class env = wrap (_object ~is_class ~allow_exact:false ~allow_spread:false) env + let interface_helper = wrap interface_helper + let function_param_list = wrap function_param_list + let annotation = wrap annotation + let annotation_opt = wrap annotation_opt + let predicate_opt = wrap predicate_opt + let annotation_and_predicate_opt = wrap annotation_and_predicate_opt + let generic = wrap generic end diff --git a/lib/yarn.lock b/lib/yarn.lock deleted file mode 100644 index d1ea139..0000000 --- a/lib/yarn.lock +++ /dev/null @@ -1,19 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -ast-types@0.8.18: - version "0.8.18" - resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.8.18.tgz#c8b98574898e8914e9d8de74b947564a9fe929af" - -colors@>=0.6.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/colors/-/colors-1.1.2.tgz#168a4701756b6a7f51a12ce0c97bfa28c084ed63" - -esprima-fb@15001.1001.0-dev-harmony-fb: - version "15001.1001.0-dev-harmony-fb" - resolved "https://registry.yarnpkg.com/esprima-fb/-/esprima-fb-15001.1001.0-dev-harmony-fb.tgz#43beb57ec26e8cf237d3dd8b33e42533577f2659" - -minimist@>=0.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" diff --git a/package.json b/package.json index 2e77d54..82078b1 100644 --- a/package.json +++ b/package.json @@ -18,13 +18,17 @@ "@opam/wtf8": "*", "@opam/dune": "*", "@opam/ocaml-migrate-parsetree": "*", - "ocaml": ">= 4.4.0 < 4.8.0" + "ocaml": "4.10.2000", + "@opam/ppx_tools_versioned": "*", + "@opam/sedlex": "*", + "@opam/ppx_gen_rec": "*", + "@opam/ppx_deriving": "*" }, "notes": { "@opam/sedlex": ">= 1.99.4 < 2.0" }, "devDependencies": { "@opam/merlin": "*", - "ocaml": "4.7.1004" + "ocaml": "4.10.2000" } } diff --git a/ppx_tools_versioned.5.2/.depend b/ppx_tools_versioned.5.2/.depend deleted file mode 100644 index 560d8b0..0000000 --- a/ppx_tools_versioned.5.2/.depend +++ /dev/null @@ -1,62 +0,0 @@ -ast_convenience_402.cmo : ast_convenience_402.cmi -ast_convenience_402.cmx : ast_convenience_402.cmi -ast_convenience_402.cmi : -ast_convenience_403.cmo : ast_convenience_403.cmi -ast_convenience_403.cmx : ast_convenience_403.cmi -ast_convenience_403.cmi : -ast_convenience_404.cmo : ast_convenience_404.cmi -ast_convenience_404.cmx : ast_convenience_404.cmi -ast_convenience_404.cmi : -ast_convenience_405.cmo : ast_convenience_405.cmi -ast_convenience_405.cmx : ast_convenience_405.cmi -ast_convenience_405.cmi : -ast_convenience_406.cmo : ast_convenience_406.cmi -ast_convenience_406.cmx : ast_convenience_406.cmi -ast_convenience_406.cmi : -ast_lifter_402.cmo : -ast_lifter_402.cmx : -ast_lifter_403.cmo : -ast_lifter_403.cmx : -ast_lifter_404.cmo : -ast_lifter_404.cmx : -ast_lifter_405.cmo : -ast_lifter_405.cmx : -ast_lifter_406.cmo : -ast_lifter_406.cmx : -ast_mapper_class_402.cmo : ast_mapper_class_402.cmi -ast_mapper_class_402.cmx : ast_mapper_class_402.cmi -ast_mapper_class_402.cmi : -ast_mapper_class_403.cmo : ast_mapper_class_403.cmi -ast_mapper_class_403.cmx : ast_mapper_class_403.cmi -ast_mapper_class_403.cmi : -ast_mapper_class_404.cmo : ast_mapper_class_404.cmi -ast_mapper_class_404.cmx : ast_mapper_class_404.cmi -ast_mapper_class_404.cmi : -ast_mapper_class_405.cmo : ast_mapper_class_405.cmi -ast_mapper_class_405.cmx : ast_mapper_class_405.cmi -ast_mapper_class_405.cmi : -ast_mapper_class_406.cmo : ast_mapper_class_406.cmi -ast_mapper_class_406.cmx : ast_mapper_class_406.cmi -ast_mapper_class_406.cmi : -ppx_metaquot_402.cmo : ast_lifter_402.cmo ast_convenience_402.cmi -ppx_metaquot_402.cmx : ast_lifter_402.cmx ast_convenience_402.cmx -ppx_metaquot_403.cmo : ast_lifter_403.cmo ast_convenience_403.cmi -ppx_metaquot_403.cmx : ast_lifter_403.cmx ast_convenience_403.cmx -ppx_metaquot_404.cmo : ast_lifter_404.cmo ast_convenience_404.cmi -ppx_metaquot_404.cmx : ast_lifter_404.cmx ast_convenience_404.cmx -ppx_metaquot_405.cmo : ast_lifter_405.cmo ast_convenience_405.cmi -ppx_metaquot_405.cmx : ast_lifter_405.cmx ast_convenience_405.cmx -ppx_metaquot_406.cmo : ast_lifter_406.cmo ast_convenience_406.cmi -ppx_metaquot_406.cmx : ast_lifter_406.cmx ast_convenience_406.cmx -ppx_metaquot_run.cmo : -ppx_metaquot_run.cmx : -ppx_tools_402.cmo : ast_mapper_class_402.cmi ast_convenience_402.cmi -ppx_tools_402.cmx : ast_mapper_class_402.cmx ast_convenience_402.cmx -ppx_tools_403.cmo : ast_mapper_class_403.cmi ast_convenience_403.cmi -ppx_tools_403.cmx : ast_mapper_class_403.cmx ast_convenience_403.cmx -ppx_tools_404.cmo : ast_mapper_class_404.cmi ast_convenience_404.cmi -ppx_tools_404.cmx : ast_mapper_class_404.cmx ast_convenience_404.cmx -ppx_tools_405.cmo : ast_mapper_class_405.cmi ast_convenience_405.cmi -ppx_tools_405.cmx : ast_mapper_class_405.cmx ast_convenience_405.cmx -ppx_tools_406.cmo : ast_mapper_class_406.cmi ast_convenience_406.cmi -ppx_tools_406.cmx : ast_mapper_class_406.cmx ast_convenience_406.cmx diff --git a/ppx_tools_versioned.5.2/.ocp-indent b/ppx_tools_versioned.5.2/.ocp-indent deleted file mode 100644 index 324a382..0000000 --- a/ppx_tools_versioned.5.2/.ocp-indent +++ /dev/null @@ -1,2 +0,0 @@ -match_clause=4 -strict_with=auto diff --git a/ppx_tools_versioned.5.2/.travis.yml b/ppx_tools_versioned.5.2/.travis.yml deleted file mode 100644 index 6464693..0000000 --- a/ppx_tools_versioned.5.2/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -language: c -install: wget https://raw.githubusercontent.com/ocaml/ocaml-travisci-skeleton/master/.travis-docker.sh -script: bash -ex .travis-docker.sh -services: - - docker -sudo: false -env: - global: - - PACKAGE="ppx_tools_versioned" - - PRE_INSTALL_HOOK="cd /home/opam/opam-repository && git pull origin master && opam update -u -y" - matrix: - - DISTRO=debian-stable OCAML_VERSION=4.03.0 - - DISTRO=debian-testing OCAML_VERSION=4.02.3 - - DISTRO=debian-unstable OCAML_VERSION=4.04.0 - - DISTRO=ubuntu-16.04 OCAML_VERSION=4.03.0 - - DISTRO=alpine OCAML_VERSION=4.04.0 - #- DISTRO=alpine OCAML_VERSION=4.05.0+trunk diff --git a/ppx_tools_versioned.5.2/LICENSE b/ppx_tools_versioned.5.2/LICENSE deleted file mode 100644 index cb4dd09..0000000 --- a/ppx_tools_versioned.5.2/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013 Alain Frisch and LexiFi - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/ppx_tools_versioned.5.2/Makefile b/ppx_tools_versioned.5.2/Makefile deleted file mode 100644 index 2ac7b59..0000000 --- a/ppx_tools_versioned.5.2/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -INSTALL_ARGS := $(if $(PREFIX),--prefix $(PREFIX),) - -all: - jbuilder build --dev @install - -install: - jbuilder install $(INSTALL_ARGS) - -uninstall: - jbuilder uninstall $(INSTALL_ARGS) - -reinstall: uninstall reinstall - -test: - jbuilder runtest --dev - -promote: - jbuilder promote - -clean: - jbuilder clean - -all-supported-ocaml-versions: - jbuilder runtest --dev --workspace jbuild-workspace.dev - -.PHONY: all-supported-ocaml-versions all install uninstall reinstall test clean diff --git a/ppx_tools_versioned.5.2/README.md b/ppx_tools_versioned.5.2/README.md deleted file mode 100644 index 1c88d45..0000000 --- a/ppx_tools_versioned.5.2/README.md +++ /dev/null @@ -1,138 +0,0 @@ -ppx_tools -========= - -Tools for authors of syntactic tools (such as ppx rewriters). - -This package is licensed by LexiFi under the terms of the MIT license. - -The tools are installed as a findlib package called 'ppx_tools'. -Executables are thus accessible through the ocamlfind driver (e.g.: -ocamlfind ppx_tools/dumpast). - -Main contributors: - - - Alain Frisch - - Peter Zotov (whitequark) - - Gabriel Radanne (Drup) - -Master : [![Build Status](https://travis-ci.org/alainfrisch/ppx_tools.svg?branch=master)](https://travis-ci.org/alainfrisch/ppx_tools) - -4.05 : [![Build Status](https://travis-ci.org/alainfrisch/ppx_tools.svg?branch=4.05)](https://travis-ci.org/alainfrisch/ppx_tools) - -4.04 : [![Build Status](https://travis-ci.org/alainfrisch/ppx_tools.svg?branch=4.04)](https://travis-ci.org/alainfrisch/ppx_tools) - -4.03 : [![Build Status](https://travis-ci.org/alainfrisch/ppx_tools.svg?branch=4.03)](https://travis-ci.org/alainfrisch/ppx_tools) - -4.02 : [![Build Status](https://travis-ci.org/alainfrisch/ppx_tools.svg?branch=4.02)](https://travis-ci.org/alainfrisch/ppx_tools) - -ppx_metaquot ------------- - -A ppx filter to help writing programs which manipulate the Parsetree, -by allowing the programmer to use concrete syntax for expressions -creating Parsetree fragments and patterns deconstructing Parsetree -fragments. See the top of ppx_metaquot.ml for a description of the -supported extensions. - -Usage: - - ocamlfind ocamlc -c -package ppx_tools.metaquot my_ppx_code.ml - - -rewriter --------- - -An utility to help testing ppx rewriters that runs the rewriter on -user-provided code and returns the result. - -Usage: - - ocamlfind ppx_tools/rewriter ./my_ppx_rewriter sample.ml - -See the integrated help message for more details: - - ocamlfind ppx_tools/rewriter -help - - -Ast_mapper_class ----------------- - -This module implements an API similar to Ast_mapper from the -compiler-libs, i.e. a generic mapper from Parsetree to Parsetree -implemeting a deep identity copy, which can be customized with a -custom behavior for each syntactic category. The difference with -Ast_mapper is that Ast_mapper_class implements the open recursion -using a class. - - -dumpast -------- - -This tool parses fragments of OCaml code (or entire source files) and -dump the resulting internal Parsetree representation. Intended uses: - - - Help to learn about the OCaml Parsetree structure and how it - corresponds to OCaml source syntax. - - - Create fragments of Parsetree to be copy-pasted into the source - code of syntax-manipulating programs (such as ppx rewriters). - -Usage: - - ocamlfind ppx_tools/dumpast -e "1 + 2" - -The tool can be used to show the Parsetree representation of small -fragments of syntax passed on the command line (-e for expressions, -p -for patterns, -t for type expressions) or for entire .ml/mli files. -The standard -pp and -ppx options are supported, but only applied on -whole files. The tool has further option to control how location and -attribute fields in the Parsetree should be displayed. - - -genlifter ---------- - -This tool generates a virtual "lifter" class for one or several OCaml -type constructors. It does so by loading the .cmi files which define -those types. The generated lifter class exposes one method to "reify" -type constructors passed on the command-line and other type -constructors accessible from them. The class is parametrized over the -target type of the reification, and it must provide method to deal -with basic types (int, string, char, int32, int64, nativeint) and data -type builders (record, constr, tuple, list, array). As an example, -calling: - - ocamlfind ppx_tools/genlifter -I +compiler-libs Location.t - -produces the following class: - - class virtual ['res] lifter = - object (this) - method lift_Location_t : Location.t -> 'res= - fun - { Location.loc_start = loc_start; Location.loc_end = loc_end; - Location.loc_ghost = loc_ghost } - -> - this#record "Location.t" - [("loc_start", (this#lift_Lexing_position loc_start)); - ("loc_end", (this#lift_Lexing_position loc_end)); - ("loc_ghost", (this#lift_bool loc_ghost))] - method lift_bool : bool -> 'res= - function - | false -> this#constr "bool" ("false", []) - | true -> this#constr "bool" ("true", []) - method lift_Lexing_position : Lexing.position -> 'res= - fun - { Lexing.pos_fname = pos_fname; Lexing.pos_lnum = pos_lnum; - Lexing.pos_bol = pos_bol; Lexing.pos_cnum = pos_cnum } - -> - this#record "Lexing.position" - [("pos_fname", (this#string pos_fname)); - ("pos_lnum", (this#int pos_lnum)); - ("pos_bol", (this#int pos_bol)); - ("pos_cnum", (this#int pos_cnum))] - end - -_dumpast_ is a direct example of using _genlifter_ applied on the -OCaml Parsetree definition itself. ppx_metaquot is another -similar example. diff --git a/ppx_tools_versioned.5.2/ast_convenience_402.ml b/ppx_tools_versioned.5.2/ast_convenience_402.ml deleted file mode 100644 index 1c65380..0000000 --- a/ppx_tools_versioned.5.2/ast_convenience_402.ml +++ /dev/null @@ -1,155 +0,0 @@ -open Ast_402 - -(* This file is part of the ppx_tools package. It is released *) -(* under the terms of the MIT license (see LICENSE file). *) -(* Copyright 2013 Alain Frisch and LexiFi *) - -open Parsetree -open Asttypes -open Location -open Ast_helper - - -module Label = struct - - type t = string - - type desc = - Nolabel - | Labelled of string - | Optional of string - - let explode s = - if s = "" then Nolabel - else if s.[0] = '?' then Optional (String.sub s 1 (String.length s - 1)) - else Labelled s - - let nolabel = "" - let labelled s = s - let optional s = "?"^s - -end - -module Constant = struct - type t = - Pconst_integer of string * char option - | Pconst_char of char - | Pconst_string of string * string option - | Pconst_float of string * char option - - exception Unknown_literal of string * char - - (** Backport Int_literal_converter from ocaml 4.03 - - * https://github.com/ocaml/ocaml/blob/trunk/utils/misc.ml#L298 *) - module Int_literal_converter = struct - let cvt_int_aux str neg of_string = - if String.length str = 0 || str.[0] = '-' - then of_string str - else neg (of_string ("-" ^ str)) - let int s = cvt_int_aux s (~-) int_of_string - let int32 s = cvt_int_aux s Int32.neg Int32.of_string - let int64 s = cvt_int_aux s Int64.neg Int64.of_string - let nativeint s = cvt_int_aux s Nativeint.neg Nativeint.of_string - end - - let of_constant = function - | Asttypes.Const_int32(i) -> Pconst_integer(Int32.to_string i, Some 'l') - | Asttypes.Const_int64(i) -> Pconst_integer(Int64.to_string i, Some 'L') - | Asttypes.Const_nativeint(i) -> Pconst_integer(Nativeint.to_string i, Some 'n') - | Asttypes.Const_int(i) -> Pconst_integer(string_of_int i, None) - | Asttypes.Const_char c -> Pconst_char c - | Asttypes.Const_string(s, s_opt) -> Pconst_string(s, s_opt) - | Asttypes.Const_float f -> Pconst_float(f, None) - - let to_constant = function - | Pconst_integer(i,Some 'l') -> Asttypes.Const_int32 (Int_literal_converter.int32 i) - | Pconst_integer(i,Some 'L') -> Asttypes.Const_int64 (Int_literal_converter.int64 i) - | Pconst_integer(i,Some 'n') -> Asttypes.Const_nativeint (Int_literal_converter.nativeint i) - | Pconst_integer(i,None) -> Asttypes.Const_int (Int_literal_converter.int i) - | Pconst_integer(i,Some c) -> raise (Unknown_literal (i, c)) - | Pconst_char c -> Asttypes.Const_char c - | Pconst_string(s,d) -> Asttypes.Const_string(s, d) - | Pconst_float(f,None) -> Asttypes.Const_float f - | Pconst_float(f,Some c) -> raise (Unknown_literal (f, c)) -end - -let may_tuple ?loc tup = function - | [] -> None - | [x] -> Some x - | l -> Some (tup ?loc ?attrs:None l) - -let lid ?(loc = !default_loc) s = mkloc (Longident.parse s) loc -let constr ?loc ?attrs s args = Exp.construct ?loc ?attrs (lid ?loc s) (may_tuple ?loc Exp.tuple args) -let nil ?loc ?attrs () = constr ?loc ?attrs "[]" [] -let unit ?loc ?attrs () = constr ?loc ?attrs "()" [] -let tuple ?loc ?attrs = function - | [] -> unit ?loc ?attrs () - | [x] -> x - | xs -> Exp.tuple ?loc ?attrs xs -let cons ?loc ?attrs hd tl = constr ?loc ?attrs "::" [hd; tl] -let list ?loc ?attrs l = List.fold_right (cons ?loc ?attrs) l (nil ?loc ?attrs ()) -let str ?loc ?attrs s = Exp.constant ?loc ?attrs (Const_string (s, None)) -let int ?loc ?attrs x = Exp.constant ?loc ?attrs (Const_int x) -let char ?loc ?attrs x = Exp.constant ?loc ?attrs (Const_char x) -let float ?loc ?attrs x = Exp.constant ?loc ?attrs (Const_float (string_of_float x)) -let record ?loc ?attrs ?over l = - Exp.record ?loc ?attrs (List.map (fun (s, e) -> (lid ~loc:e.pexp_loc s, e)) l) over -let func ?loc ?attrs l = Exp.function_ ?loc ?attrs (List.map (fun (p, e) -> Exp.case p e) l) -let lam ?loc ?attrs ?(label = Label.nolabel) ?default pat exp = Exp.fun_ ?loc ?attrs label default pat exp -let app ?loc ?attrs f l = if l = [] then f else Exp.apply ?loc ?attrs f (List.map (fun a -> Label.nolabel, a) l) -let evar ?loc ?attrs s = Exp.ident ?loc ?attrs (lid ?loc s) -let let_in ?loc ?attrs ?(recursive = false) b body = - Exp.let_ ?loc ?attrs (if recursive then Recursive else Nonrecursive) b body - -let sequence ?loc ?attrs = function - | [] -> unit ?loc ?attrs () - | hd :: tl -> List.fold_left (fun e1 e2 -> Exp.sequence ?loc ?attrs e1 e2) hd tl - -let pvar ?(loc = !default_loc) ?attrs s = Pat.var ~loc ?attrs (mkloc s loc) -let pconstr ?loc ?attrs s args = Pat.construct ?loc ?attrs (lid ?loc s) (may_tuple ?loc Pat.tuple args) -let precord ?loc ?attrs ?(closed = Open) l = - Pat.record ?loc ?attrs (List.map (fun (s, e) -> (lid ~loc:e.ppat_loc s, e)) l) closed -let pnil ?loc ?attrs () = pconstr ?loc ?attrs "[]" [] -let pcons ?loc ?attrs hd tl = pconstr ?loc ?attrs "::" [hd; tl] -let punit ?loc ?attrs () = pconstr ?loc ?attrs "()" [] -let ptuple ?loc ?attrs = function - | [] -> punit ?loc ?attrs () - | [x] -> x - | xs -> Pat.tuple ?loc ?attrs xs -let plist ?loc ?attrs l = List.fold_right (pcons ?loc ?attrs) l (pnil ?loc ?attrs ()) - -let pstr ?loc ?attrs s = Pat.constant ?loc ?attrs (Const_string (s, None)) -let pint ?loc ?attrs x = Pat.constant ?loc ?attrs (Const_int x) -let pchar ?loc ?attrs x = Pat.constant ?loc ?attrs (Const_char x) -let pfloat ?loc ?attrs x = Pat.constant ?loc ?attrs (Const_float (string_of_float x)) - -let tconstr ?loc ?attrs c l = Typ.constr ?loc ?attrs (lid ?loc c) l - -let get_str = function - | {pexp_desc=Pexp_constant (Const_string (s, _)); _} -> Some s - | _ -> None - -let get_str_with_quotation_delimiter = function - | {pexp_desc=Pexp_constant (Const_string (s, d)); _} -> Some (s, d) - | _ -> None - -let get_lid = function - | {pexp_desc=Pexp_ident{txt=id;_};_} -> - Some (String.concat "." (Longident.flatten id)) - | _ -> None - -let find_attr s attrs = - try Some (snd (List.find (fun (x, _) -> x.txt = s) attrs)) - with Not_found -> None - -let expr_of_payload = function - | PStr [{pstr_desc=Pstr_eval(e, _); _}] -> Some e - | _ -> None - -let find_attr_expr s attrs = - match find_attr s attrs with - | Some e -> expr_of_payload e - | None -> None - -let has_attr s attrs = - find_attr s attrs <> None diff --git a/ppx_tools_versioned.5.2/ast_convenience_402.mli b/ppx_tools_versioned.5.2/ast_convenience_402.mli deleted file mode 100644 index a07b92d..0000000 --- a/ppx_tools_versioned.5.2/ast_convenience_402.mli +++ /dev/null @@ -1,110 +0,0 @@ -open Ast_402 - -(* This file is part of the ppx_tools package. It is released *) -(* under the terms of the MIT license (see LICENSE file). *) -(* Copyright 2013 Alain Frisch and LexiFi *) - -(** {1 Convenience functions to help build and deconstruct AST fragments.} *) - -open Parsetree -open Asttypes -open Ast_helper - -(** {2 Compatibility modules} *) - -module Label : sig - type t = string - - type desc = - Nolabel - | Labelled of string - | Optional of string - - val explode : t -> desc - - val nolabel : t - val labelled : string -> t - val optional : string -> t - -end - -(** {2 Provides abstraction over Asttypes.constant type }*) -module Constant : sig - type t = - Pconst_integer of string * char option - | Pconst_char of char - | Pconst_string of string * string option - | Pconst_float of string * char option - - exception Unknown_literal of string * char - - (** Converts Asttypes.constant to Constant.t *) - val of_constant : constant -> t - - (** Converts Constant.t to Asttypes.constant. Raises Unknown_literal if conversion fails *) - val to_constant : t -> constant -end - -(** {2 Misc} *) - -val lid: ?loc:loc -> string -> lid - -(** {2 Expressions} *) - -val evar: ?loc:loc -> ?attrs:attrs -> string -> expression -val let_in: ?loc:loc -> ?attrs:attrs -> ?recursive:bool -> value_binding list -> expression -> expression - -val constr: ?loc:loc -> ?attrs:attrs -> string -> expression list -> expression -val record: ?loc:loc -> ?attrs:attrs -> ?over:expression -> (string * expression) list -> expression -val tuple: ?loc:loc -> ?attrs:attrs -> expression list -> expression - -val nil: ?loc:loc -> ?attrs:attrs -> unit -> expression -val cons: ?loc:loc -> ?attrs:attrs -> expression -> expression -> expression -val list: ?loc:loc -> ?attrs:attrs -> expression list -> expression - -val unit: ?loc:loc -> ?attrs:attrs -> unit -> expression - -val func: ?loc:loc -> ?attrs:attrs -> (pattern * expression) list -> expression -val lam: ?loc:loc -> ?attrs:attrs -> ?label:Label.t -> ?default:expression -> pattern -> expression -> expression -val app: ?loc:loc -> ?attrs:attrs -> expression -> expression list -> expression - -val str: ?loc:loc -> ?attrs:attrs -> string -> expression -val int: ?loc:loc -> ?attrs:attrs -> int -> expression -val char: ?loc:loc -> ?attrs:attrs -> char -> expression -val float: ?loc:loc -> ?attrs:attrs -> float -> expression - -val sequence: ?loc:loc -> ?attrs:attrs -> expression list -> expression -(** Return [()] if the list is empty. Tail rec. *) - -(** {2 Patterns} *) - -val pvar: ?loc:loc -> ?attrs:attrs -> string -> pattern -val pconstr: ?loc:loc -> ?attrs:attrs -> string -> pattern list -> pattern -val precord: ?loc:loc -> ?attrs:attrs -> ?closed:closed_flag -> (string * pattern) list -> pattern -val ptuple: ?loc:loc -> ?attrs:attrs -> pattern list -> pattern - -val pnil: ?loc:loc -> ?attrs:attrs -> unit -> pattern -val pcons: ?loc:loc -> ?attrs:attrs -> pattern -> pattern -> pattern -val plist: ?loc:loc -> ?attrs:attrs -> pattern list -> pattern - -val pstr: ?loc:loc -> ?attrs:attrs -> string -> pattern -val pint: ?loc:loc -> ?attrs:attrs -> int -> pattern -val pchar: ?loc:loc -> ?attrs:attrs -> char -> pattern -val pfloat: ?loc:loc -> ?attrs:attrs -> float -> pattern - -val punit: ?loc:loc -> ?attrs:attrs -> unit -> pattern - - -(** {2 Types} *) - -val tconstr: ?loc:loc -> ?attrs:attrs -> string -> core_type list -> core_type - -(** {2 AST deconstruction} *) - -val get_str: expression -> string option -val get_str_with_quotation_delimiter: expression -> (string * string option) option -val get_lid: expression -> string option - -val has_attr: string -> attributes -> bool -val find_attr: string -> attributes -> payload option -val find_attr_expr: string -> attributes -> expression option diff --git a/ppx_tools_versioned.5.2/ast_convenience_403.ml b/ppx_tools_versioned.5.2/ast_convenience_403.ml deleted file mode 100644 index 3187cb4..0000000 --- a/ppx_tools_versioned.5.2/ast_convenience_403.ml +++ /dev/null @@ -1,122 +0,0 @@ -open Ast_403 - -(* This file is part of the ppx_tools package. It is released *) -(* under the terms of the MIT license (see LICENSE file). *) -(* Copyright 2013 Alain Frisch and LexiFi *) - -open Parsetree -open Asttypes -open Location -open Ast_helper - - -module Label = struct - - type t = Asttypes.arg_label - - type desc = Asttypes.arg_label = - Nolabel - | Labelled of string - | Optional of string - - let explode x = x - - let nolabel = Nolabel - let labelled x = Labelled x - let optional x = Optional x - -end - -module Constant = struct - type t = Parsetree.constant = - Pconst_integer of string * char option - | Pconst_char of char - | Pconst_string of string * string option - | Pconst_float of string * char option - - let of_constant x = x - - let to_constant x = x - -end - -let may_tuple ?loc tup = function - | [] -> None - | [x] -> Some x - | l -> Some (tup ?loc ?attrs:None l) - -let lid ?(loc = !default_loc) s = mkloc (Longident.parse s) loc -let constr ?loc ?attrs s args = Exp.construct ?loc ?attrs (lid ?loc s) (may_tuple ?loc Exp.tuple args) -let nil ?loc ?attrs () = constr ?loc ?attrs "[]" [] -let unit ?loc ?attrs () = constr ?loc ?attrs "()" [] -let tuple ?loc ?attrs = function - | [] -> unit ?loc ?attrs () - | [x] -> x - | xs -> Exp.tuple ?loc ?attrs xs -let cons ?loc ?attrs hd tl = constr ?loc ?attrs "::" [hd; tl] -let list ?loc ?attrs l = List.fold_right (cons ?loc ?attrs) l (nil ?loc ?attrs ()) -let str ?loc ?attrs s = Exp.constant ?loc ?attrs (Pconst_string (s, None)) -let int ?loc ?attrs x = Exp.constant ?loc ?attrs (Pconst_integer (string_of_int x, None)) -let char ?loc ?attrs x = Exp.constant ?loc ?attrs (Pconst_char x) -let float ?loc ?attrs x = Exp.constant ?loc ?attrs (Pconst_float (string_of_float x, None)) -let record ?loc ?attrs ?over l = - Exp.record ?loc ?attrs (List.map (fun (s, e) -> (lid ~loc:e.pexp_loc s, e)) l) over -let func ?loc ?attrs l = Exp.function_ ?loc ?attrs (List.map (fun (p, e) -> Exp.case p e) l) -let lam ?loc ?attrs ?(label = Label.nolabel) ?default pat exp = Exp.fun_ ?loc ?attrs label default pat exp -let app ?loc ?attrs f l = if l = [] then f else Exp.apply ?loc ?attrs f (List.map (fun a -> Label.nolabel, a) l) -let evar ?loc ?attrs s = Exp.ident ?loc ?attrs (lid ?loc s) -let let_in ?loc ?attrs ?(recursive = false) b body = - Exp.let_ ?loc ?attrs (if recursive then Recursive else Nonrecursive) b body - -let sequence ?loc ?attrs = function - | [] -> unit ?loc ?attrs () - | hd :: tl -> List.fold_left (fun e1 e2 -> Exp.sequence ?loc ?attrs e1 e2) hd tl - -let pvar ?(loc = !default_loc) ?attrs s = Pat.var ~loc ?attrs (mkloc s loc) -let pconstr ?loc ?attrs s args = Pat.construct ?loc ?attrs (lid ?loc s) (may_tuple ?loc Pat.tuple args) -let precord ?loc ?attrs ?(closed = Open) l = - Pat.record ?loc ?attrs (List.map (fun (s, e) -> (lid ~loc:e.ppat_loc s, e)) l) closed -let pnil ?loc ?attrs () = pconstr ?loc ?attrs "[]" [] -let pcons ?loc ?attrs hd tl = pconstr ?loc ?attrs "::" [hd; tl] -let punit ?loc ?attrs () = pconstr ?loc ?attrs "()" [] -let ptuple ?loc ?attrs = function - | [] -> punit ?loc ?attrs () - | [x] -> x - | xs -> Pat.tuple ?loc ?attrs xs -let plist ?loc ?attrs l = List.fold_right (pcons ?loc ?attrs) l (pnil ?loc ?attrs ()) - -let pstr ?loc ?attrs s = Pat.constant ?loc ?attrs (Pconst_string (s, None)) -let pint ?loc ?attrs x = Pat.constant ?loc ?attrs (Pconst_integer (string_of_int x, None)) -let pchar ?loc ?attrs x = Pat.constant ?loc ?attrs (Pconst_char x) -let pfloat ?loc ?attrs x = Pat.constant ?loc ?attrs (Pconst_float (string_of_float x, None)) - -let tconstr ?loc ?attrs c l = Typ.constr ?loc ?attrs (lid ?loc c) l - -let get_str = function - | {pexp_desc=Pexp_constant (Pconst_string (s, _)); _} -> Some s - | _ -> None - -let get_str_with_quotation_delimiter = function - | {pexp_desc=Pexp_constant (Pconst_string (s, d)); _} -> Some (s, d) - | _ -> None - -let get_lid = function - | {pexp_desc=Pexp_ident{txt=id;_};_} -> - Some (String.concat "." (Longident.flatten id)) - | _ -> None - -let find_attr s attrs = - try Some (snd (List.find (fun (x, _) -> x.txt = s) attrs)) - with Not_found -> None - -let expr_of_payload = function - | PStr [{pstr_desc=Pstr_eval(e, _); _}] -> Some e - | _ -> None - -let find_attr_expr s attrs = - match find_attr s attrs with - | Some e -> expr_of_payload e - | None -> None - -let has_attr s attrs = - find_attr s attrs <> None diff --git a/ppx_tools_versioned.5.2/ast_convenience_403.mli b/ppx_tools_versioned.5.2/ast_convenience_403.mli deleted file mode 100644 index 4e9690a..0000000 --- a/ppx_tools_versioned.5.2/ast_convenience_403.mli +++ /dev/null @@ -1,110 +0,0 @@ -open Ast_403 - -(* This file is part of the ppx_tools package. It is released *) -(* under the terms of the MIT license (see LICENSE file). *) -(* Copyright 2013 Alain Frisch and LexiFi *) - -(** {1 Convenience functions to help build and deconstruct AST fragments.} *) - -open Asttypes -open Ast_helper -open Parsetree - -(** {2 Compatibility modules} *) - -module Label : sig - type t = Asttypes.arg_label - - type desc = Asttypes.arg_label = - Nolabel - | Labelled of string - | Optional of string - - val explode : t -> desc - - val nolabel : t - val labelled : string -> t - val optional : string -> t - -end - -(** {2 Provides a unified abstraction over differences in Parsetree.constant and Asttypes.constant - * types defined in ocaml 4.03 and 4.02 respectively}*) -module Constant : sig - type t = Parsetree.constant = - Pconst_integer of string * char option - | Pconst_char of char - | Pconst_string of string * string option - | Pconst_float of string * char option - - (** Convert Asttypes.constant to Constant.t *) - val of_constant : Parsetree.constant -> t - - (** Convert Constant.t to Asttypes.constant *) - val to_constant : t -> Parsetree.constant - -end - -(** {2 Misc} *) - -val lid: ?loc:loc -> string -> lid - -(** {2 Expressions} *) - -val evar: ?loc:loc -> ?attrs:attrs -> string -> expression -val let_in: ?loc:loc -> ?attrs:attrs -> ?recursive:bool -> value_binding list -> expression -> expression - -val constr: ?loc:loc -> ?attrs:attrs -> string -> expression list -> expression -val record: ?loc:loc -> ?attrs:attrs -> ?over:expression -> (string * expression) list -> expression -val tuple: ?loc:loc -> ?attrs:attrs -> expression list -> expression - -val nil: ?loc:loc -> ?attrs:attrs -> unit -> expression -val cons: ?loc:loc -> ?attrs:attrs -> expression -> expression -> expression -val list: ?loc:loc -> ?attrs:attrs -> expression list -> expression - -val unit: ?loc:loc -> ?attrs:attrs -> unit -> expression - -val func: ?loc:loc -> ?attrs:attrs -> (pattern * expression) list -> expression -val lam: ?loc:loc -> ?attrs:attrs -> ?label:Label.t -> ?default:expression -> pattern -> expression -> expression -val app: ?loc:loc -> ?attrs:attrs -> expression -> expression list -> expression - -val str: ?loc:loc -> ?attrs:attrs -> string -> expression -val int: ?loc:loc -> ?attrs:attrs -> int -> expression -val char: ?loc:loc -> ?attrs:attrs -> char -> expression -val float: ?loc:loc -> ?attrs:attrs -> float -> expression - -val sequence: ?loc:loc -> ?attrs:attrs -> expression list -> expression -(** Return [()] if the list is empty. Tail rec. *) - -(** {2 Patterns} *) - -val pvar: ?loc:loc -> ?attrs:attrs -> string -> pattern -val pconstr: ?loc:loc -> ?attrs:attrs -> string -> pattern list -> pattern -val precord: ?loc:loc -> ?attrs:attrs -> ?closed:closed_flag -> (string * pattern) list -> pattern -val ptuple: ?loc:loc -> ?attrs:attrs -> pattern list -> pattern - -val pnil: ?loc:loc -> ?attrs:attrs -> unit -> pattern -val pcons: ?loc:loc -> ?attrs:attrs -> pattern -> pattern -> pattern -val plist: ?loc:loc -> ?attrs:attrs -> pattern list -> pattern - -val pstr: ?loc:loc -> ?attrs:attrs -> string -> pattern -val pint: ?loc:loc -> ?attrs:attrs -> int -> pattern -val pchar: ?loc:loc -> ?attrs:attrs -> char -> pattern -val pfloat: ?loc:loc -> ?attrs:attrs -> float -> pattern - -val punit: ?loc:loc -> ?attrs:attrs -> unit -> pattern - - -(** {2 Types} *) - -val tconstr: ?loc:loc -> ?attrs:attrs -> string -> core_type list -> core_type - -(** {2 AST deconstruction} *) - -val get_str: expression -> string option -val get_str_with_quotation_delimiter: expression -> (string * string option) option -val get_lid: expression -> string option - -val has_attr: string -> attributes -> bool -val find_attr: string -> attributes -> payload option -val find_attr_expr: string -> attributes -> expression option diff --git a/ppx_tools_versioned.5.2/ast_convenience_404.ml b/ppx_tools_versioned.5.2/ast_convenience_404.ml deleted file mode 100644 index 1af2660..0000000 --- a/ppx_tools_versioned.5.2/ast_convenience_404.ml +++ /dev/null @@ -1,124 +0,0 @@ -open Ast_404 - -(* This file is part of the ppx_tools package. It is released *) -(* under the terms of the MIT license (see LICENSE file). *) -(* Copyright 2013 Alain Frisch and LexiFi *) - -open Parsetree -open Asttypes -open Location -open Ast_helper - - -module Label = struct - - type t = Asttypes.arg_label - - type desc = Asttypes.arg_label = - Nolabel - | Labelled of string - | Optional of string - - let explode x = x - - let nolabel = Nolabel - let labelled x = Labelled x - let optional x = Optional x - -end - -module Constant = struct - type t = Parsetree.constant = - Pconst_integer of string * char option - | Pconst_char of char - | Pconst_string of string * string option - | Pconst_float of string * char option - - let of_constant x = x - - let to_constant x = x - -end - -let may_tuple ?loc tup = function - | [] -> None - | [x] -> Some x - | l -> Some (tup ?loc ?attrs:None l) - -let lid ?(loc = !default_loc) s = mkloc (Longident.parse s) loc -let constr ?loc ?attrs s args = Exp.construct ?loc ?attrs (lid ?loc s) (may_tuple ?loc Exp.tuple args) -let nil ?loc ?attrs () = constr ?loc ?attrs "[]" [] -let unit ?loc ?attrs () = constr ?loc ?attrs "()" [] -let tuple ?loc ?attrs = function - | [] -> unit ?loc ?attrs () - | [x] -> x - | xs -> Exp.tuple ?loc ?attrs xs -let cons ?loc ?attrs hd tl = constr ?loc ?attrs "::" [hd; tl] -let list ?loc ?attrs l = List.fold_right (cons ?loc ?attrs) l (nil ?loc ?attrs ()) -let str ?loc ?attrs s = Exp.constant ?loc ?attrs (Pconst_string (s, None)) -let int ?loc ?attrs x = Exp.constant ?loc ?attrs (Pconst_integer (string_of_int x, None)) -let int32 ?loc ?attrs x = Exp.constant ?loc ?attrs (Pconst_integer (Int32.to_string x, Some 'l')) -let int64 ?loc ?attrs x = Exp.constant ?loc ?attrs (Pconst_integer (Int64.to_string x, Some 'L')) -let char ?loc ?attrs x = Exp.constant ?loc ?attrs (Pconst_char x) -let float ?loc ?attrs x = Exp.constant ?loc ?attrs (Pconst_float (string_of_float x, None)) -let record ?loc ?attrs ?over l = - Exp.record ?loc ?attrs (List.map (fun (s, e) -> (lid ~loc:e.pexp_loc s, e)) l) over -let func ?loc ?attrs l = Exp.function_ ?loc ?attrs (List.map (fun (p, e) -> Exp.case p e) l) -let lam ?loc ?attrs ?(label = Label.nolabel) ?default pat exp = Exp.fun_ ?loc ?attrs label default pat exp -let app ?loc ?attrs f l = if l = [] then f else Exp.apply ?loc ?attrs f (List.map (fun a -> Label.nolabel, a) l) -let evar ?loc ?attrs s = Exp.ident ?loc ?attrs (lid ?loc s) -let let_in ?loc ?attrs ?(recursive = false) b body = - Exp.let_ ?loc ?attrs (if recursive then Recursive else Nonrecursive) b body - -let sequence ?loc ?attrs = function - | [] -> unit ?loc ?attrs () - | hd :: tl -> List.fold_left (fun e1 e2 -> Exp.sequence ?loc ?attrs e1 e2) hd tl - -let pvar ?(loc = !default_loc) ?attrs s = Pat.var ~loc ?attrs (mkloc s loc) -let pconstr ?loc ?attrs s args = Pat.construct ?loc ?attrs (lid ?loc s) (may_tuple ?loc Pat.tuple args) -let precord ?loc ?attrs ?(closed = Open) l = - Pat.record ?loc ?attrs (List.map (fun (s, e) -> (lid ~loc:e.ppat_loc s, e)) l) closed -let pnil ?loc ?attrs () = pconstr ?loc ?attrs "[]" [] -let pcons ?loc ?attrs hd tl = pconstr ?loc ?attrs "::" [hd; tl] -let punit ?loc ?attrs () = pconstr ?loc ?attrs "()" [] -let ptuple ?loc ?attrs = function - | [] -> punit ?loc ?attrs () - | [x] -> x - | xs -> Pat.tuple ?loc ?attrs xs -let plist ?loc ?attrs l = List.fold_right (pcons ?loc ?attrs) l (pnil ?loc ?attrs ()) - -let pstr ?loc ?attrs s = Pat.constant ?loc ?attrs (Pconst_string (s, None)) -let pint ?loc ?attrs x = Pat.constant ?loc ?attrs (Pconst_integer (string_of_int x, None)) -let pchar ?loc ?attrs x = Pat.constant ?loc ?attrs (Pconst_char x) -let pfloat ?loc ?attrs x = Pat.constant ?loc ?attrs (Pconst_float (string_of_float x, None)) - -let tconstr ?loc ?attrs c l = Typ.constr ?loc ?attrs (lid ?loc c) l - -let get_str = function - | {pexp_desc=Pexp_constant (Pconst_string (s, _)); _} -> Some s - | _ -> None - -let get_str_with_quotation_delimiter = function - | {pexp_desc=Pexp_constant (Pconst_string (s, d)); _} -> Some (s, d) - | _ -> None - -let get_lid = function - | {pexp_desc=Pexp_ident{txt=id;_};_} -> - Some (String.concat "." (Longident.flatten id)) - | _ -> None - -let find_attr s attrs = - try Some (snd (List.find (fun (x, _) -> x.txt = s) attrs)) - with Not_found -> None - -let expr_of_payload = function - | PStr [{pstr_desc=Pstr_eval(e, _); _}] -> Some e - | _ -> None - -let find_attr_expr s attrs = - match find_attr s attrs with - | Some e -> expr_of_payload e - | None -> None - -let has_attr s attrs = - find_attr s attrs <> None diff --git a/ppx_tools_versioned.5.2/ast_convenience_404.mli b/ppx_tools_versioned.5.2/ast_convenience_404.mli deleted file mode 100644 index 75fdf73..0000000 --- a/ppx_tools_versioned.5.2/ast_convenience_404.mli +++ /dev/null @@ -1,112 +0,0 @@ -open Ast_404 - -(* This file is part of the ppx_tools package. It is released *) -(* under the terms of the MIT license (see LICENSE file). *) -(* Copyright 2013 Alain Frisch and LexiFi *) - -(** {1 Convenience functions to help build and deconstruct AST fragments.} *) - -open Asttypes -open Ast_helper -open Parsetree - -(** {2 Compatibility modules} *) - -module Label : sig - type t = Asttypes.arg_label - - type desc = Asttypes.arg_label = - Nolabel - | Labelled of string - | Optional of string - - val explode : t -> desc - - val nolabel : t - val labelled : string -> t - val optional : string -> t - -end - -(** {2 Provides a unified abstraction over differences in Parsetree.constant and Asttypes.constant - * types defined in ocaml 4.03 and 4.02 respectively}*) -module Constant : sig - type t = Parsetree.constant = - Pconst_integer of string * char option - | Pconst_char of char - | Pconst_string of string * string option - | Pconst_float of string * char option - - (** Convert Asttypes.constant to Constant.t *) - val of_constant : Parsetree.constant -> t - - (** Convert Constant.t to Asttypes.constant *) - val to_constant : t -> Parsetree.constant - -end - -(** {2 Misc} *) - -val lid: ?loc:loc -> string -> lid - -(** {2 Expressions} *) - -val evar: ?loc:loc -> ?attrs:attrs -> string -> expression -val let_in: ?loc:loc -> ?attrs:attrs -> ?recursive:bool -> value_binding list -> expression -> expression - -val constr: ?loc:loc -> ?attrs:attrs -> string -> expression list -> expression -val record: ?loc:loc -> ?attrs:attrs -> ?over:expression -> (string * expression) list -> expression -val tuple: ?loc:loc -> ?attrs:attrs -> expression list -> expression - -val nil: ?loc:loc -> ?attrs:attrs -> unit -> expression -val cons: ?loc:loc -> ?attrs:attrs -> expression -> expression -> expression -val list: ?loc:loc -> ?attrs:attrs -> expression list -> expression - -val unit: ?loc:loc -> ?attrs:attrs -> unit -> expression - -val func: ?loc:loc -> ?attrs:attrs -> (pattern * expression) list -> expression -val lam: ?loc:loc -> ?attrs:attrs -> ?label:Label.t -> ?default:expression -> pattern -> expression -> expression -val app: ?loc:loc -> ?attrs:attrs -> expression -> expression list -> expression - -val str: ?loc:loc -> ?attrs:attrs -> string -> expression -val int: ?loc:loc -> ?attrs:attrs -> int -> expression -val int32: ?loc:loc -> ?attrs:attrs -> int32 -> expression -val int64: ?loc:loc -> ?attrs:attrs -> int64 -> expression -val char: ?loc:loc -> ?attrs:attrs -> char -> expression -val float: ?loc:loc -> ?attrs:attrs -> float -> expression - -val sequence: ?loc:loc -> ?attrs:attrs -> expression list -> expression -(** Return [()] if the list is empty. Tail rec. *) - -(** {2 Patterns} *) - -val pvar: ?loc:loc -> ?attrs:attrs -> string -> pattern -val pconstr: ?loc:loc -> ?attrs:attrs -> string -> pattern list -> pattern -val precord: ?loc:loc -> ?attrs:attrs -> ?closed:closed_flag -> (string * pattern) list -> pattern -val ptuple: ?loc:loc -> ?attrs:attrs -> pattern list -> pattern - -val pnil: ?loc:loc -> ?attrs:attrs -> unit -> pattern -val pcons: ?loc:loc -> ?attrs:attrs -> pattern -> pattern -> pattern -val plist: ?loc:loc -> ?attrs:attrs -> pattern list -> pattern - -val pstr: ?loc:loc -> ?attrs:attrs -> string -> pattern -val pint: ?loc:loc -> ?attrs:attrs -> int -> pattern -val pchar: ?loc:loc -> ?attrs:attrs -> char -> pattern -val pfloat: ?loc:loc -> ?attrs:attrs -> float -> pattern - -val punit: ?loc:loc -> ?attrs:attrs -> unit -> pattern - - -(** {2 Types} *) - -val tconstr: ?loc:loc -> ?attrs:attrs -> string -> core_type list -> core_type - -(** {2 AST deconstruction} *) - -val get_str: expression -> string option -val get_str_with_quotation_delimiter: expression -> (string * string option) option -val get_lid: expression -> string option - -val has_attr: string -> attributes -> bool -val find_attr: string -> attributes -> payload option -val find_attr_expr: string -> attributes -> expression option diff --git a/ppx_tools_versioned.5.2/ast_convenience_405.ml b/ppx_tools_versioned.5.2/ast_convenience_405.ml deleted file mode 100644 index a99b712..0000000 --- a/ppx_tools_versioned.5.2/ast_convenience_405.ml +++ /dev/null @@ -1,124 +0,0 @@ -open Ast_405 - -(* This file is part of the ppx_tools package. It is released *) -(* under the terms of the MIT license (see LICENSE file). *) -(* Copyright 2013 Alain Frisch and LexiFi *) - -open Parsetree -open Asttypes -open Location -open Ast_helper - - -module Label = struct - - type t = Asttypes.arg_label - - type desc = Asttypes.arg_label = - Nolabel - | Labelled of string - | Optional of string - - let explode x = x - - let nolabel = Nolabel - let labelled x = Labelled x - let optional x = Optional x - -end - -module Constant = struct - type t = Parsetree.constant = - Pconst_integer of string * char option - | Pconst_char of char - | Pconst_string of string * string option - | Pconst_float of string * char option - - let of_constant x = x - - let to_constant x = x - -end - -let may_tuple ?loc tup = function - | [] -> None - | [x] -> Some x - | l -> Some (tup ?loc ?attrs:None l) - -let lid ?(loc = !default_loc) s = mkloc (Longident.parse s) loc -let constr ?loc ?attrs s args = Exp.construct ?loc ?attrs (lid ?loc s) (may_tuple ?loc Exp.tuple args) -let nil ?loc ?attrs () = constr ?loc ?attrs "[]" [] -let unit ?loc ?attrs () = constr ?loc ?attrs "()" [] -let tuple ?loc ?attrs = function - | [] -> unit ?loc ?attrs () - | [x] -> x - | xs -> Exp.tuple ?loc ?attrs xs -let cons ?loc ?attrs hd tl = constr ?loc ?attrs "::" [hd; tl] -let list ?loc ?attrs l = List.fold_right (cons ?loc ?attrs) l (nil ?loc ?attrs ()) -let str ?loc ?attrs s = Exp.constant ?loc ?attrs (Pconst_string (s, None)) -let int ?loc ?attrs x = Exp.constant ?loc ?attrs (Pconst_integer (string_of_int x, None)) -let int32 ?loc ?attrs x = Exp.constant ?loc ?attrs (Pconst_integer (Int32.to_string x, Some 'l')) -let int64 ?loc ?attrs x = Exp.constant ?loc ?attrs (Pconst_integer (Int64.to_string x, Some 'L')) -let char ?loc ?attrs x = Exp.constant ?loc ?attrs (Pconst_char x) -let float ?loc ?attrs x = Exp.constant ?loc ?attrs (Pconst_float (string_of_float x, None)) -let record ?loc ?attrs ?over l = - Exp.record ?loc ?attrs (List.map (fun (s, e) -> (lid ~loc:e.pexp_loc s, e)) l) over -let func ?loc ?attrs l = Exp.function_ ?loc ?attrs (List.map (fun (p, e) -> Exp.case p e) l) -let lam ?loc ?attrs ?(label = Label.nolabel) ?default pat exp = Exp.fun_ ?loc ?attrs label default pat exp -let app ?loc ?attrs f l = if l = [] then f else Exp.apply ?loc ?attrs f (List.map (fun a -> Label.nolabel, a) l) -let evar ?loc ?attrs s = Exp.ident ?loc ?attrs (lid ?loc s) -let let_in ?loc ?attrs ?(recursive = false) b body = - Exp.let_ ?loc ?attrs (if recursive then Recursive else Nonrecursive) b body - -let sequence ?loc ?attrs = function - | [] -> unit ?loc ?attrs () - | hd :: tl -> List.fold_left (fun e1 e2 -> Exp.sequence ?loc ?attrs e1 e2) hd tl - -let pvar ?(loc = !default_loc) ?attrs s = Pat.var ~loc ?attrs (mkloc s loc) -let pconstr ?loc ?attrs s args = Pat.construct ?loc ?attrs (lid ?loc s) (may_tuple ?loc Pat.tuple args) -let precord ?loc ?attrs ?(closed = Open) l = - Pat.record ?loc ?attrs (List.map (fun (s, e) -> (lid ~loc:e.ppat_loc s, e)) l) closed -let pnil ?loc ?attrs () = pconstr ?loc ?attrs "[]" [] -let pcons ?loc ?attrs hd tl = pconstr ?loc ?attrs "::" [hd; tl] -let punit ?loc ?attrs () = pconstr ?loc ?attrs "()" [] -let ptuple ?loc ?attrs = function - | [] -> punit ?loc ?attrs () - | [x] -> x - | xs -> Pat.tuple ?loc ?attrs xs -let plist ?loc ?attrs l = List.fold_right (pcons ?loc ?attrs) l (pnil ?loc ?attrs ()) - -let pstr ?loc ?attrs s = Pat.constant ?loc ?attrs (Pconst_string (s, None)) -let pint ?loc ?attrs x = Pat.constant ?loc ?attrs (Pconst_integer (string_of_int x, None)) -let pchar ?loc ?attrs x = Pat.constant ?loc ?attrs (Pconst_char x) -let pfloat ?loc ?attrs x = Pat.constant ?loc ?attrs (Pconst_float (string_of_float x, None)) - -let tconstr ?loc ?attrs c l = Typ.constr ?loc ?attrs (lid ?loc c) l - -let get_str = function - | {pexp_desc=Pexp_constant (Pconst_string (s, _)); _} -> Some s - | _ -> None - -let get_str_with_quotation_delimiter = function - | {pexp_desc=Pexp_constant (Pconst_string (s, d)); _} -> Some (s, d) - | _ -> None - -let get_lid = function - | {pexp_desc=Pexp_ident{txt=id;_};_} -> - Some (String.concat "." (Longident.flatten id)) - | _ -> None - -let find_attr s attrs = - try Some (snd (List.find (fun (x, _) -> x.txt = s) attrs)) - with Not_found -> None - -let expr_of_payload = function - | PStr [{pstr_desc=Pstr_eval(e, _); _}] -> Some e - | _ -> None - -let find_attr_expr s attrs = - match find_attr s attrs with - | Some e -> expr_of_payload e - | None -> None - -let has_attr s attrs = - find_attr s attrs <> None diff --git a/ppx_tools_versioned.5.2/ast_convenience_405.mli b/ppx_tools_versioned.5.2/ast_convenience_405.mli deleted file mode 100644 index 4e2b6ba..0000000 --- a/ppx_tools_versioned.5.2/ast_convenience_405.mli +++ /dev/null @@ -1,112 +0,0 @@ -open Ast_405 - -(* This file is part of the ppx_tools package. It is released *) -(* under the terms of the MIT license (see LICENSE file). *) -(* Copyright 2013 Alain Frisch and LexiFi *) - -(** {1 Convenience functions to help build and deconstruct AST fragments.} *) - -open Asttypes -open Ast_helper -open Parsetree - -(** {2 Compatibility modules} *) - -module Label : sig - type t = Asttypes.arg_label - - type desc = Asttypes.arg_label = - Nolabel - | Labelled of string - | Optional of string - - val explode : t -> desc - - val nolabel : t - val labelled : string -> t - val optional : string -> t - -end - -(** {2 Provides a unified abstraction over differences in Parsetree.constant and Asttypes.constant - * types defined in ocaml 4.03 and 4.02 respectively}*) -module Constant : sig - type t = Parsetree.constant = - Pconst_integer of string * char option - | Pconst_char of char - | Pconst_string of string * string option - | Pconst_float of string * char option - - (** Convert Asttypes.constant to Constant.t *) - val of_constant : Parsetree.constant -> t - - (** Convert Constant.t to Asttypes.constant *) - val to_constant : t -> Parsetree.constant - -end - -(** {2 Misc} *) - -val lid: ?loc:loc -> string -> lid - -(** {2 Expressions} *) - -val evar: ?loc:loc -> ?attrs:attrs -> string -> expression -val let_in: ?loc:loc -> ?attrs:attrs -> ?recursive:bool -> value_binding list -> expression -> expression - -val constr: ?loc:loc -> ?attrs:attrs -> string -> expression list -> expression -val record: ?loc:loc -> ?attrs:attrs -> ?over:expression -> (string * expression) list -> expression -val tuple: ?loc:loc -> ?attrs:attrs -> expression list -> expression - -val nil: ?loc:loc -> ?attrs:attrs -> unit -> expression -val cons: ?loc:loc -> ?attrs:attrs -> expression -> expression -> expression -val list: ?loc:loc -> ?attrs:attrs -> expression list -> expression - -val unit: ?loc:loc -> ?attrs:attrs -> unit -> expression - -val func: ?loc:loc -> ?attrs:attrs -> (pattern * expression) list -> expression -val lam: ?loc:loc -> ?attrs:attrs -> ?label:Label.t -> ?default:expression -> pattern -> expression -> expression -val app: ?loc:loc -> ?attrs:attrs -> expression -> expression list -> expression - -val str: ?loc:loc -> ?attrs:attrs -> string -> expression -val int: ?loc:loc -> ?attrs:attrs -> int -> expression -val int32: ?loc:loc -> ?attrs:attrs -> int32 -> expression -val int64: ?loc:loc -> ?attrs:attrs -> int64 -> expression -val char: ?loc:loc -> ?attrs:attrs -> char -> expression -val float: ?loc:loc -> ?attrs:attrs -> float -> expression - -val sequence: ?loc:loc -> ?attrs:attrs -> expression list -> expression -(** Return [()] if the list is empty. Tail rec. *) - -(** {2 Patterns} *) - -val pvar: ?loc:loc -> ?attrs:attrs -> string -> pattern -val pconstr: ?loc:loc -> ?attrs:attrs -> string -> pattern list -> pattern -val precord: ?loc:loc -> ?attrs:attrs -> ?closed:closed_flag -> (string * pattern) list -> pattern -val ptuple: ?loc:loc -> ?attrs:attrs -> pattern list -> pattern - -val pnil: ?loc:loc -> ?attrs:attrs -> unit -> pattern -val pcons: ?loc:loc -> ?attrs:attrs -> pattern -> pattern -> pattern -val plist: ?loc:loc -> ?attrs:attrs -> pattern list -> pattern - -val pstr: ?loc:loc -> ?attrs:attrs -> string -> pattern -val pint: ?loc:loc -> ?attrs:attrs -> int -> pattern -val pchar: ?loc:loc -> ?attrs:attrs -> char -> pattern -val pfloat: ?loc:loc -> ?attrs:attrs -> float -> pattern - -val punit: ?loc:loc -> ?attrs:attrs -> unit -> pattern - - -(** {2 Types} *) - -val tconstr: ?loc:loc -> ?attrs:attrs -> string -> core_type list -> core_type - -(** {2 AST deconstruction} *) - -val get_str: expression -> string option -val get_str_with_quotation_delimiter: expression -> (string * string option) option -val get_lid: expression -> string option - -val has_attr: string -> attributes -> bool -val find_attr: string -> attributes -> payload option -val find_attr_expr: string -> attributes -> expression option diff --git a/ppx_tools_versioned.5.2/ast_convenience_406.ml b/ppx_tools_versioned.5.2/ast_convenience_406.ml deleted file mode 100644 index 7a8f2d0..0000000 --- a/ppx_tools_versioned.5.2/ast_convenience_406.ml +++ /dev/null @@ -1,124 +0,0 @@ -open Ast_406 - -(* This file is part of the ppx_tools package. It is released *) -(* under the terms of the MIT license (see LICENSE file). *) -(* Copyright 2013 Alain Frisch and LexiFi *) - -open Parsetree -open Asttypes -open Location -open Ast_helper - - -module Label = struct - - type t = Asttypes.arg_label - - type desc = Asttypes.arg_label = - Nolabel - | Labelled of string - | Optional of string - - let explode x = x - - let nolabel = Nolabel - let labelled x = Labelled x - let optional x = Optional x - -end - -module Constant = struct - type t = Parsetree.constant = - Pconst_integer of string * char option - | Pconst_char of char - | Pconst_string of string * string option - | Pconst_float of string * char option - - let of_constant x = x - - let to_constant x = x - -end - -let may_tuple ?loc tup = function - | [] -> None - | [x] -> Some x - | l -> Some (tup ?loc ?attrs:None l) - -let lid ?(loc = !default_loc) s = mkloc (Longident.parse s) loc -let constr ?loc ?attrs s args = Exp.construct ?loc ?attrs (lid ?loc s) (may_tuple ?loc Exp.tuple args) -let nil ?loc ?attrs () = constr ?loc ?attrs "[]" [] -let unit ?loc ?attrs () = constr ?loc ?attrs "()" [] -let tuple ?loc ?attrs = function - | [] -> unit ?loc ?attrs () - | [x] -> x - | xs -> Exp.tuple ?loc ?attrs xs -let cons ?loc ?attrs hd tl = constr ?loc ?attrs "::" [hd; tl] -let list ?loc ?attrs l = List.fold_right (cons ?loc ?attrs) l (nil ?loc ?attrs ()) -let str ?loc ?attrs s = Exp.constant ?loc ?attrs (Pconst_string (s, None)) -let int ?loc ?attrs x = Exp.constant ?loc ?attrs (Pconst_integer (string_of_int x, None)) -let int32 ?loc ?attrs x = Exp.constant ?loc ?attrs (Pconst_integer (Int32.to_string x, Some 'l')) -let int64 ?loc ?attrs x = Exp.constant ?loc ?attrs (Pconst_integer (Int64.to_string x, Some 'L')) -let char ?loc ?attrs x = Exp.constant ?loc ?attrs (Pconst_char x) -let float ?loc ?attrs x = Exp.constant ?loc ?attrs (Pconst_float (string_of_float x, None)) -let record ?loc ?attrs ?over l = - Exp.record ?loc ?attrs (List.map (fun (s, e) -> (lid ~loc:e.pexp_loc s, e)) l) over -let func ?loc ?attrs l = Exp.function_ ?loc ?attrs (List.map (fun (p, e) -> Exp.case p e) l) -let lam ?loc ?attrs ?(label = Label.nolabel) ?default pat exp = Exp.fun_ ?loc ?attrs label default pat exp -let app ?loc ?attrs f l = if l = [] then f else Exp.apply ?loc ?attrs f (List.map (fun a -> Label.nolabel, a) l) -let evar ?loc ?attrs s = Exp.ident ?loc ?attrs (lid ?loc s) -let let_in ?loc ?attrs ?(recursive = false) b body = - Exp.let_ ?loc ?attrs (if recursive then Recursive else Nonrecursive) b body - -let sequence ?loc ?attrs = function - | [] -> unit ?loc ?attrs () - | hd :: tl -> List.fold_left (fun e1 e2 -> Exp.sequence ?loc ?attrs e1 e2) hd tl - -let pvar ?(loc = !default_loc) ?attrs s = Pat.var ~loc ?attrs (mkloc s loc) -let pconstr ?loc ?attrs s args = Pat.construct ?loc ?attrs (lid ?loc s) (may_tuple ?loc Pat.tuple args) -let precord ?loc ?attrs ?(closed = Open) l = - Pat.record ?loc ?attrs (List.map (fun (s, e) -> (lid ~loc:e.ppat_loc s, e)) l) closed -let pnil ?loc ?attrs () = pconstr ?loc ?attrs "[]" [] -let pcons ?loc ?attrs hd tl = pconstr ?loc ?attrs "::" [hd; tl] -let punit ?loc ?attrs () = pconstr ?loc ?attrs "()" [] -let ptuple ?loc ?attrs = function - | [] -> punit ?loc ?attrs () - | [x] -> x - | xs -> Pat.tuple ?loc ?attrs xs -let plist ?loc ?attrs l = List.fold_right (pcons ?loc ?attrs) l (pnil ?loc ?attrs ()) - -let pstr ?loc ?attrs s = Pat.constant ?loc ?attrs (Pconst_string (s, None)) -let pint ?loc ?attrs x = Pat.constant ?loc ?attrs (Pconst_integer (string_of_int x, None)) -let pchar ?loc ?attrs x = Pat.constant ?loc ?attrs (Pconst_char x) -let pfloat ?loc ?attrs x = Pat.constant ?loc ?attrs (Pconst_float (string_of_float x, None)) - -let tconstr ?loc ?attrs c l = Typ.constr ?loc ?attrs (lid ?loc c) l - -let get_str = function - | {pexp_desc=Pexp_constant (Pconst_string (s, _)); _} -> Some s - | _ -> None - -let get_str_with_quotation_delimiter = function - | {pexp_desc=Pexp_constant (Pconst_string (s, d)); _} -> Some (s, d) - | _ -> None - -let get_lid = function - | {pexp_desc=Pexp_ident{txt=id;_};_} -> - Some (String.concat "." (Longident.flatten id)) - | _ -> None - -let find_attr s attrs = - try Some (snd (List.find (fun (x, _) -> x.txt = s) attrs)) - with Not_found -> None - -let expr_of_payload = function - | PStr [{pstr_desc=Pstr_eval(e, _); _}] -> Some e - | _ -> None - -let find_attr_expr s attrs = - match find_attr s attrs with - | Some e -> expr_of_payload e - | None -> None - -let has_attr s attrs = - find_attr s attrs <> None diff --git a/ppx_tools_versioned.5.2/ast_convenience_406.mli b/ppx_tools_versioned.5.2/ast_convenience_406.mli deleted file mode 100644 index 43da159..0000000 --- a/ppx_tools_versioned.5.2/ast_convenience_406.mli +++ /dev/null @@ -1,112 +0,0 @@ -open Ast_406 - -(* This file is part of the ppx_tools package. It is released *) -(* under the terms of the MIT license (see LICENSE file). *) -(* Copyright 2013 Alain Frisch and LexiFi *) - -(** {1 Convenience functions to help build and deconstruct AST fragments.} *) - -open Asttypes -open Ast_helper -open Parsetree - -(** {2 Compatibility modules} *) - -module Label : sig - type t = Asttypes.arg_label - - type desc = Asttypes.arg_label = - Nolabel - | Labelled of string - | Optional of string - - val explode : t -> desc - - val nolabel : t - val labelled : string -> t - val optional : string -> t - -end - -(** {2 Provides a unified abstraction over differences in Parsetree.constant and Asttypes.constant - * types defined in ocaml 4.03 and 4.02 respectively}*) -module Constant : sig - type t = Parsetree.constant = - Pconst_integer of string * char option - | Pconst_char of char - | Pconst_string of string * string option - | Pconst_float of string * char option - - (** Convert Asttypes.constant to Constant.t *) - val of_constant : Parsetree.constant -> t - - (** Convert Constant.t to Asttypes.constant *) - val to_constant : t -> Parsetree.constant - -end - -(** {2 Misc} *) - -val lid: ?loc:loc -> string -> lid - -(** {2 Expressions} *) - -val evar: ?loc:loc -> ?attrs:attrs -> string -> expression -val let_in: ?loc:loc -> ?attrs:attrs -> ?recursive:bool -> value_binding list -> expression -> expression - -val constr: ?loc:loc -> ?attrs:attrs -> string -> expression list -> expression -val record: ?loc:loc -> ?attrs:attrs -> ?over:expression -> (string * expression) list -> expression -val tuple: ?loc:loc -> ?attrs:attrs -> expression list -> expression - -val nil: ?loc:loc -> ?attrs:attrs -> unit -> expression -val cons: ?loc:loc -> ?attrs:attrs -> expression -> expression -> expression -val list: ?loc:loc -> ?attrs:attrs -> expression list -> expression - -val unit: ?loc:loc -> ?attrs:attrs -> unit -> expression - -val func: ?loc:loc -> ?attrs:attrs -> (pattern * expression) list -> expression -val lam: ?loc:loc -> ?attrs:attrs -> ?label:Label.t -> ?default:expression -> pattern -> expression -> expression -val app: ?loc:loc -> ?attrs:attrs -> expression -> expression list -> expression - -val str: ?loc:loc -> ?attrs:attrs -> string -> expression -val int: ?loc:loc -> ?attrs:attrs -> int -> expression -val int32: ?loc:loc -> ?attrs:attrs -> int32 -> expression -val int64: ?loc:loc -> ?attrs:attrs -> int64 -> expression -val char: ?loc:loc -> ?attrs:attrs -> char -> expression -val float: ?loc:loc -> ?attrs:attrs -> float -> expression - -val sequence: ?loc:loc -> ?attrs:attrs -> expression list -> expression -(** Return [()] if the list is empty. Tail rec. *) - -(** {2 Patterns} *) - -val pvar: ?loc:loc -> ?attrs:attrs -> string -> pattern -val pconstr: ?loc:loc -> ?attrs:attrs -> string -> pattern list -> pattern -val precord: ?loc:loc -> ?attrs:attrs -> ?closed:closed_flag -> (string * pattern) list -> pattern -val ptuple: ?loc:loc -> ?attrs:attrs -> pattern list -> pattern - -val pnil: ?loc:loc -> ?attrs:attrs -> unit -> pattern -val pcons: ?loc:loc -> ?attrs:attrs -> pattern -> pattern -> pattern -val plist: ?loc:loc -> ?attrs:attrs -> pattern list -> pattern - -val pstr: ?loc:loc -> ?attrs:attrs -> string -> pattern -val pint: ?loc:loc -> ?attrs:attrs -> int -> pattern -val pchar: ?loc:loc -> ?attrs:attrs -> char -> pattern -val pfloat: ?loc:loc -> ?attrs:attrs -> float -> pattern - -val punit: ?loc:loc -> ?attrs:attrs -> unit -> pattern - - -(** {2 Types} *) - -val tconstr: ?loc:loc -> ?attrs:attrs -> string -> core_type list -> core_type - -(** {2 AST deconstruction} *) - -val get_str: expression -> string option -val get_str_with_quotation_delimiter: expression -> (string * string option) option -val get_lid: expression -> string option - -val has_attr: string -> attributes -> bool -val find_attr: string -> attributes -> payload option -val find_attr_expr: string -> attributes -> expression option diff --git a/ppx_tools_versioned.5.2/ast_lifter_402.ml b/ppx_tools_versioned.5.2/ast_lifter_402.ml deleted file mode 100644 index 8b44f8b..0000000 --- a/ppx_tools_versioned.5.2/ast_lifter_402.ml +++ /dev/null @@ -1,1353 +0,0 @@ -open Ast_402 - -class virtual ['res] lifter = - object (this) - method lift_Parsetree_expression : Parsetree.expression -> 'res= - (fun - { Parsetree.pexp_desc = pexp_desc; Parsetree.pexp_loc = pexp_loc; - Parsetree.pexp_attributes = pexp_attributes } - -> - this#record "Ast_402.Parsetree.expression" - [("pexp_desc", (this#lift_Parsetree_expression_desc pexp_desc)); - ("pexp_loc", (this#lift_Location_t pexp_loc)); - ("pexp_attributes", - (this#lift_Parsetree_attributes pexp_attributes))] : Parsetree.expression - -> - 'res) - method lift_Parsetree_expression_desc : - Parsetree.expression_desc -> 'res= - (function - | Parsetree.Pexp_ident x0 -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_ident", - [this#lift_Asttypes_loc this#lift_Longident_t x0]) - | Parsetree.Pexp_constant x0 -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_constant", [this#lift_Asttypes_constant x0]) - | Parsetree.Pexp_let (x0,x1,x2) -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_let", - [this#lift_Asttypes_rec_flag x0; - this#list (List.map this#lift_Parsetree_value_binding x1); - this#lift_Parsetree_expression x2]) - | Parsetree.Pexp_function x0 -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_function", - [this#list (List.map this#lift_Parsetree_case x0)]) - | Parsetree.Pexp_fun (x0,x1,x2,x3) -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_fun", - [this#lift_Asttypes_label x0; - this#lift_option this#lift_Parsetree_expression x1; - this#lift_Parsetree_pattern x2; - this#lift_Parsetree_expression x3]) - | Parsetree.Pexp_apply (x0,x1) -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_apply", - [this#lift_Parsetree_expression x0; - this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_label x0; - this#lift_Parsetree_expression x1]) x1)]) - | Parsetree.Pexp_match (x0,x1) -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_match", - [this#lift_Parsetree_expression x0; - this#list (List.map this#lift_Parsetree_case x1)]) - | Parsetree.Pexp_try (x0,x1) -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_try", - [this#lift_Parsetree_expression x0; - this#list (List.map this#lift_Parsetree_case x1)]) - | Parsetree.Pexp_tuple x0 -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_tuple", - [this#list (List.map this#lift_Parsetree_expression x0)]) - | Parsetree.Pexp_construct (x0,x1) -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_construct", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_option this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_variant (x0,x1) -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_variant", - [this#lift_Asttypes_label x0; - this#lift_option this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_record (x0,x1) -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_record", - [this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_Parsetree_expression x1]) x0); - this#lift_option this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_field (x0,x1) -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_field", - [this#lift_Parsetree_expression x0; - this#lift_Asttypes_loc this#lift_Longident_t x1]) - | Parsetree.Pexp_setfield (x0,x1,x2) -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_setfield", - [this#lift_Parsetree_expression x0; - this#lift_Asttypes_loc this#lift_Longident_t x1; - this#lift_Parsetree_expression x2]) - | Parsetree.Pexp_array x0 -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_array", - [this#list (List.map this#lift_Parsetree_expression x0)]) - | Parsetree.Pexp_ifthenelse (x0,x1,x2) -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_ifthenelse", - [this#lift_Parsetree_expression x0; - this#lift_Parsetree_expression x1; - this#lift_option this#lift_Parsetree_expression x2]) - | Parsetree.Pexp_sequence (x0,x1) -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_sequence", - [this#lift_Parsetree_expression x0; - this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_while (x0,x1) -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_while", - [this#lift_Parsetree_expression x0; - this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_for (x0,x1,x2,x3,x4) -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_for", - [this#lift_Parsetree_pattern x0; - this#lift_Parsetree_expression x1; - this#lift_Parsetree_expression x2; - this#lift_Asttypes_direction_flag x3; - this#lift_Parsetree_expression x4]) - | Parsetree.Pexp_constraint (x0,x1) -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_constraint", - [this#lift_Parsetree_expression x0; - this#lift_Parsetree_core_type x1]) - | Parsetree.Pexp_coerce (x0,x1,x2) -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_coerce", - [this#lift_Parsetree_expression x0; - this#lift_option this#lift_Parsetree_core_type x1; - this#lift_Parsetree_core_type x2]) - | Parsetree.Pexp_send (x0,x1) -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_send", - [this#lift_Parsetree_expression x0; this#string x1]) - | Parsetree.Pexp_new x0 -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_new", [this#lift_Asttypes_loc this#lift_Longident_t x0]) - | Parsetree.Pexp_setinstvar (x0,x1) -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_setinstvar", - [this#lift_Asttypes_loc this#string x0; - this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_override x0 -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_override", - [this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_loc this#string x0; - this#lift_Parsetree_expression x1]) x0)]) - | Parsetree.Pexp_letmodule (x0,x1,x2) -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_letmodule", - [this#lift_Asttypes_loc this#string x0; - this#lift_Parsetree_module_expr x1; - this#lift_Parsetree_expression x2]) - | Parsetree.Pexp_assert x0 -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_assert", [this#lift_Parsetree_expression x0]) - | Parsetree.Pexp_lazy x0 -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_lazy", [this#lift_Parsetree_expression x0]) - | Parsetree.Pexp_poly (x0,x1) -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_poly", - [this#lift_Parsetree_expression x0; - this#lift_option this#lift_Parsetree_core_type x1]) - | Parsetree.Pexp_object x0 -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_object", [this#lift_Parsetree_class_structure x0]) - | Parsetree.Pexp_newtype (x0,x1) -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_newtype", - [this#string x0; this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_pack x0 -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_pack", [this#lift_Parsetree_module_expr x0]) - | Parsetree.Pexp_open (x0,x1,x2) -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_open", - [this#lift_Asttypes_override_flag x0; - this#lift_Asttypes_loc this#lift_Longident_t x1; - this#lift_Parsetree_expression x2]) - | Parsetree.Pexp_extension x0 -> - this#constr "Ast_402.Parsetree.expression_desc" - ("Pexp_extension", [this#lift_Parsetree_extension x0]) : - Parsetree.expression_desc -> 'res) - method lift_Asttypes_direction_flag : Asttypes.direction_flag -> 'res= - (function - | Asttypes.Upto -> this#constr "Ast_402.Asttypes.direction_flag" ("Upto", []) - | Asttypes.Downto -> - this#constr "Ast_402.Asttypes.direction_flag" ("Downto", []) : Asttypes.direction_flag - -> - 'res) - method lift_Parsetree_case : Parsetree.case -> 'res= - (fun - { Parsetree.pc_lhs = pc_lhs; Parsetree.pc_guard = pc_guard; - Parsetree.pc_rhs = pc_rhs } - -> - this#record "Ast_402.Parsetree.case" - [("pc_lhs", (this#lift_Parsetree_pattern pc_lhs)); - ("pc_guard", - (this#lift_option this#lift_Parsetree_expression pc_guard)); - ("pc_rhs", (this#lift_Parsetree_expression pc_rhs))] : Parsetree.case - -> - 'res) - method lift_Parsetree_value_binding : Parsetree.value_binding -> 'res= - (fun - { Parsetree.pvb_pat = pvb_pat; Parsetree.pvb_expr = pvb_expr; - Parsetree.pvb_attributes = pvb_attributes; - Parsetree.pvb_loc = pvb_loc } - -> - this#record "Ast_402.Parsetree.value_binding" - [("pvb_pat", (this#lift_Parsetree_pattern pvb_pat)); - ("pvb_expr", (this#lift_Parsetree_expression pvb_expr)); - ("pvb_attributes", - (this#lift_Parsetree_attributes pvb_attributes)); - ("pvb_loc", (this#lift_Location_t pvb_loc))] : Parsetree.value_binding - -> 'res) - method lift_Parsetree_pattern : Parsetree.pattern -> 'res= - (fun - { Parsetree.ppat_desc = ppat_desc; Parsetree.ppat_loc = ppat_loc; - Parsetree.ppat_attributes = ppat_attributes } - -> - this#record "Ast_402.Parsetree.pattern" - [("ppat_desc", (this#lift_Parsetree_pattern_desc ppat_desc)); - ("ppat_loc", (this#lift_Location_t ppat_loc)); - ("ppat_attributes", - (this#lift_Parsetree_attributes ppat_attributes))] : Parsetree.pattern - -> - 'res) - method lift_Parsetree_pattern_desc : Parsetree.pattern_desc -> 'res= - (function - | Parsetree.Ppat_any -> - this#constr "Ast_402.Parsetree.pattern_desc" ("Ppat_any", []) - | Parsetree.Ppat_var x0 -> - this#constr "Ast_402.Parsetree.pattern_desc" - ("Ppat_var", [this#lift_Asttypes_loc this#string x0]) - | Parsetree.Ppat_alias (x0,x1) -> - this#constr "Ast_402.Parsetree.pattern_desc" - ("Ppat_alias", - [this#lift_Parsetree_pattern x0; - this#lift_Asttypes_loc this#string x1]) - | Parsetree.Ppat_constant x0 -> - this#constr "Ast_402.Parsetree.pattern_desc" - ("Ppat_constant", [this#lift_Asttypes_constant x0]) - | Parsetree.Ppat_interval (x0,x1) -> - this#constr "Ast_402.Parsetree.pattern_desc" - ("Ppat_interval", - [this#lift_Asttypes_constant x0; - this#lift_Asttypes_constant x1]) - | Parsetree.Ppat_tuple x0 -> - this#constr "Ast_402.Parsetree.pattern_desc" - ("Ppat_tuple", - [this#list (List.map this#lift_Parsetree_pattern x0)]) - | Parsetree.Ppat_construct (x0,x1) -> - this#constr "Ast_402.Parsetree.pattern_desc" - ("Ppat_construct", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_option this#lift_Parsetree_pattern x1]) - | Parsetree.Ppat_variant (x0,x1) -> - this#constr "Ast_402.Parsetree.pattern_desc" - ("Ppat_variant", - [this#lift_Asttypes_label x0; - this#lift_option this#lift_Parsetree_pattern x1]) - | Parsetree.Ppat_record (x0,x1) -> - this#constr "Ast_402.Parsetree.pattern_desc" - ("Ppat_record", - [this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_Parsetree_pattern x1]) x0); - this#lift_Asttypes_closed_flag x1]) - | Parsetree.Ppat_array x0 -> - this#constr "Ast_402.Parsetree.pattern_desc" - ("Ppat_array", - [this#list (List.map this#lift_Parsetree_pattern x0)]) - | Parsetree.Ppat_or (x0,x1) -> - this#constr "Ast_402.Parsetree.pattern_desc" - ("Ppat_or", - [this#lift_Parsetree_pattern x0; - this#lift_Parsetree_pattern x1]) - | Parsetree.Ppat_constraint (x0,x1) -> - this#constr "Ast_402.Parsetree.pattern_desc" - ("Ppat_constraint", - [this#lift_Parsetree_pattern x0; - this#lift_Parsetree_core_type x1]) - | Parsetree.Ppat_type x0 -> - this#constr "Ast_402.Parsetree.pattern_desc" - ("Ppat_type", [this#lift_Asttypes_loc this#lift_Longident_t x0]) - | Parsetree.Ppat_lazy x0 -> - this#constr "Ast_402.Parsetree.pattern_desc" - ("Ppat_lazy", [this#lift_Parsetree_pattern x0]) - | Parsetree.Ppat_unpack x0 -> - this#constr "Ast_402.Parsetree.pattern_desc" - ("Ppat_unpack", [this#lift_Asttypes_loc this#string x0]) - | Parsetree.Ppat_exception x0 -> - this#constr "Ast_402.Parsetree.pattern_desc" - ("Ppat_exception", [this#lift_Parsetree_pattern x0]) - | Parsetree.Ppat_extension x0 -> - this#constr "Ast_402.Parsetree.pattern_desc" - ("Ppat_extension", [this#lift_Parsetree_extension x0]) : - Parsetree.pattern_desc -> 'res) - method lift_Parsetree_core_type : Parsetree.core_type -> 'res= - (fun - { Parsetree.ptyp_desc = ptyp_desc; Parsetree.ptyp_loc = ptyp_loc; - Parsetree.ptyp_attributes = ptyp_attributes } - -> - this#record "Ast_402.Parsetree.core_type" - [("ptyp_desc", (this#lift_Parsetree_core_type_desc ptyp_desc)); - ("ptyp_loc", (this#lift_Location_t ptyp_loc)); - ("ptyp_attributes", - (this#lift_Parsetree_attributes ptyp_attributes))] : Parsetree.core_type - -> - 'res) - method lift_Parsetree_core_type_desc : Parsetree.core_type_desc -> 'res= - (function - | Parsetree.Ptyp_any -> - this#constr "Ast_402.Parsetree.core_type_desc" ("Ptyp_any", []) - | Parsetree.Ptyp_var x0 -> - this#constr "Ast_402.Parsetree.core_type_desc" - ("Ptyp_var", [this#string x0]) - | Parsetree.Ptyp_arrow (x0,x1,x2) -> - this#constr "Ast_402.Parsetree.core_type_desc" - ("Ptyp_arrow", - [this#lift_Asttypes_label x0; - this#lift_Parsetree_core_type x1; - this#lift_Parsetree_core_type x2]) - | Parsetree.Ptyp_tuple x0 -> - this#constr "Ast_402.Parsetree.core_type_desc" - ("Ptyp_tuple", - [this#list (List.map this#lift_Parsetree_core_type x0)]) - | Parsetree.Ptyp_constr (x0,x1) -> - this#constr "Ast_402.Parsetree.core_type_desc" - ("Ptyp_constr", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#list (List.map this#lift_Parsetree_core_type x1)]) - | Parsetree.Ptyp_object (x0,x1) -> - this#constr "Ast_402.Parsetree.core_type_desc" - ("Ptyp_object", - [this#list - (List.map - (fun x -> - let (x0,x1,x2) = x in - this#tuple - [this#string x0; - this#lift_Parsetree_attributes x1; - this#lift_Parsetree_core_type x2]) x0); - this#lift_Asttypes_closed_flag x1]) - | Parsetree.Ptyp_class (x0,x1) -> - this#constr "Ast_402.Parsetree.core_type_desc" - ("Ptyp_class", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#list (List.map this#lift_Parsetree_core_type x1)]) - | Parsetree.Ptyp_alias (x0,x1) -> - this#constr "Ast_402.Parsetree.core_type_desc" - ("Ptyp_alias", - [this#lift_Parsetree_core_type x0; this#string x1]) - | Parsetree.Ptyp_variant (x0,x1,x2) -> - this#constr "Ast_402.Parsetree.core_type_desc" - ("Ptyp_variant", - [this#list (List.map this#lift_Parsetree_row_field x0); - this#lift_Asttypes_closed_flag x1; - this#lift_option - (fun x -> this#list (List.map this#lift_Asttypes_label x)) - x2]) - | Parsetree.Ptyp_poly (x0,x1) -> - this#constr "Ast_402.Parsetree.core_type_desc" - ("Ptyp_poly", - [this#list (List.map this#string x0); - this#lift_Parsetree_core_type x1]) - | Parsetree.Ptyp_package x0 -> - this#constr "Ast_402.Parsetree.core_type_desc" - ("Ptyp_package", [this#lift_Parsetree_package_type x0]) - | Parsetree.Ptyp_extension x0 -> - this#constr "Ast_402.Parsetree.core_type_desc" - ("Ptyp_extension", [this#lift_Parsetree_extension x0]) : - Parsetree.core_type_desc -> 'res) - method lift_Parsetree_package_type : Parsetree.package_type -> 'res= - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_Parsetree_core_type x1]) x1)] : Parsetree.package_type - -> 'res) - method lift_Parsetree_row_field : Parsetree.row_field -> 'res= - (function - | Parsetree.Rtag (x0,x1,x2,x3) -> - this#constr "Ast_402.Parsetree.row_field" - ("Rtag", - [this#lift_Asttypes_label x0; - this#lift_Parsetree_attributes x1; - this#lift_bool x2; - this#list (List.map this#lift_Parsetree_core_type x3)]) - | Parsetree.Rinherit x0 -> - this#constr "Ast_402.Parsetree.row_field" - ("Rinherit", [this#lift_Parsetree_core_type x0]) : Parsetree.row_field - -> - 'res) - method lift_Parsetree_attributes : Parsetree.attributes -> 'res= - (fun x -> this#list (List.map this#lift_Parsetree_attribute x) : - Parsetree.attributes -> 'res) - method lift_Parsetree_attribute : Parsetree.attribute -> 'res= - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_loc this#string x0; - this#lift_Parsetree_payload x1] : Parsetree.attribute -> 'res) - method lift_Parsetree_payload : Parsetree.payload -> 'res= - (function - | Parsetree.PStr x0 -> - this#constr "Ast_402.Parsetree.payload" - ("PStr", [this#lift_Parsetree_structure x0]) - | Parsetree.PTyp x0 -> - this#constr "Ast_402.Parsetree.payload" - ("PTyp", [this#lift_Parsetree_core_type x0]) - | Parsetree.PPat (x0,x1) -> - this#constr "Ast_402.Parsetree.payload" - ("PPat", - [this#lift_Parsetree_pattern x0; - this#lift_option this#lift_Parsetree_expression x1]) : - Parsetree.payload -> 'res) - method lift_Parsetree_structure : Parsetree.structure -> 'res= - (fun x -> this#list (List.map this#lift_Parsetree_structure_item x) : - Parsetree.structure -> 'res) - method lift_Parsetree_structure_item : Parsetree.structure_item -> 'res= - (fun { Parsetree.pstr_desc = pstr_desc; Parsetree.pstr_loc = pstr_loc } - -> - this#record "Ast_402.Parsetree.structure_item" - [("pstr_desc", - (this#lift_Parsetree_structure_item_desc pstr_desc)); - ("pstr_loc", (this#lift_Location_t pstr_loc))] : Parsetree.structure_item - -> 'res) - method lift_Parsetree_structure_item_desc : - Parsetree.structure_item_desc -> 'res= - (function - | Parsetree.Pstr_eval (x0,x1) -> - this#constr "Ast_402.Parsetree.structure_item_desc" - ("Pstr_eval", - [this#lift_Parsetree_expression x0; - this#lift_Parsetree_attributes x1]) - | Parsetree.Pstr_value (x0,x1) -> - this#constr "Ast_402.Parsetree.structure_item_desc" - ("Pstr_value", - [this#lift_Asttypes_rec_flag x0; - this#list (List.map this#lift_Parsetree_value_binding x1)]) - | Parsetree.Pstr_primitive x0 -> - this#constr "Ast_402.Parsetree.structure_item_desc" - ("Pstr_primitive", [this#lift_Parsetree_value_description x0]) - | Parsetree.Pstr_type x0 -> - this#constr "Ast_402.Parsetree.structure_item_desc" - ("Pstr_type", - [this#list (List.map this#lift_Parsetree_type_declaration x0)]) - | Parsetree.Pstr_typext x0 -> - this#constr "Ast_402.Parsetree.structure_item_desc" - ("Pstr_typext", [this#lift_Parsetree_type_extension x0]) - | Parsetree.Pstr_exception x0 -> - this#constr "Ast_402.Parsetree.structure_item_desc" - ("Pstr_exception", - [this#lift_Parsetree_extension_constructor x0]) - | Parsetree.Pstr_module x0 -> - this#constr "Ast_402.Parsetree.structure_item_desc" - ("Pstr_module", [this#lift_Parsetree_module_binding x0]) - | Parsetree.Pstr_recmodule x0 -> - this#constr "Ast_402.Parsetree.structure_item_desc" - ("Pstr_recmodule", - [this#list (List.map this#lift_Parsetree_module_binding x0)]) - | Parsetree.Pstr_modtype x0 -> - this#constr "Ast_402.Parsetree.structure_item_desc" - ("Pstr_modtype", - [this#lift_Parsetree_module_type_declaration x0]) - | Parsetree.Pstr_open x0 -> - this#constr "Ast_402.Parsetree.structure_item_desc" - ("Pstr_open", [this#lift_Parsetree_open_description x0]) - | Parsetree.Pstr_class x0 -> - this#constr "Ast_402.Parsetree.structure_item_desc" - ("Pstr_class", - [this#list (List.map this#lift_Parsetree_class_declaration x0)]) - | Parsetree.Pstr_class_type x0 -> - this#constr "Ast_402.Parsetree.structure_item_desc" - ("Pstr_class_type", - [this#list - (List.map this#lift_Parsetree_class_type_declaration x0)]) - | Parsetree.Pstr_include x0 -> - this#constr "Ast_402.Parsetree.structure_item_desc" - ("Pstr_include", [this#lift_Parsetree_include_declaration x0]) - | Parsetree.Pstr_attribute x0 -> - this#constr "Ast_402.Parsetree.structure_item_desc" - ("Pstr_attribute", [this#lift_Parsetree_attribute x0]) - | Parsetree.Pstr_extension (x0,x1) -> - this#constr "Ast_402.Parsetree.structure_item_desc" - ("Pstr_extension", - [this#lift_Parsetree_extension x0; - this#lift_Parsetree_attributes x1]) : Parsetree.structure_item_desc - -> 'res) - method lift_Parsetree_include_declaration : - Parsetree.include_declaration -> 'res= - (fun x -> - this#lift_Parsetree_include_infos this#lift_Parsetree_module_expr x : - Parsetree.include_declaration -> 'res) - method lift_Parsetree_class_declaration : - Parsetree.class_declaration -> 'res= - (fun x -> - this#lift_Parsetree_class_infos this#lift_Parsetree_class_expr x : - Parsetree.class_declaration -> 'res) - method lift_Parsetree_class_expr : Parsetree.class_expr -> 'res= - (fun - { Parsetree.pcl_desc = pcl_desc; Parsetree.pcl_loc = pcl_loc; - Parsetree.pcl_attributes = pcl_attributes } - -> - this#record "Ast_402.Parsetree.class_expr" - [("pcl_desc", (this#lift_Parsetree_class_expr_desc pcl_desc)); - ("pcl_loc", (this#lift_Location_t pcl_loc)); - ("pcl_attributes", - (this#lift_Parsetree_attributes pcl_attributes))] : Parsetree.class_expr - -> - 'res) - method lift_Parsetree_class_expr_desc : - Parsetree.class_expr_desc -> 'res= - (function - | Parsetree.Pcl_constr (x0,x1) -> - this#constr "Ast_402.Parsetree.class_expr_desc" - ("Pcl_constr", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#list (List.map this#lift_Parsetree_core_type x1)]) - | Parsetree.Pcl_structure x0 -> - this#constr "Ast_402.Parsetree.class_expr_desc" - ("Pcl_structure", [this#lift_Parsetree_class_structure x0]) - | Parsetree.Pcl_fun (x0,x1,x2,x3) -> - this#constr "Ast_402.Parsetree.class_expr_desc" - ("Pcl_fun", - [this#lift_Asttypes_label x0; - this#lift_option this#lift_Parsetree_expression x1; - this#lift_Parsetree_pattern x2; - this#lift_Parsetree_class_expr x3]) - | Parsetree.Pcl_apply (x0,x1) -> - this#constr "Ast_402.Parsetree.class_expr_desc" - ("Pcl_apply", - [this#lift_Parsetree_class_expr x0; - this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_label x0; - this#lift_Parsetree_expression x1]) x1)]) - | Parsetree.Pcl_let (x0,x1,x2) -> - this#constr "Ast_402.Parsetree.class_expr_desc" - ("Pcl_let", - [this#lift_Asttypes_rec_flag x0; - this#list (List.map this#lift_Parsetree_value_binding x1); - this#lift_Parsetree_class_expr x2]) - | Parsetree.Pcl_constraint (x0,x1) -> - this#constr "Ast_402.Parsetree.class_expr_desc" - ("Pcl_constraint", - [this#lift_Parsetree_class_expr x0; - this#lift_Parsetree_class_type x1]) - | Parsetree.Pcl_extension x0 -> - this#constr "Ast_402.Parsetree.class_expr_desc" - ("Pcl_extension", [this#lift_Parsetree_extension x0]) : - Parsetree.class_expr_desc -> 'res) - method lift_Parsetree_class_structure : - Parsetree.class_structure -> 'res= - (fun - { Parsetree.pcstr_self = pcstr_self; - Parsetree.pcstr_fields = pcstr_fields } - -> - this#record "Ast_402.Parsetree.class_structure" - [("pcstr_self", (this#lift_Parsetree_pattern pcstr_self)); - ("pcstr_fields", - (this#list - (List.map this#lift_Parsetree_class_field pcstr_fields)))] : - Parsetree.class_structure -> 'res) - method lift_Parsetree_class_field : Parsetree.class_field -> 'res= - (fun - { Parsetree.pcf_desc = pcf_desc; Parsetree.pcf_loc = pcf_loc; - Parsetree.pcf_attributes = pcf_attributes } - -> - this#record "Ast_402.Parsetree.class_field" - [("pcf_desc", (this#lift_Parsetree_class_field_desc pcf_desc)); - ("pcf_loc", (this#lift_Location_t pcf_loc)); - ("pcf_attributes", - (this#lift_Parsetree_attributes pcf_attributes))] : Parsetree.class_field - -> - 'res) - method lift_Parsetree_class_field_desc : - Parsetree.class_field_desc -> 'res= - (function - | Parsetree.Pcf_inherit (x0,x1,x2) -> - this#constr "Ast_402.Parsetree.class_field_desc" - ("Pcf_inherit", - [this#lift_Asttypes_override_flag x0; - this#lift_Parsetree_class_expr x1; - this#lift_option this#string x2]) - | Parsetree.Pcf_val x0 -> - this#constr "Ast_402.Parsetree.class_field_desc" - ("Pcf_val", - [(let (x0,x1,x2) = x0 in - this#tuple - [this#lift_Asttypes_loc this#string x0; - this#lift_Asttypes_mutable_flag x1; - this#lift_Parsetree_class_field_kind x2])]) - | Parsetree.Pcf_method x0 -> - this#constr "Ast_402.Parsetree.class_field_desc" - ("Pcf_method", - [(let (x0,x1,x2) = x0 in - this#tuple - [this#lift_Asttypes_loc this#string x0; - this#lift_Asttypes_private_flag x1; - this#lift_Parsetree_class_field_kind x2])]) - | Parsetree.Pcf_constraint x0 -> - this#constr "Ast_402.Parsetree.class_field_desc" - ("Pcf_constraint", - [(let (x0,x1) = x0 in - this#tuple - [this#lift_Parsetree_core_type x0; - this#lift_Parsetree_core_type x1])]) - | Parsetree.Pcf_initializer x0 -> - this#constr "Ast_402.Parsetree.class_field_desc" - ("Pcf_initializer", [this#lift_Parsetree_expression x0]) - | Parsetree.Pcf_attribute x0 -> - this#constr "Ast_402.Parsetree.class_field_desc" - ("Pcf_attribute", [this#lift_Parsetree_attribute x0]) - | Parsetree.Pcf_extension x0 -> - this#constr "Ast_402.Parsetree.class_field_desc" - ("Pcf_extension", [this#lift_Parsetree_extension x0]) : - Parsetree.class_field_desc -> 'res) - method lift_Parsetree_class_field_kind : - Parsetree.class_field_kind -> 'res= - (function - | Parsetree.Cfk_virtual x0 -> - this#constr "Ast_402.Parsetree.class_field_kind" - ("Cfk_virtual", [this#lift_Parsetree_core_type x0]) - | Parsetree.Cfk_concrete (x0,x1) -> - this#constr "Ast_402.Parsetree.class_field_kind" - ("Cfk_concrete", - [this#lift_Asttypes_override_flag x0; - this#lift_Parsetree_expression x1]) : Parsetree.class_field_kind - -> 'res) - method lift_Parsetree_module_binding : Parsetree.module_binding -> 'res= - (fun - { Parsetree.pmb_name = pmb_name; Parsetree.pmb_expr = pmb_expr; - Parsetree.pmb_attributes = pmb_attributes; - Parsetree.pmb_loc = pmb_loc } - -> - this#record "Ast_402.Parsetree.module_binding" - [("pmb_name", (this#lift_Asttypes_loc this#string pmb_name)); - ("pmb_expr", (this#lift_Parsetree_module_expr pmb_expr)); - ("pmb_attributes", - (this#lift_Parsetree_attributes pmb_attributes)); - ("pmb_loc", (this#lift_Location_t pmb_loc))] : Parsetree.module_binding - -> 'res) - method lift_Parsetree_module_expr : Parsetree.module_expr -> 'res= - (fun - { Parsetree.pmod_desc = pmod_desc; Parsetree.pmod_loc = pmod_loc; - Parsetree.pmod_attributes = pmod_attributes } - -> - this#record "Ast_402.Parsetree.module_expr" - [("pmod_desc", (this#lift_Parsetree_module_expr_desc pmod_desc)); - ("pmod_loc", (this#lift_Location_t pmod_loc)); - ("pmod_attributes", - (this#lift_Parsetree_attributes pmod_attributes))] : Parsetree.module_expr - -> - 'res) - method lift_Parsetree_module_expr_desc : - Parsetree.module_expr_desc -> 'res= - (function - | Parsetree.Pmod_ident x0 -> - this#constr "Ast_402.Parsetree.module_expr_desc" - ("Pmod_ident", - [this#lift_Asttypes_loc this#lift_Longident_t x0]) - | Parsetree.Pmod_structure x0 -> - this#constr "Ast_402.Parsetree.module_expr_desc" - ("Pmod_structure", [this#lift_Parsetree_structure x0]) - | Parsetree.Pmod_functor (x0,x1,x2) -> - this#constr "Ast_402.Parsetree.module_expr_desc" - ("Pmod_functor", - [this#lift_Asttypes_loc this#string x0; - this#lift_option this#lift_Parsetree_module_type x1; - this#lift_Parsetree_module_expr x2]) - | Parsetree.Pmod_apply (x0,x1) -> - this#constr "Ast_402.Parsetree.module_expr_desc" - ("Pmod_apply", - [this#lift_Parsetree_module_expr x0; - this#lift_Parsetree_module_expr x1]) - | Parsetree.Pmod_constraint (x0,x1) -> - this#constr "Ast_402.Parsetree.module_expr_desc" - ("Pmod_constraint", - [this#lift_Parsetree_module_expr x0; - this#lift_Parsetree_module_type x1]) - | Parsetree.Pmod_unpack x0 -> - this#constr "Ast_402.Parsetree.module_expr_desc" - ("Pmod_unpack", [this#lift_Parsetree_expression x0]) - | Parsetree.Pmod_extension x0 -> - this#constr "Ast_402.Parsetree.module_expr_desc" - ("Pmod_extension", [this#lift_Parsetree_extension x0]) : - Parsetree.module_expr_desc -> 'res) - method lift_Parsetree_module_type : Parsetree.module_type -> 'res= - (fun - { Parsetree.pmty_desc = pmty_desc; Parsetree.pmty_loc = pmty_loc; - Parsetree.pmty_attributes = pmty_attributes } - -> - this#record "Ast_402.Parsetree.module_type" - [("pmty_desc", (this#lift_Parsetree_module_type_desc pmty_desc)); - ("pmty_loc", (this#lift_Location_t pmty_loc)); - ("pmty_attributes", - (this#lift_Parsetree_attributes pmty_attributes))] : Parsetree.module_type - -> - 'res) - method lift_Parsetree_module_type_desc : - Parsetree.module_type_desc -> 'res= - (function - | Parsetree.Pmty_ident x0 -> - this#constr "Ast_402.Parsetree.module_type_desc" - ("Pmty_ident", - [this#lift_Asttypes_loc this#lift_Longident_t x0]) - | Parsetree.Pmty_signature x0 -> - this#constr "Ast_402.Parsetree.module_type_desc" - ("Pmty_signature", [this#lift_Parsetree_signature x0]) - | Parsetree.Pmty_functor (x0,x1,x2) -> - this#constr "Ast_402.Parsetree.module_type_desc" - ("Pmty_functor", - [this#lift_Asttypes_loc this#string x0; - this#lift_option this#lift_Parsetree_module_type x1; - this#lift_Parsetree_module_type x2]) - | Parsetree.Pmty_with (x0,x1) -> - this#constr "Ast_402.Parsetree.module_type_desc" - ("Pmty_with", - [this#lift_Parsetree_module_type x0; - this#list (List.map this#lift_Parsetree_with_constraint x1)]) - | Parsetree.Pmty_typeof x0 -> - this#constr "Ast_402.Parsetree.module_type_desc" - ("Pmty_typeof", [this#lift_Parsetree_module_expr x0]) - | Parsetree.Pmty_extension x0 -> - this#constr "Ast_402.Parsetree.module_type_desc" - ("Pmty_extension", [this#lift_Parsetree_extension x0]) - | Parsetree.Pmty_alias x0 -> - this#constr "Ast_402.Parsetree.module_type_desc" - ("Pmty_alias", - [this#lift_Asttypes_loc this#lift_Longident_t x0]) : Parsetree.module_type_desc - -> - 'res) - method lift_Parsetree_with_constraint : - Parsetree.with_constraint -> 'res= - (function - | Parsetree.Pwith_type (x0,x1) -> - this#constr "Ast_402.Parsetree.with_constraint" - ("Pwith_type", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_Parsetree_type_declaration x1]) - | Parsetree.Pwith_module (x0,x1) -> - this#constr "Ast_402.Parsetree.with_constraint" - ("Pwith_module", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_Asttypes_loc this#lift_Longident_t x1]) - | Parsetree.Pwith_typesubst x0 -> - this#constr "Ast_402.Parsetree.with_constraint" - ("Pwith_typesubst", [this#lift_Parsetree_type_declaration x0]) - | Parsetree.Pwith_modsubst (x0,x1) -> - this#constr "Ast_402.Parsetree.with_constraint" - ("Pwith_modsubst", - [this#lift_Asttypes_loc this#string x0; - this#lift_Asttypes_loc this#lift_Longident_t x1]) : Parsetree.with_constraint - -> - 'res) - method lift_Parsetree_signature : Parsetree.signature -> 'res= - (fun x -> this#list (List.map this#lift_Parsetree_signature_item x) : - Parsetree.signature -> 'res) - method lift_Parsetree_signature_item : Parsetree.signature_item -> 'res= - (fun { Parsetree.psig_desc = psig_desc; Parsetree.psig_loc = psig_loc } - -> - this#record "Ast_402.Parsetree.signature_item" - [("psig_desc", - (this#lift_Parsetree_signature_item_desc psig_desc)); - ("psig_loc", (this#lift_Location_t psig_loc))] : Parsetree.signature_item - -> 'res) - method lift_Parsetree_signature_item_desc : - Parsetree.signature_item_desc -> 'res= - (function - | Parsetree.Psig_value x0 -> - this#constr "Ast_402.Parsetree.signature_item_desc" - ("Psig_value", [this#lift_Parsetree_value_description x0]) - | Parsetree.Psig_type x0 -> - this#constr "Ast_402.Parsetree.signature_item_desc" - ("Psig_type", - [this#list (List.map this#lift_Parsetree_type_declaration x0)]) - | Parsetree.Psig_typext x0 -> - this#constr "Ast_402.Parsetree.signature_item_desc" - ("Psig_typext", [this#lift_Parsetree_type_extension x0]) - | Parsetree.Psig_exception x0 -> - this#constr "Ast_402.Parsetree.signature_item_desc" - ("Psig_exception", - [this#lift_Parsetree_extension_constructor x0]) - | Parsetree.Psig_module x0 -> - this#constr "Ast_402.Parsetree.signature_item_desc" - ("Psig_module", [this#lift_Parsetree_module_declaration x0]) - | Parsetree.Psig_recmodule x0 -> - this#constr "Ast_402.Parsetree.signature_item_desc" - ("Psig_recmodule", - [this#list - (List.map this#lift_Parsetree_module_declaration x0)]) - | Parsetree.Psig_modtype x0 -> - this#constr "Ast_402.Parsetree.signature_item_desc" - ("Psig_modtype", - [this#lift_Parsetree_module_type_declaration x0]) - | Parsetree.Psig_open x0 -> - this#constr "Ast_402.Parsetree.signature_item_desc" - ("Psig_open", [this#lift_Parsetree_open_description x0]) - | Parsetree.Psig_include x0 -> - this#constr "Ast_402.Parsetree.signature_item_desc" - ("Psig_include", [this#lift_Parsetree_include_description x0]) - | Parsetree.Psig_class x0 -> - this#constr "Ast_402.Parsetree.signature_item_desc" - ("Psig_class", - [this#list (List.map this#lift_Parsetree_class_description x0)]) - | Parsetree.Psig_class_type x0 -> - this#constr "Ast_402.Parsetree.signature_item_desc" - ("Psig_class_type", - [this#list - (List.map this#lift_Parsetree_class_type_declaration x0)]) - | Parsetree.Psig_attribute x0 -> - this#constr "Ast_402.Parsetree.signature_item_desc" - ("Psig_attribute", [this#lift_Parsetree_attribute x0]) - | Parsetree.Psig_extension (x0,x1) -> - this#constr "Ast_402.Parsetree.signature_item_desc" - ("Psig_extension", - [this#lift_Parsetree_extension x0; - this#lift_Parsetree_attributes x1]) : Parsetree.signature_item_desc - -> 'res) - method lift_Parsetree_class_type_declaration : - Parsetree.class_type_declaration -> 'res= - (fun x -> - this#lift_Parsetree_class_infos this#lift_Parsetree_class_type x : - Parsetree.class_type_declaration -> 'res) - method lift_Parsetree_class_description : - Parsetree.class_description -> 'res= - (fun x -> - this#lift_Parsetree_class_infos this#lift_Parsetree_class_type x : - Parsetree.class_description -> 'res) - method lift_Parsetree_class_type : Parsetree.class_type -> 'res= - (fun - { Parsetree.pcty_desc = pcty_desc; Parsetree.pcty_loc = pcty_loc; - Parsetree.pcty_attributes = pcty_attributes } - -> - this#record "Ast_402.Parsetree.class_type" - [("pcty_desc", (this#lift_Parsetree_class_type_desc pcty_desc)); - ("pcty_loc", (this#lift_Location_t pcty_loc)); - ("pcty_attributes", - (this#lift_Parsetree_attributes pcty_attributes))] : Parsetree.class_type - -> - 'res) - method lift_Parsetree_class_type_desc : - Parsetree.class_type_desc -> 'res= - (function - | Parsetree.Pcty_constr (x0,x1) -> - this#constr "Ast_402.Parsetree.class_type_desc" - ("Pcty_constr", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#list (List.map this#lift_Parsetree_core_type x1)]) - | Parsetree.Pcty_signature x0 -> - this#constr "Ast_402.Parsetree.class_type_desc" - ("Pcty_signature", [this#lift_Parsetree_class_signature x0]) - | Parsetree.Pcty_arrow (x0,x1,x2) -> - this#constr "Ast_402.Parsetree.class_type_desc" - ("Pcty_arrow", - [this#lift_Asttypes_label x0; - this#lift_Parsetree_core_type x1; - this#lift_Parsetree_class_type x2]) - | Parsetree.Pcty_extension x0 -> - this#constr "Ast_402.Parsetree.class_type_desc" - ("Pcty_extension", [this#lift_Parsetree_extension x0]) : - Parsetree.class_type_desc -> 'res) - method lift_Parsetree_class_signature : - Parsetree.class_signature -> 'res= - (fun - { Parsetree.pcsig_self = pcsig_self; - Parsetree.pcsig_fields = pcsig_fields } - -> - this#record "Ast_402.Parsetree.class_signature" - [("pcsig_self", (this#lift_Parsetree_core_type pcsig_self)); - ("pcsig_fields", - (this#list - (List.map this#lift_Parsetree_class_type_field pcsig_fields)))] : - Parsetree.class_signature -> 'res) - method lift_Parsetree_class_type_field : - Parsetree.class_type_field -> 'res= - (fun - { Parsetree.pctf_desc = pctf_desc; Parsetree.pctf_loc = pctf_loc; - Parsetree.pctf_attributes = pctf_attributes } - -> - this#record "Ast_402.Parsetree.class_type_field" - [("pctf_desc", - (this#lift_Parsetree_class_type_field_desc pctf_desc)); - ("pctf_loc", (this#lift_Location_t pctf_loc)); - ("pctf_attributes", - (this#lift_Parsetree_attributes pctf_attributes))] : Parsetree.class_type_field - -> - 'res) - method lift_Parsetree_class_type_field_desc : - Parsetree.class_type_field_desc -> 'res= - (function - | Parsetree.Pctf_inherit x0 -> - this#constr "Ast_402.Parsetree.class_type_field_desc" - ("Pctf_inherit", [this#lift_Parsetree_class_type x0]) - | Parsetree.Pctf_val x0 -> - this#constr "Ast_402.Parsetree.class_type_field_desc" - ("Pctf_val", - [(let (x0,x1,x2,x3) = x0 in - this#tuple - [this#string x0; - this#lift_Asttypes_mutable_flag x1; - this#lift_Asttypes_virtual_flag x2; - this#lift_Parsetree_core_type x3])]) - | Parsetree.Pctf_method x0 -> - this#constr "Ast_402.Parsetree.class_type_field_desc" - ("Pctf_method", - [(let (x0,x1,x2,x3) = x0 in - this#tuple - [this#string x0; - this#lift_Asttypes_private_flag x1; - this#lift_Asttypes_virtual_flag x2; - this#lift_Parsetree_core_type x3])]) - | Parsetree.Pctf_constraint x0 -> - this#constr "Ast_402.Parsetree.class_type_field_desc" - ("Pctf_constraint", - [(let (x0,x1) = x0 in - this#tuple - [this#lift_Parsetree_core_type x0; - this#lift_Parsetree_core_type x1])]) - | Parsetree.Pctf_attribute x0 -> - this#constr "Ast_402.Parsetree.class_type_field_desc" - ("Pctf_attribute", [this#lift_Parsetree_attribute x0]) - | Parsetree.Pctf_extension x0 -> - this#constr "Ast_402.Parsetree.class_type_field_desc" - ("Pctf_extension", [this#lift_Parsetree_extension x0]) : - Parsetree.class_type_field_desc -> 'res) - method lift_Parsetree_extension : Parsetree.extension -> 'res= - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_loc this#string x0; - this#lift_Parsetree_payload x1] : Parsetree.extension -> 'res) - method lift_Parsetree_class_infos : - 'f0 . ('f0 -> 'res) -> 'f0 Parsetree.class_infos -> 'res= fun (type f0) - -> - (fun f0 -> - fun - { Parsetree.pci_virt = pci_virt; - Parsetree.pci_params = pci_params; - Parsetree.pci_name = pci_name; Parsetree.pci_expr = pci_expr; - Parsetree.pci_loc = pci_loc; - Parsetree.pci_attributes = pci_attributes } - -> - this#record "Ast_402.Parsetree.class_infos" - [("pci_virt", (this#lift_Asttypes_virtual_flag pci_virt)); - ("pci_params", - (this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Parsetree_core_type x0; - this#lift_Asttypes_variance x1]) pci_params))); - ("pci_name", (this#lift_Asttypes_loc this#string pci_name)); - ("pci_expr", (f0 pci_expr)); - ("pci_loc", (this#lift_Location_t pci_loc)); - ("pci_attributes", - (this#lift_Parsetree_attributes pci_attributes))] : (f0 -> - 'res) -> - f0 - Parsetree.class_infos - -> - 'res) - method lift_Asttypes_virtual_flag : Asttypes.virtual_flag -> 'res= - (function - | Asttypes.Virtual -> - this#constr "Ast_402.Asttypes.virtual_flag" ("Virtual", []) - | Asttypes.Concrete -> - this#constr "Ast_402.Asttypes.virtual_flag" ("Concrete", []) : Asttypes.virtual_flag - -> - 'res) - method lift_Parsetree_include_description : - Parsetree.include_description -> 'res= - (fun x -> - this#lift_Parsetree_include_infos this#lift_Parsetree_module_type x : - Parsetree.include_description -> 'res) - method lift_Parsetree_include_infos : - 'f0 . ('f0 -> 'res) -> 'f0 Parsetree.include_infos -> 'res= fun (type - f0) -> - (fun f0 -> - fun - { Parsetree.pincl_mod = pincl_mod; - Parsetree.pincl_loc = pincl_loc; - Parsetree.pincl_attributes = pincl_attributes } - -> - this#record "Ast_402.Parsetree.include_infos" - [("pincl_mod", (f0 pincl_mod)); - ("pincl_loc", (this#lift_Location_t pincl_loc)); - ("pincl_attributes", - (this#lift_Parsetree_attributes pincl_attributes))] : - (f0 -> 'res) -> f0 Parsetree.include_infos -> 'res) - method lift_Parsetree_open_description : - Parsetree.open_description -> 'res= - (fun - { Parsetree.popen_lid = popen_lid; - Parsetree.popen_override = popen_override; - Parsetree.popen_loc = popen_loc; - Parsetree.popen_attributes = popen_attributes } - -> - this#record "Ast_402.Parsetree.open_description" - [("popen_lid", - (this#lift_Asttypes_loc this#lift_Longident_t popen_lid)); - ("popen_override", - (this#lift_Asttypes_override_flag popen_override)); - ("popen_loc", (this#lift_Location_t popen_loc)); - ("popen_attributes", - (this#lift_Parsetree_attributes popen_attributes))] : Parsetree.open_description - -> - 'res) - method lift_Asttypes_override_flag : Asttypes.override_flag -> 'res= - (function - | Asttypes.Override -> - this#constr "Ast_402.Asttypes.override_flag" ("Override", []) - | Asttypes.Fresh -> - this#constr "Ast_402.Asttypes.override_flag" ("Fresh", []) : Asttypes.override_flag - -> - 'res) - method lift_Parsetree_module_type_declaration : - Parsetree.module_type_declaration -> 'res= - (fun - { Parsetree.pmtd_name = pmtd_name; Parsetree.pmtd_type = pmtd_type; - Parsetree.pmtd_attributes = pmtd_attributes; - Parsetree.pmtd_loc = pmtd_loc } - -> - this#record "Ast_402.Parsetree.module_type_declaration" - [("pmtd_name", (this#lift_Asttypes_loc this#string pmtd_name)); - ("pmtd_type", - (this#lift_option this#lift_Parsetree_module_type pmtd_type)); - ("pmtd_attributes", - (this#lift_Parsetree_attributes pmtd_attributes)); - ("pmtd_loc", (this#lift_Location_t pmtd_loc))] : Parsetree.module_type_declaration - -> 'res) - method lift_Parsetree_module_declaration : - Parsetree.module_declaration -> 'res= - (fun - { Parsetree.pmd_name = pmd_name; Parsetree.pmd_type = pmd_type; - Parsetree.pmd_attributes = pmd_attributes; - Parsetree.pmd_loc = pmd_loc } - -> - this#record "Ast_402.Parsetree.module_declaration" - [("pmd_name", (this#lift_Asttypes_loc this#string pmd_name)); - ("pmd_type", (this#lift_Parsetree_module_type pmd_type)); - ("pmd_attributes", - (this#lift_Parsetree_attributes pmd_attributes)); - ("pmd_loc", (this#lift_Location_t pmd_loc))] : Parsetree.module_declaration - -> 'res) - method lift_Parsetree_type_extension : Parsetree.type_extension -> 'res= - (fun - { Parsetree.ptyext_path = ptyext_path; - Parsetree.ptyext_params = ptyext_params; - Parsetree.ptyext_constructors = ptyext_constructors; - Parsetree.ptyext_private = ptyext_private; - Parsetree.ptyext_attributes = ptyext_attributes } - -> - this#record "Ast_402.Parsetree.type_extension" - [("ptyext_path", - (this#lift_Asttypes_loc this#lift_Longident_t ptyext_path)); - ("ptyext_params", - (this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Parsetree_core_type x0; - this#lift_Asttypes_variance x1]) ptyext_params))); - ("ptyext_constructors", - (this#list - (List.map this#lift_Parsetree_extension_constructor - ptyext_constructors))); - ("ptyext_private", - (this#lift_Asttypes_private_flag ptyext_private)); - ("ptyext_attributes", - (this#lift_Parsetree_attributes ptyext_attributes))] : Parsetree.type_extension - -> - 'res) - method lift_Parsetree_extension_constructor : - Parsetree.extension_constructor -> 'res= - (fun - { Parsetree.pext_name = pext_name; Parsetree.pext_kind = pext_kind; - Parsetree.pext_loc = pext_loc; - Parsetree.pext_attributes = pext_attributes } - -> - this#record "Ast_402.Parsetree.extension_constructor" - [("pext_name", (this#lift_Asttypes_loc this#string pext_name)); - ("pext_kind", - (this#lift_Parsetree_extension_constructor_kind pext_kind)); - ("pext_loc", (this#lift_Location_t pext_loc)); - ("pext_attributes", - (this#lift_Parsetree_attributes pext_attributes))] : Parsetree.extension_constructor - -> - 'res) - method lift_Parsetree_extension_constructor_kind : - Parsetree.extension_constructor_kind -> 'res= - (function - | Parsetree.Pext_decl (x0,x1) -> - this#constr "Ast_402.Parsetree.extension_constructor_kind" - ("Pext_decl", - [this#list (List.map this#lift_Parsetree_core_type x0); - this#lift_option this#lift_Parsetree_core_type x1]) - | Parsetree.Pext_rebind x0 -> - this#constr "Ast_402.Parsetree.extension_constructor_kind" - ("Pext_rebind", - [this#lift_Asttypes_loc this#lift_Longident_t x0]) : Parsetree.extension_constructor_kind - -> - 'res) - method lift_Parsetree_type_declaration : - Parsetree.type_declaration -> 'res= - (fun - { Parsetree.ptype_name = ptype_name; - Parsetree.ptype_params = ptype_params; - Parsetree.ptype_cstrs = ptype_cstrs; - Parsetree.ptype_kind = ptype_kind; - Parsetree.ptype_private = ptype_private; - Parsetree.ptype_manifest = ptype_manifest; - Parsetree.ptype_attributes = ptype_attributes; - Parsetree.ptype_loc = ptype_loc } - -> - this#record "Ast_402.Parsetree.type_declaration" - [("ptype_name", (this#lift_Asttypes_loc this#string ptype_name)); - ("ptype_params", - (this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Parsetree_core_type x0; - this#lift_Asttypes_variance x1]) ptype_params))); - ("ptype_cstrs", - (this#list - (List.map - (fun x -> - let (x0,x1,x2) = x in - this#tuple - [this#lift_Parsetree_core_type x0; - this#lift_Parsetree_core_type x1; - this#lift_Location_t x2]) ptype_cstrs))); - ("ptype_kind", (this#lift_Parsetree_type_kind ptype_kind)); - ("ptype_private", (this#lift_Asttypes_private_flag ptype_private)); - ("ptype_manifest", - (this#lift_option this#lift_Parsetree_core_type ptype_manifest)); - ("ptype_attributes", - (this#lift_Parsetree_attributes ptype_attributes)); - ("ptype_loc", (this#lift_Location_t ptype_loc))] : Parsetree.type_declaration - -> 'res) - method lift_Asttypes_private_flag : Asttypes.private_flag -> 'res= - (function - | Asttypes.Private -> - this#constr "Ast_402.Asttypes.private_flag" ("Private", []) - | Asttypes.Public -> - this#constr "Ast_402.Asttypes.private_flag" ("Public", []) : Asttypes.private_flag - -> - 'res) - method lift_Parsetree_type_kind : Parsetree.type_kind -> 'res= - (function - | Parsetree.Ptype_abstract -> - this#constr "Ast_402.Parsetree.type_kind" ("Ptype_abstract", []) - | Parsetree.Ptype_variant x0 -> - this#constr "Ast_402.Parsetree.type_kind" - ("Ptype_variant", - [this#list - (List.map this#lift_Parsetree_constructor_declaration x0)]) - | Parsetree.Ptype_record x0 -> - this#constr "Ast_402.Parsetree.type_kind" - ("Ptype_record", - [this#list (List.map this#lift_Parsetree_label_declaration x0)]) - | Parsetree.Ptype_open -> - this#constr "Ast_402.Parsetree.type_kind" ("Ptype_open", []) : Parsetree.type_kind - -> - 'res) - method lift_Parsetree_label_declaration : - Parsetree.label_declaration -> 'res= - (fun - { Parsetree.pld_name = pld_name; - Parsetree.pld_mutable = pld_mutable; - Parsetree.pld_type = pld_type; Parsetree.pld_loc = pld_loc; - Parsetree.pld_attributes = pld_attributes } - -> - this#record "Ast_402.Parsetree.label_declaration" - [("pld_name", (this#lift_Asttypes_loc this#string pld_name)); - ("pld_mutable", (this#lift_Asttypes_mutable_flag pld_mutable)); - ("pld_type", (this#lift_Parsetree_core_type pld_type)); - ("pld_loc", (this#lift_Location_t pld_loc)); - ("pld_attributes", - (this#lift_Parsetree_attributes pld_attributes))] : Parsetree.label_declaration - -> - 'res) - method lift_Asttypes_mutable_flag : Asttypes.mutable_flag -> 'res= - (function - | Asttypes.Immutable -> - this#constr "Ast_402.Asttypes.mutable_flag" ("Immutable", []) - | Asttypes.Mutable -> - this#constr "Ast_402.Asttypes.mutable_flag" ("Mutable", []) : Asttypes.mutable_flag - -> - 'res) - method lift_Parsetree_constructor_declaration : - Parsetree.constructor_declaration -> 'res= - (fun - { Parsetree.pcd_name = pcd_name; Parsetree.pcd_args = pcd_args; - Parsetree.pcd_res = pcd_res; Parsetree.pcd_loc = pcd_loc; - Parsetree.pcd_attributes = pcd_attributes } - -> - this#record "Ast_402.Parsetree.constructor_declaration" - [("pcd_name", (this#lift_Asttypes_loc this#string pcd_name)); - ("pcd_args", - (this#list (List.map this#lift_Parsetree_core_type pcd_args))); - ("pcd_res", - (this#lift_option this#lift_Parsetree_core_type pcd_res)); - ("pcd_loc", (this#lift_Location_t pcd_loc)); - ("pcd_attributes", - (this#lift_Parsetree_attributes pcd_attributes))] : Parsetree.constructor_declaration - -> - 'res) - method lift_Asttypes_variance : Asttypes.variance -> 'res= - (function - | Asttypes.Covariant -> - this#constr "Ast_402.Asttypes.variance" ("Covariant", []) - | Asttypes.Contravariant -> - this#constr "Ast_402.Asttypes.variance" ("Contravariant", []) - | Asttypes.Invariant -> - this#constr "Ast_402.Asttypes.variance" ("Invariant", []) : Asttypes.variance - -> 'res) - method lift_Parsetree_value_description : - Parsetree.value_description -> 'res= - (fun - { Parsetree.pval_name = pval_name; Parsetree.pval_type = pval_type; - Parsetree.pval_prim = pval_prim; - Parsetree.pval_attributes = pval_attributes; - Parsetree.pval_loc = pval_loc } - -> - this#record "Ast_402.Parsetree.value_description" - [("pval_name", (this#lift_Asttypes_loc this#string pval_name)); - ("pval_type", (this#lift_Parsetree_core_type pval_type)); - ("pval_prim", (this#list (List.map this#string pval_prim))); - ("pval_attributes", - (this#lift_Parsetree_attributes pval_attributes)); - ("pval_loc", (this#lift_Location_t pval_loc))] : Parsetree.value_description - -> 'res) - method lift_Asttypes_closed_flag : Asttypes.closed_flag -> 'res= - (function - | Asttypes.Closed -> - this#constr "Ast_402.Asttypes.closed_flag" ("Closed", []) - | Asttypes.Open -> this#constr "Ast_402.Asttypes.closed_flag" ("Open", []) : - Asttypes.closed_flag -> 'res) - method lift_Asttypes_label : Asttypes.label -> 'res= - (this#string : Asttypes.label -> 'res) - method lift_Asttypes_rec_flag : Asttypes.rec_flag -> 'res= - (function - | Asttypes.Nonrecursive -> - this#constr "Ast_402.Asttypes.rec_flag" ("Nonrecursive", []) - | Asttypes.Recursive -> - this#constr "Ast_402.Asttypes.rec_flag" ("Recursive", []) : Asttypes.rec_flag - -> 'res) - method lift_Asttypes_constant : Asttypes.constant -> 'res= - (function - | Asttypes.Const_int x0 -> - this#constr "Ast_402.Asttypes.constant" ("Const_int", [this#int x0]) - | Asttypes.Const_char x0 -> - this#constr "Ast_402.Asttypes.constant" ("Const_char", [this#char x0]) - | Asttypes.Const_string (x0,x1) -> - this#constr "Ast_402.Asttypes.constant" - ("Const_string", - [this#string x0; this#lift_option this#string x1]) - | Asttypes.Const_float x0 -> - this#constr "Ast_402.Asttypes.constant" ("Const_float", [this#string x0]) - | Asttypes.Const_int32 x0 -> - this#constr "Ast_402.Asttypes.constant" ("Const_int32", [this#int32 x0]) - | Asttypes.Const_int64 x0 -> - this#constr "Ast_402.Asttypes.constant" ("Const_int64", [this#int64 x0]) - | Asttypes.Const_nativeint x0 -> - this#constr "Ast_402.Asttypes.constant" - ("Const_nativeint", [this#nativeint x0]) : Asttypes.constant -> - 'res) - method lift_option : 'f0 . ('f0 -> 'res) -> 'f0 option -> 'res= fun (type - f0) -> - (fun f0 -> - function - | None -> this#constr "option" ("None", []) - | Some x0 -> this#constr "option" ("Some", [f0 x0]) : (f0 -> 'res) - -> - f0 option -> - 'res) - method lift_Longident_t : Longident.t -> 'res= - (function - | Longident.Lident x0 -> - this#constr "Ast_402.Longident.t" ("Lident", [this#string x0]) - | Longident.Ldot (x0,x1) -> - this#constr "Ast_402.Longident.t" - ("Ldot", [this#lift_Longident_t x0; this#string x1]) - | Longident.Lapply (x0,x1) -> - this#constr "Ast_402.Longident.t" - ("Lapply", [this#lift_Longident_t x0; this#lift_Longident_t x1]) : - Longident.t -> 'res) - method lift_Asttypes_loc : - 'f0 . ('f0 -> 'res) -> 'f0 Asttypes.loc -> 'res= fun (type f0) -> - (fun f0 -> - fun { Asttypes.txt = txt; Asttypes.loc = loc } -> - this#record "Ast_402.Asttypes.loc" - [("txt", (f0 txt)); ("loc", (this#lift_Location_t loc))] : - (f0 -> 'res) -> f0 Asttypes.loc -> 'res) - method lift_Location_t : Location.t -> 'res= - (fun - { Location.loc_start = loc_start; Location.loc_end = loc_end; - Location.loc_ghost = loc_ghost } - -> - this#record "Ast_402.Location.t" - [("loc_start", (this#lift_Lexing_position loc_start)); - ("loc_end", (this#lift_Lexing_position loc_end)); - ("loc_ghost", (this#lift_bool loc_ghost))] : Location.t -> 'res) - method lift_bool : bool -> 'res= - (function - | false -> this#constr "bool" ("false", []) - | true -> this#constr "bool" ("true", []) : bool -> 'res) - method lift_Lexing_position : Lexing.position -> 'res= - (fun - { Lexing.pos_fname = pos_fname; Lexing.pos_lnum = pos_lnum; - Lexing.pos_bol = pos_bol; Lexing.pos_cnum = pos_cnum } - -> - this#record "Lexing.position" - [("pos_fname", (this#string pos_fname)); - ("pos_lnum", (this#int pos_lnum)); - ("pos_bol", (this#int pos_bol)); - ("pos_cnum", (this#int pos_cnum))] : Lexing.position -> 'res) - end diff --git a/ppx_tools_versioned.5.2/ast_lifter_403.ml b/ppx_tools_versioned.5.2/ast_lifter_403.ml deleted file mode 100644 index 6c20ff9..0000000 --- a/ppx_tools_versioned.5.2/ast_lifter_403.ml +++ /dev/null @@ -1,1378 +0,0 @@ -open Ast_403 - -class virtual ['res] lifter = - object (this) - method lift_Parsetree_expression : Parsetree.expression -> 'res= - (fun - { Parsetree.pexp_desc = pexp_desc; Parsetree.pexp_loc = pexp_loc; - Parsetree.pexp_attributes = pexp_attributes } - -> - this#record "Ast_403.Parsetree.expression" - [("pexp_desc", (this#lift_Parsetree_expression_desc pexp_desc)); - ("pexp_loc", (this#lift_Location_t pexp_loc)); - ("pexp_attributes", - (this#lift_Parsetree_attributes pexp_attributes))] : Parsetree.expression - -> - 'res) - method lift_Parsetree_expression_desc : - Parsetree.expression_desc -> 'res= - (function - | Parsetree.Pexp_ident x0 -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_ident", - [this#lift_Asttypes_loc this#lift_Longident_t x0]) - | Parsetree.Pexp_constant x0 -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_constant", [this#lift_Parsetree_constant x0]) - | Parsetree.Pexp_let (x0,x1,x2) -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_let", - [this#lift_Asttypes_rec_flag x0; - this#list (List.map this#lift_Parsetree_value_binding x1); - this#lift_Parsetree_expression x2]) - | Parsetree.Pexp_function x0 -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_function", - [this#list (List.map this#lift_Parsetree_case x0)]) - | Parsetree.Pexp_fun (x0,x1,x2,x3) -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_fun", - [this#lift_Asttypes_arg_label x0; - this#lift_option this#lift_Parsetree_expression x1; - this#lift_Parsetree_pattern x2; - this#lift_Parsetree_expression x3]) - | Parsetree.Pexp_apply (x0,x1) -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_apply", - [this#lift_Parsetree_expression x0; - this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_arg_label x0; - this#lift_Parsetree_expression x1]) x1)]) - | Parsetree.Pexp_match (x0,x1) -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_match", - [this#lift_Parsetree_expression x0; - this#list (List.map this#lift_Parsetree_case x1)]) - | Parsetree.Pexp_try (x0,x1) -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_try", - [this#lift_Parsetree_expression x0; - this#list (List.map this#lift_Parsetree_case x1)]) - | Parsetree.Pexp_tuple x0 -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_tuple", - [this#list (List.map this#lift_Parsetree_expression x0)]) - | Parsetree.Pexp_construct (x0,x1) -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_construct", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_option this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_variant (x0,x1) -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_variant", - [this#lift_Asttypes_label x0; - this#lift_option this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_record (x0,x1) -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_record", - [this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_Parsetree_expression x1]) x0); - this#lift_option this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_field (x0,x1) -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_field", - [this#lift_Parsetree_expression x0; - this#lift_Asttypes_loc this#lift_Longident_t x1]) - | Parsetree.Pexp_setfield (x0,x1,x2) -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_setfield", - [this#lift_Parsetree_expression x0; - this#lift_Asttypes_loc this#lift_Longident_t x1; - this#lift_Parsetree_expression x2]) - | Parsetree.Pexp_array x0 -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_array", - [this#list (List.map this#lift_Parsetree_expression x0)]) - | Parsetree.Pexp_ifthenelse (x0,x1,x2) -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_ifthenelse", - [this#lift_Parsetree_expression x0; - this#lift_Parsetree_expression x1; - this#lift_option this#lift_Parsetree_expression x2]) - | Parsetree.Pexp_sequence (x0,x1) -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_sequence", - [this#lift_Parsetree_expression x0; - this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_while (x0,x1) -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_while", - [this#lift_Parsetree_expression x0; - this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_for (x0,x1,x2,x3,x4) -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_for", - [this#lift_Parsetree_pattern x0; - this#lift_Parsetree_expression x1; - this#lift_Parsetree_expression x2; - this#lift_Asttypes_direction_flag x3; - this#lift_Parsetree_expression x4]) - | Parsetree.Pexp_constraint (x0,x1) -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_constraint", - [this#lift_Parsetree_expression x0; - this#lift_Parsetree_core_type x1]) - | Parsetree.Pexp_coerce (x0,x1,x2) -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_coerce", - [this#lift_Parsetree_expression x0; - this#lift_option this#lift_Parsetree_core_type x1; - this#lift_Parsetree_core_type x2]) - | Parsetree.Pexp_send (x0,x1) -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_send", - [this#lift_Parsetree_expression x0; this#string x1]) - | Parsetree.Pexp_new x0 -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_new", [this#lift_Asttypes_loc this#lift_Longident_t x0]) - | Parsetree.Pexp_setinstvar (x0,x1) -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_setinstvar", - [this#lift_Asttypes_loc this#string x0; - this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_override x0 -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_override", - [this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_loc this#string x0; - this#lift_Parsetree_expression x1]) x0)]) - | Parsetree.Pexp_letmodule (x0,x1,x2) -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_letmodule", - [this#lift_Asttypes_loc this#string x0; - this#lift_Parsetree_module_expr x1; - this#lift_Parsetree_expression x2]) - | Parsetree.Pexp_assert x0 -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_assert", [this#lift_Parsetree_expression x0]) - | Parsetree.Pexp_lazy x0 -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_lazy", [this#lift_Parsetree_expression x0]) - | Parsetree.Pexp_poly (x0,x1) -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_poly", - [this#lift_Parsetree_expression x0; - this#lift_option this#lift_Parsetree_core_type x1]) - | Parsetree.Pexp_object x0 -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_object", [this#lift_Parsetree_class_structure x0]) - | Parsetree.Pexp_newtype (x0,x1) -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_newtype", - [this#string x0; this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_pack x0 -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_pack", [this#lift_Parsetree_module_expr x0]) - | Parsetree.Pexp_open (x0,x1,x2) -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_open", - [this#lift_Asttypes_override_flag x0; - this#lift_Asttypes_loc this#lift_Longident_t x1; - this#lift_Parsetree_expression x2]) - | Parsetree.Pexp_extension x0 -> - this#constr "Ast_403.Parsetree.expression_desc" - ("Pexp_extension", [this#lift_Parsetree_extension x0]) - | Parsetree.Pexp_unreachable -> - this#constr "Ast_403.Parsetree.expression_desc" ("Pexp_unreachable", []) : - Parsetree.expression_desc -> 'res) - method lift_Asttypes_direction_flag : Asttypes.direction_flag -> 'res= - (function - | Asttypes.Upto -> this#constr "Ast_403.Asttypes.direction_flag" ("Upto", []) - | Asttypes.Downto -> - this#constr "Ast_403.Asttypes.direction_flag" ("Downto", []) : Asttypes.direction_flag - -> - 'res) - method lift_Parsetree_case : Parsetree.case -> 'res= - (fun - { Parsetree.pc_lhs = pc_lhs; Parsetree.pc_guard = pc_guard; - Parsetree.pc_rhs = pc_rhs } - -> - this#record "Ast_403.Parsetree.case" - [("pc_lhs", (this#lift_Parsetree_pattern pc_lhs)); - ("pc_guard", - (this#lift_option this#lift_Parsetree_expression pc_guard)); - ("pc_rhs", (this#lift_Parsetree_expression pc_rhs))] : Parsetree.case - -> - 'res) - method lift_Parsetree_value_binding : Parsetree.value_binding -> 'res= - (fun - { Parsetree.pvb_pat = pvb_pat; Parsetree.pvb_expr = pvb_expr; - Parsetree.pvb_attributes = pvb_attributes; - Parsetree.pvb_loc = pvb_loc } - -> - this#record "Ast_403.Parsetree.value_binding" - [("pvb_pat", (this#lift_Parsetree_pattern pvb_pat)); - ("pvb_expr", (this#lift_Parsetree_expression pvb_expr)); - ("pvb_attributes", - (this#lift_Parsetree_attributes pvb_attributes)); - ("pvb_loc", (this#lift_Location_t pvb_loc))] : Parsetree.value_binding - -> 'res) - method lift_Parsetree_pattern : Parsetree.pattern -> 'res= - (fun - { Parsetree.ppat_desc = ppat_desc; Parsetree.ppat_loc = ppat_loc; - Parsetree.ppat_attributes = ppat_attributes } - -> - this#record "Ast_403.Parsetree.pattern" - [("ppat_desc", (this#lift_Parsetree_pattern_desc ppat_desc)); - ("ppat_loc", (this#lift_Location_t ppat_loc)); - ("ppat_attributes", - (this#lift_Parsetree_attributes ppat_attributes))] : Parsetree.pattern - -> - 'res) - method lift_Parsetree_pattern_desc : Parsetree.pattern_desc -> 'res= - (function - | Parsetree.Ppat_any -> - this#constr "Ast_403.Parsetree.pattern_desc" ("Ppat_any", []) - | Parsetree.Ppat_var x0 -> - this#constr "Ast_403.Parsetree.pattern_desc" - ("Ppat_var", [this#lift_Asttypes_loc this#string x0]) - | Parsetree.Ppat_alias (x0,x1) -> - this#constr "Ast_403.Parsetree.pattern_desc" - ("Ppat_alias", - [this#lift_Parsetree_pattern x0; - this#lift_Asttypes_loc this#string x1]) - | Parsetree.Ppat_constant x0 -> - this#constr "Ast_403.Parsetree.pattern_desc" - ("Ppat_constant", [this#lift_Parsetree_constant x0]) - | Parsetree.Ppat_interval (x0,x1) -> - this#constr "Ast_403.Parsetree.pattern_desc" - ("Ppat_interval", - [this#lift_Parsetree_constant x0; - this#lift_Parsetree_constant x1]) - | Parsetree.Ppat_tuple x0 -> - this#constr "Ast_403.Parsetree.pattern_desc" - ("Ppat_tuple", - [this#list (List.map this#lift_Parsetree_pattern x0)]) - | Parsetree.Ppat_construct (x0,x1) -> - this#constr "Ast_403.Parsetree.pattern_desc" - ("Ppat_construct", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_option this#lift_Parsetree_pattern x1]) - | Parsetree.Ppat_variant (x0,x1) -> - this#constr "Ast_403.Parsetree.pattern_desc" - ("Ppat_variant", - [this#lift_Asttypes_label x0; - this#lift_option this#lift_Parsetree_pattern x1]) - | Parsetree.Ppat_record (x0,x1) -> - this#constr "Ast_403.Parsetree.pattern_desc" - ("Ppat_record", - [this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_Parsetree_pattern x1]) x0); - this#lift_Asttypes_closed_flag x1]) - | Parsetree.Ppat_array x0 -> - this#constr "Ast_403.Parsetree.pattern_desc" - ("Ppat_array", - [this#list (List.map this#lift_Parsetree_pattern x0)]) - | Parsetree.Ppat_or (x0,x1) -> - this#constr "Ast_403.Parsetree.pattern_desc" - ("Ppat_or", - [this#lift_Parsetree_pattern x0; - this#lift_Parsetree_pattern x1]) - | Parsetree.Ppat_constraint (x0,x1) -> - this#constr "Ast_403.Parsetree.pattern_desc" - ("Ppat_constraint", - [this#lift_Parsetree_pattern x0; - this#lift_Parsetree_core_type x1]) - | Parsetree.Ppat_type x0 -> - this#constr "Ast_403.Parsetree.pattern_desc" - ("Ppat_type", [this#lift_Asttypes_loc this#lift_Longident_t x0]) - | Parsetree.Ppat_lazy x0 -> - this#constr "Ast_403.Parsetree.pattern_desc" - ("Ppat_lazy", [this#lift_Parsetree_pattern x0]) - | Parsetree.Ppat_unpack x0 -> - this#constr "Ast_403.Parsetree.pattern_desc" - ("Ppat_unpack", [this#lift_Asttypes_loc this#string x0]) - | Parsetree.Ppat_exception x0 -> - this#constr "Ast_403.Parsetree.pattern_desc" - ("Ppat_exception", [this#lift_Parsetree_pattern x0]) - | Parsetree.Ppat_extension x0 -> - this#constr "Ast_403.Parsetree.pattern_desc" - ("Ppat_extension", [this#lift_Parsetree_extension x0]) : - Parsetree.pattern_desc -> 'res) - method lift_Parsetree_core_type : Parsetree.core_type -> 'res= - (fun - { Parsetree.ptyp_desc = ptyp_desc; Parsetree.ptyp_loc = ptyp_loc; - Parsetree.ptyp_attributes = ptyp_attributes } - -> - this#record "Ast_403.Parsetree.core_type" - [("ptyp_desc", (this#lift_Parsetree_core_type_desc ptyp_desc)); - ("ptyp_loc", (this#lift_Location_t ptyp_loc)); - ("ptyp_attributes", - (this#lift_Parsetree_attributes ptyp_attributes))] : Parsetree.core_type - -> - 'res) - method lift_Parsetree_core_type_desc : Parsetree.core_type_desc -> 'res= - (function - | Parsetree.Ptyp_any -> - this#constr "Ast_403.Parsetree.core_type_desc" ("Ptyp_any", []) - | Parsetree.Ptyp_var x0 -> - this#constr "Ast_403.Parsetree.core_type_desc" - ("Ptyp_var", [this#string x0]) - | Parsetree.Ptyp_arrow (x0,x1,x2) -> - this#constr "Ast_403.Parsetree.core_type_desc" - ("Ptyp_arrow", - [this#lift_Asttypes_arg_label x0; - this#lift_Parsetree_core_type x1; - this#lift_Parsetree_core_type x2]) - | Parsetree.Ptyp_tuple x0 -> - this#constr "Ast_403.Parsetree.core_type_desc" - ("Ptyp_tuple", - [this#list (List.map this#lift_Parsetree_core_type x0)]) - | Parsetree.Ptyp_constr (x0,x1) -> - this#constr "Ast_403.Parsetree.core_type_desc" - ("Ptyp_constr", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#list (List.map this#lift_Parsetree_core_type x1)]) - | Parsetree.Ptyp_object (x0,x1) -> - this#constr "Ast_403.Parsetree.core_type_desc" - ("Ptyp_object", - [this#list - (List.map - (fun x -> - let (x0,x1,x2) = x in - this#tuple - [this#string x0; - this#lift_Parsetree_attributes x1; - this#lift_Parsetree_core_type x2]) x0); - this#lift_Asttypes_closed_flag x1]) - | Parsetree.Ptyp_class (x0,x1) -> - this#constr "Ast_403.Parsetree.core_type_desc" - ("Ptyp_class", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#list (List.map this#lift_Parsetree_core_type x1)]) - | Parsetree.Ptyp_alias (x0,x1) -> - this#constr "Ast_403.Parsetree.core_type_desc" - ("Ptyp_alias", - [this#lift_Parsetree_core_type x0; this#string x1]) - | Parsetree.Ptyp_variant (x0,x1,x2) -> - this#constr "Ast_403.Parsetree.core_type_desc" - ("Ptyp_variant", - [this#list (List.map this#lift_Parsetree_row_field x0); - this#lift_Asttypes_closed_flag x1; - this#lift_option - (fun x -> this#list (List.map this#lift_Asttypes_label x)) - x2]) - | Parsetree.Ptyp_poly (x0,x1) -> - this#constr "Ast_403.Parsetree.core_type_desc" - ("Ptyp_poly", - [this#list (List.map this#string x0); - this#lift_Parsetree_core_type x1]) - | Parsetree.Ptyp_package x0 -> - this#constr "Ast_403.Parsetree.core_type_desc" - ("Ptyp_package", [this#lift_Parsetree_package_type x0]) - | Parsetree.Ptyp_extension x0 -> - this#constr "Ast_403.Parsetree.core_type_desc" - ("Ptyp_extension", [this#lift_Parsetree_extension x0]) : - Parsetree.core_type_desc -> 'res) - method lift_Parsetree_package_type : Parsetree.package_type -> 'res= - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_Parsetree_core_type x1]) x1)] : Parsetree.package_type - -> 'res) - method lift_Parsetree_row_field : Parsetree.row_field -> 'res= - (function - | Parsetree.Rtag (x0,x1,x2,x3) -> - this#constr "Ast_403.Parsetree.row_field" - ("Rtag", - [this#lift_Asttypes_label x0; - this#lift_Parsetree_attributes x1; - this#lift_bool x2; - this#list (List.map this#lift_Parsetree_core_type x3)]) - | Parsetree.Rinherit x0 -> - this#constr "Ast_403.Parsetree.row_field" - ("Rinherit", [this#lift_Parsetree_core_type x0]) : Parsetree.row_field - -> - 'res) - method lift_Parsetree_attributes : Parsetree.attributes -> 'res= - (fun x -> this#list (List.map this#lift_Parsetree_attribute x) : - Parsetree.attributes -> 'res) - method lift_Parsetree_attribute : Parsetree.attribute -> 'res= - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_loc this#string x0; - this#lift_Parsetree_payload x1] : Parsetree.attribute -> 'res) - method lift_Parsetree_payload : Parsetree.payload -> 'res= - (function - | Parsetree.PStr x0 -> - this#constr "Ast_403.Parsetree.payload" - ("PStr", [this#lift_Parsetree_structure x0]) - | Parsetree.PSig x0 -> - this#constr "Ast_403.Parsetree.payload" - ("PSig", [this#lift_Parsetree_signature x0]) - | Parsetree.PTyp x0 -> - this#constr "Ast_403.Parsetree.payload" - ("PTyp", [this#lift_Parsetree_core_type x0]) - | Parsetree.PPat (x0,x1) -> - this#constr "Ast_403.Parsetree.payload" - ("PPat", - [this#lift_Parsetree_pattern x0; - this#lift_option this#lift_Parsetree_expression x1]) : - Parsetree.payload -> 'res) - method lift_Parsetree_structure : Parsetree.structure -> 'res= - (fun x -> this#list (List.map this#lift_Parsetree_structure_item x) : - Parsetree.structure -> 'res) - method lift_Parsetree_structure_item : Parsetree.structure_item -> 'res= - (fun { Parsetree.pstr_desc = pstr_desc; Parsetree.pstr_loc = pstr_loc } - -> - this#record "Ast_403.Parsetree.structure_item" - [("pstr_desc", - (this#lift_Parsetree_structure_item_desc pstr_desc)); - ("pstr_loc", (this#lift_Location_t pstr_loc))] : Parsetree.structure_item - -> 'res) - method lift_Parsetree_structure_item_desc : - Parsetree.structure_item_desc -> 'res= - (function - | Parsetree.Pstr_eval (x0,x1) -> - this#constr "Ast_403.Parsetree.structure_item_desc" - ("Pstr_eval", - [this#lift_Parsetree_expression x0; - this#lift_Parsetree_attributes x1]) - | Parsetree.Pstr_value (x0,x1) -> - this#constr "Ast_403.Parsetree.structure_item_desc" - ("Pstr_value", - [this#lift_Asttypes_rec_flag x0; - this#list (List.map this#lift_Parsetree_value_binding x1)]) - | Parsetree.Pstr_primitive x0 -> - this#constr "Ast_403.Parsetree.structure_item_desc" - ("Pstr_primitive", [this#lift_Parsetree_value_description x0]) - | Parsetree.Pstr_type (x0,x1) -> - this#constr "Ast_403.Parsetree.structure_item_desc" - ("Pstr_type", - [this#lift_Asttypes_rec_flag x0; - this#list (List.map this#lift_Parsetree_type_declaration x1)]) - | Parsetree.Pstr_typext x0 -> - this#constr "Ast_403.Parsetree.structure_item_desc" - ("Pstr_typext", [this#lift_Parsetree_type_extension x0]) - | Parsetree.Pstr_exception x0 -> - this#constr "Ast_403.Parsetree.structure_item_desc" - ("Pstr_exception", - [this#lift_Parsetree_extension_constructor x0]) - | Parsetree.Pstr_module x0 -> - this#constr "Ast_403.Parsetree.structure_item_desc" - ("Pstr_module", [this#lift_Parsetree_module_binding x0]) - | Parsetree.Pstr_recmodule x0 -> - this#constr "Ast_403.Parsetree.structure_item_desc" - ("Pstr_recmodule", - [this#list (List.map this#lift_Parsetree_module_binding x0)]) - | Parsetree.Pstr_modtype x0 -> - this#constr "Ast_403.Parsetree.structure_item_desc" - ("Pstr_modtype", - [this#lift_Parsetree_module_type_declaration x0]) - | Parsetree.Pstr_open x0 -> - this#constr "Ast_403.Parsetree.structure_item_desc" - ("Pstr_open", [this#lift_Parsetree_open_description x0]) - | Parsetree.Pstr_class x0 -> - this#constr "Ast_403.Parsetree.structure_item_desc" - ("Pstr_class", - [this#list (List.map this#lift_Parsetree_class_declaration x0)]) - | Parsetree.Pstr_class_type x0 -> - this#constr "Ast_403.Parsetree.structure_item_desc" - ("Pstr_class_type", - [this#list - (List.map this#lift_Parsetree_class_type_declaration x0)]) - | Parsetree.Pstr_include x0 -> - this#constr "Ast_403.Parsetree.structure_item_desc" - ("Pstr_include", [this#lift_Parsetree_include_declaration x0]) - | Parsetree.Pstr_attribute x0 -> - this#constr "Ast_403.Parsetree.structure_item_desc" - ("Pstr_attribute", [this#lift_Parsetree_attribute x0]) - | Parsetree.Pstr_extension (x0,x1) -> - this#constr "Ast_403.Parsetree.structure_item_desc" - ("Pstr_extension", - [this#lift_Parsetree_extension x0; - this#lift_Parsetree_attributes x1]) : Parsetree.structure_item_desc - -> 'res) - method lift_Parsetree_include_declaration : - Parsetree.include_declaration -> 'res= - (fun x -> - this#lift_Parsetree_include_infos this#lift_Parsetree_module_expr x : - Parsetree.include_declaration -> 'res) - method lift_Parsetree_class_declaration : - Parsetree.class_declaration -> 'res= - (fun x -> - this#lift_Parsetree_class_infos this#lift_Parsetree_class_expr x : - Parsetree.class_declaration -> 'res) - method lift_Parsetree_class_expr : Parsetree.class_expr -> 'res= - (fun - { Parsetree.pcl_desc = pcl_desc; Parsetree.pcl_loc = pcl_loc; - Parsetree.pcl_attributes = pcl_attributes } - -> - this#record "Ast_403.Parsetree.class_expr" - [("pcl_desc", (this#lift_Parsetree_class_expr_desc pcl_desc)); - ("pcl_loc", (this#lift_Location_t pcl_loc)); - ("pcl_attributes", - (this#lift_Parsetree_attributes pcl_attributes))] : Parsetree.class_expr - -> - 'res) - method lift_Parsetree_class_expr_desc : - Parsetree.class_expr_desc -> 'res= - (function - | Parsetree.Pcl_constr (x0,x1) -> - this#constr "Ast_403.Parsetree.class_expr_desc" - ("Pcl_constr", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#list (List.map this#lift_Parsetree_core_type x1)]) - | Parsetree.Pcl_structure x0 -> - this#constr "Ast_403.Parsetree.class_expr_desc" - ("Pcl_structure", [this#lift_Parsetree_class_structure x0]) - | Parsetree.Pcl_fun (x0,x1,x2,x3) -> - this#constr "Ast_403.Parsetree.class_expr_desc" - ("Pcl_fun", - [this#lift_Asttypes_arg_label x0; - this#lift_option this#lift_Parsetree_expression x1; - this#lift_Parsetree_pattern x2; - this#lift_Parsetree_class_expr x3]) - | Parsetree.Pcl_apply (x0,x1) -> - this#constr "Ast_403.Parsetree.class_expr_desc" - ("Pcl_apply", - [this#lift_Parsetree_class_expr x0; - this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_arg_label x0; - this#lift_Parsetree_expression x1]) x1)]) - | Parsetree.Pcl_let (x0,x1,x2) -> - this#constr "Ast_403.Parsetree.class_expr_desc" - ("Pcl_let", - [this#lift_Asttypes_rec_flag x0; - this#list (List.map this#lift_Parsetree_value_binding x1); - this#lift_Parsetree_class_expr x2]) - | Parsetree.Pcl_constraint (x0,x1) -> - this#constr "Ast_403.Parsetree.class_expr_desc" - ("Pcl_constraint", - [this#lift_Parsetree_class_expr x0; - this#lift_Parsetree_class_type x1]) - | Parsetree.Pcl_extension x0 -> - this#constr "Ast_403.Parsetree.class_expr_desc" - ("Pcl_extension", [this#lift_Parsetree_extension x0]) : - Parsetree.class_expr_desc -> 'res) - method lift_Parsetree_class_structure : - Parsetree.class_structure -> 'res= - (fun - { Parsetree.pcstr_self = pcstr_self; - Parsetree.pcstr_fields = pcstr_fields } - -> - this#record "Ast_403.Parsetree.class_structure" - [("pcstr_self", (this#lift_Parsetree_pattern pcstr_self)); - ("pcstr_fields", - (this#list - (List.map this#lift_Parsetree_class_field pcstr_fields)))] : - Parsetree.class_structure -> 'res) - method lift_Parsetree_class_field : Parsetree.class_field -> 'res= - (fun - { Parsetree.pcf_desc = pcf_desc; Parsetree.pcf_loc = pcf_loc; - Parsetree.pcf_attributes = pcf_attributes } - -> - this#record "Ast_403.Parsetree.class_field" - [("pcf_desc", (this#lift_Parsetree_class_field_desc pcf_desc)); - ("pcf_loc", (this#lift_Location_t pcf_loc)); - ("pcf_attributes", - (this#lift_Parsetree_attributes pcf_attributes))] : Parsetree.class_field - -> - 'res) - method lift_Parsetree_class_field_desc : - Parsetree.class_field_desc -> 'res= - (function - | Parsetree.Pcf_inherit (x0,x1,x2) -> - this#constr "Ast_403.Parsetree.class_field_desc" - ("Pcf_inherit", - [this#lift_Asttypes_override_flag x0; - this#lift_Parsetree_class_expr x1; - this#lift_option this#string x2]) - | Parsetree.Pcf_val x0 -> - this#constr "Ast_403.Parsetree.class_field_desc" - ("Pcf_val", - [(let (x0,x1,x2) = x0 in - this#tuple - [this#lift_Asttypes_loc this#string x0; - this#lift_Asttypes_mutable_flag x1; - this#lift_Parsetree_class_field_kind x2])]) - | Parsetree.Pcf_method x0 -> - this#constr "Ast_403.Parsetree.class_field_desc" - ("Pcf_method", - [(let (x0,x1,x2) = x0 in - this#tuple - [this#lift_Asttypes_loc this#string x0; - this#lift_Asttypes_private_flag x1; - this#lift_Parsetree_class_field_kind x2])]) - | Parsetree.Pcf_constraint x0 -> - this#constr "Ast_403.Parsetree.class_field_desc" - ("Pcf_constraint", - [(let (x0,x1) = x0 in - this#tuple - [this#lift_Parsetree_core_type x0; - this#lift_Parsetree_core_type x1])]) - | Parsetree.Pcf_initializer x0 -> - this#constr "Ast_403.Parsetree.class_field_desc" - ("Pcf_initializer", [this#lift_Parsetree_expression x0]) - | Parsetree.Pcf_attribute x0 -> - this#constr "Ast_403.Parsetree.class_field_desc" - ("Pcf_attribute", [this#lift_Parsetree_attribute x0]) - | Parsetree.Pcf_extension x0 -> - this#constr "Ast_403.Parsetree.class_field_desc" - ("Pcf_extension", [this#lift_Parsetree_extension x0]) : - Parsetree.class_field_desc -> 'res) - method lift_Parsetree_class_field_kind : - Parsetree.class_field_kind -> 'res= - (function - | Parsetree.Cfk_virtual x0 -> - this#constr "Ast_403.Parsetree.class_field_kind" - ("Cfk_virtual", [this#lift_Parsetree_core_type x0]) - | Parsetree.Cfk_concrete (x0,x1) -> - this#constr "Ast_403.Parsetree.class_field_kind" - ("Cfk_concrete", - [this#lift_Asttypes_override_flag x0; - this#lift_Parsetree_expression x1]) : Parsetree.class_field_kind - -> 'res) - method lift_Parsetree_module_binding : Parsetree.module_binding -> 'res= - (fun - { Parsetree.pmb_name = pmb_name; Parsetree.pmb_expr = pmb_expr; - Parsetree.pmb_attributes = pmb_attributes; - Parsetree.pmb_loc = pmb_loc } - -> - this#record "Ast_403.Parsetree.module_binding" - [("pmb_name", (this#lift_Asttypes_loc this#string pmb_name)); - ("pmb_expr", (this#lift_Parsetree_module_expr pmb_expr)); - ("pmb_attributes", - (this#lift_Parsetree_attributes pmb_attributes)); - ("pmb_loc", (this#lift_Location_t pmb_loc))] : Parsetree.module_binding - -> 'res) - method lift_Parsetree_module_expr : Parsetree.module_expr -> 'res= - (fun - { Parsetree.pmod_desc = pmod_desc; Parsetree.pmod_loc = pmod_loc; - Parsetree.pmod_attributes = pmod_attributes } - -> - this#record "Ast_403.Parsetree.module_expr" - [("pmod_desc", (this#lift_Parsetree_module_expr_desc pmod_desc)); - ("pmod_loc", (this#lift_Location_t pmod_loc)); - ("pmod_attributes", - (this#lift_Parsetree_attributes pmod_attributes))] : Parsetree.module_expr - -> - 'res) - method lift_Parsetree_module_expr_desc : - Parsetree.module_expr_desc -> 'res= - (function - | Parsetree.Pmod_ident x0 -> - this#constr "Ast_403.Parsetree.module_expr_desc" - ("Pmod_ident", - [this#lift_Asttypes_loc this#lift_Longident_t x0]) - | Parsetree.Pmod_structure x0 -> - this#constr "Ast_403.Parsetree.module_expr_desc" - ("Pmod_structure", [this#lift_Parsetree_structure x0]) - | Parsetree.Pmod_functor (x0,x1,x2) -> - this#constr "Ast_403.Parsetree.module_expr_desc" - ("Pmod_functor", - [this#lift_Asttypes_loc this#string x0; - this#lift_option this#lift_Parsetree_module_type x1; - this#lift_Parsetree_module_expr x2]) - | Parsetree.Pmod_apply (x0,x1) -> - this#constr "Ast_403.Parsetree.module_expr_desc" - ("Pmod_apply", - [this#lift_Parsetree_module_expr x0; - this#lift_Parsetree_module_expr x1]) - | Parsetree.Pmod_constraint (x0,x1) -> - this#constr "Ast_403.Parsetree.module_expr_desc" - ("Pmod_constraint", - [this#lift_Parsetree_module_expr x0; - this#lift_Parsetree_module_type x1]) - | Parsetree.Pmod_unpack x0 -> - this#constr "Ast_403.Parsetree.module_expr_desc" - ("Pmod_unpack", [this#lift_Parsetree_expression x0]) - | Parsetree.Pmod_extension x0 -> - this#constr "Ast_403.Parsetree.module_expr_desc" - ("Pmod_extension", [this#lift_Parsetree_extension x0]) : - Parsetree.module_expr_desc -> 'res) - method lift_Parsetree_module_type : Parsetree.module_type -> 'res= - (fun - { Parsetree.pmty_desc = pmty_desc; Parsetree.pmty_loc = pmty_loc; - Parsetree.pmty_attributes = pmty_attributes } - -> - this#record "Ast_403.Parsetree.module_type" - [("pmty_desc", (this#lift_Parsetree_module_type_desc pmty_desc)); - ("pmty_loc", (this#lift_Location_t pmty_loc)); - ("pmty_attributes", - (this#lift_Parsetree_attributes pmty_attributes))] : Parsetree.module_type - -> - 'res) - method lift_Parsetree_module_type_desc : - Parsetree.module_type_desc -> 'res= - (function - | Parsetree.Pmty_ident x0 -> - this#constr "Ast_403.Parsetree.module_type_desc" - ("Pmty_ident", - [this#lift_Asttypes_loc this#lift_Longident_t x0]) - | Parsetree.Pmty_signature x0 -> - this#constr "Ast_403.Parsetree.module_type_desc" - ("Pmty_signature", [this#lift_Parsetree_signature x0]) - | Parsetree.Pmty_functor (x0,x1,x2) -> - this#constr "Ast_403.Parsetree.module_type_desc" - ("Pmty_functor", - [this#lift_Asttypes_loc this#string x0; - this#lift_option this#lift_Parsetree_module_type x1; - this#lift_Parsetree_module_type x2]) - | Parsetree.Pmty_with (x0,x1) -> - this#constr "Ast_403.Parsetree.module_type_desc" - ("Pmty_with", - [this#lift_Parsetree_module_type x0; - this#list (List.map this#lift_Parsetree_with_constraint x1)]) - | Parsetree.Pmty_typeof x0 -> - this#constr "Ast_403.Parsetree.module_type_desc" - ("Pmty_typeof", [this#lift_Parsetree_module_expr x0]) - | Parsetree.Pmty_extension x0 -> - this#constr "Ast_403.Parsetree.module_type_desc" - ("Pmty_extension", [this#lift_Parsetree_extension x0]) - | Parsetree.Pmty_alias x0 -> - this#constr "Ast_403.Parsetree.module_type_desc" - ("Pmty_alias", - [this#lift_Asttypes_loc this#lift_Longident_t x0]) : Parsetree.module_type_desc - -> - 'res) - method lift_Parsetree_with_constraint : - Parsetree.with_constraint -> 'res= - (function - | Parsetree.Pwith_type (x0,x1) -> - this#constr "Ast_403.Parsetree.with_constraint" - ("Pwith_type", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_Parsetree_type_declaration x1]) - | Parsetree.Pwith_module (x0,x1) -> - this#constr "Ast_403.Parsetree.with_constraint" - ("Pwith_module", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_Asttypes_loc this#lift_Longident_t x1]) - | Parsetree.Pwith_typesubst x0 -> - this#constr "Ast_403.Parsetree.with_constraint" - ("Pwith_typesubst", [this#lift_Parsetree_type_declaration x0]) - | Parsetree.Pwith_modsubst (x0,x1) -> - this#constr "Ast_403.Parsetree.with_constraint" - ("Pwith_modsubst", - [this#lift_Asttypes_loc this#string x0; - this#lift_Asttypes_loc this#lift_Longident_t x1]) : Parsetree.with_constraint - -> - 'res) - method lift_Parsetree_signature : Parsetree.signature -> 'res= - (fun x -> this#list (List.map this#lift_Parsetree_signature_item x) : - Parsetree.signature -> 'res) - method lift_Parsetree_signature_item : Parsetree.signature_item -> 'res= - (fun { Parsetree.psig_desc = psig_desc; Parsetree.psig_loc = psig_loc } - -> - this#record "Ast_403.Parsetree.signature_item" - [("psig_desc", - (this#lift_Parsetree_signature_item_desc psig_desc)); - ("psig_loc", (this#lift_Location_t psig_loc))] : Parsetree.signature_item - -> 'res) - method lift_Parsetree_signature_item_desc : - Parsetree.signature_item_desc -> 'res= - (function - | Parsetree.Psig_value x0 -> - this#constr "Ast_403.Parsetree.signature_item_desc" - ("Psig_value", [this#lift_Parsetree_value_description x0]) - | Parsetree.Psig_type (x0,x1) -> - this#constr "Ast_403.Parsetree.signature_item_desc" - ("Psig_type", - [this#lift_Asttypes_rec_flag x0; - this#list (List.map this#lift_Parsetree_type_declaration x1)]) - | Parsetree.Psig_typext x0 -> - this#constr "Ast_403.Parsetree.signature_item_desc" - ("Psig_typext", [this#lift_Parsetree_type_extension x0]) - | Parsetree.Psig_exception x0 -> - this#constr "Ast_403.Parsetree.signature_item_desc" - ("Psig_exception", - [this#lift_Parsetree_extension_constructor x0]) - | Parsetree.Psig_module x0 -> - this#constr "Ast_403.Parsetree.signature_item_desc" - ("Psig_module", [this#lift_Parsetree_module_declaration x0]) - | Parsetree.Psig_recmodule x0 -> - this#constr "Ast_403.Parsetree.signature_item_desc" - ("Psig_recmodule", - [this#list - (List.map this#lift_Parsetree_module_declaration x0)]) - | Parsetree.Psig_modtype x0 -> - this#constr "Ast_403.Parsetree.signature_item_desc" - ("Psig_modtype", - [this#lift_Parsetree_module_type_declaration x0]) - | Parsetree.Psig_open x0 -> - this#constr "Ast_403.Parsetree.signature_item_desc" - ("Psig_open", [this#lift_Parsetree_open_description x0]) - | Parsetree.Psig_include x0 -> - this#constr "Ast_403.Parsetree.signature_item_desc" - ("Psig_include", [this#lift_Parsetree_include_description x0]) - | Parsetree.Psig_class x0 -> - this#constr "Ast_403.Parsetree.signature_item_desc" - ("Psig_class", - [this#list (List.map this#lift_Parsetree_class_description x0)]) - | Parsetree.Psig_class_type x0 -> - this#constr "Ast_403.Parsetree.signature_item_desc" - ("Psig_class_type", - [this#list - (List.map this#lift_Parsetree_class_type_declaration x0)]) - | Parsetree.Psig_attribute x0 -> - this#constr "Ast_403.Parsetree.signature_item_desc" - ("Psig_attribute", [this#lift_Parsetree_attribute x0]) - | Parsetree.Psig_extension (x0,x1) -> - this#constr "Ast_403.Parsetree.signature_item_desc" - ("Psig_extension", - [this#lift_Parsetree_extension x0; - this#lift_Parsetree_attributes x1]) : Parsetree.signature_item_desc - -> 'res) - method lift_Parsetree_class_type_declaration : - Parsetree.class_type_declaration -> 'res= - (fun x -> - this#lift_Parsetree_class_infos this#lift_Parsetree_class_type x : - Parsetree.class_type_declaration -> 'res) - method lift_Parsetree_class_description : - Parsetree.class_description -> 'res= - (fun x -> - this#lift_Parsetree_class_infos this#lift_Parsetree_class_type x : - Parsetree.class_description -> 'res) - method lift_Parsetree_class_type : Parsetree.class_type -> 'res= - (fun - { Parsetree.pcty_desc = pcty_desc; Parsetree.pcty_loc = pcty_loc; - Parsetree.pcty_attributes = pcty_attributes } - -> - this#record "Ast_403.Parsetree.class_type" - [("pcty_desc", (this#lift_Parsetree_class_type_desc pcty_desc)); - ("pcty_loc", (this#lift_Location_t pcty_loc)); - ("pcty_attributes", - (this#lift_Parsetree_attributes pcty_attributes))] : Parsetree.class_type - -> - 'res) - method lift_Parsetree_class_type_desc : - Parsetree.class_type_desc -> 'res= - (function - | Parsetree.Pcty_constr (x0,x1) -> - this#constr "Ast_403.Parsetree.class_type_desc" - ("Pcty_constr", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#list (List.map this#lift_Parsetree_core_type x1)]) - | Parsetree.Pcty_signature x0 -> - this#constr "Ast_403.Parsetree.class_type_desc" - ("Pcty_signature", [this#lift_Parsetree_class_signature x0]) - | Parsetree.Pcty_arrow (x0,x1,x2) -> - this#constr "Ast_403.Parsetree.class_type_desc" - ("Pcty_arrow", - [this#lift_Asttypes_arg_label x0; - this#lift_Parsetree_core_type x1; - this#lift_Parsetree_class_type x2]) - | Parsetree.Pcty_extension x0 -> - this#constr "Ast_403.Parsetree.class_type_desc" - ("Pcty_extension", [this#lift_Parsetree_extension x0]) : - Parsetree.class_type_desc -> 'res) - method lift_Parsetree_class_signature : - Parsetree.class_signature -> 'res= - (fun - { Parsetree.pcsig_self = pcsig_self; - Parsetree.pcsig_fields = pcsig_fields } - -> - this#record "Ast_403.Parsetree.class_signature" - [("pcsig_self", (this#lift_Parsetree_core_type pcsig_self)); - ("pcsig_fields", - (this#list - (List.map this#lift_Parsetree_class_type_field pcsig_fields)))] : - Parsetree.class_signature -> 'res) - method lift_Parsetree_class_type_field : - Parsetree.class_type_field -> 'res= - (fun - { Parsetree.pctf_desc = pctf_desc; Parsetree.pctf_loc = pctf_loc; - Parsetree.pctf_attributes = pctf_attributes } - -> - this#record "Ast_403.Parsetree.class_type_field" - [("pctf_desc", - (this#lift_Parsetree_class_type_field_desc pctf_desc)); - ("pctf_loc", (this#lift_Location_t pctf_loc)); - ("pctf_attributes", - (this#lift_Parsetree_attributes pctf_attributes))] : Parsetree.class_type_field - -> - 'res) - method lift_Parsetree_class_type_field_desc : - Parsetree.class_type_field_desc -> 'res= - (function - | Parsetree.Pctf_inherit x0 -> - this#constr "Ast_403.Parsetree.class_type_field_desc" - ("Pctf_inherit", [this#lift_Parsetree_class_type x0]) - | Parsetree.Pctf_val x0 -> - this#constr "Ast_403.Parsetree.class_type_field_desc" - ("Pctf_val", - [(let (x0,x1,x2,x3) = x0 in - this#tuple - [this#string x0; - this#lift_Asttypes_mutable_flag x1; - this#lift_Asttypes_virtual_flag x2; - this#lift_Parsetree_core_type x3])]) - | Parsetree.Pctf_method x0 -> - this#constr "Ast_403.Parsetree.class_type_field_desc" - ("Pctf_method", - [(let (x0,x1,x2,x3) = x0 in - this#tuple - [this#string x0; - this#lift_Asttypes_private_flag x1; - this#lift_Asttypes_virtual_flag x2; - this#lift_Parsetree_core_type x3])]) - | Parsetree.Pctf_constraint x0 -> - this#constr "Ast_403.Parsetree.class_type_field_desc" - ("Pctf_constraint", - [(let (x0,x1) = x0 in - this#tuple - [this#lift_Parsetree_core_type x0; - this#lift_Parsetree_core_type x1])]) - | Parsetree.Pctf_attribute x0 -> - this#constr "Ast_403.Parsetree.class_type_field_desc" - ("Pctf_attribute", [this#lift_Parsetree_attribute x0]) - | Parsetree.Pctf_extension x0 -> - this#constr "Ast_403.Parsetree.class_type_field_desc" - ("Pctf_extension", [this#lift_Parsetree_extension x0]) : - Parsetree.class_type_field_desc -> 'res) - method lift_Parsetree_extension : Parsetree.extension -> 'res= - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_loc this#string x0; - this#lift_Parsetree_payload x1] : Parsetree.extension -> 'res) - method lift_Parsetree_class_infos : - 'f0 . ('f0 -> 'res) -> 'f0 Parsetree.class_infos -> 'res= fun (type f0) - -> - (fun f0 -> - fun - { Parsetree.pci_virt = pci_virt; - Parsetree.pci_params = pci_params; - Parsetree.pci_name = pci_name; Parsetree.pci_expr = pci_expr; - Parsetree.pci_loc = pci_loc; - Parsetree.pci_attributes = pci_attributes } - -> - this#record "Ast_403.Parsetree.class_infos" - [("pci_virt", (this#lift_Asttypes_virtual_flag pci_virt)); - ("pci_params", - (this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Parsetree_core_type x0; - this#lift_Asttypes_variance x1]) pci_params))); - ("pci_name", (this#lift_Asttypes_loc this#string pci_name)); - ("pci_expr", (f0 pci_expr)); - ("pci_loc", (this#lift_Location_t pci_loc)); - ("pci_attributes", - (this#lift_Parsetree_attributes pci_attributes))] : (f0 -> - 'res) -> - f0 - Parsetree.class_infos - -> - 'res) - method lift_Asttypes_virtual_flag : Asttypes.virtual_flag -> 'res= - (function - | Asttypes.Virtual -> - this#constr "Ast_403.Asttypes.virtual_flag" ("Virtual", []) - | Asttypes.Concrete -> - this#constr "Ast_403.Asttypes.virtual_flag" ("Concrete", []) : Asttypes.virtual_flag - -> - 'res) - method lift_Parsetree_include_description : - Parsetree.include_description -> 'res= - (fun x -> - this#lift_Parsetree_include_infos this#lift_Parsetree_module_type x : - Parsetree.include_description -> 'res) - method lift_Parsetree_include_infos : - 'f0 . ('f0 -> 'res) -> 'f0 Parsetree.include_infos -> 'res= fun (type - f0) -> - (fun f0 -> - fun - { Parsetree.pincl_mod = pincl_mod; - Parsetree.pincl_loc = pincl_loc; - Parsetree.pincl_attributes = pincl_attributes } - -> - this#record "Ast_403.Parsetree.include_infos" - [("pincl_mod", (f0 pincl_mod)); - ("pincl_loc", (this#lift_Location_t pincl_loc)); - ("pincl_attributes", - (this#lift_Parsetree_attributes pincl_attributes))] : - (f0 -> 'res) -> f0 Parsetree.include_infos -> 'res) - method lift_Parsetree_open_description : - Parsetree.open_description -> 'res= - (fun - { Parsetree.popen_lid = popen_lid; - Parsetree.popen_override = popen_override; - Parsetree.popen_loc = popen_loc; - Parsetree.popen_attributes = popen_attributes } - -> - this#record "Ast_403.Parsetree.open_description" - [("popen_lid", - (this#lift_Asttypes_loc this#lift_Longident_t popen_lid)); - ("popen_override", - (this#lift_Asttypes_override_flag popen_override)); - ("popen_loc", (this#lift_Location_t popen_loc)); - ("popen_attributes", - (this#lift_Parsetree_attributes popen_attributes))] : Parsetree.open_description - -> - 'res) - method lift_Asttypes_override_flag : Asttypes.override_flag -> 'res= - (function - | Asttypes.Override -> - this#constr "Ast_403.Asttypes.override_flag" ("Override", []) - | Asttypes.Fresh -> - this#constr "Ast_403.Asttypes.override_flag" ("Fresh", []) : Asttypes.override_flag - -> - 'res) - method lift_Parsetree_module_type_declaration : - Parsetree.module_type_declaration -> 'res= - (fun - { Parsetree.pmtd_name = pmtd_name; Parsetree.pmtd_type = pmtd_type; - Parsetree.pmtd_attributes = pmtd_attributes; - Parsetree.pmtd_loc = pmtd_loc } - -> - this#record "Ast_403.Parsetree.module_type_declaration" - [("pmtd_name", (this#lift_Asttypes_loc this#string pmtd_name)); - ("pmtd_type", - (this#lift_option this#lift_Parsetree_module_type pmtd_type)); - ("pmtd_attributes", - (this#lift_Parsetree_attributes pmtd_attributes)); - ("pmtd_loc", (this#lift_Location_t pmtd_loc))] : Parsetree.module_type_declaration - -> 'res) - method lift_Parsetree_module_declaration : - Parsetree.module_declaration -> 'res= - (fun - { Parsetree.pmd_name = pmd_name; Parsetree.pmd_type = pmd_type; - Parsetree.pmd_attributes = pmd_attributes; - Parsetree.pmd_loc = pmd_loc } - -> - this#record "Ast_403.Parsetree.module_declaration" - [("pmd_name", (this#lift_Asttypes_loc this#string pmd_name)); - ("pmd_type", (this#lift_Parsetree_module_type pmd_type)); - ("pmd_attributes", - (this#lift_Parsetree_attributes pmd_attributes)); - ("pmd_loc", (this#lift_Location_t pmd_loc))] : Parsetree.module_declaration - -> 'res) - method lift_Parsetree_type_extension : Parsetree.type_extension -> 'res= - (fun - { Parsetree.ptyext_path = ptyext_path; - Parsetree.ptyext_params = ptyext_params; - Parsetree.ptyext_constructors = ptyext_constructors; - Parsetree.ptyext_private = ptyext_private; - Parsetree.ptyext_attributes = ptyext_attributes } - -> - this#record "Ast_403.Parsetree.type_extension" - [("ptyext_path", - (this#lift_Asttypes_loc this#lift_Longident_t ptyext_path)); - ("ptyext_params", - (this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Parsetree_core_type x0; - this#lift_Asttypes_variance x1]) ptyext_params))); - ("ptyext_constructors", - (this#list - (List.map this#lift_Parsetree_extension_constructor - ptyext_constructors))); - ("ptyext_private", - (this#lift_Asttypes_private_flag ptyext_private)); - ("ptyext_attributes", - (this#lift_Parsetree_attributes ptyext_attributes))] : Parsetree.type_extension - -> - 'res) - method lift_Parsetree_extension_constructor : - Parsetree.extension_constructor -> 'res= - (fun - { Parsetree.pext_name = pext_name; Parsetree.pext_kind = pext_kind; - Parsetree.pext_loc = pext_loc; - Parsetree.pext_attributes = pext_attributes } - -> - this#record "Ast_403.Parsetree.extension_constructor" - [("pext_name", (this#lift_Asttypes_loc this#string pext_name)); - ("pext_kind", - (this#lift_Parsetree_extension_constructor_kind pext_kind)); - ("pext_loc", (this#lift_Location_t pext_loc)); - ("pext_attributes", - (this#lift_Parsetree_attributes pext_attributes))] : Parsetree.extension_constructor - -> - 'res) - method lift_Parsetree_extension_constructor_kind : - Parsetree.extension_constructor_kind -> 'res= - (function - | Parsetree.Pext_decl (x0,x1) -> - this#constr "Ast_403.Parsetree.extension_constructor_kind" - ("Pext_decl", - [this#lift_Parsetree_constructor_arguments x0; - this#lift_option this#lift_Parsetree_core_type x1]) - | Parsetree.Pext_rebind x0 -> - this#constr "Ast_403.Parsetree.extension_constructor_kind" - ("Pext_rebind", - [this#lift_Asttypes_loc this#lift_Longident_t x0]) : Parsetree.extension_constructor_kind - -> - 'res) - method lift_Parsetree_type_declaration : - Parsetree.type_declaration -> 'res= - (fun - { Parsetree.ptype_name = ptype_name; - Parsetree.ptype_params = ptype_params; - Parsetree.ptype_cstrs = ptype_cstrs; - Parsetree.ptype_kind = ptype_kind; - Parsetree.ptype_private = ptype_private; - Parsetree.ptype_manifest = ptype_manifest; - Parsetree.ptype_attributes = ptype_attributes; - Parsetree.ptype_loc = ptype_loc } - -> - this#record "Ast_403.Parsetree.type_declaration" - [("ptype_name", (this#lift_Asttypes_loc this#string ptype_name)); - ("ptype_params", - (this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Parsetree_core_type x0; - this#lift_Asttypes_variance x1]) ptype_params))); - ("ptype_cstrs", - (this#list - (List.map - (fun x -> - let (x0,x1,x2) = x in - this#tuple - [this#lift_Parsetree_core_type x0; - this#lift_Parsetree_core_type x1; - this#lift_Location_t x2]) ptype_cstrs))); - ("ptype_kind", (this#lift_Parsetree_type_kind ptype_kind)); - ("ptype_private", (this#lift_Asttypes_private_flag ptype_private)); - ("ptype_manifest", - (this#lift_option this#lift_Parsetree_core_type ptype_manifest)); - ("ptype_attributes", - (this#lift_Parsetree_attributes ptype_attributes)); - ("ptype_loc", (this#lift_Location_t ptype_loc))] : Parsetree.type_declaration - -> 'res) - method lift_Asttypes_private_flag : Asttypes.private_flag -> 'res= - (function - | Asttypes.Private -> - this#constr "Ast_403.Asttypes.private_flag" ("Private", []) - | Asttypes.Public -> - this#constr "Ast_403.Asttypes.private_flag" ("Public", []) : Asttypes.private_flag - -> - 'res) - method lift_Parsetree_type_kind : Parsetree.type_kind -> 'res= - (function - | Parsetree.Ptype_abstract -> - this#constr "Ast_403.Parsetree.type_kind" ("Ptype_abstract", []) - | Parsetree.Ptype_variant x0 -> - this#constr "Ast_403.Parsetree.type_kind" - ("Ptype_variant", - [this#list - (List.map this#lift_Parsetree_constructor_declaration x0)]) - | Parsetree.Ptype_record x0 -> - this#constr "Ast_403.Parsetree.type_kind" - ("Ptype_record", - [this#list (List.map this#lift_Parsetree_label_declaration x0)]) - | Parsetree.Ptype_open -> - this#constr "Ast_403.Parsetree.type_kind" ("Ptype_open", []) : Parsetree.type_kind - -> - 'res) - method lift_Parsetree_constructor_declaration : - Parsetree.constructor_declaration -> 'res= - (fun - { Parsetree.pcd_name = pcd_name; Parsetree.pcd_args = pcd_args; - Parsetree.pcd_res = pcd_res; Parsetree.pcd_loc = pcd_loc; - Parsetree.pcd_attributes = pcd_attributes } - -> - this#record "Ast_403.Parsetree.constructor_declaration" - [("pcd_name", (this#lift_Asttypes_loc this#string pcd_name)); - ("pcd_args", (this#lift_Parsetree_constructor_arguments pcd_args)); - ("pcd_res", - (this#lift_option this#lift_Parsetree_core_type pcd_res)); - ("pcd_loc", (this#lift_Location_t pcd_loc)); - ("pcd_attributes", - (this#lift_Parsetree_attributes pcd_attributes))] : Parsetree.constructor_declaration - -> - 'res) - method lift_Parsetree_constructor_arguments : - Parsetree.constructor_arguments -> 'res= - (function - | Parsetree.Pcstr_tuple x0 -> - this#constr "Ast_403.Parsetree.constructor_arguments" - ("Pcstr_tuple", - [this#list (List.map this#lift_Parsetree_core_type x0)]) - | Parsetree.Pcstr_record x0 -> - this#constr "Ast_403.Parsetree.constructor_arguments" - ("Pcstr_record", - [this#list (List.map this#lift_Parsetree_label_declaration x0)]) : - Parsetree.constructor_arguments -> 'res) - method lift_Parsetree_label_declaration : - Parsetree.label_declaration -> 'res= - (fun - { Parsetree.pld_name = pld_name; - Parsetree.pld_mutable = pld_mutable; - Parsetree.pld_type = pld_type; Parsetree.pld_loc = pld_loc; - Parsetree.pld_attributes = pld_attributes } - -> - this#record "Ast_403.Parsetree.label_declaration" - [("pld_name", (this#lift_Asttypes_loc this#string pld_name)); - ("pld_mutable", (this#lift_Asttypes_mutable_flag pld_mutable)); - ("pld_type", (this#lift_Parsetree_core_type pld_type)); - ("pld_loc", (this#lift_Location_t pld_loc)); - ("pld_attributes", - (this#lift_Parsetree_attributes pld_attributes))] : Parsetree.label_declaration - -> - 'res) - method lift_Asttypes_mutable_flag : Asttypes.mutable_flag -> 'res= - (function - | Asttypes.Immutable -> - this#constr "Ast_403.Asttypes.mutable_flag" ("Immutable", []) - | Asttypes.Mutable -> - this#constr "Ast_403.Asttypes.mutable_flag" ("Mutable", []) : Asttypes.mutable_flag - -> - 'res) - method lift_Asttypes_variance : Asttypes.variance -> 'res= - (function - | Asttypes.Covariant -> - this#constr "Ast_403.Asttypes.variance" ("Covariant", []) - | Asttypes.Contravariant -> - this#constr "Ast_403.Asttypes.variance" ("Contravariant", []) - | Asttypes.Invariant -> - this#constr "Ast_403.Asttypes.variance" ("Invariant", []) : Asttypes.variance - -> 'res) - method lift_Parsetree_value_description : - Parsetree.value_description -> 'res= - (fun - { Parsetree.pval_name = pval_name; Parsetree.pval_type = pval_type; - Parsetree.pval_prim = pval_prim; - Parsetree.pval_attributes = pval_attributes; - Parsetree.pval_loc = pval_loc } - -> - this#record "Ast_403.Parsetree.value_description" - [("pval_name", (this#lift_Asttypes_loc this#string pval_name)); - ("pval_type", (this#lift_Parsetree_core_type pval_type)); - ("pval_prim", (this#list (List.map this#string pval_prim))); - ("pval_attributes", - (this#lift_Parsetree_attributes pval_attributes)); - ("pval_loc", (this#lift_Location_t pval_loc))] : Parsetree.value_description - -> 'res) - method lift_Asttypes_arg_label : Asttypes.arg_label -> 'res= - (function - | Asttypes.Nolabel -> - this#constr "Ast_403.Asttypes.arg_label" ("Nolabel", []) - | Asttypes.Labelled x0 -> - this#constr "Ast_403.Asttypes.arg_label" ("Labelled", [this#string x0]) - | Asttypes.Optional x0 -> - this#constr "Ast_403.Asttypes.arg_label" ("Optional", [this#string x0]) : - Asttypes.arg_label -> 'res) - method lift_Asttypes_closed_flag : Asttypes.closed_flag -> 'res= - (function - | Asttypes.Closed -> - this#constr "Ast_403.Asttypes.closed_flag" ("Closed", []) - | Asttypes.Open -> this#constr "Ast_403.Asttypes.closed_flag" ("Open", []) : - Asttypes.closed_flag -> 'res) - method lift_Asttypes_label : Asttypes.label -> 'res= - (this#string : Asttypes.label -> 'res) - method lift_Asttypes_rec_flag : Asttypes.rec_flag -> 'res= - (function - | Asttypes.Nonrecursive -> - this#constr "Ast_403.Asttypes.rec_flag" ("Nonrecursive", []) - | Asttypes.Recursive -> - this#constr "Ast_403.Asttypes.rec_flag" ("Recursive", []) : Asttypes.rec_flag - -> 'res) - method lift_Parsetree_constant : Parsetree.constant -> 'res= - (function - | Parsetree.Pconst_integer (x0,x1) -> - this#constr "Ast_403.Parsetree.constant" - ("Pconst_integer", - [this#string x0; this#lift_option this#char x1]) - | Parsetree.Pconst_char x0 -> - this#constr "Ast_403.Parsetree.constant" ("Pconst_char", [this#char x0]) - | Parsetree.Pconst_string (x0,x1) -> - this#constr "Ast_403.Parsetree.constant" - ("Pconst_string", - [this#string x0; this#lift_option this#string x1]) - | Parsetree.Pconst_float (x0,x1) -> - this#constr "Ast_403.Parsetree.constant" - ("Pconst_float", - [this#string x0; this#lift_option this#char x1]) : Parsetree.constant - -> - 'res) - method lift_option : 'f0 . ('f0 -> 'res) -> 'f0 option -> 'res= fun (type - f0) -> - (fun f0 -> - function - | None -> this#constr "option" ("None", []) - | Some x0 -> this#constr "option" ("Some", [f0 x0]) : (f0 -> 'res) - -> - f0 option -> - 'res) - method lift_Longident_t : Longident.t -> 'res= - (function - | Longident.Lident x0 -> - this#constr "Ast_403.Longident.t" ("Lident", [this#string x0]) - | Longident.Ldot (x0,x1) -> - this#constr "Ast_403.Longident.t" - ("Ldot", [this#lift_Longident_t x0; this#string x1]) - | Longident.Lapply (x0,x1) -> - this#constr "Ast_403.Longident.t" - ("Lapply", [this#lift_Longident_t x0; this#lift_Longident_t x1]) : - Longident.t -> 'res) - method lift_Asttypes_loc : - 'f0 . ('f0 -> 'res) -> 'f0 Asttypes.loc -> 'res= fun (type f0) -> - (fun f0 -> - fun { Asttypes.txt = txt; Asttypes.loc = loc } -> - this#record "Ast_403.Asttypes.loc" - [("txt", (f0 txt)); ("loc", (this#lift_Location_t loc))] : - (f0 -> 'res) -> f0 Asttypes.loc -> 'res) - method lift_Location_t : Location.t -> 'res= - (fun - { Location.loc_start = loc_start; Location.loc_end = loc_end; - Location.loc_ghost = loc_ghost } - -> - this#record "Ast_403.Location.t" - [("loc_start", (this#lift_Lexing_position loc_start)); - ("loc_end", (this#lift_Lexing_position loc_end)); - ("loc_ghost", (this#lift_bool loc_ghost))] : Location.t -> 'res) - method lift_bool : bool -> 'res= - (function - | false -> this#constr "bool" ("false", []) - | true -> this#constr "bool" ("true", []) : bool -> 'res) - method lift_Lexing_position : Lexing.position -> 'res= - (fun - { Lexing.pos_fname = pos_fname; Lexing.pos_lnum = pos_lnum; - Lexing.pos_bol = pos_bol; Lexing.pos_cnum = pos_cnum } - -> - this#record "Lexing.position" - [("pos_fname", (this#string pos_fname)); - ("pos_lnum", (this#int pos_lnum)); - ("pos_bol", (this#int pos_bol)); - ("pos_cnum", (this#int pos_cnum))] : Lexing.position -> 'res) - end diff --git a/ppx_tools_versioned.5.2/ast_lifter_404.ml b/ppx_tools_versioned.5.2/ast_lifter_404.ml deleted file mode 100644 index 3442d8a..0000000 --- a/ppx_tools_versioned.5.2/ast_lifter_404.ml +++ /dev/null @@ -1,1388 +0,0 @@ -open Ast_404 - -class virtual ['res] lifter = - object (this) - method lift_Parsetree_expression : Parsetree.expression -> 'res= - (fun - { Parsetree.pexp_desc = pexp_desc; Parsetree.pexp_loc = pexp_loc; - Parsetree.pexp_attributes = pexp_attributes } - -> - this#record "Ast_404.Parsetree.expression" - [("pexp_desc", (this#lift_Parsetree_expression_desc pexp_desc)); - ("pexp_loc", (this#lift_Location_t pexp_loc)); - ("pexp_attributes", - (this#lift_Parsetree_attributes pexp_attributes))] : Parsetree.expression - -> - 'res) - method lift_Parsetree_expression_desc : - Parsetree.expression_desc -> 'res= - (function - | Parsetree.Pexp_ident x0 -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_ident", - [this#lift_Asttypes_loc this#lift_Longident_t x0]) - | Parsetree.Pexp_constant x0 -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_constant", [this#lift_Parsetree_constant x0]) - | Parsetree.Pexp_let (x0,x1,x2) -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_let", - [this#lift_Asttypes_rec_flag x0; - this#list (List.map this#lift_Parsetree_value_binding x1); - this#lift_Parsetree_expression x2]) - | Parsetree.Pexp_function x0 -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_function", - [this#list (List.map this#lift_Parsetree_case x0)]) - | Parsetree.Pexp_fun (x0,x1,x2,x3) -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_fun", - [this#lift_Asttypes_arg_label x0; - this#lift_option this#lift_Parsetree_expression x1; - this#lift_Parsetree_pattern x2; - this#lift_Parsetree_expression x3]) - | Parsetree.Pexp_apply (x0,x1) -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_apply", - [this#lift_Parsetree_expression x0; - this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_arg_label x0; - this#lift_Parsetree_expression x1]) x1)]) - | Parsetree.Pexp_match (x0,x1) -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_match", - [this#lift_Parsetree_expression x0; - this#list (List.map this#lift_Parsetree_case x1)]) - | Parsetree.Pexp_try (x0,x1) -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_try", - [this#lift_Parsetree_expression x0; - this#list (List.map this#lift_Parsetree_case x1)]) - | Parsetree.Pexp_tuple x0 -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_tuple", - [this#list (List.map this#lift_Parsetree_expression x0)]) - | Parsetree.Pexp_construct (x0,x1) -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_construct", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_option this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_variant (x0,x1) -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_variant", - [this#lift_Asttypes_label x0; - this#lift_option this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_record (x0,x1) -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_record", - [this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_Parsetree_expression x1]) x0); - this#lift_option this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_field (x0,x1) -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_field", - [this#lift_Parsetree_expression x0; - this#lift_Asttypes_loc this#lift_Longident_t x1]) - | Parsetree.Pexp_setfield (x0,x1,x2) -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_setfield", - [this#lift_Parsetree_expression x0; - this#lift_Asttypes_loc this#lift_Longident_t x1; - this#lift_Parsetree_expression x2]) - | Parsetree.Pexp_array x0 -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_array", - [this#list (List.map this#lift_Parsetree_expression x0)]) - | Parsetree.Pexp_ifthenelse (x0,x1,x2) -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_ifthenelse", - [this#lift_Parsetree_expression x0; - this#lift_Parsetree_expression x1; - this#lift_option this#lift_Parsetree_expression x2]) - | Parsetree.Pexp_sequence (x0,x1) -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_sequence", - [this#lift_Parsetree_expression x0; - this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_while (x0,x1) -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_while", - [this#lift_Parsetree_expression x0; - this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_for (x0,x1,x2,x3,x4) -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_for", - [this#lift_Parsetree_pattern x0; - this#lift_Parsetree_expression x1; - this#lift_Parsetree_expression x2; - this#lift_Asttypes_direction_flag x3; - this#lift_Parsetree_expression x4]) - | Parsetree.Pexp_constraint (x0,x1) -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_constraint", - [this#lift_Parsetree_expression x0; - this#lift_Parsetree_core_type x1]) - | Parsetree.Pexp_coerce (x0,x1,x2) -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_coerce", - [this#lift_Parsetree_expression x0; - this#lift_option this#lift_Parsetree_core_type x1; - this#lift_Parsetree_core_type x2]) - | Parsetree.Pexp_send (x0,x1) -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_send", - [this#lift_Parsetree_expression x0; this#string x1]) - | Parsetree.Pexp_new x0 -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_new", [this#lift_Asttypes_loc this#lift_Longident_t x0]) - | Parsetree.Pexp_setinstvar (x0,x1) -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_setinstvar", - [this#lift_Asttypes_loc this#string x0; - this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_override x0 -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_override", - [this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_loc this#string x0; - this#lift_Parsetree_expression x1]) x0)]) - | Parsetree.Pexp_letmodule (x0,x1,x2) -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_letmodule", - [this#lift_Asttypes_loc this#string x0; - this#lift_Parsetree_module_expr x1; - this#lift_Parsetree_expression x2]) - | Parsetree.Pexp_letexception (x0,x1) -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_letexception", - [this#lift_Parsetree_extension_constructor x0; - this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_assert x0 -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_assert", [this#lift_Parsetree_expression x0]) - | Parsetree.Pexp_lazy x0 -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_lazy", [this#lift_Parsetree_expression x0]) - | Parsetree.Pexp_poly (x0,x1) -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_poly", - [this#lift_Parsetree_expression x0; - this#lift_option this#lift_Parsetree_core_type x1]) - | Parsetree.Pexp_object x0 -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_object", [this#lift_Parsetree_class_structure x0]) - | Parsetree.Pexp_newtype (x0,x1) -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_newtype", - [this#string x0; this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_pack x0 -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_pack", [this#lift_Parsetree_module_expr x0]) - | Parsetree.Pexp_open (x0,x1,x2) -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_open", - [this#lift_Asttypes_override_flag x0; - this#lift_Asttypes_loc this#lift_Longident_t x1; - this#lift_Parsetree_expression x2]) - | Parsetree.Pexp_extension x0 -> - this#constr "Ast_404.Parsetree.expression_desc" - ("Pexp_extension", [this#lift_Parsetree_extension x0]) - | Parsetree.Pexp_unreachable -> - this#constr "Ast_404.Parsetree.expression_desc" ("Pexp_unreachable", []) : - Parsetree.expression_desc -> 'res) - method lift_Asttypes_direction_flag : Asttypes.direction_flag -> 'res= - (function - | Asttypes.Upto -> this#constr "Ast_404.Asttypes.direction_flag" ("Upto", []) - | Asttypes.Downto -> - this#constr "Ast_404.Asttypes.direction_flag" ("Downto", []) : Asttypes.direction_flag - -> - 'res) - method lift_Parsetree_case : Parsetree.case -> 'res= - (fun - { Parsetree.pc_lhs = pc_lhs; Parsetree.pc_guard = pc_guard; - Parsetree.pc_rhs = pc_rhs } - -> - this#record "Ast_404.Parsetree.case" - [("pc_lhs", (this#lift_Parsetree_pattern pc_lhs)); - ("pc_guard", - (this#lift_option this#lift_Parsetree_expression pc_guard)); - ("pc_rhs", (this#lift_Parsetree_expression pc_rhs))] : Parsetree.case - -> - 'res) - method lift_Parsetree_value_binding : Parsetree.value_binding -> 'res= - (fun - { Parsetree.pvb_pat = pvb_pat; Parsetree.pvb_expr = pvb_expr; - Parsetree.pvb_attributes = pvb_attributes; - Parsetree.pvb_loc = pvb_loc } - -> - this#record "Ast_404.Parsetree.value_binding" - [("pvb_pat", (this#lift_Parsetree_pattern pvb_pat)); - ("pvb_expr", (this#lift_Parsetree_expression pvb_expr)); - ("pvb_attributes", - (this#lift_Parsetree_attributes pvb_attributes)); - ("pvb_loc", (this#lift_Location_t pvb_loc))] : Parsetree.value_binding - -> 'res) - method lift_Parsetree_pattern : Parsetree.pattern -> 'res= - (fun - { Parsetree.ppat_desc = ppat_desc; Parsetree.ppat_loc = ppat_loc; - Parsetree.ppat_attributes = ppat_attributes } - -> - this#record "Ast_404.Parsetree.pattern" - [("ppat_desc", (this#lift_Parsetree_pattern_desc ppat_desc)); - ("ppat_loc", (this#lift_Location_t ppat_loc)); - ("ppat_attributes", - (this#lift_Parsetree_attributes ppat_attributes))] : Parsetree.pattern - -> - 'res) - method lift_Parsetree_pattern_desc : Parsetree.pattern_desc -> 'res= - (function - | Parsetree.Ppat_any -> - this#constr "Ast_404.Parsetree.pattern_desc" ("Ppat_any", []) - | Parsetree.Ppat_var x0 -> - this#constr "Ast_404.Parsetree.pattern_desc" - ("Ppat_var", [this#lift_Asttypes_loc this#string x0]) - | Parsetree.Ppat_alias (x0,x1) -> - this#constr "Ast_404.Parsetree.pattern_desc" - ("Ppat_alias", - [this#lift_Parsetree_pattern x0; - this#lift_Asttypes_loc this#string x1]) - | Parsetree.Ppat_constant x0 -> - this#constr "Ast_404.Parsetree.pattern_desc" - ("Ppat_constant", [this#lift_Parsetree_constant x0]) - | Parsetree.Ppat_interval (x0,x1) -> - this#constr "Ast_404.Parsetree.pattern_desc" - ("Ppat_interval", - [this#lift_Parsetree_constant x0; - this#lift_Parsetree_constant x1]) - | Parsetree.Ppat_tuple x0 -> - this#constr "Ast_404.Parsetree.pattern_desc" - ("Ppat_tuple", - [this#list (List.map this#lift_Parsetree_pattern x0)]) - | Parsetree.Ppat_construct (x0,x1) -> - this#constr "Ast_404.Parsetree.pattern_desc" - ("Ppat_construct", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_option this#lift_Parsetree_pattern x1]) - | Parsetree.Ppat_variant (x0,x1) -> - this#constr "Ast_404.Parsetree.pattern_desc" - ("Ppat_variant", - [this#lift_Asttypes_label x0; - this#lift_option this#lift_Parsetree_pattern x1]) - | Parsetree.Ppat_record (x0,x1) -> - this#constr "Ast_404.Parsetree.pattern_desc" - ("Ppat_record", - [this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_Parsetree_pattern x1]) x0); - this#lift_Asttypes_closed_flag x1]) - | Parsetree.Ppat_array x0 -> - this#constr "Ast_404.Parsetree.pattern_desc" - ("Ppat_array", - [this#list (List.map this#lift_Parsetree_pattern x0)]) - | Parsetree.Ppat_or (x0,x1) -> - this#constr "Ast_404.Parsetree.pattern_desc" - ("Ppat_or", - [this#lift_Parsetree_pattern x0; - this#lift_Parsetree_pattern x1]) - | Parsetree.Ppat_constraint (x0,x1) -> - this#constr "Ast_404.Parsetree.pattern_desc" - ("Ppat_constraint", - [this#lift_Parsetree_pattern x0; - this#lift_Parsetree_core_type x1]) - | Parsetree.Ppat_type x0 -> - this#constr "Ast_404.Parsetree.pattern_desc" - ("Ppat_type", [this#lift_Asttypes_loc this#lift_Longident_t x0]) - | Parsetree.Ppat_lazy x0 -> - this#constr "Ast_404.Parsetree.pattern_desc" - ("Ppat_lazy", [this#lift_Parsetree_pattern x0]) - | Parsetree.Ppat_unpack x0 -> - this#constr "Ast_404.Parsetree.pattern_desc" - ("Ppat_unpack", [this#lift_Asttypes_loc this#string x0]) - | Parsetree.Ppat_exception x0 -> - this#constr "Ast_404.Parsetree.pattern_desc" - ("Ppat_exception", [this#lift_Parsetree_pattern x0]) - | Parsetree.Ppat_extension x0 -> - this#constr "Ast_404.Parsetree.pattern_desc" - ("Ppat_extension", [this#lift_Parsetree_extension x0]) - | Parsetree.Ppat_open (x0,x1) -> - this#constr "Ast_404.Parsetree.pattern_desc" - ("Ppat_open", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_Parsetree_pattern x1]) : Parsetree.pattern_desc -> - 'res) - method lift_Parsetree_core_type : Parsetree.core_type -> 'res= - (fun - { Parsetree.ptyp_desc = ptyp_desc; Parsetree.ptyp_loc = ptyp_loc; - Parsetree.ptyp_attributes = ptyp_attributes } - -> - this#record "Ast_404.Parsetree.core_type" - [("ptyp_desc", (this#lift_Parsetree_core_type_desc ptyp_desc)); - ("ptyp_loc", (this#lift_Location_t ptyp_loc)); - ("ptyp_attributes", - (this#lift_Parsetree_attributes ptyp_attributes))] : Parsetree.core_type - -> - 'res) - method lift_Parsetree_core_type_desc : Parsetree.core_type_desc -> 'res= - (function - | Parsetree.Ptyp_any -> - this#constr "Ast_404.Parsetree.core_type_desc" ("Ptyp_any", []) - | Parsetree.Ptyp_var x0 -> - this#constr "Ast_404.Parsetree.core_type_desc" - ("Ptyp_var", [this#string x0]) - | Parsetree.Ptyp_arrow (x0,x1,x2) -> - this#constr "Ast_404.Parsetree.core_type_desc" - ("Ptyp_arrow", - [this#lift_Asttypes_arg_label x0; - this#lift_Parsetree_core_type x1; - this#lift_Parsetree_core_type x2]) - | Parsetree.Ptyp_tuple x0 -> - this#constr "Ast_404.Parsetree.core_type_desc" - ("Ptyp_tuple", - [this#list (List.map this#lift_Parsetree_core_type x0)]) - | Parsetree.Ptyp_constr (x0,x1) -> - this#constr "Ast_404.Parsetree.core_type_desc" - ("Ptyp_constr", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#list (List.map this#lift_Parsetree_core_type x1)]) - | Parsetree.Ptyp_object (x0,x1) -> - this#constr "Ast_404.Parsetree.core_type_desc" - ("Ptyp_object", - [this#list - (List.map - (fun x -> - let (x0,x1,x2) = x in - this#tuple - [this#string x0; - this#lift_Parsetree_attributes x1; - this#lift_Parsetree_core_type x2]) x0); - this#lift_Asttypes_closed_flag x1]) - | Parsetree.Ptyp_class (x0,x1) -> - this#constr "Ast_404.Parsetree.core_type_desc" - ("Ptyp_class", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#list (List.map this#lift_Parsetree_core_type x1)]) - | Parsetree.Ptyp_alias (x0,x1) -> - this#constr "Ast_404.Parsetree.core_type_desc" - ("Ptyp_alias", - [this#lift_Parsetree_core_type x0; this#string x1]) - | Parsetree.Ptyp_variant (x0,x1,x2) -> - this#constr "Ast_404.Parsetree.core_type_desc" - ("Ptyp_variant", - [this#list (List.map this#lift_Parsetree_row_field x0); - this#lift_Asttypes_closed_flag x1; - this#lift_option - (fun x -> this#list (List.map this#lift_Asttypes_label x)) - x2]) - | Parsetree.Ptyp_poly (x0,x1) -> - this#constr "Ast_404.Parsetree.core_type_desc" - ("Ptyp_poly", - [this#list (List.map this#string x0); - this#lift_Parsetree_core_type x1]) - | Parsetree.Ptyp_package x0 -> - this#constr "Ast_404.Parsetree.core_type_desc" - ("Ptyp_package", [this#lift_Parsetree_package_type x0]) - | Parsetree.Ptyp_extension x0 -> - this#constr "Ast_404.Parsetree.core_type_desc" - ("Ptyp_extension", [this#lift_Parsetree_extension x0]) : - Parsetree.core_type_desc -> 'res) - method lift_Parsetree_package_type : Parsetree.package_type -> 'res= - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_Parsetree_core_type x1]) x1)] : Parsetree.package_type - -> 'res) - method lift_Parsetree_row_field : Parsetree.row_field -> 'res= - (function - | Parsetree.Rtag (x0,x1,x2,x3) -> - this#constr "Ast_404.Parsetree.row_field" - ("Rtag", - [this#lift_Asttypes_label x0; - this#lift_Parsetree_attributes x1; - this#lift_bool x2; - this#list (List.map this#lift_Parsetree_core_type x3)]) - | Parsetree.Rinherit x0 -> - this#constr "Ast_404.Parsetree.row_field" - ("Rinherit", [this#lift_Parsetree_core_type x0]) : Parsetree.row_field - -> - 'res) - method lift_Parsetree_attributes : Parsetree.attributes -> 'res= - (fun x -> this#list (List.map this#lift_Parsetree_attribute x) : - Parsetree.attributes -> 'res) - method lift_Parsetree_attribute : Parsetree.attribute -> 'res= - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_loc this#string x0; - this#lift_Parsetree_payload x1] : Parsetree.attribute -> 'res) - method lift_Parsetree_payload : Parsetree.payload -> 'res= - (function - | Parsetree.PStr x0 -> - this#constr "Ast_404.Parsetree.payload" - ("PStr", [this#lift_Parsetree_structure x0]) - | Parsetree.PSig x0 -> - this#constr "Ast_404.Parsetree.payload" - ("PSig", [this#lift_Parsetree_signature x0]) - | Parsetree.PTyp x0 -> - this#constr "Ast_404.Parsetree.payload" - ("PTyp", [this#lift_Parsetree_core_type x0]) - | Parsetree.PPat (x0,x1) -> - this#constr "Ast_404.Parsetree.payload" - ("PPat", - [this#lift_Parsetree_pattern x0; - this#lift_option this#lift_Parsetree_expression x1]) : - Parsetree.payload -> 'res) - method lift_Parsetree_structure : Parsetree.structure -> 'res= - (fun x -> this#list (List.map this#lift_Parsetree_structure_item x) : - Parsetree.structure -> 'res) - method lift_Parsetree_structure_item : Parsetree.structure_item -> 'res= - (fun { Parsetree.pstr_desc = pstr_desc; Parsetree.pstr_loc = pstr_loc } - -> - this#record "Ast_404.Parsetree.structure_item" - [("pstr_desc", - (this#lift_Parsetree_structure_item_desc pstr_desc)); - ("pstr_loc", (this#lift_Location_t pstr_loc))] : Parsetree.structure_item - -> 'res) - method lift_Parsetree_structure_item_desc : - Parsetree.structure_item_desc -> 'res= - (function - | Parsetree.Pstr_eval (x0,x1) -> - this#constr "Ast_404.Parsetree.structure_item_desc" - ("Pstr_eval", - [this#lift_Parsetree_expression x0; - this#lift_Parsetree_attributes x1]) - | Parsetree.Pstr_value (x0,x1) -> - this#constr "Ast_404.Parsetree.structure_item_desc" - ("Pstr_value", - [this#lift_Asttypes_rec_flag x0; - this#list (List.map this#lift_Parsetree_value_binding x1)]) - | Parsetree.Pstr_primitive x0 -> - this#constr "Ast_404.Parsetree.structure_item_desc" - ("Pstr_primitive", [this#lift_Parsetree_value_description x0]) - | Parsetree.Pstr_type (x0,x1) -> - this#constr "Ast_404.Parsetree.structure_item_desc" - ("Pstr_type", - [this#lift_Asttypes_rec_flag x0; - this#list (List.map this#lift_Parsetree_type_declaration x1)]) - | Parsetree.Pstr_typext x0 -> - this#constr "Ast_404.Parsetree.structure_item_desc" - ("Pstr_typext", [this#lift_Parsetree_type_extension x0]) - | Parsetree.Pstr_exception x0 -> - this#constr "Ast_404.Parsetree.structure_item_desc" - ("Pstr_exception", - [this#lift_Parsetree_extension_constructor x0]) - | Parsetree.Pstr_module x0 -> - this#constr "Ast_404.Parsetree.structure_item_desc" - ("Pstr_module", [this#lift_Parsetree_module_binding x0]) - | Parsetree.Pstr_recmodule x0 -> - this#constr "Ast_404.Parsetree.structure_item_desc" - ("Pstr_recmodule", - [this#list (List.map this#lift_Parsetree_module_binding x0)]) - | Parsetree.Pstr_modtype x0 -> - this#constr "Ast_404.Parsetree.structure_item_desc" - ("Pstr_modtype", - [this#lift_Parsetree_module_type_declaration x0]) - | Parsetree.Pstr_open x0 -> - this#constr "Ast_404.Parsetree.structure_item_desc" - ("Pstr_open", [this#lift_Parsetree_open_description x0]) - | Parsetree.Pstr_class x0 -> - this#constr "Ast_404.Parsetree.structure_item_desc" - ("Pstr_class", - [this#list (List.map this#lift_Parsetree_class_declaration x0)]) - | Parsetree.Pstr_class_type x0 -> - this#constr "Ast_404.Parsetree.structure_item_desc" - ("Pstr_class_type", - [this#list - (List.map this#lift_Parsetree_class_type_declaration x0)]) - | Parsetree.Pstr_include x0 -> - this#constr "Ast_404.Parsetree.structure_item_desc" - ("Pstr_include", [this#lift_Parsetree_include_declaration x0]) - | Parsetree.Pstr_attribute x0 -> - this#constr "Ast_404.Parsetree.structure_item_desc" - ("Pstr_attribute", [this#lift_Parsetree_attribute x0]) - | Parsetree.Pstr_extension (x0,x1) -> - this#constr "Ast_404.Parsetree.structure_item_desc" - ("Pstr_extension", - [this#lift_Parsetree_extension x0; - this#lift_Parsetree_attributes x1]) : Parsetree.structure_item_desc - -> 'res) - method lift_Parsetree_include_declaration : - Parsetree.include_declaration -> 'res= - (fun x -> - this#lift_Parsetree_include_infos this#lift_Parsetree_module_expr x : - Parsetree.include_declaration -> 'res) - method lift_Parsetree_class_declaration : - Parsetree.class_declaration -> 'res= - (fun x -> - this#lift_Parsetree_class_infos this#lift_Parsetree_class_expr x : - Parsetree.class_declaration -> 'res) - method lift_Parsetree_class_expr : Parsetree.class_expr -> 'res= - (fun - { Parsetree.pcl_desc = pcl_desc; Parsetree.pcl_loc = pcl_loc; - Parsetree.pcl_attributes = pcl_attributes } - -> - this#record "Ast_404.Parsetree.class_expr" - [("pcl_desc", (this#lift_Parsetree_class_expr_desc pcl_desc)); - ("pcl_loc", (this#lift_Location_t pcl_loc)); - ("pcl_attributes", - (this#lift_Parsetree_attributes pcl_attributes))] : Parsetree.class_expr - -> - 'res) - method lift_Parsetree_class_expr_desc : - Parsetree.class_expr_desc -> 'res= - (function - | Parsetree.Pcl_constr (x0,x1) -> - this#constr "Ast_404.Parsetree.class_expr_desc" - ("Pcl_constr", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#list (List.map this#lift_Parsetree_core_type x1)]) - | Parsetree.Pcl_structure x0 -> - this#constr "Ast_404.Parsetree.class_expr_desc" - ("Pcl_structure", [this#lift_Parsetree_class_structure x0]) - | Parsetree.Pcl_fun (x0,x1,x2,x3) -> - this#constr "Ast_404.Parsetree.class_expr_desc" - ("Pcl_fun", - [this#lift_Asttypes_arg_label x0; - this#lift_option this#lift_Parsetree_expression x1; - this#lift_Parsetree_pattern x2; - this#lift_Parsetree_class_expr x3]) - | Parsetree.Pcl_apply (x0,x1) -> - this#constr "Ast_404.Parsetree.class_expr_desc" - ("Pcl_apply", - [this#lift_Parsetree_class_expr x0; - this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_arg_label x0; - this#lift_Parsetree_expression x1]) x1)]) - | Parsetree.Pcl_let (x0,x1,x2) -> - this#constr "Ast_404.Parsetree.class_expr_desc" - ("Pcl_let", - [this#lift_Asttypes_rec_flag x0; - this#list (List.map this#lift_Parsetree_value_binding x1); - this#lift_Parsetree_class_expr x2]) - | Parsetree.Pcl_constraint (x0,x1) -> - this#constr "Ast_404.Parsetree.class_expr_desc" - ("Pcl_constraint", - [this#lift_Parsetree_class_expr x0; - this#lift_Parsetree_class_type x1]) - | Parsetree.Pcl_extension x0 -> - this#constr "Ast_404.Parsetree.class_expr_desc" - ("Pcl_extension", [this#lift_Parsetree_extension x0]) : - Parsetree.class_expr_desc -> 'res) - method lift_Parsetree_class_structure : - Parsetree.class_structure -> 'res= - (fun - { Parsetree.pcstr_self = pcstr_self; - Parsetree.pcstr_fields = pcstr_fields } - -> - this#record "Ast_404.Parsetree.class_structure" - [("pcstr_self", (this#lift_Parsetree_pattern pcstr_self)); - ("pcstr_fields", - (this#list - (List.map this#lift_Parsetree_class_field pcstr_fields)))] : - Parsetree.class_structure -> 'res) - method lift_Parsetree_class_field : Parsetree.class_field -> 'res= - (fun - { Parsetree.pcf_desc = pcf_desc; Parsetree.pcf_loc = pcf_loc; - Parsetree.pcf_attributes = pcf_attributes } - -> - this#record "Ast_404.Parsetree.class_field" - [("pcf_desc", (this#lift_Parsetree_class_field_desc pcf_desc)); - ("pcf_loc", (this#lift_Location_t pcf_loc)); - ("pcf_attributes", - (this#lift_Parsetree_attributes pcf_attributes))] : Parsetree.class_field - -> - 'res) - method lift_Parsetree_class_field_desc : - Parsetree.class_field_desc -> 'res= - (function - | Parsetree.Pcf_inherit (x0,x1,x2) -> - this#constr "Ast_404.Parsetree.class_field_desc" - ("Pcf_inherit", - [this#lift_Asttypes_override_flag x0; - this#lift_Parsetree_class_expr x1; - this#lift_option this#string x2]) - | Parsetree.Pcf_val x0 -> - this#constr "Ast_404.Parsetree.class_field_desc" - ("Pcf_val", - [(let (x0,x1,x2) = x0 in - this#tuple - [this#lift_Asttypes_loc this#string x0; - this#lift_Asttypes_mutable_flag x1; - this#lift_Parsetree_class_field_kind x2])]) - | Parsetree.Pcf_method x0 -> - this#constr "Ast_404.Parsetree.class_field_desc" - ("Pcf_method", - [(let (x0,x1,x2) = x0 in - this#tuple - [this#lift_Asttypes_loc this#string x0; - this#lift_Asttypes_private_flag x1; - this#lift_Parsetree_class_field_kind x2])]) - | Parsetree.Pcf_constraint x0 -> - this#constr "Ast_404.Parsetree.class_field_desc" - ("Pcf_constraint", - [(let (x0,x1) = x0 in - this#tuple - [this#lift_Parsetree_core_type x0; - this#lift_Parsetree_core_type x1])]) - | Parsetree.Pcf_initializer x0 -> - this#constr "Ast_404.Parsetree.class_field_desc" - ("Pcf_initializer", [this#lift_Parsetree_expression x0]) - | Parsetree.Pcf_attribute x0 -> - this#constr "Ast_404.Parsetree.class_field_desc" - ("Pcf_attribute", [this#lift_Parsetree_attribute x0]) - | Parsetree.Pcf_extension x0 -> - this#constr "Ast_404.Parsetree.class_field_desc" - ("Pcf_extension", [this#lift_Parsetree_extension x0]) : - Parsetree.class_field_desc -> 'res) - method lift_Parsetree_class_field_kind : - Parsetree.class_field_kind -> 'res= - (function - | Parsetree.Cfk_virtual x0 -> - this#constr "Ast_404.Parsetree.class_field_kind" - ("Cfk_virtual", [this#lift_Parsetree_core_type x0]) - | Parsetree.Cfk_concrete (x0,x1) -> - this#constr "Ast_404.Parsetree.class_field_kind" - ("Cfk_concrete", - [this#lift_Asttypes_override_flag x0; - this#lift_Parsetree_expression x1]) : Parsetree.class_field_kind - -> 'res) - method lift_Parsetree_module_binding : Parsetree.module_binding -> 'res= - (fun - { Parsetree.pmb_name = pmb_name; Parsetree.pmb_expr = pmb_expr; - Parsetree.pmb_attributes = pmb_attributes; - Parsetree.pmb_loc = pmb_loc } - -> - this#record "Ast_404.Parsetree.module_binding" - [("pmb_name", (this#lift_Asttypes_loc this#string pmb_name)); - ("pmb_expr", (this#lift_Parsetree_module_expr pmb_expr)); - ("pmb_attributes", - (this#lift_Parsetree_attributes pmb_attributes)); - ("pmb_loc", (this#lift_Location_t pmb_loc))] : Parsetree.module_binding - -> 'res) - method lift_Parsetree_module_expr : Parsetree.module_expr -> 'res= - (fun - { Parsetree.pmod_desc = pmod_desc; Parsetree.pmod_loc = pmod_loc; - Parsetree.pmod_attributes = pmod_attributes } - -> - this#record "Ast_404.Parsetree.module_expr" - [("pmod_desc", (this#lift_Parsetree_module_expr_desc pmod_desc)); - ("pmod_loc", (this#lift_Location_t pmod_loc)); - ("pmod_attributes", - (this#lift_Parsetree_attributes pmod_attributes))] : Parsetree.module_expr - -> - 'res) - method lift_Parsetree_module_expr_desc : - Parsetree.module_expr_desc -> 'res= - (function - | Parsetree.Pmod_ident x0 -> - this#constr "Ast_404.Parsetree.module_expr_desc" - ("Pmod_ident", - [this#lift_Asttypes_loc this#lift_Longident_t x0]) - | Parsetree.Pmod_structure x0 -> - this#constr "Ast_404.Parsetree.module_expr_desc" - ("Pmod_structure", [this#lift_Parsetree_structure x0]) - | Parsetree.Pmod_functor (x0,x1,x2) -> - this#constr "Ast_404.Parsetree.module_expr_desc" - ("Pmod_functor", - [this#lift_Asttypes_loc this#string x0; - this#lift_option this#lift_Parsetree_module_type x1; - this#lift_Parsetree_module_expr x2]) - | Parsetree.Pmod_apply (x0,x1) -> - this#constr "Ast_404.Parsetree.module_expr_desc" - ("Pmod_apply", - [this#lift_Parsetree_module_expr x0; - this#lift_Parsetree_module_expr x1]) - | Parsetree.Pmod_constraint (x0,x1) -> - this#constr "Ast_404.Parsetree.module_expr_desc" - ("Pmod_constraint", - [this#lift_Parsetree_module_expr x0; - this#lift_Parsetree_module_type x1]) - | Parsetree.Pmod_unpack x0 -> - this#constr "Ast_404.Parsetree.module_expr_desc" - ("Pmod_unpack", [this#lift_Parsetree_expression x0]) - | Parsetree.Pmod_extension x0 -> - this#constr "Ast_404.Parsetree.module_expr_desc" - ("Pmod_extension", [this#lift_Parsetree_extension x0]) : - Parsetree.module_expr_desc -> 'res) - method lift_Parsetree_module_type : Parsetree.module_type -> 'res= - (fun - { Parsetree.pmty_desc = pmty_desc; Parsetree.pmty_loc = pmty_loc; - Parsetree.pmty_attributes = pmty_attributes } - -> - this#record "Ast_404.Parsetree.module_type" - [("pmty_desc", (this#lift_Parsetree_module_type_desc pmty_desc)); - ("pmty_loc", (this#lift_Location_t pmty_loc)); - ("pmty_attributes", - (this#lift_Parsetree_attributes pmty_attributes))] : Parsetree.module_type - -> - 'res) - method lift_Parsetree_module_type_desc : - Parsetree.module_type_desc -> 'res= - (function - | Parsetree.Pmty_ident x0 -> - this#constr "Ast_404.Parsetree.module_type_desc" - ("Pmty_ident", - [this#lift_Asttypes_loc this#lift_Longident_t x0]) - | Parsetree.Pmty_signature x0 -> - this#constr "Ast_404.Parsetree.module_type_desc" - ("Pmty_signature", [this#lift_Parsetree_signature x0]) - | Parsetree.Pmty_functor (x0,x1,x2) -> - this#constr "Ast_404.Parsetree.module_type_desc" - ("Pmty_functor", - [this#lift_Asttypes_loc this#string x0; - this#lift_option this#lift_Parsetree_module_type x1; - this#lift_Parsetree_module_type x2]) - | Parsetree.Pmty_with (x0,x1) -> - this#constr "Ast_404.Parsetree.module_type_desc" - ("Pmty_with", - [this#lift_Parsetree_module_type x0; - this#list (List.map this#lift_Parsetree_with_constraint x1)]) - | Parsetree.Pmty_typeof x0 -> - this#constr "Ast_404.Parsetree.module_type_desc" - ("Pmty_typeof", [this#lift_Parsetree_module_expr x0]) - | Parsetree.Pmty_extension x0 -> - this#constr "Ast_404.Parsetree.module_type_desc" - ("Pmty_extension", [this#lift_Parsetree_extension x0]) - | Parsetree.Pmty_alias x0 -> - this#constr "Ast_404.Parsetree.module_type_desc" - ("Pmty_alias", - [this#lift_Asttypes_loc this#lift_Longident_t x0]) : Parsetree.module_type_desc - -> - 'res) - method lift_Parsetree_with_constraint : - Parsetree.with_constraint -> 'res= - (function - | Parsetree.Pwith_type (x0,x1) -> - this#constr "Ast_404.Parsetree.with_constraint" - ("Pwith_type", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_Parsetree_type_declaration x1]) - | Parsetree.Pwith_module (x0,x1) -> - this#constr "Ast_404.Parsetree.with_constraint" - ("Pwith_module", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_Asttypes_loc this#lift_Longident_t x1]) - | Parsetree.Pwith_typesubst x0 -> - this#constr "Ast_404.Parsetree.with_constraint" - ("Pwith_typesubst", [this#lift_Parsetree_type_declaration x0]) - | Parsetree.Pwith_modsubst (x0,x1) -> - this#constr "Ast_404.Parsetree.with_constraint" - ("Pwith_modsubst", - [this#lift_Asttypes_loc this#string x0; - this#lift_Asttypes_loc this#lift_Longident_t x1]) : Parsetree.with_constraint - -> - 'res) - method lift_Parsetree_signature : Parsetree.signature -> 'res= - (fun x -> this#list (List.map this#lift_Parsetree_signature_item x) : - Parsetree.signature -> 'res) - method lift_Parsetree_signature_item : Parsetree.signature_item -> 'res= - (fun { Parsetree.psig_desc = psig_desc; Parsetree.psig_loc = psig_loc } - -> - this#record "Ast_404.Parsetree.signature_item" - [("psig_desc", - (this#lift_Parsetree_signature_item_desc psig_desc)); - ("psig_loc", (this#lift_Location_t psig_loc))] : Parsetree.signature_item - -> 'res) - method lift_Parsetree_signature_item_desc : - Parsetree.signature_item_desc -> 'res= - (function - | Parsetree.Psig_value x0 -> - this#constr "Ast_404.Parsetree.signature_item_desc" - ("Psig_value", [this#lift_Parsetree_value_description x0]) - | Parsetree.Psig_type (x0,x1) -> - this#constr "Ast_404.Parsetree.signature_item_desc" - ("Psig_type", - [this#lift_Asttypes_rec_flag x0; - this#list (List.map this#lift_Parsetree_type_declaration x1)]) - | Parsetree.Psig_typext x0 -> - this#constr "Ast_404.Parsetree.signature_item_desc" - ("Psig_typext", [this#lift_Parsetree_type_extension x0]) - | Parsetree.Psig_exception x0 -> - this#constr "Ast_404.Parsetree.signature_item_desc" - ("Psig_exception", - [this#lift_Parsetree_extension_constructor x0]) - | Parsetree.Psig_module x0 -> - this#constr "Ast_404.Parsetree.signature_item_desc" - ("Psig_module", [this#lift_Parsetree_module_declaration x0]) - | Parsetree.Psig_recmodule x0 -> - this#constr "Ast_404.Parsetree.signature_item_desc" - ("Psig_recmodule", - [this#list - (List.map this#lift_Parsetree_module_declaration x0)]) - | Parsetree.Psig_modtype x0 -> - this#constr "Ast_404.Parsetree.signature_item_desc" - ("Psig_modtype", - [this#lift_Parsetree_module_type_declaration x0]) - | Parsetree.Psig_open x0 -> - this#constr "Ast_404.Parsetree.signature_item_desc" - ("Psig_open", [this#lift_Parsetree_open_description x0]) - | Parsetree.Psig_include x0 -> - this#constr "Ast_404.Parsetree.signature_item_desc" - ("Psig_include", [this#lift_Parsetree_include_description x0]) - | Parsetree.Psig_class x0 -> - this#constr "Ast_404.Parsetree.signature_item_desc" - ("Psig_class", - [this#list (List.map this#lift_Parsetree_class_description x0)]) - | Parsetree.Psig_class_type x0 -> - this#constr "Ast_404.Parsetree.signature_item_desc" - ("Psig_class_type", - [this#list - (List.map this#lift_Parsetree_class_type_declaration x0)]) - | Parsetree.Psig_attribute x0 -> - this#constr "Ast_404.Parsetree.signature_item_desc" - ("Psig_attribute", [this#lift_Parsetree_attribute x0]) - | Parsetree.Psig_extension (x0,x1) -> - this#constr "Ast_404.Parsetree.signature_item_desc" - ("Psig_extension", - [this#lift_Parsetree_extension x0; - this#lift_Parsetree_attributes x1]) : Parsetree.signature_item_desc - -> 'res) - method lift_Parsetree_class_type_declaration : - Parsetree.class_type_declaration -> 'res= - (fun x -> - this#lift_Parsetree_class_infos this#lift_Parsetree_class_type x : - Parsetree.class_type_declaration -> 'res) - method lift_Parsetree_class_description : - Parsetree.class_description -> 'res= - (fun x -> - this#lift_Parsetree_class_infos this#lift_Parsetree_class_type x : - Parsetree.class_description -> 'res) - method lift_Parsetree_class_type : Parsetree.class_type -> 'res= - (fun - { Parsetree.pcty_desc = pcty_desc; Parsetree.pcty_loc = pcty_loc; - Parsetree.pcty_attributes = pcty_attributes } - -> - this#record "Ast_404.Parsetree.class_type" - [("pcty_desc", (this#lift_Parsetree_class_type_desc pcty_desc)); - ("pcty_loc", (this#lift_Location_t pcty_loc)); - ("pcty_attributes", - (this#lift_Parsetree_attributes pcty_attributes))] : Parsetree.class_type - -> - 'res) - method lift_Parsetree_class_type_desc : - Parsetree.class_type_desc -> 'res= - (function - | Parsetree.Pcty_constr (x0,x1) -> - this#constr "Ast_404.Parsetree.class_type_desc" - ("Pcty_constr", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#list (List.map this#lift_Parsetree_core_type x1)]) - | Parsetree.Pcty_signature x0 -> - this#constr "Ast_404.Parsetree.class_type_desc" - ("Pcty_signature", [this#lift_Parsetree_class_signature x0]) - | Parsetree.Pcty_arrow (x0,x1,x2) -> - this#constr "Ast_404.Parsetree.class_type_desc" - ("Pcty_arrow", - [this#lift_Asttypes_arg_label x0; - this#lift_Parsetree_core_type x1; - this#lift_Parsetree_class_type x2]) - | Parsetree.Pcty_extension x0 -> - this#constr "Ast_404.Parsetree.class_type_desc" - ("Pcty_extension", [this#lift_Parsetree_extension x0]) : - Parsetree.class_type_desc -> 'res) - method lift_Parsetree_class_signature : - Parsetree.class_signature -> 'res= - (fun - { Parsetree.pcsig_self = pcsig_self; - Parsetree.pcsig_fields = pcsig_fields } - -> - this#record "Ast_404.Parsetree.class_signature" - [("pcsig_self", (this#lift_Parsetree_core_type pcsig_self)); - ("pcsig_fields", - (this#list - (List.map this#lift_Parsetree_class_type_field pcsig_fields)))] : - Parsetree.class_signature -> 'res) - method lift_Parsetree_class_type_field : - Parsetree.class_type_field -> 'res= - (fun - { Parsetree.pctf_desc = pctf_desc; Parsetree.pctf_loc = pctf_loc; - Parsetree.pctf_attributes = pctf_attributes } - -> - this#record "Ast_404.Parsetree.class_type_field" - [("pctf_desc", - (this#lift_Parsetree_class_type_field_desc pctf_desc)); - ("pctf_loc", (this#lift_Location_t pctf_loc)); - ("pctf_attributes", - (this#lift_Parsetree_attributes pctf_attributes))] : Parsetree.class_type_field - -> - 'res) - method lift_Parsetree_class_type_field_desc : - Parsetree.class_type_field_desc -> 'res= - (function - | Parsetree.Pctf_inherit x0 -> - this#constr "Ast_404.Parsetree.class_type_field_desc" - ("Pctf_inherit", [this#lift_Parsetree_class_type x0]) - | Parsetree.Pctf_val x0 -> - this#constr "Ast_404.Parsetree.class_type_field_desc" - ("Pctf_val", - [(let (x0,x1,x2,x3) = x0 in - this#tuple - [this#string x0; - this#lift_Asttypes_mutable_flag x1; - this#lift_Asttypes_virtual_flag x2; - this#lift_Parsetree_core_type x3])]) - | Parsetree.Pctf_method x0 -> - this#constr "Ast_404.Parsetree.class_type_field_desc" - ("Pctf_method", - [(let (x0,x1,x2,x3) = x0 in - this#tuple - [this#string x0; - this#lift_Asttypes_private_flag x1; - this#lift_Asttypes_virtual_flag x2; - this#lift_Parsetree_core_type x3])]) - | Parsetree.Pctf_constraint x0 -> - this#constr "Ast_404.Parsetree.class_type_field_desc" - ("Pctf_constraint", - [(let (x0,x1) = x0 in - this#tuple - [this#lift_Parsetree_core_type x0; - this#lift_Parsetree_core_type x1])]) - | Parsetree.Pctf_attribute x0 -> - this#constr "Ast_404.Parsetree.class_type_field_desc" - ("Pctf_attribute", [this#lift_Parsetree_attribute x0]) - | Parsetree.Pctf_extension x0 -> - this#constr "Ast_404.Parsetree.class_type_field_desc" - ("Pctf_extension", [this#lift_Parsetree_extension x0]) : - Parsetree.class_type_field_desc -> 'res) - method lift_Parsetree_extension : Parsetree.extension -> 'res= - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_loc this#string x0; - this#lift_Parsetree_payload x1] : Parsetree.extension -> 'res) - method lift_Parsetree_class_infos : - 'f0 . ('f0 -> 'res) -> 'f0 Parsetree.class_infos -> 'res= fun (type f0) - -> - (fun f0 -> - fun - { Parsetree.pci_virt = pci_virt; - Parsetree.pci_params = pci_params; - Parsetree.pci_name = pci_name; Parsetree.pci_expr = pci_expr; - Parsetree.pci_loc = pci_loc; - Parsetree.pci_attributes = pci_attributes } - -> - this#record "Ast_404.Parsetree.class_infos" - [("pci_virt", (this#lift_Asttypes_virtual_flag pci_virt)); - ("pci_params", - (this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Parsetree_core_type x0; - this#lift_Asttypes_variance x1]) pci_params))); - ("pci_name", (this#lift_Asttypes_loc this#string pci_name)); - ("pci_expr", (f0 pci_expr)); - ("pci_loc", (this#lift_Location_t pci_loc)); - ("pci_attributes", - (this#lift_Parsetree_attributes pci_attributes))] : (f0 -> - 'res) -> - f0 - Parsetree.class_infos - -> - 'res) - method lift_Asttypes_virtual_flag : Asttypes.virtual_flag -> 'res= - (function - | Asttypes.Virtual -> - this#constr "Ast_404.Asttypes.virtual_flag" ("Virtual", []) - | Asttypes.Concrete -> - this#constr "Ast_404.Asttypes.virtual_flag" ("Concrete", []) : Asttypes.virtual_flag - -> - 'res) - method lift_Parsetree_include_description : - Parsetree.include_description -> 'res= - (fun x -> - this#lift_Parsetree_include_infos this#lift_Parsetree_module_type x : - Parsetree.include_description -> 'res) - method lift_Parsetree_include_infos : - 'f0 . ('f0 -> 'res) -> 'f0 Parsetree.include_infos -> 'res= fun (type - f0) -> - (fun f0 -> - fun - { Parsetree.pincl_mod = pincl_mod; - Parsetree.pincl_loc = pincl_loc; - Parsetree.pincl_attributes = pincl_attributes } - -> - this#record "Ast_404.Parsetree.include_infos" - [("pincl_mod", (f0 pincl_mod)); - ("pincl_loc", (this#lift_Location_t pincl_loc)); - ("pincl_attributes", - (this#lift_Parsetree_attributes pincl_attributes))] : - (f0 -> 'res) -> f0 Parsetree.include_infos -> 'res) - method lift_Parsetree_open_description : - Parsetree.open_description -> 'res= - (fun - { Parsetree.popen_lid = popen_lid; - Parsetree.popen_override = popen_override; - Parsetree.popen_loc = popen_loc; - Parsetree.popen_attributes = popen_attributes } - -> - this#record "Ast_404.Parsetree.open_description" - [("popen_lid", - (this#lift_Asttypes_loc this#lift_Longident_t popen_lid)); - ("popen_override", - (this#lift_Asttypes_override_flag popen_override)); - ("popen_loc", (this#lift_Location_t popen_loc)); - ("popen_attributes", - (this#lift_Parsetree_attributes popen_attributes))] : Parsetree.open_description - -> - 'res) - method lift_Asttypes_override_flag : Asttypes.override_flag -> 'res= - (function - | Asttypes.Override -> - this#constr "Ast_404.Asttypes.override_flag" ("Override", []) - | Asttypes.Fresh -> - this#constr "Ast_404.Asttypes.override_flag" ("Fresh", []) : Asttypes.override_flag - -> - 'res) - method lift_Parsetree_module_type_declaration : - Parsetree.module_type_declaration -> 'res= - (fun - { Parsetree.pmtd_name = pmtd_name; Parsetree.pmtd_type = pmtd_type; - Parsetree.pmtd_attributes = pmtd_attributes; - Parsetree.pmtd_loc = pmtd_loc } - -> - this#record "Ast_404.Parsetree.module_type_declaration" - [("pmtd_name", (this#lift_Asttypes_loc this#string pmtd_name)); - ("pmtd_type", - (this#lift_option this#lift_Parsetree_module_type pmtd_type)); - ("pmtd_attributes", - (this#lift_Parsetree_attributes pmtd_attributes)); - ("pmtd_loc", (this#lift_Location_t pmtd_loc))] : Parsetree.module_type_declaration - -> 'res) - method lift_Parsetree_module_declaration : - Parsetree.module_declaration -> 'res= - (fun - { Parsetree.pmd_name = pmd_name; Parsetree.pmd_type = pmd_type; - Parsetree.pmd_attributes = pmd_attributes; - Parsetree.pmd_loc = pmd_loc } - -> - this#record "Ast_404.Parsetree.module_declaration" - [("pmd_name", (this#lift_Asttypes_loc this#string pmd_name)); - ("pmd_type", (this#lift_Parsetree_module_type pmd_type)); - ("pmd_attributes", - (this#lift_Parsetree_attributes pmd_attributes)); - ("pmd_loc", (this#lift_Location_t pmd_loc))] : Parsetree.module_declaration - -> 'res) - method lift_Parsetree_type_extension : Parsetree.type_extension -> 'res= - (fun - { Parsetree.ptyext_path = ptyext_path; - Parsetree.ptyext_params = ptyext_params; - Parsetree.ptyext_constructors = ptyext_constructors; - Parsetree.ptyext_private = ptyext_private; - Parsetree.ptyext_attributes = ptyext_attributes } - -> - this#record "Ast_404.Parsetree.type_extension" - [("ptyext_path", - (this#lift_Asttypes_loc this#lift_Longident_t ptyext_path)); - ("ptyext_params", - (this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Parsetree_core_type x0; - this#lift_Asttypes_variance x1]) ptyext_params))); - ("ptyext_constructors", - (this#list - (List.map this#lift_Parsetree_extension_constructor - ptyext_constructors))); - ("ptyext_private", - (this#lift_Asttypes_private_flag ptyext_private)); - ("ptyext_attributes", - (this#lift_Parsetree_attributes ptyext_attributes))] : Parsetree.type_extension - -> - 'res) - method lift_Parsetree_extension_constructor : - Parsetree.extension_constructor -> 'res= - (fun - { Parsetree.pext_name = pext_name; Parsetree.pext_kind = pext_kind; - Parsetree.pext_loc = pext_loc; - Parsetree.pext_attributes = pext_attributes } - -> - this#record "Ast_404.Parsetree.extension_constructor" - [("pext_name", (this#lift_Asttypes_loc this#string pext_name)); - ("pext_kind", - (this#lift_Parsetree_extension_constructor_kind pext_kind)); - ("pext_loc", (this#lift_Location_t pext_loc)); - ("pext_attributes", - (this#lift_Parsetree_attributes pext_attributes))] : Parsetree.extension_constructor - -> - 'res) - method lift_Parsetree_extension_constructor_kind : - Parsetree.extension_constructor_kind -> 'res= - (function - | Parsetree.Pext_decl (x0,x1) -> - this#constr "Ast_404.Parsetree.extension_constructor_kind" - ("Pext_decl", - [this#lift_Parsetree_constructor_arguments x0; - this#lift_option this#lift_Parsetree_core_type x1]) - | Parsetree.Pext_rebind x0 -> - this#constr "Ast_404.Parsetree.extension_constructor_kind" - ("Pext_rebind", - [this#lift_Asttypes_loc this#lift_Longident_t x0]) : Parsetree.extension_constructor_kind - -> - 'res) - method lift_Parsetree_type_declaration : - Parsetree.type_declaration -> 'res= - (fun - { Parsetree.ptype_name = ptype_name; - Parsetree.ptype_params = ptype_params; - Parsetree.ptype_cstrs = ptype_cstrs; - Parsetree.ptype_kind = ptype_kind; - Parsetree.ptype_private = ptype_private; - Parsetree.ptype_manifest = ptype_manifest; - Parsetree.ptype_attributes = ptype_attributes; - Parsetree.ptype_loc = ptype_loc } - -> - this#record "Ast_404.Parsetree.type_declaration" - [("ptype_name", (this#lift_Asttypes_loc this#string ptype_name)); - ("ptype_params", - (this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Parsetree_core_type x0; - this#lift_Asttypes_variance x1]) ptype_params))); - ("ptype_cstrs", - (this#list - (List.map - (fun x -> - let (x0,x1,x2) = x in - this#tuple - [this#lift_Parsetree_core_type x0; - this#lift_Parsetree_core_type x1; - this#lift_Location_t x2]) ptype_cstrs))); - ("ptype_kind", (this#lift_Parsetree_type_kind ptype_kind)); - ("ptype_private", (this#lift_Asttypes_private_flag ptype_private)); - ("ptype_manifest", - (this#lift_option this#lift_Parsetree_core_type ptype_manifest)); - ("ptype_attributes", - (this#lift_Parsetree_attributes ptype_attributes)); - ("ptype_loc", (this#lift_Location_t ptype_loc))] : Parsetree.type_declaration - -> 'res) - method lift_Asttypes_private_flag : Asttypes.private_flag -> 'res= - (function - | Asttypes.Private -> - this#constr "Ast_404.Asttypes.private_flag" ("Private", []) - | Asttypes.Public -> - this#constr "Ast_404.Asttypes.private_flag" ("Public", []) : Asttypes.private_flag - -> - 'res) - method lift_Parsetree_type_kind : Parsetree.type_kind -> 'res= - (function - | Parsetree.Ptype_abstract -> - this#constr "Ast_404.Parsetree.type_kind" ("Ptype_abstract", []) - | Parsetree.Ptype_variant x0 -> - this#constr "Ast_404.Parsetree.type_kind" - ("Ptype_variant", - [this#list - (List.map this#lift_Parsetree_constructor_declaration x0)]) - | Parsetree.Ptype_record x0 -> - this#constr "Ast_404.Parsetree.type_kind" - ("Ptype_record", - [this#list (List.map this#lift_Parsetree_label_declaration x0)]) - | Parsetree.Ptype_open -> - this#constr "Ast_404.Parsetree.type_kind" ("Ptype_open", []) : Parsetree.type_kind - -> - 'res) - method lift_Parsetree_constructor_declaration : - Parsetree.constructor_declaration -> 'res= - (fun - { Parsetree.pcd_name = pcd_name; Parsetree.pcd_args = pcd_args; - Parsetree.pcd_res = pcd_res; Parsetree.pcd_loc = pcd_loc; - Parsetree.pcd_attributes = pcd_attributes } - -> - this#record "Ast_404.Parsetree.constructor_declaration" - [("pcd_name", (this#lift_Asttypes_loc this#string pcd_name)); - ("pcd_args", (this#lift_Parsetree_constructor_arguments pcd_args)); - ("pcd_res", - (this#lift_option this#lift_Parsetree_core_type pcd_res)); - ("pcd_loc", (this#lift_Location_t pcd_loc)); - ("pcd_attributes", - (this#lift_Parsetree_attributes pcd_attributes))] : Parsetree.constructor_declaration - -> - 'res) - method lift_Parsetree_constructor_arguments : - Parsetree.constructor_arguments -> 'res= - (function - | Parsetree.Pcstr_tuple x0 -> - this#constr "Ast_404.Parsetree.constructor_arguments" - ("Pcstr_tuple", - [this#list (List.map this#lift_Parsetree_core_type x0)]) - | Parsetree.Pcstr_record x0 -> - this#constr "Ast_404.Parsetree.constructor_arguments" - ("Pcstr_record", - [this#list (List.map this#lift_Parsetree_label_declaration x0)]) : - Parsetree.constructor_arguments -> 'res) - method lift_Parsetree_label_declaration : - Parsetree.label_declaration -> 'res= - (fun - { Parsetree.pld_name = pld_name; - Parsetree.pld_mutable = pld_mutable; - Parsetree.pld_type = pld_type; Parsetree.pld_loc = pld_loc; - Parsetree.pld_attributes = pld_attributes } - -> - this#record "Ast_404.Parsetree.label_declaration" - [("pld_name", (this#lift_Asttypes_loc this#string pld_name)); - ("pld_mutable", (this#lift_Asttypes_mutable_flag pld_mutable)); - ("pld_type", (this#lift_Parsetree_core_type pld_type)); - ("pld_loc", (this#lift_Location_t pld_loc)); - ("pld_attributes", - (this#lift_Parsetree_attributes pld_attributes))] : Parsetree.label_declaration - -> - 'res) - method lift_Asttypes_mutable_flag : Asttypes.mutable_flag -> 'res= - (function - | Asttypes.Immutable -> - this#constr "Ast_404.Asttypes.mutable_flag" ("Immutable", []) - | Asttypes.Mutable -> - this#constr "Ast_404.Asttypes.mutable_flag" ("Mutable", []) : Asttypes.mutable_flag - -> - 'res) - method lift_Asttypes_variance : Asttypes.variance -> 'res= - (function - | Asttypes.Covariant -> - this#constr "Ast_404.Asttypes.variance" ("Covariant", []) - | Asttypes.Contravariant -> - this#constr "Ast_404.Asttypes.variance" ("Contravariant", []) - | Asttypes.Invariant -> - this#constr "Ast_404.Asttypes.variance" ("Invariant", []) : Asttypes.variance - -> 'res) - method lift_Parsetree_value_description : - Parsetree.value_description -> 'res= - (fun - { Parsetree.pval_name = pval_name; Parsetree.pval_type = pval_type; - Parsetree.pval_prim = pval_prim; - Parsetree.pval_attributes = pval_attributes; - Parsetree.pval_loc = pval_loc } - -> - this#record "Ast_404.Parsetree.value_description" - [("pval_name", (this#lift_Asttypes_loc this#string pval_name)); - ("pval_type", (this#lift_Parsetree_core_type pval_type)); - ("pval_prim", (this#list (List.map this#string pval_prim))); - ("pval_attributes", - (this#lift_Parsetree_attributes pval_attributes)); - ("pval_loc", (this#lift_Location_t pval_loc))] : Parsetree.value_description - -> 'res) - method lift_Asttypes_arg_label : Asttypes.arg_label -> 'res= - (function - | Asttypes.Nolabel -> - this#constr "Ast_404.Asttypes.arg_label" ("Nolabel", []) - | Asttypes.Labelled x0 -> - this#constr "Ast_404.Asttypes.arg_label" ("Labelled", [this#string x0]) - | Asttypes.Optional x0 -> - this#constr "Ast_404.Asttypes.arg_label" ("Optional", [this#string x0]) : - Asttypes.arg_label -> 'res) - method lift_Asttypes_closed_flag : Asttypes.closed_flag -> 'res= - (function - | Asttypes.Closed -> - this#constr "Ast_404.Asttypes.closed_flag" ("Closed", []) - | Asttypes.Open -> this#constr "Ast_404.Asttypes.closed_flag" ("Open", []) : - Asttypes.closed_flag -> 'res) - method lift_Asttypes_label : Asttypes.label -> 'res= - (this#string : Asttypes.label -> 'res) - method lift_Asttypes_rec_flag : Asttypes.rec_flag -> 'res= - (function - | Asttypes.Nonrecursive -> - this#constr "Ast_404.Asttypes.rec_flag" ("Nonrecursive", []) - | Asttypes.Recursive -> - this#constr "Ast_404.Asttypes.rec_flag" ("Recursive", []) : Asttypes.rec_flag - -> 'res) - method lift_Parsetree_constant : Parsetree.constant -> 'res= - (function - | Parsetree.Pconst_integer (x0,x1) -> - this#constr "Ast_404.Parsetree.constant" - ("Pconst_integer", - [this#string x0; this#lift_option this#char x1]) - | Parsetree.Pconst_char x0 -> - this#constr "Ast_404.Parsetree.constant" ("Pconst_char", [this#char x0]) - | Parsetree.Pconst_string (x0,x1) -> - this#constr "Ast_404.Parsetree.constant" - ("Pconst_string", - [this#string x0; this#lift_option this#string x1]) - | Parsetree.Pconst_float (x0,x1) -> - this#constr "Ast_404.Parsetree.constant" - ("Pconst_float", - [this#string x0; this#lift_option this#char x1]) : Parsetree.constant - -> - 'res) - method lift_option : 'f0 . ('f0 -> 'res) -> 'f0 option -> 'res= fun (type - f0) -> - (fun f0 -> - function - | None -> this#constr "option" ("None", []) - | Some x0 -> this#constr "option" ("Some", [f0 x0]) : (f0 -> 'res) - -> - f0 option -> - 'res) - method lift_Longident_t : Longident.t -> 'res= - (function - | Longident.Lident x0 -> - this#constr "Ast_404.Longident.t" ("Lident", [this#string x0]) - | Longident.Ldot (x0,x1) -> - this#constr "Ast_404.Longident.t" - ("Ldot", [this#lift_Longident_t x0; this#string x1]) - | Longident.Lapply (x0,x1) -> - this#constr "Ast_404.Longident.t" - ("Lapply", [this#lift_Longident_t x0; this#lift_Longident_t x1]) : - Longident.t -> 'res) - method lift_Asttypes_loc : - 'f0 . ('f0 -> 'res) -> 'f0 Asttypes.loc -> 'res= fun (type f0) -> - (fun f0 -> - fun { Asttypes.txt = txt; Asttypes.loc = loc } -> - this#record "Ast_404.Asttypes.loc" - [("txt", (f0 txt)); ("loc", (this#lift_Location_t loc))] : - (f0 -> 'res) -> f0 Asttypes.loc -> 'res) - method lift_Location_t : Location.t -> 'res= - (fun - { Location.loc_start = loc_start; Location.loc_end = loc_end; - Location.loc_ghost = loc_ghost } - -> - this#record "Ast_404.Location.t" - [("loc_start", (this#lift_Lexing_position loc_start)); - ("loc_end", (this#lift_Lexing_position loc_end)); - ("loc_ghost", (this#lift_bool loc_ghost))] : Location.t -> 'res) - method lift_bool : bool -> 'res= - (function - | false -> this#constr "bool" ("false", []) - | true -> this#constr "bool" ("true", []) : bool -> 'res) - method lift_Lexing_position : Lexing.position -> 'res= - (fun - { Lexing.pos_fname = pos_fname; Lexing.pos_lnum = pos_lnum; - Lexing.pos_bol = pos_bol; Lexing.pos_cnum = pos_cnum } - -> - this#record "Lexing.position" - [("pos_fname", (this#string pos_fname)); - ("pos_lnum", (this#int pos_lnum)); - ("pos_bol", (this#int pos_bol)); - ("pos_cnum", (this#int pos_cnum))] : Lexing.position -> 'res) - end diff --git a/ppx_tools_versioned.5.2/ast_lifter_405.ml b/ppx_tools_versioned.5.2/ast_lifter_405.ml deleted file mode 100644 index ad49f91..0000000 --- a/ppx_tools_versioned.5.2/ast_lifter_405.ml +++ /dev/null @@ -1,1393 +0,0 @@ -open Ast_405 - -class virtual ['res] lifter = - object (this) - method lift_Parsetree_expression : Parsetree.expression -> 'res= - (fun - { Parsetree.pexp_desc = pexp_desc; Parsetree.pexp_loc = pexp_loc; - Parsetree.pexp_attributes = pexp_attributes } - -> - this#record "Ast_405.Parsetree.expression" - [("pexp_desc", (this#lift_Parsetree_expression_desc pexp_desc)); - ("pexp_loc", (this#lift_Location_t pexp_loc)); - ("pexp_attributes", - (this#lift_Parsetree_attributes pexp_attributes))] : Parsetree.expression - -> - 'res) - method lift_Parsetree_expression_desc : - Parsetree.expression_desc -> 'res= - (function - | Parsetree.Pexp_ident x0 -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_ident", - [this#lift_Asttypes_loc this#lift_Longident_t x0]) - | Parsetree.Pexp_constant x0 -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_constant", [this#lift_Parsetree_constant x0]) - | Parsetree.Pexp_let (x0,x1,x2) -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_let", - [this#lift_Asttypes_rec_flag x0; - this#list (List.map this#lift_Parsetree_value_binding x1); - this#lift_Parsetree_expression x2]) - | Parsetree.Pexp_function x0 -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_function", - [this#list (List.map this#lift_Parsetree_case x0)]) - | Parsetree.Pexp_fun (x0,x1,x2,x3) -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_fun", - [this#lift_Asttypes_arg_label x0; - this#lift_option this#lift_Parsetree_expression x1; - this#lift_Parsetree_pattern x2; - this#lift_Parsetree_expression x3]) - | Parsetree.Pexp_apply (x0,x1) -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_apply", - [this#lift_Parsetree_expression x0; - this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_arg_label x0; - this#lift_Parsetree_expression x1]) x1)]) - | Parsetree.Pexp_match (x0,x1) -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_match", - [this#lift_Parsetree_expression x0; - this#list (List.map this#lift_Parsetree_case x1)]) - | Parsetree.Pexp_try (x0,x1) -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_try", - [this#lift_Parsetree_expression x0; - this#list (List.map this#lift_Parsetree_case x1)]) - | Parsetree.Pexp_tuple x0 -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_tuple", - [this#list (List.map this#lift_Parsetree_expression x0)]) - | Parsetree.Pexp_construct (x0,x1) -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_construct", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_option this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_variant (x0,x1) -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_variant", - [this#lift_Asttypes_label x0; - this#lift_option this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_record (x0,x1) -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_record", - [this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_Parsetree_expression x1]) x0); - this#lift_option this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_field (x0,x1) -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_field", - [this#lift_Parsetree_expression x0; - this#lift_Asttypes_loc this#lift_Longident_t x1]) - | Parsetree.Pexp_setfield (x0,x1,x2) -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_setfield", - [this#lift_Parsetree_expression x0; - this#lift_Asttypes_loc this#lift_Longident_t x1; - this#lift_Parsetree_expression x2]) - | Parsetree.Pexp_array x0 -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_array", - [this#list (List.map this#lift_Parsetree_expression x0)]) - | Parsetree.Pexp_ifthenelse (x0,x1,x2) -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_ifthenelse", - [this#lift_Parsetree_expression x0; - this#lift_Parsetree_expression x1; - this#lift_option this#lift_Parsetree_expression x2]) - | Parsetree.Pexp_sequence (x0,x1) -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_sequence", - [this#lift_Parsetree_expression x0; - this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_while (x0,x1) -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_while", - [this#lift_Parsetree_expression x0; - this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_for (x0,x1,x2,x3,x4) -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_for", - [this#lift_Parsetree_pattern x0; - this#lift_Parsetree_expression x1; - this#lift_Parsetree_expression x2; - this#lift_Asttypes_direction_flag x3; - this#lift_Parsetree_expression x4]) - | Parsetree.Pexp_constraint (x0,x1) -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_constraint", - [this#lift_Parsetree_expression x0; - this#lift_Parsetree_core_type x1]) - | Parsetree.Pexp_coerce (x0,x1,x2) -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_coerce", - [this#lift_Parsetree_expression x0; - this#lift_option this#lift_Parsetree_core_type x1; - this#lift_Parsetree_core_type x2]) - | Parsetree.Pexp_send (x0,x1) -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_send", - [this#lift_Parsetree_expression x0; - this#lift_Asttypes_loc this#string x1]) - | Parsetree.Pexp_new x0 -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_new", [this#lift_Asttypes_loc this#lift_Longident_t x0]) - | Parsetree.Pexp_setinstvar (x0,x1) -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_setinstvar", - [this#lift_Asttypes_loc this#string x0; - this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_override x0 -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_override", - [this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_loc this#string x0; - this#lift_Parsetree_expression x1]) x0)]) - | Parsetree.Pexp_letmodule (x0,x1,x2) -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_letmodule", - [this#lift_Asttypes_loc this#string x0; - this#lift_Parsetree_module_expr x1; - this#lift_Parsetree_expression x2]) - | Parsetree.Pexp_letexception (x0,x1) -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_letexception", - [this#lift_Parsetree_extension_constructor x0; - this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_assert x0 -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_assert", [this#lift_Parsetree_expression x0]) - | Parsetree.Pexp_lazy x0 -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_lazy", [this#lift_Parsetree_expression x0]) - | Parsetree.Pexp_poly (x0,x1) -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_poly", - [this#lift_Parsetree_expression x0; - this#lift_option this#lift_Parsetree_core_type x1]) - | Parsetree.Pexp_object x0 -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_object", [this#lift_Parsetree_class_structure x0]) - | Parsetree.Pexp_newtype (x0,x1) -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_newtype", - [this#lift_Asttypes_loc this#string x0; - this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_pack x0 -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_pack", [this#lift_Parsetree_module_expr x0]) - | Parsetree.Pexp_open (x0,x1,x2) -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_open", - [this#lift_Asttypes_override_flag x0; - this#lift_Asttypes_loc this#lift_Longident_t x1; - this#lift_Parsetree_expression x2]) - | Parsetree.Pexp_extension x0 -> - this#constr "Ast_405.Parsetree.expression_desc" - ("Pexp_extension", [this#lift_Parsetree_extension x0]) - | Parsetree.Pexp_unreachable -> - this#constr "Ast_405.Parsetree.expression_desc" ("Pexp_unreachable", []) : - Parsetree.expression_desc -> 'res) - method lift_Asttypes_direction_flag : Asttypes.direction_flag -> 'res= - (function - | Asttypes.Upto -> this#constr "Ast_405.Asttypes.direction_flag" ("Upto", []) - | Asttypes.Downto -> - this#constr "Ast_405.Asttypes.direction_flag" ("Downto", []) : Asttypes.direction_flag - -> - 'res) - method lift_Parsetree_case : Parsetree.case -> 'res= - (fun - { Parsetree.pc_lhs = pc_lhs; Parsetree.pc_guard = pc_guard; - Parsetree.pc_rhs = pc_rhs } - -> - this#record "Ast_405.Parsetree.case" - [("pc_lhs", (this#lift_Parsetree_pattern pc_lhs)); - ("pc_guard", - (this#lift_option this#lift_Parsetree_expression pc_guard)); - ("pc_rhs", (this#lift_Parsetree_expression pc_rhs))] : Parsetree.case - -> - 'res) - method lift_Parsetree_value_binding : Parsetree.value_binding -> 'res= - (fun - { Parsetree.pvb_pat = pvb_pat; Parsetree.pvb_expr = pvb_expr; - Parsetree.pvb_attributes = pvb_attributes; - Parsetree.pvb_loc = pvb_loc } - -> - this#record "Ast_405.Parsetree.value_binding" - [("pvb_pat", (this#lift_Parsetree_pattern pvb_pat)); - ("pvb_expr", (this#lift_Parsetree_expression pvb_expr)); - ("pvb_attributes", - (this#lift_Parsetree_attributes pvb_attributes)); - ("pvb_loc", (this#lift_Location_t pvb_loc))] : Parsetree.value_binding - -> 'res) - method lift_Parsetree_pattern : Parsetree.pattern -> 'res= - (fun - { Parsetree.ppat_desc = ppat_desc; Parsetree.ppat_loc = ppat_loc; - Parsetree.ppat_attributes = ppat_attributes } - -> - this#record "Ast_405.Parsetree.pattern" - [("ppat_desc", (this#lift_Parsetree_pattern_desc ppat_desc)); - ("ppat_loc", (this#lift_Location_t ppat_loc)); - ("ppat_attributes", - (this#lift_Parsetree_attributes ppat_attributes))] : Parsetree.pattern - -> - 'res) - method lift_Parsetree_pattern_desc : Parsetree.pattern_desc -> 'res= - (function - | Parsetree.Ppat_any -> - this#constr "Ast_405.Parsetree.pattern_desc" ("Ppat_any", []) - | Parsetree.Ppat_var x0 -> - this#constr "Ast_405.Parsetree.pattern_desc" - ("Ppat_var", [this#lift_Asttypes_loc this#string x0]) - | Parsetree.Ppat_alias (x0,x1) -> - this#constr "Ast_405.Parsetree.pattern_desc" - ("Ppat_alias", - [this#lift_Parsetree_pattern x0; - this#lift_Asttypes_loc this#string x1]) - | Parsetree.Ppat_constant x0 -> - this#constr "Ast_405.Parsetree.pattern_desc" - ("Ppat_constant", [this#lift_Parsetree_constant x0]) - | Parsetree.Ppat_interval (x0,x1) -> - this#constr "Ast_405.Parsetree.pattern_desc" - ("Ppat_interval", - [this#lift_Parsetree_constant x0; - this#lift_Parsetree_constant x1]) - | Parsetree.Ppat_tuple x0 -> - this#constr "Ast_405.Parsetree.pattern_desc" - ("Ppat_tuple", - [this#list (List.map this#lift_Parsetree_pattern x0)]) - | Parsetree.Ppat_construct (x0,x1) -> - this#constr "Ast_405.Parsetree.pattern_desc" - ("Ppat_construct", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_option this#lift_Parsetree_pattern x1]) - | Parsetree.Ppat_variant (x0,x1) -> - this#constr "Ast_405.Parsetree.pattern_desc" - ("Ppat_variant", - [this#lift_Asttypes_label x0; - this#lift_option this#lift_Parsetree_pattern x1]) - | Parsetree.Ppat_record (x0,x1) -> - this#constr "Ast_405.Parsetree.pattern_desc" - ("Ppat_record", - [this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_Parsetree_pattern x1]) x0); - this#lift_Asttypes_closed_flag x1]) - | Parsetree.Ppat_array x0 -> - this#constr "Ast_405.Parsetree.pattern_desc" - ("Ppat_array", - [this#list (List.map this#lift_Parsetree_pattern x0)]) - | Parsetree.Ppat_or (x0,x1) -> - this#constr "Ast_405.Parsetree.pattern_desc" - ("Ppat_or", - [this#lift_Parsetree_pattern x0; - this#lift_Parsetree_pattern x1]) - | Parsetree.Ppat_constraint (x0,x1) -> - this#constr "Ast_405.Parsetree.pattern_desc" - ("Ppat_constraint", - [this#lift_Parsetree_pattern x0; - this#lift_Parsetree_core_type x1]) - | Parsetree.Ppat_type x0 -> - this#constr "Ast_405.Parsetree.pattern_desc" - ("Ppat_type", [this#lift_Asttypes_loc this#lift_Longident_t x0]) - | Parsetree.Ppat_lazy x0 -> - this#constr "Ast_405.Parsetree.pattern_desc" - ("Ppat_lazy", [this#lift_Parsetree_pattern x0]) - | Parsetree.Ppat_unpack x0 -> - this#constr "Ast_405.Parsetree.pattern_desc" - ("Ppat_unpack", [this#lift_Asttypes_loc this#string x0]) - | Parsetree.Ppat_exception x0 -> - this#constr "Ast_405.Parsetree.pattern_desc" - ("Ppat_exception", [this#lift_Parsetree_pattern x0]) - | Parsetree.Ppat_extension x0 -> - this#constr "Ast_405.Parsetree.pattern_desc" - ("Ppat_extension", [this#lift_Parsetree_extension x0]) - | Parsetree.Ppat_open (x0,x1) -> - this#constr "Ast_405.Parsetree.pattern_desc" - ("Ppat_open", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_Parsetree_pattern x1]) : Parsetree.pattern_desc -> - 'res) - method lift_Parsetree_core_type : Parsetree.core_type -> 'res= - (fun - { Parsetree.ptyp_desc = ptyp_desc; Parsetree.ptyp_loc = ptyp_loc; - Parsetree.ptyp_attributes = ptyp_attributes } - -> - this#record "Ast_405.Parsetree.core_type" - [("ptyp_desc", (this#lift_Parsetree_core_type_desc ptyp_desc)); - ("ptyp_loc", (this#lift_Location_t ptyp_loc)); - ("ptyp_attributes", - (this#lift_Parsetree_attributes ptyp_attributes))] : Parsetree.core_type - -> - 'res) - method lift_Parsetree_core_type_desc : Parsetree.core_type_desc -> 'res= - (function - | Parsetree.Ptyp_any -> - this#constr "Ast_405.Parsetree.core_type_desc" ("Ptyp_any", []) - | Parsetree.Ptyp_var x0 -> - this#constr "Ast_405.Parsetree.core_type_desc" - ("Ptyp_var", [this#string x0]) - | Parsetree.Ptyp_arrow (x0,x1,x2) -> - this#constr "Ast_405.Parsetree.core_type_desc" - ("Ptyp_arrow", - [this#lift_Asttypes_arg_label x0; - this#lift_Parsetree_core_type x1; - this#lift_Parsetree_core_type x2]) - | Parsetree.Ptyp_tuple x0 -> - this#constr "Ast_405.Parsetree.core_type_desc" - ("Ptyp_tuple", - [this#list (List.map this#lift_Parsetree_core_type x0)]) - | Parsetree.Ptyp_constr (x0,x1) -> - this#constr "Ast_405.Parsetree.core_type_desc" - ("Ptyp_constr", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#list (List.map this#lift_Parsetree_core_type x1)]) - | Parsetree.Ptyp_object (x0,x1) -> - this#constr "Ast_405.Parsetree.core_type_desc" - ("Ptyp_object", - [this#list - (List.map - (fun x -> - let (x0,x1,x2) = x in - this#tuple - [this#lift_Asttypes_loc this#string x0; - this#lift_Parsetree_attributes x1; - this#lift_Parsetree_core_type x2]) x0); - this#lift_Asttypes_closed_flag x1]) - | Parsetree.Ptyp_class (x0,x1) -> - this#constr "Ast_405.Parsetree.core_type_desc" - ("Ptyp_class", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#list (List.map this#lift_Parsetree_core_type x1)]) - | Parsetree.Ptyp_alias (x0,x1) -> - this#constr "Ast_405.Parsetree.core_type_desc" - ("Ptyp_alias", - [this#lift_Parsetree_core_type x0; this#string x1]) - | Parsetree.Ptyp_variant (x0,x1,x2) -> - this#constr "Ast_405.Parsetree.core_type_desc" - ("Ptyp_variant", - [this#list (List.map this#lift_Parsetree_row_field x0); - this#lift_Asttypes_closed_flag x1; - this#lift_option - (fun x -> this#list (List.map this#lift_Asttypes_label x)) - x2]) - | Parsetree.Ptyp_poly (x0,x1) -> - this#constr "Ast_405.Parsetree.core_type_desc" - ("Ptyp_poly", - [this#list - (List.map (fun x -> this#lift_Asttypes_loc this#string x) - x0); - this#lift_Parsetree_core_type x1]) - | Parsetree.Ptyp_package x0 -> - this#constr "Ast_405.Parsetree.core_type_desc" - ("Ptyp_package", [this#lift_Parsetree_package_type x0]) - | Parsetree.Ptyp_extension x0 -> - this#constr "Ast_405.Parsetree.core_type_desc" - ("Ptyp_extension", [this#lift_Parsetree_extension x0]) : - Parsetree.core_type_desc -> 'res) - method lift_Parsetree_package_type : Parsetree.package_type -> 'res= - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_Parsetree_core_type x1]) x1)] : Parsetree.package_type - -> 'res) - method lift_Parsetree_row_field : Parsetree.row_field -> 'res= - (function - | Parsetree.Rtag (x0,x1,x2,x3) -> - this#constr "Ast_405.Parsetree.row_field" - ("Rtag", - [this#lift_Asttypes_label x0; - this#lift_Parsetree_attributes x1; - this#lift_bool x2; - this#list (List.map this#lift_Parsetree_core_type x3)]) - | Parsetree.Rinherit x0 -> - this#constr "Ast_405.Parsetree.row_field" - ("Rinherit", [this#lift_Parsetree_core_type x0]) : Parsetree.row_field - -> - 'res) - method lift_Parsetree_attributes : Parsetree.attributes -> 'res= - (fun x -> this#list (List.map this#lift_Parsetree_attribute x) : - Parsetree.attributes -> 'res) - method lift_Parsetree_attribute : Parsetree.attribute -> 'res= - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_loc this#string x0; - this#lift_Parsetree_payload x1] : Parsetree.attribute -> 'res) - method lift_Parsetree_payload : Parsetree.payload -> 'res= - (function - | Parsetree.PStr x0 -> - this#constr "Ast_405.Parsetree.payload" - ("PStr", [this#lift_Parsetree_structure x0]) - | Parsetree.PSig x0 -> - this#constr "Ast_405.Parsetree.payload" - ("PSig", [this#lift_Parsetree_signature x0]) - | Parsetree.PTyp x0 -> - this#constr "Ast_405.Parsetree.payload" - ("PTyp", [this#lift_Parsetree_core_type x0]) - | Parsetree.PPat (x0,x1) -> - this#constr "Ast_405.Parsetree.payload" - ("PPat", - [this#lift_Parsetree_pattern x0; - this#lift_option this#lift_Parsetree_expression x1]) : - Parsetree.payload -> 'res) - method lift_Parsetree_structure : Parsetree.structure -> 'res= - (fun x -> this#list (List.map this#lift_Parsetree_structure_item x) : - Parsetree.structure -> 'res) - method lift_Parsetree_structure_item : Parsetree.structure_item -> 'res= - (fun { Parsetree.pstr_desc = pstr_desc; Parsetree.pstr_loc = pstr_loc } - -> - this#record "Ast_405.Parsetree.structure_item" - [("pstr_desc", - (this#lift_Parsetree_structure_item_desc pstr_desc)); - ("pstr_loc", (this#lift_Location_t pstr_loc))] : Parsetree.structure_item - -> 'res) - method lift_Parsetree_structure_item_desc : - Parsetree.structure_item_desc -> 'res= - (function - | Parsetree.Pstr_eval (x0,x1) -> - this#constr "Ast_405.Parsetree.structure_item_desc" - ("Pstr_eval", - [this#lift_Parsetree_expression x0; - this#lift_Parsetree_attributes x1]) - | Parsetree.Pstr_value (x0,x1) -> - this#constr "Ast_405.Parsetree.structure_item_desc" - ("Pstr_value", - [this#lift_Asttypes_rec_flag x0; - this#list (List.map this#lift_Parsetree_value_binding x1)]) - | Parsetree.Pstr_primitive x0 -> - this#constr "Ast_405.Parsetree.structure_item_desc" - ("Pstr_primitive", [this#lift_Parsetree_value_description x0]) - | Parsetree.Pstr_type (x0,x1) -> - this#constr "Ast_405.Parsetree.structure_item_desc" - ("Pstr_type", - [this#lift_Asttypes_rec_flag x0; - this#list (List.map this#lift_Parsetree_type_declaration x1)]) - | Parsetree.Pstr_typext x0 -> - this#constr "Ast_405.Parsetree.structure_item_desc" - ("Pstr_typext", [this#lift_Parsetree_type_extension x0]) - | Parsetree.Pstr_exception x0 -> - this#constr "Ast_405.Parsetree.structure_item_desc" - ("Pstr_exception", - [this#lift_Parsetree_extension_constructor x0]) - | Parsetree.Pstr_module x0 -> - this#constr "Ast_405.Parsetree.structure_item_desc" - ("Pstr_module", [this#lift_Parsetree_module_binding x0]) - | Parsetree.Pstr_recmodule x0 -> - this#constr "Ast_405.Parsetree.structure_item_desc" - ("Pstr_recmodule", - [this#list (List.map this#lift_Parsetree_module_binding x0)]) - | Parsetree.Pstr_modtype x0 -> - this#constr "Ast_405.Parsetree.structure_item_desc" - ("Pstr_modtype", - [this#lift_Parsetree_module_type_declaration x0]) - | Parsetree.Pstr_open x0 -> - this#constr "Ast_405.Parsetree.structure_item_desc" - ("Pstr_open", [this#lift_Parsetree_open_description x0]) - | Parsetree.Pstr_class x0 -> - this#constr "Ast_405.Parsetree.structure_item_desc" - ("Pstr_class", - [this#list (List.map this#lift_Parsetree_class_declaration x0)]) - | Parsetree.Pstr_class_type x0 -> - this#constr "Ast_405.Parsetree.structure_item_desc" - ("Pstr_class_type", - [this#list - (List.map this#lift_Parsetree_class_type_declaration x0)]) - | Parsetree.Pstr_include x0 -> - this#constr "Ast_405.Parsetree.structure_item_desc" - ("Pstr_include", [this#lift_Parsetree_include_declaration x0]) - | Parsetree.Pstr_attribute x0 -> - this#constr "Ast_405.Parsetree.structure_item_desc" - ("Pstr_attribute", [this#lift_Parsetree_attribute x0]) - | Parsetree.Pstr_extension (x0,x1) -> - this#constr "Ast_405.Parsetree.structure_item_desc" - ("Pstr_extension", - [this#lift_Parsetree_extension x0; - this#lift_Parsetree_attributes x1]) : Parsetree.structure_item_desc - -> 'res) - method lift_Parsetree_include_declaration : - Parsetree.include_declaration -> 'res= - (fun x -> - this#lift_Parsetree_include_infos this#lift_Parsetree_module_expr x : - Parsetree.include_declaration -> 'res) - method lift_Parsetree_class_declaration : - Parsetree.class_declaration -> 'res= - (fun x -> - this#lift_Parsetree_class_infos this#lift_Parsetree_class_expr x : - Parsetree.class_declaration -> 'res) - method lift_Parsetree_class_expr : Parsetree.class_expr -> 'res= - (fun - { Parsetree.pcl_desc = pcl_desc; Parsetree.pcl_loc = pcl_loc; - Parsetree.pcl_attributes = pcl_attributes } - -> - this#record "Ast_405.Parsetree.class_expr" - [("pcl_desc", (this#lift_Parsetree_class_expr_desc pcl_desc)); - ("pcl_loc", (this#lift_Location_t pcl_loc)); - ("pcl_attributes", - (this#lift_Parsetree_attributes pcl_attributes))] : Parsetree.class_expr - -> - 'res) - method lift_Parsetree_class_expr_desc : - Parsetree.class_expr_desc -> 'res= - (function - | Parsetree.Pcl_constr (x0,x1) -> - this#constr "Ast_405.Parsetree.class_expr_desc" - ("Pcl_constr", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#list (List.map this#lift_Parsetree_core_type x1)]) - | Parsetree.Pcl_structure x0 -> - this#constr "Ast_405.Parsetree.class_expr_desc" - ("Pcl_structure", [this#lift_Parsetree_class_structure x0]) - | Parsetree.Pcl_fun (x0,x1,x2,x3) -> - this#constr "Ast_405.Parsetree.class_expr_desc" - ("Pcl_fun", - [this#lift_Asttypes_arg_label x0; - this#lift_option this#lift_Parsetree_expression x1; - this#lift_Parsetree_pattern x2; - this#lift_Parsetree_class_expr x3]) - | Parsetree.Pcl_apply (x0,x1) -> - this#constr "Ast_405.Parsetree.class_expr_desc" - ("Pcl_apply", - [this#lift_Parsetree_class_expr x0; - this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_arg_label x0; - this#lift_Parsetree_expression x1]) x1)]) - | Parsetree.Pcl_let (x0,x1,x2) -> - this#constr "Ast_405.Parsetree.class_expr_desc" - ("Pcl_let", - [this#lift_Asttypes_rec_flag x0; - this#list (List.map this#lift_Parsetree_value_binding x1); - this#lift_Parsetree_class_expr x2]) - | Parsetree.Pcl_constraint (x0,x1) -> - this#constr "Ast_405.Parsetree.class_expr_desc" - ("Pcl_constraint", - [this#lift_Parsetree_class_expr x0; - this#lift_Parsetree_class_type x1]) - | Parsetree.Pcl_extension x0 -> - this#constr "Ast_405.Parsetree.class_expr_desc" - ("Pcl_extension", [this#lift_Parsetree_extension x0]) : - Parsetree.class_expr_desc -> 'res) - method lift_Parsetree_class_structure : - Parsetree.class_structure -> 'res= - (fun - { Parsetree.pcstr_self = pcstr_self; - Parsetree.pcstr_fields = pcstr_fields } - -> - this#record "Ast_405.Parsetree.class_structure" - [("pcstr_self", (this#lift_Parsetree_pattern pcstr_self)); - ("pcstr_fields", - (this#list - (List.map this#lift_Parsetree_class_field pcstr_fields)))] : - Parsetree.class_structure -> 'res) - method lift_Parsetree_class_field : Parsetree.class_field -> 'res= - (fun - { Parsetree.pcf_desc = pcf_desc; Parsetree.pcf_loc = pcf_loc; - Parsetree.pcf_attributes = pcf_attributes } - -> - this#record "Ast_405.Parsetree.class_field" - [("pcf_desc", (this#lift_Parsetree_class_field_desc pcf_desc)); - ("pcf_loc", (this#lift_Location_t pcf_loc)); - ("pcf_attributes", - (this#lift_Parsetree_attributes pcf_attributes))] : Parsetree.class_field - -> - 'res) - method lift_Parsetree_class_field_desc : - Parsetree.class_field_desc -> 'res= - (function - | Parsetree.Pcf_inherit (x0,x1,x2) -> - this#constr "Ast_405.Parsetree.class_field_desc" - ("Pcf_inherit", - [this#lift_Asttypes_override_flag x0; - this#lift_Parsetree_class_expr x1; - this#lift_option - (fun x -> this#lift_Asttypes_loc this#string x) x2]) - | Parsetree.Pcf_val x0 -> - this#constr "Ast_405.Parsetree.class_field_desc" - ("Pcf_val", - [(let (x0,x1,x2) = x0 in - this#tuple - [this#lift_Asttypes_loc this#string x0; - this#lift_Asttypes_mutable_flag x1; - this#lift_Parsetree_class_field_kind x2])]) - | Parsetree.Pcf_method x0 -> - this#constr "Ast_405.Parsetree.class_field_desc" - ("Pcf_method", - [(let (x0,x1,x2) = x0 in - this#tuple - [this#lift_Asttypes_loc this#string x0; - this#lift_Asttypes_private_flag x1; - this#lift_Parsetree_class_field_kind x2])]) - | Parsetree.Pcf_constraint x0 -> - this#constr "Ast_405.Parsetree.class_field_desc" - ("Pcf_constraint", - [(let (x0,x1) = x0 in - this#tuple - [this#lift_Parsetree_core_type x0; - this#lift_Parsetree_core_type x1])]) - | Parsetree.Pcf_initializer x0 -> - this#constr "Ast_405.Parsetree.class_field_desc" - ("Pcf_initializer", [this#lift_Parsetree_expression x0]) - | Parsetree.Pcf_attribute x0 -> - this#constr "Ast_405.Parsetree.class_field_desc" - ("Pcf_attribute", [this#lift_Parsetree_attribute x0]) - | Parsetree.Pcf_extension x0 -> - this#constr "Ast_405.Parsetree.class_field_desc" - ("Pcf_extension", [this#lift_Parsetree_extension x0]) : - Parsetree.class_field_desc -> 'res) - method lift_Parsetree_class_field_kind : - Parsetree.class_field_kind -> 'res= - (function - | Parsetree.Cfk_virtual x0 -> - this#constr "Ast_405.Parsetree.class_field_kind" - ("Cfk_virtual", [this#lift_Parsetree_core_type x0]) - | Parsetree.Cfk_concrete (x0,x1) -> - this#constr "Ast_405.Parsetree.class_field_kind" - ("Cfk_concrete", - [this#lift_Asttypes_override_flag x0; - this#lift_Parsetree_expression x1]) : Parsetree.class_field_kind - -> 'res) - method lift_Parsetree_module_binding : Parsetree.module_binding -> 'res= - (fun - { Parsetree.pmb_name = pmb_name; Parsetree.pmb_expr = pmb_expr; - Parsetree.pmb_attributes = pmb_attributes; - Parsetree.pmb_loc = pmb_loc } - -> - this#record "Ast_405.Parsetree.module_binding" - [("pmb_name", (this#lift_Asttypes_loc this#string pmb_name)); - ("pmb_expr", (this#lift_Parsetree_module_expr pmb_expr)); - ("pmb_attributes", - (this#lift_Parsetree_attributes pmb_attributes)); - ("pmb_loc", (this#lift_Location_t pmb_loc))] : Parsetree.module_binding - -> 'res) - method lift_Parsetree_module_expr : Parsetree.module_expr -> 'res= - (fun - { Parsetree.pmod_desc = pmod_desc; Parsetree.pmod_loc = pmod_loc; - Parsetree.pmod_attributes = pmod_attributes } - -> - this#record "Ast_405.Parsetree.module_expr" - [("pmod_desc", (this#lift_Parsetree_module_expr_desc pmod_desc)); - ("pmod_loc", (this#lift_Location_t pmod_loc)); - ("pmod_attributes", - (this#lift_Parsetree_attributes pmod_attributes))] : Parsetree.module_expr - -> - 'res) - method lift_Parsetree_module_expr_desc : - Parsetree.module_expr_desc -> 'res= - (function - | Parsetree.Pmod_ident x0 -> - this#constr "Ast_405.Parsetree.module_expr_desc" - ("Pmod_ident", - [this#lift_Asttypes_loc this#lift_Longident_t x0]) - | Parsetree.Pmod_structure x0 -> - this#constr "Ast_405.Parsetree.module_expr_desc" - ("Pmod_structure", [this#lift_Parsetree_structure x0]) - | Parsetree.Pmod_functor (x0,x1,x2) -> - this#constr "Ast_405.Parsetree.module_expr_desc" - ("Pmod_functor", - [this#lift_Asttypes_loc this#string x0; - this#lift_option this#lift_Parsetree_module_type x1; - this#lift_Parsetree_module_expr x2]) - | Parsetree.Pmod_apply (x0,x1) -> - this#constr "Ast_405.Parsetree.module_expr_desc" - ("Pmod_apply", - [this#lift_Parsetree_module_expr x0; - this#lift_Parsetree_module_expr x1]) - | Parsetree.Pmod_constraint (x0,x1) -> - this#constr "Ast_405.Parsetree.module_expr_desc" - ("Pmod_constraint", - [this#lift_Parsetree_module_expr x0; - this#lift_Parsetree_module_type x1]) - | Parsetree.Pmod_unpack x0 -> - this#constr "Ast_405.Parsetree.module_expr_desc" - ("Pmod_unpack", [this#lift_Parsetree_expression x0]) - | Parsetree.Pmod_extension x0 -> - this#constr "Ast_405.Parsetree.module_expr_desc" - ("Pmod_extension", [this#lift_Parsetree_extension x0]) : - Parsetree.module_expr_desc -> 'res) - method lift_Parsetree_module_type : Parsetree.module_type -> 'res= - (fun - { Parsetree.pmty_desc = pmty_desc; Parsetree.pmty_loc = pmty_loc; - Parsetree.pmty_attributes = pmty_attributes } - -> - this#record "Ast_405.Parsetree.module_type" - [("pmty_desc", (this#lift_Parsetree_module_type_desc pmty_desc)); - ("pmty_loc", (this#lift_Location_t pmty_loc)); - ("pmty_attributes", - (this#lift_Parsetree_attributes pmty_attributes))] : Parsetree.module_type - -> - 'res) - method lift_Parsetree_module_type_desc : - Parsetree.module_type_desc -> 'res= - (function - | Parsetree.Pmty_ident x0 -> - this#constr "Ast_405.Parsetree.module_type_desc" - ("Pmty_ident", - [this#lift_Asttypes_loc this#lift_Longident_t x0]) - | Parsetree.Pmty_signature x0 -> - this#constr "Ast_405.Parsetree.module_type_desc" - ("Pmty_signature", [this#lift_Parsetree_signature x0]) - | Parsetree.Pmty_functor (x0,x1,x2) -> - this#constr "Ast_405.Parsetree.module_type_desc" - ("Pmty_functor", - [this#lift_Asttypes_loc this#string x0; - this#lift_option this#lift_Parsetree_module_type x1; - this#lift_Parsetree_module_type x2]) - | Parsetree.Pmty_with (x0,x1) -> - this#constr "Ast_405.Parsetree.module_type_desc" - ("Pmty_with", - [this#lift_Parsetree_module_type x0; - this#list (List.map this#lift_Parsetree_with_constraint x1)]) - | Parsetree.Pmty_typeof x0 -> - this#constr "Ast_405.Parsetree.module_type_desc" - ("Pmty_typeof", [this#lift_Parsetree_module_expr x0]) - | Parsetree.Pmty_extension x0 -> - this#constr "Ast_405.Parsetree.module_type_desc" - ("Pmty_extension", [this#lift_Parsetree_extension x0]) - | Parsetree.Pmty_alias x0 -> - this#constr "Ast_405.Parsetree.module_type_desc" - ("Pmty_alias", - [this#lift_Asttypes_loc this#lift_Longident_t x0]) : Parsetree.module_type_desc - -> - 'res) - method lift_Parsetree_with_constraint : - Parsetree.with_constraint -> 'res= - (function - | Parsetree.Pwith_type (x0,x1) -> - this#constr "Ast_405.Parsetree.with_constraint" - ("Pwith_type", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_Parsetree_type_declaration x1]) - | Parsetree.Pwith_module (x0,x1) -> - this#constr "Ast_405.Parsetree.with_constraint" - ("Pwith_module", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_Asttypes_loc this#lift_Longident_t x1]) - | Parsetree.Pwith_typesubst x0 -> - this#constr "Ast_405.Parsetree.with_constraint" - ("Pwith_typesubst", [this#lift_Parsetree_type_declaration x0]) - | Parsetree.Pwith_modsubst (x0,x1) -> - this#constr "Ast_405.Parsetree.with_constraint" - ("Pwith_modsubst", - [this#lift_Asttypes_loc this#string x0; - this#lift_Asttypes_loc this#lift_Longident_t x1]) : Parsetree.with_constraint - -> - 'res) - method lift_Parsetree_signature : Parsetree.signature -> 'res= - (fun x -> this#list (List.map this#lift_Parsetree_signature_item x) : - Parsetree.signature -> 'res) - method lift_Parsetree_signature_item : Parsetree.signature_item -> 'res= - (fun { Parsetree.psig_desc = psig_desc; Parsetree.psig_loc = psig_loc } - -> - this#record "Ast_405.Parsetree.signature_item" - [("psig_desc", - (this#lift_Parsetree_signature_item_desc psig_desc)); - ("psig_loc", (this#lift_Location_t psig_loc))] : Parsetree.signature_item - -> 'res) - method lift_Parsetree_signature_item_desc : - Parsetree.signature_item_desc -> 'res= - (function - | Parsetree.Psig_value x0 -> - this#constr "Ast_405.Parsetree.signature_item_desc" - ("Psig_value", [this#lift_Parsetree_value_description x0]) - | Parsetree.Psig_type (x0,x1) -> - this#constr "Ast_405.Parsetree.signature_item_desc" - ("Psig_type", - [this#lift_Asttypes_rec_flag x0; - this#list (List.map this#lift_Parsetree_type_declaration x1)]) - | Parsetree.Psig_typext x0 -> - this#constr "Ast_405.Parsetree.signature_item_desc" - ("Psig_typext", [this#lift_Parsetree_type_extension x0]) - | Parsetree.Psig_exception x0 -> - this#constr "Ast_405.Parsetree.signature_item_desc" - ("Psig_exception", - [this#lift_Parsetree_extension_constructor x0]) - | Parsetree.Psig_module x0 -> - this#constr "Ast_405.Parsetree.signature_item_desc" - ("Psig_module", [this#lift_Parsetree_module_declaration x0]) - | Parsetree.Psig_recmodule x0 -> - this#constr "Ast_405.Parsetree.signature_item_desc" - ("Psig_recmodule", - [this#list - (List.map this#lift_Parsetree_module_declaration x0)]) - | Parsetree.Psig_modtype x0 -> - this#constr "Ast_405.Parsetree.signature_item_desc" - ("Psig_modtype", - [this#lift_Parsetree_module_type_declaration x0]) - | Parsetree.Psig_open x0 -> - this#constr "Ast_405.Parsetree.signature_item_desc" - ("Psig_open", [this#lift_Parsetree_open_description x0]) - | Parsetree.Psig_include x0 -> - this#constr "Ast_405.Parsetree.signature_item_desc" - ("Psig_include", [this#lift_Parsetree_include_description x0]) - | Parsetree.Psig_class x0 -> - this#constr "Ast_405.Parsetree.signature_item_desc" - ("Psig_class", - [this#list (List.map this#lift_Parsetree_class_description x0)]) - | Parsetree.Psig_class_type x0 -> - this#constr "Ast_405.Parsetree.signature_item_desc" - ("Psig_class_type", - [this#list - (List.map this#lift_Parsetree_class_type_declaration x0)]) - | Parsetree.Psig_attribute x0 -> - this#constr "Ast_405.Parsetree.signature_item_desc" - ("Psig_attribute", [this#lift_Parsetree_attribute x0]) - | Parsetree.Psig_extension (x0,x1) -> - this#constr "Ast_405.Parsetree.signature_item_desc" - ("Psig_extension", - [this#lift_Parsetree_extension x0; - this#lift_Parsetree_attributes x1]) : Parsetree.signature_item_desc - -> 'res) - method lift_Parsetree_class_type_declaration : - Parsetree.class_type_declaration -> 'res= - (fun x -> - this#lift_Parsetree_class_infos this#lift_Parsetree_class_type x : - Parsetree.class_type_declaration -> 'res) - method lift_Parsetree_class_description : - Parsetree.class_description -> 'res= - (fun x -> - this#lift_Parsetree_class_infos this#lift_Parsetree_class_type x : - Parsetree.class_description -> 'res) - method lift_Parsetree_class_type : Parsetree.class_type -> 'res= - (fun - { Parsetree.pcty_desc = pcty_desc; Parsetree.pcty_loc = pcty_loc; - Parsetree.pcty_attributes = pcty_attributes } - -> - this#record "Ast_405.Parsetree.class_type" - [("pcty_desc", (this#lift_Parsetree_class_type_desc pcty_desc)); - ("pcty_loc", (this#lift_Location_t pcty_loc)); - ("pcty_attributes", - (this#lift_Parsetree_attributes pcty_attributes))] : Parsetree.class_type - -> - 'res) - method lift_Parsetree_class_type_desc : - Parsetree.class_type_desc -> 'res= - (function - | Parsetree.Pcty_constr (x0,x1) -> - this#constr "Ast_405.Parsetree.class_type_desc" - ("Pcty_constr", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#list (List.map this#lift_Parsetree_core_type x1)]) - | Parsetree.Pcty_signature x0 -> - this#constr "Ast_405.Parsetree.class_type_desc" - ("Pcty_signature", [this#lift_Parsetree_class_signature x0]) - | Parsetree.Pcty_arrow (x0,x1,x2) -> - this#constr "Ast_405.Parsetree.class_type_desc" - ("Pcty_arrow", - [this#lift_Asttypes_arg_label x0; - this#lift_Parsetree_core_type x1; - this#lift_Parsetree_class_type x2]) - | Parsetree.Pcty_extension x0 -> - this#constr "Ast_405.Parsetree.class_type_desc" - ("Pcty_extension", [this#lift_Parsetree_extension x0]) : - Parsetree.class_type_desc -> 'res) - method lift_Parsetree_class_signature : - Parsetree.class_signature -> 'res= - (fun - { Parsetree.pcsig_self = pcsig_self; - Parsetree.pcsig_fields = pcsig_fields } - -> - this#record "Ast_405.Parsetree.class_signature" - [("pcsig_self", (this#lift_Parsetree_core_type pcsig_self)); - ("pcsig_fields", - (this#list - (List.map this#lift_Parsetree_class_type_field pcsig_fields)))] : - Parsetree.class_signature -> 'res) - method lift_Parsetree_class_type_field : - Parsetree.class_type_field -> 'res= - (fun - { Parsetree.pctf_desc = pctf_desc; Parsetree.pctf_loc = pctf_loc; - Parsetree.pctf_attributes = pctf_attributes } - -> - this#record "Ast_405.Parsetree.class_type_field" - [("pctf_desc", - (this#lift_Parsetree_class_type_field_desc pctf_desc)); - ("pctf_loc", (this#lift_Location_t pctf_loc)); - ("pctf_attributes", - (this#lift_Parsetree_attributes pctf_attributes))] : Parsetree.class_type_field - -> - 'res) - method lift_Parsetree_class_type_field_desc : - Parsetree.class_type_field_desc -> 'res= - (function - | Parsetree.Pctf_inherit x0 -> - this#constr "Ast_405.Parsetree.class_type_field_desc" - ("Pctf_inherit", [this#lift_Parsetree_class_type x0]) - | Parsetree.Pctf_val x0 -> - this#constr "Ast_405.Parsetree.class_type_field_desc" - ("Pctf_val", - [(let (x0,x1,x2,x3) = x0 in - this#tuple - [this#lift_Asttypes_loc this#string x0; - this#lift_Asttypes_mutable_flag x1; - this#lift_Asttypes_virtual_flag x2; - this#lift_Parsetree_core_type x3])]) - | Parsetree.Pctf_method x0 -> - this#constr "Ast_405.Parsetree.class_type_field_desc" - ("Pctf_method", - [(let (x0,x1,x2,x3) = x0 in - this#tuple - [this#lift_Asttypes_loc this#string x0; - this#lift_Asttypes_private_flag x1; - this#lift_Asttypes_virtual_flag x2; - this#lift_Parsetree_core_type x3])]) - | Parsetree.Pctf_constraint x0 -> - this#constr "Ast_405.Parsetree.class_type_field_desc" - ("Pctf_constraint", - [(let (x0,x1) = x0 in - this#tuple - [this#lift_Parsetree_core_type x0; - this#lift_Parsetree_core_type x1])]) - | Parsetree.Pctf_attribute x0 -> - this#constr "Ast_405.Parsetree.class_type_field_desc" - ("Pctf_attribute", [this#lift_Parsetree_attribute x0]) - | Parsetree.Pctf_extension x0 -> - this#constr "Ast_405.Parsetree.class_type_field_desc" - ("Pctf_extension", [this#lift_Parsetree_extension x0]) : - Parsetree.class_type_field_desc -> 'res) - method lift_Parsetree_extension : Parsetree.extension -> 'res= - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Asttypes_loc this#string x0; - this#lift_Parsetree_payload x1] : Parsetree.extension -> 'res) - method lift_Parsetree_class_infos : - 'f0 . ('f0 -> 'res) -> 'f0 Parsetree.class_infos -> 'res= fun (type f0) - -> - (fun f0 -> - fun - { Parsetree.pci_virt = pci_virt; - Parsetree.pci_params = pci_params; - Parsetree.pci_name = pci_name; Parsetree.pci_expr = pci_expr; - Parsetree.pci_loc = pci_loc; - Parsetree.pci_attributes = pci_attributes } - -> - this#record "Ast_405.Parsetree.class_infos" - [("pci_virt", (this#lift_Asttypes_virtual_flag pci_virt)); - ("pci_params", - (this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Parsetree_core_type x0; - this#lift_Asttypes_variance x1]) pci_params))); - ("pci_name", (this#lift_Asttypes_loc this#string pci_name)); - ("pci_expr", (f0 pci_expr)); - ("pci_loc", (this#lift_Location_t pci_loc)); - ("pci_attributes", - (this#lift_Parsetree_attributes pci_attributes))] : (f0 -> - 'res) -> - f0 - Parsetree.class_infos - -> - 'res) - method lift_Asttypes_virtual_flag : Asttypes.virtual_flag -> 'res= - (function - | Asttypes.Virtual -> - this#constr "Ast_405.Asttypes.virtual_flag" ("Virtual", []) - | Asttypes.Concrete -> - this#constr "Ast_405.Asttypes.virtual_flag" ("Concrete", []) : Asttypes.virtual_flag - -> - 'res) - method lift_Parsetree_include_description : - Parsetree.include_description -> 'res= - (fun x -> - this#lift_Parsetree_include_infos this#lift_Parsetree_module_type x : - Parsetree.include_description -> 'res) - method lift_Parsetree_include_infos : - 'f0 . ('f0 -> 'res) -> 'f0 Parsetree.include_infos -> 'res= fun (type - f0) -> - (fun f0 -> - fun - { Parsetree.pincl_mod = pincl_mod; - Parsetree.pincl_loc = pincl_loc; - Parsetree.pincl_attributes = pincl_attributes } - -> - this#record "Ast_405.Parsetree.include_infos" - [("pincl_mod", (f0 pincl_mod)); - ("pincl_loc", (this#lift_Location_t pincl_loc)); - ("pincl_attributes", - (this#lift_Parsetree_attributes pincl_attributes))] : - (f0 -> 'res) -> f0 Parsetree.include_infos -> 'res) - method lift_Parsetree_open_description : - Parsetree.open_description -> 'res= - (fun - { Parsetree.popen_lid = popen_lid; - Parsetree.popen_override = popen_override; - Parsetree.popen_loc = popen_loc; - Parsetree.popen_attributes = popen_attributes } - -> - this#record "Ast_405.Parsetree.open_description" - [("popen_lid", - (this#lift_Asttypes_loc this#lift_Longident_t popen_lid)); - ("popen_override", - (this#lift_Asttypes_override_flag popen_override)); - ("popen_loc", (this#lift_Location_t popen_loc)); - ("popen_attributes", - (this#lift_Parsetree_attributes popen_attributes))] : Parsetree.open_description - -> - 'res) - method lift_Asttypes_override_flag : Asttypes.override_flag -> 'res= - (function - | Asttypes.Override -> - this#constr "Ast_405.Asttypes.override_flag" ("Override", []) - | Asttypes.Fresh -> - this#constr "Ast_405.Asttypes.override_flag" ("Fresh", []) : Asttypes.override_flag - -> - 'res) - method lift_Parsetree_module_type_declaration : - Parsetree.module_type_declaration -> 'res= - (fun - { Parsetree.pmtd_name = pmtd_name; Parsetree.pmtd_type = pmtd_type; - Parsetree.pmtd_attributes = pmtd_attributes; - Parsetree.pmtd_loc = pmtd_loc } - -> - this#record "Ast_405.Parsetree.module_type_declaration" - [("pmtd_name", (this#lift_Asttypes_loc this#string pmtd_name)); - ("pmtd_type", - (this#lift_option this#lift_Parsetree_module_type pmtd_type)); - ("pmtd_attributes", - (this#lift_Parsetree_attributes pmtd_attributes)); - ("pmtd_loc", (this#lift_Location_t pmtd_loc))] : Parsetree.module_type_declaration - -> 'res) - method lift_Parsetree_module_declaration : - Parsetree.module_declaration -> 'res= - (fun - { Parsetree.pmd_name = pmd_name; Parsetree.pmd_type = pmd_type; - Parsetree.pmd_attributes = pmd_attributes; - Parsetree.pmd_loc = pmd_loc } - -> - this#record "Ast_405.Parsetree.module_declaration" - [("pmd_name", (this#lift_Asttypes_loc this#string pmd_name)); - ("pmd_type", (this#lift_Parsetree_module_type pmd_type)); - ("pmd_attributes", - (this#lift_Parsetree_attributes pmd_attributes)); - ("pmd_loc", (this#lift_Location_t pmd_loc))] : Parsetree.module_declaration - -> 'res) - method lift_Parsetree_type_extension : Parsetree.type_extension -> 'res= - (fun - { Parsetree.ptyext_path = ptyext_path; - Parsetree.ptyext_params = ptyext_params; - Parsetree.ptyext_constructors = ptyext_constructors; - Parsetree.ptyext_private = ptyext_private; - Parsetree.ptyext_attributes = ptyext_attributes } - -> - this#record "Ast_405.Parsetree.type_extension" - [("ptyext_path", - (this#lift_Asttypes_loc this#lift_Longident_t ptyext_path)); - ("ptyext_params", - (this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Parsetree_core_type x0; - this#lift_Asttypes_variance x1]) ptyext_params))); - ("ptyext_constructors", - (this#list - (List.map this#lift_Parsetree_extension_constructor - ptyext_constructors))); - ("ptyext_private", - (this#lift_Asttypes_private_flag ptyext_private)); - ("ptyext_attributes", - (this#lift_Parsetree_attributes ptyext_attributes))] : Parsetree.type_extension - -> - 'res) - method lift_Parsetree_extension_constructor : - Parsetree.extension_constructor -> 'res= - (fun - { Parsetree.pext_name = pext_name; Parsetree.pext_kind = pext_kind; - Parsetree.pext_loc = pext_loc; - Parsetree.pext_attributes = pext_attributes } - -> - this#record "Ast_405.Parsetree.extension_constructor" - [("pext_name", (this#lift_Asttypes_loc this#string pext_name)); - ("pext_kind", - (this#lift_Parsetree_extension_constructor_kind pext_kind)); - ("pext_loc", (this#lift_Location_t pext_loc)); - ("pext_attributes", - (this#lift_Parsetree_attributes pext_attributes))] : Parsetree.extension_constructor - -> - 'res) - method lift_Parsetree_extension_constructor_kind : - Parsetree.extension_constructor_kind -> 'res= - (function - | Parsetree.Pext_decl (x0,x1) -> - this#constr "Ast_405.Parsetree.extension_constructor_kind" - ("Pext_decl", - [this#lift_Parsetree_constructor_arguments x0; - this#lift_option this#lift_Parsetree_core_type x1]) - | Parsetree.Pext_rebind x0 -> - this#constr "Ast_405.Parsetree.extension_constructor_kind" - ("Pext_rebind", - [this#lift_Asttypes_loc this#lift_Longident_t x0]) : Parsetree.extension_constructor_kind - -> - 'res) - method lift_Parsetree_type_declaration : - Parsetree.type_declaration -> 'res= - (fun - { Parsetree.ptype_name = ptype_name; - Parsetree.ptype_params = ptype_params; - Parsetree.ptype_cstrs = ptype_cstrs; - Parsetree.ptype_kind = ptype_kind; - Parsetree.ptype_private = ptype_private; - Parsetree.ptype_manifest = ptype_manifest; - Parsetree.ptype_attributes = ptype_attributes; - Parsetree.ptype_loc = ptype_loc } - -> - this#record "Ast_405.Parsetree.type_declaration" - [("ptype_name", (this#lift_Asttypes_loc this#string ptype_name)); - ("ptype_params", - (this#list - (List.map - (fun x -> - let (x0,x1) = x in - this#tuple - [this#lift_Parsetree_core_type x0; - this#lift_Asttypes_variance x1]) ptype_params))); - ("ptype_cstrs", - (this#list - (List.map - (fun x -> - let (x0,x1,x2) = x in - this#tuple - [this#lift_Parsetree_core_type x0; - this#lift_Parsetree_core_type x1; - this#lift_Location_t x2]) ptype_cstrs))); - ("ptype_kind", (this#lift_Parsetree_type_kind ptype_kind)); - ("ptype_private", (this#lift_Asttypes_private_flag ptype_private)); - ("ptype_manifest", - (this#lift_option this#lift_Parsetree_core_type ptype_manifest)); - ("ptype_attributes", - (this#lift_Parsetree_attributes ptype_attributes)); - ("ptype_loc", (this#lift_Location_t ptype_loc))] : Parsetree.type_declaration - -> 'res) - method lift_Asttypes_private_flag : Asttypes.private_flag -> 'res= - (function - | Asttypes.Private -> - this#constr "Ast_405.Asttypes.private_flag" ("Private", []) - | Asttypes.Public -> - this#constr "Ast_405.Asttypes.private_flag" ("Public", []) : Asttypes.private_flag - -> - 'res) - method lift_Parsetree_type_kind : Parsetree.type_kind -> 'res= - (function - | Parsetree.Ptype_abstract -> - this#constr "Ast_405.Parsetree.type_kind" ("Ptype_abstract", []) - | Parsetree.Ptype_variant x0 -> - this#constr "Ast_405.Parsetree.type_kind" - ("Ptype_variant", - [this#list - (List.map this#lift_Parsetree_constructor_declaration x0)]) - | Parsetree.Ptype_record x0 -> - this#constr "Ast_405.Parsetree.type_kind" - ("Ptype_record", - [this#list (List.map this#lift_Parsetree_label_declaration x0)]) - | Parsetree.Ptype_open -> - this#constr "Ast_405.Parsetree.type_kind" ("Ptype_open", []) : Parsetree.type_kind - -> - 'res) - method lift_Parsetree_constructor_declaration : - Parsetree.constructor_declaration -> 'res= - (fun - { Parsetree.pcd_name = pcd_name; Parsetree.pcd_args = pcd_args; - Parsetree.pcd_res = pcd_res; Parsetree.pcd_loc = pcd_loc; - Parsetree.pcd_attributes = pcd_attributes } - -> - this#record "Ast_405.Parsetree.constructor_declaration" - [("pcd_name", (this#lift_Asttypes_loc this#string pcd_name)); - ("pcd_args", (this#lift_Parsetree_constructor_arguments pcd_args)); - ("pcd_res", - (this#lift_option this#lift_Parsetree_core_type pcd_res)); - ("pcd_loc", (this#lift_Location_t pcd_loc)); - ("pcd_attributes", - (this#lift_Parsetree_attributes pcd_attributes))] : Parsetree.constructor_declaration - -> - 'res) - method lift_Parsetree_constructor_arguments : - Parsetree.constructor_arguments -> 'res= - (function - | Parsetree.Pcstr_tuple x0 -> - this#constr "Ast_405.Parsetree.constructor_arguments" - ("Pcstr_tuple", - [this#list (List.map this#lift_Parsetree_core_type x0)]) - | Parsetree.Pcstr_record x0 -> - this#constr "Ast_405.Parsetree.constructor_arguments" - ("Pcstr_record", - [this#list (List.map this#lift_Parsetree_label_declaration x0)]) : - Parsetree.constructor_arguments -> 'res) - method lift_Parsetree_label_declaration : - Parsetree.label_declaration -> 'res= - (fun - { Parsetree.pld_name = pld_name; - Parsetree.pld_mutable = pld_mutable; - Parsetree.pld_type = pld_type; Parsetree.pld_loc = pld_loc; - Parsetree.pld_attributes = pld_attributes } - -> - this#record "Ast_405.Parsetree.label_declaration" - [("pld_name", (this#lift_Asttypes_loc this#string pld_name)); - ("pld_mutable", (this#lift_Asttypes_mutable_flag pld_mutable)); - ("pld_type", (this#lift_Parsetree_core_type pld_type)); - ("pld_loc", (this#lift_Location_t pld_loc)); - ("pld_attributes", - (this#lift_Parsetree_attributes pld_attributes))] : Parsetree.label_declaration - -> - 'res) - method lift_Asttypes_mutable_flag : Asttypes.mutable_flag -> 'res= - (function - | Asttypes.Immutable -> - this#constr "Ast_405.Asttypes.mutable_flag" ("Immutable", []) - | Asttypes.Mutable -> - this#constr "Ast_405.Asttypes.mutable_flag" ("Mutable", []) : Asttypes.mutable_flag - -> - 'res) - method lift_Asttypes_variance : Asttypes.variance -> 'res= - (function - | Asttypes.Covariant -> - this#constr "Ast_405.Asttypes.variance" ("Covariant", []) - | Asttypes.Contravariant -> - this#constr "Ast_405.Asttypes.variance" ("Contravariant", []) - | Asttypes.Invariant -> - this#constr "Ast_405.Asttypes.variance" ("Invariant", []) : Asttypes.variance - -> 'res) - method lift_Parsetree_value_description : - Parsetree.value_description -> 'res= - (fun - { Parsetree.pval_name = pval_name; Parsetree.pval_type = pval_type; - Parsetree.pval_prim = pval_prim; - Parsetree.pval_attributes = pval_attributes; - Parsetree.pval_loc = pval_loc } - -> - this#record "Ast_405.Parsetree.value_description" - [("pval_name", (this#lift_Asttypes_loc this#string pval_name)); - ("pval_type", (this#lift_Parsetree_core_type pval_type)); - ("pval_prim", (this#list (List.map this#string pval_prim))); - ("pval_attributes", - (this#lift_Parsetree_attributes pval_attributes)); - ("pval_loc", (this#lift_Location_t pval_loc))] : Parsetree.value_description - -> 'res) - method lift_Asttypes_arg_label : Asttypes.arg_label -> 'res= - (function - | Asttypes.Nolabel -> - this#constr "Ast_405.Asttypes.arg_label" ("Nolabel", []) - | Asttypes.Labelled x0 -> - this#constr "Ast_405.Asttypes.arg_label" ("Labelled", [this#string x0]) - | Asttypes.Optional x0 -> - this#constr "Ast_405.Asttypes.arg_label" ("Optional", [this#string x0]) : - Asttypes.arg_label -> 'res) - method lift_Asttypes_closed_flag : Asttypes.closed_flag -> 'res= - (function - | Asttypes.Closed -> - this#constr "Ast_405.Asttypes.closed_flag" ("Closed", []) - | Asttypes.Open -> this#constr "Ast_405.Asttypes.closed_flag" ("Open", []) : - Asttypes.closed_flag -> 'res) - method lift_Asttypes_label : Asttypes.label -> 'res= - (this#string : Asttypes.label -> 'res) - method lift_Asttypes_rec_flag : Asttypes.rec_flag -> 'res= - (function - | Asttypes.Nonrecursive -> - this#constr "Ast_405.Asttypes.rec_flag" ("Nonrecursive", []) - | Asttypes.Recursive -> - this#constr "Ast_405.Asttypes.rec_flag" ("Recursive", []) : Asttypes.rec_flag - -> 'res) - method lift_Parsetree_constant : Parsetree.constant -> 'res= - (function - | Parsetree.Pconst_integer (x0,x1) -> - this#constr "Ast_405.Parsetree.constant" - ("Pconst_integer", - [this#string x0; this#lift_option this#char x1]) - | Parsetree.Pconst_char x0 -> - this#constr "Ast_405.Parsetree.constant" ("Pconst_char", [this#char x0]) - | Parsetree.Pconst_string (x0,x1) -> - this#constr "Ast_405.Parsetree.constant" - ("Pconst_string", - [this#string x0; this#lift_option this#string x1]) - | Parsetree.Pconst_float (x0,x1) -> - this#constr "Ast_405.Parsetree.constant" - ("Pconst_float", - [this#string x0; this#lift_option this#char x1]) : Parsetree.constant - -> - 'res) - method lift_option : 'f0 . ('f0 -> 'res) -> 'f0 option -> 'res= fun (type - f0) -> - (fun f0 -> - function - | None -> this#constr "option" ("None", []) - | Some x0 -> this#constr "option" ("Some", [f0 x0]) : (f0 -> 'res) - -> - f0 option -> - 'res) - method lift_Longident_t : Longident.t -> 'res= - (function - | Longident.Lident x0 -> - this#constr "Ast_405.Longident.t" ("Lident", [this#string x0]) - | Longident.Ldot (x0,x1) -> - this#constr "Ast_405.Longident.t" - ("Ldot", [this#lift_Longident_t x0; this#string x1]) - | Longident.Lapply (x0,x1) -> - this#constr "Ast_405.Longident.t" - ("Lapply", [this#lift_Longident_t x0; this#lift_Longident_t x1]) : - Longident.t -> 'res) - method lift_Asttypes_loc : - 'f0 . ('f0 -> 'res) -> 'f0 Asttypes.loc -> 'res= fun (type f0) -> - (fun f0 -> - fun { Asttypes.txt = txt; Asttypes.loc = loc } -> - this#record "Ast_405.Asttypes.loc" - [("txt", (f0 txt)); ("loc", (this#lift_Location_t loc))] : - (f0 -> 'res) -> f0 Asttypes.loc -> 'res) - method lift_Location_t : Location.t -> 'res= - (fun - { Location.loc_start = loc_start; Location.loc_end = loc_end; - Location.loc_ghost = loc_ghost } - -> - this#record "Ast_405.Location.t" - [("loc_start", (this#lift_Lexing_position loc_start)); - ("loc_end", (this#lift_Lexing_position loc_end)); - ("loc_ghost", (this#lift_bool loc_ghost))] : Location.t -> 'res) - method lift_bool : bool -> 'res= - (function - | false -> this#constr "bool" ("false", []) - | true -> this#constr "bool" ("true", []) : bool -> 'res) - method lift_Lexing_position : Lexing.position -> 'res= - (fun - { Lexing.pos_fname = pos_fname; Lexing.pos_lnum = pos_lnum; - Lexing.pos_bol = pos_bol; Lexing.pos_cnum = pos_cnum } - -> - this#record "Lexing.position" - [("pos_fname", (this#string pos_fname)); - ("pos_lnum", (this#int pos_lnum)); - ("pos_bol", (this#int pos_bol)); - ("pos_cnum", (this#int pos_cnum))] : Lexing.position -> 'res) - end diff --git a/ppx_tools_versioned.5.2/ast_lifter_406.ml b/ppx_tools_versioned.5.2/ast_lifter_406.ml deleted file mode 100644 index 37e5502..0000000 --- a/ppx_tools_versioned.5.2/ast_lifter_406.ml +++ /dev/null @@ -1,1409 +0,0 @@ -open Ast_406 - -class virtual ['res] lifter = - object (this) - method lift_Parsetree_expression : Parsetree.expression -> 'res= - (fun - { Parsetree.pexp_desc = pexp_desc; Parsetree.pexp_loc = pexp_loc; - Parsetree.pexp_attributes = pexp_attributes } - -> - this#record "Ast_406.Parsetree.expression" - [("pexp_desc", (this#lift_Parsetree_expression_desc pexp_desc)); - ("pexp_loc", (this#lift_Location_t pexp_loc)); - ("pexp_attributes", - (this#lift_Parsetree_attributes pexp_attributes))] : Parsetree.expression - -> - 'res) - method lift_Parsetree_expression_desc : - Parsetree.expression_desc -> 'res= - (function - | Parsetree.Pexp_ident x0 -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_ident", - [this#lift_Asttypes_loc this#lift_Longident_t x0]) - | Parsetree.Pexp_constant x0 -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_constant", [this#lift_Parsetree_constant x0]) - | Parsetree.Pexp_let (x0, x1, x2) -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_let", - [this#lift_Asttypes_rec_flag x0; - this#list (List.map this#lift_Parsetree_value_binding x1); - this#lift_Parsetree_expression x2]) - | Parsetree.Pexp_function x0 -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_function", - [this#list (List.map this#lift_Parsetree_case x0)]) - | Parsetree.Pexp_fun (x0, x1, x2, x3) -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_fun", - [this#lift_Asttypes_arg_label x0; - this#lift_option this#lift_Parsetree_expression x1; - this#lift_Parsetree_pattern x2; - this#lift_Parsetree_expression x3]) - | Parsetree.Pexp_apply (x0, x1) -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_apply", - [this#lift_Parsetree_expression x0; - this#list - (List.map - (fun x -> - let (x0, x1) = x in - this#tuple - [this#lift_Asttypes_arg_label x0; - this#lift_Parsetree_expression x1]) x1)]) - | Parsetree.Pexp_match (x0, x1) -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_match", - [this#lift_Parsetree_expression x0; - this#list (List.map this#lift_Parsetree_case x1)]) - | Parsetree.Pexp_try (x0, x1) -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_try", - [this#lift_Parsetree_expression x0; - this#list (List.map this#lift_Parsetree_case x1)]) - | Parsetree.Pexp_tuple x0 -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_tuple", - [this#list (List.map this#lift_Parsetree_expression x0)]) - | Parsetree.Pexp_construct (x0, x1) -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_construct", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_option this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_variant (x0, x1) -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_variant", - [this#lift_Asttypes_label x0; - this#lift_option this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_record (x0, x1) -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_record", - [this#list - (List.map - (fun x -> - let (x0, x1) = x in - this#tuple - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_Parsetree_expression x1]) x0); - this#lift_option this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_field (x0, x1) -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_field", - [this#lift_Parsetree_expression x0; - this#lift_Asttypes_loc this#lift_Longident_t x1]) - | Parsetree.Pexp_setfield (x0, x1, x2) -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_setfield", - [this#lift_Parsetree_expression x0; - this#lift_Asttypes_loc this#lift_Longident_t x1; - this#lift_Parsetree_expression x2]) - | Parsetree.Pexp_array x0 -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_array", - [this#list (List.map this#lift_Parsetree_expression x0)]) - | Parsetree.Pexp_ifthenelse (x0, x1, x2) -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_ifthenelse", - [this#lift_Parsetree_expression x0; - this#lift_Parsetree_expression x1; - this#lift_option this#lift_Parsetree_expression x2]) - | Parsetree.Pexp_sequence (x0, x1) -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_sequence", - [this#lift_Parsetree_expression x0; - this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_while (x0, x1) -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_while", - [this#lift_Parsetree_expression x0; - this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_for (x0, x1, x2, x3, x4) -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_for", - [this#lift_Parsetree_pattern x0; - this#lift_Parsetree_expression x1; - this#lift_Parsetree_expression x2; - this#lift_Asttypes_direction_flag x3; - this#lift_Parsetree_expression x4]) - | Parsetree.Pexp_constraint (x0, x1) -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_constraint", - [this#lift_Parsetree_expression x0; - this#lift_Parsetree_core_type x1]) - | Parsetree.Pexp_coerce (x0, x1, x2) -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_coerce", - [this#lift_Parsetree_expression x0; - this#lift_option this#lift_Parsetree_core_type x1; - this#lift_Parsetree_core_type x2]) - | Parsetree.Pexp_send (x0, x1) -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_send", - [this#lift_Parsetree_expression x0; - this#lift_Asttypes_loc this#lift_Asttypes_label x1]) - | Parsetree.Pexp_new x0 -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_new", [this#lift_Asttypes_loc this#lift_Longident_t x0]) - | Parsetree.Pexp_setinstvar (x0, x1) -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_setinstvar", - [this#lift_Asttypes_loc this#lift_Asttypes_label x0; - this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_override x0 -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_override", - [this#list - (List.map - (fun x -> - let (x0, x1) = x in - this#tuple - [this#lift_Asttypes_loc this#lift_Asttypes_label x0; - this#lift_Parsetree_expression x1]) x0)]) - | Parsetree.Pexp_letmodule (x0, x1, x2) -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_letmodule", - [this#lift_Asttypes_loc this#string x0; - this#lift_Parsetree_module_expr x1; - this#lift_Parsetree_expression x2]) - | Parsetree.Pexp_letexception (x0, x1) -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_letexception", - [this#lift_Parsetree_extension_constructor x0; - this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_assert x0 -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_assert", [this#lift_Parsetree_expression x0]) - | Parsetree.Pexp_lazy x0 -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_lazy", [this#lift_Parsetree_expression x0]) - | Parsetree.Pexp_poly (x0, x1) -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_poly", - [this#lift_Parsetree_expression x0; - this#lift_option this#lift_Parsetree_core_type x1]) - | Parsetree.Pexp_object x0 -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_object", [this#lift_Parsetree_class_structure x0]) - | Parsetree.Pexp_newtype (x0, x1) -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_newtype", - [this#lift_Asttypes_loc this#string x0; - this#lift_Parsetree_expression x1]) - | Parsetree.Pexp_pack x0 -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_pack", [this#lift_Parsetree_module_expr x0]) - | Parsetree.Pexp_open (x0, x1, x2) -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_open", - [this#lift_Asttypes_override_flag x0; - this#lift_Asttypes_loc this#lift_Longident_t x1; - this#lift_Parsetree_expression x2]) - | Parsetree.Pexp_extension x0 -> - this#constr "Ast_406.Parsetree.expression_desc" - ("Pexp_extension", [this#lift_Parsetree_extension x0]) - | Parsetree.Pexp_unreachable -> - this#constr "Ast_406.Parsetree.expression_desc" ("Pexp_unreachable", []) : - Parsetree.expression_desc -> 'res) - method lift_Asttypes_direction_flag : Asttypes.direction_flag -> 'res= - (function - | Asttypes.Upto -> this#constr "Ast_406.Asttypes.direction_flag" ("Upto", []) - | Asttypes.Downto -> - this#constr "Ast_406.Asttypes.direction_flag" ("Downto", []) : Asttypes.direction_flag - -> - 'res) - method lift_Parsetree_case : Parsetree.case -> 'res= - (fun - { Parsetree.pc_lhs = pc_lhs; Parsetree.pc_guard = pc_guard; - Parsetree.pc_rhs = pc_rhs } - -> - this#record "Ast_406.Parsetree.case" - [("pc_lhs", (this#lift_Parsetree_pattern pc_lhs)); - ("pc_guard", - (this#lift_option this#lift_Parsetree_expression pc_guard)); - ("pc_rhs", (this#lift_Parsetree_expression pc_rhs))] : Parsetree.case - -> - 'res) - method lift_Parsetree_value_binding : Parsetree.value_binding -> 'res= - (fun - { Parsetree.pvb_pat = pvb_pat; Parsetree.pvb_expr = pvb_expr; - Parsetree.pvb_attributes = pvb_attributes; - Parsetree.pvb_loc = pvb_loc } - -> - this#record "Ast_406.Parsetree.value_binding" - [("pvb_pat", (this#lift_Parsetree_pattern pvb_pat)); - ("pvb_expr", (this#lift_Parsetree_expression pvb_expr)); - ("pvb_attributes", - (this#lift_Parsetree_attributes pvb_attributes)); - ("pvb_loc", (this#lift_Location_t pvb_loc))] : Parsetree.value_binding - -> 'res) - method lift_Parsetree_pattern : Parsetree.pattern -> 'res= - (fun - { Parsetree.ppat_desc = ppat_desc; Parsetree.ppat_loc = ppat_loc; - Parsetree.ppat_attributes = ppat_attributes } - -> - this#record "Ast_406.Parsetree.pattern" - [("ppat_desc", (this#lift_Parsetree_pattern_desc ppat_desc)); - ("ppat_loc", (this#lift_Location_t ppat_loc)); - ("ppat_attributes", - (this#lift_Parsetree_attributes ppat_attributes))] : Parsetree.pattern - -> - 'res) - method lift_Parsetree_pattern_desc : Parsetree.pattern_desc -> 'res= - (function - | Parsetree.Ppat_any -> - this#constr "Ast_406.Parsetree.pattern_desc" ("Ppat_any", []) - | Parsetree.Ppat_var x0 -> - this#constr "Ast_406.Parsetree.pattern_desc" - ("Ppat_var", [this#lift_Asttypes_loc this#string x0]) - | Parsetree.Ppat_alias (x0, x1) -> - this#constr "Ast_406.Parsetree.pattern_desc" - ("Ppat_alias", - [this#lift_Parsetree_pattern x0; - this#lift_Asttypes_loc this#string x1]) - | Parsetree.Ppat_constant x0 -> - this#constr "Ast_406.Parsetree.pattern_desc" - ("Ppat_constant", [this#lift_Parsetree_constant x0]) - | Parsetree.Ppat_interval (x0, x1) -> - this#constr "Ast_406.Parsetree.pattern_desc" - ("Ppat_interval", - [this#lift_Parsetree_constant x0; - this#lift_Parsetree_constant x1]) - | Parsetree.Ppat_tuple x0 -> - this#constr "Ast_406.Parsetree.pattern_desc" - ("Ppat_tuple", - [this#list (List.map this#lift_Parsetree_pattern x0)]) - | Parsetree.Ppat_construct (x0, x1) -> - this#constr "Ast_406.Parsetree.pattern_desc" - ("Ppat_construct", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_option this#lift_Parsetree_pattern x1]) - | Parsetree.Ppat_variant (x0, x1) -> - this#constr "Ast_406.Parsetree.pattern_desc" - ("Ppat_variant", - [this#lift_Asttypes_label x0; - this#lift_option this#lift_Parsetree_pattern x1]) - | Parsetree.Ppat_record (x0, x1) -> - this#constr "Ast_406.Parsetree.pattern_desc" - ("Ppat_record", - [this#list - (List.map - (fun x -> - let (x0, x1) = x in - this#tuple - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_Parsetree_pattern x1]) x0); - this#lift_Asttypes_closed_flag x1]) - | Parsetree.Ppat_array x0 -> - this#constr "Ast_406.Parsetree.pattern_desc" - ("Ppat_array", - [this#list (List.map this#lift_Parsetree_pattern x0)]) - | Parsetree.Ppat_or (x0, x1) -> - this#constr "Ast_406.Parsetree.pattern_desc" - ("Ppat_or", - [this#lift_Parsetree_pattern x0; - this#lift_Parsetree_pattern x1]) - | Parsetree.Ppat_constraint (x0, x1) -> - this#constr "Ast_406.Parsetree.pattern_desc" - ("Ppat_constraint", - [this#lift_Parsetree_pattern x0; - this#lift_Parsetree_core_type x1]) - | Parsetree.Ppat_type x0 -> - this#constr "Ast_406.Parsetree.pattern_desc" - ("Ppat_type", [this#lift_Asttypes_loc this#lift_Longident_t x0]) - | Parsetree.Ppat_lazy x0 -> - this#constr "Ast_406.Parsetree.pattern_desc" - ("Ppat_lazy", [this#lift_Parsetree_pattern x0]) - | Parsetree.Ppat_unpack x0 -> - this#constr "Ast_406.Parsetree.pattern_desc" - ("Ppat_unpack", [this#lift_Asttypes_loc this#string x0]) - | Parsetree.Ppat_exception x0 -> - this#constr "Ast_406.Parsetree.pattern_desc" - ("Ppat_exception", [this#lift_Parsetree_pattern x0]) - | Parsetree.Ppat_extension x0 -> - this#constr "Ast_406.Parsetree.pattern_desc" - ("Ppat_extension", [this#lift_Parsetree_extension x0]) - | Parsetree.Ppat_open (x0, x1) -> - this#constr "Ast_406.Parsetree.pattern_desc" - ("Ppat_open", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_Parsetree_pattern x1]) : Parsetree.pattern_desc -> - 'res) - method lift_Parsetree_core_type : Parsetree.core_type -> 'res= - (fun - { Parsetree.ptyp_desc = ptyp_desc; Parsetree.ptyp_loc = ptyp_loc; - Parsetree.ptyp_attributes = ptyp_attributes } - -> - this#record "Ast_406.Parsetree.core_type" - [("ptyp_desc", (this#lift_Parsetree_core_type_desc ptyp_desc)); - ("ptyp_loc", (this#lift_Location_t ptyp_loc)); - ("ptyp_attributes", - (this#lift_Parsetree_attributes ptyp_attributes))] : Parsetree.core_type - -> - 'res) - method lift_Parsetree_core_type_desc : Parsetree.core_type_desc -> 'res= - (function - | Parsetree.Ptyp_any -> - this#constr "Ast_406.Parsetree.core_type_desc" ("Ptyp_any", []) - | Parsetree.Ptyp_var x0 -> - this#constr "Ast_406.Parsetree.core_type_desc" - ("Ptyp_var", [this#string x0]) - | Parsetree.Ptyp_arrow (x0, x1, x2) -> - this#constr "Ast_406.Parsetree.core_type_desc" - ("Ptyp_arrow", - [this#lift_Asttypes_arg_label x0; - this#lift_Parsetree_core_type x1; - this#lift_Parsetree_core_type x2]) - | Parsetree.Ptyp_tuple x0 -> - this#constr "Ast_406.Parsetree.core_type_desc" - ("Ptyp_tuple", - [this#list (List.map this#lift_Parsetree_core_type x0)]) - | Parsetree.Ptyp_constr (x0, x1) -> - this#constr "Ast_406.Parsetree.core_type_desc" - ("Ptyp_constr", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#list (List.map this#lift_Parsetree_core_type x1)]) - | Parsetree.Ptyp_object (x0, x1) -> - this#constr "Ast_406.Parsetree.core_type_desc" - ("Ptyp_object", - [this#list (List.map this#lift_Parsetree_object_field x0); - this#lift_Asttypes_closed_flag x1]) - | Parsetree.Ptyp_class (x0, x1) -> - this#constr "Ast_406.Parsetree.core_type_desc" - ("Ptyp_class", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#list (List.map this#lift_Parsetree_core_type x1)]) - | Parsetree.Ptyp_alias (x0, x1) -> - this#constr "Ast_406.Parsetree.core_type_desc" - ("Ptyp_alias", - [this#lift_Parsetree_core_type x0; this#string x1]) - | Parsetree.Ptyp_variant (x0, x1, x2) -> - this#constr "Ast_406.Parsetree.core_type_desc" - ("Ptyp_variant", - [this#list (List.map this#lift_Parsetree_row_field x0); - this#lift_Asttypes_closed_flag x1; - this#lift_option - (fun x -> this#list (List.map this#lift_Asttypes_label x)) - x2]) - | Parsetree.Ptyp_poly (x0, x1) -> - this#constr "Ast_406.Parsetree.core_type_desc" - ("Ptyp_poly", - [this#list - (List.map (fun x -> this#lift_Asttypes_loc this#string x) - x0); - this#lift_Parsetree_core_type x1]) - | Parsetree.Ptyp_package x0 -> - this#constr "Ast_406.Parsetree.core_type_desc" - ("Ptyp_package", [this#lift_Parsetree_package_type x0]) - | Parsetree.Ptyp_extension x0 -> - this#constr "Ast_406.Parsetree.core_type_desc" - ("Ptyp_extension", [this#lift_Parsetree_extension x0]) : - Parsetree.core_type_desc -> 'res) - method lift_Parsetree_package_type : Parsetree.package_type -> 'res= - (fun x -> - let (x0, x1) = x in - this#tuple - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#list - (List.map - (fun x -> - let (x0, x1) = x in - this#tuple - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_Parsetree_core_type x1]) x1)] : Parsetree.package_type - -> 'res) - method lift_Parsetree_row_field : Parsetree.row_field -> 'res= - (function - | Parsetree.Rtag (x0, x1, x2, x3) -> - this#constr "Ast_406.Parsetree.row_field" - ("Rtag", - [this#lift_Asttypes_loc this#lift_Asttypes_label x0; - this#lift_Parsetree_attributes x1; - this#lift_bool x2; - this#list (List.map this#lift_Parsetree_core_type x3)]) - | Parsetree.Rinherit x0 -> - this#constr "Ast_406.Parsetree.row_field" - ("Rinherit", [this#lift_Parsetree_core_type x0]) : Parsetree.row_field - -> - 'res) - method lift_Parsetree_object_field : Parsetree.object_field -> 'res= - (function - | Parsetree.Otag (x0, x1, x2) -> - this#constr "Ast_406.Parsetree.object_field" - ("Otag", - [this#lift_Asttypes_loc this#lift_Asttypes_label x0; - this#lift_Parsetree_attributes x1; - this#lift_Parsetree_core_type x2]) - | Parsetree.Oinherit x0 -> - this#constr "Ast_406.Parsetree.object_field" - ("Oinherit", [this#lift_Parsetree_core_type x0]) : Parsetree.object_field - -> - 'res) - method lift_Parsetree_attributes : Parsetree.attributes -> 'res= - (fun x -> this#list (List.map this#lift_Parsetree_attribute x) : - Parsetree.attributes -> 'res) - method lift_Parsetree_attribute : Parsetree.attribute -> 'res= - (fun x -> - let (x0, x1) = x in - this#tuple - [this#lift_Asttypes_loc this#string x0; - this#lift_Parsetree_payload x1] : Parsetree.attribute -> 'res) - method lift_Parsetree_payload : Parsetree.payload -> 'res= - (function - | Parsetree.PStr x0 -> - this#constr "Ast_406.Parsetree.payload" - ("PStr", [this#lift_Parsetree_structure x0]) - | Parsetree.PSig x0 -> - this#constr "Ast_406.Parsetree.payload" - ("PSig", [this#lift_Parsetree_signature x0]) - | Parsetree.PTyp x0 -> - this#constr "Ast_406.Parsetree.payload" - ("PTyp", [this#lift_Parsetree_core_type x0]) - | Parsetree.PPat (x0, x1) -> - this#constr "Ast_406.Parsetree.payload" - ("PPat", - [this#lift_Parsetree_pattern x0; - this#lift_option this#lift_Parsetree_expression x1]) : - Parsetree.payload -> 'res) - method lift_Parsetree_structure : Parsetree.structure -> 'res= - (fun x -> this#list (List.map this#lift_Parsetree_structure_item x) : - Parsetree.structure -> 'res) - method lift_Parsetree_structure_item : Parsetree.structure_item -> 'res= - (fun { Parsetree.pstr_desc = pstr_desc; Parsetree.pstr_loc = pstr_loc } - -> - this#record "Ast_406.Parsetree.structure_item" - [("pstr_desc", - (this#lift_Parsetree_structure_item_desc pstr_desc)); - ("pstr_loc", (this#lift_Location_t pstr_loc))] : Parsetree.structure_item - -> 'res) - method lift_Parsetree_structure_item_desc : - Parsetree.structure_item_desc -> 'res= - (function - | Parsetree.Pstr_eval (x0, x1) -> - this#constr "Ast_406.Parsetree.structure_item_desc" - ("Pstr_eval", - [this#lift_Parsetree_expression x0; - this#lift_Parsetree_attributes x1]) - | Parsetree.Pstr_value (x0, x1) -> - this#constr "Ast_406.Parsetree.structure_item_desc" - ("Pstr_value", - [this#lift_Asttypes_rec_flag x0; - this#list (List.map this#lift_Parsetree_value_binding x1)]) - | Parsetree.Pstr_primitive x0 -> - this#constr "Ast_406.Parsetree.structure_item_desc" - ("Pstr_primitive", [this#lift_Parsetree_value_description x0]) - | Parsetree.Pstr_type (x0, x1) -> - this#constr "Ast_406.Parsetree.structure_item_desc" - ("Pstr_type", - [this#lift_Asttypes_rec_flag x0; - this#list (List.map this#lift_Parsetree_type_declaration x1)]) - | Parsetree.Pstr_typext x0 -> - this#constr "Ast_406.Parsetree.structure_item_desc" - ("Pstr_typext", [this#lift_Parsetree_type_extension x0]) - | Parsetree.Pstr_exception x0 -> - this#constr "Ast_406.Parsetree.structure_item_desc" - ("Pstr_exception", - [this#lift_Parsetree_extension_constructor x0]) - | Parsetree.Pstr_module x0 -> - this#constr "Ast_406.Parsetree.structure_item_desc" - ("Pstr_module", [this#lift_Parsetree_module_binding x0]) - | Parsetree.Pstr_recmodule x0 -> - this#constr "Ast_406.Parsetree.structure_item_desc" - ("Pstr_recmodule", - [this#list (List.map this#lift_Parsetree_module_binding x0)]) - | Parsetree.Pstr_modtype x0 -> - this#constr "Ast_406.Parsetree.structure_item_desc" - ("Pstr_modtype", - [this#lift_Parsetree_module_type_declaration x0]) - | Parsetree.Pstr_open x0 -> - this#constr "Ast_406.Parsetree.structure_item_desc" - ("Pstr_open", [this#lift_Parsetree_open_description x0]) - | Parsetree.Pstr_class x0 -> - this#constr "Ast_406.Parsetree.structure_item_desc" - ("Pstr_class", - [this#list (List.map this#lift_Parsetree_class_declaration x0)]) - | Parsetree.Pstr_class_type x0 -> - this#constr "Ast_406.Parsetree.structure_item_desc" - ("Pstr_class_type", - [this#list - (List.map this#lift_Parsetree_class_type_declaration x0)]) - | Parsetree.Pstr_include x0 -> - this#constr "Ast_406.Parsetree.structure_item_desc" - ("Pstr_include", [this#lift_Parsetree_include_declaration x0]) - | Parsetree.Pstr_attribute x0 -> - this#constr "Ast_406.Parsetree.structure_item_desc" - ("Pstr_attribute", [this#lift_Parsetree_attribute x0]) - | Parsetree.Pstr_extension (x0, x1) -> - this#constr "Ast_406.Parsetree.structure_item_desc" - ("Pstr_extension", - [this#lift_Parsetree_extension x0; - this#lift_Parsetree_attributes x1]) : Parsetree.structure_item_desc - -> 'res) - method lift_Parsetree_include_declaration : - Parsetree.include_declaration -> 'res= - (fun x -> - this#lift_Parsetree_include_infos this#lift_Parsetree_module_expr x : - Parsetree.include_declaration -> 'res) - method lift_Parsetree_class_declaration : - Parsetree.class_declaration -> 'res= - (fun x -> - this#lift_Parsetree_class_infos this#lift_Parsetree_class_expr x : - Parsetree.class_declaration -> 'res) - method lift_Parsetree_class_expr : Parsetree.class_expr -> 'res= - (fun - { Parsetree.pcl_desc = pcl_desc; Parsetree.pcl_loc = pcl_loc; - Parsetree.pcl_attributes = pcl_attributes } - -> - this#record "Ast_406.Parsetree.class_expr" - [("pcl_desc", (this#lift_Parsetree_class_expr_desc pcl_desc)); - ("pcl_loc", (this#lift_Location_t pcl_loc)); - ("pcl_attributes", - (this#lift_Parsetree_attributes pcl_attributes))] : Parsetree.class_expr - -> - 'res) - method lift_Parsetree_class_expr_desc : - Parsetree.class_expr_desc -> 'res= - (function - | Parsetree.Pcl_constr (x0, x1) -> - this#constr "Ast_406.Parsetree.class_expr_desc" - ("Pcl_constr", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#list (List.map this#lift_Parsetree_core_type x1)]) - | Parsetree.Pcl_structure x0 -> - this#constr "Ast_406.Parsetree.class_expr_desc" - ("Pcl_structure", [this#lift_Parsetree_class_structure x0]) - | Parsetree.Pcl_fun (x0, x1, x2, x3) -> - this#constr "Ast_406.Parsetree.class_expr_desc" - ("Pcl_fun", - [this#lift_Asttypes_arg_label x0; - this#lift_option this#lift_Parsetree_expression x1; - this#lift_Parsetree_pattern x2; - this#lift_Parsetree_class_expr x3]) - | Parsetree.Pcl_apply (x0, x1) -> - this#constr "Ast_406.Parsetree.class_expr_desc" - ("Pcl_apply", - [this#lift_Parsetree_class_expr x0; - this#list - (List.map - (fun x -> - let (x0, x1) = x in - this#tuple - [this#lift_Asttypes_arg_label x0; - this#lift_Parsetree_expression x1]) x1)]) - | Parsetree.Pcl_let (x0, x1, x2) -> - this#constr "Ast_406.Parsetree.class_expr_desc" - ("Pcl_let", - [this#lift_Asttypes_rec_flag x0; - this#list (List.map this#lift_Parsetree_value_binding x1); - this#lift_Parsetree_class_expr x2]) - | Parsetree.Pcl_constraint (x0, x1) -> - this#constr "Ast_406.Parsetree.class_expr_desc" - ("Pcl_constraint", - [this#lift_Parsetree_class_expr x0; - this#lift_Parsetree_class_type x1]) - | Parsetree.Pcl_extension x0 -> - this#constr "Ast_406.Parsetree.class_expr_desc" - ("Pcl_extension", [this#lift_Parsetree_extension x0]) - | Parsetree.Pcl_open (x0, x1, x2) -> - this#constr "Ast_406.Parsetree.class_expr_desc" - ("Pcl_open", - [this#lift_Asttypes_override_flag x0; - this#lift_Asttypes_loc this#lift_Longident_t x1; - this#lift_Parsetree_class_expr x2]) : Parsetree.class_expr_desc - -> 'res) - method lift_Parsetree_class_structure : - Parsetree.class_structure -> 'res= - (fun - { Parsetree.pcstr_self = pcstr_self; - Parsetree.pcstr_fields = pcstr_fields } - -> - this#record "Ast_406.Parsetree.class_structure" - [("pcstr_self", (this#lift_Parsetree_pattern pcstr_self)); - ("pcstr_fields", - (this#list - (List.map this#lift_Parsetree_class_field pcstr_fields)))] : - Parsetree.class_structure -> 'res) - method lift_Parsetree_class_field : Parsetree.class_field -> 'res= - (fun - { Parsetree.pcf_desc = pcf_desc; Parsetree.pcf_loc = pcf_loc; - Parsetree.pcf_attributes = pcf_attributes } - -> - this#record "Ast_406.Parsetree.class_field" - [("pcf_desc", (this#lift_Parsetree_class_field_desc pcf_desc)); - ("pcf_loc", (this#lift_Location_t pcf_loc)); - ("pcf_attributes", - (this#lift_Parsetree_attributes pcf_attributes))] : Parsetree.class_field - -> - 'res) - method lift_Parsetree_class_field_desc : - Parsetree.class_field_desc -> 'res= - (function - | Parsetree.Pcf_inherit (x0, x1, x2) -> - this#constr "Ast_406.Parsetree.class_field_desc" - ("Pcf_inherit", - [this#lift_Asttypes_override_flag x0; - this#lift_Parsetree_class_expr x1; - this#lift_option - (fun x -> this#lift_Asttypes_loc this#string x) x2]) - | Parsetree.Pcf_val x0 -> - this#constr "Ast_406.Parsetree.class_field_desc" - ("Pcf_val", - [(let (x0, x1, x2) = x0 in - this#tuple - [this#lift_Asttypes_loc this#lift_Asttypes_label x0; - this#lift_Asttypes_mutable_flag x1; - this#lift_Parsetree_class_field_kind x2])]) - | Parsetree.Pcf_method x0 -> - this#constr "Ast_406.Parsetree.class_field_desc" - ("Pcf_method", - [(let (x0, x1, x2) = x0 in - this#tuple - [this#lift_Asttypes_loc this#lift_Asttypes_label x0; - this#lift_Asttypes_private_flag x1; - this#lift_Parsetree_class_field_kind x2])]) - | Parsetree.Pcf_constraint x0 -> - this#constr "Ast_406.Parsetree.class_field_desc" - ("Pcf_constraint", - [(let (x0, x1) = x0 in - this#tuple - [this#lift_Parsetree_core_type x0; - this#lift_Parsetree_core_type x1])]) - | Parsetree.Pcf_initializer x0 -> - this#constr "Ast_406.Parsetree.class_field_desc" - ("Pcf_initializer", [this#lift_Parsetree_expression x0]) - | Parsetree.Pcf_attribute x0 -> - this#constr "Ast_406.Parsetree.class_field_desc" - ("Pcf_attribute", [this#lift_Parsetree_attribute x0]) - | Parsetree.Pcf_extension x0 -> - this#constr "Ast_406.Parsetree.class_field_desc" - ("Pcf_extension", [this#lift_Parsetree_extension x0]) : - Parsetree.class_field_desc -> 'res) - method lift_Parsetree_class_field_kind : - Parsetree.class_field_kind -> 'res= - (function - | Parsetree.Cfk_virtual x0 -> - this#constr "Ast_406.Parsetree.class_field_kind" - ("Cfk_virtual", [this#lift_Parsetree_core_type x0]) - | Parsetree.Cfk_concrete (x0, x1) -> - this#constr "Ast_406.Parsetree.class_field_kind" - ("Cfk_concrete", - [this#lift_Asttypes_override_flag x0; - this#lift_Parsetree_expression x1]) : Parsetree.class_field_kind - -> 'res) - method lift_Parsetree_module_binding : Parsetree.module_binding -> 'res= - (fun - { Parsetree.pmb_name = pmb_name; Parsetree.pmb_expr = pmb_expr; - Parsetree.pmb_attributes = pmb_attributes; - Parsetree.pmb_loc = pmb_loc } - -> - this#record "Ast_406.Parsetree.module_binding" - [("pmb_name", (this#lift_Asttypes_loc this#string pmb_name)); - ("pmb_expr", (this#lift_Parsetree_module_expr pmb_expr)); - ("pmb_attributes", - (this#lift_Parsetree_attributes pmb_attributes)); - ("pmb_loc", (this#lift_Location_t pmb_loc))] : Parsetree.module_binding - -> 'res) - method lift_Parsetree_module_expr : Parsetree.module_expr -> 'res= - (fun - { Parsetree.pmod_desc = pmod_desc; Parsetree.pmod_loc = pmod_loc; - Parsetree.pmod_attributes = pmod_attributes } - -> - this#record "Ast_406.Parsetree.module_expr" - [("pmod_desc", (this#lift_Parsetree_module_expr_desc pmod_desc)); - ("pmod_loc", (this#lift_Location_t pmod_loc)); - ("pmod_attributes", - (this#lift_Parsetree_attributes pmod_attributes))] : Parsetree.module_expr - -> - 'res) - method lift_Parsetree_module_expr_desc : - Parsetree.module_expr_desc -> 'res= - (function - | Parsetree.Pmod_ident x0 -> - this#constr "Ast_406.Parsetree.module_expr_desc" - ("Pmod_ident", - [this#lift_Asttypes_loc this#lift_Longident_t x0]) - | Parsetree.Pmod_structure x0 -> - this#constr "Ast_406.Parsetree.module_expr_desc" - ("Pmod_structure", [this#lift_Parsetree_structure x0]) - | Parsetree.Pmod_functor (x0, x1, x2) -> - this#constr "Ast_406.Parsetree.module_expr_desc" - ("Pmod_functor", - [this#lift_Asttypes_loc this#string x0; - this#lift_option this#lift_Parsetree_module_type x1; - this#lift_Parsetree_module_expr x2]) - | Parsetree.Pmod_apply (x0, x1) -> - this#constr "Ast_406.Parsetree.module_expr_desc" - ("Pmod_apply", - [this#lift_Parsetree_module_expr x0; - this#lift_Parsetree_module_expr x1]) - | Parsetree.Pmod_constraint (x0, x1) -> - this#constr "Ast_406.Parsetree.module_expr_desc" - ("Pmod_constraint", - [this#lift_Parsetree_module_expr x0; - this#lift_Parsetree_module_type x1]) - | Parsetree.Pmod_unpack x0 -> - this#constr "Ast_406.Parsetree.module_expr_desc" - ("Pmod_unpack", [this#lift_Parsetree_expression x0]) - | Parsetree.Pmod_extension x0 -> - this#constr "Ast_406.Parsetree.module_expr_desc" - ("Pmod_extension", [this#lift_Parsetree_extension x0]) : - Parsetree.module_expr_desc -> 'res) - method lift_Parsetree_module_type : Parsetree.module_type -> 'res= - (fun - { Parsetree.pmty_desc = pmty_desc; Parsetree.pmty_loc = pmty_loc; - Parsetree.pmty_attributes = pmty_attributes } - -> - this#record "Ast_406.Parsetree.module_type" - [("pmty_desc", (this#lift_Parsetree_module_type_desc pmty_desc)); - ("pmty_loc", (this#lift_Location_t pmty_loc)); - ("pmty_attributes", - (this#lift_Parsetree_attributes pmty_attributes))] : Parsetree.module_type - -> - 'res) - method lift_Parsetree_module_type_desc : - Parsetree.module_type_desc -> 'res= - (function - | Parsetree.Pmty_ident x0 -> - this#constr "Ast_406.Parsetree.module_type_desc" - ("Pmty_ident", - [this#lift_Asttypes_loc this#lift_Longident_t x0]) - | Parsetree.Pmty_signature x0 -> - this#constr "Ast_406.Parsetree.module_type_desc" - ("Pmty_signature", [this#lift_Parsetree_signature x0]) - | Parsetree.Pmty_functor (x0, x1, x2) -> - this#constr "Ast_406.Parsetree.module_type_desc" - ("Pmty_functor", - [this#lift_Asttypes_loc this#string x0; - this#lift_option this#lift_Parsetree_module_type x1; - this#lift_Parsetree_module_type x2]) - | Parsetree.Pmty_with (x0, x1) -> - this#constr "Ast_406.Parsetree.module_type_desc" - ("Pmty_with", - [this#lift_Parsetree_module_type x0; - this#list (List.map this#lift_Parsetree_with_constraint x1)]) - | Parsetree.Pmty_typeof x0 -> - this#constr "Ast_406.Parsetree.module_type_desc" - ("Pmty_typeof", [this#lift_Parsetree_module_expr x0]) - | Parsetree.Pmty_extension x0 -> - this#constr "Ast_406.Parsetree.module_type_desc" - ("Pmty_extension", [this#lift_Parsetree_extension x0]) - | Parsetree.Pmty_alias x0 -> - this#constr "Ast_406.Parsetree.module_type_desc" - ("Pmty_alias", - [this#lift_Asttypes_loc this#lift_Longident_t x0]) : Parsetree.module_type_desc - -> - 'res) - method lift_Parsetree_with_constraint : - Parsetree.with_constraint -> 'res= - (function - | Parsetree.Pwith_type (x0, x1) -> - this#constr "Ast_406.Parsetree.with_constraint" - ("Pwith_type", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_Parsetree_type_declaration x1]) - | Parsetree.Pwith_module (x0, x1) -> - this#constr "Ast_406.Parsetree.with_constraint" - ("Pwith_module", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_Asttypes_loc this#lift_Longident_t x1]) - | Parsetree.Pwith_typesubst (x0, x1) -> - this#constr "Ast_406.Parsetree.with_constraint" - ("Pwith_typesubst", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_Parsetree_type_declaration x1]) - | Parsetree.Pwith_modsubst (x0, x1) -> - this#constr "Ast_406.Parsetree.with_constraint" - ("Pwith_modsubst", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#lift_Asttypes_loc this#lift_Longident_t x1]) : Parsetree.with_constraint - -> - 'res) - method lift_Parsetree_signature : Parsetree.signature -> 'res= - (fun x -> this#list (List.map this#lift_Parsetree_signature_item x) : - Parsetree.signature -> 'res) - method lift_Parsetree_signature_item : Parsetree.signature_item -> 'res= - (fun { Parsetree.psig_desc = psig_desc; Parsetree.psig_loc = psig_loc } - -> - this#record "Ast_406.Parsetree.signature_item" - [("psig_desc", - (this#lift_Parsetree_signature_item_desc psig_desc)); - ("psig_loc", (this#lift_Location_t psig_loc))] : Parsetree.signature_item - -> 'res) - method lift_Parsetree_signature_item_desc : - Parsetree.signature_item_desc -> 'res= - (function - | Parsetree.Psig_value x0 -> - this#constr "Ast_406.Parsetree.signature_item_desc" - ("Psig_value", [this#lift_Parsetree_value_description x0]) - | Parsetree.Psig_type (x0, x1) -> - this#constr "Ast_406.Parsetree.signature_item_desc" - ("Psig_type", - [this#lift_Asttypes_rec_flag x0; - this#list (List.map this#lift_Parsetree_type_declaration x1)]) - | Parsetree.Psig_typext x0 -> - this#constr "Ast_406.Parsetree.signature_item_desc" - ("Psig_typext", [this#lift_Parsetree_type_extension x0]) - | Parsetree.Psig_exception x0 -> - this#constr "Ast_406.Parsetree.signature_item_desc" - ("Psig_exception", - [this#lift_Parsetree_extension_constructor x0]) - | Parsetree.Psig_module x0 -> - this#constr "Ast_406.Parsetree.signature_item_desc" - ("Psig_module", [this#lift_Parsetree_module_declaration x0]) - | Parsetree.Psig_recmodule x0 -> - this#constr "Ast_406.Parsetree.signature_item_desc" - ("Psig_recmodule", - [this#list - (List.map this#lift_Parsetree_module_declaration x0)]) - | Parsetree.Psig_modtype x0 -> - this#constr "Ast_406.Parsetree.signature_item_desc" - ("Psig_modtype", - [this#lift_Parsetree_module_type_declaration x0]) - | Parsetree.Psig_open x0 -> - this#constr "Ast_406.Parsetree.signature_item_desc" - ("Psig_open", [this#lift_Parsetree_open_description x0]) - | Parsetree.Psig_include x0 -> - this#constr "Ast_406.Parsetree.signature_item_desc" - ("Psig_include", [this#lift_Parsetree_include_description x0]) - | Parsetree.Psig_class x0 -> - this#constr "Ast_406.Parsetree.signature_item_desc" - ("Psig_class", - [this#list (List.map this#lift_Parsetree_class_description x0)]) - | Parsetree.Psig_class_type x0 -> - this#constr "Ast_406.Parsetree.signature_item_desc" - ("Psig_class_type", - [this#list - (List.map this#lift_Parsetree_class_type_declaration x0)]) - | Parsetree.Psig_attribute x0 -> - this#constr "Ast_406.Parsetree.signature_item_desc" - ("Psig_attribute", [this#lift_Parsetree_attribute x0]) - | Parsetree.Psig_extension (x0, x1) -> - this#constr "Ast_406.Parsetree.signature_item_desc" - ("Psig_extension", - [this#lift_Parsetree_extension x0; - this#lift_Parsetree_attributes x1]) : Parsetree.signature_item_desc - -> 'res) - method lift_Parsetree_class_type_declaration : - Parsetree.class_type_declaration -> 'res= - (fun x -> - this#lift_Parsetree_class_infos this#lift_Parsetree_class_type x : - Parsetree.class_type_declaration -> 'res) - method lift_Parsetree_class_description : - Parsetree.class_description -> 'res= - (fun x -> - this#lift_Parsetree_class_infos this#lift_Parsetree_class_type x : - Parsetree.class_description -> 'res) - method lift_Parsetree_class_type : Parsetree.class_type -> 'res= - (fun - { Parsetree.pcty_desc = pcty_desc; Parsetree.pcty_loc = pcty_loc; - Parsetree.pcty_attributes = pcty_attributes } - -> - this#record "Ast_406.Parsetree.class_type" - [("pcty_desc", (this#lift_Parsetree_class_type_desc pcty_desc)); - ("pcty_loc", (this#lift_Location_t pcty_loc)); - ("pcty_attributes", - (this#lift_Parsetree_attributes pcty_attributes))] : Parsetree.class_type - -> - 'res) - method lift_Parsetree_class_type_desc : - Parsetree.class_type_desc -> 'res= - (function - | Parsetree.Pcty_constr (x0, x1) -> - this#constr "Ast_406.Parsetree.class_type_desc" - ("Pcty_constr", - [this#lift_Asttypes_loc this#lift_Longident_t x0; - this#list (List.map this#lift_Parsetree_core_type x1)]) - | Parsetree.Pcty_signature x0 -> - this#constr "Ast_406.Parsetree.class_type_desc" - ("Pcty_signature", [this#lift_Parsetree_class_signature x0]) - | Parsetree.Pcty_arrow (x0, x1, x2) -> - this#constr "Ast_406.Parsetree.class_type_desc" - ("Pcty_arrow", - [this#lift_Asttypes_arg_label x0; - this#lift_Parsetree_core_type x1; - this#lift_Parsetree_class_type x2]) - | Parsetree.Pcty_extension x0 -> - this#constr "Ast_406.Parsetree.class_type_desc" - ("Pcty_extension", [this#lift_Parsetree_extension x0]) - | Parsetree.Pcty_open (x0, x1, x2) -> - this#constr "Ast_406.Parsetree.class_type_desc" - ("Pcty_open", - [this#lift_Asttypes_override_flag x0; - this#lift_Asttypes_loc this#lift_Longident_t x1; - this#lift_Parsetree_class_type x2]) : Parsetree.class_type_desc - -> 'res) - method lift_Parsetree_class_signature : - Parsetree.class_signature -> 'res= - (fun - { Parsetree.pcsig_self = pcsig_self; - Parsetree.pcsig_fields = pcsig_fields } - -> - this#record "Ast_406.Parsetree.class_signature" - [("pcsig_self", (this#lift_Parsetree_core_type pcsig_self)); - ("pcsig_fields", - (this#list - (List.map this#lift_Parsetree_class_type_field pcsig_fields)))] : - Parsetree.class_signature -> 'res) - method lift_Parsetree_class_type_field : - Parsetree.class_type_field -> 'res= - (fun - { Parsetree.pctf_desc = pctf_desc; Parsetree.pctf_loc = pctf_loc; - Parsetree.pctf_attributes = pctf_attributes } - -> - this#record "Ast_406.Parsetree.class_type_field" - [("pctf_desc", - (this#lift_Parsetree_class_type_field_desc pctf_desc)); - ("pctf_loc", (this#lift_Location_t pctf_loc)); - ("pctf_attributes", - (this#lift_Parsetree_attributes pctf_attributes))] : Parsetree.class_type_field - -> - 'res) - method lift_Parsetree_class_type_field_desc : - Parsetree.class_type_field_desc -> 'res= - (function - | Parsetree.Pctf_inherit x0 -> - this#constr "Ast_406.Parsetree.class_type_field_desc" - ("Pctf_inherit", [this#lift_Parsetree_class_type x0]) - | Parsetree.Pctf_val x0 -> - this#constr "Ast_406.Parsetree.class_type_field_desc" - ("Pctf_val", - [(let (x0, x1, x2, x3) = x0 in - this#tuple - [this#lift_Asttypes_loc this#lift_Asttypes_label x0; - this#lift_Asttypes_mutable_flag x1; - this#lift_Asttypes_virtual_flag x2; - this#lift_Parsetree_core_type x3])]) - | Parsetree.Pctf_method x0 -> - this#constr "Ast_406.Parsetree.class_type_field_desc" - ("Pctf_method", - [(let (x0, x1, x2, x3) = x0 in - this#tuple - [this#lift_Asttypes_loc this#lift_Asttypes_label x0; - this#lift_Asttypes_private_flag x1; - this#lift_Asttypes_virtual_flag x2; - this#lift_Parsetree_core_type x3])]) - | Parsetree.Pctf_constraint x0 -> - this#constr "Ast_406.Parsetree.class_type_field_desc" - ("Pctf_constraint", - [(let (x0, x1) = x0 in - this#tuple - [this#lift_Parsetree_core_type x0; - this#lift_Parsetree_core_type x1])]) - | Parsetree.Pctf_attribute x0 -> - this#constr "Ast_406.Parsetree.class_type_field_desc" - ("Pctf_attribute", [this#lift_Parsetree_attribute x0]) - | Parsetree.Pctf_extension x0 -> - this#constr "Ast_406.Parsetree.class_type_field_desc" - ("Pctf_extension", [this#lift_Parsetree_extension x0]) : - Parsetree.class_type_field_desc -> 'res) - method lift_Parsetree_extension : Parsetree.extension -> 'res= - (fun x -> - let (x0, x1) = x in - this#tuple - [this#lift_Asttypes_loc this#string x0; - this#lift_Parsetree_payload x1] : Parsetree.extension -> 'res) - method lift_Parsetree_class_infos : - 'f0 . ('f0 -> 'res) -> 'f0 Parsetree.class_infos -> 'res= fun (type f0) - -> - (fun f0 -> - fun - { Parsetree.pci_virt = pci_virt; - Parsetree.pci_params = pci_params; - Parsetree.pci_name = pci_name; Parsetree.pci_expr = pci_expr; - Parsetree.pci_loc = pci_loc; - Parsetree.pci_attributes = pci_attributes } - -> - this#record "Ast_406.Parsetree.class_infos" - [("pci_virt", (this#lift_Asttypes_virtual_flag pci_virt)); - ("pci_params", - (this#list - (List.map - (fun x -> - let (x0, x1) = x in - this#tuple - [this#lift_Parsetree_core_type x0; - this#lift_Asttypes_variance x1]) pci_params))); - ("pci_name", (this#lift_Asttypes_loc this#string pci_name)); - ("pci_expr", (f0 pci_expr)); - ("pci_loc", (this#lift_Location_t pci_loc)); - ("pci_attributes", - (this#lift_Parsetree_attributes pci_attributes))] : (f0 -> - 'res) -> - f0 - Parsetree.class_infos - -> - 'res) - method lift_Asttypes_virtual_flag : Asttypes.virtual_flag -> 'res= - (function - | Asttypes.Virtual -> - this#constr "Ast_406.Asttypes.virtual_flag" ("Virtual", []) - | Asttypes.Concrete -> - this#constr "Ast_406.Asttypes.virtual_flag" ("Concrete", []) : Asttypes.virtual_flag - -> - 'res) - method lift_Parsetree_include_description : - Parsetree.include_description -> 'res= - (fun x -> - this#lift_Parsetree_include_infos this#lift_Parsetree_module_type x : - Parsetree.include_description -> 'res) - method lift_Parsetree_include_infos : - 'f0 . ('f0 -> 'res) -> 'f0 Parsetree.include_infos -> 'res= fun (type - f0) -> - (fun f0 -> - fun - { Parsetree.pincl_mod = pincl_mod; - Parsetree.pincl_loc = pincl_loc; - Parsetree.pincl_attributes = pincl_attributes } - -> - this#record "Ast_406.Parsetree.include_infos" - [("pincl_mod", (f0 pincl_mod)); - ("pincl_loc", (this#lift_Location_t pincl_loc)); - ("pincl_attributes", - (this#lift_Parsetree_attributes pincl_attributes))] : - (f0 -> 'res) -> f0 Parsetree.include_infos -> 'res) - method lift_Parsetree_open_description : - Parsetree.open_description -> 'res= - (fun - { Parsetree.popen_lid = popen_lid; - Parsetree.popen_override = popen_override; - Parsetree.popen_loc = popen_loc; - Parsetree.popen_attributes = popen_attributes } - -> - this#record "Ast_406.Parsetree.open_description" - [("popen_lid", - (this#lift_Asttypes_loc this#lift_Longident_t popen_lid)); - ("popen_override", - (this#lift_Asttypes_override_flag popen_override)); - ("popen_loc", (this#lift_Location_t popen_loc)); - ("popen_attributes", - (this#lift_Parsetree_attributes popen_attributes))] : Parsetree.open_description - -> - 'res) - method lift_Asttypes_override_flag : Asttypes.override_flag -> 'res= - (function - | Asttypes.Override -> - this#constr "Ast_406.Asttypes.override_flag" ("Override", []) - | Asttypes.Fresh -> this#constr "Ast_406.Asttypes.override_flag" ("Fresh", []) : - Asttypes.override_flag -> 'res) - method lift_Parsetree_module_type_declaration : - Parsetree.module_type_declaration -> 'res= - (fun - { Parsetree.pmtd_name = pmtd_name; Parsetree.pmtd_type = pmtd_type; - Parsetree.pmtd_attributes = pmtd_attributes; - Parsetree.pmtd_loc = pmtd_loc } - -> - this#record "Ast_406.Parsetree.module_type_declaration" - [("pmtd_name", (this#lift_Asttypes_loc this#string pmtd_name)); - ("pmtd_type", - (this#lift_option this#lift_Parsetree_module_type pmtd_type)); - ("pmtd_attributes", - (this#lift_Parsetree_attributes pmtd_attributes)); - ("pmtd_loc", (this#lift_Location_t pmtd_loc))] : Parsetree.module_type_declaration - -> 'res) - method lift_Parsetree_module_declaration : - Parsetree.module_declaration -> 'res= - (fun - { Parsetree.pmd_name = pmd_name; Parsetree.pmd_type = pmd_type; - Parsetree.pmd_attributes = pmd_attributes; - Parsetree.pmd_loc = pmd_loc } - -> - this#record "Ast_406.Parsetree.module_declaration" - [("pmd_name", (this#lift_Asttypes_loc this#string pmd_name)); - ("pmd_type", (this#lift_Parsetree_module_type pmd_type)); - ("pmd_attributes", - (this#lift_Parsetree_attributes pmd_attributes)); - ("pmd_loc", (this#lift_Location_t pmd_loc))] : Parsetree.module_declaration - -> 'res) - method lift_Parsetree_type_extension : Parsetree.type_extension -> 'res= - (fun - { Parsetree.ptyext_path = ptyext_path; - Parsetree.ptyext_params = ptyext_params; - Parsetree.ptyext_constructors = ptyext_constructors; - Parsetree.ptyext_private = ptyext_private; - Parsetree.ptyext_attributes = ptyext_attributes } - -> - this#record "Ast_406.Parsetree.type_extension" - [("ptyext_path", - (this#lift_Asttypes_loc this#lift_Longident_t ptyext_path)); - ("ptyext_params", - (this#list - (List.map - (fun x -> - let (x0, x1) = x in - this#tuple - [this#lift_Parsetree_core_type x0; - this#lift_Asttypes_variance x1]) ptyext_params))); - ("ptyext_constructors", - (this#list - (List.map this#lift_Parsetree_extension_constructor - ptyext_constructors))); - ("ptyext_private", - (this#lift_Asttypes_private_flag ptyext_private)); - ("ptyext_attributes", - (this#lift_Parsetree_attributes ptyext_attributes))] : Parsetree.type_extension - -> - 'res) - method lift_Parsetree_extension_constructor : - Parsetree.extension_constructor -> 'res= - (fun - { Parsetree.pext_name = pext_name; Parsetree.pext_kind = pext_kind; - Parsetree.pext_loc = pext_loc; - Parsetree.pext_attributes = pext_attributes } - -> - this#record "Ast_406.Parsetree.extension_constructor" - [("pext_name", (this#lift_Asttypes_loc this#string pext_name)); - ("pext_kind", - (this#lift_Parsetree_extension_constructor_kind pext_kind)); - ("pext_loc", (this#lift_Location_t pext_loc)); - ("pext_attributes", - (this#lift_Parsetree_attributes pext_attributes))] : Parsetree.extension_constructor - -> - 'res) - method lift_Parsetree_extension_constructor_kind : - Parsetree.extension_constructor_kind -> 'res= - (function - | Parsetree.Pext_decl (x0, x1) -> - this#constr "Ast_406.Parsetree.extension_constructor_kind" - ("Pext_decl", - [this#lift_Parsetree_constructor_arguments x0; - this#lift_option this#lift_Parsetree_core_type x1]) - | Parsetree.Pext_rebind x0 -> - this#constr "Ast_406.Parsetree.extension_constructor_kind" - ("Pext_rebind", - [this#lift_Asttypes_loc this#lift_Longident_t x0]) : Parsetree.extension_constructor_kind - -> - 'res) - method lift_Parsetree_type_declaration : - Parsetree.type_declaration -> 'res= - (fun - { Parsetree.ptype_name = ptype_name; - Parsetree.ptype_params = ptype_params; - Parsetree.ptype_cstrs = ptype_cstrs; - Parsetree.ptype_kind = ptype_kind; - Parsetree.ptype_private = ptype_private; - Parsetree.ptype_manifest = ptype_manifest; - Parsetree.ptype_attributes = ptype_attributes; - Parsetree.ptype_loc = ptype_loc } - -> - this#record "Ast_406.Parsetree.type_declaration" - [("ptype_name", (this#lift_Asttypes_loc this#string ptype_name)); - ("ptype_params", - (this#list - (List.map - (fun x -> - let (x0, x1) = x in - this#tuple - [this#lift_Parsetree_core_type x0; - this#lift_Asttypes_variance x1]) ptype_params))); - ("ptype_cstrs", - (this#list - (List.map - (fun x -> - let (x0, x1, x2) = x in - this#tuple - [this#lift_Parsetree_core_type x0; - this#lift_Parsetree_core_type x1; - this#lift_Location_t x2]) ptype_cstrs))); - ("ptype_kind", (this#lift_Parsetree_type_kind ptype_kind)); - ("ptype_private", (this#lift_Asttypes_private_flag ptype_private)); - ("ptype_manifest", - (this#lift_option this#lift_Parsetree_core_type ptype_manifest)); - ("ptype_attributes", - (this#lift_Parsetree_attributes ptype_attributes)); - ("ptype_loc", (this#lift_Location_t ptype_loc))] : Parsetree.type_declaration - -> 'res) - method lift_Asttypes_private_flag : Asttypes.private_flag -> 'res= - (function - | Asttypes.Private -> - this#constr "Ast_406.Asttypes.private_flag" ("Private", []) - | Asttypes.Public -> - this#constr "Ast_406.Asttypes.private_flag" ("Public", []) : Asttypes.private_flag - -> - 'res) - method lift_Parsetree_type_kind : Parsetree.type_kind -> 'res= - (function - | Parsetree.Ptype_abstract -> - this#constr "Ast_406.Parsetree.type_kind" ("Ptype_abstract", []) - | Parsetree.Ptype_variant x0 -> - this#constr "Ast_406.Parsetree.type_kind" - ("Ptype_variant", - [this#list - (List.map this#lift_Parsetree_constructor_declaration x0)]) - | Parsetree.Ptype_record x0 -> - this#constr "Ast_406.Parsetree.type_kind" - ("Ptype_record", - [this#list (List.map this#lift_Parsetree_label_declaration x0)]) - | Parsetree.Ptype_open -> - this#constr "Ast_406.Parsetree.type_kind" ("Ptype_open", []) : Parsetree.type_kind - -> - 'res) - method lift_Parsetree_constructor_declaration : - Parsetree.constructor_declaration -> 'res= - (fun - { Parsetree.pcd_name = pcd_name; Parsetree.pcd_args = pcd_args; - Parsetree.pcd_res = pcd_res; Parsetree.pcd_loc = pcd_loc; - Parsetree.pcd_attributes = pcd_attributes } - -> - this#record "Ast_406.Parsetree.constructor_declaration" - [("pcd_name", (this#lift_Asttypes_loc this#string pcd_name)); - ("pcd_args", (this#lift_Parsetree_constructor_arguments pcd_args)); - ("pcd_res", - (this#lift_option this#lift_Parsetree_core_type pcd_res)); - ("pcd_loc", (this#lift_Location_t pcd_loc)); - ("pcd_attributes", - (this#lift_Parsetree_attributes pcd_attributes))] : Parsetree.constructor_declaration - -> - 'res) - method lift_Parsetree_constructor_arguments : - Parsetree.constructor_arguments -> 'res= - (function - | Parsetree.Pcstr_tuple x0 -> - this#constr "Ast_406.Parsetree.constructor_arguments" - ("Pcstr_tuple", - [this#list (List.map this#lift_Parsetree_core_type x0)]) - | Parsetree.Pcstr_record x0 -> - this#constr "Ast_406.Parsetree.constructor_arguments" - ("Pcstr_record", - [this#list (List.map this#lift_Parsetree_label_declaration x0)]) : - Parsetree.constructor_arguments -> 'res) - method lift_Parsetree_label_declaration : - Parsetree.label_declaration -> 'res= - (fun - { Parsetree.pld_name = pld_name; - Parsetree.pld_mutable = pld_mutable; - Parsetree.pld_type = pld_type; Parsetree.pld_loc = pld_loc; - Parsetree.pld_attributes = pld_attributes } - -> - this#record "Ast_406.Parsetree.label_declaration" - [("pld_name", (this#lift_Asttypes_loc this#string pld_name)); - ("pld_mutable", (this#lift_Asttypes_mutable_flag pld_mutable)); - ("pld_type", (this#lift_Parsetree_core_type pld_type)); - ("pld_loc", (this#lift_Location_t pld_loc)); - ("pld_attributes", - (this#lift_Parsetree_attributes pld_attributes))] : Parsetree.label_declaration - -> - 'res) - method lift_Asttypes_mutable_flag : Asttypes.mutable_flag -> 'res= - (function - | Asttypes.Immutable -> - this#constr "Ast_406.Asttypes.mutable_flag" ("Immutable", []) - | Asttypes.Mutable -> - this#constr "Ast_406.Asttypes.mutable_flag" ("Mutable", []) : Asttypes.mutable_flag - -> - 'res) - method lift_Asttypes_variance : Asttypes.variance -> 'res= - (function - | Asttypes.Covariant -> - this#constr "Ast_406.Asttypes.variance" ("Covariant", []) - | Asttypes.Contravariant -> - this#constr "Ast_406.Asttypes.variance" ("Contravariant", []) - | Asttypes.Invariant -> - this#constr "Ast_406.Asttypes.variance" ("Invariant", []) : Asttypes.variance - -> 'res) - method lift_Parsetree_value_description : - Parsetree.value_description -> 'res= - (fun - { Parsetree.pval_name = pval_name; Parsetree.pval_type = pval_type; - Parsetree.pval_prim = pval_prim; - Parsetree.pval_attributes = pval_attributes; - Parsetree.pval_loc = pval_loc } - -> - this#record "Ast_406.Parsetree.value_description" - [("pval_name", (this#lift_Asttypes_loc this#string pval_name)); - ("pval_type", (this#lift_Parsetree_core_type pval_type)); - ("pval_prim", (this#list (List.map this#string pval_prim))); - ("pval_attributes", - (this#lift_Parsetree_attributes pval_attributes)); - ("pval_loc", (this#lift_Location_t pval_loc))] : Parsetree.value_description - -> 'res) - method lift_Asttypes_arg_label : Asttypes.arg_label -> 'res= - (function - | Asttypes.Nolabel -> this#constr "Ast_406.Asttypes.arg_label" ("Nolabel", []) - | Asttypes.Labelled x0 -> - this#constr "Ast_406.Asttypes.arg_label" ("Labelled", [this#string x0]) - | Asttypes.Optional x0 -> - this#constr "Ast_406.Asttypes.arg_label" ("Optional", [this#string x0]) : - Asttypes.arg_label -> 'res) - method lift_Asttypes_closed_flag : Asttypes.closed_flag -> 'res= - (function - | Asttypes.Closed -> this#constr "Ast_406.Asttypes.closed_flag" ("Closed", []) - | Asttypes.Open -> this#constr "Ast_406.Asttypes.closed_flag" ("Open", []) : - Asttypes.closed_flag -> 'res) - method lift_Asttypes_label : Asttypes.label -> 'res= - (this#string : Asttypes.label -> 'res) - method lift_Asttypes_rec_flag : Asttypes.rec_flag -> 'res= - (function - | Asttypes.Nonrecursive -> - this#constr "Ast_406.Asttypes.rec_flag" ("Nonrecursive", []) - | Asttypes.Recursive -> - this#constr "Ast_406.Asttypes.rec_flag" ("Recursive", []) : Asttypes.rec_flag - -> 'res) - method lift_Parsetree_constant : Parsetree.constant -> 'res= - (function - | Parsetree.Pconst_integer (x0, x1) -> - this#constr "Ast_406.Parsetree.constant" - ("Pconst_integer", - [this#string x0; this#lift_option this#char x1]) - | Parsetree.Pconst_char x0 -> - this#constr "Ast_406.Parsetree.constant" ("Pconst_char", [this#char x0]) - | Parsetree.Pconst_string (x0, x1) -> - this#constr "Ast_406.Parsetree.constant" - ("Pconst_string", - [this#string x0; this#lift_option this#string x1]) - | Parsetree.Pconst_float (x0, x1) -> - this#constr "Ast_406.Parsetree.constant" - ("Pconst_float", - [this#string x0; this#lift_option this#char x1]) : Parsetree.constant - -> - 'res) - method lift_option : 'f0 . ('f0 -> 'res) -> 'f0 option -> 'res= fun (type - f0) -> - (fun f0 -> - function - | None -> this#constr "option" ("None", []) - | Some x0 -> this#constr "option" ("Some", [f0 x0]) : (f0 -> 'res) - -> - f0 option -> - 'res) - method lift_Longident_t : Longident.t -> 'res= - (function - | Longident.Lident x0 -> - this#constr "Ast_406.Longident.t" ("Lident", [this#string x0]) - | Longident.Ldot (x0, x1) -> - this#constr "Ast_406.Longident.t" - ("Ldot", [this#lift_Longident_t x0; this#string x1]) - | Longident.Lapply (x0, x1) -> - this#constr "Ast_406.Longident.t" - ("Lapply", [this#lift_Longident_t x0; this#lift_Longident_t x1]) : - Longident.t -> 'res) - method lift_Asttypes_loc : - 'f0 . ('f0 -> 'res) -> 'f0 Asttypes.loc -> 'res= fun (type f0) -> - (fun f0 -> - fun { Asttypes.txt = txt; Asttypes.loc = loc } -> - this#record "Ast_406.Asttypes.loc" - [("txt", (f0 txt)); ("loc", (this#lift_Location_t loc))] : - (f0 -> 'res) -> f0 Asttypes.loc -> 'res) - method lift_Location_t : Location.t -> 'res= - (fun - { Location.loc_start = loc_start; Location.loc_end = loc_end; - Location.loc_ghost = loc_ghost } - -> - this#record "Ast_406.Location.t" - [("loc_start", (this#lift_Lexing_position loc_start)); - ("loc_end", (this#lift_Lexing_position loc_end)); - ("loc_ghost", (this#lift_bool loc_ghost))] : Location.t -> 'res) - method lift_bool : bool -> 'res= - (function - | false -> this#constr "bool" ("false", []) - | true -> this#constr "bool" ("true", []) : bool -> 'res) - method lift_Lexing_position : Lexing.position -> 'res= - (fun - { Lexing.pos_fname = pos_fname; Lexing.pos_lnum = pos_lnum; - Lexing.pos_bol = pos_bol; Lexing.pos_cnum = pos_cnum } - -> - this#record "Lexing.position" - [("pos_fname", (this#string pos_fname)); - ("pos_lnum", (this#int pos_lnum)); - ("pos_bol", (this#int pos_bol)); - ("pos_cnum", (this#int pos_cnum))] : Lexing.position -> 'res) - end diff --git a/ppx_tools_versioned.5.2/ast_mapper_class_402.ml b/ppx_tools_versioned.5.2/ast_mapper_class_402.ml deleted file mode 100644 index 4c8dda0..0000000 --- a/ppx_tools_versioned.5.2/ast_mapper_class_402.ml +++ /dev/null @@ -1,576 +0,0 @@ -open Ast_402 - -(* This file is part of the ppx_tools package. It is released *) -(* under the terms of the MIT license (see LICENSE file). *) -(* Copyright 2013 Alain Frisch and LexiFi *) - -(** Class-based customizable mapper *) - -open Parsetree -open Asttypes -open Ast_helper - -let map_fst f (x, y) = (f x, y) -let map_snd f (x, y) = (x, f y) -let map_tuple f1 f2 (x, y) = (f1 x, f2 y) -let map_tuple3 f1 f2 f3 (x, y, z) = (f1 x, f2 y, f3 z) -let map_opt f = function None -> None | Some x -> Some (f x) - -let map_loc sub {loc; txt} = {loc = sub # location loc; txt} - -module T = struct - (* Type expressions for the core language *) - - let row_field sub = function - | Rtag (l, attrs, b, tl) -> - Rtag (l, sub # attributes attrs, b, List.map (sub # typ) tl) - | Rinherit t -> Rinherit (sub # typ t) - - let map sub {ptyp_desc = desc; ptyp_loc = loc; ptyp_attributes = attrs} = - let open Typ in - let loc = sub # location loc in - let attrs = sub # attributes attrs in - match desc with - | Ptyp_any -> any ~loc ~attrs () - | Ptyp_var s -> var ~loc ~attrs s - | Ptyp_arrow (lab, t1, t2) -> - arrow ~loc ~attrs lab (sub # typ t1) (sub # typ t2) - | Ptyp_tuple tyl -> tuple ~loc ~attrs (List.map (sub # typ) tyl) - | Ptyp_constr (lid, tl) -> - constr ~loc ~attrs (map_loc sub lid) (List.map (sub # typ) tl) - | Ptyp_object (l, o) -> - let f (s, a, t) = (s, sub # attributes a, sub # typ t) in - object_ ~loc ~attrs (List.map f l) o - | Ptyp_class (lid, tl) -> - class_ ~loc ~attrs (map_loc sub lid) (List.map (sub # typ) tl) - | Ptyp_alias (t, s) -> alias ~loc ~attrs (sub # typ t) s - | Ptyp_variant (rl, b, ll) -> - variant ~loc ~attrs (List.map (row_field sub) rl) b ll - | Ptyp_poly (sl, t) -> poly ~loc ~attrs sl (sub # typ t) - | Ptyp_package (lid, l) -> - package ~loc ~attrs (map_loc sub lid) - (List.map (map_tuple (map_loc sub) (sub # typ)) l) - | Ptyp_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_type_declaration sub - {ptype_name; ptype_params; ptype_cstrs; - ptype_kind; - ptype_private; - ptype_manifest; - ptype_attributes; - ptype_loc} = - Type.mk (map_loc sub ptype_name) - ~params:(List.map (map_fst (sub # typ)) ptype_params) - ~priv:ptype_private - ~cstrs:(List.map (map_tuple3 (sub # typ) (sub # typ) (sub # location)) - ptype_cstrs) - ~kind:(sub # type_kind ptype_kind) - ?manifest:(map_opt (sub # typ) ptype_manifest) - ~loc:(sub # location ptype_loc) - ~attrs:(sub # attributes ptype_attributes) - - let map_type_kind sub = function - | Ptype_abstract -> Ptype_abstract - | Ptype_variant l -> - Ptype_variant (List.map (sub # constructor_declaration) l) - | Ptype_record l -> Ptype_record (List.map (sub # label_declaration) l) - | Ptype_open -> Ptype_open - - let map_type_extension sub - {ptyext_path; ptyext_params; - ptyext_constructors; - ptyext_private; - ptyext_attributes} = - Te.mk - (map_loc sub ptyext_path) - (List.map (sub # extension_constructor) ptyext_constructors) - ~params:(List.map (map_fst (sub # typ)) ptyext_params) - ~priv:ptyext_private - ~attrs:(sub # attributes ptyext_attributes) - - let map_extension_constructor_kind sub = function - Pext_decl(ctl, cto) -> - Pext_decl(List.map (sub # typ) ctl, map_opt (sub # typ) cto) - | Pext_rebind li -> - Pext_rebind (map_loc sub li) - - let map_extension_constructor sub - {pext_name; - pext_kind; - pext_loc; - pext_attributes} = - Te.constructor - (map_loc sub pext_name) - (map_extension_constructor_kind sub pext_kind) - ~loc:(sub # location pext_loc) - ~attrs:(sub # attributes pext_attributes) - - -end - -module CT = struct - (* Type expressions for the class language *) - - let map sub {pcty_loc = loc; pcty_desc = desc; pcty_attributes = attrs} = - let open Cty in - let loc = sub # location loc in - match desc with - | Pcty_constr (lid, tys) -> - constr ~loc ~attrs (map_loc sub lid) (List.map (sub # typ) tys) - | Pcty_signature x -> signature ~loc ~attrs (sub # class_signature x) - | Pcty_arrow (lab, t, ct) -> - arrow ~loc ~attrs lab (sub # typ t) (sub # class_type ct) - | Pcty_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_field sub {pctf_desc = desc; pctf_loc = loc; pctf_attributes = attrs} - = - let open Ctf in - let loc = sub # location loc in - match desc with - | Pctf_inherit ct -> inherit_ ~loc ~attrs (sub # class_type ct) - | Pctf_val (s, m, v, t) -> val_ ~loc ~attrs s m v (sub # typ t) - | Pctf_method (s, p, v, t) -> method_ ~loc ~attrs s p v (sub # typ t) - | Pctf_constraint (t1, t2) -> - constraint_ ~loc ~attrs (sub # typ t1) (sub # typ t2) - | Pctf_attribute x -> attribute ~loc (sub # attribute x) - | Pctf_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_signature sub {pcsig_self; pcsig_fields} = - Csig.mk - (sub # typ pcsig_self) - (List.map (sub # class_type_field) pcsig_fields) -end - -module MT = struct - (* Type expressions for the module language *) - - let map sub {pmty_desc = desc; pmty_loc = loc; pmty_attributes = attrs} = - let open Mty in - let loc = sub # location loc in - let attrs = sub # attributes attrs in - match desc with - | Pmty_ident s -> ident ~loc ~attrs (map_loc sub s) - | Pmty_alias s -> alias ~loc ~attrs (map_loc sub s) - | Pmty_signature sg -> signature ~loc ~attrs (sub # signature sg) - | Pmty_functor (s, mt1, mt2) -> - functor_ ~loc ~attrs (map_loc sub s) - (map_opt (sub # module_type) mt1) - (sub # module_type mt2) - | Pmty_with (mt, l) -> - with_ ~loc ~attrs (sub # module_type mt) - (List.map (sub # with_constraint) l) - | Pmty_typeof me -> typeof_ ~loc ~attrs (sub # module_expr me) - | Pmty_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_with_constraint sub = function - | Pwith_type (lid, d) -> - Pwith_type (map_loc sub lid, sub # type_declaration d) - | Pwith_module (lid, lid2) -> - Pwith_module (map_loc sub lid, map_loc sub lid2) - | Pwith_typesubst d -> Pwith_typesubst (sub # type_declaration d) - | Pwith_modsubst (s, lid) -> - Pwith_modsubst (map_loc sub s, map_loc sub lid) - - let map_signature_item sub {psig_desc = desc; psig_loc = loc} = - let open Sig in - let loc = sub # location loc in - match desc with - | Psig_value vd -> value ~loc (sub # value_description vd) - | Psig_type l -> type_ ~loc (List.map (sub # type_declaration) l) - | Psig_typext te -> type_extension ~loc (sub # type_extension te) - | Psig_exception ed -> exception_ ~loc (sub # extension_constructor ed) - | Psig_module x -> module_ ~loc (sub # module_declaration x) - | Psig_recmodule l -> - rec_module ~loc (List.map (sub # module_declaration) l) - | Psig_modtype x -> modtype ~loc (sub # module_type_declaration x) - | Psig_open od -> open_ ~loc (sub # open_description od) - | Psig_include x -> include_ ~loc (sub # include_description x) - | Psig_class l -> class_ ~loc (List.map (sub # class_description) l) - | Psig_class_type l -> - class_type ~loc (List.map (sub # class_type_declaration) l) - | Psig_extension (x, attrs) -> - extension ~loc (sub # extension x) ~attrs:(sub # attributes attrs) - | Psig_attribute x -> attribute ~loc (sub # attribute x) -end - - -module M = struct - (* Value expressions for the module language *) - - let map sub {pmod_loc = loc; pmod_desc = desc; pmod_attributes = attrs} = - let open Mod in - let loc = sub # location loc in - let attrs = sub # attributes attrs in - match desc with - | Pmod_ident x -> ident ~loc ~attrs (map_loc sub x) - | Pmod_structure str -> structure ~loc ~attrs (sub # structure str) - | Pmod_functor (arg, arg_ty, body) -> - functor_ ~loc ~attrs (map_loc sub arg) - (map_opt (sub # module_type) arg_ty) - (sub # module_expr body) - | Pmod_apply (m1, m2) -> - apply ~loc ~attrs (sub # module_expr m1) (sub # module_expr m2) - | Pmod_constraint (m, mty) -> - constraint_ ~loc ~attrs (sub # module_expr m) (sub # module_type mty) - | Pmod_unpack e -> unpack ~loc ~attrs (sub # expr e) - | Pmod_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_structure_item sub {pstr_loc = loc; pstr_desc = desc} = - let open Str in - let loc = sub # location loc in - match desc with - | Pstr_eval (x, attrs) -> - eval ~loc ~attrs:(sub # attributes attrs) (sub # expr x) - | Pstr_value (r, vbs) -> value ~loc r (List.map (sub # value_binding) vbs) - | Pstr_primitive vd -> primitive ~loc (sub # value_description vd) - | Pstr_type l -> type_ ~loc (List.map (sub # type_declaration) l) - | Pstr_typext te -> type_extension ~loc (sub # type_extension te) - | Pstr_exception ed -> exception_ ~loc (sub # extension_constructor ed) - | Pstr_module x -> module_ ~loc (sub # module_binding x) - | Pstr_recmodule l -> rec_module ~loc (List.map (sub # module_binding) l) - | Pstr_modtype x -> modtype ~loc (sub # module_type_declaration x) - | Pstr_open od -> open_ ~loc (sub # open_description od) - | Pstr_class l -> class_ ~loc (List.map (sub # class_declaration) l) - | Pstr_class_type l -> - class_type ~loc (List.map (sub # class_type_declaration) l) - | Pstr_include x -> include_ ~loc (sub # include_declaration x) - | Pstr_extension (x, attrs) -> - extension ~loc (sub # extension x) ~attrs:(sub # attributes attrs) - | Pstr_attribute x -> attribute ~loc (sub # attribute x) -end - -module E = struct - (* Value expressions for the core language *) - - let map sub {pexp_loc = loc; pexp_desc = desc; pexp_attributes = attrs} = - let open Exp in - let loc = sub # location loc in - let attrs = sub # attributes attrs in - match desc with - | Pexp_ident x -> ident ~loc ~attrs (map_loc sub x) - | Pexp_constant x -> constant ~loc ~attrs x - | Pexp_let (r, vbs, e) -> - let_ ~loc ~attrs r (List.map (sub # value_binding) vbs) (sub # expr e) - | Pexp_fun (lab, def, p, e) -> - fun_ ~loc ~attrs lab (map_opt (sub # expr) def) (sub # pat p) - (sub # expr e) - | Pexp_function pel -> function_ ~loc ~attrs (sub # cases pel) - | Pexp_apply (e, l) -> - apply ~loc ~attrs (sub # expr e) (List.map (map_snd (sub # expr)) l) - | Pexp_match (e, pel) -> match_ ~loc ~attrs (sub # expr e) (sub # cases pel) - | Pexp_try (e, pel) -> try_ ~loc ~attrs (sub # expr e) (sub # cases pel) - | Pexp_tuple el -> tuple ~loc ~attrs (List.map (sub # expr) el) - | Pexp_construct (lid, arg) -> - construct ~loc ~attrs (map_loc sub lid) (map_opt (sub # expr) arg) - | Pexp_variant (lab, eo) -> - variant ~loc ~attrs lab (map_opt (sub # expr) eo) - | Pexp_record (l, eo) -> - record ~loc ~attrs (List.map (map_tuple (map_loc sub) (sub # expr)) l) - (map_opt (sub # expr) eo) - | Pexp_field (e, lid) -> field ~loc ~attrs (sub # expr e) (map_loc sub lid) - | Pexp_setfield (e1, lid, e2) -> - setfield ~loc ~attrs (sub # expr e1) (map_loc sub lid) (sub # expr e2) - | Pexp_array el -> array ~loc ~attrs (List.map (sub # expr) el) - | Pexp_ifthenelse (e1, e2, e3) -> - ifthenelse ~loc ~attrs (sub # expr e1) (sub # expr e2) - (map_opt (sub # expr) e3) - | Pexp_sequence (e1, e2) -> - sequence ~loc ~attrs (sub # expr e1) (sub # expr e2) - | Pexp_while (e1, e2) -> while_ ~loc ~attrs (sub # expr e1) (sub # expr e2) - | Pexp_for (p, e1, e2, d, e3) -> - for_ ~loc ~attrs (sub # pat p) (sub # expr e1) (sub # expr e2) d - (sub # expr e3) - | Pexp_coerce (e, t1, t2) -> - coerce ~loc ~attrs (sub # expr e) (map_opt (sub # typ) t1) - (sub # typ t2) - | Pexp_constraint (e, t) -> - constraint_ ~loc ~attrs (sub # expr e) (sub # typ t) - | Pexp_send (e, s) -> send ~loc ~attrs (sub # expr e) s - | Pexp_new lid -> new_ ~loc ~attrs (map_loc sub lid) - | Pexp_setinstvar (s, e) -> - setinstvar ~loc ~attrs (map_loc sub s) (sub # expr e) - | Pexp_override sel -> - override ~loc ~attrs - (List.map (map_tuple (map_loc sub) (sub # expr)) sel) - | Pexp_letmodule (s, me, e) -> - letmodule ~loc ~attrs (map_loc sub s) (sub # module_expr me) - (sub # expr e) - | Pexp_assert e -> assert_ ~loc ~attrs (sub # expr e) - | Pexp_lazy e -> lazy_ ~loc ~attrs (sub # expr e) - | Pexp_poly (e, t) -> - poly ~loc ~attrs (sub # expr e) (map_opt (sub # typ) t) - | Pexp_object cls -> object_ ~loc ~attrs (sub # class_structure cls) - | Pexp_newtype (s, e) -> newtype ~loc ~attrs s (sub # expr e) - | Pexp_pack me -> pack ~loc ~attrs (sub # module_expr me) - | Pexp_open (ovf, lid, e) -> - open_ ~loc ~attrs ovf (map_loc sub lid) (sub # expr e) - | Pexp_extension x -> extension ~loc ~attrs (sub # extension x) -end - -module P = struct - (* Patterns *) - - let map sub {ppat_desc = desc; ppat_loc = loc; ppat_attributes = attrs} = - let open Pat in - let loc = sub # location loc in - let attrs = sub # attributes attrs in - match desc with - | Ppat_any -> any ~loc ~attrs () - | Ppat_var s -> var ~loc ~attrs (map_loc sub s) - | Ppat_alias (p, s) -> alias ~loc ~attrs (sub # pat p) (map_loc sub s) - | Ppat_constant c -> constant ~loc ~attrs c - | Ppat_interval (c1, c2) -> interval ~loc ~attrs c1 c2 - | Ppat_tuple pl -> tuple ~loc ~attrs (List.map (sub # pat) pl) - | Ppat_construct (l, p) -> - construct ~loc ~attrs (map_loc sub l) (map_opt (sub # pat) p) - | Ppat_variant (l, p) -> variant ~loc ~attrs l (map_opt (sub # pat) p) - | Ppat_record (lpl, cf) -> - record ~loc ~attrs (List.map (map_tuple (map_loc sub) (sub # pat)) lpl) - cf - | Ppat_array pl -> array ~loc ~attrs (List.map (sub # pat) pl) - | Ppat_or (p1, p2) -> or_ ~loc ~attrs (sub # pat p1) (sub # pat p2) - | Ppat_constraint (p, t) -> - constraint_ ~loc ~attrs (sub # pat p) (sub # typ t) - | Ppat_type s -> type_ ~loc ~attrs (map_loc sub s) - | Ppat_lazy p -> lazy_ ~loc ~attrs (sub # pat p) - | Ppat_unpack s -> unpack ~loc ~attrs (map_loc sub s) - | Ppat_exception p -> exception_ ~loc ~attrs (sub # pat p) - | Ppat_extension x -> extension ~loc ~attrs (sub # extension x) -end - -module CE = struct - (* Value expressions for the class language *) - - let map sub {pcl_loc = loc; pcl_desc = desc; pcl_attributes = attrs} = - let open Cl in - let loc = sub # location loc in - match desc with - | Pcl_constr (lid, tys) -> - constr ~loc ~attrs (map_loc sub lid) (List.map (sub # typ) tys) - | Pcl_structure s -> - structure ~loc ~attrs (sub # class_structure s) - | Pcl_fun (lab, e, p, ce) -> - fun_ ~loc ~attrs lab - (map_opt (sub # expr) e) - (sub # pat p) - (sub # class_expr ce) - | Pcl_apply (ce, l) -> - apply ~loc ~attrs (sub # class_expr ce) - (List.map (map_snd (sub # expr)) l) - | Pcl_let (r, vbs, ce) -> - let_ ~loc ~attrs r (List.map (sub # value_binding) vbs) - (sub # class_expr ce) - | Pcl_constraint (ce, ct) -> - constraint_ ~loc ~attrs (sub # class_expr ce) (sub # class_type ct) - | Pcl_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_kind sub = function - | Cfk_concrete (o, e) -> Cfk_concrete (o, sub # expr e) - | Cfk_virtual t -> Cfk_virtual (sub # typ t) - - let map_field sub {pcf_desc = desc; pcf_loc = loc; pcf_attributes = attrs} = - let open Cf in - let loc = sub # location loc in - match desc with - | Pcf_inherit (o, ce, s) -> inherit_ ~loc ~attrs o (sub # class_expr ce) s - | Pcf_val (s, m, k) -> val_ ~loc ~attrs (map_loc sub s) m (map_kind sub k) - | Pcf_method (s, p, k) -> - method_ ~loc ~attrs (map_loc sub s) p (map_kind sub k) - | Pcf_constraint (t1, t2) -> - constraint_ ~loc ~attrs (sub # typ t1) (sub # typ t2) - | Pcf_initializer e -> initializer_ ~loc ~attrs (sub # expr e) - | Pcf_attribute x -> attribute ~loc (sub # attribute x) - | Pcf_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_structure sub {pcstr_self; pcstr_fields} = - { - pcstr_self = sub # pat pcstr_self; - pcstr_fields = List.map (sub # class_field) pcstr_fields; - } - - let class_infos sub f {pci_virt; pci_params = pl; pci_name; pci_expr; - pci_loc; pci_attributes} = - Ci.mk - ~virt:pci_virt - ~params:(List.map (map_fst (sub # typ)) pl) - (map_loc sub pci_name) - (f pci_expr) - ~loc:(sub # location pci_loc) - ~attrs:(sub # attributes pci_attributes) -end - -(* Now, a generic AST mapper class, to be extended to cover all kinds - and cases of the OCaml grammar. The default behavior of the mapper - is the identity. *) - -class mapper = - object(this) - method structure l = List.map (this # structure_item) l - method structure_item si = M.map_structure_item this si - method module_expr = M.map this - - method signature l = List.map (this # signature_item) l - method signature_item si = MT.map_signature_item this si - method module_type = MT.map this - method with_constraint c = MT.map_with_constraint this c - - method class_declaration = CE.class_infos this (this # class_expr) - method class_expr = CE.map this - method class_field = CE.map_field this - method class_structure = CE.map_structure this - - method class_type = CT.map this - method class_type_field = CT.map_field this - method class_signature = CT.map_signature this - - method class_type_declaration = CE.class_infos this (this # class_type) - method class_description = CE.class_infos this (this # class_type) - - method type_declaration = T.map_type_declaration this - method type_kind = T.map_type_kind this - method typ = T.map this - - method type_extension = T.map_type_extension this - method extension_constructor = T.map_extension_constructor this - - method value_description {pval_name; pval_type; pval_prim; pval_loc; - pval_attributes} = - Val.mk - (map_loc this pval_name) - (this # typ pval_type) - ~attrs:(this # attributes pval_attributes) - ~loc:(this # location pval_loc) - ~prim:pval_prim - - method pat = P.map this - method expr = E.map this - - method module_declaration {pmd_name; pmd_type; pmd_attributes; pmd_loc} = - Md.mk - (map_loc this pmd_name) - (this # module_type pmd_type) - ~attrs:(this # attributes pmd_attributes) - ~loc:(this # location pmd_loc) - - method module_type_declaration {pmtd_name; pmtd_type; pmtd_attributes; pmtd_loc} = - Mtd.mk - (map_loc this pmtd_name) - ?typ:(map_opt (this # module_type) pmtd_type) - ~attrs:(this # attributes pmtd_attributes) - ~loc:(this # location pmtd_loc) - - method module_binding {pmb_name; pmb_expr; pmb_attributes; pmb_loc} = - Mb.mk (map_loc this pmb_name) (this # module_expr pmb_expr) - ~attrs:(this # attributes pmb_attributes) - ~loc:(this # location pmb_loc) - - method value_binding {pvb_pat; pvb_expr; pvb_attributes; pvb_loc} = - Vb.mk - (this # pat pvb_pat) - (this # expr pvb_expr) - ~attrs:(this # attributes pvb_attributes) - ~loc:(this # location pvb_loc) - - - method constructor_declaration {pcd_name; pcd_args; pcd_res; pcd_loc; - pcd_attributes} = - Type.constructor - (map_loc this pcd_name) - ~args:(List.map (this # typ) pcd_args) - ?res:(map_opt (this # typ) pcd_res) - ~loc:(this # location pcd_loc) - ~attrs:(this # attributes pcd_attributes) - - method label_declaration {pld_name; pld_type; pld_loc; pld_mutable; - pld_attributes} = - Type.field - (map_loc this pld_name) - (this # typ pld_type) - ~mut:pld_mutable - ~loc:(this # location pld_loc) - ~attrs:(this # attributes pld_attributes) - - - method cases l = List.map (this # case) l - method case {pc_lhs; pc_guard; pc_rhs} = - { - pc_lhs = this # pat pc_lhs; - pc_guard = map_opt (this # expr) pc_guard; - pc_rhs = this # expr pc_rhs; - } - - method open_description - {popen_lid; popen_override; popen_attributes; popen_loc} = - Opn.mk (map_loc this popen_lid) - ~override:popen_override - ~loc:(this # location popen_loc) - ~attrs:(this # attributes popen_attributes) - - method include_description - {pincl_mod; pincl_attributes; pincl_loc} = - Incl.mk (this # module_type pincl_mod) - ~loc:(this # location pincl_loc) - ~attrs:(this # attributes pincl_attributes) - - method include_declaration - {pincl_mod; pincl_attributes; pincl_loc} = - Incl.mk (this # module_expr pincl_mod) - ~loc:(this # location pincl_loc) - ~attrs:(this # attributes pincl_attributes) - - method location l = l - - method extension (s, e) = (map_loc this s, this # payload e) - method attribute (s, e) = (map_loc this s, this # payload e) - method attributes l = List.map (this # attribute) l - method payload = function - | PStr x -> PStr (this # structure x) - | PTyp x -> PTyp (this # typ x) - | PPat (x, g) -> PPat (this # pat x, map_opt (this # expr) g) - end - - -let to_mapper this = - let open Ast_mapper in - { - attribute = (fun _ -> this # attribute); - attributes = (fun _ -> this # attributes); - case = (fun _ -> this # case); - cases = (fun _ -> this # cases); - class_declaration = (fun _ -> this # class_declaration); - class_description = (fun _ -> this # class_description); - class_expr = (fun _ -> this # class_expr); - class_field = (fun _ -> this # class_field); - class_signature = (fun _ -> this # class_signature); - class_structure = (fun _ -> this # class_structure); - class_type = (fun _ -> this # class_type); - class_type_declaration = (fun _ -> this # class_type_declaration); - class_type_field = (fun _ -> this # class_type_field); - constructor_declaration = (fun _ -> this # constructor_declaration); - expr = (fun _ -> this # expr); - extension = (fun _ -> this # extension); - extension_constructor = (fun _ -> this # extension_constructor); - include_declaration = (fun _ -> this # include_declaration); - include_description = (fun _ -> this # include_description); - label_declaration = (fun _ -> this # label_declaration); - location = (fun _ -> this # location); - module_binding = (fun _ -> this # module_binding); - module_declaration = (fun _ -> this # module_declaration); - module_expr = (fun _ -> this # module_expr); - module_type = (fun _ -> this # module_type); - module_type_declaration = (fun _ -> this # module_type_declaration); - open_description = (fun _ -> this # open_description); - pat = (fun _ -> this # pat); - payload = (fun _ -> this # payload); - signature = (fun _ -> this # signature); - signature_item = (fun _ -> this # signature_item); - structure = (fun _ -> this # structure); - structure_item = (fun _ -> this # structure_item); - typ = (fun _ -> this # typ); - type_declaration = (fun _ -> this # type_declaration); - type_extension = (fun _ -> this # type_extension); - type_kind = (fun _ -> this # type_kind); - value_binding = (fun _ -> this # value_binding); - value_description = (fun _ -> this # value_description); - with_constraint = (fun _ -> this # with_constraint); - } diff --git a/ppx_tools_versioned.5.2/ast_mapper_class_402.mli b/ppx_tools_versioned.5.2/ast_mapper_class_402.mli deleted file mode 100644 index 3fbaa22..0000000 --- a/ppx_tools_versioned.5.2/ast_mapper_class_402.mli +++ /dev/null @@ -1,57 +0,0 @@ -open Ast_402 - -(* This file is part of the ppx_tools package. It is released *) -(* under the terms of the MIT license (see LICENSE file). *) -(* Copyright 2013 Alain Frisch and LexiFi *) - -(** Class-based customizable mapper *) - -open Parsetree - -class mapper: - object - method attribute: attribute -> attribute - method attributes: attribute list -> attribute list - method case: case -> case - method cases: case list -> case list - method class_declaration: class_declaration -> class_declaration - method class_description: class_description -> class_description - method class_expr: class_expr -> class_expr - method class_field: class_field -> class_field - method class_signature: class_signature -> class_signature - method class_structure: class_structure -> class_structure - method class_type: class_type -> class_type - method class_type_declaration: class_type_declaration -> class_type_declaration - method class_type_field: class_type_field -> class_type_field - method constructor_declaration: constructor_declaration -> constructor_declaration - method expr: expression -> expression - method extension: extension -> extension - method extension_constructor: extension_constructor -> extension_constructor - method include_declaration: include_declaration -> include_declaration - method include_description: include_description -> include_description - method label_declaration: label_declaration -> label_declaration - method location: Location.t -> Location.t - method module_binding: module_binding -> module_binding - method module_declaration: module_declaration -> module_declaration - method module_expr: module_expr -> module_expr - method module_type: module_type -> module_type - method module_type_declaration: module_type_declaration -> module_type_declaration - method open_description: open_description -> open_description - method pat: pattern -> pattern - method payload: payload -> payload - method signature: signature -> signature - method signature_item: signature_item -> signature_item - method structure: structure -> structure - method structure_item: structure_item -> structure_item - method typ: core_type -> core_type - method type_declaration: type_declaration -> type_declaration - method type_extension: type_extension -> type_extension - method type_kind: type_kind -> type_kind - method value_binding: value_binding -> value_binding - method value_description: value_description -> value_description - method with_constraint: with_constraint -> with_constraint - end - -val to_mapper: #mapper -> Ast_mapper.mapper -(** The resulting mapper is "closed", i.e. methods ignore - their first argument. *) diff --git a/ppx_tools_versioned.5.2/ast_mapper_class_403.ml b/ppx_tools_versioned.5.2/ast_mapper_class_403.ml deleted file mode 100644 index 0d76977..0000000 --- a/ppx_tools_versioned.5.2/ast_mapper_class_403.ml +++ /dev/null @@ -1,581 +0,0 @@ -open Ast_403 - -(* This file is part of the ppx_tools package. It is released *) -(* under the terms of the MIT license (see LICENSE file). *) -(* Copyright 2013 Alain Frisch and LexiFi *) - -(** Class-based customizable mapper *) - -open Parsetree -open Asttypes -open Ast_helper - -let map_fst f (x, y) = (f x, y) -let map_snd f (x, y) = (x, f y) -let map_tuple f1 f2 (x, y) = (f1 x, f2 y) -let map_tuple3 f1 f2 f3 (x, y, z) = (f1 x, f2 y, f3 z) -let map_opt f = function None -> None | Some x -> Some (f x) - -let map_loc sub {loc; txt} = {loc = sub # location loc; txt} - -module T = struct - (* Type expressions for the core language *) - - let row_field sub = function - | Rtag (l, attrs, b, tl) -> - Rtag (l, sub # attributes attrs, b, List.map (sub # typ) tl) - | Rinherit t -> Rinherit (sub # typ t) - - let map sub {ptyp_desc = desc; ptyp_loc = loc; ptyp_attributes = attrs} = - let open Typ in - let loc = sub # location loc in - let attrs = sub # attributes attrs in - match desc with - | Ptyp_any -> any ~loc ~attrs () - | Ptyp_var s -> var ~loc ~attrs s - | Ptyp_arrow (lab, t1, t2) -> - arrow ~loc ~attrs lab (sub # typ t1) (sub # typ t2) - | Ptyp_tuple tyl -> tuple ~loc ~attrs (List.map (sub # typ) tyl) - | Ptyp_constr (lid, tl) -> - constr ~loc ~attrs (map_loc sub lid) (List.map (sub # typ) tl) - | Ptyp_object (l, o) -> - let f (s, a, t) = (s, sub # attributes a, sub # typ t) in - object_ ~loc ~attrs (List.map f l) o - | Ptyp_class (lid, tl) -> - class_ ~loc ~attrs (map_loc sub lid) (List.map (sub # typ) tl) - | Ptyp_alias (t, s) -> alias ~loc ~attrs (sub # typ t) s - | Ptyp_variant (rl, b, ll) -> - variant ~loc ~attrs (List.map (row_field sub) rl) b ll - | Ptyp_poly (sl, t) -> poly ~loc ~attrs sl (sub # typ t) - | Ptyp_package (lid, l) -> - package ~loc ~attrs (map_loc sub lid) - (List.map (map_tuple (map_loc sub) (sub # typ)) l) - | Ptyp_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_type_declaration sub - {ptype_name; ptype_params; ptype_cstrs; - ptype_kind; - ptype_private; - ptype_manifest; - ptype_attributes; - ptype_loc} = - Type.mk (map_loc sub ptype_name) - ~params:(List.map (map_fst (sub # typ)) ptype_params) - ~priv:ptype_private - ~cstrs:(List.map (map_tuple3 (sub # typ) (sub # typ) (sub # location)) - ptype_cstrs) - ~kind:(sub # type_kind ptype_kind) - ?manifest:(map_opt (sub # typ) ptype_manifest) - ~loc:(sub # location ptype_loc) - ~attrs:(sub # attributes ptype_attributes) - - let map_type_kind sub = function - | Ptype_abstract -> Ptype_abstract - | Ptype_variant l -> - Ptype_variant (List.map (sub # constructor_declaration) l) - | Ptype_record l -> Ptype_record (List.map (sub # label_declaration) l) - | Ptype_open -> Ptype_open - - let map_type_extension sub - {ptyext_path; ptyext_params; - ptyext_constructors; - ptyext_private; - ptyext_attributes} = - Te.mk - (map_loc sub ptyext_path) - (List.map (sub # extension_constructor) ptyext_constructors) - ~params:(List.map (map_fst (sub # typ)) ptyext_params) - ~priv:ptyext_private - ~attrs:(sub # attributes ptyext_attributes) - - let map_extension_constructor_kind sub = function - Pext_decl(ctl, cto) -> - Pext_decl(sub # constructor_arguments ctl, map_opt (sub # typ) cto) - | Pext_rebind li -> - Pext_rebind (map_loc sub li) - - let map_extension_constructor sub - {pext_name; - pext_kind; - pext_loc; - pext_attributes} = - Te.constructor - (map_loc sub pext_name) - (map_extension_constructor_kind sub pext_kind) - ~loc:(sub # location pext_loc) - ~attrs:(sub # attributes pext_attributes) - - -end - -module CT = struct - (* Type expressions for the class language *) - - let map sub {pcty_loc = loc; pcty_desc = desc; pcty_attributes = attrs} = - let open Cty in - let loc = sub # location loc in - match desc with - | Pcty_constr (lid, tys) -> - constr ~loc ~attrs (map_loc sub lid) (List.map (sub # typ) tys) - | Pcty_signature x -> signature ~loc ~attrs (sub # class_signature x) - | Pcty_arrow (lab, t, ct) -> - arrow ~loc ~attrs lab (sub # typ t) (sub # class_type ct) - | Pcty_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_field sub {pctf_desc = desc; pctf_loc = loc; pctf_attributes = attrs} - = - let open Ctf in - let loc = sub # location loc in - match desc with - | Pctf_inherit ct -> inherit_ ~loc ~attrs (sub # class_type ct) - | Pctf_val (s, m, v, t) -> val_ ~loc ~attrs s m v (sub # typ t) - | Pctf_method (s, p, v, t) -> method_ ~loc ~attrs s p v (sub # typ t) - | Pctf_constraint (t1, t2) -> - constraint_ ~loc ~attrs (sub # typ t1) (sub # typ t2) - | Pctf_attribute x -> attribute ~loc (sub # attribute x) - | Pctf_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_signature sub {pcsig_self; pcsig_fields} = - Csig.mk - (sub # typ pcsig_self) - (List.map (sub # class_type_field) pcsig_fields) -end - -module MT = struct - (* Type expressions for the module language *) - - let map sub {pmty_desc = desc; pmty_loc = loc; pmty_attributes = attrs} = - let open Mty in - let loc = sub # location loc in - let attrs = sub # attributes attrs in - match desc with - | Pmty_ident s -> ident ~loc ~attrs (map_loc sub s) - | Pmty_alias s -> alias ~loc ~attrs (map_loc sub s) - | Pmty_signature sg -> signature ~loc ~attrs (sub # signature sg) - | Pmty_functor (s, mt1, mt2) -> - functor_ ~loc ~attrs (map_loc sub s) - (map_opt (sub # module_type) mt1) - (sub # module_type mt2) - | Pmty_with (mt, l) -> - with_ ~loc ~attrs (sub # module_type mt) - (List.map (sub # with_constraint) l) - | Pmty_typeof me -> typeof_ ~loc ~attrs (sub # module_expr me) - | Pmty_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_with_constraint sub = function - | Pwith_type (lid, d) -> - Pwith_type (map_loc sub lid, sub # type_declaration d) - | Pwith_module (lid, lid2) -> - Pwith_module (map_loc sub lid, map_loc sub lid2) - | Pwith_typesubst d -> Pwith_typesubst (sub # type_declaration d) - | Pwith_modsubst (s, lid) -> - Pwith_modsubst (map_loc sub s, map_loc sub lid) - - let map_signature_item sub {psig_desc = desc; psig_loc = loc} = - let open Sig in - let loc = sub # location loc in - match desc with - | Psig_value vd -> value ~loc (sub # value_description vd) - | Psig_type (rf, l) -> type_ ~loc rf (List.map (sub # type_declaration) l) - | Psig_typext te -> type_extension ~loc (sub # type_extension te) - | Psig_exception ed -> exception_ ~loc (sub # extension_constructor ed) - | Psig_module x -> module_ ~loc (sub # module_declaration x) - | Psig_recmodule l -> - rec_module ~loc (List.map (sub # module_declaration) l) - | Psig_modtype x -> modtype ~loc (sub # module_type_declaration x) - | Psig_open od -> open_ ~loc (sub # open_description od) - | Psig_include x -> include_ ~loc (sub # include_description x) - | Psig_class l -> class_ ~loc (List.map (sub # class_description) l) - | Psig_class_type l -> - class_type ~loc (List.map (sub # class_type_declaration) l) - | Psig_extension (x, attrs) -> - extension ~loc (sub # extension x) ~attrs:(sub # attributes attrs) - | Psig_attribute x -> attribute ~loc (sub # attribute x) -end - - -module M = struct - (* Value expressions for the module language *) - - let map sub {pmod_loc = loc; pmod_desc = desc; pmod_attributes = attrs} = - let open Mod in - let loc = sub # location loc in - let attrs = sub # attributes attrs in - match desc with - | Pmod_ident x -> ident ~loc ~attrs (map_loc sub x) - | Pmod_structure str -> structure ~loc ~attrs (sub # structure str) - | Pmod_functor (arg, arg_ty, body) -> - functor_ ~loc ~attrs (map_loc sub arg) - (map_opt (sub # module_type) arg_ty) - (sub # module_expr body) - | Pmod_apply (m1, m2) -> - apply ~loc ~attrs (sub # module_expr m1) (sub # module_expr m2) - | Pmod_constraint (m, mty) -> - constraint_ ~loc ~attrs (sub # module_expr m) (sub # module_type mty) - | Pmod_unpack e -> unpack ~loc ~attrs (sub # expr e) - | Pmod_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_structure_item sub {pstr_loc = loc; pstr_desc = desc} = - let open Str in - let loc = sub # location loc in - match desc with - | Pstr_eval (x, attrs) -> - eval ~loc ~attrs:(sub # attributes attrs) (sub # expr x) - | Pstr_value (r, vbs) -> value ~loc r (List.map (sub # value_binding) vbs) - | Pstr_primitive vd -> primitive ~loc (sub # value_description vd) - | Pstr_type (rf, l) -> type_ ~loc rf (List.map (sub # type_declaration) l) - | Pstr_typext te -> type_extension ~loc (sub # type_extension te) - | Pstr_exception ed -> exception_ ~loc (sub # extension_constructor ed) - | Pstr_module x -> module_ ~loc (sub # module_binding x) - | Pstr_recmodule l -> rec_module ~loc (List.map (sub # module_binding) l) - | Pstr_modtype x -> modtype ~loc (sub # module_type_declaration x) - | Pstr_open od -> open_ ~loc (sub # open_description od) - | Pstr_class l -> class_ ~loc (List.map (sub # class_declaration) l) - | Pstr_class_type l -> - class_type ~loc (List.map (sub # class_type_declaration) l) - | Pstr_include x -> include_ ~loc (sub # include_declaration x) - | Pstr_extension (x, attrs) -> - extension ~loc (sub # extension x) ~attrs:(sub # attributes attrs) - | Pstr_attribute x -> attribute ~loc (sub # attribute x) -end - -module E = struct - (* Value expressions for the core language *) - - let map sub {pexp_loc = loc; pexp_desc = desc; pexp_attributes = attrs} = - let open Exp in - let loc = sub # location loc in - let attrs = sub # attributes attrs in - match desc with - | Pexp_ident x -> ident ~loc ~attrs (map_loc sub x) - | Pexp_constant x -> constant ~loc ~attrs x - | Pexp_let (r, vbs, e) -> - let_ ~loc ~attrs r (List.map (sub # value_binding) vbs) (sub # expr e) - | Pexp_fun (lab, def, p, e) -> - fun_ ~loc ~attrs lab (map_opt (sub # expr) def) (sub # pat p) - (sub # expr e) - | Pexp_function pel -> function_ ~loc ~attrs (sub # cases pel) - | Pexp_apply (e, l) -> - apply ~loc ~attrs (sub # expr e) (List.map (map_snd (sub # expr)) l) - | Pexp_match (e, pel) -> match_ ~loc ~attrs (sub # expr e) (sub # cases pel) - | Pexp_try (e, pel) -> try_ ~loc ~attrs (sub # expr e) (sub # cases pel) - | Pexp_tuple el -> tuple ~loc ~attrs (List.map (sub # expr) el) - | Pexp_construct (lid, arg) -> - construct ~loc ~attrs (map_loc sub lid) (map_opt (sub # expr) arg) - | Pexp_variant (lab, eo) -> - variant ~loc ~attrs lab (map_opt (sub # expr) eo) - | Pexp_record (l, eo) -> - record ~loc ~attrs (List.map (map_tuple (map_loc sub) (sub # expr)) l) - (map_opt (sub # expr) eo) - | Pexp_field (e, lid) -> field ~loc ~attrs (sub # expr e) (map_loc sub lid) - | Pexp_setfield (e1, lid, e2) -> - setfield ~loc ~attrs (sub # expr e1) (map_loc sub lid) (sub # expr e2) - | Pexp_array el -> array ~loc ~attrs (List.map (sub # expr) el) - | Pexp_ifthenelse (e1, e2, e3) -> - ifthenelse ~loc ~attrs (sub # expr e1) (sub # expr e2) - (map_opt (sub # expr) e3) - | Pexp_sequence (e1, e2) -> - sequence ~loc ~attrs (sub # expr e1) (sub # expr e2) - | Pexp_while (e1, e2) -> while_ ~loc ~attrs (sub # expr e1) (sub # expr e2) - | Pexp_for (p, e1, e2, d, e3) -> - for_ ~loc ~attrs (sub # pat p) (sub # expr e1) (sub # expr e2) d - (sub # expr e3) - | Pexp_coerce (e, t1, t2) -> - coerce ~loc ~attrs (sub # expr e) (map_opt (sub # typ) t1) - (sub # typ t2) - | Pexp_constraint (e, t) -> - constraint_ ~loc ~attrs (sub # expr e) (sub # typ t) - | Pexp_send (e, s) -> send ~loc ~attrs (sub # expr e) s - | Pexp_new lid -> new_ ~loc ~attrs (map_loc sub lid) - | Pexp_setinstvar (s, e) -> - setinstvar ~loc ~attrs (map_loc sub s) (sub # expr e) - | Pexp_override sel -> - override ~loc ~attrs - (List.map (map_tuple (map_loc sub) (sub # expr)) sel) - | Pexp_letmodule (s, me, e) -> - letmodule ~loc ~attrs (map_loc sub s) (sub # module_expr me) - (sub # expr e) - | Pexp_assert e -> assert_ ~loc ~attrs (sub # expr e) - | Pexp_lazy e -> lazy_ ~loc ~attrs (sub # expr e) - | Pexp_poly (e, t) -> - poly ~loc ~attrs (sub # expr e) (map_opt (sub # typ) t) - | Pexp_object cls -> object_ ~loc ~attrs (sub # class_structure cls) - | Pexp_newtype (s, e) -> newtype ~loc ~attrs s (sub # expr e) - | Pexp_pack me -> pack ~loc ~attrs (sub # module_expr me) - | Pexp_open (ovf, lid, e) -> - open_ ~loc ~attrs ovf (map_loc sub lid) (sub # expr e) - | Pexp_extension x -> extension ~loc ~attrs (sub # extension x) - | Pexp_unreachable -> unreachable ~loc ~attrs () -end - -module P = struct - (* Patterns *) - - let map sub {ppat_desc = desc; ppat_loc = loc; ppat_attributes = attrs} = - let open Pat in - let loc = sub # location loc in - let attrs = sub # attributes attrs in - match desc with - | Ppat_any -> any ~loc ~attrs () - | Ppat_var s -> var ~loc ~attrs (map_loc sub s) - | Ppat_alias (p, s) -> alias ~loc ~attrs (sub # pat p) (map_loc sub s) - | Ppat_constant c -> constant ~loc ~attrs c - | Ppat_interval (c1, c2) -> interval ~loc ~attrs c1 c2 - | Ppat_tuple pl -> tuple ~loc ~attrs (List.map (sub # pat) pl) - | Ppat_construct (l, p) -> - construct ~loc ~attrs (map_loc sub l) (map_opt (sub # pat) p) - | Ppat_variant (l, p) -> variant ~loc ~attrs l (map_opt (sub # pat) p) - | Ppat_record (lpl, cf) -> - record ~loc ~attrs (List.map (map_tuple (map_loc sub) (sub # pat)) lpl) - cf - | Ppat_array pl -> array ~loc ~attrs (List.map (sub # pat) pl) - | Ppat_or (p1, p2) -> or_ ~loc ~attrs (sub # pat p1) (sub # pat p2) - | Ppat_constraint (p, t) -> - constraint_ ~loc ~attrs (sub # pat p) (sub # typ t) - | Ppat_type s -> type_ ~loc ~attrs (map_loc sub s) - | Ppat_lazy p -> lazy_ ~loc ~attrs (sub # pat p) - | Ppat_unpack s -> unpack ~loc ~attrs (map_loc sub s) - | Ppat_exception p -> exception_ ~loc ~attrs (sub # pat p) - | Ppat_extension x -> extension ~loc ~attrs (sub # extension x) -end - -module CE = struct - (* Value expressions for the class language *) - - let map sub {pcl_loc = loc; pcl_desc = desc; pcl_attributes = attrs} = - let open Cl in - let loc = sub # location loc in - match desc with - | Pcl_constr (lid, tys) -> - constr ~loc ~attrs (map_loc sub lid) (List.map (sub # typ) tys) - | Pcl_structure s -> - structure ~loc ~attrs (sub # class_structure s) - | Pcl_fun (lab, e, p, ce) -> - fun_ ~loc ~attrs lab - (map_opt (sub # expr) e) - (sub # pat p) - (sub # class_expr ce) - | Pcl_apply (ce, l) -> - apply ~loc ~attrs (sub # class_expr ce) - (List.map (map_snd (sub # expr)) l) - | Pcl_let (r, vbs, ce) -> - let_ ~loc ~attrs r (List.map (sub # value_binding) vbs) - (sub # class_expr ce) - | Pcl_constraint (ce, ct) -> - constraint_ ~loc ~attrs (sub # class_expr ce) (sub # class_type ct) - | Pcl_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_kind sub = function - | Cfk_concrete (o, e) -> Cfk_concrete (o, sub # expr e) - | Cfk_virtual t -> Cfk_virtual (sub # typ t) - - let map_field sub {pcf_desc = desc; pcf_loc = loc; pcf_attributes = attrs} = - let open Cf in - let loc = sub # location loc in - match desc with - | Pcf_inherit (o, ce, s) -> inherit_ ~loc ~attrs o (sub # class_expr ce) s - | Pcf_val (s, m, k) -> val_ ~loc ~attrs (map_loc sub s) m (map_kind sub k) - | Pcf_method (s, p, k) -> - method_ ~loc ~attrs (map_loc sub s) p (map_kind sub k) - | Pcf_constraint (t1, t2) -> - constraint_ ~loc ~attrs (sub # typ t1) (sub # typ t2) - | Pcf_initializer e -> initializer_ ~loc ~attrs (sub # expr e) - | Pcf_attribute x -> attribute ~loc (sub # attribute x) - | Pcf_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_structure sub {pcstr_self; pcstr_fields} = - { - pcstr_self = sub # pat pcstr_self; - pcstr_fields = List.map (sub # class_field) pcstr_fields; - } - - let class_infos sub f {pci_virt; pci_params = pl; pci_name; pci_expr; - pci_loc; pci_attributes} = - Ci.mk - ~virt:pci_virt - ~params:(List.map (map_fst (sub # typ)) pl) - (map_loc sub pci_name) - (f pci_expr) - ~loc:(sub # location pci_loc) - ~attrs:(sub # attributes pci_attributes) -end - -(* Now, a generic AST mapper class, to be extended to cover all kinds - and cases of the OCaml grammar. The default behavior of the mapper - is the identity. *) - -class mapper = - object(this) - method structure l = List.map (this # structure_item) l - method structure_item si = M.map_structure_item this si - method module_expr = M.map this - - method signature l = List.map (this # signature_item) l - method signature_item si = MT.map_signature_item this si - method module_type = MT.map this - method with_constraint c = MT.map_with_constraint this c - - method class_declaration = CE.class_infos this (this # class_expr) - method class_expr = CE.map this - method class_field = CE.map_field this - method class_structure = CE.map_structure this - - method class_type = CT.map this - method class_type_field = CT.map_field this - method class_signature = CT.map_signature this - - method class_type_declaration = CE.class_infos this (this # class_type) - method class_description = CE.class_infos this (this # class_type) - - method type_declaration = T.map_type_declaration this - method type_kind = T.map_type_kind this - method typ = T.map this - - method type_extension = T.map_type_extension this - method extension_constructor = T.map_extension_constructor this - - method value_description {pval_name; pval_type; pval_prim; pval_loc; - pval_attributes} = - Val.mk - (map_loc this pval_name) - (this # typ pval_type) - ~attrs:(this # attributes pval_attributes) - ~loc:(this # location pval_loc) - ~prim:pval_prim - - method pat = P.map this - method expr = E.map this - - method module_declaration {pmd_name; pmd_type; pmd_attributes; pmd_loc} = - Md.mk - (map_loc this pmd_name) - (this # module_type pmd_type) - ~attrs:(this # attributes pmd_attributes) - ~loc:(this # location pmd_loc) - - method module_type_declaration {pmtd_name; pmtd_type; pmtd_attributes; pmtd_loc} = - Mtd.mk - (map_loc this pmtd_name) - ?typ:(map_opt (this # module_type) pmtd_type) - ~attrs:(this # attributes pmtd_attributes) - ~loc:(this # location pmtd_loc) - - method module_binding {pmb_name; pmb_expr; pmb_attributes; pmb_loc} = - Mb.mk (map_loc this pmb_name) (this # module_expr pmb_expr) - ~attrs:(this # attributes pmb_attributes) - ~loc:(this # location pmb_loc) - - method value_binding {pvb_pat; pvb_expr; pvb_attributes; pvb_loc} = - Vb.mk - (this # pat pvb_pat) - (this # expr pvb_expr) - ~attrs:(this # attributes pvb_attributes) - ~loc:(this # location pvb_loc) - - method constructor_arguments = function - | Pcstr_tuple (tys) -> Pcstr_tuple (List.map (this # typ) tys) - | Pcstr_record (ls) -> Pcstr_record (List.map (this # label_declaration) ls) - - method constructor_declaration {pcd_name; pcd_args; pcd_res; pcd_loc; - pcd_attributes} = - Type.constructor - (map_loc this pcd_name) - ~args:(this # constructor_arguments pcd_args) - ?res:(map_opt (this # typ) pcd_res) - ~loc:(this # location pcd_loc) - ~attrs:(this # attributes pcd_attributes) - - method label_declaration {pld_name; pld_type; pld_loc; pld_mutable; - pld_attributes} = - Type.field - (map_loc this pld_name) - (this # typ pld_type) - ~mut:pld_mutable - ~loc:(this # location pld_loc) - ~attrs:(this # attributes pld_attributes) - - - method cases l = List.map (this # case) l - method case {pc_lhs; pc_guard; pc_rhs} = - { - pc_lhs = this # pat pc_lhs; - pc_guard = map_opt (this # expr) pc_guard; - pc_rhs = this # expr pc_rhs; - } - - method open_description - {popen_lid; popen_override; popen_attributes; popen_loc} = - Opn.mk (map_loc this popen_lid) - ~override:popen_override - ~loc:(this # location popen_loc) - ~attrs:(this # attributes popen_attributes) - - method include_description - {pincl_mod; pincl_attributes; pincl_loc} = - Incl.mk (this # module_type pincl_mod) - ~loc:(this # location pincl_loc) - ~attrs:(this # attributes pincl_attributes) - - method include_declaration - {pincl_mod; pincl_attributes; pincl_loc} = - Incl.mk (this # module_expr pincl_mod) - ~loc:(this # location pincl_loc) - ~attrs:(this # attributes pincl_attributes) - - method location l = l - - method extension (s, e) = (map_loc this s, this # payload e) - method attribute (s, e) = (map_loc this s, this # payload e) - method attributes l = List.map (this # attribute) l - method payload = function - | PStr x -> PStr (this # structure x) - | PTyp x -> PTyp (this # typ x) - | PPat (x, g) -> PPat (this # pat x, map_opt (this # expr) g) - | PSig x -> PSig (this # signature x) - end - - -let to_mapper this = - let open Ast_mapper in - { - attribute = (fun _ -> this # attribute); - attributes = (fun _ -> this # attributes); - case = (fun _ -> this # case); - cases = (fun _ -> this # cases); - class_declaration = (fun _ -> this # class_declaration); - class_description = (fun _ -> this # class_description); - class_expr = (fun _ -> this # class_expr); - class_field = (fun _ -> this # class_field); - class_signature = (fun _ -> this # class_signature); - class_structure = (fun _ -> this # class_structure); - class_type = (fun _ -> this # class_type); - class_type_declaration = (fun _ -> this # class_type_declaration); - class_type_field = (fun _ -> this # class_type_field); - constructor_declaration = (fun _ -> this # constructor_declaration); - expr = (fun _ -> this # expr); - extension = (fun _ -> this # extension); - extension_constructor = (fun _ -> this # extension_constructor); - include_declaration = (fun _ -> this # include_declaration); - include_description = (fun _ -> this # include_description); - label_declaration = (fun _ -> this # label_declaration); - location = (fun _ -> this # location); - module_binding = (fun _ -> this # module_binding); - module_declaration = (fun _ -> this # module_declaration); - module_expr = (fun _ -> this # module_expr); - module_type = (fun _ -> this # module_type); - module_type_declaration = (fun _ -> this # module_type_declaration); - open_description = (fun _ -> this # open_description); - pat = (fun _ -> this # pat); - payload = (fun _ -> this # payload); - signature = (fun _ -> this # signature); - signature_item = (fun _ -> this # signature_item); - structure = (fun _ -> this # structure); - structure_item = (fun _ -> this # structure_item); - typ = (fun _ -> this # typ); - type_declaration = (fun _ -> this # type_declaration); - type_extension = (fun _ -> this # type_extension); - type_kind = (fun _ -> this # type_kind); - value_binding = (fun _ -> this # value_binding); - value_description = (fun _ -> this # value_description); - with_constraint = (fun _ -> this # with_constraint); - } diff --git a/ppx_tools_versioned.5.2/ast_mapper_class_403.mli b/ppx_tools_versioned.5.2/ast_mapper_class_403.mli deleted file mode 100644 index 9672290..0000000 --- a/ppx_tools_versioned.5.2/ast_mapper_class_403.mli +++ /dev/null @@ -1,58 +0,0 @@ -open Ast_403 - -(* This file is part of the ppx_tools package. It is released *) -(* under the terms of the MIT license (see LICENSE file). *) -(* Copyright 2013 Alain Frisch and LexiFi *) - -(** Class-based customizable mapper *) - -open Parsetree - -class mapper: - object - method attribute: attribute -> attribute - method attributes: attribute list -> attribute list - method case: case -> case - method cases: case list -> case list - method class_declaration: class_declaration -> class_declaration - method class_description: class_description -> class_description - method class_expr: class_expr -> class_expr - method class_field: class_field -> class_field - method class_signature: class_signature -> class_signature - method class_structure: class_structure -> class_structure - method class_type: class_type -> class_type - method class_type_declaration: class_type_declaration -> class_type_declaration - method class_type_field: class_type_field -> class_type_field - method constructor_arguments: constructor_arguments -> constructor_arguments - method constructor_declaration: constructor_declaration -> constructor_declaration - method expr: expression -> expression - method extension: extension -> extension - method extension_constructor: extension_constructor -> extension_constructor - method include_declaration: include_declaration -> include_declaration - method include_description: include_description -> include_description - method label_declaration: label_declaration -> label_declaration - method location: Location.t -> Location.t - method module_binding: module_binding -> module_binding - method module_declaration: module_declaration -> module_declaration - method module_expr: module_expr -> module_expr - method module_type: module_type -> module_type - method module_type_declaration: module_type_declaration -> module_type_declaration - method open_description: open_description -> open_description - method pat: pattern -> pattern - method payload: payload -> payload - method signature: signature -> signature - method signature_item: signature_item -> signature_item - method structure: structure -> structure - method structure_item: structure_item -> structure_item - method typ: core_type -> core_type - method type_declaration: type_declaration -> type_declaration - method type_extension: type_extension -> type_extension - method type_kind: type_kind -> type_kind - method value_binding: value_binding -> value_binding - method value_description: value_description -> value_description - method with_constraint: with_constraint -> with_constraint - end - -val to_mapper: #mapper -> Ast_mapper.mapper -(** The resulting mapper is "closed", i.e. methods ignore - their first argument. *) diff --git a/ppx_tools_versioned.5.2/ast_mapper_class_404.ml b/ppx_tools_versioned.5.2/ast_mapper_class_404.ml deleted file mode 100644 index 3d0ab18..0000000 --- a/ppx_tools_versioned.5.2/ast_mapper_class_404.ml +++ /dev/null @@ -1,586 +0,0 @@ -open Ast_404 - -(* This file is part of the ppx_tools package. It is released *) -(* under the terms of the MIT license (see LICENSE file). *) -(* Copyright 2013 Alain Frisch and LexiFi *) - -(** Class-based customizable mapper *) - -open Parsetree -open Asttypes -open Ast_helper - -let map_fst f (x, y) = (f x, y) -let map_snd f (x, y) = (x, f y) -let map_tuple f1 f2 (x, y) = (f1 x, f2 y) -let map_tuple3 f1 f2 f3 (x, y, z) = (f1 x, f2 y, f3 z) -let map_opt f = function None -> None | Some x -> Some (f x) - -let map_loc sub {loc; txt} = {loc = sub # location loc; txt} - -module T = struct - (* Type expressions for the core language *) - - let row_field sub = function - | Rtag (l, attrs, b, tl) -> - Rtag (l, sub # attributes attrs, b, List.map (sub # typ) tl) - | Rinherit t -> Rinherit (sub # typ t) - - let map sub {ptyp_desc = desc; ptyp_loc = loc; ptyp_attributes = attrs} = - let open Typ in - let loc = sub # location loc in - let attrs = sub # attributes attrs in - match desc with - | Ptyp_any -> any ~loc ~attrs () - | Ptyp_var s -> var ~loc ~attrs s - | Ptyp_arrow (lab, t1, t2) -> - arrow ~loc ~attrs lab (sub # typ t1) (sub # typ t2) - | Ptyp_tuple tyl -> tuple ~loc ~attrs (List.map (sub # typ) tyl) - | Ptyp_constr (lid, tl) -> - constr ~loc ~attrs (map_loc sub lid) (List.map (sub # typ) tl) - | Ptyp_object (l, o) -> - let f (s, a, t) = (s, sub # attributes a, sub # typ t) in - object_ ~loc ~attrs (List.map f l) o - | Ptyp_class (lid, tl) -> - class_ ~loc ~attrs (map_loc sub lid) (List.map (sub # typ) tl) - | Ptyp_alias (t, s) -> alias ~loc ~attrs (sub # typ t) s - | Ptyp_variant (rl, b, ll) -> - variant ~loc ~attrs (List.map (row_field sub) rl) b ll - | Ptyp_poly (sl, t) -> poly ~loc ~attrs sl (sub # typ t) - | Ptyp_package (lid, l) -> - package ~loc ~attrs (map_loc sub lid) - (List.map (map_tuple (map_loc sub) (sub # typ)) l) - | Ptyp_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_type_declaration sub - {ptype_name; ptype_params; ptype_cstrs; - ptype_kind; - ptype_private; - ptype_manifest; - ptype_attributes; - ptype_loc} = - Type.mk (map_loc sub ptype_name) - ~params:(List.map (map_fst (sub # typ)) ptype_params) - ~priv:ptype_private - ~cstrs:(List.map (map_tuple3 (sub # typ) (sub # typ) (sub # location)) - ptype_cstrs) - ~kind:(sub # type_kind ptype_kind) - ?manifest:(map_opt (sub # typ) ptype_manifest) - ~loc:(sub # location ptype_loc) - ~attrs:(sub # attributes ptype_attributes) - - let map_type_kind sub = function - | Ptype_abstract -> Ptype_abstract - | Ptype_variant l -> - Ptype_variant (List.map (sub # constructor_declaration) l) - | Ptype_record l -> Ptype_record (List.map (sub # label_declaration) l) - | Ptype_open -> Ptype_open - - let map_type_extension sub - {ptyext_path; ptyext_params; - ptyext_constructors; - ptyext_private; - ptyext_attributes} = - Te.mk - (map_loc sub ptyext_path) - (List.map (sub # extension_constructor) ptyext_constructors) - ~params:(List.map (map_fst (sub # typ)) ptyext_params) - ~priv:ptyext_private - ~attrs:(sub # attributes ptyext_attributes) - - let map_extension_constructor_kind sub = function - Pext_decl(ctl, cto) -> - Pext_decl(sub # constructor_arguments ctl, map_opt (sub # typ) cto) - | Pext_rebind li -> - Pext_rebind (map_loc sub li) - - let map_extension_constructor sub - {pext_name; - pext_kind; - pext_loc; - pext_attributes} = - Te.constructor - (map_loc sub pext_name) - (map_extension_constructor_kind sub pext_kind) - ~loc:(sub # location pext_loc) - ~attrs:(sub # attributes pext_attributes) - - -end - -module CT = struct - (* Type expressions for the class language *) - - let map sub {pcty_loc = loc; pcty_desc = desc; pcty_attributes = attrs} = - let open Cty in - let loc = sub # location loc in - match desc with - | Pcty_constr (lid, tys) -> - constr ~loc ~attrs (map_loc sub lid) (List.map (sub # typ) tys) - | Pcty_signature x -> signature ~loc ~attrs (sub # class_signature x) - | Pcty_arrow (lab, t, ct) -> - arrow ~loc ~attrs lab (sub # typ t) (sub # class_type ct) - | Pcty_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_field sub {pctf_desc = desc; pctf_loc = loc; pctf_attributes = attrs} - = - let open Ctf in - let loc = sub # location loc in - match desc with - | Pctf_inherit ct -> inherit_ ~loc ~attrs (sub # class_type ct) - | Pctf_val (s, m, v, t) -> val_ ~loc ~attrs s m v (sub # typ t) - | Pctf_method (s, p, v, t) -> method_ ~loc ~attrs s p v (sub # typ t) - | Pctf_constraint (t1, t2) -> - constraint_ ~loc ~attrs (sub # typ t1) (sub # typ t2) - | Pctf_attribute x -> attribute ~loc (sub # attribute x) - | Pctf_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_signature sub {pcsig_self; pcsig_fields} = - Csig.mk - (sub # typ pcsig_self) - (List.map (sub # class_type_field) pcsig_fields) -end - -module MT = struct - (* Type expressions for the module language *) - - let map sub {pmty_desc = desc; pmty_loc = loc; pmty_attributes = attrs} = - let open Mty in - let loc = sub # location loc in - let attrs = sub # attributes attrs in - match desc with - | Pmty_ident s -> ident ~loc ~attrs (map_loc sub s) - | Pmty_alias s -> alias ~loc ~attrs (map_loc sub s) - | Pmty_signature sg -> signature ~loc ~attrs (sub # signature sg) - | Pmty_functor (s, mt1, mt2) -> - functor_ ~loc ~attrs (map_loc sub s) - (map_opt (sub # module_type) mt1) - (sub # module_type mt2) - | Pmty_with (mt, l) -> - with_ ~loc ~attrs (sub # module_type mt) - (List.map (sub # with_constraint) l) - | Pmty_typeof me -> typeof_ ~loc ~attrs (sub # module_expr me) - | Pmty_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_with_constraint sub = function - | Pwith_type (lid, d) -> - Pwith_type (map_loc sub lid, sub # type_declaration d) - | Pwith_module (lid, lid2) -> - Pwith_module (map_loc sub lid, map_loc sub lid2) - | Pwith_typesubst d -> Pwith_typesubst (sub # type_declaration d) - | Pwith_modsubst (s, lid) -> - Pwith_modsubst (map_loc sub s, map_loc sub lid) - - let map_signature_item sub {psig_desc = desc; psig_loc = loc} = - let open Sig in - let loc = sub # location loc in - match desc with - | Psig_value vd -> value ~loc (sub # value_description vd) - | Psig_type (rf, l) -> type_ ~loc rf (List.map (sub # type_declaration) l) - | Psig_typext te -> type_extension ~loc (sub # type_extension te) - | Psig_exception ed -> exception_ ~loc (sub # extension_constructor ed) - | Psig_module x -> module_ ~loc (sub # module_declaration x) - | Psig_recmodule l -> - rec_module ~loc (List.map (sub # module_declaration) l) - | Psig_modtype x -> modtype ~loc (sub # module_type_declaration x) - | Psig_open od -> open_ ~loc (sub # open_description od) - | Psig_include x -> include_ ~loc (sub # include_description x) - | Psig_class l -> class_ ~loc (List.map (sub # class_description) l) - | Psig_class_type l -> - class_type ~loc (List.map (sub # class_type_declaration) l) - | Psig_extension (x, attrs) -> - extension ~loc (sub # extension x) ~attrs:(sub # attributes attrs) - | Psig_attribute x -> attribute ~loc (sub # attribute x) -end - - -module M = struct - (* Value expressions for the module language *) - - let map sub {pmod_loc = loc; pmod_desc = desc; pmod_attributes = attrs} = - let open Mod in - let loc = sub # location loc in - let attrs = sub # attributes attrs in - match desc with - | Pmod_ident x -> ident ~loc ~attrs (map_loc sub x) - | Pmod_structure str -> structure ~loc ~attrs (sub # structure str) - | Pmod_functor (arg, arg_ty, body) -> - functor_ ~loc ~attrs (map_loc sub arg) - (map_opt (sub # module_type) arg_ty) - (sub # module_expr body) - | Pmod_apply (m1, m2) -> - apply ~loc ~attrs (sub # module_expr m1) (sub # module_expr m2) - | Pmod_constraint (m, mty) -> - constraint_ ~loc ~attrs (sub # module_expr m) (sub # module_type mty) - | Pmod_unpack e -> unpack ~loc ~attrs (sub # expr e) - | Pmod_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_structure_item sub {pstr_loc = loc; pstr_desc = desc} = - let open Str in - let loc = sub # location loc in - match desc with - | Pstr_eval (x, attrs) -> - eval ~loc ~attrs:(sub # attributes attrs) (sub # expr x) - | Pstr_value (r, vbs) -> value ~loc r (List.map (sub # value_binding) vbs) - | Pstr_primitive vd -> primitive ~loc (sub # value_description vd) - | Pstr_type (rf, l) -> type_ ~loc rf (List.map (sub # type_declaration) l) - | Pstr_typext te -> type_extension ~loc (sub # type_extension te) - | Pstr_exception ed -> exception_ ~loc (sub # extension_constructor ed) - | Pstr_module x -> module_ ~loc (sub # module_binding x) - | Pstr_recmodule l -> rec_module ~loc (List.map (sub # module_binding) l) - | Pstr_modtype x -> modtype ~loc (sub # module_type_declaration x) - | Pstr_open od -> open_ ~loc (sub # open_description od) - | Pstr_class l -> class_ ~loc (List.map (sub # class_declaration) l) - | Pstr_class_type l -> - class_type ~loc (List.map (sub # class_type_declaration) l) - | Pstr_include x -> include_ ~loc (sub # include_declaration x) - | Pstr_extension (x, attrs) -> - extension ~loc (sub # extension x) ~attrs:(sub # attributes attrs) - | Pstr_attribute x -> attribute ~loc (sub # attribute x) -end - -module E = struct - (* Value expressions for the core language *) - - let map sub {pexp_loc = loc; pexp_desc = desc; pexp_attributes = attrs} = - let open Exp in - let loc = sub # location loc in - let attrs = sub # attributes attrs in - match desc with - | Pexp_ident x -> ident ~loc ~attrs (map_loc sub x) - | Pexp_constant x -> constant ~loc ~attrs x - | Pexp_let (r, vbs, e) -> - let_ ~loc ~attrs r (List.map (sub # value_binding) vbs) (sub # expr e) - | Pexp_fun (lab, def, p, e) -> - fun_ ~loc ~attrs lab (map_opt (sub # expr) def) (sub # pat p) - (sub # expr e) - | Pexp_function pel -> function_ ~loc ~attrs (sub # cases pel) - | Pexp_apply (e, l) -> - apply ~loc ~attrs (sub # expr e) (List.map (map_snd (sub # expr)) l) - | Pexp_match (e, pel) -> match_ ~loc ~attrs (sub # expr e) (sub # cases pel) - | Pexp_try (e, pel) -> try_ ~loc ~attrs (sub # expr e) (sub # cases pel) - | Pexp_tuple el -> tuple ~loc ~attrs (List.map (sub # expr) el) - | Pexp_construct (lid, arg) -> - construct ~loc ~attrs (map_loc sub lid) (map_opt (sub # expr) arg) - | Pexp_variant (lab, eo) -> - variant ~loc ~attrs lab (map_opt (sub # expr) eo) - | Pexp_record (l, eo) -> - record ~loc ~attrs (List.map (map_tuple (map_loc sub) (sub # expr)) l) - (map_opt (sub # expr) eo) - | Pexp_field (e, lid) -> field ~loc ~attrs (sub # expr e) (map_loc sub lid) - | Pexp_setfield (e1, lid, e2) -> - setfield ~loc ~attrs (sub # expr e1) (map_loc sub lid) (sub # expr e2) - | Pexp_array el -> array ~loc ~attrs (List.map (sub # expr) el) - | Pexp_ifthenelse (e1, e2, e3) -> - ifthenelse ~loc ~attrs (sub # expr e1) (sub # expr e2) - (map_opt (sub # expr) e3) - | Pexp_sequence (e1, e2) -> - sequence ~loc ~attrs (sub # expr e1) (sub # expr e2) - | Pexp_while (e1, e2) -> while_ ~loc ~attrs (sub # expr e1) (sub # expr e2) - | Pexp_for (p, e1, e2, d, e3) -> - for_ ~loc ~attrs (sub # pat p) (sub # expr e1) (sub # expr e2) d - (sub # expr e3) - | Pexp_coerce (e, t1, t2) -> - coerce ~loc ~attrs (sub # expr e) (map_opt (sub # typ) t1) - (sub # typ t2) - | Pexp_constraint (e, t) -> - constraint_ ~loc ~attrs (sub # expr e) (sub # typ t) - | Pexp_send (e, s) -> send ~loc ~attrs (sub # expr e) s - | Pexp_new lid -> new_ ~loc ~attrs (map_loc sub lid) - | Pexp_setinstvar (s, e) -> - setinstvar ~loc ~attrs (map_loc sub s) (sub # expr e) - | Pexp_override sel -> - override ~loc ~attrs - (List.map (map_tuple (map_loc sub) (sub # expr)) sel) - | Pexp_letmodule (s, me, e) -> - letmodule ~loc ~attrs (map_loc sub s) (sub # module_expr me) - (sub # expr e) - | Pexp_letexception (cd, e) -> - letexception ~loc ~attrs - (sub # extension_constructor cd) - (sub # expr e) - | Pexp_assert e -> assert_ ~loc ~attrs (sub # expr e) - | Pexp_lazy e -> lazy_ ~loc ~attrs (sub # expr e) - | Pexp_poly (e, t) -> - poly ~loc ~attrs (sub # expr e) (map_opt (sub # typ) t) - | Pexp_object cls -> object_ ~loc ~attrs (sub # class_structure cls) - | Pexp_newtype (s, e) -> newtype ~loc ~attrs s (sub # expr e) - | Pexp_pack me -> pack ~loc ~attrs (sub # module_expr me) - | Pexp_open (ovf, lid, e) -> - open_ ~loc ~attrs ovf (map_loc sub lid) (sub # expr e) - | Pexp_extension x -> extension ~loc ~attrs (sub # extension x) - | Pexp_unreachable -> unreachable ~loc ~attrs () -end - -module P = struct - (* Patterns *) - - let map sub {ppat_desc = desc; ppat_loc = loc; ppat_attributes = attrs} = - let open Pat in - let loc = sub # location loc in - let attrs = sub # attributes attrs in - match desc with - | Ppat_any -> any ~loc ~attrs () - | Ppat_var s -> var ~loc ~attrs (map_loc sub s) - | Ppat_alias (p, s) -> alias ~loc ~attrs (sub # pat p) (map_loc sub s) - | Ppat_constant c -> constant ~loc ~attrs c - | Ppat_interval (c1, c2) -> interval ~loc ~attrs c1 c2 - | Ppat_tuple pl -> tuple ~loc ~attrs (List.map (sub # pat) pl) - | Ppat_construct (l, p) -> - construct ~loc ~attrs (map_loc sub l) (map_opt (sub # pat) p) - | Ppat_variant (l, p) -> variant ~loc ~attrs l (map_opt (sub # pat) p) - | Ppat_record (lpl, cf) -> - record ~loc ~attrs (List.map (map_tuple (map_loc sub) (sub # pat)) lpl) - cf - | Ppat_array pl -> array ~loc ~attrs (List.map (sub # pat) pl) - | Ppat_or (p1, p2) -> or_ ~loc ~attrs (sub # pat p1) (sub # pat p2) - | Ppat_constraint (p, t) -> - constraint_ ~loc ~attrs (sub # pat p) (sub # typ t) - | Ppat_type s -> type_ ~loc ~attrs (map_loc sub s) - | Ppat_lazy p -> lazy_ ~loc ~attrs (sub # pat p) - | Ppat_unpack s -> unpack ~loc ~attrs (map_loc sub s) - | Ppat_exception p -> exception_ ~loc ~attrs (sub # pat p) - | Ppat_extension x -> extension ~loc ~attrs (sub # extension x) - | Ppat_open (l, p) -> open_ ~loc ~attrs (map_loc sub l) (sub # pat p) -end - -module CE = struct - (* Value expressions for the class language *) - - let map sub {pcl_loc = loc; pcl_desc = desc; pcl_attributes = attrs} = - let open Cl in - let loc = sub # location loc in - match desc with - | Pcl_constr (lid, tys) -> - constr ~loc ~attrs (map_loc sub lid) (List.map (sub # typ) tys) - | Pcl_structure s -> - structure ~loc ~attrs (sub # class_structure s) - | Pcl_fun (lab, e, p, ce) -> - fun_ ~loc ~attrs lab - (map_opt (sub # expr) e) - (sub # pat p) - (sub # class_expr ce) - | Pcl_apply (ce, l) -> - apply ~loc ~attrs (sub # class_expr ce) - (List.map (map_snd (sub # expr)) l) - | Pcl_let (r, vbs, ce) -> - let_ ~loc ~attrs r (List.map (sub # value_binding) vbs) - (sub # class_expr ce) - | Pcl_constraint (ce, ct) -> - constraint_ ~loc ~attrs (sub # class_expr ce) (sub # class_type ct) - | Pcl_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_kind sub = function - | Cfk_concrete (o, e) -> Cfk_concrete (o, sub # expr e) - | Cfk_virtual t -> Cfk_virtual (sub # typ t) - - let map_field sub {pcf_desc = desc; pcf_loc = loc; pcf_attributes = attrs} = - let open Cf in - let loc = sub # location loc in - match desc with - | Pcf_inherit (o, ce, s) -> inherit_ ~loc ~attrs o (sub # class_expr ce) s - | Pcf_val (s, m, k) -> val_ ~loc ~attrs (map_loc sub s) m (map_kind sub k) - | Pcf_method (s, p, k) -> - method_ ~loc ~attrs (map_loc sub s) p (map_kind sub k) - | Pcf_constraint (t1, t2) -> - constraint_ ~loc ~attrs (sub # typ t1) (sub # typ t2) - | Pcf_initializer e -> initializer_ ~loc ~attrs (sub # expr e) - | Pcf_attribute x -> attribute ~loc (sub # attribute x) - | Pcf_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_structure sub {pcstr_self; pcstr_fields} = - { - pcstr_self = sub # pat pcstr_self; - pcstr_fields = List.map (sub # class_field) pcstr_fields; - } - - let class_infos sub f {pci_virt; pci_params = pl; pci_name; pci_expr; - pci_loc; pci_attributes} = - Ci.mk - ~virt:pci_virt - ~params:(List.map (map_fst (sub # typ)) pl) - (map_loc sub pci_name) - (f pci_expr) - ~loc:(sub # location pci_loc) - ~attrs:(sub # attributes pci_attributes) -end - -(* Now, a generic AST mapper class, to be extended to cover all kinds - and cases of the OCaml grammar. The default behavior of the mapper - is the identity. *) - -class mapper = - object(this) - method structure l = List.map (this # structure_item) l - method structure_item si = M.map_structure_item this si - method module_expr = M.map this - - method signature l = List.map (this # signature_item) l - method signature_item si = MT.map_signature_item this si - method module_type = MT.map this - method with_constraint c = MT.map_with_constraint this c - - method class_declaration = CE.class_infos this (this # class_expr) - method class_expr = CE.map this - method class_field = CE.map_field this - method class_structure = CE.map_structure this - - method class_type = CT.map this - method class_type_field = CT.map_field this - method class_signature = CT.map_signature this - - method class_type_declaration = CE.class_infos this (this # class_type) - method class_description = CE.class_infos this (this # class_type) - - method type_declaration = T.map_type_declaration this - method type_kind = T.map_type_kind this - method typ = T.map this - - method type_extension = T.map_type_extension this - method extension_constructor = T.map_extension_constructor this - - method value_description {pval_name; pval_type; pval_prim; pval_loc; - pval_attributes} = - Val.mk - (map_loc this pval_name) - (this # typ pval_type) - ~attrs:(this # attributes pval_attributes) - ~loc:(this # location pval_loc) - ~prim:pval_prim - - method pat = P.map this - method expr = E.map this - - method module_declaration {pmd_name; pmd_type; pmd_attributes; pmd_loc} = - Md.mk - (map_loc this pmd_name) - (this # module_type pmd_type) - ~attrs:(this # attributes pmd_attributes) - ~loc:(this # location pmd_loc) - - method module_type_declaration {pmtd_name; pmtd_type; pmtd_attributes; pmtd_loc} = - Mtd.mk - (map_loc this pmtd_name) - ?typ:(map_opt (this # module_type) pmtd_type) - ~attrs:(this # attributes pmtd_attributes) - ~loc:(this # location pmtd_loc) - - method module_binding {pmb_name; pmb_expr; pmb_attributes; pmb_loc} = - Mb.mk (map_loc this pmb_name) (this # module_expr pmb_expr) - ~attrs:(this # attributes pmb_attributes) - ~loc:(this # location pmb_loc) - - method value_binding {pvb_pat; pvb_expr; pvb_attributes; pvb_loc} = - Vb.mk - (this # pat pvb_pat) - (this # expr pvb_expr) - ~attrs:(this # attributes pvb_attributes) - ~loc:(this # location pvb_loc) - - method constructor_arguments = function - | Pcstr_tuple (tys) -> Pcstr_tuple (List.map (this # typ) tys) - | Pcstr_record (ls) -> Pcstr_record (List.map (this # label_declaration) ls) - - method constructor_declaration {pcd_name; pcd_args; pcd_res; pcd_loc; - pcd_attributes} = - Type.constructor - (map_loc this pcd_name) - ~args:(this # constructor_arguments pcd_args) - ?res:(map_opt (this # typ) pcd_res) - ~loc:(this # location pcd_loc) - ~attrs:(this # attributes pcd_attributes) - - method label_declaration {pld_name; pld_type; pld_loc; pld_mutable; - pld_attributes} = - Type.field - (map_loc this pld_name) - (this # typ pld_type) - ~mut:pld_mutable - ~loc:(this # location pld_loc) - ~attrs:(this # attributes pld_attributes) - - - method cases l = List.map (this # case) l - method case {pc_lhs; pc_guard; pc_rhs} = - { - pc_lhs = this # pat pc_lhs; - pc_guard = map_opt (this # expr) pc_guard; - pc_rhs = this # expr pc_rhs; - } - - method open_description - {popen_lid; popen_override; popen_attributes; popen_loc} = - Opn.mk (map_loc this popen_lid) - ~override:popen_override - ~loc:(this # location popen_loc) - ~attrs:(this # attributes popen_attributes) - - method include_description - {pincl_mod; pincl_attributes; pincl_loc} = - Incl.mk (this # module_type pincl_mod) - ~loc:(this # location pincl_loc) - ~attrs:(this # attributes pincl_attributes) - - method include_declaration - {pincl_mod; pincl_attributes; pincl_loc} = - Incl.mk (this # module_expr pincl_mod) - ~loc:(this # location pincl_loc) - ~attrs:(this # attributes pincl_attributes) - - method location l = l - - method extension (s, e) = (map_loc this s, this # payload e) - method attribute (s, e) = (map_loc this s, this # payload e) - method attributes l = List.map (this # attribute) l - method payload = function - | PStr x -> PStr (this # structure x) - | PTyp x -> PTyp (this # typ x) - | PPat (x, g) -> PPat (this # pat x, map_opt (this # expr) g) - | PSig x -> PSig (this # signature x) - end - - -let to_mapper this = - let open Ast_mapper in - { - attribute = (fun _ -> this # attribute); - attributes = (fun _ -> this # attributes); - case = (fun _ -> this # case); - cases = (fun _ -> this # cases); - class_declaration = (fun _ -> this # class_declaration); - class_description = (fun _ -> this # class_description); - class_expr = (fun _ -> this # class_expr); - class_field = (fun _ -> this # class_field); - class_signature = (fun _ -> this # class_signature); - class_structure = (fun _ -> this # class_structure); - class_type = (fun _ -> this # class_type); - class_type_declaration = (fun _ -> this # class_type_declaration); - class_type_field = (fun _ -> this # class_type_field); - constructor_declaration = (fun _ -> this # constructor_declaration); - expr = (fun _ -> this # expr); - extension = (fun _ -> this # extension); - extension_constructor = (fun _ -> this # extension_constructor); - include_declaration = (fun _ -> this # include_declaration); - include_description = (fun _ -> this # include_description); - label_declaration = (fun _ -> this # label_declaration); - location = (fun _ -> this # location); - module_binding = (fun _ -> this # module_binding); - module_declaration = (fun _ -> this # module_declaration); - module_expr = (fun _ -> this # module_expr); - module_type = (fun _ -> this # module_type); - module_type_declaration = (fun _ -> this # module_type_declaration); - open_description = (fun _ -> this # open_description); - pat = (fun _ -> this # pat); - payload = (fun _ -> this # payload); - signature = (fun _ -> this # signature); - signature_item = (fun _ -> this # signature_item); - structure = (fun _ -> this # structure); - structure_item = (fun _ -> this # structure_item); - typ = (fun _ -> this # typ); - type_declaration = (fun _ -> this # type_declaration); - type_extension = (fun _ -> this # type_extension); - type_kind = (fun _ -> this # type_kind); - value_binding = (fun _ -> this # value_binding); - value_description = (fun _ -> this # value_description); - with_constraint = (fun _ -> this # with_constraint); - } diff --git a/ppx_tools_versioned.5.2/ast_mapper_class_404.mli b/ppx_tools_versioned.5.2/ast_mapper_class_404.mli deleted file mode 100644 index f30a0bf..0000000 --- a/ppx_tools_versioned.5.2/ast_mapper_class_404.mli +++ /dev/null @@ -1,58 +0,0 @@ -open Ast_404 - -(* This file is part of the ppx_tools package. It is released *) -(* under the terms of the MIT license (see LICENSE file). *) -(* Copyright 2013 Alain Frisch and LexiFi *) - -(** Class-based customizable mapper *) - -open Parsetree - -class mapper: - object - method attribute: attribute -> attribute - method attributes: attribute list -> attribute list - method case: case -> case - method cases: case list -> case list - method class_declaration: class_declaration -> class_declaration - method class_description: class_description -> class_description - method class_expr: class_expr -> class_expr - method class_field: class_field -> class_field - method class_signature: class_signature -> class_signature - method class_structure: class_structure -> class_structure - method class_type: class_type -> class_type - method class_type_declaration: class_type_declaration -> class_type_declaration - method class_type_field: class_type_field -> class_type_field - method constructor_arguments: constructor_arguments -> constructor_arguments - method constructor_declaration: constructor_declaration -> constructor_declaration - method expr: expression -> expression - method extension: extension -> extension - method extension_constructor: extension_constructor -> extension_constructor - method include_declaration: include_declaration -> include_declaration - method include_description: include_description -> include_description - method label_declaration: label_declaration -> label_declaration - method location: Location.t -> Location.t - method module_binding: module_binding -> module_binding - method module_declaration: module_declaration -> module_declaration - method module_expr: module_expr -> module_expr - method module_type: module_type -> module_type - method module_type_declaration: module_type_declaration -> module_type_declaration - method open_description: open_description -> open_description - method pat: pattern -> pattern - method payload: payload -> payload - method signature: signature -> signature - method signature_item: signature_item -> signature_item - method structure: structure -> structure - method structure_item: structure_item -> structure_item - method typ: core_type -> core_type - method type_declaration: type_declaration -> type_declaration - method type_extension: type_extension -> type_extension - method type_kind: type_kind -> type_kind - method value_binding: value_binding -> value_binding - method value_description: value_description -> value_description - method with_constraint: with_constraint -> with_constraint - end - -val to_mapper: #mapper -> Ast_mapper.mapper -(** The resulting mapper is "closed", i.e. methods ignore - their first argument. *) diff --git a/ppx_tools_versioned.5.2/ast_mapper_class_405.ml b/ppx_tools_versioned.5.2/ast_mapper_class_405.ml deleted file mode 100644 index 2947185..0000000 --- a/ppx_tools_versioned.5.2/ast_mapper_class_405.ml +++ /dev/null @@ -1,586 +0,0 @@ -open Ast_405 - -(* This file is part of the ppx_tools package. It is released *) -(* under the terms of the MIT license (see LICENSE file). *) -(* Copyright 2013 Alain Frisch and LexiFi *) - -(** Class-based customizable mapper *) - -open Parsetree -open Asttypes -open Ast_helper - -let map_fst f (x, y) = (f x, y) -let map_snd f (x, y) = (x, f y) -let map_tuple f1 f2 (x, y) = (f1 x, f2 y) -let map_tuple3 f1 f2 f3 (x, y, z) = (f1 x, f2 y, f3 z) -let map_opt f = function None -> None | Some x -> Some (f x) - -let map_loc sub {loc; txt} = {loc = sub # location loc; txt} - -module T = struct - (* Type expressions for the core language *) - - let row_field sub = function - | Rtag (l, attrs, b, tl) -> - Rtag (l, sub # attributes attrs, b, List.map (sub # typ) tl) - | Rinherit t -> Rinherit (sub # typ t) - - let map sub {ptyp_desc = desc; ptyp_loc = loc; ptyp_attributes = attrs} = - let open Typ in - let loc = sub # location loc in - let attrs = sub # attributes attrs in - match desc with - | Ptyp_any -> any ~loc ~attrs () - | Ptyp_var s -> var ~loc ~attrs s - | Ptyp_arrow (lab, t1, t2) -> - arrow ~loc ~attrs lab (sub # typ t1) (sub # typ t2) - | Ptyp_tuple tyl -> tuple ~loc ~attrs (List.map (sub # typ) tyl) - | Ptyp_constr (lid, tl) -> - constr ~loc ~attrs (map_loc sub lid) (List.map (sub # typ) tl) - | Ptyp_object (l, o) -> - let f (s, a, t) = (s, sub # attributes a, sub # typ t) in - object_ ~loc ~attrs (List.map f l) o - | Ptyp_class (lid, tl) -> - class_ ~loc ~attrs (map_loc sub lid) (List.map (sub # typ) tl) - | Ptyp_alias (t, s) -> alias ~loc ~attrs (sub # typ t) s - | Ptyp_variant (rl, b, ll) -> - variant ~loc ~attrs (List.map (row_field sub) rl) b ll - | Ptyp_poly (sl, t) -> poly ~loc ~attrs sl (sub # typ t) - | Ptyp_package (lid, l) -> - package ~loc ~attrs (map_loc sub lid) - (List.map (map_tuple (map_loc sub) (sub # typ)) l) - | Ptyp_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_type_declaration sub - {ptype_name; ptype_params; ptype_cstrs; - ptype_kind; - ptype_private; - ptype_manifest; - ptype_attributes; - ptype_loc} = - Type.mk (map_loc sub ptype_name) - ~params:(List.map (map_fst (sub # typ)) ptype_params) - ~priv:ptype_private - ~cstrs:(List.map (map_tuple3 (sub # typ) (sub # typ) (sub # location)) - ptype_cstrs) - ~kind:(sub # type_kind ptype_kind) - ?manifest:(map_opt (sub # typ) ptype_manifest) - ~loc:(sub # location ptype_loc) - ~attrs:(sub # attributes ptype_attributes) - - let map_type_kind sub = function - | Ptype_abstract -> Ptype_abstract - | Ptype_variant l -> - Ptype_variant (List.map (sub # constructor_declaration) l) - | Ptype_record l -> Ptype_record (List.map (sub # label_declaration) l) - | Ptype_open -> Ptype_open - - let map_type_extension sub - {ptyext_path; ptyext_params; - ptyext_constructors; - ptyext_private; - ptyext_attributes} = - Te.mk - (map_loc sub ptyext_path) - (List.map (sub # extension_constructor) ptyext_constructors) - ~params:(List.map (map_fst (sub # typ)) ptyext_params) - ~priv:ptyext_private - ~attrs:(sub # attributes ptyext_attributes) - - let map_extension_constructor_kind sub = function - Pext_decl(ctl, cto) -> - Pext_decl(sub # constructor_arguments ctl, map_opt (sub # typ) cto) - | Pext_rebind li -> - Pext_rebind (map_loc sub li) - - let map_extension_constructor sub - {pext_name; - pext_kind; - pext_loc; - pext_attributes} = - Te.constructor - (map_loc sub pext_name) - (map_extension_constructor_kind sub pext_kind) - ~loc:(sub # location pext_loc) - ~attrs:(sub # attributes pext_attributes) - - -end - -module CT = struct - (* Type expressions for the class language *) - - let map sub {pcty_loc = loc; pcty_desc = desc; pcty_attributes = attrs} = - let open Cty in - let loc = sub # location loc in - match desc with - | Pcty_constr (lid, tys) -> - constr ~loc ~attrs (map_loc sub lid) (List.map (sub # typ) tys) - | Pcty_signature x -> signature ~loc ~attrs (sub # class_signature x) - | Pcty_arrow (lab, t, ct) -> - arrow ~loc ~attrs lab (sub # typ t) (sub # class_type ct) - | Pcty_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_field sub {pctf_desc = desc; pctf_loc = loc; pctf_attributes = attrs} - = - let open Ctf in - let loc = sub # location loc in - match desc with - | Pctf_inherit ct -> inherit_ ~loc ~attrs (sub # class_type ct) - | Pctf_val (s, m, v, t) -> val_ ~loc ~attrs s m v (sub # typ t) - | Pctf_method (s, p, v, t) -> method_ ~loc ~attrs s p v (sub # typ t) - | Pctf_constraint (t1, t2) -> - constraint_ ~loc ~attrs (sub # typ t1) (sub # typ t2) - | Pctf_attribute x -> attribute ~loc (sub # attribute x) - | Pctf_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_signature sub {pcsig_self; pcsig_fields} = - Csig.mk - (sub # typ pcsig_self) - (List.map (sub # class_type_field) pcsig_fields) -end - -module MT = struct - (* Type expressions for the module language *) - - let map sub {pmty_desc = desc; pmty_loc = loc; pmty_attributes = attrs} = - let open Mty in - let loc = sub # location loc in - let attrs = sub # attributes attrs in - match desc with - | Pmty_ident s -> ident ~loc ~attrs (map_loc sub s) - | Pmty_alias s -> alias ~loc ~attrs (map_loc sub s) - | Pmty_signature sg -> signature ~loc ~attrs (sub # signature sg) - | Pmty_functor (s, mt1, mt2) -> - functor_ ~loc ~attrs (map_loc sub s) - (map_opt (sub # module_type) mt1) - (sub # module_type mt2) - | Pmty_with (mt, l) -> - with_ ~loc ~attrs (sub # module_type mt) - (List.map (sub # with_constraint) l) - | Pmty_typeof me -> typeof_ ~loc ~attrs (sub # module_expr me) - | Pmty_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_with_constraint sub = function - | Pwith_type (lid, d) -> - Pwith_type (map_loc sub lid, sub # type_declaration d) - | Pwith_module (lid, lid2) -> - Pwith_module (map_loc sub lid, map_loc sub lid2) - | Pwith_typesubst d -> Pwith_typesubst (sub # type_declaration d) - | Pwith_modsubst (s, lid) -> - Pwith_modsubst (map_loc sub s, map_loc sub lid) - - let map_signature_item sub {psig_desc = desc; psig_loc = loc} = - let open Sig in - let loc = sub # location loc in - match desc with - | Psig_value vd -> value ~loc (sub # value_description vd) - | Psig_type (rf, l) -> type_ ~loc rf (List.map (sub # type_declaration) l) - | Psig_typext te -> type_extension ~loc (sub # type_extension te) - | Psig_exception ed -> exception_ ~loc (sub # extension_constructor ed) - | Psig_module x -> module_ ~loc (sub # module_declaration x) - | Psig_recmodule l -> - rec_module ~loc (List.map (sub # module_declaration) l) - | Psig_modtype x -> modtype ~loc (sub # module_type_declaration x) - | Psig_open od -> open_ ~loc (sub # open_description od) - | Psig_include x -> include_ ~loc (sub # include_description x) - | Psig_class l -> class_ ~loc (List.map (sub # class_description) l) - | Psig_class_type l -> - class_type ~loc (List.map (sub # class_type_declaration) l) - | Psig_extension (x, attrs) -> - extension ~loc (sub # extension x) ~attrs:(sub # attributes attrs) - | Psig_attribute x -> attribute ~loc (sub # attribute x) -end - - -module M = struct - (* Value expressions for the module language *) - - let map sub {pmod_loc = loc; pmod_desc = desc; pmod_attributes = attrs} = - let open Mod in - let loc = sub # location loc in - let attrs = sub # attributes attrs in - match desc with - | Pmod_ident x -> ident ~loc ~attrs (map_loc sub x) - | Pmod_structure str -> structure ~loc ~attrs (sub # structure str) - | Pmod_functor (arg, arg_ty, body) -> - functor_ ~loc ~attrs (map_loc sub arg) - (map_opt (sub # module_type) arg_ty) - (sub # module_expr body) - | Pmod_apply (m1, m2) -> - apply ~loc ~attrs (sub # module_expr m1) (sub # module_expr m2) - | Pmod_constraint (m, mty) -> - constraint_ ~loc ~attrs (sub # module_expr m) (sub # module_type mty) - | Pmod_unpack e -> unpack ~loc ~attrs (sub # expr e) - | Pmod_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_structure_item sub {pstr_loc = loc; pstr_desc = desc} = - let open Str in - let loc = sub # location loc in - match desc with - | Pstr_eval (x, attrs) -> - eval ~loc ~attrs:(sub # attributes attrs) (sub # expr x) - | Pstr_value (r, vbs) -> value ~loc r (List.map (sub # value_binding) vbs) - | Pstr_primitive vd -> primitive ~loc (sub # value_description vd) - | Pstr_type (rf, l) -> type_ ~loc rf (List.map (sub # type_declaration) l) - | Pstr_typext te -> type_extension ~loc (sub # type_extension te) - | Pstr_exception ed -> exception_ ~loc (sub # extension_constructor ed) - | Pstr_module x -> module_ ~loc (sub # module_binding x) - | Pstr_recmodule l -> rec_module ~loc (List.map (sub # module_binding) l) - | Pstr_modtype x -> modtype ~loc (sub # module_type_declaration x) - | Pstr_open od -> open_ ~loc (sub # open_description od) - | Pstr_class l -> class_ ~loc (List.map (sub # class_declaration) l) - | Pstr_class_type l -> - class_type ~loc (List.map (sub # class_type_declaration) l) - | Pstr_include x -> include_ ~loc (sub # include_declaration x) - | Pstr_extension (x, attrs) -> - extension ~loc (sub # extension x) ~attrs:(sub # attributes attrs) - | Pstr_attribute x -> attribute ~loc (sub # attribute x) -end - -module E = struct - (* Value expressions for the core language *) - - let map sub {pexp_loc = loc; pexp_desc = desc; pexp_attributes = attrs} = - let open Exp in - let loc = sub # location loc in - let attrs = sub # attributes attrs in - match desc with - | Pexp_ident x -> ident ~loc ~attrs (map_loc sub x) - | Pexp_constant x -> constant ~loc ~attrs x - | Pexp_let (r, vbs, e) -> - let_ ~loc ~attrs r (List.map (sub # value_binding) vbs) (sub # expr e) - | Pexp_fun (lab, def, p, e) -> - fun_ ~loc ~attrs lab (map_opt (sub # expr) def) (sub # pat p) - (sub # expr e) - | Pexp_function pel -> function_ ~loc ~attrs (sub # cases pel) - | Pexp_apply (e, l) -> - apply ~loc ~attrs (sub # expr e) (List.map (map_snd (sub # expr)) l) - | Pexp_match (e, pel) -> match_ ~loc ~attrs (sub # expr e) (sub # cases pel) - | Pexp_try (e, pel) -> try_ ~loc ~attrs (sub # expr e) (sub # cases pel) - | Pexp_tuple el -> tuple ~loc ~attrs (List.map (sub # expr) el) - | Pexp_construct (lid, arg) -> - construct ~loc ~attrs (map_loc sub lid) (map_opt (sub # expr) arg) - | Pexp_variant (lab, eo) -> - variant ~loc ~attrs lab (map_opt (sub # expr) eo) - | Pexp_record (l, eo) -> - record ~loc ~attrs (List.map (map_tuple (map_loc sub) (sub # expr)) l) - (map_opt (sub # expr) eo) - | Pexp_field (e, lid) -> field ~loc ~attrs (sub # expr e) (map_loc sub lid) - | Pexp_setfield (e1, lid, e2) -> - setfield ~loc ~attrs (sub # expr e1) (map_loc sub lid) (sub # expr e2) - | Pexp_array el -> array ~loc ~attrs (List.map (sub # expr) el) - | Pexp_ifthenelse (e1, e2, e3) -> - ifthenelse ~loc ~attrs (sub # expr e1) (sub # expr e2) - (map_opt (sub # expr) e3) - | Pexp_sequence (e1, e2) -> - sequence ~loc ~attrs (sub # expr e1) (sub # expr e2) - | Pexp_while (e1, e2) -> while_ ~loc ~attrs (sub # expr e1) (sub # expr e2) - | Pexp_for (p, e1, e2, d, e3) -> - for_ ~loc ~attrs (sub # pat p) (sub # expr e1) (sub # expr e2) d - (sub # expr e3) - | Pexp_coerce (e, t1, t2) -> - coerce ~loc ~attrs (sub # expr e) (map_opt (sub # typ) t1) - (sub # typ t2) - | Pexp_constraint (e, t) -> - constraint_ ~loc ~attrs (sub # expr e) (sub # typ t) - | Pexp_send (e, s) -> send ~loc ~attrs (sub # expr e) s - | Pexp_new lid -> new_ ~loc ~attrs (map_loc sub lid) - | Pexp_setinstvar (s, e) -> - setinstvar ~loc ~attrs (map_loc sub s) (sub # expr e) - | Pexp_override sel -> - override ~loc ~attrs - (List.map (map_tuple (map_loc sub) (sub # expr)) sel) - | Pexp_letmodule (s, me, e) -> - letmodule ~loc ~attrs (map_loc sub s) (sub # module_expr me) - (sub # expr e) - | Pexp_letexception (cd, e) -> - letexception ~loc ~attrs - (sub # extension_constructor cd) - (sub # expr e) - | Pexp_assert e -> assert_ ~loc ~attrs (sub # expr e) - | Pexp_lazy e -> lazy_ ~loc ~attrs (sub # expr e) - | Pexp_poly (e, t) -> - poly ~loc ~attrs (sub # expr e) (map_opt (sub # typ) t) - | Pexp_object cls -> object_ ~loc ~attrs (sub # class_structure cls) - | Pexp_newtype (s, e) -> newtype ~loc ~attrs s (sub # expr e) - | Pexp_pack me -> pack ~loc ~attrs (sub # module_expr me) - | Pexp_open (ovf, lid, e) -> - open_ ~loc ~attrs ovf (map_loc sub lid) (sub # expr e) - | Pexp_extension x -> extension ~loc ~attrs (sub # extension x) - | Pexp_unreachable -> unreachable ~loc ~attrs () -end - -module P = struct - (* Patterns *) - - let map sub {ppat_desc = desc; ppat_loc = loc; ppat_attributes = attrs} = - let open Pat in - let loc = sub # location loc in - let attrs = sub # attributes attrs in - match desc with - | Ppat_any -> any ~loc ~attrs () - | Ppat_var s -> var ~loc ~attrs (map_loc sub s) - | Ppat_alias (p, s) -> alias ~loc ~attrs (sub # pat p) (map_loc sub s) - | Ppat_constant c -> constant ~loc ~attrs c - | Ppat_interval (c1, c2) -> interval ~loc ~attrs c1 c2 - | Ppat_tuple pl -> tuple ~loc ~attrs (List.map (sub # pat) pl) - | Ppat_construct (l, p) -> - construct ~loc ~attrs (map_loc sub l) (map_opt (sub # pat) p) - | Ppat_variant (l, p) -> variant ~loc ~attrs l (map_opt (sub # pat) p) - | Ppat_record (lpl, cf) -> - record ~loc ~attrs (List.map (map_tuple (map_loc sub) (sub # pat)) lpl) - cf - | Ppat_array pl -> array ~loc ~attrs (List.map (sub # pat) pl) - | Ppat_or (p1, p2) -> or_ ~loc ~attrs (sub # pat p1) (sub # pat p2) - | Ppat_constraint (p, t) -> - constraint_ ~loc ~attrs (sub # pat p) (sub # typ t) - | Ppat_type s -> type_ ~loc ~attrs (map_loc sub s) - | Ppat_lazy p -> lazy_ ~loc ~attrs (sub # pat p) - | Ppat_unpack s -> unpack ~loc ~attrs (map_loc sub s) - | Ppat_exception p -> exception_ ~loc ~attrs (sub # pat p) - | Ppat_extension x -> extension ~loc ~attrs (sub # extension x) - | Ppat_open (l, p) -> open_ ~loc ~attrs (map_loc sub l) (sub # pat p) -end - -module CE = struct - (* Value expressions for the class language *) - - let map sub {pcl_loc = loc; pcl_desc = desc; pcl_attributes = attrs} = - let open Cl in - let loc = sub # location loc in - match desc with - | Pcl_constr (lid, tys) -> - constr ~loc ~attrs (map_loc sub lid) (List.map (sub # typ) tys) - | Pcl_structure s -> - structure ~loc ~attrs (sub # class_structure s) - | Pcl_fun (lab, e, p, ce) -> - fun_ ~loc ~attrs lab - (map_opt (sub # expr) e) - (sub # pat p) - (sub # class_expr ce) - | Pcl_apply (ce, l) -> - apply ~loc ~attrs (sub # class_expr ce) - (List.map (map_snd (sub # expr)) l) - | Pcl_let (r, vbs, ce) -> - let_ ~loc ~attrs r (List.map (sub # value_binding) vbs) - (sub # class_expr ce) - | Pcl_constraint (ce, ct) -> - constraint_ ~loc ~attrs (sub # class_expr ce) (sub # class_type ct) - | Pcl_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_kind sub = function - | Cfk_concrete (o, e) -> Cfk_concrete (o, sub # expr e) - | Cfk_virtual t -> Cfk_virtual (sub # typ t) - - let map_field sub {pcf_desc = desc; pcf_loc = loc; pcf_attributes = attrs} = - let open Cf in - let loc = sub # location loc in - match desc with - | Pcf_inherit (o, ce, s) -> inherit_ ~loc ~attrs o (sub # class_expr ce) s - | Pcf_val (s, m, k) -> val_ ~loc ~attrs (map_loc sub s) m (map_kind sub k) - | Pcf_method (s, p, k) -> - method_ ~loc ~attrs (map_loc sub s) p (map_kind sub k) - | Pcf_constraint (t1, t2) -> - constraint_ ~loc ~attrs (sub # typ t1) (sub # typ t2) - | Pcf_initializer e -> initializer_ ~loc ~attrs (sub # expr e) - | Pcf_attribute x -> attribute ~loc (sub # attribute x) - | Pcf_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_structure sub {pcstr_self; pcstr_fields} = - { - pcstr_self = sub # pat pcstr_self; - pcstr_fields = List.map (sub # class_field) pcstr_fields; - } - - let class_infos sub f {pci_virt; pci_params = pl; pci_name; pci_expr; - pci_loc; pci_attributes} = - Ci.mk - ~virt:pci_virt - ~params:(List.map (map_fst (sub # typ)) pl) - (map_loc sub pci_name) - (f pci_expr) - ~loc:(sub # location pci_loc) - ~attrs:(sub # attributes pci_attributes) -end - -(* Now, a generic AST mapper class, to be extended to cover all kinds - and cases of the OCaml grammar. The default behavior of the mapper - is the identity. *) - -class mapper = - object(this) - method structure l = List.map (this # structure_item) l - method structure_item si = M.map_structure_item this si - method module_expr = M.map this - - method signature l = List.map (this # signature_item) l - method signature_item si = MT.map_signature_item this si - method module_type = MT.map this - method with_constraint c = MT.map_with_constraint this c - - method class_declaration = CE.class_infos this (this # class_expr) - method class_expr = CE.map this - method class_field = CE.map_field this - method class_structure = CE.map_structure this - - method class_type = CT.map this - method class_type_field = CT.map_field this - method class_signature = CT.map_signature this - - method class_type_declaration = CE.class_infos this (this # class_type) - method class_description = CE.class_infos this (this # class_type) - - method type_declaration = T.map_type_declaration this - method type_kind = T.map_type_kind this - method typ = T.map this - - method type_extension = T.map_type_extension this - method extension_constructor = T.map_extension_constructor this - - method value_description {pval_name; pval_type; pval_prim; pval_loc; - pval_attributes} = - Val.mk - (map_loc this pval_name) - (this # typ pval_type) - ~attrs:(this # attributes pval_attributes) - ~loc:(this # location pval_loc) - ~prim:pval_prim - - method pat = P.map this - method expr = E.map this - - method module_declaration {pmd_name; pmd_type; pmd_attributes; pmd_loc} = - Md.mk - (map_loc this pmd_name) - (this # module_type pmd_type) - ~attrs:(this # attributes pmd_attributes) - ~loc:(this # location pmd_loc) - - method module_type_declaration {pmtd_name; pmtd_type; pmtd_attributes; pmtd_loc} = - Mtd.mk - (map_loc this pmtd_name) - ?typ:(map_opt (this # module_type) pmtd_type) - ~attrs:(this # attributes pmtd_attributes) - ~loc:(this # location pmtd_loc) - - method module_binding {pmb_name; pmb_expr; pmb_attributes; pmb_loc} = - Mb.mk (map_loc this pmb_name) (this # module_expr pmb_expr) - ~attrs:(this # attributes pmb_attributes) - ~loc:(this # location pmb_loc) - - method value_binding {pvb_pat; pvb_expr; pvb_attributes; pvb_loc} = - Vb.mk - (this # pat pvb_pat) - (this # expr pvb_expr) - ~attrs:(this # attributes pvb_attributes) - ~loc:(this # location pvb_loc) - - method constructor_arguments = function - | Pcstr_tuple (tys) -> Pcstr_tuple (List.map (this # typ) tys) - | Pcstr_record (ls) -> Pcstr_record (List.map (this # label_declaration) ls) - - method constructor_declaration {pcd_name; pcd_args; pcd_res; pcd_loc; - pcd_attributes} = - Type.constructor - (map_loc this pcd_name) - ~args:(this # constructor_arguments pcd_args) - ?res:(map_opt (this # typ) pcd_res) - ~loc:(this # location pcd_loc) - ~attrs:(this # attributes pcd_attributes) - - method label_declaration {pld_name; pld_type; pld_loc; pld_mutable; - pld_attributes} = - Type.field - (map_loc this pld_name) - (this # typ pld_type) - ~mut:pld_mutable - ~loc:(this # location pld_loc) - ~attrs:(this # attributes pld_attributes) - - - method cases l = List.map (this # case) l - method case {pc_lhs; pc_guard; pc_rhs} = - { - pc_lhs = this # pat pc_lhs; - pc_guard = map_opt (this # expr) pc_guard; - pc_rhs = this # expr pc_rhs; - } - - method open_description - {popen_lid; popen_override; popen_attributes; popen_loc} = - Opn.mk (map_loc this popen_lid) - ~override:popen_override - ~loc:(this # location popen_loc) - ~attrs:(this # attributes popen_attributes) - - method include_description - {pincl_mod; pincl_attributes; pincl_loc} = - Incl.mk (this # module_type pincl_mod) - ~loc:(this # location pincl_loc) - ~attrs:(this # attributes pincl_attributes) - - method include_declaration - {pincl_mod; pincl_attributes; pincl_loc} = - Incl.mk (this # module_expr pincl_mod) - ~loc:(this # location pincl_loc) - ~attrs:(this # attributes pincl_attributes) - - method location l = l - - method extension (s, e) = (map_loc this s, this # payload e) - method attribute (s, e) = (map_loc this s, this # payload e) - method attributes l = List.map (this # attribute) l - method payload = function - | PStr x -> PStr (this # structure x) - | PTyp x -> PTyp (this # typ x) - | PPat (x, g) -> PPat (this # pat x, map_opt (this # expr) g) - | PSig x -> PSig (this # signature x) - end - - -let to_mapper this = - let open Ast_mapper in - { - attribute = (fun _ -> this # attribute); - attributes = (fun _ -> this # attributes); - case = (fun _ -> this # case); - cases = (fun _ -> this # cases); - class_declaration = (fun _ -> this # class_declaration); - class_description = (fun _ -> this # class_description); - class_expr = (fun _ -> this # class_expr); - class_field = (fun _ -> this # class_field); - class_signature = (fun _ -> this # class_signature); - class_structure = (fun _ -> this # class_structure); - class_type = (fun _ -> this # class_type); - class_type_declaration = (fun _ -> this # class_type_declaration); - class_type_field = (fun _ -> this # class_type_field); - constructor_declaration = (fun _ -> this # constructor_declaration); - expr = (fun _ -> this # expr); - extension = (fun _ -> this # extension); - extension_constructor = (fun _ -> this # extension_constructor); - include_declaration = (fun _ -> this # include_declaration); - include_description = (fun _ -> this # include_description); - label_declaration = (fun _ -> this # label_declaration); - location = (fun _ -> this # location); - module_binding = (fun _ -> this # module_binding); - module_declaration = (fun _ -> this # module_declaration); - module_expr = (fun _ -> this # module_expr); - module_type = (fun _ -> this # module_type); - module_type_declaration = (fun _ -> this # module_type_declaration); - open_description = (fun _ -> this # open_description); - pat = (fun _ -> this # pat); - payload = (fun _ -> this # payload); - signature = (fun _ -> this # signature); - signature_item = (fun _ -> this # signature_item); - structure = (fun _ -> this # structure); - structure_item = (fun _ -> this # structure_item); - typ = (fun _ -> this # typ); - type_declaration = (fun _ -> this # type_declaration); - type_extension = (fun _ -> this # type_extension); - type_kind = (fun _ -> this # type_kind); - value_binding = (fun _ -> this # value_binding); - value_description = (fun _ -> this # value_description); - with_constraint = (fun _ -> this # with_constraint); - } diff --git a/ppx_tools_versioned.5.2/ast_mapper_class_405.mli b/ppx_tools_versioned.5.2/ast_mapper_class_405.mli deleted file mode 100644 index 5285a9b..0000000 --- a/ppx_tools_versioned.5.2/ast_mapper_class_405.mli +++ /dev/null @@ -1,58 +0,0 @@ -open Ast_405 - -(* This file is part of the ppx_tools package. It is released *) -(* under the terms of the MIT license (see LICENSE file). *) -(* Copyright 2013 Alain Frisch and LexiFi *) - -(** Class-based customizable mapper *) - -open Parsetree - -class mapper: - object - method attribute: attribute -> attribute - method attributes: attribute list -> attribute list - method case: case -> case - method cases: case list -> case list - method class_declaration: class_declaration -> class_declaration - method class_description: class_description -> class_description - method class_expr: class_expr -> class_expr - method class_field: class_field -> class_field - method class_signature: class_signature -> class_signature - method class_structure: class_structure -> class_structure - method class_type: class_type -> class_type - method class_type_declaration: class_type_declaration -> class_type_declaration - method class_type_field: class_type_field -> class_type_field - method constructor_arguments: constructor_arguments -> constructor_arguments - method constructor_declaration: constructor_declaration -> constructor_declaration - method expr: expression -> expression - method extension: extension -> extension - method extension_constructor: extension_constructor -> extension_constructor - method include_declaration: include_declaration -> include_declaration - method include_description: include_description -> include_description - method label_declaration: label_declaration -> label_declaration - method location: Location.t -> Location.t - method module_binding: module_binding -> module_binding - method module_declaration: module_declaration -> module_declaration - method module_expr: module_expr -> module_expr - method module_type: module_type -> module_type - method module_type_declaration: module_type_declaration -> module_type_declaration - method open_description: open_description -> open_description - method pat: pattern -> pattern - method payload: payload -> payload - method signature: signature -> signature - method signature_item: signature_item -> signature_item - method structure: structure -> structure - method structure_item: structure_item -> structure_item - method typ: core_type -> core_type - method type_declaration: type_declaration -> type_declaration - method type_extension: type_extension -> type_extension - method type_kind: type_kind -> type_kind - method value_binding: value_binding -> value_binding - method value_description: value_description -> value_description - method with_constraint: with_constraint -> with_constraint - end - -val to_mapper: #mapper -> Ast_mapper.mapper -(** The resulting mapper is "closed", i.e. methods ignore - their first argument. *) diff --git a/ppx_tools_versioned.5.2/ast_mapper_class_406.ml b/ppx_tools_versioned.5.2/ast_mapper_class_406.ml deleted file mode 100644 index 4d4522e..0000000 --- a/ppx_tools_versioned.5.2/ast_mapper_class_406.ml +++ /dev/null @@ -1,594 +0,0 @@ -open Ast_406 - -(* This file is part of the ppx_tools package. It is released *) -(* under the terms of the MIT license (see LICENSE file). *) -(* Copyright 2013 Alain Frisch and LexiFi *) - -(** Class-based customizable mapper *) - -open Parsetree -open Asttypes -open Ast_helper - -let map_fst f (x, y) = (f x, y) -let map_snd f (x, y) = (x, f y) -let map_tuple f1 f2 (x, y) = (f1 x, f2 y) -let map_tuple3 f1 f2 f3 (x, y, z) = (f1 x, f2 y, f3 z) -let map_opt f = function None -> None | Some x -> Some (f x) - -let map_loc sub {loc; txt} = {loc = sub # location loc; txt} - -module T = struct - (* Type expressions for the core language *) - - let row_field sub = function - | Rtag (l, attrs, b, tl) -> - Rtag (l, sub # attributes attrs, b, List.map (sub # typ) tl) - | Rinherit t -> Rinherit (sub # typ t) - - let object_field sub = function - | Otag (s, a, t) -> Otag (s, sub # attributes a, sub # typ t) - | Oinherit t -> Oinherit (sub # typ t) - - let map sub {ptyp_desc = desc; ptyp_loc = loc; ptyp_attributes = attrs} = - let open Typ in - let loc = sub # location loc in - let attrs = sub # attributes attrs in - match desc with - | Ptyp_any -> any ~loc ~attrs () - | Ptyp_var s -> var ~loc ~attrs s - | Ptyp_arrow (lab, t1, t2) -> - arrow ~loc ~attrs lab (sub # typ t1) (sub # typ t2) - | Ptyp_tuple tyl -> tuple ~loc ~attrs (List.map (sub # typ) tyl) - | Ptyp_constr (lid, tl) -> - constr ~loc ~attrs (map_loc sub lid) (List.map (sub # typ) tl) - | Ptyp_object (l, o) -> - object_ ~loc ~attrs (List.map (object_field sub) l) o - | Ptyp_class (lid, tl) -> - class_ ~loc ~attrs (map_loc sub lid) (List.map (sub # typ) tl) - | Ptyp_alias (t, s) -> alias ~loc ~attrs (sub # typ t) s - | Ptyp_variant (rl, b, ll) -> - variant ~loc ~attrs (List.map (row_field sub) rl) b ll - | Ptyp_poly (sl, t) -> poly ~loc ~attrs sl (sub # typ t) - | Ptyp_package (lid, l) -> - package ~loc ~attrs (map_loc sub lid) - (List.map (map_tuple (map_loc sub) (sub # typ)) l) - | Ptyp_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_type_declaration sub - {ptype_name; ptype_params; ptype_cstrs; - ptype_kind; - ptype_private; - ptype_manifest; - ptype_attributes; - ptype_loc} = - Type.mk (map_loc sub ptype_name) - ~params:(List.map (map_fst (sub # typ)) ptype_params) - ~priv:ptype_private - ~cstrs:(List.map (map_tuple3 (sub # typ) (sub # typ) (sub # location)) - ptype_cstrs) - ~kind:(sub # type_kind ptype_kind) - ?manifest:(map_opt (sub # typ) ptype_manifest) - ~loc:(sub # location ptype_loc) - ~attrs:(sub # attributes ptype_attributes) - - let map_type_kind sub = function - | Ptype_abstract -> Ptype_abstract - | Ptype_variant l -> - Ptype_variant (List.map (sub # constructor_declaration) l) - | Ptype_record l -> Ptype_record (List.map (sub # label_declaration) l) - | Ptype_open -> Ptype_open - - let map_type_extension sub - {ptyext_path; ptyext_params; - ptyext_constructors; - ptyext_private; - ptyext_attributes} = - Te.mk - (map_loc sub ptyext_path) - (List.map (sub # extension_constructor) ptyext_constructors) - ~params:(List.map (map_fst (sub # typ)) ptyext_params) - ~priv:ptyext_private - ~attrs:(sub # attributes ptyext_attributes) - - let map_extension_constructor_kind sub = function - Pext_decl(ctl, cto) -> - Pext_decl(sub # constructor_arguments ctl, map_opt (sub # typ) cto) - | Pext_rebind li -> - Pext_rebind (map_loc sub li) - - let map_extension_constructor sub - {pext_name; - pext_kind; - pext_loc; - pext_attributes} = - Te.constructor - (map_loc sub pext_name) - (map_extension_constructor_kind sub pext_kind) - ~loc:(sub # location pext_loc) - ~attrs:(sub # attributes pext_attributes) - - -end - -module CT = struct - (* Type expressions for the class language *) - - let map sub {pcty_loc = loc; pcty_desc = desc; pcty_attributes = attrs} = - let open Cty in - let loc = sub # location loc in - match desc with - | Pcty_constr (lid, tys) -> - constr ~loc ~attrs (map_loc sub lid) (List.map (sub # typ) tys) - | Pcty_signature x -> signature ~loc ~attrs (sub # class_signature x) - | Pcty_arrow (lab, t, ct) -> - arrow ~loc ~attrs lab (sub # typ t) (sub # class_type ct) - | Pcty_extension x -> extension ~loc ~attrs (sub # extension x) - | Pcty_open (ovf, lid, ct) -> - open_ ~loc ~attrs ovf (map_loc sub lid) (sub # class_type ct) - - let map_field sub {pctf_desc = desc; pctf_loc = loc; pctf_attributes = attrs} - = - let open Ctf in - let loc = sub # location loc in - match desc with - | Pctf_inherit ct -> inherit_ ~loc ~attrs (sub # class_type ct) - | Pctf_val (s, m, v, t) -> val_ ~loc ~attrs s m v (sub # typ t) - | Pctf_method (s, p, v, t) -> method_ ~loc ~attrs s p v (sub # typ t) - | Pctf_constraint (t1, t2) -> - constraint_ ~loc ~attrs (sub # typ t1) (sub # typ t2) - | Pctf_attribute x -> attribute ~loc (sub # attribute x) - | Pctf_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_signature sub {pcsig_self; pcsig_fields} = - Csig.mk - (sub # typ pcsig_self) - (List.map (sub # class_type_field) pcsig_fields) -end - -module MT = struct - (* Type expressions for the module language *) - - let map sub {pmty_desc = desc; pmty_loc = loc; pmty_attributes = attrs} = - let open Mty in - let loc = sub # location loc in - let attrs = sub # attributes attrs in - match desc with - | Pmty_ident s -> ident ~loc ~attrs (map_loc sub s) - | Pmty_alias s -> alias ~loc ~attrs (map_loc sub s) - | Pmty_signature sg -> signature ~loc ~attrs (sub # signature sg) - | Pmty_functor (s, mt1, mt2) -> - functor_ ~loc ~attrs (map_loc sub s) - (map_opt (sub # module_type) mt1) - (sub # module_type mt2) - | Pmty_with (mt, l) -> - with_ ~loc ~attrs (sub # module_type mt) - (List.map (sub # with_constraint) l) - | Pmty_typeof me -> typeof_ ~loc ~attrs (sub # module_expr me) - | Pmty_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_with_constraint sub = function - | Pwith_type (lid, d) -> - Pwith_type (map_loc sub lid, sub # type_declaration d) - | Pwith_module (lid, lid2) -> - Pwith_module (map_loc sub lid, map_loc sub lid2) - | Pwith_typesubst (lid, d) -> - Pwith_typesubst (map_loc sub lid, sub # type_declaration d) - | Pwith_modsubst (lid, lid2) -> - Pwith_modsubst (map_loc sub lid, map_loc sub lid2) - - let map_signature_item sub {psig_desc = desc; psig_loc = loc} = - let open Sig in - let loc = sub # location loc in - match desc with - | Psig_value vd -> value ~loc (sub # value_description vd) - | Psig_type (rf, l) -> type_ ~loc rf (List.map (sub # type_declaration) l) - | Psig_typext te -> type_extension ~loc (sub # type_extension te) - | Psig_exception ed -> exception_ ~loc (sub # extension_constructor ed) - | Psig_module x -> module_ ~loc (sub # module_declaration x) - | Psig_recmodule l -> - rec_module ~loc (List.map (sub # module_declaration) l) - | Psig_modtype x -> modtype ~loc (sub # module_type_declaration x) - | Psig_open od -> open_ ~loc (sub # open_description od) - | Psig_include x -> include_ ~loc (sub # include_description x) - | Psig_class l -> class_ ~loc (List.map (sub # class_description) l) - | Psig_class_type l -> - class_type ~loc (List.map (sub # class_type_declaration) l) - | Psig_extension (x, attrs) -> - extension ~loc (sub # extension x) ~attrs:(sub # attributes attrs) - | Psig_attribute x -> attribute ~loc (sub # attribute x) -end - - -module M = struct - (* Value expressions for the module language *) - - let map sub {pmod_loc = loc; pmod_desc = desc; pmod_attributes = attrs} = - let open Mod in - let loc = sub # location loc in - let attrs = sub # attributes attrs in - match desc with - | Pmod_ident x -> ident ~loc ~attrs (map_loc sub x) - | Pmod_structure str -> structure ~loc ~attrs (sub # structure str) - | Pmod_functor (arg, arg_ty, body) -> - functor_ ~loc ~attrs (map_loc sub arg) - (map_opt (sub # module_type) arg_ty) - (sub # module_expr body) - | Pmod_apply (m1, m2) -> - apply ~loc ~attrs (sub # module_expr m1) (sub # module_expr m2) - | Pmod_constraint (m, mty) -> - constraint_ ~loc ~attrs (sub # module_expr m) (sub # module_type mty) - | Pmod_unpack e -> unpack ~loc ~attrs (sub # expr e) - | Pmod_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_structure_item sub {pstr_loc = loc; pstr_desc = desc} = - let open Str in - let loc = sub # location loc in - match desc with - | Pstr_eval (x, attrs) -> - eval ~loc ~attrs:(sub # attributes attrs) (sub # expr x) - | Pstr_value (r, vbs) -> value ~loc r (List.map (sub # value_binding) vbs) - | Pstr_primitive vd -> primitive ~loc (sub # value_description vd) - | Pstr_type (rf, l) -> type_ ~loc rf (List.map (sub # type_declaration) l) - | Pstr_typext te -> type_extension ~loc (sub # type_extension te) - | Pstr_exception ed -> exception_ ~loc (sub # extension_constructor ed) - | Pstr_module x -> module_ ~loc (sub # module_binding x) - | Pstr_recmodule l -> rec_module ~loc (List.map (sub # module_binding) l) - | Pstr_modtype x -> modtype ~loc (sub # module_type_declaration x) - | Pstr_open od -> open_ ~loc (sub # open_description od) - | Pstr_class l -> class_ ~loc (List.map (sub # class_declaration) l) - | Pstr_class_type l -> - class_type ~loc (List.map (sub # class_type_declaration) l) - | Pstr_include x -> include_ ~loc (sub # include_declaration x) - | Pstr_extension (x, attrs) -> - extension ~loc (sub # extension x) ~attrs:(sub # attributes attrs) - | Pstr_attribute x -> attribute ~loc (sub # attribute x) -end - -module E = struct - (* Value expressions for the core language *) - - let map sub {pexp_loc = loc; pexp_desc = desc; pexp_attributes = attrs} = - let open Exp in - let loc = sub # location loc in - let attrs = sub # attributes attrs in - match desc with - | Pexp_ident x -> ident ~loc ~attrs (map_loc sub x) - | Pexp_constant x -> constant ~loc ~attrs x - | Pexp_let (r, vbs, e) -> - let_ ~loc ~attrs r (List.map (sub # value_binding) vbs) (sub # expr e) - | Pexp_fun (lab, def, p, e) -> - fun_ ~loc ~attrs lab (map_opt (sub # expr) def) (sub # pat p) - (sub # expr e) - | Pexp_function pel -> function_ ~loc ~attrs (sub # cases pel) - | Pexp_apply (e, l) -> - apply ~loc ~attrs (sub # expr e) (List.map (map_snd (sub # expr)) l) - | Pexp_match (e, pel) -> match_ ~loc ~attrs (sub # expr e) (sub # cases pel) - | Pexp_try (e, pel) -> try_ ~loc ~attrs (sub # expr e) (sub # cases pel) - | Pexp_tuple el -> tuple ~loc ~attrs (List.map (sub # expr) el) - | Pexp_construct (lid, arg) -> - construct ~loc ~attrs (map_loc sub lid) (map_opt (sub # expr) arg) - | Pexp_variant (lab, eo) -> - variant ~loc ~attrs lab (map_opt (sub # expr) eo) - | Pexp_record (l, eo) -> - record ~loc ~attrs (List.map (map_tuple (map_loc sub) (sub # expr)) l) - (map_opt (sub # expr) eo) - | Pexp_field (e, lid) -> field ~loc ~attrs (sub # expr e) (map_loc sub lid) - | Pexp_setfield (e1, lid, e2) -> - setfield ~loc ~attrs (sub # expr e1) (map_loc sub lid) (sub # expr e2) - | Pexp_array el -> array ~loc ~attrs (List.map (sub # expr) el) - | Pexp_ifthenelse (e1, e2, e3) -> - ifthenelse ~loc ~attrs (sub # expr e1) (sub # expr e2) - (map_opt (sub # expr) e3) - | Pexp_sequence (e1, e2) -> - sequence ~loc ~attrs (sub # expr e1) (sub # expr e2) - | Pexp_while (e1, e2) -> while_ ~loc ~attrs (sub # expr e1) (sub # expr e2) - | Pexp_for (p, e1, e2, d, e3) -> - for_ ~loc ~attrs (sub # pat p) (sub # expr e1) (sub # expr e2) d - (sub # expr e3) - | Pexp_coerce (e, t1, t2) -> - coerce ~loc ~attrs (sub # expr e) (map_opt (sub # typ) t1) - (sub # typ t2) - | Pexp_constraint (e, t) -> - constraint_ ~loc ~attrs (sub # expr e) (sub # typ t) - | Pexp_send (e, s) -> send ~loc ~attrs (sub # expr e) s - | Pexp_new lid -> new_ ~loc ~attrs (map_loc sub lid) - | Pexp_setinstvar (s, e) -> - setinstvar ~loc ~attrs (map_loc sub s) (sub # expr e) - | Pexp_override sel -> - override ~loc ~attrs - (List.map (map_tuple (map_loc sub) (sub # expr)) sel) - | Pexp_letmodule (s, me, e) -> - letmodule ~loc ~attrs (map_loc sub s) (sub # module_expr me) - (sub # expr e) - | Pexp_letexception (cd, e) -> - letexception ~loc ~attrs - (sub # extension_constructor cd) - (sub # expr e) - | Pexp_assert e -> assert_ ~loc ~attrs (sub # expr e) - | Pexp_lazy e -> lazy_ ~loc ~attrs (sub # expr e) - | Pexp_poly (e, t) -> - poly ~loc ~attrs (sub # expr e) (map_opt (sub # typ) t) - | Pexp_object cls -> object_ ~loc ~attrs (sub # class_structure cls) - | Pexp_newtype (s, e) -> newtype ~loc ~attrs s (sub # expr e) - | Pexp_pack me -> pack ~loc ~attrs (sub # module_expr me) - | Pexp_open (ovf, lid, e) -> - open_ ~loc ~attrs ovf (map_loc sub lid) (sub # expr e) - | Pexp_extension x -> extension ~loc ~attrs (sub # extension x) - | Pexp_unreachable -> unreachable ~loc ~attrs () -end - -module P = struct - (* Patterns *) - - let map sub {ppat_desc = desc; ppat_loc = loc; ppat_attributes = attrs} = - let open Pat in - let loc = sub # location loc in - let attrs = sub # attributes attrs in - match desc with - | Ppat_any -> any ~loc ~attrs () - | Ppat_var s -> var ~loc ~attrs (map_loc sub s) - | Ppat_alias (p, s) -> alias ~loc ~attrs (sub # pat p) (map_loc sub s) - | Ppat_constant c -> constant ~loc ~attrs c - | Ppat_interval (c1, c2) -> interval ~loc ~attrs c1 c2 - | Ppat_tuple pl -> tuple ~loc ~attrs (List.map (sub # pat) pl) - | Ppat_construct (l, p) -> - construct ~loc ~attrs (map_loc sub l) (map_opt (sub # pat) p) - | Ppat_variant (l, p) -> variant ~loc ~attrs l (map_opt (sub # pat) p) - | Ppat_record (lpl, cf) -> - record ~loc ~attrs (List.map (map_tuple (map_loc sub) (sub # pat)) lpl) - cf - | Ppat_array pl -> array ~loc ~attrs (List.map (sub # pat) pl) - | Ppat_or (p1, p2) -> or_ ~loc ~attrs (sub # pat p1) (sub # pat p2) - | Ppat_constraint (p, t) -> - constraint_ ~loc ~attrs (sub # pat p) (sub # typ t) - | Ppat_type s -> type_ ~loc ~attrs (map_loc sub s) - | Ppat_lazy p -> lazy_ ~loc ~attrs (sub # pat p) - | Ppat_unpack s -> unpack ~loc ~attrs (map_loc sub s) - | Ppat_exception p -> exception_ ~loc ~attrs (sub # pat p) - | Ppat_extension x -> extension ~loc ~attrs (sub # extension x) - | Ppat_open (l, p) -> open_ ~loc ~attrs (map_loc sub l) (sub # pat p) -end - -module CE = struct - (* Value expressions for the class language *) - - let map sub {pcl_loc = loc; pcl_desc = desc; pcl_attributes = attrs} = - let open Cl in - let loc = sub # location loc in - match desc with - | Pcl_constr (lid, tys) -> - constr ~loc ~attrs (map_loc sub lid) (List.map (sub # typ) tys) - | Pcl_structure s -> - structure ~loc ~attrs (sub # class_structure s) - | Pcl_fun (lab, e, p, ce) -> - fun_ ~loc ~attrs lab - (map_opt (sub # expr) e) - (sub # pat p) - (sub # class_expr ce) - | Pcl_apply (ce, l) -> - apply ~loc ~attrs (sub # class_expr ce) - (List.map (map_snd (sub # expr)) l) - | Pcl_let (r, vbs, ce) -> - let_ ~loc ~attrs r (List.map (sub # value_binding) vbs) - (sub # class_expr ce) - | Pcl_constraint (ce, ct) -> - constraint_ ~loc ~attrs (sub # class_expr ce) (sub # class_type ct) - | Pcl_extension x -> extension ~loc ~attrs (sub # extension x) - | Pcl_open (ovf, lid, ce) -> - open_ ~loc ~attrs ovf (map_loc sub lid) (sub # class_expr ce) - - let map_kind sub = function - | Cfk_concrete (o, e) -> Cfk_concrete (o, sub # expr e) - | Cfk_virtual t -> Cfk_virtual (sub # typ t) - - let map_field sub {pcf_desc = desc; pcf_loc = loc; pcf_attributes = attrs} = - let open Cf in - let loc = sub # location loc in - match desc with - | Pcf_inherit (o, ce, s) -> inherit_ ~loc ~attrs o (sub # class_expr ce) s - | Pcf_val (s, m, k) -> val_ ~loc ~attrs (map_loc sub s) m (map_kind sub k) - | Pcf_method (s, p, k) -> - method_ ~loc ~attrs (map_loc sub s) p (map_kind sub k) - | Pcf_constraint (t1, t2) -> - constraint_ ~loc ~attrs (sub # typ t1) (sub # typ t2) - | Pcf_initializer e -> initializer_ ~loc ~attrs (sub # expr e) - | Pcf_attribute x -> attribute ~loc (sub # attribute x) - | Pcf_extension x -> extension ~loc ~attrs (sub # extension x) - - let map_structure sub {pcstr_self; pcstr_fields} = - { - pcstr_self = sub # pat pcstr_self; - pcstr_fields = List.map (sub # class_field) pcstr_fields; - } - - let class_infos sub f {pci_virt; pci_params = pl; pci_name; pci_expr; - pci_loc; pci_attributes} = - Ci.mk - ~virt:pci_virt - ~params:(List.map (map_fst (sub # typ)) pl) - (map_loc sub pci_name) - (f pci_expr) - ~loc:(sub # location pci_loc) - ~attrs:(sub # attributes pci_attributes) -end - -(* Now, a generic AST mapper class, to be extended to cover all kinds - and cases of the OCaml grammar. The default behavior of the mapper - is the identity. *) - -class mapper = - object(this) - method structure l = List.map (this # structure_item) l - method structure_item si = M.map_structure_item this si - method module_expr = M.map this - - method signature l = List.map (this # signature_item) l - method signature_item si = MT.map_signature_item this si - method module_type = MT.map this - method with_constraint c = MT.map_with_constraint this c - - method class_declaration = CE.class_infos this (this # class_expr) - method class_expr = CE.map this - method class_field = CE.map_field this - method class_structure = CE.map_structure this - - method class_type = CT.map this - method class_type_field = CT.map_field this - method class_signature = CT.map_signature this - - method class_type_declaration = CE.class_infos this (this # class_type) - method class_description = CE.class_infos this (this # class_type) - - method type_declaration = T.map_type_declaration this - method type_kind = T.map_type_kind this - method typ = T.map this - - method type_extension = T.map_type_extension this - method extension_constructor = T.map_extension_constructor this - - method value_description {pval_name; pval_type; pval_prim; pval_loc; - pval_attributes} = - Val.mk - (map_loc this pval_name) - (this # typ pval_type) - ~attrs:(this # attributes pval_attributes) - ~loc:(this # location pval_loc) - ~prim:pval_prim - - method pat = P.map this - method expr = E.map this - - method module_declaration {pmd_name; pmd_type; pmd_attributes; pmd_loc} = - Md.mk - (map_loc this pmd_name) - (this # module_type pmd_type) - ~attrs:(this # attributes pmd_attributes) - ~loc:(this # location pmd_loc) - - method module_type_declaration {pmtd_name; pmtd_type; pmtd_attributes; pmtd_loc} = - Mtd.mk - (map_loc this pmtd_name) - ?typ:(map_opt (this # module_type) pmtd_type) - ~attrs:(this # attributes pmtd_attributes) - ~loc:(this # location pmtd_loc) - - method module_binding {pmb_name; pmb_expr; pmb_attributes; pmb_loc} = - Mb.mk (map_loc this pmb_name) (this # module_expr pmb_expr) - ~attrs:(this # attributes pmb_attributes) - ~loc:(this # location pmb_loc) - - method value_binding {pvb_pat; pvb_expr; pvb_attributes; pvb_loc} = - Vb.mk - (this # pat pvb_pat) - (this # expr pvb_expr) - ~attrs:(this # attributes pvb_attributes) - ~loc:(this # location pvb_loc) - - method constructor_arguments = function - | Pcstr_tuple (tys) -> Pcstr_tuple (List.map (this # typ) tys) - | Pcstr_record (ls) -> Pcstr_record (List.map (this # label_declaration) ls) - - method constructor_declaration {pcd_name; pcd_args; pcd_res; pcd_loc; - pcd_attributes} = - Type.constructor - (map_loc this pcd_name) - ~args:(this # constructor_arguments pcd_args) - ?res:(map_opt (this # typ) pcd_res) - ~loc:(this # location pcd_loc) - ~attrs:(this # attributes pcd_attributes) - - method label_declaration {pld_name; pld_type; pld_loc; pld_mutable; - pld_attributes} = - Type.field - (map_loc this pld_name) - (this # typ pld_type) - ~mut:pld_mutable - ~loc:(this # location pld_loc) - ~attrs:(this # attributes pld_attributes) - - - method cases l = List.map (this # case) l - method case {pc_lhs; pc_guard; pc_rhs} = - { - pc_lhs = this # pat pc_lhs; - pc_guard = map_opt (this # expr) pc_guard; - pc_rhs = this # expr pc_rhs; - } - - method open_description - {popen_lid; popen_override; popen_attributes; popen_loc} = - Opn.mk (map_loc this popen_lid) - ~override:popen_override - ~loc:(this # location popen_loc) - ~attrs:(this # attributes popen_attributes) - - method include_description - {pincl_mod; pincl_attributes; pincl_loc} = - Incl.mk (this # module_type pincl_mod) - ~loc:(this # location pincl_loc) - ~attrs:(this # attributes pincl_attributes) - - method include_declaration - {pincl_mod; pincl_attributes; pincl_loc} = - Incl.mk (this # module_expr pincl_mod) - ~loc:(this # location pincl_loc) - ~attrs:(this # attributes pincl_attributes) - - method location l = l - - method extension (s, e) = (map_loc this s, this # payload e) - method attribute (s, e) = (map_loc this s, this # payload e) - method attributes l = List.map (this # attribute) l - method payload = function - | PStr x -> PStr (this # structure x) - | PTyp x -> PTyp (this # typ x) - | PPat (x, g) -> PPat (this # pat x, map_opt (this # expr) g) - | PSig x -> PSig (this # signature x) - end - - -let to_mapper this = - let open Ast_mapper in - { - attribute = (fun _ -> this # attribute); - attributes = (fun _ -> this # attributes); - case = (fun _ -> this # case); - cases = (fun _ -> this # cases); - class_declaration = (fun _ -> this # class_declaration); - class_description = (fun _ -> this # class_description); - class_expr = (fun _ -> this # class_expr); - class_field = (fun _ -> this # class_field); - class_signature = (fun _ -> this # class_signature); - class_structure = (fun _ -> this # class_structure); - class_type = (fun _ -> this # class_type); - class_type_declaration = (fun _ -> this # class_type_declaration); - class_type_field = (fun _ -> this # class_type_field); - constructor_declaration = (fun _ -> this # constructor_declaration); - expr = (fun _ -> this # expr); - extension = (fun _ -> this # extension); - extension_constructor = (fun _ -> this # extension_constructor); - include_declaration = (fun _ -> this # include_declaration); - include_description = (fun _ -> this # include_description); - label_declaration = (fun _ -> this # label_declaration); - location = (fun _ -> this # location); - module_binding = (fun _ -> this # module_binding); - module_declaration = (fun _ -> this # module_declaration); - module_expr = (fun _ -> this # module_expr); - module_type = (fun _ -> this # module_type); - module_type_declaration = (fun _ -> this # module_type_declaration); - open_description = (fun _ -> this # open_description); - pat = (fun _ -> this # pat); - payload = (fun _ -> this # payload); - signature = (fun _ -> this # signature); - signature_item = (fun _ -> this # signature_item); - structure = (fun _ -> this # structure); - structure_item = (fun _ -> this # structure_item); - typ = (fun _ -> this # typ); - type_declaration = (fun _ -> this # type_declaration); - type_extension = (fun _ -> this # type_extension); - type_kind = (fun _ -> this # type_kind); - value_binding = (fun _ -> this # value_binding); - value_description = (fun _ -> this # value_description); - with_constraint = (fun _ -> this # with_constraint); - } diff --git a/ppx_tools_versioned.5.2/ast_mapper_class_406.mli b/ppx_tools_versioned.5.2/ast_mapper_class_406.mli deleted file mode 100644 index 08e1849..0000000 --- a/ppx_tools_versioned.5.2/ast_mapper_class_406.mli +++ /dev/null @@ -1,58 +0,0 @@ -open Ast_406 - -(* This file is part of the ppx_tools package. It is released *) -(* under the terms of the MIT license (see LICENSE file). *) -(* Copyright 2013 Alain Frisch and LexiFi *) - -(** Class-based customizable mapper *) - -open Parsetree - -class mapper: - object - method attribute: attribute -> attribute - method attributes: attribute list -> attribute list - method case: case -> case - method cases: case list -> case list - method class_declaration: class_declaration -> class_declaration - method class_description: class_description -> class_description - method class_expr: class_expr -> class_expr - method class_field: class_field -> class_field - method class_signature: class_signature -> class_signature - method class_structure: class_structure -> class_structure - method class_type: class_type -> class_type - method class_type_declaration: class_type_declaration -> class_type_declaration - method class_type_field: class_type_field -> class_type_field - method constructor_arguments: constructor_arguments -> constructor_arguments - method constructor_declaration: constructor_declaration -> constructor_declaration - method expr: expression -> expression - method extension: extension -> extension - method extension_constructor: extension_constructor -> extension_constructor - method include_declaration: include_declaration -> include_declaration - method include_description: include_description -> include_description - method label_declaration: label_declaration -> label_declaration - method location: Location.t -> Location.t - method module_binding: module_binding -> module_binding - method module_declaration: module_declaration -> module_declaration - method module_expr: module_expr -> module_expr - method module_type: module_type -> module_type - method module_type_declaration: module_type_declaration -> module_type_declaration - method open_description: open_description -> open_description - method pat: pattern -> pattern - method payload: payload -> payload - method signature: signature -> signature - method signature_item: signature_item -> signature_item - method structure: structure -> structure - method structure_item: structure_item -> structure_item - method typ: core_type -> core_type - method type_declaration: type_declaration -> type_declaration - method type_extension: type_extension -> type_extension - method type_kind: type_kind -> type_kind - method value_binding: value_binding -> value_binding - method value_description: value_description -> value_description - method with_constraint: with_constraint -> with_constraint - end - -val to_mapper: #mapper -> Ast_mapper.mapper -(** The resulting mapper is "closed", i.e. methods ignore - their first argument. *) diff --git a/ppx_tools_versioned.5.2/example/ppx_once/META b/ppx_tools_versioned.5.2/example/ppx_once/META deleted file mode 100644 index 28ca40b..0000000 --- a/ppx_tools_versioned.5.2/example/ppx_once/META +++ /dev/null @@ -1,8 +0,0 @@ -description = "once: execute expressions only once" -version = "1.0" -requires(custom_ppx) = "ocaml-migrate-parsetree" -ppx(-custom_ppx,-ppx_driver) = "./ppx_once --as-ppx" -archive(byte,ppx_driver) = "ppx_once.cmo" -archive(native,ppx_driver) = "ppx_once.cmx" -plugin(byte,ppx_driver) = "ppx_once.cma" -plugin(native,ppx_driver) = "ppx_once.cmxs" diff --git a/ppx_tools_versioned.5.2/example/ppx_once/Makefile b/ppx_tools_versioned.5.2/example/ppx_once/Makefile deleted file mode 100644 index 56b8b3e..0000000 --- a/ppx_tools_versioned.5.2/example/ppx_once/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -PACKAGE=ppx_once -OCAMLC=ocamlfind c -OCAMLOPT=ocamlfind opt -FLAGS=-package ocaml-migrate-parsetree,ppx_tools_versioned.metaquot_405 -TARGETS=ppx_once ppx_once.cmo ppx_once.cmx ppx_once.cmxs - -all: build - -clean: - rm -f *.o *.cm* $(TARGETS) - -build: $(TARGETS) - -install: build - ocamlfind install $(PACKAGE) META $(TARGETS) - -uninstall: - ocamlfind remove $(PACKAGE) - -reinstall: - $(MAKE) uninstall - $(MAKE) install - -%.cmo: %.ml - $(OCAMLC) $(FLAGS) -c $^ - -%.cmx: %.ml - $(OCAMLOPT) $(FLAGS) -c $^ - -ppx_once.cmxs: ppx_once.cmx - $(OCAMLOPT) -o $@ -shared $^ - -ppx_once: ppx_once.cmx standalone.ml - $(OCAMLOPT) $(FLAGS) -o $@ -linkpkg $^ diff --git a/ppx_tools_versioned.5.2/example/ppx_once/ppx_once.ml b/ppx_tools_versioned.5.2/example/ppx_once/ppx_once.ml deleted file mode 100644 index 46fd83b..0000000 --- a/ppx_tools_versioned.5.2/example/ppx_once/ppx_once.ml +++ /dev/null @@ -1,70 +0,0 @@ -open Migrate_parsetree -open Ast_405 -open Ppx_tools_405 - -(* - * This ppx rewrites expression extension of the form [%once expr]. - * The first time the expression is evaluated, its result is cached. - * After that, the evaluation will be skipped and the result reused. - * - * The ppx introduces references at the top-level to cache the results. - *) - -let inject_once var code = - [%expr match ![%e var] with - | Some result -> result - | None -> - let result = [%e code] in - [%e var] := Some result; - result] - [@metaloc {code.Parsetree.pexp_loc with Location.loc_ghost = true}] - -let mapper _config _cookies = - let open Ast_mapper in - let toplevel = ref true in - let uid = ref 0 in - let insert = ref [] in - let make_option name = [%str let [%p Ast_helper.Pat.var name] = ref None] in - let toplevel_structure mapper str = - let items = List.fold_left (fun acc x -> - let x' = mapper.structure_item mapper x in - let items = List.map make_option !insert in - insert := []; - x' :: List.concat items @ acc - ) [] str - in - List.rev items - in - let expr mapper pexp = - let open Parsetree in - match pexp.pexp_desc with - | Pexp_extension ( - {Location. txt = "once"; loc}, - payload - ) -> - begin match payload with - | PStr [{pstr_desc = Pstr_eval (body, []) }] -> - incr uid; - let name = "__ppx_once_" ^ string_of_int !uid in - insert := Location.mkloc name loc :: !insert; - inject_once - (Ast_helper.Exp.ident (Location.mkloc (Longident.Lident name) loc)) - (mapper.expr mapper body) - | _ -> default_mapper.expr mapper pexp - end; - | _ -> default_mapper.expr mapper pexp - in - let structure mapper str = - if !toplevel then ( - uid := 0; - insert := []; - toplevel := false; - match toplevel_structure mapper str with - | result -> toplevel := true; result - | exception exn -> toplevel := true; raise exn - ) else - default_mapper.structure mapper str - in - {default_mapper with structure; expr} - -let () = Driver.register ~name:"ppx_once" Versions.ocaml_405 mapper diff --git a/ppx_tools_versioned.5.2/example/ppx_once/standalone.ml b/ppx_tools_versioned.5.2/example/ppx_once/standalone.ml deleted file mode 100644 index 8834410..0000000 --- a/ppx_tools_versioned.5.2/example/ppx_once/standalone.ml +++ /dev/null @@ -1,4 +0,0 @@ -open Migrate_parsetree - -(* To run as a standalone binary, run the registered drivers *) -let () = Driver.run_main () diff --git a/ppx_tools_versioned.5.2/gen/update_jbuild.ml b/ppx_tools_versioned.5.2/gen/update_jbuild.ml deleted file mode 100644 index ce11e73..0000000 --- a/ppx_tools_versioned.5.2/gen/update_jbuild.ml +++ /dev/null @@ -1,48 +0,0 @@ -let versions = ["402"; "403"; "404"; "405"; "406"] - -let flags = "(:standard -w +A-4-17-44-45-105-42 -safe-string)" - -let ppx_tools_versioned_modules = - versions - |> List.map (fun v -> - [ "ast_convenience" - ; "ast_mapper_class" - ; "ast_lifter" - ; "ppx_tools" ] - |> List.map (fun m -> Printf.sprintf "%s_%s" m v) - |> String.concat " " - ) - |> String.concat "\n" - -let () = - Printf.printf - {sexp| -(library - ((name flow-parser.ppx_tools_versioned) - (public_name flow-parser.ppx_tools_versioned) - (synopsis "Tools for authors of ppx rewriters and other syntactic tools (with ocaml-migrate-parsetree support)") - (libraries (ocaml-migrate-parsetree)) - (flags (%s)) - (wrapped false) - (modules (%s)))) -|sexp} flags ppx_tools_versioned_modules - -let synopsis_v v = - Printf.sprintf "%c.%s" v.[0] (String.sub v 1 (String.length v - 1)) - -let () = - List.iter (fun version -> - Printf.printf - {sexp| -(library - ((name flow-parser.ppx_tools_versioned_metaquot_%s) - (public_name flow-parser.ppx_tools_versioned.metaquot_%s) - (synopsis "Meta-quotation: %s parsetree quotation") - (libraries (ocaml-migrate-parsetree flow-parser.ppx_tools_versioned)) - (kind ppx_rewriter) - (ppx_runtime_libraries (flow-parser.ppx_tools_versioned)) - (wrapped false) - (modules (ppx_metaquot_%s)) - (flags (%s)))) -|sexp} version version (synopsis_v version) version flags - ) versions diff --git a/ppx_tools_versioned.5.2/jbuild b/ppx_tools_versioned.5.2/jbuild deleted file mode 100644 index 19128ce..0000000 --- a/ppx_tools_versioned.5.2/jbuild +++ /dev/null @@ -1,11 +0,0 @@ -(jbuild_version 1) - -(rule - (with-stdout-to jbuild.inc.gen - (run ocaml ${path:gen/update_jbuild.ml}))) - -(alias - ((name runtest) - (action (diff jbuild.inc jbuild.inc.gen)))) - -(include jbuild.inc) diff --git a/ppx_tools_versioned.5.2/jbuild-workspace.dev b/ppx_tools_versioned.5.2/jbuild-workspace.dev deleted file mode 100644 index 7b7de5f..0000000 --- a/ppx_tools_versioned.5.2/jbuild-workspace.dev +++ /dev/null @@ -1,5 +0,0 @@ -(context (opam (switch 4.02.3))) -(context (opam (switch 4.03.0))) -(context (opam (switch 4.04.2))) -(context (opam (switch 4.05.0))) -(context (opam (switch 4.06.0))) \ No newline at end of file diff --git a/ppx_tools_versioned.5.2/jbuild.inc b/ppx_tools_versioned.5.2/jbuild.inc deleted file mode 100644 index bb9c7f2..0000000 --- a/ppx_tools_versioned.5.2/jbuild.inc +++ /dev/null @@ -1,68 +0,0 @@ - -(library - ((name ppx_tools_versioned) - (public_name flow-parser.flow-parser.ppx_tools_versioned) - (synopsis "Tools for authors of ppx rewriters and other syntactic tools (with ocaml-migrate-parsetree support)") - (libraries (ocaml-migrate-parsetree)) - (flags ((:standard -w +A-4-17-44-45-105-42 -safe-string))) - (wrapped false) - (modules (ast_convenience_402 ast_mapper_class_402 ast_lifter_402 ppx_tools_402 -ast_convenience_403 ast_mapper_class_403 ast_lifter_403 ppx_tools_403 -ast_convenience_404 ast_mapper_class_404 ast_lifter_404 ppx_tools_404 -ast_convenience_405 ast_mapper_class_405 ast_lifter_405 ppx_tools_405 -ast_convenience_406 ast_mapper_class_406 ast_lifter_406 ppx_tools_406)))) - -(library - ((name ppx_tools_versioned_metaquot_402) - (public_name flow-parser.ppx_tools_versioned.metaquot_402) - (synopsis "Meta-quotation: 4.02 parsetree quotation") - (libraries (ocaml-migrate-parsetree ppx_tools_versioned)) - (kind ppx_rewriter) - (ppx_runtime_libraries (ppx_tools_versioned)) - (wrapped false) - (modules (ppx_metaquot_402)) - (flags ((:standard -w +A-4-17-44-45-105-42 -safe-string))))) - -(library - ((name ppx_tools_versioned_metaquot_403) - (public_name flow-parser.ppx_tools_versioned.metaquot_403) - (synopsis "Meta-quotation: 4.03 parsetree quotation") - (libraries (ocaml-migrate-parsetree ppx_tools_versioned)) - (kind ppx_rewriter) - (ppx_runtime_libraries (ppx_tools_versioned)) - (wrapped false) - (modules (ppx_metaquot_403)) - (flags ((:standard -w +A-4-17-44-45-105-42 -safe-string))))) - -(library - ((name ppx_tools_versioned_metaquot_404) - (public_name flow-parser.ppx_tools_versioned.metaquot_404) - (synopsis "Meta-quotation: 4.04 parsetree quotation") - (libraries (ocaml-migrate-parsetree ppx_tools_versioned)) - (kind ppx_rewriter) - (ppx_runtime_libraries (ppx_tools_versioned)) - (wrapped false) - (modules (ppx_metaquot_404)) - (flags ((:standard -w +A-4-17-44-45-105-42 -safe-string))))) - -(library - ((name ppx_tools_versioned_metaquot_405) - (public_name flow-parser.ppx_tools_versioned.metaquot_405) - (synopsis "Meta-quotation: 4.05 parsetree quotation") - (libraries (ocaml-migrate-parsetree ppx_tools_versioned)) - (kind ppx_rewriter) - (ppx_runtime_libraries (ppx_tools_versioned)) - (wrapped false) - (modules (ppx_metaquot_405)) - (flags ((:standard -w +A-4-17-44-45-105-42 -safe-string))))) - -(library - ((name ppx_tools_versioned_metaquot_406) - (public_name flow-parser.ppx_tools_versioned.metaquot_406) - (synopsis "Meta-quotation: 4.06 parsetree quotation") - (libraries (ocaml-migrate-parsetree ppx_tools_versioned)) - (kind ppx_rewriter) - (ppx_runtime_libraries (ppx_tools_versioned)) - (wrapped false) - (modules (ppx_metaquot_406)) - (flags ((:standard -w +A-4-17-44-45-105-42 -safe-string))))) diff --git a/ppx_tools_versioned.5.2/pkg/pkg.ml b/ppx_tools_versioned.5.2/pkg/pkg.ml deleted file mode 100644 index 1a04c2b..0000000 --- a/ppx_tools_versioned.5.2/pkg/pkg.ml +++ /dev/null @@ -1,2 +0,0 @@ -#use "topfind" -#require "topkg-jbuilder.auto" diff --git a/ppx_tools_versioned.5.2/ppx_metaquot_402.ml b/ppx_tools_versioned.5.2/ppx_metaquot_402.ml deleted file mode 100644 index e09dd82..0000000 --- a/ppx_tools_versioned.5.2/ppx_metaquot_402.ml +++ /dev/null @@ -1,236 +0,0 @@ -open Ast_402 - -(* This file is part of the ppx_tools package. It is released *) -(* under the terms of the MIT license (see LICENSE file). *) -(* Copyright 2013 Alain Frisch and LexiFi *) - -(* A -ppx rewriter to be used to write Parsetree-generating code - (including other -ppx rewriters) using concrete syntax. - - We support the following extensions in expression position: - - [%expr ...] maps to code which creates the expression represented by ... - [%pat? ...] maps to code which creates the pattern represented by ... - [%str ...] maps to code which creates the structure represented by ... - [%stri ...] maps to code which creates the structure item represented by ... - [%type: ...] maps to code which creates the core type represented by ... - - Quoted code can refer to expressions representing AST fragments, - using the following extensions: - - [%e ...] where ... is an expression of type Parsetree.expression - [%t ...] where ... is an expression of type Parsetree.core_type - [%p ...] where ... is an expression of type Parsetree.pattern - - - All locations generated by the meta quotation are by default set - to [Ast_helper.default_loc]. This can be overriden by providing a custom - expression which will be inserted whereever a location is required - in the generated AST. This expression can be specified globally - (for the current structure) as a structure item attribute: - - ;;[@@metaloc ...] - - or locally for the scope of an expression: - - e [@metaloc ...] - - - - Support is also provided to use concrete syntax in pattern - position. The location and attribute fields are currently ignored - by patterns generated from meta quotations. - - We support the following extensions in pattern position: - - [%expr ...] maps to code which creates the expression represented by ... - [%pat? ...] maps to code which creates the pattern represented by ... - [%str ...] maps to code which creates the structure represented by ... - [%type: ...] maps to code which creates the core type represented by ... - - Quoted code can refer to expressions representing AST fragments, - using the following extensions: - - [%e? ...] where ... is a pattern of type Parsetree.expression - [%t? ...] where ... is a pattern of type Parsetree.core_type - [%p? ...] where ... is a pattern of type Parsetree.pattern - -*) - -module Main : sig end = struct - open Asttypes - open Parsetree - open Ast_helper - open Ast_convenience_402 - - let prefix ty s = - let open Longident in - match parse ty with - | Ldot(m, _) -> String.concat "." (Longident.flatten m) ^ "." ^ s - | _ -> s - - class exp_builder = - object - method record ty x = record (List.map (fun (l, e) -> prefix ty l, e) x) - method constr ty (c, args) = constr (prefix ty c) args - method list l = list l - method tuple l = tuple l - method int i = int i - method string s = str s - method char c = char c - method int32 x = Exp.constant (Const_int32 x) - method int64 x = Exp.constant (Const_int64 x) - method nativeint x = Exp.constant (Const_nativeint x) - end - - class pat_builder = - object - method record ty x = precord ~closed:Closed (List.map (fun (l, e) -> prefix ty l, e) x) - method constr ty (c, args) = pconstr (prefix ty c) args - method list l = plist l - method tuple l = ptuple l - method int i = pint i - method string s = pstr s - method char c = pchar c - method int32 x = Pat.constant (Const_int32 x) - method int64 x = Pat.constant (Const_int64 x) - method nativeint x = Pat.constant (Const_nativeint x) - end - - - let get_exp loc = function - | PStr [ {pstr_desc=Pstr_eval (e, _); _} ] -> e - | _ -> - Format.eprintf "%aExpression expected@." - Location.print_error loc; - exit 2 - - let get_typ loc = function - | PTyp t -> t - | _ -> - Format.eprintf "%aType expected@." - Location.print_error loc; - exit 2 - - let get_pat loc = function - | PPat (t, None) -> t - | _ -> - Format.eprintf "%aPattern expected@." - Location.print_error loc; - exit 2 - - let exp_lifter loc map = - let map = map.Ast_mapper.expr map in - object - inherit [_] Ast_lifter_402.lifter as super - inherit exp_builder - - (* Special support for location in the generated AST *) - method! lift_Location_t _ = loc - - (* Support for antiquotations *) - method! lift_Parsetree_expression = function - | {pexp_desc=Pexp_extension({txt="e";loc}, e); _} -> map (get_exp loc e) - | x -> super # lift_Parsetree_expression x - - method! lift_Parsetree_pattern = function - | {ppat_desc=Ppat_extension({txt="p";loc}, e); _} -> map (get_exp loc e) - | x -> super # lift_Parsetree_pattern x - - method! lift_Parsetree_core_type = function - | {ptyp_desc=Ptyp_extension({txt="t";loc}, e); _} -> map (get_exp loc e) - | x -> super # lift_Parsetree_core_type x - end - - let pat_lifter map = - let map = map.Ast_mapper.pat map in - object - inherit [_] Ast_lifter_402.lifter as super - inherit pat_builder - - (* Special support for location and attributes in the generated AST *) - method! lift_Location_t _ = Pat.any () - method! lift_Parsetree_attributes _ = Pat.any () - - (* Support for antiquotations *) - method! lift_Parsetree_expression = function - | {pexp_desc=Pexp_extension({txt="e";loc}, e); _} -> map (get_pat loc e) - | x -> super # lift_Parsetree_expression x - - method! lift_Parsetree_pattern = function - | {ppat_desc=Ppat_extension({txt="p";loc}, e); _} -> map (get_pat loc e) - | x -> super # lift_Parsetree_pattern x - - method! lift_Parsetree_core_type = function - | {ptyp_desc=Ptyp_extension({txt="t";loc}, e); _} -> map (get_pat loc e) - | x -> super # lift_Parsetree_core_type x - end - - let loc = ref (app (evar "Pervasives.!") [evar "Ast_helper.default_loc"]) - - let handle_attr = function - | {txt="metaloc";loc=l}, e -> loc := get_exp l e - | _ -> () - - let with_loc ?(attrs = []) f = - let old_loc = !loc in - List.iter handle_attr attrs; - let r = f () in - loc := old_loc; - r - - let expander _config _cookies = - let open Ast_mapper in - let super = default_mapper in - let expr this e = - with_loc ~attrs:e.pexp_attributes - (fun () -> - match e.pexp_desc with - | Pexp_extension({txt="expr";loc=l}, e) -> - (exp_lifter !loc this) # lift_Parsetree_expression (get_exp l e) - | Pexp_extension({txt="pat";loc=l}, e) -> - (exp_lifter !loc this) # lift_Parsetree_pattern (get_pat l e) - | Pexp_extension({txt="str";_}, PStr e) -> - (exp_lifter !loc this) # lift_Parsetree_structure e - | Pexp_extension({txt="stri";_}, PStr [e]) -> - (exp_lifter !loc this) # lift_Parsetree_structure_item e - | Pexp_extension({txt="type";loc=l}, e) -> - (exp_lifter !loc this) # lift_Parsetree_core_type (get_typ l e) - | _ -> - super.expr this e - ) - and pat this p = - with_loc ~attrs:p.ppat_attributes - (fun () -> - match p.ppat_desc with - | Ppat_extension({txt="expr";loc=l}, e) -> - (pat_lifter this) # lift_Parsetree_expression (get_exp l e) - | Ppat_extension({txt="pat";loc=l}, e) -> - (pat_lifter this) # lift_Parsetree_pattern (get_pat l e) - | Ppat_extension({txt="str";_}, PStr e) -> - (pat_lifter this) # lift_Parsetree_structure e - | Ppat_extension({txt="stri";_}, PStr [e]) -> - (pat_lifter this) # lift_Parsetree_structure_item e - | Ppat_extension({txt="type";loc=l}, e) -> - (pat_lifter this) # lift_Parsetree_core_type (get_typ l e) - | _ -> - super.pat this p - ) - and structure this l = - with_loc - (fun () -> super.structure this l) - - and structure_item this x = - begin match x.pstr_desc with - | Pstr_attribute x -> handle_attr x - | _ -> () - end; - super.structure_item this x - - in - {super with expr; pat; structure; structure_item} - - let () = - let open Migrate_parsetree in - Driver.register ~name:"metaquot_402" Versions.ocaml_402 expander -end diff --git a/ppx_tools_versioned.5.2/ppx_metaquot_403.ml b/ppx_tools_versioned.5.2/ppx_metaquot_403.ml deleted file mode 100644 index 76e0bee..0000000 --- a/ppx_tools_versioned.5.2/ppx_metaquot_403.ml +++ /dev/null @@ -1,236 +0,0 @@ -open Ast_403 - -(* This file is part of the ppx_tools package. It is released *) -(* under the terms of the MIT license (see LICENSE file). *) -(* Copyright 2013 Alain Frisch and LexiFi *) - -(* A -ppx rewriter to be used to write Parsetree-generating code - (including other -ppx rewriters) using concrete syntax. - - We support the following extensions in expression position: - - [%expr ...] maps to code which creates the expression represented by ... - [%pat? ...] maps to code which creates the pattern represented by ... - [%str ...] maps to code which creates the structure represented by ... - [%stri ...] maps to code which creates the structure item represented by ... - [%type: ...] maps to code which creates the core type represented by ... - - Quoted code can refer to expressions representing AST fragments, - using the following extensions: - - [%e ...] where ... is an expression of type Parsetree.expression - [%t ...] where ... is an expression of type Parsetree.core_type - [%p ...] where ... is an expression of type Parsetree.pattern - - - All locations generated by the meta quotation are by default set - to [Ast_helper.default_loc]. This can be overriden by providing a custom - expression which will be inserted whereever a location is required - in the generated AST. This expression can be specified globally - (for the current structure) as a structure item attribute: - - ;;[@@metaloc ...] - - or locally for the scope of an expression: - - e [@metaloc ...] - - - - Support is also provided to use concrete syntax in pattern - position. The location and attribute fields are currently ignored - by patterns generated from meta quotations. - - We support the following extensions in pattern position: - - [%expr ...] maps to code which creates the expression represented by ... - [%pat? ...] maps to code which creates the pattern represented by ... - [%str ...] maps to code which creates the structure represented by ... - [%type: ...] maps to code which creates the core type represented by ... - - Quoted code can refer to expressions representing AST fragments, - using the following extensions: - - [%e? ...] where ... is a pattern of type Parsetree.expression - [%t? ...] where ... is a pattern of type Parsetree.core_type - [%p? ...] where ... is a pattern of type Parsetree.pattern - -*) - -module Main : sig end = struct - open Asttypes - open Parsetree - open Ast_helper - open Ast_convenience_403 - - let prefix ty s = - let open Longident in - match parse ty with - | Ldot(m, _) -> String.concat "." (Longident.flatten m) ^ "." ^ s - | _ -> s - - class exp_builder = - object - method record ty x = record (List.map (fun (l, e) -> prefix ty l, e) x) - method constr ty (c, args) = constr (prefix ty c) args - method list l = list l - method tuple l = tuple l - method int i = int i - method string s = str s - method char c = char c - method int32 x = Exp.constant (Const.int32 x) - method int64 x = Exp.constant (Const.int64 x) - method nativeint x = Exp.constant (Const.nativeint x) - end - - class pat_builder = - object - method record ty x = precord ~closed:Closed (List.map (fun (l, e) -> prefix ty l, e) x) - method constr ty (c, args) = pconstr (prefix ty c) args - method list l = plist l - method tuple l = ptuple l - method int i = pint i - method string s = pstr s - method char c = pchar c - method int32 x = Pat.constant (Const.int32 x) - method int64 x = Pat.constant (Const.int64 x) - method nativeint x = Pat.constant (Const.nativeint x) - end - - - let get_exp loc = function - | PStr [ {pstr_desc=Pstr_eval (e, _); _} ] -> e - | _ -> - Format.eprintf "%aExpression expected@." - Location.print_error loc; - exit 2 - - let get_typ loc = function - | PTyp t -> t - | _ -> - Format.eprintf "%aType expected@." - Location.print_error loc; - exit 2 - - let get_pat loc = function - | PPat (t, None) -> t - | _ -> - Format.eprintf "%aPattern expected@." - Location.print_error loc; - exit 2 - - let exp_lifter loc map = - let map = map.Ast_mapper.expr map in - object - inherit [_] Ast_lifter_403.lifter as super - inherit exp_builder - - (* Special support for location in the generated AST *) - method! lift_Location_t _ = loc - - (* Support for antiquotations *) - method! lift_Parsetree_expression = function - | {pexp_desc=Pexp_extension({txt="e";loc}, e); _} -> map (get_exp loc e) - | x -> super # lift_Parsetree_expression x - - method! lift_Parsetree_pattern = function - | {ppat_desc=Ppat_extension({txt="p";loc}, e); _} -> map (get_exp loc e) - | x -> super # lift_Parsetree_pattern x - - method! lift_Parsetree_core_type = function - | {ptyp_desc=Ptyp_extension({txt="t";loc}, e); _} -> map (get_exp loc e) - | x -> super # lift_Parsetree_core_type x - end - - let pat_lifter map = - let map = map.Ast_mapper.pat map in - object - inherit [_] Ast_lifter_403.lifter as super - inherit pat_builder - - (* Special support for location and attributes in the generated AST *) - method! lift_Location_t _ = Pat.any () - method! lift_Parsetree_attributes _ = Pat.any () - - (* Support for antiquotations *) - method! lift_Parsetree_expression = function - | {pexp_desc=Pexp_extension({txt="e";loc}, e); _} -> map (get_pat loc e) - | x -> super # lift_Parsetree_expression x - - method! lift_Parsetree_pattern = function - | {ppat_desc=Ppat_extension({txt="p";loc}, e); _} -> map (get_pat loc e) - | x -> super # lift_Parsetree_pattern x - - method! lift_Parsetree_core_type = function - | {ptyp_desc=Ptyp_extension({txt="t";loc}, e); _} -> map (get_pat loc e) - | x -> super # lift_Parsetree_core_type x - end - - let loc = ref (app (evar "Pervasives.!") [evar "Ast_helper.default_loc"]) - - let handle_attr = function - | {txt="metaloc";loc=l}, e -> loc := get_exp l e - | _ -> () - - let with_loc ?(attrs = []) f = - let old_loc = !loc in - List.iter handle_attr attrs; - let r = f () in - loc := old_loc; - r - - let expander _config _cookies = - let open Ast_mapper in - let super = default_mapper in - let expr this e = - with_loc ~attrs:e.pexp_attributes - (fun () -> - match e.pexp_desc with - | Pexp_extension({txt="expr";loc=l}, e) -> - (exp_lifter !loc this) # lift_Parsetree_expression (get_exp l e) - | Pexp_extension({txt="pat";loc=l}, e) -> - (exp_lifter !loc this) # lift_Parsetree_pattern (get_pat l e) - | Pexp_extension({txt="str";_}, PStr e) -> - (exp_lifter !loc this) # lift_Parsetree_structure e - | Pexp_extension({txt="stri";_}, PStr [e]) -> - (exp_lifter !loc this) # lift_Parsetree_structure_item e - | Pexp_extension({txt="type";loc=l}, e) -> - (exp_lifter !loc this) # lift_Parsetree_core_type (get_typ l e) - | _ -> - super.expr this e - ) - and pat this p = - with_loc ~attrs:p.ppat_attributes - (fun () -> - match p.ppat_desc with - | Ppat_extension({txt="expr";loc=l}, e) -> - (pat_lifter this) # lift_Parsetree_expression (get_exp l e) - | Ppat_extension({txt="pat";loc=l}, e) -> - (pat_lifter this) # lift_Parsetree_pattern (get_pat l e) - | Ppat_extension({txt="str";_}, PStr e) -> - (pat_lifter this) # lift_Parsetree_structure e - | Ppat_extension({txt="stri";_}, PStr [e]) -> - (pat_lifter this) # lift_Parsetree_structure_item e - | Ppat_extension({txt="type";loc=l}, e) -> - (pat_lifter this) # lift_Parsetree_core_type (get_typ l e) - | _ -> - super.pat this p - ) - and structure this l = - with_loc - (fun () -> super.structure this l) - - and structure_item this x = - begin match x.pstr_desc with - | Pstr_attribute x -> handle_attr x - | _ -> () - end; - super.structure_item this x - - in - {super with expr; pat; structure; structure_item} - - let () = - let open Migrate_parsetree in - Driver.register ~name:"metaquot_403" Versions.ocaml_403 expander -end diff --git a/ppx_tools_versioned.5.2/ppx_metaquot_404.ml b/ppx_tools_versioned.5.2/ppx_metaquot_404.ml deleted file mode 100644 index a447b6a..0000000 --- a/ppx_tools_versioned.5.2/ppx_metaquot_404.ml +++ /dev/null @@ -1,281 +0,0 @@ -open Ast_404 - -(* This file is part of the ppx_tools package. It is released *) -(* under the terms of the MIT license (see LICENSE file). *) -(* Copyright 2013 Alain Frisch and LexiFi *) - -(* A -ppx rewriter to be used to write Parsetree-generating code - (including other -ppx rewriters) using concrete syntax. - - We support the following extensions in expression position: - - [%expr ...] maps to code which creates the expression represented by ... - [%pat? ...] maps to code which creates the pattern represented by ... - [%str ...] maps to code which creates the structure represented by ... - [%stri ...] maps to code which creates the structure item represented by ... - [%sig: ...] maps to code which creates the signature represented by ... - [%sigi: ...] maps to code which creates the signature item represented by ... - [%type: ...] maps to code which creates the core type represented by ... - - Quoted code can refer to expressions representing AST fragments, - using the following extensions: - - [%e ...] where ... is an expression of type Parsetree.expression - [%t ...] where ... is an expression of type Parsetree.core_type - [%p ...] where ... is an expression of type Parsetree.pattern - [%%s ...] where ... is an expression of type Parsetree.structure - or Parsetree.signature depending on the context. - - - All locations generated by the meta quotation are by default set - to [Ast_helper.default_loc]. This can be overriden by providing a custom - expression which will be inserted whereever a location is required - in the generated AST. This expression can be specified globally - (for the current structure) as a structure item attribute: - - ;;[@@metaloc ...] - - or locally for the scope of an expression: - - e [@metaloc ...] - - - - Support is also provided to use concrete syntax in pattern - position. The location and attribute fields are currently ignored - by patterns generated from meta quotations. - - We support the following extensions in pattern position: - - [%expr ...] maps to code which creates the expression represented by ... - [%pat? ...] maps to code which creates the pattern represented by ... - [%str ...] maps to code which creates the structure represented by ... - [%type: ...] maps to code which creates the core type represented by ... - - Quoted code can refer to expressions representing AST fragments, - using the following extensions: - - [%e? ...] where ... is a pattern of type Parsetree.expression - [%t? ...] where ... is a pattern of type Parsetree.core_type - [%p? ...] where ... is a pattern of type Parsetree.pattern - -*) - -module Main : sig end = struct - open Asttypes - open Parsetree - open Ast_helper - open Ast_convenience_404 - - let prefix ty s = - let open Longident in - match parse ty with - | Ldot(m, _) -> String.concat "." (Longident.flatten m) ^ "." ^ s - | _ -> s - - let append ?loc ?attrs e e' = - let fn = Location.mknoloc (Longident.(Ldot (Lident "List", "append"))) in - Exp.apply ?loc ?attrs (Exp.ident fn) [Nolabel, e; Nolabel, e'] - - class exp_builder = - object - method record ty x = record (List.map (fun (l, e) -> prefix ty l, e) x) - method constr ty (c, args) = constr (prefix ty c) args - method list l = list l - method tuple l = tuple l - method int i = int i - method string s = str s - method char c = char c - method int32 x = Exp.constant (Const.int32 x) - method int64 x = Exp.constant (Const.int64 x) - method nativeint x = Exp.constant (Const.nativeint x) - end - - class pat_builder = - object - method record ty x = precord ~closed:Closed (List.map (fun (l, e) -> prefix ty l, e) x) - method constr ty (c, args) = pconstr (prefix ty c) args - method list l = plist l - method tuple l = ptuple l - method int i = pint i - method string s = pstr s - method char c = pchar c - method int32 x = Pat.constant (Const.int32 x) - method int64 x = Pat.constant (Const.int64 x) - method nativeint x = Pat.constant (Const.nativeint x) - end - - - let get_exp loc = function - | PStr [ {pstr_desc=Pstr_eval (e, _); _} ] -> e - | _ -> - Format.eprintf "%aExpression expected@." - Location.print_error loc; - exit 2 - - let get_typ loc = function - | PTyp t -> t - | _ -> - Format.eprintf "%aType expected@." - Location.print_error loc; - exit 2 - - let get_pat loc = function - | PPat (t, None) -> t - | _ -> - Format.eprintf "%aPattern expected@." - Location.print_error loc; - exit 2 - - let exp_lifter loc map = - let map = map.Ast_mapper.expr map in - object - inherit [_] Ast_lifter_404.lifter as super - inherit exp_builder - - (* Special support for location in the generated AST *) - method! lift_Location_t _ = loc - - (* Support for antiquotations *) - method! lift_Parsetree_expression = function - | {pexp_desc=Pexp_extension({txt="e";loc}, e); _} -> map (get_exp loc e) - | x -> super # lift_Parsetree_expression x - - method! lift_Parsetree_pattern = function - | {ppat_desc=Ppat_extension({txt="p";loc}, e); _} -> map (get_exp loc e) - | x -> super # lift_Parsetree_pattern x - - method! lift_Parsetree_structure str = - List.fold_right - (function - | {pstr_desc=Pstr_extension(({txt="s";loc}, e), _); _} -> - append (get_exp loc e) - | x -> - cons (super # lift_Parsetree_structure_item x)) - str (nil ()) - - method! lift_Parsetree_signature sign = - List.fold_right - (function - | {psig_desc=Psig_extension(({txt="s";loc}, e), _); _} -> - append (get_exp loc e) - | x -> - cons (super # lift_Parsetree_signature_item x)) - sign (nil ()) - - method! lift_Parsetree_core_type = function - | {ptyp_desc=Ptyp_extension({txt="t";loc}, e); _} -> map (get_exp loc e) - | x -> super # lift_Parsetree_core_type x - end - - let pat_lifter map = - let map = map.Ast_mapper.pat map in - object - inherit [_] Ast_lifter_404.lifter as super - inherit pat_builder - - (* Special support for location and attributes in the generated AST *) - method! lift_Location_t _ = Pat.any () - method! lift_Parsetree_attributes _ = Pat.any () - - (* Support for antiquotations *) - method! lift_Parsetree_expression = function - | {pexp_desc=Pexp_extension({txt="e";loc}, e); _} -> map (get_pat loc e) - | x -> super # lift_Parsetree_expression x - - method! lift_Parsetree_pattern = function - | {ppat_desc=Ppat_extension({txt="p";loc}, e); _} -> map (get_pat loc e) - | x -> super # lift_Parsetree_pattern x - - method! lift_Parsetree_core_type = function - | {ptyp_desc=Ptyp_extension({txt="t";loc}, e); _} -> map (get_pat loc e) - | x -> super # lift_Parsetree_core_type x - end - - let loc = ref (app (evar "Pervasives.!") [evar "Ast_helper.default_loc"]) - - let handle_attr = function - | {txt="metaloc";loc=l}, e -> loc := get_exp l e - | _ -> () - - let with_loc ?(attrs = []) f = - let old_loc = !loc in - List.iter handle_attr attrs; - let r = f () in - loc := old_loc; - r - - let expander _config _cookies = - let open Ast_mapper in - let super = default_mapper in - let expr this e = - with_loc ~attrs:e.pexp_attributes - (fun () -> - match e.pexp_desc with - | Pexp_extension({txt="expr";loc=l}, e) -> - (exp_lifter !loc this) # lift_Parsetree_expression (get_exp l e) - | Pexp_extension({txt="pat";loc=l}, e) -> - (exp_lifter !loc this) # lift_Parsetree_pattern (get_pat l e) - | Pexp_extension({txt="str";_}, PStr e) -> - (exp_lifter !loc this) # lift_Parsetree_structure e - | Pexp_extension({txt="stri";_}, PStr [e]) -> - (exp_lifter !loc this) # lift_Parsetree_structure_item e - | Pexp_extension({txt="sig";_}, PSig e) -> - (exp_lifter !loc this) # lift_Parsetree_signature e - | Pexp_extension({txt="sigi";_}, PSig [e]) -> - (exp_lifter !loc this) # lift_Parsetree_signature_item e - | Pexp_extension({txt="type";loc=l}, e) -> - (exp_lifter !loc this) # lift_Parsetree_core_type (get_typ l e) - | _ -> - super.expr this e - ) - and pat this p = - with_loc ~attrs:p.ppat_attributes - (fun () -> - match p.ppat_desc with - | Ppat_extension({txt="expr";loc=l}, e) -> - (pat_lifter this) # lift_Parsetree_expression (get_exp l e) - | Ppat_extension({txt="pat";loc=l}, e) -> - (pat_lifter this) # lift_Parsetree_pattern (get_pat l e) - | Ppat_extension({txt="str";_}, PStr e) -> - (pat_lifter this) # lift_Parsetree_structure e - | Ppat_extension({txt="stri";_}, PStr [e]) -> - (pat_lifter this) # lift_Parsetree_structure_item e - | Ppat_extension({txt="sig";_}, PSig e) -> - (pat_lifter this) # lift_Parsetree_signature e - | Ppat_extension({txt="sigi";_}, PSig [e]) -> - (pat_lifter this) # lift_Parsetree_signature_item e - | Ppat_extension({txt="type";loc=l}, e) -> - (pat_lifter this) # lift_Parsetree_core_type (get_typ l e) - | _ -> - super.pat this p - ) - and structure this l = - with_loc - (fun () -> super.structure this l) - - and structure_item this x = - begin match x.pstr_desc with - | Pstr_attribute x -> handle_attr x - | _ -> () - end; - super.structure_item this x - - and signature this l = - with_loc - (fun () -> super.signature this l) - - and signature_item this x = - begin match x.psig_desc with - | Psig_attribute x -> handle_attr x - | _ -> () - end; - super.signature_item this x - - in - {super with expr; pat; structure; structure_item; signature; signature_item} - - let () = - let open Migrate_parsetree in - Driver.register ~name:"metaquot_404" Versions.ocaml_404 expander -end diff --git a/ppx_tools_versioned.5.2/ppx_metaquot_405.ml b/ppx_tools_versioned.5.2/ppx_metaquot_405.ml deleted file mode 100644 index c39af1f..0000000 --- a/ppx_tools_versioned.5.2/ppx_metaquot_405.ml +++ /dev/null @@ -1,281 +0,0 @@ -open Ast_405 - -(* This file is part of the ppx_tools package. It is released *) -(* under the terms of the MIT license (see LICENSE file). *) -(* Copyright 2013 Alain Frisch and LexiFi *) - -(* A -ppx rewriter to be used to write Parsetree-generating code - (including other -ppx rewriters) using concrete syntax. - - We support the following extensions in expression position: - - [%expr ...] maps to code which creates the expression represented by ... - [%pat? ...] maps to code which creates the pattern represented by ... - [%str ...] maps to code which creates the structure represented by ... - [%stri ...] maps to code which creates the structure item represented by ... - [%sig: ...] maps to code which creates the signature represented by ... - [%sigi: ...] maps to code which creates the signature item represented by ... - [%type: ...] maps to code which creates the core type represented by ... - - Quoted code can refer to expressions representing AST fragments, - using the following extensions: - - [%e ...] where ... is an expression of type Parsetree.expression - [%t ...] where ... is an expression of type Parsetree.core_type - [%p ...] where ... is an expression of type Parsetree.pattern - [%%s ...] where ... is an expression of type Parsetree.structure - or Parsetree.signature depending on the context. - - - All locations generated by the meta quotation are by default set - to [Ast_helper.default_loc]. This can be overriden by providing a custom - expression which will be inserted whereever a location is required - in the generated AST. This expression can be specified globally - (for the current structure) as a structure item attribute: - - ;;[@@metaloc ...] - - or locally for the scope of an expression: - - e [@metaloc ...] - - - - Support is also provided to use concrete syntax in pattern - position. The location and attribute fields are currently ignored - by patterns generated from meta quotations. - - We support the following extensions in pattern position: - - [%expr ...] maps to code which creates the expression represented by ... - [%pat? ...] maps to code which creates the pattern represented by ... - [%str ...] maps to code which creates the structure represented by ... - [%type: ...] maps to code which creates the core type represented by ... - - Quoted code can refer to expressions representing AST fragments, - using the following extensions: - - [%e? ...] where ... is a pattern of type Parsetree.expression - [%t? ...] where ... is a pattern of type Parsetree.core_type - [%p? ...] where ... is a pattern of type Parsetree.pattern - -*) - -module Main : sig end = struct - open Asttypes - open Parsetree - open Ast_helper - open Ast_convenience_405 - - let prefix ty s = - let open Longident in - match parse ty with - | Ldot(m, _) -> String.concat "." (Longident.flatten m) ^ "." ^ s - | _ -> s - - let append ?loc ?attrs e e' = - let fn = Location.mknoloc (Longident.(Ldot (Lident "List", "append"))) in - Exp.apply ?loc ?attrs (Exp.ident fn) [Nolabel, e; Nolabel, e'] - - class exp_builder = - object - method record ty x = record (List.map (fun (l, e) -> prefix ty l, e) x) - method constr ty (c, args) = constr (prefix ty c) args - method list l = list l - method tuple l = tuple l - method int i = int i - method string s = str s - method char c = char c - method int32 x = Exp.constant (Const.int32 x) - method int64 x = Exp.constant (Const.int64 x) - method nativeint x = Exp.constant (Const.nativeint x) - end - - class pat_builder = - object - method record ty x = precord ~closed:Closed (List.map (fun (l, e) -> prefix ty l, e) x) - method constr ty (c, args) = pconstr (prefix ty c) args - method list l = plist l - method tuple l = ptuple l - method int i = pint i - method string s = pstr s - method char c = pchar c - method int32 x = Pat.constant (Const.int32 x) - method int64 x = Pat.constant (Const.int64 x) - method nativeint x = Pat.constant (Const.nativeint x) - end - - - let get_exp loc = function - | PStr [ {pstr_desc=Pstr_eval (e, _); _} ] -> e - | _ -> - Format.eprintf "%aExpression expected@." - Location.print_error loc; - exit 2 - - let get_typ loc = function - | PTyp t -> t - | _ -> - Format.eprintf "%aType expected@." - Location.print_error loc; - exit 2 - - let get_pat loc = function - | PPat (t, None) -> t - | _ -> - Format.eprintf "%aPattern expected@." - Location.print_error loc; - exit 2 - - let exp_lifter loc map = - let map = map.Ast_mapper.expr map in - object - inherit [_] Ast_lifter_405.lifter as super - inherit exp_builder - - (* Special support for location in the generated AST *) - method! lift_Location_t _ = loc - - (* Support for antiquotations *) - method! lift_Parsetree_expression = function - | {pexp_desc=Pexp_extension({txt="e";loc}, e); _} -> map (get_exp loc e) - | x -> super # lift_Parsetree_expression x - - method! lift_Parsetree_pattern = function - | {ppat_desc=Ppat_extension({txt="p";loc}, e); _} -> map (get_exp loc e) - | x -> super # lift_Parsetree_pattern x - - method! lift_Parsetree_structure str = - List.fold_right - (function - | {pstr_desc=Pstr_extension(({txt="s";loc}, e), _); _} -> - append (get_exp loc e) - | x -> - cons (super # lift_Parsetree_structure_item x)) - str (nil ()) - - method! lift_Parsetree_signature sign = - List.fold_right - (function - | {psig_desc=Psig_extension(({txt="s";loc}, e), _); _} -> - append (get_exp loc e) - | x -> - cons (super # lift_Parsetree_signature_item x)) - sign (nil ()) - - method! lift_Parsetree_core_type = function - | {ptyp_desc=Ptyp_extension({txt="t";loc}, e); _} -> map (get_exp loc e) - | x -> super # lift_Parsetree_core_type x - end - - let pat_lifter map = - let map = map.Ast_mapper.pat map in - object - inherit [_] Ast_lifter_405.lifter as super - inherit pat_builder - - (* Special support for location and attributes in the generated AST *) - method! lift_Location_t _ = Pat.any () - method! lift_Parsetree_attributes _ = Pat.any () - - (* Support for antiquotations *) - method! lift_Parsetree_expression = function - | {pexp_desc=Pexp_extension({txt="e";loc}, e); _} -> map (get_pat loc e) - | x -> super # lift_Parsetree_expression x - - method! lift_Parsetree_pattern = function - | {ppat_desc=Ppat_extension({txt="p";loc}, e); _} -> map (get_pat loc e) - | x -> super # lift_Parsetree_pattern x - - method! lift_Parsetree_core_type = function - | {ptyp_desc=Ptyp_extension({txt="t";loc}, e); _} -> map (get_pat loc e) - | x -> super # lift_Parsetree_core_type x - end - - let loc = ref (app (evar "Pervasives.!") [evar "Ast_helper.default_loc"]) - - let handle_attr = function - | {txt="metaloc";loc=l}, e -> loc := get_exp l e - | _ -> () - - let with_loc ?(attrs = []) f = - let old_loc = !loc in - List.iter handle_attr attrs; - let r = f () in - loc := old_loc; - r - - let expander _config _cookies = - let open Ast_mapper in - let super = default_mapper in - let expr this e = - with_loc ~attrs:e.pexp_attributes - (fun () -> - match e.pexp_desc with - | Pexp_extension({txt="expr";loc=l}, e) -> - (exp_lifter !loc this) # lift_Parsetree_expression (get_exp l e) - | Pexp_extension({txt="pat";loc=l}, e) -> - (exp_lifter !loc this) # lift_Parsetree_pattern (get_pat l e) - | Pexp_extension({txt="str";_}, PStr e) -> - (exp_lifter !loc this) # lift_Parsetree_structure e - | Pexp_extension({txt="stri";_}, PStr [e]) -> - (exp_lifter !loc this) # lift_Parsetree_structure_item e - | Pexp_extension({txt="sig";_}, PSig e) -> - (exp_lifter !loc this) # lift_Parsetree_signature e - | Pexp_extension({txt="sigi";_}, PSig [e]) -> - (exp_lifter !loc this) # lift_Parsetree_signature_item e - | Pexp_extension({txt="type";loc=l}, e) -> - (exp_lifter !loc this) # lift_Parsetree_core_type (get_typ l e) - | _ -> - super.expr this e - ) - and pat this p = - with_loc ~attrs:p.ppat_attributes - (fun () -> - match p.ppat_desc with - | Ppat_extension({txt="expr";loc=l}, e) -> - (pat_lifter this) # lift_Parsetree_expression (get_exp l e) - | Ppat_extension({txt="pat";loc=l}, e) -> - (pat_lifter this) # lift_Parsetree_pattern (get_pat l e) - | Ppat_extension({txt="str";_}, PStr e) -> - (pat_lifter this) # lift_Parsetree_structure e - | Ppat_extension({txt="stri";_}, PStr [e]) -> - (pat_lifter this) # lift_Parsetree_structure_item e - | Ppat_extension({txt="sig";_}, PSig e) -> - (pat_lifter this) # lift_Parsetree_signature e - | Ppat_extension({txt="sigi";_}, PSig [e]) -> - (pat_lifter this) # lift_Parsetree_signature_item e - | Ppat_extension({txt="type";loc=l}, e) -> - (pat_lifter this) # lift_Parsetree_core_type (get_typ l e) - | _ -> - super.pat this p - ) - and structure this l = - with_loc - (fun () -> super.structure this l) - - and structure_item this x = - begin match x.pstr_desc with - | Pstr_attribute x -> handle_attr x - | _ -> () - end; - super.structure_item this x - - and signature this l = - with_loc - (fun () -> super.signature this l) - - and signature_item this x = - begin match x.psig_desc with - | Psig_attribute x -> handle_attr x - | _ -> () - end; - super.signature_item this x - - in - {super with expr; pat; structure; structure_item; signature; signature_item} - - let () = - let open Migrate_parsetree in - Driver.register ~name:"metaquot_405" Versions.ocaml_405 expander -end diff --git a/ppx_tools_versioned.5.2/ppx_metaquot_406.ml b/ppx_tools_versioned.5.2/ppx_metaquot_406.ml deleted file mode 100644 index 66fdc3a..0000000 --- a/ppx_tools_versioned.5.2/ppx_metaquot_406.ml +++ /dev/null @@ -1,281 +0,0 @@ -open Ast_406 - -(* This file is part of the ppx_tools package. It is released *) -(* under the terms of the MIT license (see LICENSE file). *) -(* Copyright 2013 Alain Frisch and LexiFi *) - -(* A -ppx rewriter to be used to write Parsetree-generating code - (including other -ppx rewriters) using concrete syntax. - - We support the following extensions in expression position: - - [%expr ...] maps to code which creates the expression represented by ... - [%pat? ...] maps to code which creates the pattern represented by ... - [%str ...] maps to code which creates the structure represented by ... - [%stri ...] maps to code which creates the structure item represented by ... - [%sig: ...] maps to code which creates the signature represented by ... - [%sigi: ...] maps to code which creates the signature item represented by ... - [%type: ...] maps to code which creates the core type represented by ... - - Quoted code can refer to expressions representing AST fragments, - using the following extensions: - - [%e ...] where ... is an expression of type Parsetree.expression - [%t ...] where ... is an expression of type Parsetree.core_type - [%p ...] where ... is an expression of type Parsetree.pattern - [%%s ...] where ... is an expression of type Parsetree.structure - or Parsetree.signature depending on the context. - - - All locations generated by the meta quotation are by default set - to [Ast_helper.default_loc]. This can be overriden by providing a custom - expression which will be inserted whereever a location is required - in the generated AST. This expression can be specified globally - (for the current structure) as a structure item attribute: - - ;;[@@metaloc ...] - - or locally for the scope of an expression: - - e [@metaloc ...] - - - - Support is also provided to use concrete syntax in pattern - position. The location and attribute fields are currently ignored - by patterns generated from meta quotations. - - We support the following extensions in pattern position: - - [%expr ...] maps to code which creates the expression represented by ... - [%pat? ...] maps to code which creates the pattern represented by ... - [%str ...] maps to code which creates the structure represented by ... - [%type: ...] maps to code which creates the core type represented by ... - - Quoted code can refer to expressions representing AST fragments, - using the following extensions: - - [%e? ...] where ... is a pattern of type Parsetree.expression - [%t? ...] where ... is a pattern of type Parsetree.core_type - [%p? ...] where ... is a pattern of type Parsetree.pattern - -*) - -module Main : sig end = struct - open Asttypes - open Parsetree - open Ast_helper - open Ast_convenience_406 - - let prefix ty s = - let open Longident in - match parse ty with - | Ldot(m, _) -> String.concat "." (Longident.flatten m) ^ "." ^ s - | _ -> s - - let append ?loc ?attrs e e' = - let fn = Location.mknoloc (Longident.(Ldot (Lident "List", "append"))) in - Exp.apply ?loc ?attrs (Exp.ident fn) [Nolabel, e; Nolabel, e'] - - class exp_builder = - object - method record ty x = record (List.map (fun (l, e) -> prefix ty l, e) x) - method constr ty (c, args) = constr (prefix ty c) args - method list l = list l - method tuple l = tuple l - method int i = int i - method string s = str s - method char c = char c - method int32 x = Exp.constant (Const.int32 x) - method int64 x = Exp.constant (Const.int64 x) - method nativeint x = Exp.constant (Const.nativeint x) - end - - class pat_builder = - object - method record ty x = precord ~closed:Closed (List.map (fun (l, e) -> prefix ty l, e) x) - method constr ty (c, args) = pconstr (prefix ty c) args - method list l = plist l - method tuple l = ptuple l - method int i = pint i - method string s = pstr s - method char c = pchar c - method int32 x = Pat.constant (Const.int32 x) - method int64 x = Pat.constant (Const.int64 x) - method nativeint x = Pat.constant (Const.nativeint x) - end - - - let get_exp loc = function - | PStr [ {pstr_desc=Pstr_eval (e, _); _} ] -> e - | _ -> - Format.eprintf "%aExpression expected@." - Location.print_error loc; - exit 2 - - let get_typ loc = function - | PTyp t -> t - | _ -> - Format.eprintf "%aType expected@." - Location.print_error loc; - exit 2 - - let get_pat loc = function - | PPat (t, None) -> t - | _ -> - Format.eprintf "%aPattern expected@." - Location.print_error loc; - exit 2 - - let exp_lifter loc map = - let map = map.Ast_mapper.expr map in - object - inherit [_] Ast_lifter_406.lifter as super - inherit exp_builder - - (* Special support for location in the generated AST *) - method! lift_Location_t _ = loc - - (* Support for antiquotations *) - method! lift_Parsetree_expression = function - | {pexp_desc=Pexp_extension({txt="e";loc}, e); _} -> map (get_exp loc e) - | x -> super # lift_Parsetree_expression x - - method! lift_Parsetree_pattern = function - | {ppat_desc=Ppat_extension({txt="p";loc}, e); _} -> map (get_exp loc e) - | x -> super # lift_Parsetree_pattern x - - method! lift_Parsetree_structure str = - List.fold_right - (function - | {pstr_desc=Pstr_extension(({txt="s";loc}, e), _); _} -> - append (get_exp loc e) - | x -> - cons (super # lift_Parsetree_structure_item x)) - str (nil ()) - - method! lift_Parsetree_signature sign = - List.fold_right - (function - | {psig_desc=Psig_extension(({txt="s";loc}, e), _); _} -> - append (get_exp loc e) - | x -> - cons (super # lift_Parsetree_signature_item x)) - sign (nil ()) - - method! lift_Parsetree_core_type = function - | {ptyp_desc=Ptyp_extension({txt="t";loc}, e); _} -> map (get_exp loc e) - | x -> super # lift_Parsetree_core_type x - end - - let pat_lifter map = - let map = map.Ast_mapper.pat map in - object - inherit [_] Ast_lifter_406.lifter as super - inherit pat_builder - - (* Special support for location and attributes in the generated AST *) - method! lift_Location_t _ = Pat.any () - method! lift_Parsetree_attributes _ = Pat.any () - - (* Support for antiquotations *) - method! lift_Parsetree_expression = function - | {pexp_desc=Pexp_extension({txt="e";loc}, e); _} -> map (get_pat loc e) - | x -> super # lift_Parsetree_expression x - - method! lift_Parsetree_pattern = function - | {ppat_desc=Ppat_extension({txt="p";loc}, e); _} -> map (get_pat loc e) - | x -> super # lift_Parsetree_pattern x - - method! lift_Parsetree_core_type = function - | {ptyp_desc=Ptyp_extension({txt="t";loc}, e); _} -> map (get_pat loc e) - | x -> super # lift_Parsetree_core_type x - end - - let loc = ref (app (evar "Pervasives.!") [evar "Ast_helper.default_loc"]) - - let handle_attr = function - | {txt="metaloc";loc=l}, e -> loc := get_exp l e - | _ -> () - - let with_loc ?(attrs = []) f = - let old_loc = !loc in - List.iter handle_attr attrs; - let r = f () in - loc := old_loc; - r - - let expander _config _cookies = - let open Ast_mapper in - let super = default_mapper in - let expr this e = - with_loc ~attrs:e.pexp_attributes - (fun () -> - match e.pexp_desc with - | Pexp_extension({txt="expr";loc=l}, e) -> - (exp_lifter !loc this) # lift_Parsetree_expression (get_exp l e) - | Pexp_extension({txt="pat";loc=l}, e) -> - (exp_lifter !loc this) # lift_Parsetree_pattern (get_pat l e) - | Pexp_extension({txt="str";_}, PStr e) -> - (exp_lifter !loc this) # lift_Parsetree_structure e - | Pexp_extension({txt="stri";_}, PStr [e]) -> - (exp_lifter !loc this) # lift_Parsetree_structure_item e - | Pexp_extension({txt="sig";_}, PSig e) -> - (exp_lifter !loc this) # lift_Parsetree_signature e - | Pexp_extension({txt="sigi";_}, PSig [e]) -> - (exp_lifter !loc this) # lift_Parsetree_signature_item e - | Pexp_extension({txt="type";loc=l}, e) -> - (exp_lifter !loc this) # lift_Parsetree_core_type (get_typ l e) - | _ -> - super.expr this e - ) - and pat this p = - with_loc ~attrs:p.ppat_attributes - (fun () -> - match p.ppat_desc with - | Ppat_extension({txt="expr";loc=l}, e) -> - (pat_lifter this) # lift_Parsetree_expression (get_exp l e) - | Ppat_extension({txt="pat";loc=l}, e) -> - (pat_lifter this) # lift_Parsetree_pattern (get_pat l e) - | Ppat_extension({txt="str";_}, PStr e) -> - (pat_lifter this) # lift_Parsetree_structure e - | Ppat_extension({txt="stri";_}, PStr [e]) -> - (pat_lifter this) # lift_Parsetree_structure_item e - | Ppat_extension({txt="sig";_}, PSig e) -> - (pat_lifter this) # lift_Parsetree_signature e - | Ppat_extension({txt="sigi";_}, PSig [e]) -> - (pat_lifter this) # lift_Parsetree_signature_item e - | Ppat_extension({txt="type";loc=l}, e) -> - (pat_lifter this) # lift_Parsetree_core_type (get_typ l e) - | _ -> - super.pat this p - ) - and structure this l = - with_loc - (fun () -> super.structure this l) - - and structure_item this x = - begin match x.pstr_desc with - | Pstr_attribute x -> handle_attr x - | _ -> () - end; - super.structure_item this x - - and signature this l = - with_loc - (fun () -> super.signature this l) - - and signature_item this x = - begin match x.psig_desc with - | Psig_attribute x -> handle_attr x - | _ -> () - end; - super.signature_item this x - - in - {super with expr; pat; structure; structure_item; signature; signature_item} - - let () = - let open Migrate_parsetree in - Driver.register ~name:"metaquot_406" Versions.ocaml_406 expander -end diff --git a/ppx_tools_versioned.5.2/ppx_metaquot_run.ml b/ppx_tools_versioned.5.2/ppx_metaquot_run.ml deleted file mode 100644 index 7bd1567..0000000 --- a/ppx_tools_versioned.5.2/ppx_metaquot_run.ml +++ /dev/null @@ -1 +0,0 @@ -let () = Migrate_parsetree.Driver.run_main () diff --git a/ppx_tools_versioned.5.2/ppx_tools_402.ml b/ppx_tools_versioned.5.2/ppx_tools_402.ml deleted file mode 100644 index 7733885..0000000 --- a/ppx_tools_versioned.5.2/ppx_tools_402.ml +++ /dev/null @@ -1,2 +0,0 @@ -module Ast_convenience = Ast_convenience_402 -module Ast_mapper_class = Ast_mapper_class_402 diff --git a/ppx_tools_versioned.5.2/ppx_tools_403.ml b/ppx_tools_versioned.5.2/ppx_tools_403.ml deleted file mode 100644 index 1d186d9..0000000 --- a/ppx_tools_versioned.5.2/ppx_tools_403.ml +++ /dev/null @@ -1,2 +0,0 @@ -module Ast_convenience = Ast_convenience_403 -module Ast_mapper_class = Ast_mapper_class_403 diff --git a/ppx_tools_versioned.5.2/ppx_tools_404.ml b/ppx_tools_versioned.5.2/ppx_tools_404.ml deleted file mode 100644 index cef40a6..0000000 --- a/ppx_tools_versioned.5.2/ppx_tools_404.ml +++ /dev/null @@ -1,2 +0,0 @@ -module Ast_convenience = Ast_convenience_404 -module Ast_mapper_class = Ast_mapper_class_404 diff --git a/ppx_tools_versioned.5.2/ppx_tools_405.ml b/ppx_tools_versioned.5.2/ppx_tools_405.ml deleted file mode 100644 index 398d008..0000000 --- a/ppx_tools_versioned.5.2/ppx_tools_405.ml +++ /dev/null @@ -1,2 +0,0 @@ -module Ast_convenience = Ast_convenience_405 -module Ast_mapper_class = Ast_mapper_class_405 diff --git a/ppx_tools_versioned.5.2/ppx_tools_406.ml b/ppx_tools_versioned.5.2/ppx_tools_406.ml deleted file mode 100644 index 4fd2c1e..0000000 --- a/ppx_tools_versioned.5.2/ppx_tools_406.ml +++ /dev/null @@ -1,2 +0,0 @@ -module Ast_convenience = Ast_convenience_406 -module Ast_mapper_class = Ast_mapper_class_406 diff --git a/ppx_tools_versioned.5.2/ppx_tools_versioned.nopam b/ppx_tools_versioned.5.2/ppx_tools_versioned.nopam deleted file mode 100644 index 536246e..0000000 --- a/ppx_tools_versioned.5.2/ppx_tools_versioned.nopam +++ /dev/null @@ -1,21 +0,0 @@ -opam-version: "1.2" -maintainer: "frederic.bour@lakaban.net" -authors: [ - "Frédéric Bour " - "Alain Frisch " -] -license: "MIT" -homepage: "https://github.com/let-def/ppx_tools_versioned" -bug-reports: "https://github.com/let-def/ppx_tools_versioned/issues" -dev-repo: "git://github.com/let-def/ppx_tools_versioned.git" -tags: [ "syntax" ] -build: [ - ["dune" "subst"] {pinned} - ["dune" "build" "-p" name "-j" jobs] -] -build-test: [["dune" "runtest" "-p" name "-j" jobs]] -depends: [ - "dune" {build & >= "1.0"} - "ocaml-migrate-parsetree" { >= "0.4" } -] -available: ocaml-version >= "4.02.0" diff --git a/sedlex-1.99.4/.gitignore b/sedlex-1.99.4/.gitignore deleted file mode 100644 index 18147d6..0000000 --- a/sedlex-1.99.4/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -*.annot -*.cmo -*.cma -*.cmi -*.a -*.o -*.cmx -*.cmxs -*.cmxa -*.exe -libdoc -src/syntax/ppx_sedlex -examples/complement -examples/tokenizer -examples/subtraction diff --git a/sedlex-1.99.4/CHANGES b/sedlex-1.99.4/CHANGES deleted file mode 100644 index b7ae07d..0000000 --- a/sedlex-1.99.4/CHANGES +++ /dev/null @@ -1,57 +0,0 @@ -1.99.4 - * GPR#47: Switch to ocaml-migrate-parsetree (contributed by Adrien Guatto) - * GPR#42: Added 'Rep' (repeat operator) (contributed by jpathy) - -1.99.3 - * Update to work with 4.03 (4.02 still supported) - -1.99.2 - * First official release of sedlex - -1.99.1 - * Support for new Ast_mapper registration API, follow OCaml trunk after - the inclusion of the extension_point branch - -1.99 - * First version of sedlex. The history below refers to ulex, the ancestor - or sedlex implemented with Camlp4. - --------------------------------------------------------------------------- - -1.1 - * Generate (more) globally unique identifiers to avoid conflicts when open'ing another module - processed by ulex (issue reported by Gerd Stolpmann) - -1.0 - * Update to the new Camlp4 and to ocamlbuild (release for OCaml 3.10 - only), by Nicolas Pouillard. - -0.8 - * Really make it work with OCaml 3.09. - * Support for Utf-16. - -0.7 released May 24 2005 - * Bug fixes - * Update to OCaml 3.09 (currently CVS). Still works with OCaml 3.08. - * MIT-like license (used to LGPL) - -0.5 release Jul. 8 2004 - * Document how to use a custom implementation for lex buffers - * Update to OCaml 3.08 - -0.4 released Jan. 10 2004 - * Bug fix (accept 1114111 as valid Unicode code point) - * Add the rollback function - -0.3 released Oct. 8 2003 - * Bug fix - * Add a new predefined class for ISO identifiers - -0.2 released Sep. 22 2003 - * Changed the names of predefined regexp - * Fix max_code = 0x10ffff - * Lexers that changes encoding on the fly - * Documentation of the interface Ulexing - -0.1 released Sep. 20 2003 - * Initial release diff --git a/sedlex-1.99.4/LICENSE b/sedlex-1.99.4/LICENSE deleted file mode 100644 index 630eb99..0000000 --- a/sedlex-1.99.4/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright 2005, 2014 by Alain Frisch and LexiFi. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/sedlex-1.99.4/META b/sedlex-1.99.4/META deleted file mode 100644 index 56b956e..0000000 --- a/sedlex-1.99.4/META +++ /dev/null @@ -1,14 +0,0 @@ -version = "1.99.4" -description = "Runtime support for sedlex" -archive(byte) = "sedlexing.cma" -archive(native) = "sedlexing.cmxa" -requires = "gen" -ppx = "./ppx_sedlex --as-ppx" - -package "ppx" ( - version = "1.99.4" - description = "ppx implementation of sedlex" - requires = "ocaml-migrate-parsetree ppx_tools_versioned gen" - archive(byte) = "sedlex.cma" - archive(native) = "sedlex.cmxa" -) diff --git a/sedlex-1.99.4/Makefile b/sedlex-1.99.4/Makefile deleted file mode 100644 index b3be1af..0000000 --- a/sedlex-1.99.4/Makefile +++ /dev/null @@ -1,74 +0,0 @@ -# The package sedlex is released under the terms of an MIT-like license. -# See the attached LICENSE file. -# Copyright 2005, 2013 by Alain Frisch and LexiFi. - -include $(shell ocamlc -where)/Makefile.config - -VERSION=1.99.2 -# Don't forget to change META file as well - -.PHONY: all opt clean test install package - -all: - (cd src/lib && $(MAKE) all doc) - (cd src/syntax && $(MAKE) all) - -opt: - (cd src/syntax && $(MAKE) opt) - (cd src/lib && $(MAKE) opt) - -clean: - rm -f *~ *.cm* *.a *.lib *.o *.obj - (cd src/lib && $(MAKE) clean) - (cd src/syntax && $(MAKE) clean) - (cd examples && $(MAKE) clean) - rm -rf libdoc - -test: clean all opt - cd examples && $(MAKE) test - -INSTALL=META src/syntax/sedlex.cma src/syntax/ppx_sedlex$(EXE) src/lib/sedlexing.cma src/lib/sedlexing.cmi - -INSTALL_OPT=src/syntax/sedlex.cmxs src/syntax/sedlex$(EXT_LIB) src/syntax/sedlex.cmxa src/syntax/ppx_sedlex.opt$(EXE) src/lib/sedlexing.cmx src/lib/sedlexing$(EXT_LIB) src/lib/sedlexing.cmxa - -install: - ocamlfind install sedlex $(INSTALL) $(INSTALL_OPT) - -install_byteonly: - ocamlfind install sedlex $(INSTALL) - -uninstall: - ocamlfind remove sedlex - -PACKAGE = sedlex-$(VERSION) -DISTRIB = \ - CHANGES LICENSE META README.md Makefile \ - examples/Makefile \ - examples/tokenizer.ml \ - src/lib/Makefile \ - src/lib/sedlexing.ml \ - src/lib/sedlexing.mli \ - src/syntax/Makefile \ - src/syntax/sedlex_cset.ml \ - src/syntax/sedlex_cset.mli \ - src/syntax/sedlex.ml \ - src/syntax/sedlex.mli \ - src/syntax/sedlex_ppx.ml \ - src/syntax/unicode63.ml \ - src/syntax/unicode63.mli - - -package: clean - rm -rf sedlex.tar.gz - tar czf sedlex.tar.gz $(DISTRIB) - rm -Rf $(PACKAGE) - mkdir $(PACKAGE) - cd $(PACKAGE) && tar xzf ../sedlex.tar.gz - tar czf $(PACKAGE).tar.gz $(PACKAGE) - rm -Rf $(PACKAGE) sedlex.tar.gz - - -TARGET=foo:bar/sedlex_dara -upload: - scp $(PACKAGE).tar.gz README CHANGES $(TARGET)/ - rsync -avz libdoc $(TARGET) diff --git a/sedlex-1.99.4/README.md b/sedlex-1.99.4/README.md deleted file mode 100644 index d8bfa70..0000000 --- a/sedlex-1.99.4/README.md +++ /dev/null @@ -1,225 +0,0 @@ -# sedlex - -Unicode-friendly lexer generator for OCaml. - -This package is licensed by LexiFi under the terms of the MIT license. - -Contact: alain.frisch@lexifi.com - -## Overview - -sedlex is a lexer generator for OCaml, similar to ocamllex, but -supporting Unicode. Contrary to ocamllex, lexer specifications for -sedlex are embedded in regular OCaml source files. - -The lexers work with a new kind of "lexbuf", similar to ocamllex -Lexing lexbufs, but designed to support Unicode, and abstracting from -a specific encoding. A single lexer can work with arbitrary encodings -of the input stream. - -sedlex is the successor of the ulex project. Contrary to ulex which -was implemented as a Camlp4 syntax extension, sedlex is based on the -new "-ppx" technology of OCaml, which allow rewriting OCaml parse -trees through external rewriters. (And what a better name than "sed" -for a rewriter?) - -As any -ppx rewriter, sedlex does not touch the concrete syntax of the -language: lexer specifications are written in source file which comply -with the standard grammar of OCaml programs. sedlex reuse the syntax -for pattern matching in order to describe lexers (regular expressions -are encoded within OCaml patterns). A nice consequence is that your -editor (vi, emacs, ...) won't get confused (indentation, coloring) and -you don't need to learn new priority rules. Moreover, sedlex is -compatible with any front-end parsing technology: it works fine even -if you use camlp4 or camlp5, with the standard or revised syntax. - - -## Lexer specifications - - -sedlex adds a new kind of expression to OCaml: lexer definitions. -The syntax for the new construction is: - -```ocaml - match%sedlex lexbuf with - | R1 -> e1 - ... - | Rn -> en - | _ -> def -``` - -or: - -```ocaml - [%sedlex match lexbuf with - | R1 -> e1 - ... - | Rn -> en - | _ -> def - ] -``` - -(The first vertical bar is optional as in any OCaml pattern matching. -Guard expressions are not allowed.) - -where: -- lexbuf is an arbitrary lowercase identifier, which must refer to - an existing value of type [Sedlexing.lexbuf]. -- the Ri are regular expressions (see below); -- the ei and def are OCaml expressions (called actions) of the same type - (the type for the whole lexer definitioon). - -Unlike ocamllex, lexers work on stream of Unicode codepoints, not -bytes. - -The actions can call functions from the Sedlexing module to extract -(parts of) the matched lexeme, in the desired encoding. - -Regular expressions are syntactically OCaml patterns: - -- `"...."` (string constant): recognize the specified string -- `'....'` (character constant) : recognize the specified character -- `i` (integer constant) : recognize the specified codepoint -- `'...' .. '...'`: character range -- `i1 .. i2`: range between two codepoints -- `R1 | R2` : alternation -- `R, R2, ..., Rn` : concatenation -- `Star R` : Kleene star (0 or more repetition) -- `Plus R` : equivalent to `R, R*` -- `Opt R` : equivalent to `("" | R)` -- `Rep (R, n)` : equivalent to `R{n}` -- `Rep (R, n .. m)` : equivalent to `R{n, m}` -- `Chars "..."` : recognize any character in the string -- `Compl R` : assume that R is a single-character length regexp (see below) - and recognize the complement set -- `Sub (R1,R2)` : assume that R is a single-character length regexp (see below) - and recognize the set of items in `R1` but not in `R2` ("subtract") -- `Intersect (R1,R2)` : assume that `R` is a single-character length regexp (see - below) and recognize the set of items which are in both `R1` and `R2` -- `lid` (lowercase identifier) : reference a named regexp (see below) - -A single-character length regexp is a regexp which does not contain (after -expansion of references) concatenation, Star, Plus, Opt or string constants -with a length different from one. - - - -Note: - - The OCaml source is assumed to be encoded in Latin1 (for string - and character literals). - - -It is possible to define named regular expressions with the following -construction, that can appear in place of a structure item: - -```ocaml - let lid = [%sedlex.regexp? R] -``` - -where lid is the regexp name to be defined and R its definition. The -scope of the "lid" regular expression is the rest of the structure, -after the definition. - -The same syntax can be used for local binding: - -```ocaml - let lid = [%sedlex.regexp? R] in - body -``` - -The scope of "lid" is the body expression. - - -## Predefined regexps - -sedlex provides a set of predefined regexps: -- any: any character -- eof: the virtual end-of-file character -- xml_letter, xml_digit, xml_extender, xml_base_char, xml_ideographic, - xml_combining_char, xml_blank: as defined by the XML recommandation -- tr8876_ident_char: characters names in identifiers from ISO TR8876 -- cc, cf, cn, co, cs, ll, lm, lo, lt, lu, mc, me, mn, nd, nl, no, pc, pd, - pe, pf, pi, po, ps, sc, sk, sm, so, zl, zp, zs: as defined by the - Unicode standard (categories) -- alphabetic, ascii_hex_digit, hex_digit, id_continue, id_start, - lowercase, math, other_alphabetic, other_lowercase, other_math, - other_uppercase, uppercase, white_space, xid_continue, xid_start: as - defined by the Unicode standard (properties) - - -## Running a lexer - -See the interface of the Sedlexing module for a description of how to -create lexbuf values (from strings, stream or channels encoded in -Latin1, utf8 or utf16, or from integer arrays or streams representing -Unicode code points). - -It is possible to work with a custom implementation for lex buffers. -To do this, you just have to ensure that a module called Sedlexing is -in scope of your lexer specifications, and that it defines at least -the following functions: start, next, mark, backtrack. See the interface -of the Sedlexing module for more information. - - - -## Using sedlex - -The quick way: - -``` - opam install sedlex -``` - - -Otherwise, the first thing to do is to compile and install sedlex. -You need a recent version of OCaml. - -``` - make all - make opt (* optional *) -``` - -### With findlib - -If you have findlib, you can use it to install and use sedlex. -The name of the findlib package is "sedlex". - -Installation (after "make all" and "make opt"): - -``` - make install -``` - -Compilation of OCaml files with lexer specifications: - -``` - ocamlfind ocamlc -c -package sedlex my_file.ml -``` - -When linking, you must also include the sedlex package: - -``` - ocamlfind ocamlc -o my_prog -linkpkg -package sedlex my_file.cmo -``` - - -There is also a sedlex.ppx subpackage containing the code of the ppx -filter. This can be used to build custom drivers (combining several ppx -transformations in a single process). - - -### Without findlib - -You can use sedlex without findlib. To compile, you need to run the -source file through -ppx rewriter ppx_sedlex. Moreover, you need to -link the application with the runtime support library for sedlex -(sedlexing.cma / sedlexing.cmxa). - - -## Contributors - -- Benus Becker: implementation of Utf16 -- sghost: for Unicode 6.3 categories and properties -- Peter Zotov: - - improvements to the build system - - switched parts of ppx_sedlex to using concrete syntax (with ppx_metaquot) diff --git a/sedlex-1.99.4/examples/Makefile b/sedlex-1.99.4/examples/Makefile deleted file mode 100644 index dea8e74..0000000 --- a/sedlex-1.99.4/examples/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# The package sedlex is released under the terms of an MIT-like license. -# See the attached LICENSE file. -# Copyright 2005, 2013 by Alain Frisch and LexiFi. - -include $(shell ocamlc -where)/Makefile.config - -.PHONY: test -test: tokenizer$(EXE) complement$(EXE) subtraction$(EXE) repeat$(EXE) - ./tokenizer$(EXE) - ./complement$(EXE) - ./subtraction$(EXE) - ./repeat$(EXE) - -tokenizer$(EXE): tokenizer.ml - ocamlfind ocamlc -package gen -ppx "../src/syntax/ppx_sedlex$(EXE) --as-ppx" -I ../src/lib -o tokenizer$(EXE) -linkpkg sedlexing.cma tokenizer.ml - -complement$(EXE): complement.ml - ocamlfind ocamlc -package gen -ppx "../src/syntax/ppx_sedlex$(EXE) --as-ppx" -I ../src/lib -o complement$(EXE) -linkpkg sedlexing.cma complement.ml - -subtraction$(EXE): subtraction.ml - ocamlfind ocamlc -package gen -ppx "../src/syntax/ppx_sedlex$(EXE) --as-ppx" -I ../src/lib -o subtraction$(EXE) -linkpkg sedlexing.cma subtraction.ml - -repeat$(EXE): repeat.ml - ocamlfind ocamlc -package gen -ppx "../src/syntax/ppx_sedlex$(EXE) --as-ppx" -I ../src/lib -o repeat$(EXE) -linkpkg sedlexing.cma repeat.ml - -.PHONY: with_driver -with_driver: tokenizer.ml - ocamlfind ocamlc -package gen -ppx "ppx_driver ../src/syntax/sedlex.cma" -I ../src/lib -o tokenizer$(EXE) sedlexing.cma tokenizer.ml - -.PHONY: with_findlib -with_findlib: tokenizer.ml - ocamlfind ocamlc -c -package sedlex -package gen tokenizer.ml - ocamlfind ocamlc -o tokenizer$(EXE) -linkpkg -package sedlex -package gen tokenizer.cmo - -clean: - rm -f *~ *.cm* *.a *.lib *.o *.obj tokenizer$(EXE) complement$(EXE) subtraction$(EXE) repeat$(EXE) diff --git a/sedlex-1.99.4/examples/complement.ml b/sedlex-1.99.4/examples/complement.ml deleted file mode 100644 index 1c415a2..0000000 --- a/sedlex-1.99.4/examples/complement.ml +++ /dev/null @@ -1,14 +0,0 @@ -let ucase = [%sedlex.regexp? 'A'..'Z'] -let lcase = [%sedlex.regexp? 'a'..'z'] - -let rec token buf = - match%sedlex buf with - | lcase -> print_char 'L';token buf - | Compl (ucase | lcase) -> print_char '?'; token buf - | ucase -> print_char 'U';token buf - | eof -> print_endline "." - | _ -> assert false - -let () = - let lexbuf = Sedlexing.Latin1.from_string "Abc::DefG" in - token lexbuf diff --git a/sedlex-1.99.4/examples/repeat.ml b/sedlex-1.99.4/examples/repeat.ml deleted file mode 100644 index 0e1d5d0..0000000 --- a/sedlex-1.99.4/examples/repeat.ml +++ /dev/null @@ -1,15 +0,0 @@ -let rec token buf = - match%sedlex buf with - | white_space -> print_endline "\tWhitespace"; token buf - | 'a', Rep(white_space, 1) -> print_endline "a\n\tWhitespace"; token buf - | Rep("bc", 2) -> print_endline "bcbc"; token buf - | Rep("d", 1 .. 1) -> print_endline "d"; token buf - | Rep("ef", 1 .. 3) -> Printf.printf "%s\n" (Sedlexing.Utf8.lexeme buf); token buf - | eof -> print_endline "\tEnd" - | any -> print_endline "Other"; token buf - | _ -> failwith "Internal failure: Reached impossible place" - - -let () = - let lexbuf = Sedlexing.Utf8.from_string "a bcbc d ef efef efefef" in - token lexbuf diff --git a/sedlex-1.99.4/examples/subtraction.ml b/sedlex-1.99.4/examples/subtraction.ml deleted file mode 100644 index 9136d2e..0000000 --- a/sedlex-1.99.4/examples/subtraction.ml +++ /dev/null @@ -1,14 +0,0 @@ -let rec token buf = - match%sedlex buf with - | white_space -> print_endline "\tWhitespace"; token buf - | Sub (Chars "ab","b") -> print_endline "a"; token buf - | (Chars "ab"|"c") -> print_endline "abc"; token buf - | Intersect ("d", Chars "abd") -> print_endline "d"; token buf - | eof -> print_endline "\tEnd" - | any -> print_endline "Other"; token buf - | _ -> failwith "Internal failure: Reached impossible place" - - -let () = - let lexbuf = Sedlexing.Utf8.from_string "a b c d e" in - token lexbuf diff --git a/sedlex-1.99.4/examples/tokenizer.ml b/sedlex-1.99.4/examples/tokenizer.ml deleted file mode 100644 index 9ad8831..0000000 --- a/sedlex-1.99.4/examples/tokenizer.ml +++ /dev/null @@ -1,17 +0,0 @@ -let digit = [%sedlex.regexp? '0'..'9'] -let number = [%sedlex.regexp? Plus digit] - -let rec token buf = - let letter = [%sedlex.regexp? 'a'..'z'|'A'..'Z'] in - match%sedlex buf with - | number -> Printf.printf "Number %s\n" (Sedlexing.Latin1.lexeme buf); token buf - | letter, Star ('A'..'Z' | 'a'..'z' | digit) -> Printf.printf "Ident %s\n" (Sedlexing.Latin1.lexeme buf); token buf - | Plus xml_blank -> token buf - | Plus (Chars "+*-/") -> Printf.printf "Op %s\n" (Sedlexing.Latin1.lexeme buf); token buf - | 128 .. 255 -> print_endline "Non ASCII" - | eof -> print_endline "EOF" - | _ -> failwith "Unexpected character" - -let () = - let lexbuf = Sedlexing.Latin1.from_string "foobar A123Bfoo ++123Xbar/foo" in - token lexbuf diff --git a/sedlex-1.99.4/nopam b/sedlex-1.99.4/nopam deleted file mode 100644 index 5666365..0000000 --- a/sedlex-1.99.4/nopam +++ /dev/null @@ -1,20 +0,0 @@ -opam-version: "1.2" -name: "sedlex" -version: "1.99.4" -maintainer: "Alain Frisch " -authors: [ - "Alain Frisch " -] -build: [ [make "all"] [make "opt"] ] -install: [make "install"] -remove: [["ocamlfind" "remove" "sedlex"]] -depends: ["ocamlfind" {build} - "ppx_tools_versioned" - "ocaml-migrate-parsetree" - "gen" - ] -available: [ ocaml-version >= "4.02.3" ] -homepage: "https://github.com/alainfrisch/sedlex" -bug-reports: "https://github.com/alainfrisch/sedlex/issues" -license: "MIT" -dev-repo: "https://github.com/alainfrisch/sedlex.git" diff --git a/sedlex-1.99.4/src/lib/Makefile b/sedlex-1.99.4/src/lib/Makefile deleted file mode 100644 index 0544095..0000000 --- a/sedlex-1.99.4/src/lib/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# The package sedlex is released under the terms of an MIT-like license. -# See the attached LICENSE file. -# Copyright 2005, 2013 by Alain Frisch and LexiFi. - -MODS=sedlexing.cmo - -all: sedlexing.cma -opt: sedlexing.cmxa - -sedlexing.cma: $(MODS:.cmo=.mli) $(MODS:.cmo=.ml) - ocamlfind ocamlc -package gen -w +A-4-9 -safe-string -c $(MODS:.cmo=.mli) $(MODS:.cmo=.ml) - ocamlfind ocamlc -package gen -a -o sedlexing.cma $(MODS) - -sedlexing.cmxa: $(MODS:.cmo=.mli) $(MODS:.cmo=.ml) - ocamlfind ocamlopt -package gen -safe-string -c $(MODS:.cmo=.mli) $(MODS:.cmo=.ml) - ocamlfind ocamlopt -package gen -a -o sedlexing.cmxa $(MODS:.cmo=.cmx) - -doc: - rm -rf ../../libdoc - mkdir ../../libdoc - ocamlfind ocamldoc -package gen -html sedlexing.mli -d ../../libdoc - - - -clean: - rm -f *~ *.cm* *.a *.lib *.exe *.o *.obj diff --git a/sedlex-1.99.4/src/lib/dune b/sedlex-1.99.4/src/lib/dune deleted file mode 100644 index 49e138d..0000000 --- a/sedlex-1.99.4/src/lib/dune +++ /dev/null @@ -1,5 +0,0 @@ -(library - (name Flow_parser_sedlex) - (public_name flow-parser.sedlex) - (libraries gen uchar) - (flags :standard -w +A-4-9 -safe-string)) diff --git a/sedlex-1.99.4/src/lib/sedlexing.ml b/sedlex-1.99.4/src/lib/sedlexing.ml deleted file mode 100755 index fcb9f0a..0000000 --- a/sedlex-1.99.4/src/lib/sedlexing.ml +++ /dev/null @@ -1,464 +0,0 @@ -(* The package sedlex is released under the terms of an MIT-like license. *) -(* See the attached LICENSE file. *) -(* Copyright 2005, 2013 by Alain Frisch and LexiFi. *) - -exception InvalidCodepoint of int -exception MalFormed - - -let gen_of_channel chan = - let f () = - try Some (input_char chan) - with End_of_file -> None - in - f - -let (>>=) o f = match o with - | Some x -> f x - | None -> None - - -(* For legacy purposes. *) -let gen_of_stream stream = - let f () = - try Some (Stream.next stream) - with Stream.Failure -> None - in f - -let eof = -1 - -(* Absolute position from the beginning of the stream *) -type apos = int - -type lexbuf = { - refill: (int array -> int -> int -> int); - mutable buf: int array; - mutable len: int; (* Number of meaningful char in buffer *) - mutable offset: apos; (* Position of the first char in buffer - in the input stream *) - mutable pos: int; - mutable start: int; (* First char we need to keep visible *) - - mutable marked_pos: int; - mutable marked_val: int; - - mutable finished: bool; -} - -let chunk_size = 512 - -let empty_lexbuf = { - refill = (fun _ _ _ -> assert false); - buf = [| |]; - len = 0; - offset = 0; - pos = 0; - start = 0; - marked_pos = 0; - marked_val = 0; - finished = false; -} - -let create f = { - empty_lexbuf with - refill = f; - buf = Array.make chunk_size 0; -} - - -let fill_buf_from_gen f gen buf pos len = - let rec aux i = - if i >= len then len - else match gen () with - | Some c -> buf.(pos + i) <- f c ; aux (i+1) - | None -> i - in - aux 0 - -let from_gen s = - create (fill_buf_from_gen (fun id -> id) s) - -let from_stream s = from_gen @@ gen_of_stream s - -let from_int_array a = - let len = Array.length a in - { - empty_lexbuf with - buf = Array.init len (fun i -> a.(i)); - len = len; - finished = true; - } - - -let refill lexbuf = - if lexbuf.len + chunk_size > Array.length lexbuf.buf - then begin - let s = lexbuf.start in - let ls = lexbuf.len - s in - if ls + chunk_size <= Array.length lexbuf.buf then - Array.blit lexbuf.buf s lexbuf.buf 0 ls - else begin - let newlen = (Array.length lexbuf.buf + chunk_size) * 2 in - let newbuf = Array.make newlen 0 in - Array.blit lexbuf.buf s newbuf 0 ls; - lexbuf.buf <- newbuf - end; - lexbuf.len <- ls; - lexbuf.offset <- lexbuf.offset + s; - lexbuf.pos <- lexbuf.pos - s; - lexbuf.marked_pos <- lexbuf.marked_pos - s; - lexbuf.start <- 0 - end; - let n = lexbuf.refill lexbuf.buf lexbuf.pos chunk_size in - if (n = 0) - then begin - lexbuf.buf.(lexbuf.len) <- eof; - lexbuf.len <- lexbuf.len + 1; - end - else lexbuf.len <- lexbuf.len + n - -let next lexbuf = - let i = - if lexbuf.pos = lexbuf.len then - if lexbuf.finished then eof - else (refill lexbuf; lexbuf.buf.(lexbuf.pos)) - else lexbuf.buf.(lexbuf.pos) - in - if i = eof then lexbuf.finished <- true else lexbuf.pos <- lexbuf.pos + 1; - i - -let start lexbuf = - lexbuf.start <- lexbuf.pos; - lexbuf.marked_pos <- lexbuf.pos; - lexbuf.marked_val <- (-1) - -let mark lexbuf i = - lexbuf.marked_pos <- lexbuf.pos; - lexbuf.marked_val <- i - -let backtrack lexbuf = - lexbuf.pos <- lexbuf.marked_pos; - lexbuf.marked_val - -let rollback lexbuf = - lexbuf.pos <- lexbuf.start - -let lexeme_start lexbuf = lexbuf.start + lexbuf.offset -let lexeme_end lexbuf = lexbuf.pos + lexbuf.offset - -let loc lexbuf = (lexbuf.start + lexbuf.offset, lexbuf.pos + lexbuf.offset) - -let lexeme_length lexbuf = lexbuf.pos - lexbuf.start - -let sub_lexeme lexbuf pos len = - Array.sub lexbuf.buf (lexbuf.start + pos) len - -let lexeme lexbuf = - Array.sub lexbuf.buf (lexbuf.start) (lexbuf.pos - lexbuf.start) - -let lexeme_char lexbuf pos = - lexbuf.buf.(lexbuf.start + pos) - - -module Latin1 = struct - let from_gen s = - create (fill_buf_from_gen Char.code s) - - let from_stream s = from_gen @@ gen_of_stream s - - let from_string s = - let len = String.length s in - { - empty_lexbuf with - buf = Array.init len (fun i -> Char.code s.[i]); - len = len; - finished = true; - } - - let from_channel ic = - from_gen (gen_of_channel ic) - - let to_latin1 c = - if (c >= 0) && (c < 256) - then Char.chr c - else raise (InvalidCodepoint c) - - let lexeme_char lexbuf pos = - to_latin1 (lexeme_char lexbuf pos) - - let sub_lexeme lexbuf pos len = - let s = Bytes.create len in - for i = 0 to len - 1 do Bytes.set s i (to_latin1 lexbuf.buf.(lexbuf.start + pos + i)) done; - Bytes.to_string s - - let lexeme lexbuf = - sub_lexeme lexbuf 0 (lexbuf.pos - lexbuf.start) -end - - -module Utf8 = struct - module Helper = struct - (* http://www.faqs.org/rfcs/rfc3629.html *) - - let width = Array.make 256 (-1) - let () = - for i = 0 to 127 do width.(i) <- 1 done; - for i = 192 to 223 do width.(i) <- 2 done; - for i = 224 to 239 do width.(i) <- 3 done; - for i = 240 to 247 do width.(i) <- 4 done - - let next s i = - match s.[i] with - | '\000'..'\127' as c -> - Char.code c - | '\192'..'\223' as c -> - let n1 = Char.code c in - let n2 = Char.code s.[i+1] in - if (n2 lsr 6 != 0b10) then raise MalFormed; - ((n1 land 0x1f) lsl 6) lor (n2 land 0x3f) - | '\224'..'\239' as c -> - let n1 = Char.code c in - let n2 = Char.code s.[i+1] in - let n3 = Char.code s.[i+2] in - if (n2 lsr 6 != 0b10) || (n3 lsr 6 != 0b10) then raise MalFormed; - let p = - ((n1 land 0x0f) lsl 12) lor ((n2 land 0x3f) lsl 6) lor (n3 land 0x3f) - in - if (p >= 0xd800) && (p <= 0xdf00) then raise MalFormed; - p - | '\240'..'\247' as c -> - let n1 = Char.code c in - let n2 = Char.code s.[i+1] in - let n3 = Char.code s.[i+2] in - let n4 = Char.code s.[i+3] in - if (n2 lsr 6 != 0b10) || (n3 lsr 6 != 0b10) || (n4 lsr 6 != 0b10) - then raise MalFormed; - ((n1 land 0x07) lsl 18) lor ((n2 land 0x3f) lsl 12) lor - ((n3 land 0x3f) lsl 6) lor (n4 land 0x3f) - | _ -> raise MalFormed - - - let from_gen s = - Gen.next s >>= function - | '\000'..'\127' as c -> - Some (Char.code c) - | '\192'..'\223' as c -> - let n1 = Char.code c in - Gen.next s >>= fun c2 -> - let n2 = Char.code c2 in - if (n2 lsr 6 != 0b10) then raise MalFormed; - Some (((n1 land 0x1f) lsl 6) lor (n2 land 0x3f)) - | '\224'..'\239' as c -> - let n1 = Char.code c in - Gen.next s >>= fun c2 -> - let n2 = Char.code c2 in - Gen.next s >>= fun c3 -> - let n3 = Char.code c3 in - if (n2 lsr 6 != 0b10) || (n3 lsr 6 != 0b10) then raise MalFormed; - Some (((n1 land 0x0f) lsl 12) lor ((n2 land 0x3f) lsl 6) lor (n3 land 0x3f)) - | '\240'..'\247' as c -> - let n1 = Char.code c in - Gen.next s >>= fun c2 -> - let n2 = Char.code c2 in - Gen.next s >>= fun c3 -> - let n3 = Char.code c3 in - Gen.next s >>= fun c4 -> - let n4 = Char.code c4 in - if (n2 lsr 6 != 0b10) || (n3 lsr 6 != 0b10) || (n4 lsr 6 != 0b10) - then raise MalFormed; - Some (((n1 land 0x07) lsl 18) lor ((n2 land 0x3f) lsl 12) lor - ((n3 land 0x3f) lsl 6) lor (n4 land 0x3f)) - | _ -> raise MalFormed - - - - let compute_len s pos bytes = - let rec aux n i = - if i >= pos + bytes then if i = pos + bytes then n else raise MalFormed - else - let w = width.(Char.code s.[i]) in - if w > 0 then aux (succ n) (i + w) - else raise MalFormed - in - aux 0 pos - - let rec blit_to_int s spos a apos n = - if n > 0 then begin - a.(apos) <- next s spos; - blit_to_int s (spos + width.(Char.code s.[spos])) a (succ apos) (pred n) - end - - let to_int_array s pos bytes = - let n = compute_len s pos bytes in - let a = Array.make n 0 in - blit_to_int s pos a 0 n; - a - -(**************************) - - let store b p = - if p <= 0x7f then - Buffer.add_char b (Char.chr p) - else if p <= 0x7ff then ( - Buffer.add_char b (Char.chr (0xc0 lor (p lsr 6))); - Buffer.add_char b (Char.chr (0x80 lor (p land 0x3f))) - ) - else if p <= 0xffff then ( - if (p >= 0xd800 && p < 0xe000) then raise MalFormed; - Buffer.add_char b (Char.chr (0xe0 lor (p lsr 12))); - Buffer.add_char b (Char.chr (0x80 lor ((p lsr 6) land 0x3f))); - Buffer.add_char b (Char.chr (0x80 lor (p land 0x3f))) - ) - else if p <= 0x10ffff then ( - Buffer.add_char b (Char.chr (0xf0 lor (p lsr 18))); - Buffer.add_char b (Char.chr (0x80 lor ((p lsr 12) land 0x3f))); - Buffer.add_char b (Char.chr (0x80 lor ((p lsr 6) land 0x3f))); - Buffer.add_char b (Char.chr (0x80 lor (p land 0x3f))) - ) - else raise MalFormed - - let from_int_array a apos len = - let b = Buffer.create (len * 4) in - let rec aux apos len = - if len > 0 then (store b a.(apos); aux (succ apos) (pred len)) - else Buffer.contents b in - aux apos len - - let gen_from_char_gen s = (fun () -> from_gen s) - end - - let from_channel ic = - from_gen (Helper.gen_from_char_gen (gen_of_channel ic)) - - let from_gen s = - create (fill_buf_from_gen (fun id -> id) - (Helper.gen_from_char_gen s)) - - let from_stream s = from_gen @@ gen_of_stream s - - let from_string s = - from_int_array (Helper.to_int_array s 0 (String.length s)) - - let sub_lexeme lexbuf pos len = - Helper.from_int_array lexbuf.buf (lexbuf.start + pos) len - - let lexeme lexbuf = - sub_lexeme lexbuf 0 (lexbuf.pos - lexbuf.start) -end - - -module Utf16 = struct - type byte_order = Little_endian | Big_endian - module Helper = struct - (* http://www.ietf.org/rfc/rfc2781.txt *) - - let number_of_char_pair bo c1 c2 = match bo with - | Little_endian -> ((Char.code c2) lsl 8) + (Char.code c1) - | Big_endian -> ((Char.code c1) lsl 8) + (Char.code c2) - - let char_pair_of_number bo num = match bo with - | Little_endian -> - (Char.chr (num land 0xFF), Char.chr ((num lsr 8) land 0xFF )) - | Big_endian -> - (Char.chr ((num lsr 8) land 0xFF), Char.chr (num land 0xFF)) - - let next_in_gen bo s = - Gen.next s >>= fun c1 -> - Gen.next s >>= fun c2 -> - Some (number_of_char_pair bo c1 c2) - - let from_gen bo s w1 = - if w1 = 0xfffe then raise (InvalidCodepoint w1); - if w1 < 0xd800 || 0xdfff < w1 then Some w1 - else if w1 <= 0xdbff - then - next_in_gen bo s >>= fun w2 -> - if w2 < 0xdc00 || w2 > 0xdfff then raise MalFormed; - let upper10 = (w1 land 0x3ff) lsl 10 - and lower10 = w2 land 0x3ff in - Some (0x10000 + upper10 + lower10) - else raise MalFormed - - let gen_from_char_gen opt_bo s = - let bo = ref opt_bo in - fun () -> - Gen.next s >>= fun c1 -> - Gen.next s >>= fun c2 -> - let o = match !bo with - | Some o -> o - | None -> - let o = match (Char.code c1, Char.code c2) with - | (0xff,0xfe) -> Little_endian - | _ -> Big_endian in - bo := Some o; - o in - from_gen o s (number_of_char_pair o c1 c2) - - - let compute_len opt_bo str pos bytes = - let s = gen_from_char_gen opt_bo - (Gen.init ~limit:(bytes - pos) (fun i -> (str.[i + pos]))) - in - let l = ref 0 in - Gen.iter (fun _ -> incr l) s ; - !l - - let blit_to_int opt_bo s spos a apos bytes = - let s = gen_from_char_gen opt_bo - (Gen.init ~limit:(bytes - spos) (fun i -> (s.[i + spos]))) in - let p = ref apos in - Gen.iter (fun x -> a.(!p) <- x ; incr p) s - - let to_int_array opt_bo s pos bytes = - let len = compute_len opt_bo s pos bytes in - let a = Array.make len 0 in - blit_to_int opt_bo s pos a 0 bytes ; - a - - let store bo buf code = - if code < 0x10000 - then ( - let (c1,c2) = char_pair_of_number bo code in - Buffer.add_char buf c1; - Buffer.add_char buf c2 - ) else ( - let u' = code - 0x10000 in - let w1 = 0xd800 + (u' lsr 10) - and w2 = 0xdc00 + (u' land 0x3ff) in - let (c1,c2) = char_pair_of_number bo w1 - and (c3,c4) = char_pair_of_number bo w2 in - Buffer.add_char buf c1; - Buffer.add_char buf c2; - Buffer.add_char buf c3; - Buffer.add_char buf c4 - ) - - let from_int_array bo a apos len bom = - let b = Buffer.create (len * 4) in - if bom then store bo b 0xfeff ; (* first, store the BOM *) - let rec aux apos len = - if len > 0 - then (store bo b a.(apos); aux (succ apos) (pred len)) - else Buffer.contents b in - aux apos len - end - - - let from_gen s opt_bo = - from_gen (Helper.gen_from_char_gen opt_bo s) - - let from_stream s = from_gen @@ gen_of_stream s - - let from_channel ic opt_bo = - from_gen (gen_of_channel ic) opt_bo - - let from_string s opt_bo = - let a = Helper.to_int_array opt_bo s 0 (String.length s) in - from_int_array a - - let sub_lexeme lb pos len bo bom = - Helper.from_int_array bo lb.buf (lb.start + pos) len bom - - let lexeme lb bo bom = - sub_lexeme lb 0 (lb.pos - lb.start) bo bom -end diff --git a/sedlex-1.99.4/src/lib/sedlexing.mli b/sedlex-1.99.4/src/lib/sedlexing.mli deleted file mode 100644 index fa3d15c..0000000 --- a/sedlex-1.99.4/src/lib/sedlexing.mli +++ /dev/null @@ -1,231 +0,0 @@ -(* The package sedlex is released under the terms of an MIT-like license. *) -(* See the attached LICENSE file. *) -(* Copyright 2005, 2013 by Alain Frisch and LexiFi. *) - -(** Runtime support for lexers generated by [sedlex]. *) - -(** This module is roughly equivalent to the module Lexing from the - OCaml standard library, except that its lexbuffers handle Unicode - code points (OCaml type: [int] in the range [0..0x10ffff]) instead - of bytes (OCaml type: [char]). - - It is possible to have sedlex-generated lexers work on a custom - implementation for lex buffers. To do this, define a module [L] - which implements the [start], [next], [mark] and [backtrack] - functions (See the Internal Interface section below for a - specification). They need not work on a type named [lexbuf]: you - can use the type name you want. Then, just do in your - sedlex-processed source, bind this module to the name [Sedlexing] - (for instance, with a local module definition: [let module Sedlexing - = L in ...]. - - Of course, you'll probably want to define functions like [lexeme] to - be used in the lexers semantic actions. *) - -type lexbuf - (** The type of lexer buffers. A lexer buffer is the argument passed - to the scanning functions defined by the generated lexers. - The lexer buffer holds the internal information for the - scanners, including the code points of the token currently scanned, - its position from the beginning of the input stream, - and the current position of the lexer. *) - -exception InvalidCodepoint of int - (** Raised by some functions to signal that some code point is not - compatible with a specified encoding. *) - -exception MalFormed - (** Raised by functions in the [Utf8] and [Utf16] modules to report - strings which do not comply to the encoding. *) - -(** {6 Creating generic lexbufs} *) - -val create: (int array -> int -> int -> int) -> lexbuf - (** Create a generic lexer buffer. When the lexer needs more - characters, it will call the given function, giving it an array of - integers [a], a position [pos] and a code point count [n]. The - function should put [n] code points or less in [a], starting at - position [pos], and return the number of characters provided. A - return value of 0 means end of input. *) - -val from_gen: int Gen.t -> lexbuf - (** Create a lexbuf from a stream of Unicode code points. *) - -val from_stream: int Stream.t -> lexbuf - [@@ocaml.deprecated "Use [Sedlexing.from_gen] instead."] - (** Create a lexbuf from a stream of Unicode code points. *) - -val from_int_array: int array -> lexbuf - (** Create a lexbuf from an array of Unicode code points. *) - -(** {6 Interface for lexers semantic actions} *) - -(** The following functions can be called from the semantic actions of - lexer definitions. They give access to the character string matched - by the regular expression associated with the semantic action. *) - -val lexeme_start: lexbuf -> int - (** [Sedlexing.lexeme_start lexbuf] returns the offset in the - input stream of the first code point of the matched string. - The first code point of the stream has offset 0. *) - -val lexeme_end: lexbuf -> int - (** [Sedlexing.lexeme_end lexbuf] returns the offset in the input - stream of the character following the last code point of the - matched string. The first character of the stream has offset - 0. *) - -val loc: lexbuf -> int * int - (** [Sedlexing.loc lexbuf] returns the pair - [(Sedlexing.lexeme_start lexbuf,Sedlexing.lexeme_end - lexbuf)]. *) - -val lexeme_length: lexbuf -> int - (** [Sedlexing.loc lexbuf] returns the difference - [(Sedlexing.lexeme_end lexbuf) - (Sedlexing.lexeme_start - lexbuf)], that is, the length (in code points) of the matched - string. *) - -val lexeme: lexbuf -> int array - (** [Sedlexing.lexeme lexbuf] returns the string matched by the - regular expression as an array of Unicode code point. *) - -val lexeme_char: lexbuf -> int -> int - (** [Sedlexing.lexeme_char lexbuf pos] returns code point number [pos] in - the matched string. *) - -val sub_lexeme: lexbuf -> int -> int -> int array -(** [Sedlexing.lexeme lexbuf pos len] returns a substring of the string - matched by the regular expression as an array of Unicode code point. *) - - -val rollback: lexbuf -> unit -(** [Sedlexing.rollback lexbuf] puts [lexbuf] back in its configuration before - the last lexeme was matched. It is then possible to use another - lexer to parse the same characters again. The other functions - above in this section should not be used in the semantic action - after a call to [Sedlexing.rollback]. *) - -(** {6 Internal interface} *) - -(** These functions are used internally by the lexers. They could be used - to write lexers by hand, or with a lexer generator different from - [sedlex]. The lexer buffers have a unique internal slot that can store - an integer. They also store a "backtrack" position. - *) - -val start: lexbuf -> unit -(** [start t] informs the lexer buffer that any - code points until the current position can be discarded. - The current position become the "start" position as returned - by [Sedlexing.lexeme_start]. Moreover, the internal slot is set to - [-1] and the backtrack position is set to the current position. - *) - -val next: lexbuf -> int -(** [next lexbuf] extracts the next code point from the - lexer buffer and increments to current position. If the input stream - is exhausted, the function returns [-1]. *) - -val mark: lexbuf -> int -> unit -(** [mark lexbuf i] stores the integer [i] in the internal - slot. The backtrack position is set to the current position. *) - -val backtrack: lexbuf -> int -(** [backtrack lexbuf] returns the value stored in the - internal slot of the buffer, and performs backtracking - (the current position is set to the value of the backtrack position). *) - - -(** {6 Support for common encodings} *) - -module Latin1: sig - val from_gen: char Gen.t -> lexbuf - (** Create a lexbuf from a Latin1 encoded stream (ie a stream - of Unicode code points in the range [0..255]) *) - - val from_stream: char Stream.t -> lexbuf - [@@ocaml.deprecated "Use [Sedlexing.Latin1.from_gen] instead."] - (** Create a lexbuf from a Latin1 encoded stream (ie a stream - of Unicode code points in the range [0..255]) *) - - val from_channel: in_channel -> lexbuf - (** Create a lexbuf from a Latin1 encoded input channel. - The client is responsible for closing the channel. *) - - val from_string: string -> lexbuf - (** Create a lexbuf from a Latin1 encoded string. *) - - - val lexeme: lexbuf -> string - (** As [Sedlexing.lexeme] with a result encoded in Latin1. This - function throws an exception [InvalidCodepoint] if it is not - possible to encode the result in Latin1. *) - - val sub_lexeme: lexbuf -> int -> int -> string - (** As [Sedlexing.sub_lexeme] with a result encoded in Latin1. - This function throws an exception [InvalidCodepoint] if it - is not possible to encode the result in Latin1. *) - - val lexeme_char: lexbuf -> int -> char - (** As [Sedlexing.lexeme_char] with a result encoded in Latin1. - This function throws an exception [InvalidCodepoint] if it - is not possible to encode the result in Latin1. *) -end - - -module Utf8: sig - val from_gen: char Gen.t -> lexbuf - (** Create a lexbuf from a UTF-8 encoded stream. *) - - val from_stream: char Stream.t -> lexbuf - [@@ocaml.deprecated "Use [Sedlexing.Utf8.from_gen] instead."] - (** Create a lexbuf from a UTF-8 encoded stream. *) - - val from_channel: in_channel -> lexbuf - (** Create a lexbuf from a UTF-8 encoded input channel. *) - - val from_string: string -> lexbuf - (** Create a lexbuf from a UTF-8 encoded string. *) - - val lexeme: lexbuf -> string - (** As [Sedlexing.lexeme] with a result encoded in UTF-8. *) - - val sub_lexeme: lexbuf -> int -> int -> string - (** As [Sedlexing.sub_lexeme] with a result encoded in UTF-8. *) -end - - -module Utf16: sig - type byte_order = Little_endian | Big_endian - - val from_gen: char Gen.t -> byte_order option -> lexbuf - (** [Utf16.from_gen s opt_bo] creates a lexbuf from an UTF-16 - encoded stream. If [opt_bo] matches with [None] the function - expects a BOM (Byte Order Mark), and takes the byte order as - [Utf16.Big_endian] if it cannot find one. When [opt_bo] - matches with [Some bo], [bo] is taken as byte order. In this - case a leading BOM is kept in the stream - the lexer has to - ignore it and a `wrong' BOM ([0xfffe]) will raise - Utf16.InvalidCodepoint. *) - - val from_stream: char Stream.t -> byte_order option -> lexbuf - [@@ocaml.deprecated "Use [Sedlexing.Utf16.from_gen] instead."] - (** Works as [Utf16.from_gen] with a [stream]. *) - - val from_channel: in_channel -> byte_order option-> lexbuf - (** Works as [Utf16.from_gen] with an [in_channel]. *) - - val from_string: string -> byte_order option -> lexbuf - (** Works as [Utf16.from_gen] with a [string]. *) - - val lexeme: lexbuf -> byte_order -> bool -> string - (** [utf16_lexeme lb bo bom] as [Sedlexing.lexeme] with a result - encoded in UTF-16 in byte_order [bo] and starting with a BOM - if [bom = true]. *) - - val sub_lexeme: lexbuf -> int -> int -> byte_order -> bool -> string - (** [sub_lexeme lb pos len bo bom] as - [Sedlexing.sub_lexeme] with a result encoded in UTF-16 with - byte order [bo] and starting with a BOM if [bom=true] *) -end diff --git a/sedlex-1.99.4/src/syntax/Makefile b/sedlex-1.99.4/src/syntax/Makefile deleted file mode 100644 index ec5b86f..0000000 --- a/sedlex-1.99.4/src/syntax/Makefile +++ /dev/null @@ -1,54 +0,0 @@ -# The package sedlex is released under the terms of an MIT-like license. -# See the attached LICENSE file. -# Copyright 2005, 2013 by Alain Frisch and LexiFi. - -include $(shell ocamlc -where)/Makefile.config - -SRCS=sedlex_cset.mli sedlex_cset.ml unicode63.mli unicode63.ml sedlex.mli sedlex.ml ppx_sedlex.ml - -OCAMLC=ocamlfind ocamlc -OCAMLOPT=ocamlfind ocamlopt -PACKAGES=-package ppx_tools_versioned.metaquot_405 -package ocaml-migrate-parsetree -OCAMLFLAGS=$(PACKAGES) -linkall -w +A-4-9-42 -annot - -all: ppx_sedlex$(EXE) sedlex.cma -opt: ppx_sedlex.opt$(EXE) sedlex.cmxa sedlex.cmxs - -sedlex.cma: $(SRCS) - $(OCAMLC) $(OCAMLFLAGS) -a -o sedlex.cma $(SRCS) - -sedlex.cmxa: $(SRCS) - $(OCAMLOPT) $(OCAMLFLAGS) -a -o sedlex.cmxa $(SRCS) - -sedlex.cmxs: $(SRCS) - $(OCAMLOPT) $(OCAMLFLAGS) -shared -o sedlex.cmxs $(SRCS) - -# We need the ocaml-migrate-parsetree.driver-main.cm{,x}a library to come last -# on the command-line when linking, since its initialization code must run -# *after* the one of sedlex.cm{,x}a. To ensure that this is the case, we -# manually pass its file to ocaml{c,opt}, as normally ocamlfind links in all the -# -package libraries *before* user code. - -MIGRATE_PARSETREE_MAIN_BYTE= \ - $(shell ocamlfind query -predicates byte -a-format ocaml-migrate-parsetree.driver-main) -MIGRATE_PARSETREE_MAIN_NATIVE= \ - $(shell ocamlfind query -predicates native -a-format ocaml-migrate-parsetree.driver-main) - -ppx_sedlex$(EXE): sedlex.cma - $(OCAMLC) \ - -predicates ppx_driver \ - -o $@ -linkpkg -linkall \ - -package ppx_tools_versioned \ - $< \ - $(MIGRATE_PARSETREE_MAIN_BYTE) - -ppx_sedlex.opt$(EXE): sedlex.cmxa - $(OCAMLOPT) \ - -predicates ppx_driver \ - -o $@ -linkpkg -linkall \ - -package ppx_tools_versioned \ - $< \ - $(MIGRATE_PARSETREE_MAIN_NATIVE) - -clean: - rm -f *~ *.cm* *.a *.lib *.o *.obj *.annot ppx_sedlex$(EXE) ppx_sedlex.opt$(EXE) diff --git a/sedlex-1.99.4/src/syntax/dune b/sedlex-1.99.4/src/syntax/dune deleted file mode 100644 index 7a508b8..0000000 --- a/sedlex-1.99.4/src/syntax/dune +++ /dev/null @@ -1,9 +0,0 @@ -(library - (name Flow_parser_sedlex_ppx) - (public_name flow-parser.sedlex_ppx) - (kind ppx_rewriter) - (libraries flow-parser.ppx_tools_versioned.metaquot_405 Flow_parser_sedlex) - (ppx_runtime_libraries Flow_parser_sedlex) - (preprocess - (pps flow-parser.ppx_tools_versioned.metaquot_405)) - (flags (:standard -w -9))) diff --git a/sedlex-1.99.4/src/syntax/ppx_sedlex.ml b/sedlex-1.99.4/src/syntax/ppx_sedlex.ml deleted file mode 100644 index 5174df0..0000000 --- a/sedlex-1.99.4/src/syntax/ppx_sedlex.ml +++ /dev/null @@ -1,452 +0,0 @@ -(* The package sedlex is released under the terms of an MIT-like license. *) -(* See the attached LICENSE file. *) -(* Copyright 2005, 2013 by Alain Frisch and LexiFi. *) - -open Longident -open Migrate_parsetree -open Ast_405 -open Parsetree -open Asttypes -open Ast_helper -open Ast_convenience_405 - -module Ast_mapper_class = Ast_mapper_class_405 - -let ocaml_version = Versions.ocaml_405 - -module Cset = Sedlex_cset - -(* Decision tree for partitions *) - -type decision_tree = - | Lte of int * decision_tree * decision_tree - | Table of int * int array - | Return of int - -let decision l = - let l = List.map (fun (a, b, i) -> (a, b, Return i)) l in - let rec merge2 = function - | (a1, b1, d1) :: (a2, b2, d2) :: rest -> - let x = - if b1 + 1 = a2 then d2 - else Lte (a2 - 1, Return (-1), d2) - in - (a1, b2, Lte (b1, d1, x)) :: merge2 rest - | rest -> rest - in - let rec aux = function - | [(a, b, d)] -> Lte (a - 1, Return (-1), Lte (b, d, Return (-1))) - | [] -> Return (-1) - | l -> aux (merge2 l) - in - aux l - -let limit = 8192 - -let decision_table l = - let rec aux m accu = function - | ((a, b, i) as x)::rem when b < limit && i < 255-> - aux (min a m) (x :: accu) rem - | rem -> m, accu, rem - in - let (min, table, rest) = aux max_int [] l in - match table with - | [] -> decision l - | [(min, max, i)] -> - Lte (min - 1, Return (-1), (Lte (max, Return i, decision rest))) - | (_, max, _) :: _ -> - let arr = Array.make (max - min + 1) 0 in - let set (a, b, i) = for j = a to b do arr.(j - min) <- i + 1 done in - List.iter set table; - Lte (min - 1, Return (-1), Lte (max, Table (min, arr), decision rest)) - -let rec simplify min max = function - | Lte (i,yes,no) -> - if i >= max then simplify min max yes - else if i < min then simplify min max no - else Lte (i, simplify min i yes, simplify (i+1) max no) - | x -> x - -let segments_of_partition p = - let seg = ref [] in - Array.iteri - (fun i c -> List.iter (fun (a, b) -> seg := (a, b, i) :: !seg) c) - p; - List.sort (fun (a1,_,_) (a2,_,_) -> compare a1 a2) !seg - -let decision_table p = - simplify (-1) (Cset.max_code) (decision_table (segments_of_partition p)) - - -(* Helpers to build AST *) - -let appfun s l = app (evar s) l -let glb_value name def = Str.value Nonrecursive [Vb.mk (pvar name) def] - -(* Named regexps *) - -module StringMap = Map.Make(struct - type t = string - let compare = compare -end) - -let builtin_regexps = - List.fold_left (fun acc (n, c) -> StringMap.add n (Sedlex.chars c) acc) - StringMap.empty - [ - "any", Cset.any; - "eof", Cset.eof; - "xml_letter", Cset.letter; - "xml_digit", Cset.digit; - "xml_extender", Cset.extender; - "xml_base_char", Cset.base_char; - "xml_ideographic", Cset.ideographic; - "xml_combining_char", Cset.combining_char; - "xml_blank", Cset.blank; - "tr8876_ident_char", Cset.tr8876_ident_char; - - (* Unicode 6.3 categories *) - "cc", Unicode63.Categories.cc; - "cf", Unicode63.Categories.cf; - "cn", Unicode63.Categories.cn; - "co", Unicode63.Categories.co; - "cs", Unicode63.Categories.cs; - "ll", Unicode63.Categories.ll; - "lm", Unicode63.Categories.lm; - "lo", Unicode63.Categories.lo; - "lt", Unicode63.Categories.lt; - "lu", Unicode63.Categories.lu; - "mc", Unicode63.Categories.mc; - "me", Unicode63.Categories.me; - "mn", Unicode63.Categories.mn; - "nd", Unicode63.Categories.nd; - "nl", Unicode63.Categories.nl; - "no", Unicode63.Categories.no; - "pc", Unicode63.Categories.pc; - "pd", Unicode63.Categories.pd; - "pe", Unicode63.Categories.pe; - "pf", Unicode63.Categories.pf; - "pi", Unicode63.Categories.pi; - "po", Unicode63.Categories.po; - "ps", Unicode63.Categories.ps; - "sc", Unicode63.Categories.sc; - "sk", Unicode63.Categories.sk; - "sm", Unicode63.Categories.sm; - "so", Unicode63.Categories.so; - "zl", Unicode63.Categories.zl; - "zp", Unicode63.Categories.zp; - "zs", Unicode63.Categories.zs; - - (* Unicode 6.3 properties *) - "alphabetic", Unicode63.Properties.alphabetic; - "ascii_hex_digit", Unicode63.Properties.ascii_hex_digit; - "hex_digit", Unicode63.Properties.hex_digit; - "id_continue", Unicode63.Properties.id_continue; - "id_start", Unicode63.Properties.id_start; - "lowercase", Unicode63.Properties.lowercase; - "math", Unicode63.Properties.math; - "other_alphabetic", Unicode63.Properties.other_alphabetic; - "other_lowercase", Unicode63.Properties.other_lowercase; - "other_math", Unicode63.Properties.other_math; - "other_uppercase", Unicode63.Properties.other_uppercase; - "uppercase", Unicode63.Properties.uppercase; - "white_space", Unicode63.Properties.white_space; - "xid_continue", Unicode63.Properties.xid_continue; - "xid_start", Unicode63.Properties.xid_start; - ] - -(* Tables (indexed mapping: codepoint -> next state) *) - -let tables = Hashtbl.create 31 -let table_counter = ref 0 -let get_tables () = Hashtbl.fold (fun key x accu -> (x, key) :: accu) tables [] - -let table_name x = - try Hashtbl.find tables x - with Not_found -> - incr table_counter; - let s = Printf.sprintf "__sedlex_table_%i" !table_counter in - Hashtbl.add tables x s; - s - -let table (name, v) = - let n = Array.length v in - let s = Bytes.create n in - for i = 0 to n - 1 do Bytes.set s i (Char.chr v.(i)) done; - glb_value name (str (Bytes.to_string s)) - -(* Partition (function: codepoint -> next state) *) - -let partitions = Hashtbl.create 31 -let partition_counter = ref 0 -let get_partitions () = Hashtbl.fold (fun key x accu -> (x, key) :: accu) partitions [] - -let partition_name x = - try Hashtbl.find partitions x - with Not_found -> - incr partition_counter; - let s = Printf.sprintf "__sedlex_partition_%i" !partition_counter in - Hashtbl.add partitions x s; - s - -let partition (name, p) = - let rec gen_tree = function - | Lte (i, yes, no) -> - [%expr if c <= [%e int i] then [%e gen_tree yes] else [%e gen_tree no]] - | Return i -> int i - | Table (offset, t) -> - let c = if offset = 0 then [%expr c] else [%expr c - [%e int offset]] in - [%expr Char.code (String.get [%e evar (table_name t)] [%e c]) - 1] - in - let body = gen_tree (decision_table p) in - glb_value name (func [pvar "c", body]) - -(* Code generation for the automata *) - -let best_final final = - let fin = ref None in - for i = Array.length final - 1 downto 0 do - if final.(i) then fin := Some i - done; - !fin - -let state_fun state = Printf.sprintf "__sedlex_state_%i" state - -let call_state lexbuf auto state = - let (trans, final) = auto.(state) in - if Array.length trans = 0 - then match best_final final with - | Some i -> int i - | None -> assert false - else appfun (state_fun state) [evar lexbuf] - -let gen_state lexbuf auto i (trans, final) = - let partition = Array.map fst trans in - let cases = Array.mapi (fun i (_, j) -> Exp.case(pint i) (call_state lexbuf auto j)) trans in - let cases = Array.to_list cases in - let body () = - Exp.match_ - (appfun (partition_name partition) [[%expr Sedlexing.next [%e evar lexbuf]]]) - (cases @ [Exp.case [%pat? _] [%expr Sedlexing.backtrack [%e evar lexbuf]]]) - in - let ret body = [ Vb.mk (pvar (state_fun i)) (func [pvar lexbuf, body]) ] in - match best_final final with - | None -> ret (body ()) - | Some _ when Array.length trans = 0 -> [] - | Some i -> ret [%expr Sedlexing.mark [%e evar lexbuf] [%e int i]; [%e body ()]] - -let gen_definition lexbuf l error = - let brs = Array.of_list l in - let auto = Sedlex.compile (Array.map fst brs) in - let cases = Array.to_list (Array.mapi (fun i (_, e) -> Exp.case (pint i) e) brs) in - let states = Array.mapi (gen_state lexbuf auto) auto in - let states = List.flatten (Array.to_list states) in - Exp.let_ Recursive states - (Exp.sequence - [%expr Sedlexing.start [%e evar lexbuf]] - (Exp.match_ (appfun (state_fun 0) [evar lexbuf]) - (cases @ [Exp.case (Pat.any ()) error]) - ) - ) - -(* Lexer specification parser *) - -let codepoint i = - if i < 0 || i > Cset.max_code then - failwith (Printf.sprintf "Invalid Unicode code point: %i" i); - i - -let regexp_for_char c = - Sedlex.chars (Cset.singleton (Char.code c)) - -let regexp_for_string s = - let rec aux n = - if n = String.length s then Sedlex.eps - else - Sedlex.seq (regexp_for_char s.[n]) (aux (succ n)) - in aux 0 - -let err loc s = - raise (Location.Error (Location.error ~loc ("Sedlex: " ^ s))) - -let rec repeat r = function - | 0, 0 -> Sedlex.eps - | 0, m -> Sedlex.alt Sedlex.eps (Sedlex.seq r (repeat r (0, m - 1))) - | n, m -> Sedlex.seq r (repeat r (n - 1, m - 1)) - -let regexp_of_pattern env = - let rec char_pair_op func name p tuple = (* Construct something like Sub(a,b) *) - match tuple with - | Some {ppat_desc=Ppat_tuple (p0 :: p1 :: [])} -> - begin match func (aux p0) (aux p1) with - | Some r -> r - | None -> - err p.ppat_loc @@ - "the "^name^" operator can only applied to single-character length regexps" - end - | _ -> err p.ppat_loc @@ "the "^name^" operator requires two arguments, like "^name^"(a,b)" - and aux p = (* interpret one pattern node *) - match p.ppat_desc with - | Ppat_or (p1, p2) -> Sedlex.alt (aux p1) (aux p2) - | Ppat_tuple (p :: pl) -> - List.fold_left (fun r p -> Sedlex.seq r (aux p)) - (aux p) - pl - | Ppat_construct ({txt = Lident "Star"}, Some p) -> - Sedlex.rep (aux p) - | Ppat_construct ({txt = Lident "Plus"}, Some p) -> - Sedlex.plus (aux p) - | Ppat_construct - ({txt = Lident "Rep"}, - Some {ppat_desc=Ppat_tuple[p0; {ppat_desc=Ppat_constant (i1 as i2)|Ppat_interval(i1, i2)}]}) -> - begin match Constant.of_constant i1, Constant.of_constant i2 with - | Pconst_integer(i1,_), Pconst_integer(i2,_) -> - let i1 = int_of_string i1 in - let i2 = int_of_string i2 in - if 0 <= i1 && i1 <= i2 then repeat (aux p0) (i1, i2) - else err p.ppat_loc "Invalid range for Rep operator" - | _ -> - err p.ppat_loc "Rep must take an integer constant or interval" - end - | Ppat_construct ({txt = Lident "Rep"}, _) -> - err p.ppat_loc "the Rep operator takes 2 arguments" - | Ppat_construct ({txt = Lident "Opt"}, Some p) -> - Sedlex.alt Sedlex.eps (aux p) - | Ppat_construct ({txt = Lident "Compl"}, arg) -> - begin match arg with - | Some p0 -> - begin match Sedlex.compl (aux p0) with - | Some r -> r - | None -> - err p.ppat_loc - "the Compl operator can only applied to a single-character length regexp" - end - | _ -> err p.ppat_loc "the Compl operator requires an argument" - end - | Ppat_construct ({ txt = Lident "Sub" }, arg) -> - char_pair_op Sedlex.subtract "Sub" p arg - | Ppat_construct ({ txt = Lident "Intersect" }, arg) -> - char_pair_op Sedlex.intersection "Intersect" p arg - | Ppat_construct ({txt = Lident "Chars"}, arg) -> - let const = match arg with - | Some {ppat_desc=Ppat_constant const} -> - Some (Constant.of_constant const) - | _ -> None - in - begin match const with - | Some (Pconst_string(s,_))-> - let c = ref Cset.empty in - for i = 0 to String.length s - 1 do - c := Cset.union !c (Cset.singleton (Char.code s.[i])) - done; - Sedlex.chars !c - | _ -> err p.ppat_loc "the Chars operator requires a string argument" - end - | Ppat_interval (i_start, i_end) -> - begin match Constant.of_constant i_start, Constant.of_constant i_end with - | Pconst_char c1, Pconst_char c2 -> Sedlex.chars (Cset.interval (Char.code c1) (Char.code c2)) - | Pconst_integer(i1,_), Pconst_integer(i2,_) -> - Sedlex.chars (Cset.interval (codepoint (int_of_string i1)) (codepoint (int_of_string i2))) - | _ -> err p.ppat_loc "this pattern is not a valid interval regexp" - end - | Ppat_constant (const) -> - begin match Constant.of_constant const with - | Pconst_string (s, _) -> regexp_for_string s - | Pconst_char c -> regexp_for_char c - | Pconst_integer(i,_) -> Sedlex.chars (Cset.singleton (codepoint (int_of_string i))) - | _ -> err p.ppat_loc "this pattern is not a valid regexp" - end - | Ppat_var {txt=x} -> - begin try StringMap.find x env - with Not_found -> - err p.ppat_loc (Printf.sprintf "unbound regexp %s" x) - end - | _ -> - err p.ppat_loc "this pattern is not a valid regexp" - in - aux - - -let mapper cookies = - object(this) - inherit Ast_mapper_class.mapper as super - - val env = builtin_regexps - - method define_regexp name p = - {< env = StringMap.add name (regexp_of_pattern env p) env >} - - method! expr e = - match e with - | [%expr [%sedlex [%e? {pexp_desc=Pexp_match (lexbuf, cases)}]]] -> - let lexbuf = - match lexbuf with - | {pexp_desc=Pexp_ident{txt=Lident lexbuf}} -> lexbuf - | _ -> - err lexbuf.pexp_loc "the matched expression must be a single identifier" - in - let cases = List.rev cases in - let error = - match List.hd cases with - | {pc_lhs = [%pat? _]; pc_rhs = e; pc_guard = None} -> super # expr e - | {pc_lhs = p} -> - err p.ppat_loc "the last branch must be a catch-all error case" - in - let cases = List.rev (List.tl cases) in - let cases = - List.map - (function - | {pc_lhs = p; pc_rhs = e; pc_guard = None} -> regexp_of_pattern env p, super # expr e - | {pc_guard = Some e} -> - err e.pexp_loc "'when' guards are not supported" - ) cases - in - gen_definition lexbuf cases error - | [%expr let [%p? {ppat_desc=Ppat_var{txt=name}}] = [%sedlex.regexp? [%p? p]] in [%e? body]] -> - (this # define_regexp name p) # expr body - | [%expr [%sedlex [%e? _]]] -> - err e.pexp_loc "the %sedlex extension is only recognized on match expressions" - | _ -> super # expr e - - - val toplevel = true - - method structure_with_regexps l = - let mapper = ref this in - let regexps = ref [] in - let l = List.concat - (List.map - (function - | [%stri let [%p? {ppat_desc=Ppat_var{txt=name}}] = [%sedlex.regexp? [%p? p]]] as i -> - regexps := i :: !regexps; - mapper := !mapper # define_regexp name p; - [] - | i -> - [ !mapper # structure_item i ] - ) l) in - (l, List.rev !regexps) - - method! structure l = - if toplevel then - let sub = {< toplevel = false >} in - let previous = - match Driver.get_cookie cookies "sedlex.regexps" ocaml_version with - | Some {pexp_desc = Pexp_extension (_, PStr l)} -> l - | Some _ -> assert false - | None -> [] - in - let l, regexps = sub # structure_with_regexps (previous @ l) in - let parts = List.map partition (get_partitions ()) in - let tables = List.map table (get_tables ()) in - Driver.set_cookie cookies "sedlex.regexps" ocaml_version (Exp.extension (Location.mknoloc "regexps", PStr regexps)); - tables @ parts @ l - else - fst (this # structure_with_regexps l) - - end - -let () = - Driver.register - ~name:"sedlex" - ocaml_version - (fun _ cookies -> Ast_mapper_class.to_mapper (mapper cookies)) diff --git a/sedlex-1.99.4/src/syntax/sedlex.ml b/sedlex-1.99.4/src/syntax/sedlex.ml deleted file mode 100644 index aeb42d3..0000000 --- a/sedlex-1.99.4/src/syntax/sedlex.ml +++ /dev/null @@ -1,145 +0,0 @@ -(* The package sedlex is released under the terms of an MIT-like license. *) -(* See the attached LICENSE file. *) -(* Copyright 2005, 2013 by Alain Frisch and LexiFi. *) - -module Cset = Sedlex_cset - -(* NFA *) - -type node = { - id : int; - mutable eps : node list; - mutable trans : (Cset.t * node) list; -} - -(* Compilation regexp -> NFA *) - -type regexp = node -> node - -let cur_id = ref 0 -let new_node () = - incr cur_id; - { id = !cur_id; eps = []; trans = [] } - -let seq r1 r2 succ = r1 (r2 succ) - -let is_chars final = function - | {eps = []; trans = [c, f]} when f == final -> Some c - | _ -> None - -let chars c succ = - let n = new_node () in - n.trans <- [c,succ]; - n - -let alt r1 r2 succ = - let nr1 = r1 succ and nr2 = r2 succ in - match is_chars succ nr1, is_chars succ nr2 with - | Some c1, Some c2 -> chars (Cset.union c1 c2) succ - | _ -> - let n = new_node () in - n.eps <- [r1 succ; r2 succ]; - n - -let rep r succ = - let n = new_node () in - n.eps <- [r n; succ]; - n - -let plus r succ = - let n = new_node () in - let nr = r n in - n.eps <- [nr; succ]; - nr - -let eps succ = succ (* eps for epsilon *) - -let compl r = - let n = new_node () in - match is_chars n (r n) with - | Some c -> - Some (chars (Cset.difference Cset.any c)) - | _ -> - None - -let pair_op f r0 r1 = (* Construct subtract or intersection *) - let n = new_node () in - let to_chars r = is_chars n (r n) in - match to_chars r0, to_chars r1 with - | Some c0, Some c1 -> - Some (chars (f c0 c1)) - | _ -> - None - -let subtract = pair_op Cset.difference - -let intersection = pair_op Cset.intersection - -let compile_re re = - let final = new_node () in - (re final, final) - -(* Determinization *) - -type state = node list - (* A state of the DFA corresponds to a set of nodes in the NFA. *) - -let rec add_node state node = - if List.memq node state then state else add_nodes (node::state) node.eps -and add_nodes state nodes = - List.fold_left add_node state nodes - - -let transition (state : state) = - (* Merge transition with the same target *) - let rec norm = function - | (c1, n1)::((c2, n2)::q as l) -> - if n1 == n2 then norm ((Cset.union c1 c2, n1)::q) - else (c1, n1)::(norm l) - | l -> l in - let t = List.concat (List.map (fun n -> n.trans) state) in - let t = norm (List.sort (fun (_, n1) (_, n2) -> n1.id - n2.id) t) in - - (* Split char sets so as to make them disjoint *) - let split (all, t) (c0, n0) = - let t = - (Cset.difference c0 all, [n0]) :: - List.map (fun (c, ns) -> (Cset.intersection c c0, n0::ns)) t @ - List.map (fun (c, ns) -> (Cset.difference c c0, ns)) t - in - Cset.union all c0, - List.filter (fun (c, _) -> not (Cset.is_empty c)) t - in - - let (_,t) = List.fold_left split (Cset.empty,[]) t in - - (* Epsilon closure of targets *) - let t = List.map (fun (c, ns) -> (c, add_nodes [] ns)) t in - - (* Canonical ordering *) - let t = Array.of_list t in - Array.sort (fun (c1, _) (c2, _) -> compare c1 c2) t; - t - -let compile rs = - let rs = Array.map compile_re rs in - let counter = ref 0 in - let states = Hashtbl.create 31 in - let states_def = Hashtbl.create 31 in - let rec aux state = - try Hashtbl.find states state - with Not_found -> - let i = !counter in - incr counter; - Hashtbl.add states state i; - let trans = transition state in - let trans = Array.map (fun (p, t) -> (p, aux t)) trans in - let finals = Array.map (fun (_, f) -> List.memq f state) rs in - Hashtbl.add states_def i (trans, finals); - i - in - let init = ref [] in - Array.iter (fun (i,_) -> init := add_node !init i) rs; - let i = aux !init in - assert(i = 0); - Array.init !counter (Hashtbl.find states_def) diff --git a/sedlex-1.99.4/src/syntax/sedlex.mli b/sedlex-1.99.4/src/syntax/sedlex.mli deleted file mode 100644 index d0e0392..0000000 --- a/sedlex-1.99.4/src/syntax/sedlex.mli +++ /dev/null @@ -1,24 +0,0 @@ -(* The package sedlex is released under the terms of an MIT-like license. *) -(* See the attached LICENSE file. *) -(* Copyright 2005, 2013 by Alain Frisch and LexiFi. *) - -type regexp - -val chars: Sedlex_cset.t -> regexp -val seq: regexp -> regexp -> regexp -val alt: regexp -> regexp -> regexp -val rep: regexp -> regexp -val plus: regexp -> regexp -val eps: regexp - -val compl: regexp -> regexp option - (* If the argument is a single [chars] regexp, returns a regexp - which matches the complement set. Otherwise returns [None]. *) -val subtract: regexp -> regexp -> regexp option - (* If each argument is a single [chars] regexp, returns a regexp - which matches the set (arg1 - arg2). Otherwise returns [None]. *) -val intersection: regexp -> regexp -> regexp option - (* If each argument is a single [chars] regexp, returns a regexp - which matches the intersection set. Otherwise returns [None]. *) - -val compile: regexp array -> ((Sedlex_cset.t * int) array * bool array) array diff --git a/sedlex-1.99.4/src/syntax/sedlex_cset.ml b/sedlex-1.99.4/src/syntax/sedlex_cset.ml deleted file mode 100755 index efad478..0000000 --- a/sedlex-1.99.4/src/syntax/sedlex_cset.ml +++ /dev/null @@ -1,399 +0,0 @@ -(* The package sedlex is released under the terms of an MIT-like license. *) -(* See the attached LICENSE file. *) -(* Copyright 2005, 2013 by Alain Frisch and LexiFi. *) - -(* Character sets are represented as lists of intervals. The - intervals must be non-overlapping and not collapsable, and the list - must be ordered in increasing order. *) - -type t = (int * int) list - -let max_code = 0x10ffff (* must be < max_int *) -let min_code = -1 - -let empty = [] -let singleton i = [i,i] -let is_empty = function [] -> true | _ -> false -let interval i j = if i <= j then [i,j] else [j,i] -let eof = singleton (-1) -let any = interval 0 max_code - -let rec union c1 c2 = - match c1,c2 with - | [], _ -> c2 - | _, [] -> c1 - | ((i1, j1) as s1)::r1, (i2, j2)::r2 -> - if (i1 <= i2) then - if j1 + 1 < i2 then s1::(union r1 c2) - else if (j1 < j2) then union r1 ((i1, j2)::r2) - else union c1 r2 - else union c2 c1 - -let complement c = - let rec aux start = function - | [] -> if start <= max_code then [start,max_code] else [] - | (i, j)::l -> (start, i-1)::(aux (succ j) l) - in - match c with - | (-1,j)::l -> aux (succ j) l - | l -> aux (-1) l - -let intersection c1 c2 = - complement (union (complement c1) (complement c2)) - -let difference c1 c2 = - complement (union (complement c1) c2) - - -(* Unicode classes from XML *) - -let base_char = - [ 0x0041,0x005A; 0x0061,0x007A; 0x00C0,0x00D6; 0x00D8,0x00F6; - 0x00F8,0x00FF; 0x0100,0x0131; 0x0134,0x013E; 0x0141,0x0148; - 0x014A,0x017E; 0x0180,0x01C3; 0x01CD,0x01F0; 0x01F4,0x01F5; - 0x01FA,0x0217; 0x0250,0x02A8; 0x02BB,0x02C1; 0x0386,0x0386; - 0x0388,0x038A; 0x038C,0x038C; 0x038E,0x03A1; 0x03A3,0x03CE; - 0x03D0,0x03D6; 0x03DA,0x03DA; 0x03DC,0x03DC; 0x03DE,0x03DE; - 0x03E0,0x03E0; 0x03E2,0x03F3; - 0x0401,0x040C; 0x040E,0x044F; 0x0451,0x045C; 0x045E,0x0481; - 0x0490,0x04C4; 0x04C7,0x04C8; 0x04CB,0x04CC; 0x04D0,0x04EB; - 0x04EE,0x04F5; 0x04F8,0x04F9; 0x0531,0x0556; 0x0559,0x0559; - 0x0561,0x0586; 0x05D0,0x05EA; 0x05F0,0x05F2; 0x0621,0x063A; - 0x0641,0x064A; 0x0671,0x06B7; 0x06BA,0x06BE; 0x06C0,0x06CE; - 0x06D0,0x06D3; 0x06D5,0x06D5; 0x06E5,0x06E6; 0x0905,0x0939; - 0x093D,0x093D; - 0x0958,0x0961; 0x0985,0x098C; 0x098F,0x0990; 0x0993,0x09A8; - 0x09AA,0x09B0; 0x09B2,0x09B2; 0x09B6,0x09B9; 0x09DC,0x09DD; - 0x09DF,0x09E1; 0x09F0,0x09F1; 0x0A05,0x0A0A; 0x0A0F,0x0A10; - 0x0A13,0x0A28; 0x0A2A,0x0A30; 0x0A32,0x0A33; 0x0A35,0x0A36; - 0x0A38,0x0A39; 0x0A59,0x0A5C; 0x0A5E,0x0A5E; 0x0A72,0x0A74; - 0x0A85,0x0A8B; 0x0A8D,0x0A8D; 0x0A8F,0x0A91; 0x0A93,0x0AA8; - 0x0AAA,0x0AB0; 0x0AB2,0x0AB3; 0x0AB5,0x0AB9; 0x0ABD,0x0ABD; - 0x0AE0,0x0AE0; - 0x0B05,0x0B0C; 0x0B0F,0x0B10; 0x0B13,0x0B28; 0x0B2A,0x0B30; - 0x0B32,0x0B33; 0x0B36,0x0B39; 0x0B3D,0x0B3D; 0x0B5C,0x0B5D; - 0x0B5F,0x0B61; 0x0B85,0x0B8A; 0x0B8E,0x0B90; 0x0B92,0x0B95; - 0x0B99,0x0B9A; 0x0B9C,0x0B9C; 0x0B9E,0x0B9F; 0x0BA3,0x0BA4; - 0x0BA8,0x0BAA; 0x0BAE,0x0BB5; 0x0BB7,0x0BB9; 0x0C05,0x0C0C; - 0x0C0E,0x0C10; 0x0C12,0x0C28; 0x0C2A,0x0C33; 0x0C35,0x0C39; - 0x0C60,0x0C61; 0x0C85,0x0C8C; 0x0C8E,0x0C90; 0x0C92,0x0CA8; - 0x0CAA,0x0CB3; 0x0CB5,0x0CB9; 0x0CDE,0x0CDE; 0x0CE0,0x0CE1; - 0x0D05,0x0D0C; 0x0D0E,0x0D10; 0x0D12,0x0D28; 0x0D2A,0x0D39; - 0x0D60,0x0D61; 0x0E01,0x0E2E; 0x0E30,0x0E30; 0x0E32,0x0E33; - 0x0E40,0x0E45; 0x0E81,0x0E82; 0x0E84,0x0E84; 0x0E87,0x0E88; - 0x0E8A,0x0E8A; - 0x0E8D,0x0E8D; 0x0E94,0x0E97; 0x0E99,0x0E9F; 0x0EA1,0x0EA3; - 0x0EA5,0x0EA5; - 0x0EA7,0x0EA7; 0x0EAA,0x0EAB; 0x0EAD,0x0EAE; 0x0EB0,0x0EB0; - 0x0EB2,0x0EB3; - 0x0EBD,0x0EBD; 0x0EC0,0x0EC4; 0x0F40,0x0F47; 0x0F49,0x0F69; - 0x10A0,0x10C5; 0x10D0,0x10F6; 0x1100,0x1100; 0x1102,0x1103; - 0x1105,0x1107; 0x1109,0x1109; 0x110B,0x110C; 0x110E,0x1112; - 0x113C,0x113C; - 0x113E,0x113E; 0x1140,0x1140; 0x114C,0x114C; 0x114E,0x114E; - 0x1150,0x1150; 0x1154,0x1155; 0x1159,0x1159; - 0x115F,0x1161; 0x1163,0x1163; 0x1165,0x1165; 0x1167,0x1167; - 0x1169,0x1169; 0x116D,0x116E; - 0x1172,0x1173; 0x1175,0x1175; 0x119E,0x119E; 0x11A8,0x11A8; - 0x11AB,0x11AB; 0x11AE,0x11AF; - 0x11B7,0x11B8; 0x11BA,0x11BA; 0x11BC,0x11C2; 0x11EB,0x11EB; - 0x11F0,0x11F0; 0x11F9,0x11F9; - 0x1E00,0x1E9B; 0x1EA0,0x1EF9; 0x1F00,0x1F15; 0x1F18,0x1F1D; - 0x1F20,0x1F45; 0x1F48,0x1F4D; 0x1F50,0x1F57; 0x1F59,0x1F59; - 0x1F5B,0x1F5B; - 0x1F5D,0x1F5D; 0x1F5F,0x1F7D; 0x1F80,0x1FB4; 0x1FB6,0x1FBC; - 0x1FBE,0x1FBE; - 0x1FC2,0x1FC4; 0x1FC6,0x1FCC; 0x1FD0,0x1FD3; 0x1FD6,0x1FDB; - 0x1FE0,0x1FEC; 0x1FF2,0x1FF4; 0x1FF6,0x1FFC; 0x2126,0x2126; - 0x212A,0x212B; 0x212E,0x212E; 0x2180,0x2182; 0x3041,0x3094; - 0x30A1,0x30FA; 0x3105,0x312C; 0xAC00,0xD7A3 ] - -let ideographic = - [ 0x3007,0x3007; 0x3021,0x3029; 0x4E00,0x9FA5 ] - -let combining_char = - [ 0x0300,0x0345; 0x0360,0x0361; 0x0483,0x0486; 0x0591,0x05A1; - 0x05A3,0x05B9; 0x05BB,0x05BD; 0x05BF,0x05BF; 0x05C1,0x05C2; - 0x05C4,0x05C4; 0x064B,0x0652; 0x0670,0x0670; 0x06D6,0x06DC; - 0x06DD,0x06DF; 0x06E0,0x06E4; 0x06E7,0x06E8; 0x06EA,0x06ED; - 0x0901,0x0903; 0x093C,0x093C; 0x093E,0x094C; 0x094D,0x094D; - 0x0951,0x0954; 0x0962,0x0963; 0x0981,0x0983; 0x09BC,0x09BC; - 0x09BE,0x09BE; 0x09BF,0x09BF; 0x09C0,0x09C4; 0x09C7,0x09C8; - 0x09CB,0x09CD; 0x09D7,0x09D7; 0x09E2,0x09E3; 0x0A02,0x0A02; - 0x0A3C,0x0A3C; 0x0A3E,0x0A3E; 0x0A3F,0x0A3F; 0x0A40,0x0A42; - 0x0A47,0x0A48; 0x0A4B,0x0A4D; 0x0A70,0x0A71; 0x0A81,0x0A83; - 0x0ABC,0x0ABC; 0x0ABE,0x0AC5; 0x0AC7,0x0AC9; 0x0ACB,0x0ACD; - 0x0B01,0x0B03; 0x0B3C,0x0B3C; 0x0B3E,0x0B43; 0x0B47,0x0B48; - 0x0B4B,0x0B4D; 0x0B56,0x0B57; 0x0B82,0x0B83; 0x0BBE,0x0BC2; - 0x0BC6,0x0BC8; 0x0BCA,0x0BCD; 0x0BD7,0x0BD7; 0x0C01,0x0C03; - 0x0C3E,0x0C44; 0x0C46,0x0C48; 0x0C4A,0x0C4D; 0x0C55,0x0C56; - 0x0C82,0x0C83; 0x0CBE,0x0CC4; 0x0CC6,0x0CC8; 0x0CCA,0x0CCD; - 0x0CD5,0x0CD6; 0x0D02,0x0D03; 0x0D3E,0x0D43; 0x0D46,0x0D48; - 0x0D4A,0x0D4D; 0x0D57,0x0D57; 0x0E31,0x0E31; 0x0E34,0x0E3A; - 0x0E47,0x0E4E; 0x0EB1,0x0EB1; 0x0EB4,0x0EB9; 0x0EBB,0x0EBC; - 0x0EC8,0x0ECD; 0x0F18,0x0F19; 0x0F35,0x0F35; 0x0F37,0x0F37; - 0x0F39,0x0F39; 0x0F3E,0x0F3E; 0x0F3F,0x0F3F; 0x0F71,0x0F84; - 0x0F86,0x0F8B; 0x0F90,0x0F95; 0x0F97,0x0F97; 0x0F99,0x0FAD; - 0x0FB1,0x0FB7; 0x0FB9,0x0FB9; 0x20D0,0x20DC; 0x20E1,0x20E1; - 0x302A,0x302F; 0x3099,0x3099; 0x309A,0x309A ] - -let digit = - [ 0x0030,0x0039; - 0x0660,0x0669; 0x06F0,0x06F9; 0x0966,0x096F; 0x09E6,0x09EF; - 0x0A66,0x0A6F; 0x0AE6,0x0AEF; 0x0B66,0x0B6F; 0x0BE7,0x0BEF; - 0x0C66,0x0C6F; 0x0CE6,0x0CEF; 0x0D66,0x0D6F; 0x0E50,0x0E59; - 0x0ED0,0x0ED9; 0x0F20,0x0F29 ] - -let extender = - [ 0x00B7,0x00B7; 0x02D0,0x02D1; 0x0387,0x0387; 0x0640,0x0640; - 0x0E46,0x0E46; 0x0EC6,0x0EC6; 0x3005,0x3005; 0x3031,0x3035; - 0x309D,0x309E; 0x30FC,0x30FE ] - -let blank = - [ 0x0009,0x000A; 0x000D,0x000D; 0x0020,0x0020 ] - -let letter = union base_char ideographic - - -(* Letters to be used in identifiers, as specified - by ISO .... - Data provided by John M. Skaller *) -let tr8876_ident_char = [ - (* ASCII *) - (0x0041,0x005a); - (0x0061,0x007a); - - (* Latin *) - (0x00c0,0x00d6); - (0x00d8,0x00f6); - (0x00f8,0x01f5); - (0x01fa,0x0217); - (0x0250,0x02a8); - - (* Greek *) - (0x0384,0x0384); - (0x0388,0x038a); - (0x038c,0x038c); - (0x038e,0x03a1); - (0x03a3,0x03ce); - (0x03d0,0x03d6); - (0x03da,0x03da); - (0x03dc,0x03dc); - (0x03de,0x03de); - (0x03e0,0x03e0); - (0x03e2,0x03f3); - - (* Cyrillic *) - (0x0401,0x040d); - (0x040f,0x044f); - (0x0451,0x045c); - (0x045e,0x0481); - (0x0490,0x04c4); - (0x04c7,0x04c4); - (0x04cb,0x04cc); - (0x04d0,0x04eb); - (0x04ee,0x04f5); - (0x04f8,0x04f9); - - (* Armenian *) - (0x0531,0x0556); - (0x0561,0x0587); - (0x04d0,0x04eb); - - (* Hebrew *) - (0x05d0,0x05ea); - (0x05f0,0x05f4); - - (* Arabic *) - (0x0621,0x063a); - (0x0640,0x0652); - (0x0670,0x06b7); - (0x06ba,0x06be); - (0x06c0,0x06ce); - (0x06e5,0x06e7); - - (* Devanagari *) - (0x0905,0x0939); - (0x0958,0x0962); - - (* Bengali *) - (0x0985,0x098c); - (0x098f,0x0990); - (0x0993,0x09a8); - (0x09aa,0x09b0); - (0x09b2,0x09b2); - (0x09b6,0x09b9); - (0x09dc,0x09dd); - (0x09df,0x09e1); - (0x09f0,0x09f1); - - (* Gurmukhi *) - (0x0a05,0x0a0a); - (0x0a0f,0x0a10); - (0x0a13,0x0a28); - (0x0a2a,0x0a30); - (0x0a32,0x0a33); - (0x0a35,0x0a36); - (0x0a38,0x0a39); - (0x0a59,0x0a5c); - (0x0a5e,0x0a5e); - - (* Gunjarati *) - (0x0a85,0x0a8b); - (0x0a8d,0x0a8d); - (0x0a8f,0x0a91); - (0x0a93,0x0aa8); - (0x0aaa,0x0ab0); - (0x0ab2,0x0ab3); - (0x0ab5,0x0ab9); - (0x0ae0,0x0ae0); - - (* Oriya *) - (0x0b05,0x0b0c); - (0x0b0f,0x0b10); - (0x0b13,0x0b28); - (0x0b2a,0x0b30); - (0x0b32,0x0b33); - (0x0b36,0x0b39); - (0x0b5c,0x0b5d); - (0x0b5f,0x0b61); - - (* Tamil *) - (0x0b85,0x0b8a); - (0x0b8e,0x0b90); - (0x0b92,0x0b95); - (0x0b99,0x0b9a); - (0x0b9c,0x0b9c); - (0x0b9e,0x0b9f); - (0x0ba3,0x0ba4); - (0x0ba8,0x0baa); - (0x0bae,0x0bb5); - (0x0bb7,0x0bb9); - - (* Telugu *) - (0x0c05,0x0c0c); - (0x0c0e,0x0c10); - (0x0c12,0x0c28); - (0x0c2a,0x0c33); - (0x0c35,0x0c39); - (0x0c60,0x0c61); - - (* Kannada *) - (0x0c85,0x0c8c); - (0x0c8e,0x0c90); - (0x0c92,0x0ca8); - (0x0caa,0x0cb3); - (0x0cb5,0x0cb9); - (0x0ce0,0x0ce1); - - (* Malayam *) - (0x0d05,0x0d0c); - (0x0d0e,0x0d10); - (0x0d12,0x0d28); - (0x0d2a,0x0d39); - (0x0d60,0x0d61); - - (* Thai *) - (0x0e01,0x0e30); - (0x0e32,0x0e33); - (0x0e40,0x0e46); - (0x0e4f,0x0e5b); - - (* Lao *) - (0x0e81,0x0e82); - (0x0e84,0x0e84); - (0x0e87,0x0e88); - (0x0e8a,0x0e8a); - (0x0e0d,0x0e0d); - (0x0e94,0x0e97); - (0x0e99,0x0e9f); - (0x0ea1,0x0ea3); - (0x0ea5,0x0ea5); - (0x0ea7,0x0ea7); - (0x0eaa,0x0eab); - (0x0ead,0x0eb0); - (0x0eb2,0x0eb3); - (0x0ebd,0x0ebd); - (0x0ec0,0x0ec4); - (0x0ec6,0x0ec6); - - (* Georgian *) - (0x10a0,0x10c5); - (0x10d0,0x10f6); - - (* Hangul Jamo *) - (0x1100,0x1159); - (0x1161,0x11a2); - (0x11a8,0x11f9); - (0x11d0,0x11f6); - - (* Latin extensions *) - (0x1e00,0x1e9a); - (0x1ea0,0x1ef9); - - (* Greek extended *) - (0x1f00,0x1f15); - (0x1f18,0x1f1d); - (0x1f20,0x1f45); - (0x1f48,0x1f4d); - (0x1f50,0x1f57); - (0x1f59,0x1f59); - (0x1f5b,0x1f5b); - (0x1f5d,0x1f5d); - (0x1f5f,0x1f7d); - (0x1f80,0x1fb4); - (0x1fb6,0x1fbc); - (0x1fc2,0x1fc4); - (0x1fc6,0x1fcc); - (0x1fd0,0x1fd3); - (0x1fd6,0x1fdb); - (0x1fe0,0x1fec); - (0x1ff2,0x1ff4); - (0x1ff6,0x1ffc); - - - (* Hiragana *) - (0x3041,0x3094); - (0x309b,0x309e); - - (* Katakana *) - (0x30a1,0x30fe); - - (* Bopmofo *) - (0x3105,0x312c); - - (* CJK Unified Ideographs *) - (0x4e00,0x9fa5); - - (* CJK Compatibility Ideographs *) - (0xf900,0xfa2d); - - (* Arabic Presentation Forms *) - (0xfb1f,0xfb36); - (0xfb38,0xfb3c); - (0xfb3e,0xfb3e); - (0xfb40,0xfb41); - (0xfb42,0xfb44); - (0xfb46,0xfbb1); - (0xfbd3,0xfd35); - - (* Arabic Presentation Forms-A *) - (0xfd50,0xfd85); - (0xfd92,0xfbc7); - (0xfdf0,0xfdfb); - - (* Arabic Presentation Forms-B *) - (0xfe70,0xfe72); - (0xfe74,0xfe74); - (0xfe76,0xfefc); - - (* Half width and Fullwidth Forms *) - (0xff21,0xff3a); - (0xff41,0xff5a); - (0xff66,0xffbe); - (0xffc2,0xffc7); - (0xffca,0xffcf); - (0xffd2,0xffd7); - (0xffd2,0xffd7); - (0xffda,0xffdc) -] diff --git a/sedlex-1.99.4/src/syntax/sedlex_cset.mli b/sedlex-1.99.4/src/syntax/sedlex_cset.mli deleted file mode 100644 index 5b9e53f..0000000 --- a/sedlex-1.99.4/src/syntax/sedlex_cset.mli +++ /dev/null @@ -1,30 +0,0 @@ -(* The package sedlex is released under the terms of an MIT-like license. *) -(* See the attached LICENSE file. *) -(* Copyright 2005, 2013 by Alain Frisch and LexiFi. *) - -(** Representation of sets of unicode code points. *) - -type t = (int * int) list - -val min_code: int -val max_code: int - -val empty: t -val any: t -val union: t -> t -> t -val difference: t -> t -> t -val intersection: t -> t -> t -val is_empty: t -> bool -val eof: t -val singleton: int -> t -val interval: int -> int -> t - -val letter: t -val digit: t -val extender: t -val base_char: t -val ideographic: t -val combining_char: t -val blank: t -val tr8876_ident_char: t - diff --git a/sedlex-1.99.4/src/syntax/unicode63.ml b/sedlex-1.99.4/src/syntax/unicode63.ml deleted file mode 100644 index 262b556..0000000 --- a/sedlex-1.99.4/src/syntax/unicode63.ml +++ /dev/null @@ -1,1869 +0,0 @@ -module Categories = struct - - let cc = [0000, 0x1f; 0x7f, 0x9f] - - let cf = - [0xad, 0xad; 0x600, 0x604; 0x61c, 0x61c; 0x6dd, 0x6dd; 0x70f, 0x70f; - 0x180e, 0x180e; 0x200b, 0x200f; 0x202a, 0x202e; 0x2060, 0x2064; - 0x2066, 0x206f; 0xfeff, 0xfeff; 0xfff9, 0xfffb; 0x110bd, 0x110bd; - 0x1d173, 0x1d17a; 0xe0001, 0xe0001; 0xe0020, 0xe007f] - - let cn = - [0x378, 0x379; 0x37f, 0x383; 0x38b, 0x38b; 0x38d, 0x38d; 0x3a2, 0x3a2; - 0x528, 0x530; 0x557, 0x558; 0x560, 0x560; 0x588, 0x588; 0x58b, 0x58e; - 0x590, 0x590; 0x5c8, 0x5cf; 0x5eb, 0x5ef; 0x5f5, 0x5ff; 0x605, 0x605; - 0x61d, 0x61d; 0x70e, 0x70e; 0x74b, 0x74c; 0x7b2, 0x7bf; 0x7fb, 0x7ff; - 0x82e, 0x82f; 0x83f, 0x83f; 0x85c, 0x85d; 0x85f, 0x89f; 0x8a1, 0x8a1; - 0x8ad, 0x8e3; 0x8ff, 0x8ff; 0x978, 0x978; 0x980, 0x980; 0x984, 0x984; - 0x98d, 0x98e; 0x991, 0x992; 0x9a9, 0x9a9; 0x9b1, 0x9b1; 0x9b3, 0x9b5; - 0x9ba, 0x9bb; 0x9c5, 0x9c6; 0x9c9, 0x9ca; 0x9cf, 0x9d6; 0x9d8, 0x9db; - 0x9de, 0x9de; 0x9e4, 0x9e5; 0x9fc, 0xa00; 0xa04, 0xa04; 0xa0b, 0xa0e; - 0xa11, 0xa12; 0xa29, 0xa29; 0xa31, 0xa31; 0xa34, 0xa34; 0xa37, 0xa37; - 0xa3a, 0xa3b; 0xa3d, 0xa3d; 0xa43, 0xa46; 0xa49, 0xa4a; 0xa4e, 0xa50; - 0xa52, 0xa58; 0xa5d, 0xa5d; 0xa5f, 0xa65; 0xa76, 0xa80; 0xa84, 0xa84; - 0xa8e, 0xa8e; 0xa92, 0xa92; 0xaa9, 0xaa9; 0xab1, 0xab1; 0xab4, 0xab4; - 0xaba, 0xabb; 0xac6, 0xac6; 0xaca, 0xaca; 0xace, 0xacf; 0xad1, 0xadf; - 0xae4, 0xae5; 0xaf2, 0xb00; 0xb04, 0xb04; 0xb0d, 0xb0e; 0xb11, 0xb12; - 0xb29, 0xb29; 0xb31, 0xb31; 0xb34, 0xb34; 0xb3a, 0xb3b; 0xb45, 0xb46; - 0xb49, 0xb4a; 0xb4e, 0xb55; 0xb58, 0xb5b; 0xb5e, 0xb5e; 0xb64, 0xb65; - 0xb78, 0xb81; 0xb84, 0xb84; 0xb8b, 0xb8d; 0xb91, 0xb91; 0xb96, 0xb98; - 0xb9b, 0xb9b; 0xb9d, 0xb9d; 0xba0, 0xba2; 0xba5, 0xba7; 0xbab, 0xbad; - 0xbba, 0xbbd; 0xbc3, 0xbc5; 0xbc9, 0xbc9; 0xbce, 0xbcf; 0xbd1, 0xbd6; - 0xbd8, 0xbe5; 0xbfb, 0xc00; 0xc04, 0xc04; 0xc0d, 0xc0d; 0xc11, 0xc11; - 0xc29, 0xc29; 0xc34, 0xc34; 0xc3a, 0xc3c; 0xc45, 0xc45; 0xc49, 0xc49; - 0xc4e, 0xc54; 0xc57, 0xc57; 0xc5a, 0xc5f; 0xc64, 0xc65; 0xc70, 0xc77; - 0xc80, 0xc81; 0xc84, 0xc84; 0xc8d, 0xc8d; 0xc91, 0xc91; 0xca9, 0xca9; - 0xcb4, 0xcb4; 0xcba, 0xcbb; 0xcc5, 0xcc5; 0xcc9, 0xcc9; 0xcce, 0xcd4; - 0xcd7, 0xcdd; 0xcdf, 0xcdf; 0xce4, 0xce5; 0xcf0, 0xcf0; 0xcf3, 0xd01; - 0xd04, 0xd04; 0xd0d, 0xd0d; 0xd11, 0xd11; 0xd3b, 0xd3c; 0xd45, 0xd45; - 0xd49, 0xd49; 0xd4f, 0xd56; 0xd58, 0xd5f; 0xd64, 0xd65; 0xd76, 0xd78; - 0xd80, 0xd81; 0xd84, 0xd84; 0xd97, 0xd99; 0xdb2, 0xdb2; 0xdbc, 0xdbc; - 0xdbe, 0xdbf; 0xdc7, 0xdc9; 0xdcb, 0xdce; 0xdd5, 0xdd5; 0xdd7, 0xdd7; - 0xde0, 0xdf1; 0xdf5, 0xe00; 0xe3b, 0xe3e; 0xe5c, 0xe80; 0xe83, 0xe83; - 0xe85, 0xe86; 0xe89, 0xe89; 0xe8b, 0xe8c; 0xe8e, 0xe93; 0xe98, 0xe98; - 0xea0, 0xea0; 0xea4, 0xea4; 0xea6, 0xea6; 0xea8, 0xea9; 0xeac, 0xeac; - 0xeba, 0xeba; 0xebe, 0xebf; 0xec5, 0xec5; 0xec7, 0xec7; 0xece, 0xecf; - 0xeda, 0xedb; 0xee0, 0xeff; 0xf48, 0xf48; 0xf6d, 0xf70; 0xf98, 0xf98; - 0xfbd, 0xfbd; 0xfcd, 0xfcd; 0xfdb, 0xfff; 0x10c6, 0x10c6; 0x10c8, 0x10cc; - 0x10ce, 0x10cf; 0x1249, 0x1249; 0x124e, 0x124f; 0x1257, 0x1257; - 0x1259, 0x1259; 0x125e, 0x125f; 0x1289, 0x1289; 0x128e, 0x128f; - 0x12b1, 0x12b1; 0x12b6, 0x12b7; 0x12bf, 0x12bf; 0x12c1, 0x12c1; - 0x12c6, 0x12c7; 0x12d7, 0x12d7; 0x1311, 0x1311; 0x1316, 0x1317; - 0x135b, 0x135c; 0x137d, 0x137f; 0x139a, 0x139f; 0x13f5, 0x13ff; - 0x169d, 0x169f; 0x16f1, 0x16ff; 0x170d, 0x170d; 0x1715, 0x171f; - 0x1737, 0x173f; 0x1754, 0x175f; 0x176d, 0x176d; 0x1771, 0x1771; - 0x1774, 0x177f; 0x17de, 0x17df; 0x17ea, 0x17ef; 0x17fa, 0x17ff; - 0x180f, 0x180f; 0x181a, 0x181f; 0x1878, 0x187f; 0x18ab, 0x18af; - 0x18f6, 0x18ff; 0x191d, 0x191f; 0x192c, 0x192f; 0x193c, 0x193f; - 0x1941, 0x1943; 0x196e, 0x196f; 0x1975, 0x197f; 0x19ac, 0x19af; - 0x19ca, 0x19cf; 0x19db, 0x19dd; 0x1a1c, 0x1a1d; 0x1a5f, 0x1a5f; - 0x1a7d, 0x1a7e; 0x1a8a, 0x1a8f; 0x1a9a, 0x1a9f; 0x1aae, 0x1aff; - 0x1b4c, 0x1b4f; 0x1b7d, 0x1b7f; 0x1bf4, 0x1bfb; 0x1c38, 0x1c3a; - 0x1c4a, 0x1c4c; 0x1c80, 0x1cbf; 0x1cc8, 0x1ccf; 0x1cf7, 0x1cff; - 0x1de7, 0x1dfb; 0x1f16, 0x1f17; 0x1f1e, 0x1f1f; 0x1f46, 0x1f47; - 0x1f4e, 0x1f4f; 0x1f58, 0x1f58; 0x1f5a, 0x1f5a; 0x1f5c, 0x1f5c; - 0x1f5e, 0x1f5e; 0x1f7e, 0x1f7f; 0x1fb5, 0x1fb5; 0x1fc5, 0x1fc5; - 0x1fd4, 0x1fd5; 0x1fdc, 0x1fdc; 0x1ff0, 0x1ff1; 0x1ff5, 0x1ff5; - 0x1fff, 0x1fff; 0x2065, 0x2065; 0x2072, 0x2073; 0x208f, 0x208f; - 0x209d, 0x209f; 0x20bb, 0x20cf; 0x20f1, 0x20ff; 0x218a, 0x218f; - 0x23f4, 0x23ff; 0x2427, 0x243f; 0x244b, 0x245f; 0x2700, 0x2700; - 0x2b4d, 0x2b4f; 0x2b5a, 0x2bff; 0x2c2f, 0x2c2f; 0x2c5f, 0x2c5f; - 0x2cf4, 0x2cf8; 0x2d26, 0x2d26; 0x2d28, 0x2d2c; 0x2d2e, 0x2d2f; - 0x2d68, 0x2d6e; 0x2d71, 0x2d7e; 0x2d97, 0x2d9f; 0x2da7, 0x2da7; - 0x2daf, 0x2daf; 0x2db7, 0x2db7; 0x2dbf, 0x2dbf; 0x2dc7, 0x2dc7; - 0x2dcf, 0x2dcf; 0x2dd7, 0x2dd7; 0x2ddf, 0x2ddf; 0x2e3c, 0x2e7f; - 0x2e9a, 0x2e9a; 0x2ef4, 0x2eff; 0x2fd6, 0x2fef; 0x2ffc, 0x2fff; - 0x3040, 0x3040; 0x3097, 0x3098; 0x3100, 0x3104; 0x312e, 0x3130; - 0x318f, 0x318f; 0x31bb, 0x31bf; 0x31e4, 0x31ef; 0x321f, 0x321f; - 0x32ff, 0x32ff; 0x4db6, 0x4dbf; 0x9fcd, 0x9fff; 0xa48d, 0xa48f; - 0xa4c7, 0xa4cf; 0xa62c, 0xa63f; 0xa698, 0xa69e; 0xa6f8, 0xa6ff; - 0xa78f, 0xa78f; 0xa794, 0xa79f; 0xa7ab, 0xa7f7; 0xa82c, 0xa82f; - 0xa83a, 0xa83f; 0xa878, 0xa87f; 0xa8c5, 0xa8cd; 0xa8da, 0xa8df; - 0xa8fc, 0xa8ff; 0xa954, 0xa95e; 0xa97d, 0xa97f; 0xa9ce, 0xa9ce; - 0xa9da, 0xa9dd; 0xa9e0, 0xa9ff; 0xaa37, 0xaa3f; 0xaa4e, 0xaa4f; - 0xaa5a, 0xaa5b; 0xaa7c, 0xaa7f; 0xaac3, 0xaada; 0xaaf7, 0xab00; - 0xab07, 0xab08; 0xab0f, 0xab10; 0xab17, 0xab1f; 0xab27, 0xab27; - 0xab2f, 0xabbf; 0xabee, 0xabef; 0xabfa, 0xabff; 0xd7a4, 0xd7af; - 0xd7c7, 0xd7ca; 0xd7fc, 0xd7ff; 0xfa6e, 0xfa6f; 0xfada, 0xfaff; - 0xfb07, 0xfb12; 0xfb18, 0xfb1c; 0xfb37, 0xfb37; 0xfb3d, 0xfb3d; - 0xfb3f, 0xfb3f; 0xfb42, 0xfb42; 0xfb45, 0xfb45; 0xfbc2, 0xfbd2; - 0xfd40, 0xfd4f; 0xfd90, 0xfd91; 0xfdc8, 0xfdef; 0xfdfe, 0xfdff; - 0xfe1a, 0xfe1f; 0xfe27, 0xfe2f; 0xfe53, 0xfe53; 0xfe67, 0xfe67; - 0xfe6c, 0xfe6f; 0xfe75, 0xfe75; 0xfefd, 0xfefe; 0xff00, 0xff00; - 0xffbf, 0xffc1; 0xffc8, 0xffc9; 0xffd0, 0xffd1; 0xffd8, 0xffd9; - 0xffdd, 0xffdf; 0xffe7, 0xffe7; 0xffef, 0xfff8; 0xfffe, 0xffff; - 0x1000c, 0x1000c; 0x10027, 0x10027; 0x1003b, 0x1003b; 0x1003e, 0x1003e; - 0x1004e, 0x1004f; 0x1005e, 0x1007f; 0x100fb, 0x100ff; 0x10103, 0x10106; - 0x10134, 0x10136; 0x1018b, 0x1018f; 0x1019c, 0x101cf; 0x101fe, 0x1027f; - 0x1029d, 0x1029f; 0x102d1, 0x102ff; 0x1031f, 0x1031f; 0x10324, 0x1032f; - 0x1034b, 0x1037f; 0x1039e, 0x1039e; 0x103c4, 0x103c7; 0x103d6, 0x103ff; - 0x1049e, 0x1049f; 0x104aa, 0x107ff; 0x10806, 0x10807; 0x10809, 0x10809; - 0x10836, 0x10836; 0x10839, 0x1083b; 0x1083d, 0x1083e; 0x10856, 0x10856; - 0x10860, 0x108ff; 0x1091c, 0x1091e; 0x1093a, 0x1093e; 0x10940, 0x1097f; - 0x109b8, 0x109bd; 0x109c0, 0x109ff; 0x10a04, 0x10a04; 0x10a07, 0x10a0b; - 0x10a14, 0x10a14; 0x10a18, 0x10a18; 0x10a34, 0x10a37; 0x10a3b, 0x10a3e; - 0x10a48, 0x10a4f; 0x10a59, 0x10a5f; 0x10a80, 0x10aff; 0x10b36, 0x10b38; - 0x10b56, 0x10b57; 0x10b73, 0x10b77; 0x10b80, 0x10bff; 0x10c49, 0x10e5f; - 0x10e7f, 0x10fff; 0x1104e, 0x11051; 0x11070, 0x1107f; 0x110c2, 0x110cf; - 0x110e9, 0x110ef; 0x110fa, 0x110ff; 0x11135, 0x11135; 0x11144, 0x1117f; - 0x111c9, 0x111cf; 0x111da, 0x1167f; 0x116b8, 0x116bf; 0x116ca, 0x11fff; - 0x1236f, 0x123ff; 0x12463, 0x1246f; 0x12474, 0x12fff; 0x1342f, 0x167ff; - 0x16a39, 0x16eff; 0x16f45, 0x16f4f; 0x16f7f, 0x16f8e; 0x16fa0, 0x1afff; - 0x1b002, 0x1cfff; 0x1d0f6, 0x1d0ff; 0x1d127, 0x1d128; 0x1d1de, 0x1d1ff; - 0x1d246, 0x1d2ff; 0x1d357, 0x1d35f; 0x1d372, 0x1d3ff; 0x1d455, 0x1d455; - 0x1d49d, 0x1d49d; 0x1d4a0, 0x1d4a1; 0x1d4a3, 0x1d4a4; 0x1d4a7, 0x1d4a8; - 0x1d4ad, 0x1d4ad; 0x1d4ba, 0x1d4ba; 0x1d4bc, 0x1d4bc; 0x1d4c4, 0x1d4c4; - 0x1d506, 0x1d506; 0x1d50b, 0x1d50c; 0x1d515, 0x1d515; 0x1d51d, 0x1d51d; - 0x1d53a, 0x1d53a; 0x1d53f, 0x1d53f; 0x1d545, 0x1d545; 0x1d547, 0x1d549; - 0x1d551, 0x1d551; 0x1d6a6, 0x1d6a7; 0x1d7cc, 0x1d7cd; 0x1d800, 0x1edff; - 0x1ee04, 0x1ee04; 0x1ee20, 0x1ee20; 0x1ee23, 0x1ee23; 0x1ee25, 0x1ee26; - 0x1ee28, 0x1ee28; 0x1ee33, 0x1ee33; 0x1ee38, 0x1ee38; 0x1ee3a, 0x1ee3a; - 0x1ee3c, 0x1ee41; 0x1ee43, 0x1ee46; 0x1ee48, 0x1ee48; 0x1ee4a, 0x1ee4a; - 0x1ee4c, 0x1ee4c; 0x1ee50, 0x1ee50; 0x1ee53, 0x1ee53; 0x1ee55, 0x1ee56; - 0x1ee58, 0x1ee58; 0x1ee5a, 0x1ee5a; 0x1ee5c, 0x1ee5c; 0x1ee5e, 0x1ee5e; - 0x1ee60, 0x1ee60; 0x1ee63, 0x1ee63; 0x1ee65, 0x1ee66; 0x1ee6b, 0x1ee6b; - 0x1ee73, 0x1ee73; 0x1ee78, 0x1ee78; 0x1ee7d, 0x1ee7d; 0x1ee7f, 0x1ee7f; - 0x1ee8a, 0x1ee8a; 0x1ee9c, 0x1eea0; 0x1eea4, 0x1eea4; 0x1eeaa, 0x1eeaa; - 0x1eebc, 0x1eeef; 0x1eef2, 0x1efff; 0x1f02c, 0x1f02f; 0x1f094, 0x1f09f; - 0x1f0af, 0x1f0b0; 0x1f0bf, 0x1f0c0; 0x1f0d0, 0x1f0d0; 0x1f0e0, 0x1f0ff; - 0x1f10b, 0x1f10f; 0x1f12f, 0x1f12f; 0x1f16c, 0x1f16f; 0x1f19b, 0x1f1e5; - 0x1f203, 0x1f20f; 0x1f23b, 0x1f23f; 0x1f249, 0x1f24f; 0x1f252, 0x1f2ff; - 0x1f321, 0x1f32f; 0x1f336, 0x1f336; 0x1f37d, 0x1f37f; 0x1f394, 0x1f39f; - 0x1f3c5, 0x1f3c5; 0x1f3cb, 0x1f3df; 0x1f3f1, 0x1f3ff; 0x1f43f, 0x1f43f; - 0x1f441, 0x1f441; 0x1f4f8, 0x1f4f8; 0x1f4fd, 0x1f4ff; 0x1f53e, 0x1f53f; - 0x1f544, 0x1f54f; 0x1f568, 0x1f5fa; 0x1f641, 0x1f644; 0x1f650, 0x1f67f; - 0x1f6c6, 0x1f6ff; 0x1f774, 0x1ffff; 0x2a6d7, 0x2a6ff; 0x2b735, 0x2b73f; - 0x2b81e, 0x2f7ff; 0x2fa1e, 0xe0000; 0xe0002, 0xe001f; 0xe0080, 0xe00ff; - 0xe01f0, 0xeffff; 0xffffe, 0xfffff; 0x10fffe, 0x10ffff] - - let co = [0xe000, 0xf8ff; 0xf0000, 0xffffd; 0x100000, 0x10fffd] - - let cs = [0xd800, 0xdfff] - - let ll = - [0x61, 0x7a; 0xb5, 0xb5; 0xdf, 0xf6; 0xf8, 0xff; 0x101, 0x101; - 0x103, 0x103; 0x105, 0x105; 0x107, 0x107; 0x109, 0x109; 0x10b, 0x10b; - 0x10d, 0x10d; 0x10f, 0x10f; 0x111, 0x111; 0x113, 0x113; 0x115, 0x115; - 0x117, 0x117; 0x119, 0x119; 0x11b, 0x11b; 0x11d, 0x11d; 0x11f, 0x11f; - 0x121, 0x121; 0x123, 0x123; 0x125, 0x125; 0x127, 0x127; 0x129, 0x129; - 0x12b, 0x12b; 0x12d, 0x12d; 0x12f, 0x12f; 0x131, 0x131; 0x133, 0x133; - 0x135, 0x135; 0x137, 0x138; 0x13a, 0x13a; 0x13c, 0x13c; 0x13e, 0x13e; - 0x140, 0x140; 0x142, 0x142; 0x144, 0x144; 0x146, 0x146; 0x148, 0x149; - 0x14b, 0x14b; 0x14d, 0x14d; 0x14f, 0x14f; 0x151, 0x151; 0x153, 0x153; - 0x155, 0x155; 0x157, 0x157; 0x159, 0x159; 0x15b, 0x15b; 0x15d, 0x15d; - 0x15f, 0x15f; 0x161, 0x161; 0x163, 0x163; 0x165, 0x165; 0x167, 0x167; - 0x169, 0x169; 0x16b, 0x16b; 0x16d, 0x16d; 0x16f, 0x16f; 0x171, 0x171; - 0x173, 0x173; 0x175, 0x175; 0x177, 0x177; 0x17a, 0x17a; 0x17c, 0x17c; - 0x17e, 0x180; 0x183, 0x183; 0x185, 0x185; 0x188, 0x188; 0x18c, 0x18d; - 0x192, 0x192; 0x195, 0x195; 0x199, 0x19b; 0x19e, 0x19e; 0x1a1, 0x1a1; - 0x1a3, 0x1a3; 0x1a5, 0x1a5; 0x1a8, 0x1a8; 0x1aa, 0x1ab; 0x1ad, 0x1ad; - 0x1b0, 0x1b0; 0x1b4, 0x1b4; 0x1b6, 0x1b6; 0x1b9, 0x1ba; 0x1bd, 0x1bf; - 0x1c6, 0x1c6; 0x1c9, 0x1c9; 0x1cc, 0x1cc; 0x1ce, 0x1ce; 0x1d0, 0x1d0; - 0x1d2, 0x1d2; 0x1d4, 0x1d4; 0x1d6, 0x1d6; 0x1d8, 0x1d8; 0x1da, 0x1da; - 0x1dc, 0x1dd; 0x1df, 0x1df; 0x1e1, 0x1e1; 0x1e3, 0x1e3; 0x1e5, 0x1e5; - 0x1e7, 0x1e7; 0x1e9, 0x1e9; 0x1eb, 0x1eb; 0x1ed, 0x1ed; 0x1ef, 0x1f0; - 0x1f3, 0x1f3; 0x1f5, 0x1f5; 0x1f9, 0x1f9; 0x1fb, 0x1fb; 0x1fd, 0x1fd; - 0x1ff, 0x1ff; 0x201, 0x201; 0x203, 0x203; 0x205, 0x205; 0x207, 0x207; - 0x209, 0x209; 0x20b, 0x20b; 0x20d, 0x20d; 0x20f, 0x20f; 0x211, 0x211; - 0x213, 0x213; 0x215, 0x215; 0x217, 0x217; 0x219, 0x219; 0x21b, 0x21b; - 0x21d, 0x21d; 0x21f, 0x21f; 0x221, 0x221; 0x223, 0x223; 0x225, 0x225; - 0x227, 0x227; 0x229, 0x229; 0x22b, 0x22b; 0x22d, 0x22d; 0x22f, 0x22f; - 0x231, 0x231; 0x233, 0x239; 0x23c, 0x23c; 0x23f, 0x240; 0x242, 0x242; - 0x247, 0x247; 0x249, 0x249; 0x24b, 0x24b; 0x24d, 0x24d; 0x24f, 0x293; - 0x295, 0x2af; 0x371, 0x371; 0x373, 0x373; 0x377, 0x377; 0x37b, 0x37d; - 0x390, 0x390; 0x3ac, 0x3ce; 0x3d0, 0x3d1; 0x3d5, 0x3d7; 0x3d9, 0x3d9; - 0x3db, 0x3db; 0x3dd, 0x3dd; 0x3df, 0x3df; 0x3e1, 0x3e1; 0x3e3, 0x3e3; - 0x3e5, 0x3e5; 0x3e7, 0x3e7; 0x3e9, 0x3e9; 0x3eb, 0x3eb; 0x3ed, 0x3ed; - 0x3ef, 0x3f3; 0x3f5, 0x3f5; 0x3f8, 0x3f8; 0x3fb, 0x3fc; 0x430, 0x45f; - 0x461, 0x461; 0x463, 0x463; 0x465, 0x465; 0x467, 0x467; 0x469, 0x469; - 0x46b, 0x46b; 0x46d, 0x46d; 0x46f, 0x46f; 0x471, 0x471; 0x473, 0x473; - 0x475, 0x475; 0x477, 0x477; 0x479, 0x479; 0x47b, 0x47b; 0x47d, 0x47d; - 0x47f, 0x47f; 0x481, 0x481; 0x48b, 0x48b; 0x48d, 0x48d; 0x48f, 0x48f; - 0x491, 0x491; 0x493, 0x493; 0x495, 0x495; 0x497, 0x497; 0x499, 0x499; - 0x49b, 0x49b; 0x49d, 0x49d; 0x49f, 0x49f; 0x4a1, 0x4a1; 0x4a3, 0x4a3; - 0x4a5, 0x4a5; 0x4a7, 0x4a7; 0x4a9, 0x4a9; 0x4ab, 0x4ab; 0x4ad, 0x4ad; - 0x4af, 0x4af; 0x4b1, 0x4b1; 0x4b3, 0x4b3; 0x4b5, 0x4b5; 0x4b7, 0x4b7; - 0x4b9, 0x4b9; 0x4bb, 0x4bb; 0x4bd, 0x4bd; 0x4bf, 0x4bf; 0x4c2, 0x4c2; - 0x4c4, 0x4c4; 0x4c6, 0x4c6; 0x4c8, 0x4c8; 0x4ca, 0x4ca; 0x4cc, 0x4cc; - 0x4ce, 0x4cf; 0x4d1, 0x4d1; 0x4d3, 0x4d3; 0x4d5, 0x4d5; 0x4d7, 0x4d7; - 0x4d9, 0x4d9; 0x4db, 0x4db; 0x4dd, 0x4dd; 0x4df, 0x4df; 0x4e1, 0x4e1; - 0x4e3, 0x4e3; 0x4e5, 0x4e5; 0x4e7, 0x4e7; 0x4e9, 0x4e9; 0x4eb, 0x4eb; - 0x4ed, 0x4ed; 0x4ef, 0x4ef; 0x4f1, 0x4f1; 0x4f3, 0x4f3; 0x4f5, 0x4f5; - 0x4f7, 0x4f7; 0x4f9, 0x4f9; 0x4fb, 0x4fb; 0x4fd, 0x4fd; 0x4ff, 0x4ff; - 0x501, 0x501; 0x503, 0x503; 0x505, 0x505; 0x507, 0x507; 0x509, 0x509; - 0x50b, 0x50b; 0x50d, 0x50d; 0x50f, 0x50f; 0x511, 0x511; 0x513, 0x513; - 0x515, 0x515; 0x517, 0x517; 0x519, 0x519; 0x51b, 0x51b; 0x51d, 0x51d; - 0x51f, 0x51f; 0x521, 0x521; 0x523, 0x523; 0x525, 0x525; 0x527, 0x527; - 0x561, 0x587; 0x1d00, 0x1d2b; 0x1d6b, 0x1d77; 0x1d79, 0x1d9a; - 0x1e01, 0x1e01; 0x1e03, 0x1e03; 0x1e05, 0x1e05; 0x1e07, 0x1e07; - 0x1e09, 0x1e09; 0x1e0b, 0x1e0b; 0x1e0d, 0x1e0d; 0x1e0f, 0x1e0f; - 0x1e11, 0x1e11; 0x1e13, 0x1e13; 0x1e15, 0x1e15; 0x1e17, 0x1e17; - 0x1e19, 0x1e19; 0x1e1b, 0x1e1b; 0x1e1d, 0x1e1d; 0x1e1f, 0x1e1f; - 0x1e21, 0x1e21; 0x1e23, 0x1e23; 0x1e25, 0x1e25; 0x1e27, 0x1e27; - 0x1e29, 0x1e29; 0x1e2b, 0x1e2b; 0x1e2d, 0x1e2d; 0x1e2f, 0x1e2f; - 0x1e31, 0x1e31; 0x1e33, 0x1e33; 0x1e35, 0x1e35; 0x1e37, 0x1e37; - 0x1e39, 0x1e39; 0x1e3b, 0x1e3b; 0x1e3d, 0x1e3d; 0x1e3f, 0x1e3f; - 0x1e41, 0x1e41; 0x1e43, 0x1e43; 0x1e45, 0x1e45; 0x1e47, 0x1e47; - 0x1e49, 0x1e49; 0x1e4b, 0x1e4b; 0x1e4d, 0x1e4d; 0x1e4f, 0x1e4f; - 0x1e51, 0x1e51; 0x1e53, 0x1e53; 0x1e55, 0x1e55; 0x1e57, 0x1e57; - 0x1e59, 0x1e59; 0x1e5b, 0x1e5b; 0x1e5d, 0x1e5d; 0x1e5f, 0x1e5f; - 0x1e61, 0x1e61; 0x1e63, 0x1e63; 0x1e65, 0x1e65; 0x1e67, 0x1e67; - 0x1e69, 0x1e69; 0x1e6b, 0x1e6b; 0x1e6d, 0x1e6d; 0x1e6f, 0x1e6f; - 0x1e71, 0x1e71; 0x1e73, 0x1e73; 0x1e75, 0x1e75; 0x1e77, 0x1e77; - 0x1e79, 0x1e79; 0x1e7b, 0x1e7b; 0x1e7d, 0x1e7d; 0x1e7f, 0x1e7f; - 0x1e81, 0x1e81; 0x1e83, 0x1e83; 0x1e85, 0x1e85; 0x1e87, 0x1e87; - 0x1e89, 0x1e89; 0x1e8b, 0x1e8b; 0x1e8d, 0x1e8d; 0x1e8f, 0x1e8f; - 0x1e91, 0x1e91; 0x1e93, 0x1e93; 0x1e95, 0x1e9d; 0x1e9f, 0x1e9f; - 0x1ea1, 0x1ea1; 0x1ea3, 0x1ea3; 0x1ea5, 0x1ea5; 0x1ea7, 0x1ea7; - 0x1ea9, 0x1ea9; 0x1eab, 0x1eab; 0x1ead, 0x1ead; 0x1eaf, 0x1eaf; - 0x1eb1, 0x1eb1; 0x1eb3, 0x1eb3; 0x1eb5, 0x1eb5; 0x1eb7, 0x1eb7; - 0x1eb9, 0x1eb9; 0x1ebb, 0x1ebb; 0x1ebd, 0x1ebd; 0x1ebf, 0x1ebf; - 0x1ec1, 0x1ec1; 0x1ec3, 0x1ec3; 0x1ec5, 0x1ec5; 0x1ec7, 0x1ec7; - 0x1ec9, 0x1ec9; 0x1ecb, 0x1ecb; 0x1ecd, 0x1ecd; 0x1ecf, 0x1ecf; - 0x1ed1, 0x1ed1; 0x1ed3, 0x1ed3; 0x1ed5, 0x1ed5; 0x1ed7, 0x1ed7; - 0x1ed9, 0x1ed9; 0x1edb, 0x1edb; 0x1edd, 0x1edd; 0x1edf, 0x1edf; - 0x1ee1, 0x1ee1; 0x1ee3, 0x1ee3; 0x1ee5, 0x1ee5; 0x1ee7, 0x1ee7; - 0x1ee9, 0x1ee9; 0x1eeb, 0x1eeb; 0x1eed, 0x1eed; 0x1eef, 0x1eef; - 0x1ef1, 0x1ef1; 0x1ef3, 0x1ef3; 0x1ef5, 0x1ef5; 0x1ef7, 0x1ef7; - 0x1ef9, 0x1ef9; 0x1efb, 0x1efb; 0x1efd, 0x1efd; 0x1eff, 0x1f07; - 0x1f10, 0x1f15; 0x1f20, 0x1f27; 0x1f30, 0x1f37; 0x1f40, 0x1f45; - 0x1f50, 0x1f57; 0x1f60, 0x1f67; 0x1f70, 0x1f7d; 0x1f80, 0x1f87; - 0x1f90, 0x1f97; 0x1fa0, 0x1fa7; 0x1fb0, 0x1fb4; 0x1fb6, 0x1fb7; - 0x1fbe, 0x1fbe; 0x1fc2, 0x1fc4; 0x1fc6, 0x1fc7; 0x1fd0, 0x1fd3; - 0x1fd6, 0x1fd7; 0x1fe0, 0x1fe7; 0x1ff2, 0x1ff4; 0x1ff6, 0x1ff7; - 0x210a, 0x210a; 0x210e, 0x210f; 0x2113, 0x2113; 0x212f, 0x212f; - 0x2134, 0x2134; 0x2139, 0x2139; 0x213c, 0x213d; 0x2146, 0x2149; - 0x214e, 0x214e; 0x2184, 0x2184; 0x2c30, 0x2c5e; 0x2c61, 0x2c61; - 0x2c65, 0x2c66; 0x2c68, 0x2c68; 0x2c6a, 0x2c6a; 0x2c6c, 0x2c6c; - 0x2c71, 0x2c71; 0x2c73, 0x2c74; 0x2c76, 0x2c7b; 0x2c81, 0x2c81; - 0x2c83, 0x2c83; 0x2c85, 0x2c85; 0x2c87, 0x2c87; 0x2c89, 0x2c89; - 0x2c8b, 0x2c8b; 0x2c8d, 0x2c8d; 0x2c8f, 0x2c8f; 0x2c91, 0x2c91; - 0x2c93, 0x2c93; 0x2c95, 0x2c95; 0x2c97, 0x2c97; 0x2c99, 0x2c99; - 0x2c9b, 0x2c9b; 0x2c9d, 0x2c9d; 0x2c9f, 0x2c9f; 0x2ca1, 0x2ca1; - 0x2ca3, 0x2ca3; 0x2ca5, 0x2ca5; 0x2ca7, 0x2ca7; 0x2ca9, 0x2ca9; - 0x2cab, 0x2cab; 0x2cad, 0x2cad; 0x2caf, 0x2caf; 0x2cb1, 0x2cb1; - 0x2cb3, 0x2cb3; 0x2cb5, 0x2cb5; 0x2cb7, 0x2cb7; 0x2cb9, 0x2cb9; - 0x2cbb, 0x2cbb; 0x2cbd, 0x2cbd; 0x2cbf, 0x2cbf; 0x2cc1, 0x2cc1; - 0x2cc3, 0x2cc3; 0x2cc5, 0x2cc5; 0x2cc7, 0x2cc7; 0x2cc9, 0x2cc9; - 0x2ccb, 0x2ccb; 0x2ccd, 0x2ccd; 0x2ccf, 0x2ccf; 0x2cd1, 0x2cd1; - 0x2cd3, 0x2cd3; 0x2cd5, 0x2cd5; 0x2cd7, 0x2cd7; 0x2cd9, 0x2cd9; - 0x2cdb, 0x2cdb; 0x2cdd, 0x2cdd; 0x2cdf, 0x2cdf; 0x2ce1, 0x2ce1; - 0x2ce3, 0x2ce4; 0x2cec, 0x2cec; 0x2cee, 0x2cee; 0x2cf3, 0x2cf3; - 0x2d00, 0x2d25; 0x2d27, 0x2d27; 0x2d2d, 0x2d2d; 0xa641, 0xa641; - 0xa643, 0xa643; 0xa645, 0xa645; 0xa647, 0xa647; 0xa649, 0xa649; - 0xa64b, 0xa64b; 0xa64d, 0xa64d; 0xa64f, 0xa64f; 0xa651, 0xa651; - 0xa653, 0xa653; 0xa655, 0xa655; 0xa657, 0xa657; 0xa659, 0xa659; - 0xa65b, 0xa65b; 0xa65d, 0xa65d; 0xa65f, 0xa65f; 0xa661, 0xa661; - 0xa663, 0xa663; 0xa665, 0xa665; 0xa667, 0xa667; 0xa669, 0xa669; - 0xa66b, 0xa66b; 0xa66d, 0xa66d; 0xa681, 0xa681; 0xa683, 0xa683; - 0xa685, 0xa685; 0xa687, 0xa687; 0xa689, 0xa689; 0xa68b, 0xa68b; - 0xa68d, 0xa68d; 0xa68f, 0xa68f; 0xa691, 0xa691; 0xa693, 0xa693; - 0xa695, 0xa695; 0xa697, 0xa697; 0xa723, 0xa723; 0xa725, 0xa725; - 0xa727, 0xa727; 0xa729, 0xa729; 0xa72b, 0xa72b; 0xa72d, 0xa72d; - 0xa72f, 0xa731; 0xa733, 0xa733; 0xa735, 0xa735; 0xa737, 0xa737; - 0xa739, 0xa739; 0xa73b, 0xa73b; 0xa73d, 0xa73d; 0xa73f, 0xa73f; - 0xa741, 0xa741; 0xa743, 0xa743; 0xa745, 0xa745; 0xa747, 0xa747; - 0xa749, 0xa749; 0xa74b, 0xa74b; 0xa74d, 0xa74d; 0xa74f, 0xa74f; - 0xa751, 0xa751; 0xa753, 0xa753; 0xa755, 0xa755; 0xa757, 0xa757; - 0xa759, 0xa759; 0xa75b, 0xa75b; 0xa75d, 0xa75d; 0xa75f, 0xa75f; - 0xa761, 0xa761; 0xa763, 0xa763; 0xa765, 0xa765; 0xa767, 0xa767; - 0xa769, 0xa769; 0xa76b, 0xa76b; 0xa76d, 0xa76d; 0xa76f, 0xa76f; - 0xa771, 0xa778; 0xa77a, 0xa77a; 0xa77c, 0xa77c; 0xa77f, 0xa77f; - 0xa781, 0xa781; 0xa783, 0xa783; 0xa785, 0xa785; 0xa787, 0xa787; - 0xa78c, 0xa78c; 0xa78e, 0xa78e; 0xa791, 0xa791; 0xa793, 0xa793; - 0xa7a1, 0xa7a1; 0xa7a3, 0xa7a3; 0xa7a5, 0xa7a5; 0xa7a7, 0xa7a7; - 0xa7a9, 0xa7a9; 0xa7fa, 0xa7fa; 0xfb00, 0xfb06; 0xfb13, 0xfb17; - 0xff41, 0xff5a; 0x10428, 0x1044f; 0x1d41a, 0x1d433; 0x1d44e, 0x1d454; - 0x1d456, 0x1d467; 0x1d482, 0x1d49b; 0x1d4b6, 0x1d4b9; 0x1d4bb, 0x1d4bb; - 0x1d4bd, 0x1d4c3; 0x1d4c5, 0x1d4cf; 0x1d4ea, 0x1d503; 0x1d51e, 0x1d537; - 0x1d552, 0x1d56b; 0x1d586, 0x1d59f; 0x1d5ba, 0x1d5d3; 0x1d5ee, 0x1d607; - 0x1d622, 0x1d63b; 0x1d656, 0x1d66f; 0x1d68a, 0x1d6a5; 0x1d6c2, 0x1d6da; - 0x1d6dc, 0x1d6e1; 0x1d6fc, 0x1d714; 0x1d716, 0x1d71b; 0x1d736, 0x1d74e; - 0x1d750, 0x1d755; 0x1d770, 0x1d788; 0x1d78a, 0x1d78f; 0x1d7aa, 0x1d7c2; - 0x1d7c4, 0x1d7c9; 0x1d7cb, 0x1d7cb] - - let lm = - [0x2b0, 0x2c1; 0x2c6, 0x2d1; 0x2e0, 0x2e4; 0x2ec, 0x2ec; 0x2ee, 0x2ee; - 0x374, 0x374; 0x37a, 0x37a; 0x559, 0x559; 0x640, 0x640; 0x6e5, 0x6e6; - 0x7f4, 0x7f5; 0x7fa, 0x7fa; 0x81a, 0x81a; 0x824, 0x824; 0x828, 0x828; - 0x971, 0x971; 0xe46, 0xe46; 0xec6, 0xec6; 0x10fc, 0x10fc; 0x17d7, 0x17d7; - 0x1843, 0x1843; 0x1aa7, 0x1aa7; 0x1c78, 0x1c7d; 0x1d2c, 0x1d6a; - 0x1d78, 0x1d78; 0x1d9b, 0x1dbf; 0x2071, 0x2071; 0x207f, 0x207f; - 0x2090, 0x209c; 0x2c7c, 0x2c7d; 0x2d6f, 0x2d6f; 0x2e2f, 0x2e2f; - 0x3005, 0x3005; 0x3031, 0x3035; 0x303b, 0x303b; 0x309d, 0x309e; - 0x30fc, 0x30fe; 0xa015, 0xa015; 0xa4f8, 0xa4fd; 0xa60c, 0xa60c; - 0xa67f, 0xa67f; 0xa717, 0xa71f; 0xa770, 0xa770; 0xa788, 0xa788; - 0xa7f8, 0xa7f9; 0xa9cf, 0xa9cf; 0xaa70, 0xaa70; 0xaadd, 0xaadd; - 0xaaf3, 0xaaf4; 0xff70, 0xff70; 0xff9e, 0xff9f; 0x16f93, 0x16f9f] - - let lo = - [0xaa, 0xaa; 0xba, 0xba; 0x1bb, 0x1bb; 0x1c0, 0x1c3; 0x294, 0x294; - 0x5d0, 0x5ea; 0x5f0, 0x5f2; 0x620, 0x63f; 0x641, 0x64a; 0x66e, 0x66f; - 0x671, 0x6d3; 0x6d5, 0x6d5; 0x6ee, 0x6ef; 0x6fa, 0x6fc; 0x6ff, 0x6ff; - 0x710, 0x710; 0x712, 0x72f; 0x74d, 0x7a5; 0x7b1, 0x7b1; 0x7ca, 0x7ea; - 0x800, 0x815; 0x840, 0x858; 0x8a0, 0x8a0; 0x8a2, 0x8ac; 0x904, 0x939; - 0x93d, 0x93d; 0x950, 0x950; 0x958, 0x961; 0x972, 0x977; 0x979, 0x97f; - 0x985, 0x98c; 0x98f, 0x990; 0x993, 0x9a8; 0x9aa, 0x9b0; 0x9b2, 0x9b2; - 0x9b6, 0x9b9; 0x9bd, 0x9bd; 0x9ce, 0x9ce; 0x9dc, 0x9dd; 0x9df, 0x9e1; - 0x9f0, 0x9f1; 0xa05, 0xa0a; 0xa0f, 0xa10; 0xa13, 0xa28; 0xa2a, 0xa30; - 0xa32, 0xa33; 0xa35, 0xa36; 0xa38, 0xa39; 0xa59, 0xa5c; 0xa5e, 0xa5e; - 0xa72, 0xa74; 0xa85, 0xa8d; 0xa8f, 0xa91; 0xa93, 0xaa8; 0xaaa, 0xab0; - 0xab2, 0xab3; 0xab5, 0xab9; 0xabd, 0xabd; 0xad0, 0xad0; 0xae0, 0xae1; - 0xb05, 0xb0c; 0xb0f, 0xb10; 0xb13, 0xb28; 0xb2a, 0xb30; 0xb32, 0xb33; - 0xb35, 0xb39; 0xb3d, 0xb3d; 0xb5c, 0xb5d; 0xb5f, 0xb61; 0xb71, 0xb71; - 0xb83, 0xb83; 0xb85, 0xb8a; 0xb8e, 0xb90; 0xb92, 0xb95; 0xb99, 0xb9a; - 0xb9c, 0xb9c; 0xb9e, 0xb9f; 0xba3, 0xba4; 0xba8, 0xbaa; 0xbae, 0xbb9; - 0xbd0, 0xbd0; 0xc05, 0xc0c; 0xc0e, 0xc10; 0xc12, 0xc28; 0xc2a, 0xc33; - 0xc35, 0xc39; 0xc3d, 0xc3d; 0xc58, 0xc59; 0xc60, 0xc61; 0xc85, 0xc8c; - 0xc8e, 0xc90; 0xc92, 0xca8; 0xcaa, 0xcb3; 0xcb5, 0xcb9; 0xcbd, 0xcbd; - 0xcde, 0xcde; 0xce0, 0xce1; 0xcf1, 0xcf2; 0xd05, 0xd0c; 0xd0e, 0xd10; - 0xd12, 0xd3a; 0xd3d, 0xd3d; 0xd4e, 0xd4e; 0xd60, 0xd61; 0xd7a, 0xd7f; - 0xd85, 0xd96; 0xd9a, 0xdb1; 0xdb3, 0xdbb; 0xdbd, 0xdbd; 0xdc0, 0xdc6; - 0xe01, 0xe30; 0xe32, 0xe33; 0xe40, 0xe45; 0xe81, 0xe82; 0xe84, 0xe84; - 0xe87, 0xe88; 0xe8a, 0xe8a; 0xe8d, 0xe8d; 0xe94, 0xe97; 0xe99, 0xe9f; - 0xea1, 0xea3; 0xea5, 0xea5; 0xea7, 0xea7; 0xeaa, 0xeab; 0xead, 0xeb0; - 0xeb2, 0xeb3; 0xebd, 0xebd; 0xec0, 0xec4; 0xedc, 0xedf; 0xf00, 0xf00; - 0xf40, 0xf47; 0xf49, 0xf6c; 0xf88, 0xf8c; 0x1000, 0x102a; 0x103f, 0x103f; - 0x1050, 0x1055; 0x105a, 0x105d; 0x1061, 0x1061; 0x1065, 0x1066; - 0x106e, 0x1070; 0x1075, 0x1081; 0x108e, 0x108e; 0x10d0, 0x10fa; - 0x10fd, 0x1248; 0x124a, 0x124d; 0x1250, 0x1256; 0x1258, 0x1258; - 0x125a, 0x125d; 0x1260, 0x1288; 0x128a, 0x128d; 0x1290, 0x12b0; - 0x12b2, 0x12b5; 0x12b8, 0x12be; 0x12c0, 0x12c0; 0x12c2, 0x12c5; - 0x12c8, 0x12d6; 0x12d8, 0x1310; 0x1312, 0x1315; 0x1318, 0x135a; - 0x1380, 0x138f; 0x13a0, 0x13f4; 0x1401, 0x166c; 0x166f, 0x167f; - 0x1681, 0x169a; 0x16a0, 0x16ea; 0x1700, 0x170c; 0x170e, 0x1711; - 0x1720, 0x1731; 0x1740, 0x1751; 0x1760, 0x176c; 0x176e, 0x1770; - 0x1780, 0x17b3; 0x17dc, 0x17dc; 0x1820, 0x1842; 0x1844, 0x1877; - 0x1880, 0x18a8; 0x18aa, 0x18aa; 0x18b0, 0x18f5; 0x1900, 0x191c; - 0x1950, 0x196d; 0x1970, 0x1974; 0x1980, 0x19ab; 0x19c1, 0x19c7; - 0x1a00, 0x1a16; 0x1a20, 0x1a54; 0x1b05, 0x1b33; 0x1b45, 0x1b4b; - 0x1b83, 0x1ba0; 0x1bae, 0x1baf; 0x1bba, 0x1be5; 0x1c00, 0x1c23; - 0x1c4d, 0x1c4f; 0x1c5a, 0x1c77; 0x1ce9, 0x1cec; 0x1cee, 0x1cf1; - 0x1cf5, 0x1cf6; 0x2135, 0x2138; 0x2d30, 0x2d67; 0x2d80, 0x2d96; - 0x2da0, 0x2da6; 0x2da8, 0x2dae; 0x2db0, 0x2db6; 0x2db8, 0x2dbe; - 0x2dc0, 0x2dc6; 0x2dc8, 0x2dce; 0x2dd0, 0x2dd6; 0x2dd8, 0x2dde; - 0x3006, 0x3006; 0x303c, 0x303c; 0x3041, 0x3096; 0x309f, 0x309f; - 0x30a1, 0x30fa; 0x30ff, 0x30ff; 0x3105, 0x312d; 0x3131, 0x318e; - 0x31a0, 0x31ba; 0x31f0, 0x31ff; 0x3400, 0x4db5; 0x4e00, 0x9fcc; - 0xa000, 0xa014; 0xa016, 0xa48c; 0xa4d0, 0xa4f7; 0xa500, 0xa60b; - 0xa610, 0xa61f; 0xa62a, 0xa62b; 0xa66e, 0xa66e; 0xa6a0, 0xa6e5; - 0xa7fb, 0xa801; 0xa803, 0xa805; 0xa807, 0xa80a; 0xa80c, 0xa822; - 0xa840, 0xa873; 0xa882, 0xa8b3; 0xa8f2, 0xa8f7; 0xa8fb, 0xa8fb; - 0xa90a, 0xa925; 0xa930, 0xa946; 0xa960, 0xa97c; 0xa984, 0xa9b2; - 0xaa00, 0xaa28; 0xaa40, 0xaa42; 0xaa44, 0xaa4b; 0xaa60, 0xaa6f; - 0xaa71, 0xaa76; 0xaa7a, 0xaa7a; 0xaa80, 0xaaaf; 0xaab1, 0xaab1; - 0xaab5, 0xaab6; 0xaab9, 0xaabd; 0xaac0, 0xaac0; 0xaac2, 0xaac2; - 0xaadb, 0xaadc; 0xaae0, 0xaaea; 0xaaf2, 0xaaf2; 0xab01, 0xab06; - 0xab09, 0xab0e; 0xab11, 0xab16; 0xab20, 0xab26; 0xab28, 0xab2e; - 0xabc0, 0xabe2; 0xac00, 0xd7a3; 0xd7b0, 0xd7c6; 0xd7cb, 0xd7fb; - 0xf900, 0xfa6d; 0xfa70, 0xfad9; 0xfb1d, 0xfb1d; 0xfb1f, 0xfb28; - 0xfb2a, 0xfb36; 0xfb38, 0xfb3c; 0xfb3e, 0xfb3e; 0xfb40, 0xfb41; - 0xfb43, 0xfb44; 0xfb46, 0xfbb1; 0xfbd3, 0xfd3d; 0xfd50, 0xfd8f; - 0xfd92, 0xfdc7; 0xfdf0, 0xfdfb; 0xfe70, 0xfe74; 0xfe76, 0xfefc; - 0xff66, 0xff6f; 0xff71, 0xff9d; 0xffa0, 0xffbe; 0xffc2, 0xffc7; - 0xffca, 0xffcf; 0xffd2, 0xffd7; 0xffda, 0xffdc; 0x10000, 0x1000b; - 0x1000d, 0x10026; 0x10028, 0x1003a; 0x1003c, 0x1003d; 0x1003f, 0x1004d; - 0x10050, 0x1005d; 0x10080, 0x100fa; 0x10280, 0x1029c; 0x102a0, 0x102d0; - 0x10300, 0x1031e; 0x10330, 0x10340; 0x10342, 0x10349; 0x10380, 0x1039d; - 0x103a0, 0x103c3; 0x103c8, 0x103cf; 0x10450, 0x1049d; 0x10800, 0x10805; - 0x10808, 0x10808; 0x1080a, 0x10835; 0x10837, 0x10838; 0x1083c, 0x1083c; - 0x1083f, 0x10855; 0x10900, 0x10915; 0x10920, 0x10939; 0x10980, 0x109b7; - 0x109be, 0x109bf; 0x10a00, 0x10a00; 0x10a10, 0x10a13; 0x10a15, 0x10a17; - 0x10a19, 0x10a33; 0x10a60, 0x10a7c; 0x10b00, 0x10b35; 0x10b40, 0x10b55; - 0x10b60, 0x10b72; 0x10c00, 0x10c48; 0x11003, 0x11037; 0x11083, 0x110af; - 0x110d0, 0x110e8; 0x11103, 0x11126; 0x11183, 0x111b2; 0x111c1, 0x111c4; - 0x11680, 0x116aa; 0x12000, 0x1236e; 0x13000, 0x1342e; 0x16800, 0x16a38; - 0x16f00, 0x16f44; 0x16f50, 0x16f50; 0x1b000, 0x1b001; 0x1ee00, 0x1ee03; - 0x1ee05, 0x1ee1f; 0x1ee21, 0x1ee22; 0x1ee24, 0x1ee24; 0x1ee27, 0x1ee27; - 0x1ee29, 0x1ee32; 0x1ee34, 0x1ee37; 0x1ee39, 0x1ee39; 0x1ee3b, 0x1ee3b; - 0x1ee42, 0x1ee42; 0x1ee47, 0x1ee47; 0x1ee49, 0x1ee49; 0x1ee4b, 0x1ee4b; - 0x1ee4d, 0x1ee4f; 0x1ee51, 0x1ee52; 0x1ee54, 0x1ee54; 0x1ee57, 0x1ee57; - 0x1ee59, 0x1ee59; 0x1ee5b, 0x1ee5b; 0x1ee5d, 0x1ee5d; 0x1ee5f, 0x1ee5f; - 0x1ee61, 0x1ee62; 0x1ee64, 0x1ee64; 0x1ee67, 0x1ee6a; 0x1ee6c, 0x1ee72; - 0x1ee74, 0x1ee77; 0x1ee79, 0x1ee7c; 0x1ee7e, 0x1ee7e; 0x1ee80, 0x1ee89; - 0x1ee8b, 0x1ee9b; 0x1eea1, 0x1eea3; 0x1eea5, 0x1eea9; 0x1eeab, 0x1eebb; - 0x20000, 0x2a6d6; 0x2a700, 0x2b734; 0x2b740, 0x2b81d; 0x2f800, 0x2fa1d] - - let lt = - [0x1c5, 0x1c5; 0x1c8, 0x1c8; 0x1cb, 0x1cb; 0x1f2, 0x1f2; 0x1f88, 0x1f8f; - 0x1f98, 0x1f9f; 0x1fa8, 0x1faf; 0x1fbc, 0x1fbc; 0x1fcc, 0x1fcc; - 0x1ffc, 0x1ffc] - - let lu = - [0x41, 0x5a; 0xc0, 0xd6; 0xd8, 0xde; 0x100, 0x100; 0x102, 0x102; - 0x104, 0x104; 0x106, 0x106; 0x108, 0x108; 0x10a, 0x10a; 0x10c, 0x10c; - 0x10e, 0x10e; 0x110, 0x110; 0x112, 0x112; 0x114, 0x114; 0x116, 0x116; - 0x118, 0x118; 0x11a, 0x11a; 0x11c, 0x11c; 0x11e, 0x11e; 0x120, 0x120; - 0x122, 0x122; 0x124, 0x124; 0x126, 0x126; 0x128, 0x128; 0x12a, 0x12a; - 0x12c, 0x12c; 0x12e, 0x12e; 0x130, 0x130; 0x132, 0x132; 0x134, 0x134; - 0x136, 0x136; 0x139, 0x139; 0x13b, 0x13b; 0x13d, 0x13d; 0x13f, 0x13f; - 0x141, 0x141; 0x143, 0x143; 0x145, 0x145; 0x147, 0x147; 0x14a, 0x14a; - 0x14c, 0x14c; 0x14e, 0x14e; 0x150, 0x150; 0x152, 0x152; 0x154, 0x154; - 0x156, 0x156; 0x158, 0x158; 0x15a, 0x15a; 0x15c, 0x15c; 0x15e, 0x15e; - 0x160, 0x160; 0x162, 0x162; 0x164, 0x164; 0x166, 0x166; 0x168, 0x168; - 0x16a, 0x16a; 0x16c, 0x16c; 0x16e, 0x16e; 0x170, 0x170; 0x172, 0x172; - 0x174, 0x174; 0x176, 0x176; 0x178, 0x179; 0x17b, 0x17b; 0x17d, 0x17d; - 0x181, 0x182; 0x184, 0x184; 0x186, 0x187; 0x189, 0x18b; 0x18e, 0x191; - 0x193, 0x194; 0x196, 0x198; 0x19c, 0x19d; 0x19f, 0x1a0; 0x1a2, 0x1a2; - 0x1a4, 0x1a4; 0x1a6, 0x1a7; 0x1a9, 0x1a9; 0x1ac, 0x1ac; 0x1ae, 0x1af; - 0x1b1, 0x1b3; 0x1b5, 0x1b5; 0x1b7, 0x1b8; 0x1bc, 0x1bc; 0x1c4, 0x1c4; - 0x1c7, 0x1c7; 0x1ca, 0x1ca; 0x1cd, 0x1cd; 0x1cf, 0x1cf; 0x1d1, 0x1d1; - 0x1d3, 0x1d3; 0x1d5, 0x1d5; 0x1d7, 0x1d7; 0x1d9, 0x1d9; 0x1db, 0x1db; - 0x1de, 0x1de; 0x1e0, 0x1e0; 0x1e2, 0x1e2; 0x1e4, 0x1e4; 0x1e6, 0x1e6; - 0x1e8, 0x1e8; 0x1ea, 0x1ea; 0x1ec, 0x1ec; 0x1ee, 0x1ee; 0x1f1, 0x1f1; - 0x1f4, 0x1f4; 0x1f6, 0x1f8; 0x1fa, 0x1fa; 0x1fc, 0x1fc; 0x1fe, 0x1fe; - 0x200, 0x200; 0x202, 0x202; 0x204, 0x204; 0x206, 0x206; 0x208, 0x208; - 0x20a, 0x20a; 0x20c, 0x20c; 0x20e, 0x20e; 0x210, 0x210; 0x212, 0x212; - 0x214, 0x214; 0x216, 0x216; 0x218, 0x218; 0x21a, 0x21a; 0x21c, 0x21c; - 0x21e, 0x21e; 0x220, 0x220; 0x222, 0x222; 0x224, 0x224; 0x226, 0x226; - 0x228, 0x228; 0x22a, 0x22a; 0x22c, 0x22c; 0x22e, 0x22e; 0x230, 0x230; - 0x232, 0x232; 0x23a, 0x23b; 0x23d, 0x23e; 0x241, 0x241; 0x243, 0x246; - 0x248, 0x248; 0x24a, 0x24a; 0x24c, 0x24c; 0x24e, 0x24e; 0x370, 0x370; - 0x372, 0x372; 0x376, 0x376; 0x386, 0x386; 0x388, 0x38a; 0x38c, 0x38c; - 0x38e, 0x38f; 0x391, 0x3a1; 0x3a3, 0x3ab; 0x3cf, 0x3cf; 0x3d2, 0x3d4; - 0x3d8, 0x3d8; 0x3da, 0x3da; 0x3dc, 0x3dc; 0x3de, 0x3de; 0x3e0, 0x3e0; - 0x3e2, 0x3e2; 0x3e4, 0x3e4; 0x3e6, 0x3e6; 0x3e8, 0x3e8; 0x3ea, 0x3ea; - 0x3ec, 0x3ec; 0x3ee, 0x3ee; 0x3f4, 0x3f4; 0x3f7, 0x3f7; 0x3f9, 0x3fa; - 0x3fd, 0x42f; 0x460, 0x460; 0x462, 0x462; 0x464, 0x464; 0x466, 0x466; - 0x468, 0x468; 0x46a, 0x46a; 0x46c, 0x46c; 0x46e, 0x46e; 0x470, 0x470; - 0x472, 0x472; 0x474, 0x474; 0x476, 0x476; 0x478, 0x478; 0x47a, 0x47a; - 0x47c, 0x47c; 0x47e, 0x47e; 0x480, 0x480; 0x48a, 0x48a; 0x48c, 0x48c; - 0x48e, 0x48e; 0x490, 0x490; 0x492, 0x492; 0x494, 0x494; 0x496, 0x496; - 0x498, 0x498; 0x49a, 0x49a; 0x49c, 0x49c; 0x49e, 0x49e; 0x4a0, 0x4a0; - 0x4a2, 0x4a2; 0x4a4, 0x4a4; 0x4a6, 0x4a6; 0x4a8, 0x4a8; 0x4aa, 0x4aa; - 0x4ac, 0x4ac; 0x4ae, 0x4ae; 0x4b0, 0x4b0; 0x4b2, 0x4b2; 0x4b4, 0x4b4; - 0x4b6, 0x4b6; 0x4b8, 0x4b8; 0x4ba, 0x4ba; 0x4bc, 0x4bc; 0x4be, 0x4be; - 0x4c0, 0x4c1; 0x4c3, 0x4c3; 0x4c5, 0x4c5; 0x4c7, 0x4c7; 0x4c9, 0x4c9; - 0x4cb, 0x4cb; 0x4cd, 0x4cd; 0x4d0, 0x4d0; 0x4d2, 0x4d2; 0x4d4, 0x4d4; - 0x4d6, 0x4d6; 0x4d8, 0x4d8; 0x4da, 0x4da; 0x4dc, 0x4dc; 0x4de, 0x4de; - 0x4e0, 0x4e0; 0x4e2, 0x4e2; 0x4e4, 0x4e4; 0x4e6, 0x4e6; 0x4e8, 0x4e8; - 0x4ea, 0x4ea; 0x4ec, 0x4ec; 0x4ee, 0x4ee; 0x4f0, 0x4f0; 0x4f2, 0x4f2; - 0x4f4, 0x4f4; 0x4f6, 0x4f6; 0x4f8, 0x4f8; 0x4fa, 0x4fa; 0x4fc, 0x4fc; - 0x4fe, 0x4fe; 0x500, 0x500; 0x502, 0x502; 0x504, 0x504; 0x506, 0x506; - 0x508, 0x508; 0x50a, 0x50a; 0x50c, 0x50c; 0x50e, 0x50e; 0x510, 0x510; - 0x512, 0x512; 0x514, 0x514; 0x516, 0x516; 0x518, 0x518; 0x51a, 0x51a; - 0x51c, 0x51c; 0x51e, 0x51e; 0x520, 0x520; 0x522, 0x522; 0x524, 0x524; - 0x526, 0x526; 0x531, 0x556; 0x10a0, 0x10c5; 0x10c7, 0x10c7; - 0x10cd, 0x10cd; 0x1e00, 0x1e00; 0x1e02, 0x1e02; 0x1e04, 0x1e04; - 0x1e06, 0x1e06; 0x1e08, 0x1e08; 0x1e0a, 0x1e0a; 0x1e0c, 0x1e0c; - 0x1e0e, 0x1e0e; 0x1e10, 0x1e10; 0x1e12, 0x1e12; 0x1e14, 0x1e14; - 0x1e16, 0x1e16; 0x1e18, 0x1e18; 0x1e1a, 0x1e1a; 0x1e1c, 0x1e1c; - 0x1e1e, 0x1e1e; 0x1e20, 0x1e20; 0x1e22, 0x1e22; 0x1e24, 0x1e24; - 0x1e26, 0x1e26; 0x1e28, 0x1e28; 0x1e2a, 0x1e2a; 0x1e2c, 0x1e2c; - 0x1e2e, 0x1e2e; 0x1e30, 0x1e30; 0x1e32, 0x1e32; 0x1e34, 0x1e34; - 0x1e36, 0x1e36; 0x1e38, 0x1e38; 0x1e3a, 0x1e3a; 0x1e3c, 0x1e3c; - 0x1e3e, 0x1e3e; 0x1e40, 0x1e40; 0x1e42, 0x1e42; 0x1e44, 0x1e44; - 0x1e46, 0x1e46; 0x1e48, 0x1e48; 0x1e4a, 0x1e4a; 0x1e4c, 0x1e4c; - 0x1e4e, 0x1e4e; 0x1e50, 0x1e50; 0x1e52, 0x1e52; 0x1e54, 0x1e54; - 0x1e56, 0x1e56; 0x1e58, 0x1e58; 0x1e5a, 0x1e5a; 0x1e5c, 0x1e5c; - 0x1e5e, 0x1e5e; 0x1e60, 0x1e60; 0x1e62, 0x1e62; 0x1e64, 0x1e64; - 0x1e66, 0x1e66; 0x1e68, 0x1e68; 0x1e6a, 0x1e6a; 0x1e6c, 0x1e6c; - 0x1e6e, 0x1e6e; 0x1e70, 0x1e70; 0x1e72, 0x1e72; 0x1e74, 0x1e74; - 0x1e76, 0x1e76; 0x1e78, 0x1e78; 0x1e7a, 0x1e7a; 0x1e7c, 0x1e7c; - 0x1e7e, 0x1e7e; 0x1e80, 0x1e80; 0x1e82, 0x1e82; 0x1e84, 0x1e84; - 0x1e86, 0x1e86; 0x1e88, 0x1e88; 0x1e8a, 0x1e8a; 0x1e8c, 0x1e8c; - 0x1e8e, 0x1e8e; 0x1e90, 0x1e90; 0x1e92, 0x1e92; 0x1e94, 0x1e94; - 0x1e9e, 0x1e9e; 0x1ea0, 0x1ea0; 0x1ea2, 0x1ea2; 0x1ea4, 0x1ea4; - 0x1ea6, 0x1ea6; 0x1ea8, 0x1ea8; 0x1eaa, 0x1eaa; 0x1eac, 0x1eac; - 0x1eae, 0x1eae; 0x1eb0, 0x1eb0; 0x1eb2, 0x1eb2; 0x1eb4, 0x1eb4; - 0x1eb6, 0x1eb6; 0x1eb8, 0x1eb8; 0x1eba, 0x1eba; 0x1ebc, 0x1ebc; - 0x1ebe, 0x1ebe; 0x1ec0, 0x1ec0; 0x1ec2, 0x1ec2; 0x1ec4, 0x1ec4; - 0x1ec6, 0x1ec6; 0x1ec8, 0x1ec8; 0x1eca, 0x1eca; 0x1ecc, 0x1ecc; - 0x1ece, 0x1ece; 0x1ed0, 0x1ed0; 0x1ed2, 0x1ed2; 0x1ed4, 0x1ed4; - 0x1ed6, 0x1ed6; 0x1ed8, 0x1ed8; 0x1eda, 0x1eda; 0x1edc, 0x1edc; - 0x1ede, 0x1ede; 0x1ee0, 0x1ee0; 0x1ee2, 0x1ee2; 0x1ee4, 0x1ee4; - 0x1ee6, 0x1ee6; 0x1ee8, 0x1ee8; 0x1eea, 0x1eea; 0x1eec, 0x1eec; - 0x1eee, 0x1eee; 0x1ef0, 0x1ef0; 0x1ef2, 0x1ef2; 0x1ef4, 0x1ef4; - 0x1ef6, 0x1ef6; 0x1ef8, 0x1ef8; 0x1efa, 0x1efa; 0x1efc, 0x1efc; - 0x1efe, 0x1efe; 0x1f08, 0x1f0f; 0x1f18, 0x1f1d; 0x1f28, 0x1f2f; - 0x1f38, 0x1f3f; 0x1f48, 0x1f4d; 0x1f59, 0x1f59; 0x1f5b, 0x1f5b; - 0x1f5d, 0x1f5d; 0x1f5f, 0x1f5f; 0x1f68, 0x1f6f; 0x1fb8, 0x1fbb; - 0x1fc8, 0x1fcb; 0x1fd8, 0x1fdb; 0x1fe8, 0x1fec; 0x1ff8, 0x1ffb; - 0x2102, 0x2102; 0x2107, 0x2107; 0x210b, 0x210d; 0x2110, 0x2112; - 0x2115, 0x2115; 0x2119, 0x211d; 0x2124, 0x2124; 0x2126, 0x2126; - 0x2128, 0x2128; 0x212a, 0x212d; 0x2130, 0x2133; 0x213e, 0x213f; - 0x2145, 0x2145; 0x2183, 0x2183; 0x2c00, 0x2c2e; 0x2c60, 0x2c60; - 0x2c62, 0x2c64; 0x2c67, 0x2c67; 0x2c69, 0x2c69; 0x2c6b, 0x2c6b; - 0x2c6d, 0x2c70; 0x2c72, 0x2c72; 0x2c75, 0x2c75; 0x2c7e, 0x2c80; - 0x2c82, 0x2c82; 0x2c84, 0x2c84; 0x2c86, 0x2c86; 0x2c88, 0x2c88; - 0x2c8a, 0x2c8a; 0x2c8c, 0x2c8c; 0x2c8e, 0x2c8e; 0x2c90, 0x2c90; - 0x2c92, 0x2c92; 0x2c94, 0x2c94; 0x2c96, 0x2c96; 0x2c98, 0x2c98; - 0x2c9a, 0x2c9a; 0x2c9c, 0x2c9c; 0x2c9e, 0x2c9e; 0x2ca0, 0x2ca0; - 0x2ca2, 0x2ca2; 0x2ca4, 0x2ca4; 0x2ca6, 0x2ca6; 0x2ca8, 0x2ca8; - 0x2caa, 0x2caa; 0x2cac, 0x2cac; 0x2cae, 0x2cae; 0x2cb0, 0x2cb0; - 0x2cb2, 0x2cb2; 0x2cb4, 0x2cb4; 0x2cb6, 0x2cb6; 0x2cb8, 0x2cb8; - 0x2cba, 0x2cba; 0x2cbc, 0x2cbc; 0x2cbe, 0x2cbe; 0x2cc0, 0x2cc0; - 0x2cc2, 0x2cc2; 0x2cc4, 0x2cc4; 0x2cc6, 0x2cc6; 0x2cc8, 0x2cc8; - 0x2cca, 0x2cca; 0x2ccc, 0x2ccc; 0x2cce, 0x2cce; 0x2cd0, 0x2cd0; - 0x2cd2, 0x2cd2; 0x2cd4, 0x2cd4; 0x2cd6, 0x2cd6; 0x2cd8, 0x2cd8; - 0x2cda, 0x2cda; 0x2cdc, 0x2cdc; 0x2cde, 0x2cde; 0x2ce0, 0x2ce0; - 0x2ce2, 0x2ce2; 0x2ceb, 0x2ceb; 0x2ced, 0x2ced; 0x2cf2, 0x2cf2; - 0xa640, 0xa640; 0xa642, 0xa642; 0xa644, 0xa644; 0xa646, 0xa646; - 0xa648, 0xa648; 0xa64a, 0xa64a; 0xa64c, 0xa64c; 0xa64e, 0xa64e; - 0xa650, 0xa650; 0xa652, 0xa652; 0xa654, 0xa654; 0xa656, 0xa656; - 0xa658, 0xa658; 0xa65a, 0xa65a; 0xa65c, 0xa65c; 0xa65e, 0xa65e; - 0xa660, 0xa660; 0xa662, 0xa662; 0xa664, 0xa664; 0xa666, 0xa666; - 0xa668, 0xa668; 0xa66a, 0xa66a; 0xa66c, 0xa66c; 0xa680, 0xa680; - 0xa682, 0xa682; 0xa684, 0xa684; 0xa686, 0xa686; 0xa688, 0xa688; - 0xa68a, 0xa68a; 0xa68c, 0xa68c; 0xa68e, 0xa68e; 0xa690, 0xa690; - 0xa692, 0xa692; 0xa694, 0xa694; 0xa696, 0xa696; 0xa722, 0xa722; - 0xa724, 0xa724; 0xa726, 0xa726; 0xa728, 0xa728; 0xa72a, 0xa72a; - 0xa72c, 0xa72c; 0xa72e, 0xa72e; 0xa732, 0xa732; 0xa734, 0xa734; - 0xa736, 0xa736; 0xa738, 0xa738; 0xa73a, 0xa73a; 0xa73c, 0xa73c; - 0xa73e, 0xa73e; 0xa740, 0xa740; 0xa742, 0xa742; 0xa744, 0xa744; - 0xa746, 0xa746; 0xa748, 0xa748; 0xa74a, 0xa74a; 0xa74c, 0xa74c; - 0xa74e, 0xa74e; 0xa750, 0xa750; 0xa752, 0xa752; 0xa754, 0xa754; - 0xa756, 0xa756; 0xa758, 0xa758; 0xa75a, 0xa75a; 0xa75c, 0xa75c; - 0xa75e, 0xa75e; 0xa760, 0xa760; 0xa762, 0xa762; 0xa764, 0xa764; - 0xa766, 0xa766; 0xa768, 0xa768; 0xa76a, 0xa76a; 0xa76c, 0xa76c; - 0xa76e, 0xa76e; 0xa779, 0xa779; 0xa77b, 0xa77b; 0xa77d, 0xa77e; - 0xa780, 0xa780; 0xa782, 0xa782; 0xa784, 0xa784; 0xa786, 0xa786; - 0xa78b, 0xa78b; 0xa78d, 0xa78d; 0xa790, 0xa790; 0xa792, 0xa792; - 0xa7a0, 0xa7a0; 0xa7a2, 0xa7a2; 0xa7a4, 0xa7a4; 0xa7a6, 0xa7a6; - 0xa7a8, 0xa7a8; 0xa7aa, 0xa7aa; 0xff21, 0xff3a; 0x10400, 0x10427; - 0x1d400, 0x1d419; 0x1d434, 0x1d44d; 0x1d468, 0x1d481; 0x1d49c, 0x1d49c; - 0x1d49e, 0x1d49f; 0x1d4a2, 0x1d4a2; 0x1d4a5, 0x1d4a6; 0x1d4a9, 0x1d4ac; - 0x1d4ae, 0x1d4b5; 0x1d4d0, 0x1d4e9; 0x1d504, 0x1d505; 0x1d507, 0x1d50a; - 0x1d50d, 0x1d514; 0x1d516, 0x1d51c; 0x1d538, 0x1d539; 0x1d53b, 0x1d53e; - 0x1d540, 0x1d544; 0x1d546, 0x1d546; 0x1d54a, 0x1d550; 0x1d56c, 0x1d585; - 0x1d5a0, 0x1d5b9; 0x1d5d4, 0x1d5ed; 0x1d608, 0x1d621; 0x1d63c, 0x1d655; - 0x1d670, 0x1d689; 0x1d6a8, 0x1d6c0; 0x1d6e2, 0x1d6fa; 0x1d71c, 0x1d734; - 0x1d756, 0x1d76e; 0x1d790, 0x1d7a8; 0x1d7ca, 0x1d7ca] - - let mc = - [0x903, 0x903; 0x93b, 0x93b; 0x93e, 0x940; 0x949, 0x94c; 0x94e, 0x94f; - 0x982, 0x983; 0x9be, 0x9c0; 0x9c7, 0x9c8; 0x9cb, 0x9cc; 0x9d7, 0x9d7; - 0xa03, 0xa03; 0xa3e, 0xa40; 0xa83, 0xa83; 0xabe, 0xac0; 0xac9, 0xac9; - 0xacb, 0xacc; 0xb02, 0xb03; 0xb3e, 0xb3e; 0xb40, 0xb40; 0xb47, 0xb48; - 0xb4b, 0xb4c; 0xb57, 0xb57; 0xbbe, 0xbbf; 0xbc1, 0xbc2; 0xbc6, 0xbc8; - 0xbca, 0xbcc; 0xbd7, 0xbd7; 0xc01, 0xc03; 0xc41, 0xc44; 0xc82, 0xc83; - 0xcbe, 0xcbe; 0xcc0, 0xcc4; 0xcc7, 0xcc8; 0xcca, 0xccb; 0xcd5, 0xcd6; - 0xd02, 0xd03; 0xd3e, 0xd40; 0xd46, 0xd48; 0xd4a, 0xd4c; 0xd57, 0xd57; - 0xd82, 0xd83; 0xdcf, 0xdd1; 0xdd8, 0xddf; 0xdf2, 0xdf3; 0xf3e, 0xf3f; - 0xf7f, 0xf7f; 0x102b, 0x102c; 0x1031, 0x1031; 0x1038, 0x1038; - 0x103b, 0x103c; 0x1056, 0x1057; 0x1062, 0x1064; 0x1067, 0x106d; - 0x1083, 0x1084; 0x1087, 0x108c; 0x108f, 0x108f; 0x109a, 0x109c; - 0x17b6, 0x17b6; 0x17be, 0x17c5; 0x17c7, 0x17c8; 0x1923, 0x1926; - 0x1929, 0x192b; 0x1930, 0x1931; 0x1933, 0x1938; 0x19b0, 0x19c0; - 0x19c8, 0x19c9; 0x1a19, 0x1a1a; 0x1a55, 0x1a55; 0x1a57, 0x1a57; - 0x1a61, 0x1a61; 0x1a63, 0x1a64; 0x1a6d, 0x1a72; 0x1b04, 0x1b04; - 0x1b35, 0x1b35; 0x1b3b, 0x1b3b; 0x1b3d, 0x1b41; 0x1b43, 0x1b44; - 0x1b82, 0x1b82; 0x1ba1, 0x1ba1; 0x1ba6, 0x1ba7; 0x1baa, 0x1baa; - 0x1bac, 0x1bad; 0x1be7, 0x1be7; 0x1bea, 0x1bec; 0x1bee, 0x1bee; - 0x1bf2, 0x1bf3; 0x1c24, 0x1c2b; 0x1c34, 0x1c35; 0x1ce1, 0x1ce1; - 0x1cf2, 0x1cf3; 0x302e, 0x302f; 0xa823, 0xa824; 0xa827, 0xa827; - 0xa880, 0xa881; 0xa8b4, 0xa8c3; 0xa952, 0xa953; 0xa983, 0xa983; - 0xa9b4, 0xa9b5; 0xa9ba, 0xa9bb; 0xa9bd, 0xa9c0; 0xaa2f, 0xaa30; - 0xaa33, 0xaa34; 0xaa4d, 0xaa4d; 0xaa7b, 0xaa7b; 0xaaeb, 0xaaeb; - 0xaaee, 0xaaef; 0xaaf5, 0xaaf5; 0xabe3, 0xabe4; 0xabe6, 0xabe7; - 0xabe9, 0xabea; 0xabec, 0xabec; 0x11000, 0x11000; 0x11002, 0x11002; - 0x11082, 0x11082; 0x110b0, 0x110b2; 0x110b7, 0x110b8; 0x1112c, 0x1112c; - 0x11182, 0x11182; 0x111b3, 0x111b5; 0x111bf, 0x111c0; 0x116ac, 0x116ac; - 0x116ae, 0x116af; 0x116b6, 0x116b6; 0x16f51, 0x16f7e; 0x1d165, 0x1d166; - 0x1d16d, 0x1d172] - - let me = [0x488, 0x489; 0x20dd, 0x20e0; 0x20e2, 0x20e4; 0xa670, 0xa672] - - let mn = - [0x300, 0x36f; 0x483, 0x487; 0x591, 0x5bd; 0x5bf, 0x5bf; 0x5c1, 0x5c2; - 0x5c4, 0x5c5; 0x5c7, 0x5c7; 0x610, 0x61a; 0x64b, 0x65f; 0x670, 0x670; - 0x6d6, 0x6dc; 0x6df, 0x6e4; 0x6e7, 0x6e8; 0x6ea, 0x6ed; 0x711, 0x711; - 0x730, 0x74a; 0x7a6, 0x7b0; 0x7eb, 0x7f3; 0x816, 0x819; 0x81b, 0x823; - 0x825, 0x827; 0x829, 0x82d; 0x859, 0x85b; 0x8e4, 0x8fe; 0x900, 0x902; - 0x93a, 0x93a; 0x93c, 0x93c; 0x941, 0x948; 0x94d, 0x94d; 0x951, 0x957; - 0x962, 0x963; 0x981, 0x981; 0x9bc, 0x9bc; 0x9c1, 0x9c4; 0x9cd, 0x9cd; - 0x9e2, 0x9e3; 0xa01, 0xa02; 0xa3c, 0xa3c; 0xa41, 0xa42; 0xa47, 0xa48; - 0xa4b, 0xa4d; 0xa51, 0xa51; 0xa70, 0xa71; 0xa75, 0xa75; 0xa81, 0xa82; - 0xabc, 0xabc; 0xac1, 0xac5; 0xac7, 0xac8; 0xacd, 0xacd; 0xae2, 0xae3; - 0xb01, 0xb01; 0xb3c, 0xb3c; 0xb3f, 0xb3f; 0xb41, 0xb44; 0xb4d, 0xb4d; - 0xb56, 0xb56; 0xb62, 0xb63; 0xb82, 0xb82; 0xbc0, 0xbc0; 0xbcd, 0xbcd; - 0xc3e, 0xc40; 0xc46, 0xc48; 0xc4a, 0xc4d; 0xc55, 0xc56; 0xc62, 0xc63; - 0xcbc, 0xcbc; 0xcbf, 0xcbf; 0xcc6, 0xcc6; 0xccc, 0xccd; 0xce2, 0xce3; - 0xd41, 0xd44; 0xd4d, 0xd4d; 0xd62, 0xd63; 0xdca, 0xdca; 0xdd2, 0xdd4; - 0xdd6, 0xdd6; 0xe31, 0xe31; 0xe34, 0xe3a; 0xe47, 0xe4e; 0xeb1, 0xeb1; - 0xeb4, 0xeb9; 0xebb, 0xebc; 0xec8, 0xecd; 0xf18, 0xf19; 0xf35, 0xf35; - 0xf37, 0xf37; 0xf39, 0xf39; 0xf71, 0xf7e; 0xf80, 0xf84; 0xf86, 0xf87; - 0xf8d, 0xf97; 0xf99, 0xfbc; 0xfc6, 0xfc6; 0x102d, 0x1030; 0x1032, 0x1037; - 0x1039, 0x103a; 0x103d, 0x103e; 0x1058, 0x1059; 0x105e, 0x1060; - 0x1071, 0x1074; 0x1082, 0x1082; 0x1085, 0x1086; 0x108d, 0x108d; - 0x109d, 0x109d; 0x135d, 0x135f; 0x1712, 0x1714; 0x1732, 0x1734; - 0x1752, 0x1753; 0x1772, 0x1773; 0x17b4, 0x17b5; 0x17b7, 0x17bd; - 0x17c6, 0x17c6; 0x17c9, 0x17d3; 0x17dd, 0x17dd; 0x180b, 0x180d; - 0x18a9, 0x18a9; 0x1920, 0x1922; 0x1927, 0x1928; 0x1932, 0x1932; - 0x1939, 0x193b; 0x1a17, 0x1a18; 0x1a1b, 0x1a1b; 0x1a56, 0x1a56; - 0x1a58, 0x1a5e; 0x1a60, 0x1a60; 0x1a62, 0x1a62; 0x1a65, 0x1a6c; - 0x1a73, 0x1a7c; 0x1a7f, 0x1a7f; 0x1b00, 0x1b03; 0x1b34, 0x1b34; - 0x1b36, 0x1b3a; 0x1b3c, 0x1b3c; 0x1b42, 0x1b42; 0x1b6b, 0x1b73; - 0x1b80, 0x1b81; 0x1ba2, 0x1ba5; 0x1ba8, 0x1ba9; 0x1bab, 0x1bab; - 0x1be6, 0x1be6; 0x1be8, 0x1be9; 0x1bed, 0x1bed; 0x1bef, 0x1bf1; - 0x1c2c, 0x1c33; 0x1c36, 0x1c37; 0x1cd0, 0x1cd2; 0x1cd4, 0x1ce0; - 0x1ce2, 0x1ce8; 0x1ced, 0x1ced; 0x1cf4, 0x1cf4; 0x1dc0, 0x1de6; - 0x1dfc, 0x1dff; 0x20d0, 0x20dc; 0x20e1, 0x20e1; 0x20e5, 0x20f0; - 0x2cef, 0x2cf1; 0x2d7f, 0x2d7f; 0x2de0, 0x2dff; 0x302a, 0x302d; - 0x3099, 0x309a; 0xa66f, 0xa66f; 0xa674, 0xa67d; 0xa69f, 0xa69f; - 0xa6f0, 0xa6f1; 0xa802, 0xa802; 0xa806, 0xa806; 0xa80b, 0xa80b; - 0xa825, 0xa826; 0xa8c4, 0xa8c4; 0xa8e0, 0xa8f1; 0xa926, 0xa92d; - 0xa947, 0xa951; 0xa980, 0xa982; 0xa9b3, 0xa9b3; 0xa9b6, 0xa9b9; - 0xa9bc, 0xa9bc; 0xaa29, 0xaa2e; 0xaa31, 0xaa32; 0xaa35, 0xaa36; - 0xaa43, 0xaa43; 0xaa4c, 0xaa4c; 0xaab0, 0xaab0; 0xaab2, 0xaab4; - 0xaab7, 0xaab8; 0xaabe, 0xaabf; 0xaac1, 0xaac1; 0xaaec, 0xaaed; - 0xaaf6, 0xaaf6; 0xabe5, 0xabe5; 0xabe8, 0xabe8; 0xabed, 0xabed; - 0xfb1e, 0xfb1e; 0xfe00, 0xfe0f; 0xfe20, 0xfe26; 0x101fd, 0x101fd; - 0x10a01, 0x10a03; 0x10a05, 0x10a06; 0x10a0c, 0x10a0f; 0x10a38, 0x10a3a; - 0x10a3f, 0x10a3f; 0x11001, 0x11001; 0x11038, 0x11046; 0x11080, 0x11081; - 0x110b3, 0x110b6; 0x110b9, 0x110ba; 0x11100, 0x11102; 0x11127, 0x1112b; - 0x1112d, 0x11134; 0x11180, 0x11181; 0x111b6, 0x111be; 0x116ab, 0x116ab; - 0x116ad, 0x116ad; 0x116b0, 0x116b5; 0x116b7, 0x116b7; 0x16f8f, 0x16f92; - 0x1d167, 0x1d169; 0x1d17b, 0x1d182; 0x1d185, 0x1d18b; 0x1d1aa, 0x1d1ad; - 0x1d242, 0x1d244; 0xe0100, 0xe01ef] - - let nd = - [0x30, 0x39; 0x660, 0x669; 0x6f0, 0x6f9; 0x7c0, 0x7c9; 0x966, 0x96f; - 0x9e6, 0x9ef; 0xa66, 0xa6f; 0xae6, 0xaef; 0xb66, 0xb6f; 0xbe6, 0xbef; - 0xc66, 0xc6f; 0xce6, 0xcef; 0xd66, 0xd6f; 0xe50, 0xe59; 0xed0, 0xed9; - 0xf20, 0xf29; 0x1040, 0x1049; 0x1090, 0x1099; 0x17e0, 0x17e9; - 0x1810, 0x1819; 0x1946, 0x194f; 0x19d0, 0x19d9; 0x1a80, 0x1a89; - 0x1a90, 0x1a99; 0x1b50, 0x1b59; 0x1bb0, 0x1bb9; 0x1c40, 0x1c49; - 0x1c50, 0x1c59; 0xa620, 0xa629; 0xa8d0, 0xa8d9; 0xa900, 0xa909; - 0xa9d0, 0xa9d9; 0xaa50, 0xaa59; 0xabf0, 0xabf9; 0xff10, 0xff19; - 0x104a0, 0x104a9; 0x11066, 0x1106f; 0x110f0, 0x110f9; 0x11136, 0x1113f; - 0x111d0, 0x111d9; 0x116c0, 0x116c9; 0x1d7ce, 0x1d7ff] - - let nl = - [0x16ee, 0x16f0; 0x2160, 0x2182; 0x2185, 0x2188; 0x3007, 0x3007; - 0x3021, 0x3029; 0x3038, 0x303a; 0xa6e6, 0xa6ef; 0x10140, 0x10174; - 0x10341, 0x10341; 0x1034a, 0x1034a; 0x103d1, 0x103d5; 0x12400, 0x12462] - - let no = - [0xb2, 0xb3; 0xb9, 0xb9; 0xbc, 0xbe; 0x9f4, 0x9f9; 0xb72, 0xb77; - 0xbf0, 0xbf2; 0xc78, 0xc7e; 0xd70, 0xd75; 0xf2a, 0xf33; 0x1369, 0x137c; - 0x17f0, 0x17f9; 0x19da, 0x19da; 0x2070, 0x2070; 0x2074, 0x2079; - 0x2080, 0x2089; 0x2150, 0x215f; 0x2189, 0x2189; 0x2460, 0x249b; - 0x24ea, 0x24ff; 0x2776, 0x2793; 0x2cfd, 0x2cfd; 0x3192, 0x3195; - 0x3220, 0x3229; 0x3248, 0x324f; 0x3251, 0x325f; 0x3280, 0x3289; - 0x32b1, 0x32bf; 0xa830, 0xa835; 0x10107, 0x10133; 0x10175, 0x10178; - 0x1018a, 0x1018a; 0x10320, 0x10323; 0x10858, 0x1085f; 0x10916, 0x1091b; - 0x10a40, 0x10a47; 0x10a7d, 0x10a7e; 0x10b58, 0x10b5f; 0x10b78, 0x10b7f; - 0x10e60, 0x10e7e; 0x11052, 0x11065; 0x1d360, 0x1d371; 0x1f100, 0x1f10a] - - let pc = - [0x5f, 0x5f; 0x203f, 0x2040; 0x2054, 0x2054; 0xfe33, 0xfe34; - 0xfe4d, 0xfe4f; 0xff3f, 0xff3f] - - let pd = - [0x2d, 0x2d; 0x58a, 0x58a; 0x5be, 0x5be; 0x1400, 0x1400; 0x1806, 0x1806; - 0x2010, 0x2015; 0x2e17, 0x2e17; 0x2e1a, 0x2e1a; 0x2e3a, 0x2e3b; - 0x301c, 0x301c; 0x3030, 0x3030; 0x30a0, 0x30a0; 0xfe31, 0xfe32; - 0xfe58, 0xfe58; 0xfe63, 0xfe63; 0xff0d, 0xff0d] - - let pe = - [0x29, 0x29; 0x5d, 0x5d; 0x7d, 0x7d; 0xf3b, 0xf3b; 0xf3d, 0xf3d; - 0x169c, 0x169c; 0x2046, 0x2046; 0x207e, 0x207e; 0x208e, 0x208e; - 0x2309, 0x2309; 0x230b, 0x230b; 0x232a, 0x232a; 0x2769, 0x2769; - 0x276b, 0x276b; 0x276d, 0x276d; 0x276f, 0x276f; 0x2771, 0x2771; - 0x2773, 0x2773; 0x2775, 0x2775; 0x27c6, 0x27c6; 0x27e7, 0x27e7; - 0x27e9, 0x27e9; 0x27eb, 0x27eb; 0x27ed, 0x27ed; 0x27ef, 0x27ef; - 0x2984, 0x2984; 0x2986, 0x2986; 0x2988, 0x2988; 0x298a, 0x298a; - 0x298c, 0x298c; 0x298e, 0x298e; 0x2990, 0x2990; 0x2992, 0x2992; - 0x2994, 0x2994; 0x2996, 0x2996; 0x2998, 0x2998; 0x29d9, 0x29d9; - 0x29db, 0x29db; 0x29fd, 0x29fd; 0x2e23, 0x2e23; 0x2e25, 0x2e25; - 0x2e27, 0x2e27; 0x2e29, 0x2e29; 0x3009, 0x3009; 0x300b, 0x300b; - 0x300d, 0x300d; 0x300f, 0x300f; 0x3011, 0x3011; 0x3015, 0x3015; - 0x3017, 0x3017; 0x3019, 0x3019; 0x301b, 0x301b; 0x301e, 0x301f; - 0xfd3f, 0xfd3f; 0xfe18, 0xfe18; 0xfe36, 0xfe36; 0xfe38, 0xfe38; - 0xfe3a, 0xfe3a; 0xfe3c, 0xfe3c; 0xfe3e, 0xfe3e; 0xfe40, 0xfe40; - 0xfe42, 0xfe42; 0xfe44, 0xfe44; 0xfe48, 0xfe48; 0xfe5a, 0xfe5a; - 0xfe5c, 0xfe5c; 0xfe5e, 0xfe5e; 0xff09, 0xff09; 0xff3d, 0xff3d; - 0xff5d, 0xff5d; 0xff60, 0xff60; 0xff63, 0xff63] - - let pf = - [0xbb, 0xbb; 0x2019, 0x2019; 0x201d, 0x201d; 0x203a, 0x203a; - 0x2e03, 0x2e03; 0x2e05, 0x2e05; 0x2e0a, 0x2e0a; 0x2e0d, 0x2e0d; - 0x2e1d, 0x2e1d; 0x2e21, 0x2e21] - - let pi = - [0xab, 0xab; 0x2018, 0x2018; 0x201b, 0x201c; 0x201f, 0x201f; - 0x2039, 0x2039; 0x2e02, 0x2e02; 0x2e04, 0x2e04; 0x2e09, 0x2e09; - 0x2e0c, 0x2e0c; 0x2e1c, 0x2e1c; 0x2e20, 0x2e20] - - let po = - [0x21, 0x23; 0x25, 0x27; 0x2a, 0x2a; 0x2c, 0x2c; 0x2e, 0x2f; 0x3a, 0x3b; - 0x3f, 0x40; 0x5c, 0x5c; 0xa1, 0xa1; 0xa7, 0xa7; 0xb6, 0xb7; 0xbf, 0xbf; - 0x37e, 0x37e; 0x387, 0x387; 0x55a, 0x55f; 0x589, 0x589; 0x5c0, 0x5c0; - 0x5c3, 0x5c3; 0x5c6, 0x5c6; 0x5f3, 0x5f4; 0x609, 0x60a; 0x60c, 0x60d; - 0x61b, 0x61b; 0x61e, 0x61f; 0x66a, 0x66d; 0x6d4, 0x6d4; 0x700, 0x70d; - 0x7f7, 0x7f9; 0x830, 0x83e; 0x85e, 0x85e; 0x964, 0x965; 0x970, 0x970; - 0xaf0, 0xaf0; 0xdf4, 0xdf4; 0xe4f, 0xe4f; 0xe5a, 0xe5b; 0xf04, 0xf12; - 0xf14, 0xf14; 0xf85, 0xf85; 0xfd0, 0xfd4; 0xfd9, 0xfda; 0x104a, 0x104f; - 0x10fb, 0x10fb; 0x1360, 0x1368; 0x166d, 0x166e; 0x16eb, 0x16ed; - 0x1735, 0x1736; 0x17d4, 0x17d6; 0x17d8, 0x17da; 0x1800, 0x1805; - 0x1807, 0x180a; 0x1944, 0x1945; 0x1a1e, 0x1a1f; 0x1aa0, 0x1aa6; - 0x1aa8, 0x1aad; 0x1b5a, 0x1b60; 0x1bfc, 0x1bff; 0x1c3b, 0x1c3f; - 0x1c7e, 0x1c7f; 0x1cc0, 0x1cc7; 0x1cd3, 0x1cd3; 0x2016, 0x2017; - 0x2020, 0x2027; 0x2030, 0x2038; 0x203b, 0x203e; 0x2041, 0x2043; - 0x2047, 0x2051; 0x2053, 0x2053; 0x2055, 0x205e; 0x2cf9, 0x2cfc; - 0x2cfe, 0x2cff; 0x2d70, 0x2d70; 0x2e00, 0x2e01; 0x2e06, 0x2e08; - 0x2e0b, 0x2e0b; 0x2e0e, 0x2e16; 0x2e18, 0x2e19; 0x2e1b, 0x2e1b; - 0x2e1e, 0x2e1f; 0x2e2a, 0x2e2e; 0x2e30, 0x2e39; 0x3001, 0x3003; - 0x303d, 0x303d; 0x30fb, 0x30fb; 0xa4fe, 0xa4ff; 0xa60d, 0xa60f; - 0xa673, 0xa673; 0xa67e, 0xa67e; 0xa6f2, 0xa6f7; 0xa874, 0xa877; - 0xa8ce, 0xa8cf; 0xa8f8, 0xa8fa; 0xa92e, 0xa92f; 0xa95f, 0xa95f; - 0xa9c1, 0xa9cd; 0xa9de, 0xa9df; 0xaa5c, 0xaa5f; 0xaade, 0xaadf; - 0xaaf0, 0xaaf1; 0xabeb, 0xabeb; 0xfe10, 0xfe16; 0xfe19, 0xfe19; - 0xfe30, 0xfe30; 0xfe45, 0xfe46; 0xfe49, 0xfe4c; 0xfe50, 0xfe52; - 0xfe54, 0xfe57; 0xfe5f, 0xfe61; 0xfe68, 0xfe68; 0xfe6a, 0xfe6b; - 0xff01, 0xff03; 0xff05, 0xff07; 0xff0a, 0xff0a; 0xff0c, 0xff0c; - 0xff0e, 0xff0f; 0xff1a, 0xff1b; 0xff1f, 0xff20; 0xff3c, 0xff3c; - 0xff61, 0xff61; 0xff64, 0xff65; 0x10100, 0x10102; 0x1039f, 0x1039f; - 0x103d0, 0x103d0; 0x10857, 0x10857; 0x1091f, 0x1091f; 0x1093f, 0x1093f; - 0x10a50, 0x10a58; 0x10a7f, 0x10a7f; 0x10b39, 0x10b3f; 0x11047, 0x1104d; - 0x110bb, 0x110bc; 0x110be, 0x110c1; 0x11140, 0x11143; 0x111c5, 0x111c8; - 0x12470, 0x12473] - - let ps = - [0x28, 0x28; 0x5b, 0x5b; 0x7b, 0x7b; 0xf3a, 0xf3a; 0xf3c, 0xf3c; - 0x169b, 0x169b; 0x201a, 0x201a; 0x201e, 0x201e; 0x2045, 0x2045; - 0x207d, 0x207d; 0x208d, 0x208d; 0x2308, 0x2308; 0x230a, 0x230a; - 0x2329, 0x2329; 0x2768, 0x2768; 0x276a, 0x276a; 0x276c, 0x276c; - 0x276e, 0x276e; 0x2770, 0x2770; 0x2772, 0x2772; 0x2774, 0x2774; - 0x27c5, 0x27c5; 0x27e6, 0x27e6; 0x27e8, 0x27e8; 0x27ea, 0x27ea; - 0x27ec, 0x27ec; 0x27ee, 0x27ee; 0x2983, 0x2983; 0x2985, 0x2985; - 0x2987, 0x2987; 0x2989, 0x2989; 0x298b, 0x298b; 0x298d, 0x298d; - 0x298f, 0x298f; 0x2991, 0x2991; 0x2993, 0x2993; 0x2995, 0x2995; - 0x2997, 0x2997; 0x29d8, 0x29d8; 0x29da, 0x29da; 0x29fc, 0x29fc; - 0x2e22, 0x2e22; 0x2e24, 0x2e24; 0x2e26, 0x2e26; 0x2e28, 0x2e28; - 0x3008, 0x3008; 0x300a, 0x300a; 0x300c, 0x300c; 0x300e, 0x300e; - 0x3010, 0x3010; 0x3014, 0x3014; 0x3016, 0x3016; 0x3018, 0x3018; - 0x301a, 0x301a; 0x301d, 0x301d; 0xfd3e, 0xfd3e; 0xfe17, 0xfe17; - 0xfe35, 0xfe35; 0xfe37, 0xfe37; 0xfe39, 0xfe39; 0xfe3b, 0xfe3b; - 0xfe3d, 0xfe3d; 0xfe3f, 0xfe3f; 0xfe41, 0xfe41; 0xfe43, 0xfe43; - 0xfe47, 0xfe47; 0xfe59, 0xfe59; 0xfe5b, 0xfe5b; 0xfe5d, 0xfe5d; - 0xff08, 0xff08; 0xff3b, 0xff3b; 0xff5b, 0xff5b; 0xff5f, 0xff5f; - 0xff62, 0xff62] - - let sc = - [0x24, 0x24; 0xa2, 0xa5; 0x58f, 0x58f; 0x60b, 0x60b; 0x9f2, 0x9f3; - 0x9fb, 0x9fb; 0xaf1, 0xaf1; 0xbf9, 0xbf9; 0xe3f, 0xe3f; 0x17db, 0x17db; - 0x20a0, 0x20ba; 0xa838, 0xa838; 0xfdfc, 0xfdfc; 0xfe69, 0xfe69; - 0xff04, 0xff04; 0xffe0, 0xffe1; 0xffe5, 0xffe6] - - let sk = - [0x5e, 0x5e; 0x60, 0x60; 0xa8, 0xa8; 0xaf, 0xaf; 0xb4, 0xb4; 0xb8, 0xb8; - 0x2c2, 0x2c5; 0x2d2, 0x2df; 0x2e5, 0x2eb; 0x2ed, 0x2ed; 0x2ef, 0x2ff; - 0x375, 0x375; 0x384, 0x385; 0x1fbd, 0x1fbd; 0x1fbf, 0x1fc1; - 0x1fcd, 0x1fcf; 0x1fdd, 0x1fdf; 0x1fed, 0x1fef; 0x1ffd, 0x1ffe; - 0x309b, 0x309c; 0xa700, 0xa716; 0xa720, 0xa721; 0xa789, 0xa78a; - 0xfbb2, 0xfbc1; 0xff3e, 0xff3e; 0xff40, 0xff40; 0xffe3, 0xffe3] - - let sm = - [0x2b, 0x2b; 0x3c, 0x3e; 0x7c, 0x7c; 0x7e, 0x7e; 0xac, 0xac; 0xb1, 0xb1; - 0xd7, 0xd7; 0xf7, 0xf7; 0x3f6, 0x3f6; 0x606, 0x608; 0x2044, 0x2044; - 0x2052, 0x2052; 0x207a, 0x207c; 0x208a, 0x208c; 0x2118, 0x2118; - 0x2140, 0x2144; 0x214b, 0x214b; 0x2190, 0x2194; 0x219a, 0x219b; - 0x21a0, 0x21a0; 0x21a3, 0x21a3; 0x21a6, 0x21a6; 0x21ae, 0x21ae; - 0x21ce, 0x21cf; 0x21d2, 0x21d2; 0x21d4, 0x21d4; 0x21f4, 0x22ff; - 0x2320, 0x2321; 0x237c, 0x237c; 0x239b, 0x23b3; 0x23dc, 0x23e1; - 0x25b7, 0x25b7; 0x25c1, 0x25c1; 0x25f8, 0x25ff; 0x266f, 0x266f; - 0x27c0, 0x27c4; 0x27c7, 0x27e5; 0x27f0, 0x27ff; 0x2900, 0x2982; - 0x2999, 0x29d7; 0x29dc, 0x29fb; 0x29fe, 0x2aff; 0x2b30, 0x2b44; - 0x2b47, 0x2b4c; 0xfb29, 0xfb29; 0xfe62, 0xfe62; 0xfe64, 0xfe66; - 0xff0b, 0xff0b; 0xff1c, 0xff1e; 0xff5c, 0xff5c; 0xff5e, 0xff5e; - 0xffe2, 0xffe2; 0xffe9, 0xffec; 0x1d6c1, 0x1d6c1; 0x1d6db, 0x1d6db; - 0x1d6fb, 0x1d6fb; 0x1d715, 0x1d715; 0x1d735, 0x1d735; 0x1d74f, 0x1d74f; - 0x1d76f, 0x1d76f; 0x1d789, 0x1d789; 0x1d7a9, 0x1d7a9; 0x1d7c3, 0x1d7c3; - 0x1eef0, 0x1eef1] - - let so = - [0xa6, 0xa6; 0xa9, 0xa9; 0xae, 0xae; 0xb0, 0xb0; 0x482, 0x482; - 0x60e, 0x60f; 0x6de, 0x6de; 0x6e9, 0x6e9; 0x6fd, 0x6fe; 0x7f6, 0x7f6; - 0x9fa, 0x9fa; 0xb70, 0xb70; 0xbf3, 0xbf8; 0xbfa, 0xbfa; 0xc7f, 0xc7f; - 0xd79, 0xd79; 0xf01, 0xf03; 0xf13, 0xf13; 0xf15, 0xf17; 0xf1a, 0xf1f; - 0xf34, 0xf34; 0xf36, 0xf36; 0xf38, 0xf38; 0xfbe, 0xfc5; 0xfc7, 0xfcc; - 0xfce, 0xfcf; 0xfd5, 0xfd8; 0x109e, 0x109f; 0x1390, 0x1399; - 0x1940, 0x1940; 0x19de, 0x19ff; 0x1b61, 0x1b6a; 0x1b74, 0x1b7c; - 0x2100, 0x2101; 0x2103, 0x2106; 0x2108, 0x2109; 0x2114, 0x2114; - 0x2116, 0x2117; 0x211e, 0x2123; 0x2125, 0x2125; 0x2127, 0x2127; - 0x2129, 0x2129; 0x212e, 0x212e; 0x213a, 0x213b; 0x214a, 0x214a; - 0x214c, 0x214d; 0x214f, 0x214f; 0x2195, 0x2199; 0x219c, 0x219f; - 0x21a1, 0x21a2; 0x21a4, 0x21a5; 0x21a7, 0x21ad; 0x21af, 0x21cd; - 0x21d0, 0x21d1; 0x21d3, 0x21d3; 0x21d5, 0x21f3; 0x2300, 0x2307; - 0x230c, 0x231f; 0x2322, 0x2328; 0x232b, 0x237b; 0x237d, 0x239a; - 0x23b4, 0x23db; 0x23e2, 0x23f3; 0x2400, 0x2426; 0x2440, 0x244a; - 0x249c, 0x24e9; 0x2500, 0x25b6; 0x25b8, 0x25c0; 0x25c2, 0x25f7; - 0x2600, 0x266e; 0x2670, 0x26ff; 0x2701, 0x2767; 0x2794, 0x27bf; - 0x2800, 0x28ff; 0x2b00, 0x2b2f; 0x2b45, 0x2b46; 0x2b50, 0x2b59; - 0x2ce5, 0x2cea; 0x2e80, 0x2e99; 0x2e9b, 0x2ef3; 0x2f00, 0x2fd5; - 0x2ff0, 0x2ffb; 0x3004, 0x3004; 0x3012, 0x3013; 0x3020, 0x3020; - 0x3036, 0x3037; 0x303e, 0x303f; 0x3190, 0x3191; 0x3196, 0x319f; - 0x31c0, 0x31e3; 0x3200, 0x321e; 0x322a, 0x3247; 0x3250, 0x3250; - 0x3260, 0x327f; 0x328a, 0x32b0; 0x32c0, 0x32fe; 0x3300, 0x33ff; - 0x4dc0, 0x4dff; 0xa490, 0xa4c6; 0xa828, 0xa82b; 0xa836, 0xa837; - 0xa839, 0xa839; 0xaa77, 0xaa79; 0xfdfd, 0xfdfd; 0xffe4, 0xffe4; - 0xffe8, 0xffe8; 0xffed, 0xffee; 0xfffc, 0xfffd; 0x10137, 0x1013f; - 0x10179, 0x10189; 0x10190, 0x1019b; 0x101d0, 0x101fc; 0x1d000, 0x1d0f5; - 0x1d100, 0x1d126; 0x1d129, 0x1d164; 0x1d16a, 0x1d16c; 0x1d183, 0x1d184; - 0x1d18c, 0x1d1a9; 0x1d1ae, 0x1d1dd; 0x1d200, 0x1d241; 0x1d245, 0x1d245; - 0x1d300, 0x1d356; 0x1f000, 0x1f02b; 0x1f030, 0x1f093; 0x1f0a0, 0x1f0ae; - 0x1f0b1, 0x1f0be; 0x1f0c1, 0x1f0cf; 0x1f0d1, 0x1f0df; 0x1f110, 0x1f12e; - 0x1f130, 0x1f16b; 0x1f170, 0x1f19a; 0x1f1e6, 0x1f202; 0x1f210, 0x1f23a; - 0x1f240, 0x1f248; 0x1f250, 0x1f251; 0x1f300, 0x1f320; 0x1f330, 0x1f335; - 0x1f337, 0x1f37c; 0x1f380, 0x1f393; 0x1f3a0, 0x1f3c4; 0x1f3c6, 0x1f3ca; - 0x1f3e0, 0x1f3f0; 0x1f400, 0x1f43e; 0x1f440, 0x1f440; 0x1f442, 0x1f4f7; - 0x1f4f9, 0x1f4fc; 0x1f500, 0x1f53d; 0x1f540, 0x1f543; 0x1f550, 0x1f567; - 0x1f5fb, 0x1f640; 0x1f645, 0x1f64f; 0x1f680, 0x1f6c5; 0x1f700, 0x1f773] - - let zl = [0x2028, 0x2028] - - let zp = [0x2029, 0x2029] - - let zs = - [0x20, 0x20; 0xa0, 0xa0; 0x1680, 0x1680; 0x2000, 0x200a; 0x202f, 0x202f; - 0x205f, 0x205f; 0x3000, 0x3000] - -end - -module Properties = struct - - let alphabetic = - [0x41, 0x5a; 0x61, 0x7a; 0xaa, 0xaa; 0xb5, 0xb5; 0xba, 0xba; 0xc0, 0xd6; - 0xd8, 0xf6; 0xf8, 0x2c1; 0x2c6, 0x2d1; 0x2e0, 0x2e4; 0x2ec, 0x2ec; - 0x2ee, 0x2ee; 0x345, 0x345; 0x370, 0x374; 0x376, 0x377; 0x37a, 0x37d; - 0x386, 0x386; 0x388, 0x38a; 0x38c, 0x38c; 0x38e, 0x3a1; 0x3a3, 0x3f5; - 0x3f7, 0x481; 0x48a, 0x527; 0x531, 0x556; 0x559, 0x559; 0x561, 0x587; - 0x5b0, 0x5bd; 0x5bf, 0x5bf; 0x5c1, 0x5c2; 0x5c4, 0x5c5; 0x5c7, 0x5c7; - 0x5d0, 0x5ea; 0x5f0, 0x5f2; 0x610, 0x61a; 0x620, 0x657; 0x659, 0x65f; - 0x66e, 0x6d3; 0x6d5, 0x6dc; 0x6e1, 0x6e8; 0x6ed, 0x6ef; 0x6fa, 0x6fc; - 0x6ff, 0x6ff; 0x710, 0x73f; 0x74d, 0x7b1; 0x7ca, 0x7ea; 0x7f4, 0x7f5; - 0x7fa, 0x7fa; 0x800, 0x817; 0x81a, 0x82c; 0x840, 0x858; 0x8a0, 0x8a0; - 0x8a2, 0x8ac; 0x8e4, 0x8e9; 0x8f0, 0x8fe; 0x900, 0x93b; 0x93d, 0x94c; - 0x94e, 0x950; 0x955, 0x963; 0x971, 0x977; 0x979, 0x97f; 0x981, 0x983; - 0x985, 0x98c; 0x98f, 0x990; 0x993, 0x9a8; 0x9aa, 0x9b0; 0x9b2, 0x9b2; - 0x9b6, 0x9b9; 0x9bd, 0x9c4; 0x9c7, 0x9c8; 0x9cb, 0x9cc; 0x9ce, 0x9ce; - 0x9d7, 0x9d7; 0x9dc, 0x9dd; 0x9df, 0x9e3; 0x9f0, 0x9f1; 0xa01, 0xa03; - 0xa05, 0xa0a; 0xa0f, 0xa10; 0xa13, 0xa28; 0xa2a, 0xa30; 0xa32, 0xa33; - 0xa35, 0xa36; 0xa38, 0xa39; 0xa3e, 0xa42; 0xa47, 0xa48; 0xa4b, 0xa4c; - 0xa51, 0xa51; 0xa59, 0xa5c; 0xa5e, 0xa5e; 0xa70, 0xa75; 0xa81, 0xa83; - 0xa85, 0xa8d; 0xa8f, 0xa91; 0xa93, 0xaa8; 0xaaa, 0xab0; 0xab2, 0xab3; - 0xab5, 0xab9; 0xabd, 0xac5; 0xac7, 0xac9; 0xacb, 0xacc; 0xad0, 0xad0; - 0xae0, 0xae3; 0xb01, 0xb03; 0xb05, 0xb0c; 0xb0f, 0xb10; 0xb13, 0xb28; - 0xb2a, 0xb30; 0xb32, 0xb33; 0xb35, 0xb39; 0xb3d, 0xb44; 0xb47, 0xb48; - 0xb4b, 0xb4c; 0xb56, 0xb57; 0xb5c, 0xb5d; 0xb5f, 0xb63; 0xb71, 0xb71; - 0xb82, 0xb83; 0xb85, 0xb8a; 0xb8e, 0xb90; 0xb92, 0xb95; 0xb99, 0xb9a; - 0xb9c, 0xb9c; 0xb9e, 0xb9f; 0xba3, 0xba4; 0xba8, 0xbaa; 0xbae, 0xbb9; - 0xbbe, 0xbc2; 0xbc6, 0xbc8; 0xbca, 0xbcc; 0xbd0, 0xbd0; 0xbd7, 0xbd7; - 0xc01, 0xc03; 0xc05, 0xc0c; 0xc0e, 0xc10; 0xc12, 0xc28; 0xc2a, 0xc33; - 0xc35, 0xc39; 0xc3d, 0xc44; 0xc46, 0xc48; 0xc4a, 0xc4c; 0xc55, 0xc56; - 0xc58, 0xc59; 0xc60, 0xc63; 0xc82, 0xc83; 0xc85, 0xc8c; 0xc8e, 0xc90; - 0xc92, 0xca8; 0xcaa, 0xcb3; 0xcb5, 0xcb9; 0xcbd, 0xcc4; 0xcc6, 0xcc8; - 0xcca, 0xccc; 0xcd5, 0xcd6; 0xcde, 0xcde; 0xce0, 0xce3; 0xcf1, 0xcf2; - 0xd02, 0xd03; 0xd05, 0xd0c; 0xd0e, 0xd10; 0xd12, 0xd3a; 0xd3d, 0xd44; - 0xd46, 0xd48; 0xd4a, 0xd4c; 0xd4e, 0xd4e; 0xd57, 0xd57; 0xd60, 0xd63; - 0xd7a, 0xd7f; 0xd82, 0xd83; 0xd85, 0xd96; 0xd9a, 0xdb1; 0xdb3, 0xdbb; - 0xdbd, 0xdbd; 0xdc0, 0xdc6; 0xdcf, 0xdd4; 0xdd6, 0xdd6; 0xdd8, 0xddf; - 0xdf2, 0xdf3; 0xe01, 0xe3a; 0xe40, 0xe46; 0xe4d, 0xe4d; 0xe81, 0xe82; - 0xe84, 0xe84; 0xe87, 0xe88; 0xe8a, 0xe8a; 0xe8d, 0xe8d; 0xe94, 0xe97; - 0xe99, 0xe9f; 0xea1, 0xea3; 0xea5, 0xea5; 0xea7, 0xea7; 0xeaa, 0xeab; - 0xead, 0xeb9; 0xebb, 0xebd; 0xec0, 0xec4; 0xec6, 0xec6; 0xecd, 0xecd; - 0xedc, 0xedf; 0xf00, 0xf00; 0xf40, 0xf47; 0xf49, 0xf6c; 0xf71, 0xf81; - 0xf88, 0xf97; 0xf99, 0xfbc; 0x1000, 0x1036; 0x1038, 0x1038; - 0x103b, 0x103f; 0x1050, 0x1062; 0x1065, 0x1068; 0x106e, 0x1086; - 0x108e, 0x108e; 0x109c, 0x109d; 0x10a0, 0x10c5; 0x10c7, 0x10c7; - 0x10cd, 0x10cd; 0x10d0, 0x10fa; 0x10fc, 0x1248; 0x124a, 0x124d; - 0x1250, 0x1256; 0x1258, 0x1258; 0x125a, 0x125d; 0x1260, 0x1288; - 0x128a, 0x128d; 0x1290, 0x12b0; 0x12b2, 0x12b5; 0x12b8, 0x12be; - 0x12c0, 0x12c0; 0x12c2, 0x12c5; 0x12c8, 0x12d6; 0x12d8, 0x1310; - 0x1312, 0x1315; 0x1318, 0x135a; 0x135f, 0x135f; 0x1380, 0x138f; - 0x13a0, 0x13f4; 0x1401, 0x166c; 0x166f, 0x167f; 0x1681, 0x169a; - 0x16a0, 0x16ea; 0x16ee, 0x16f0; 0x1700, 0x170c; 0x170e, 0x1713; - 0x1720, 0x1733; 0x1740, 0x1753; 0x1760, 0x176c; 0x176e, 0x1770; - 0x1772, 0x1773; 0x1780, 0x17b3; 0x17b6, 0x17c8; 0x17d7, 0x17d7; - 0x17dc, 0x17dc; 0x1820, 0x1877; 0x1880, 0x18aa; 0x18b0, 0x18f5; - 0x1900, 0x191c; 0x1920, 0x192b; 0x1930, 0x1938; 0x1950, 0x196d; - 0x1970, 0x1974; 0x1980, 0x19ab; 0x19b0, 0x19c9; 0x1a00, 0x1a1b; - 0x1a20, 0x1a5e; 0x1a61, 0x1a74; 0x1aa7, 0x1aa7; 0x1b00, 0x1b33; - 0x1b35, 0x1b43; 0x1b45, 0x1b4b; 0x1b80, 0x1ba9; 0x1bac, 0x1baf; - 0x1bba, 0x1be5; 0x1be7, 0x1bf1; 0x1c00, 0x1c35; 0x1c4d, 0x1c4f; - 0x1c5a, 0x1c7d; 0x1ce9, 0x1cec; 0x1cee, 0x1cf3; 0x1cf5, 0x1cf6; - 0x1d00, 0x1dbf; 0x1e00, 0x1f15; 0x1f18, 0x1f1d; 0x1f20, 0x1f45; - 0x1f48, 0x1f4d; 0x1f50, 0x1f57; 0x1f59, 0x1f59; 0x1f5b, 0x1f5b; - 0x1f5d, 0x1f5d; 0x1f5f, 0x1f7d; 0x1f80, 0x1fb4; 0x1fb6, 0x1fbc; - 0x1fbe, 0x1fbe; 0x1fc2, 0x1fc4; 0x1fc6, 0x1fcc; 0x1fd0, 0x1fd3; - 0x1fd6, 0x1fdb; 0x1fe0, 0x1fec; 0x1ff2, 0x1ff4; 0x1ff6, 0x1ffc; - 0x2071, 0x2071; 0x207f, 0x207f; 0x2090, 0x209c; 0x2102, 0x2102; - 0x2107, 0x2107; 0x210a, 0x2113; 0x2115, 0x2115; 0x2119, 0x211d; - 0x2124, 0x2124; 0x2126, 0x2126; 0x2128, 0x2128; 0x212a, 0x212d; - 0x212f, 0x2139; 0x213c, 0x213f; 0x2145, 0x2149; 0x214e, 0x214e; - 0x2160, 0x2188; 0x24b6, 0x24e9; 0x2c00, 0x2c2e; 0x2c30, 0x2c5e; - 0x2c60, 0x2ce4; 0x2ceb, 0x2cee; 0x2cf2, 0x2cf3; 0x2d00, 0x2d25; - 0x2d27, 0x2d27; 0x2d2d, 0x2d2d; 0x2d30, 0x2d67; 0x2d6f, 0x2d6f; - 0x2d80, 0x2d96; 0x2da0, 0x2da6; 0x2da8, 0x2dae; 0x2db0, 0x2db6; - 0x2db8, 0x2dbe; 0x2dc0, 0x2dc6; 0x2dc8, 0x2dce; 0x2dd0, 0x2dd6; - 0x2dd8, 0x2dde; 0x2de0, 0x2dff; 0x2e2f, 0x2e2f; 0x3005, 0x3007; - 0x3021, 0x3029; 0x3031, 0x3035; 0x3038, 0x303c; 0x3041, 0x3096; - 0x309d, 0x309f; 0x30a1, 0x30fa; 0x30fc, 0x30ff; 0x3105, 0x312d; - 0x3131, 0x318e; 0x31a0, 0x31ba; 0x31f0, 0x31ff; 0x3400, 0x4db5; - 0x4e00, 0x9fcc; 0xa000, 0xa48c; 0xa4d0, 0xa4fd; 0xa500, 0xa60c; - 0xa610, 0xa61f; 0xa62a, 0xa62b; 0xa640, 0xa66e; 0xa674, 0xa67b; - 0xa67f, 0xa697; 0xa69f, 0xa6ef; 0xa717, 0xa71f; 0xa722, 0xa788; - 0xa78b, 0xa78e; 0xa790, 0xa793; 0xa7a0, 0xa7aa; 0xa7f8, 0xa801; - 0xa803, 0xa805; 0xa807, 0xa80a; 0xa80c, 0xa827; 0xa840, 0xa873; - 0xa880, 0xa8c3; 0xa8f2, 0xa8f7; 0xa8fb, 0xa8fb; 0xa90a, 0xa92a; - 0xa930, 0xa952; 0xa960, 0xa97c; 0xa980, 0xa9b2; 0xa9b4, 0xa9bf; - 0xa9cf, 0xa9cf; 0xaa00, 0xaa36; 0xaa40, 0xaa4d; 0xaa60, 0xaa76; - 0xaa7a, 0xaa7a; 0xaa80, 0xaabe; 0xaac0, 0xaac0; 0xaac2, 0xaac2; - 0xaadb, 0xaadd; 0xaae0, 0xaaef; 0xaaf2, 0xaaf5; 0xab01, 0xab06; - 0xab09, 0xab0e; 0xab11, 0xab16; 0xab20, 0xab26; 0xab28, 0xab2e; - 0xabc0, 0xabea; 0xac00, 0xd7a3; 0xd7b0, 0xd7c6; 0xd7cb, 0xd7fb; - 0xf900, 0xfa6d; 0xfa70, 0xfad9; 0xfb00, 0xfb06; 0xfb13, 0xfb17; - 0xfb1d, 0xfb28; 0xfb2a, 0xfb36; 0xfb38, 0xfb3c; 0xfb3e, 0xfb3e; - 0xfb40, 0xfb41; 0xfb43, 0xfb44; 0xfb46, 0xfbb1; 0xfbd3, 0xfd3d; - 0xfd50, 0xfd8f; 0xfd92, 0xfdc7; 0xfdf0, 0xfdfb; 0xfe70, 0xfe74; - 0xfe76, 0xfefc; 0xff21, 0xff3a; 0xff41, 0xff5a; 0xff66, 0xffbe; - 0xffc2, 0xffc7; 0xffca, 0xffcf; 0xffd2, 0xffd7; 0xffda, 0xffdc; - 0x10000, 0x1000b; 0x1000d, 0x10026; 0x10028, 0x1003a; 0x1003c, 0x1003d; - 0x1003f, 0x1004d; 0x10050, 0x1005d; 0x10080, 0x100fa; 0x10140, 0x10174; - 0x10280, 0x1029c; 0x102a0, 0x102d0; 0x10300, 0x1031e; 0x10330, 0x1034a; - 0x10380, 0x1039d; 0x103a0, 0x103c3; 0x103c8, 0x103cf; 0x103d1, 0x103d5; - 0x10400, 0x1049d; 0x10800, 0x10805; 0x10808, 0x10808; 0x1080a, 0x10835; - 0x10837, 0x10838; 0x1083c, 0x1083c; 0x1083f, 0x10855; 0x10900, 0x10915; - 0x10920, 0x10939; 0x10980, 0x109b7; 0x109be, 0x109bf; 0x10a00, 0x10a03; - 0x10a05, 0x10a06; 0x10a0c, 0x10a13; 0x10a15, 0x10a17; 0x10a19, 0x10a33; - 0x10a60, 0x10a7c; 0x10b00, 0x10b35; 0x10b40, 0x10b55; 0x10b60, 0x10b72; - 0x10c00, 0x10c48; 0x11000, 0x11045; 0x11082, 0x110b8; 0x110d0, 0x110e8; - 0x11100, 0x11132; 0x11180, 0x111bf; 0x111c1, 0x111c4; 0x11680, 0x116b5; - 0x12000, 0x1236e; 0x12400, 0x12462; 0x13000, 0x1342e; 0x16800, 0x16a38; - 0x16f00, 0x16f44; 0x16f50, 0x16f7e; 0x16f93, 0x16f9f; 0x1b000, 0x1b001; - 0x1d400, 0x1d454; 0x1d456, 0x1d49c; 0x1d49e, 0x1d49f; 0x1d4a2, 0x1d4a2; - 0x1d4a5, 0x1d4a6; 0x1d4a9, 0x1d4ac; 0x1d4ae, 0x1d4b9; 0x1d4bb, 0x1d4bb; - 0x1d4bd, 0x1d4c3; 0x1d4c5, 0x1d505; 0x1d507, 0x1d50a; 0x1d50d, 0x1d514; - 0x1d516, 0x1d51c; 0x1d51e, 0x1d539; 0x1d53b, 0x1d53e; 0x1d540, 0x1d544; - 0x1d546, 0x1d546; 0x1d54a, 0x1d550; 0x1d552, 0x1d6a5; 0x1d6a8, 0x1d6c0; - 0x1d6c2, 0x1d6da; 0x1d6dc, 0x1d6fa; 0x1d6fc, 0x1d714; 0x1d716, 0x1d734; - 0x1d736, 0x1d74e; 0x1d750, 0x1d76e; 0x1d770, 0x1d788; 0x1d78a, 0x1d7a8; - 0x1d7aa, 0x1d7c2; 0x1d7c4, 0x1d7cb; 0x1ee00, 0x1ee03; 0x1ee05, 0x1ee1f; - 0x1ee21, 0x1ee22; 0x1ee24, 0x1ee24; 0x1ee27, 0x1ee27; 0x1ee29, 0x1ee32; - 0x1ee34, 0x1ee37; 0x1ee39, 0x1ee39; 0x1ee3b, 0x1ee3b; 0x1ee42, 0x1ee42; - 0x1ee47, 0x1ee47; 0x1ee49, 0x1ee49; 0x1ee4b, 0x1ee4b; 0x1ee4d, 0x1ee4f; - 0x1ee51, 0x1ee52; 0x1ee54, 0x1ee54; 0x1ee57, 0x1ee57; 0x1ee59, 0x1ee59; - 0x1ee5b, 0x1ee5b; 0x1ee5d, 0x1ee5d; 0x1ee5f, 0x1ee5f; 0x1ee61, 0x1ee62; - 0x1ee64, 0x1ee64; 0x1ee67, 0x1ee6a; 0x1ee6c, 0x1ee72; 0x1ee74, 0x1ee77; - 0x1ee79, 0x1ee7c; 0x1ee7e, 0x1ee7e; 0x1ee80, 0x1ee89; 0x1ee8b, 0x1ee9b; - 0x1eea1, 0x1eea3; 0x1eea5, 0x1eea9; 0x1eeab, 0x1eebb; 0x20000, 0x2a6d6; - 0x2a700, 0x2b734; 0x2b740, 0x2b81d; 0x2f800, 0x2fa1d] - - let ascii_hex_digit = [0x30, 0x39; 0x41, 0x46; 0x61, 0x66] - - let hex_digit = - [0x30, 0x39; 0x41, 0x46; 0x61, 0x66; 0xff10, 0xff19; 0xff21, 0xff26; - 0xff41, 0xff46] - - let id_continue = - [0x30, 0x39; 0x41, 0x5a; 0x5f, 0x5f; 0x61, 0x7a; 0xaa, 0xaa; 0xb5, 0xb5; - 0xb7, 0xb7; 0xba, 0xba; 0xc0, 0xd6; 0xd8, 0xf6; 0xf8, 0x2c1; - 0x2c6, 0x2d1; 0x2e0, 0x2e4; 0x2ec, 0x2ec; 0x2ee, 0x2ee; 0x300, 0x374; - 0x376, 0x377; 0x37a, 0x37d; 0x386, 0x38a; 0x38c, 0x38c; 0x38e, 0x3a1; - 0x3a3, 0x3f5; 0x3f7, 0x481; 0x483, 0x487; 0x48a, 0x527; 0x531, 0x556; - 0x559, 0x559; 0x561, 0x587; 0x591, 0x5bd; 0x5bf, 0x5bf; 0x5c1, 0x5c2; - 0x5c4, 0x5c5; 0x5c7, 0x5c7; 0x5d0, 0x5ea; 0x5f0, 0x5f2; 0x610, 0x61a; - 0x620, 0x669; 0x66e, 0x6d3; 0x6d5, 0x6dc; 0x6df, 0x6e8; 0x6ea, 0x6fc; - 0x6ff, 0x6ff; 0x710, 0x74a; 0x74d, 0x7b1; 0x7c0, 0x7f5; 0x7fa, 0x7fa; - 0x800, 0x82d; 0x840, 0x85b; 0x8a0, 0x8a0; 0x8a2, 0x8ac; 0x8e4, 0x8fe; - 0x900, 0x963; 0x966, 0x96f; 0x971, 0x977; 0x979, 0x97f; 0x981, 0x983; - 0x985, 0x98c; 0x98f, 0x990; 0x993, 0x9a8; 0x9aa, 0x9b0; 0x9b2, 0x9b2; - 0x9b6, 0x9b9; 0x9bc, 0x9c4; 0x9c7, 0x9c8; 0x9cb, 0x9ce; 0x9d7, 0x9d7; - 0x9dc, 0x9dd; 0x9df, 0x9e3; 0x9e6, 0x9f1; 0xa01, 0xa03; 0xa05, 0xa0a; - 0xa0f, 0xa10; 0xa13, 0xa28; 0xa2a, 0xa30; 0xa32, 0xa33; 0xa35, 0xa36; - 0xa38, 0xa39; 0xa3c, 0xa3c; 0xa3e, 0xa42; 0xa47, 0xa48; 0xa4b, 0xa4d; - 0xa51, 0xa51; 0xa59, 0xa5c; 0xa5e, 0xa5e; 0xa66, 0xa75; 0xa81, 0xa83; - 0xa85, 0xa8d; 0xa8f, 0xa91; 0xa93, 0xaa8; 0xaaa, 0xab0; 0xab2, 0xab3; - 0xab5, 0xab9; 0xabc, 0xac5; 0xac7, 0xac9; 0xacb, 0xacd; 0xad0, 0xad0; - 0xae0, 0xae3; 0xae6, 0xaef; 0xb01, 0xb03; 0xb05, 0xb0c; 0xb0f, 0xb10; - 0xb13, 0xb28; 0xb2a, 0xb30; 0xb32, 0xb33; 0xb35, 0xb39; 0xb3c, 0xb44; - 0xb47, 0xb48; 0xb4b, 0xb4d; 0xb56, 0xb57; 0xb5c, 0xb5d; 0xb5f, 0xb63; - 0xb66, 0xb6f; 0xb71, 0xb71; 0xb82, 0xb83; 0xb85, 0xb8a; 0xb8e, 0xb90; - 0xb92, 0xb95; 0xb99, 0xb9a; 0xb9c, 0xb9c; 0xb9e, 0xb9f; 0xba3, 0xba4; - 0xba8, 0xbaa; 0xbae, 0xbb9; 0xbbe, 0xbc2; 0xbc6, 0xbc8; 0xbca, 0xbcd; - 0xbd0, 0xbd0; 0xbd7, 0xbd7; 0xbe6, 0xbef; 0xc01, 0xc03; 0xc05, 0xc0c; - 0xc0e, 0xc10; 0xc12, 0xc28; 0xc2a, 0xc33; 0xc35, 0xc39; 0xc3d, 0xc44; - 0xc46, 0xc48; 0xc4a, 0xc4d; 0xc55, 0xc56; 0xc58, 0xc59; 0xc60, 0xc63; - 0xc66, 0xc6f; 0xc82, 0xc83; 0xc85, 0xc8c; 0xc8e, 0xc90; 0xc92, 0xca8; - 0xcaa, 0xcb3; 0xcb5, 0xcb9; 0xcbc, 0xcc4; 0xcc6, 0xcc8; 0xcca, 0xccd; - 0xcd5, 0xcd6; 0xcde, 0xcde; 0xce0, 0xce3; 0xce6, 0xcef; 0xcf1, 0xcf2; - 0xd02, 0xd03; 0xd05, 0xd0c; 0xd0e, 0xd10; 0xd12, 0xd3a; 0xd3d, 0xd44; - 0xd46, 0xd48; 0xd4a, 0xd4e; 0xd57, 0xd57; 0xd60, 0xd63; 0xd66, 0xd6f; - 0xd7a, 0xd7f; 0xd82, 0xd83; 0xd85, 0xd96; 0xd9a, 0xdb1; 0xdb3, 0xdbb; - 0xdbd, 0xdbd; 0xdc0, 0xdc6; 0xdca, 0xdca; 0xdcf, 0xdd4; 0xdd6, 0xdd6; - 0xdd8, 0xddf; 0xdf2, 0xdf3; 0xe01, 0xe3a; 0xe40, 0xe4e; 0xe50, 0xe59; - 0xe81, 0xe82; 0xe84, 0xe84; 0xe87, 0xe88; 0xe8a, 0xe8a; 0xe8d, 0xe8d; - 0xe94, 0xe97; 0xe99, 0xe9f; 0xea1, 0xea3; 0xea5, 0xea5; 0xea7, 0xea7; - 0xeaa, 0xeab; 0xead, 0xeb9; 0xebb, 0xebd; 0xec0, 0xec4; 0xec6, 0xec6; - 0xec8, 0xecd; 0xed0, 0xed9; 0xedc, 0xedf; 0xf00, 0xf00; 0xf18, 0xf19; - 0xf20, 0xf29; 0xf35, 0xf35; 0xf37, 0xf37; 0xf39, 0xf39; 0xf3e, 0xf47; - 0xf49, 0xf6c; 0xf71, 0xf84; 0xf86, 0xf97; 0xf99, 0xfbc; 0xfc6, 0xfc6; - 0x1000, 0x1049; 0x1050, 0x109d; 0x10a0, 0x10c5; 0x10c7, 0x10c7; - 0x10cd, 0x10cd; 0x10d0, 0x10fa; 0x10fc, 0x1248; 0x124a, 0x124d; - 0x1250, 0x1256; 0x1258, 0x1258; 0x125a, 0x125d; 0x1260, 0x1288; - 0x128a, 0x128d; 0x1290, 0x12b0; 0x12b2, 0x12b5; 0x12b8, 0x12be; - 0x12c0, 0x12c0; 0x12c2, 0x12c5; 0x12c8, 0x12d6; 0x12d8, 0x1310; - 0x1312, 0x1315; 0x1318, 0x135a; 0x135d, 0x135f; 0x1369, 0x1371; - 0x1380, 0x138f; 0x13a0, 0x13f4; 0x1401, 0x166c; 0x166f, 0x167f; - 0x1681, 0x169a; 0x16a0, 0x16ea; 0x16ee, 0x16f0; 0x1700, 0x170c; - 0x170e, 0x1714; 0x1720, 0x1734; 0x1740, 0x1753; 0x1760, 0x176c; - 0x176e, 0x1770; 0x1772, 0x1773; 0x1780, 0x17d3; 0x17d7, 0x17d7; - 0x17dc, 0x17dd; 0x17e0, 0x17e9; 0x180b, 0x180d; 0x1810, 0x1819; - 0x1820, 0x1877; 0x1880, 0x18aa; 0x18b0, 0x18f5; 0x1900, 0x191c; - 0x1920, 0x192b; 0x1930, 0x193b; 0x1946, 0x196d; 0x1970, 0x1974; - 0x1980, 0x19ab; 0x19b0, 0x19c9; 0x19d0, 0x19da; 0x1a00, 0x1a1b; - 0x1a20, 0x1a5e; 0x1a60, 0x1a7c; 0x1a7f, 0x1a89; 0x1a90, 0x1a99; - 0x1aa7, 0x1aa7; 0x1b00, 0x1b4b; 0x1b50, 0x1b59; 0x1b6b, 0x1b73; - 0x1b80, 0x1bf3; 0x1c00, 0x1c37; 0x1c40, 0x1c49; 0x1c4d, 0x1c7d; - 0x1cd0, 0x1cd2; 0x1cd4, 0x1cf6; 0x1d00, 0x1de6; 0x1dfc, 0x1f15; - 0x1f18, 0x1f1d; 0x1f20, 0x1f45; 0x1f48, 0x1f4d; 0x1f50, 0x1f57; - 0x1f59, 0x1f59; 0x1f5b, 0x1f5b; 0x1f5d, 0x1f5d; 0x1f5f, 0x1f7d; - 0x1f80, 0x1fb4; 0x1fb6, 0x1fbc; 0x1fbe, 0x1fbe; 0x1fc2, 0x1fc4; - 0x1fc6, 0x1fcc; 0x1fd0, 0x1fd3; 0x1fd6, 0x1fdb; 0x1fe0, 0x1fec; - 0x1ff2, 0x1ff4; 0x1ff6, 0x1ffc; 0x203f, 0x2040; 0x2054, 0x2054; - 0x2071, 0x2071; 0x207f, 0x207f; 0x2090, 0x209c; 0x20d0, 0x20dc; - 0x20e1, 0x20e1; 0x20e5, 0x20f0; 0x2102, 0x2102; 0x2107, 0x2107; - 0x210a, 0x2113; 0x2115, 0x2115; 0x2118, 0x211d; 0x2124, 0x2124; - 0x2126, 0x2126; 0x2128, 0x2128; 0x212a, 0x2139; 0x213c, 0x213f; - 0x2145, 0x2149; 0x214e, 0x214e; 0x2160, 0x2188; 0x2c00, 0x2c2e; - 0x2c30, 0x2c5e; 0x2c60, 0x2ce4; 0x2ceb, 0x2cf3; 0x2d00, 0x2d25; - 0x2d27, 0x2d27; 0x2d2d, 0x2d2d; 0x2d30, 0x2d67; 0x2d6f, 0x2d6f; - 0x2d7f, 0x2d96; 0x2da0, 0x2da6; 0x2da8, 0x2dae; 0x2db0, 0x2db6; - 0x2db8, 0x2dbe; 0x2dc0, 0x2dc6; 0x2dc8, 0x2dce; 0x2dd0, 0x2dd6; - 0x2dd8, 0x2dde; 0x2de0, 0x2dff; 0x3005, 0x3007; 0x3021, 0x302f; - 0x3031, 0x3035; 0x3038, 0x303c; 0x3041, 0x3096; 0x3099, 0x309f; - 0x30a1, 0x30fa; 0x30fc, 0x30ff; 0x3105, 0x312d; 0x3131, 0x318e; - 0x31a0, 0x31ba; 0x31f0, 0x31ff; 0x3400, 0x4db5; 0x4e00, 0x9fcc; - 0xa000, 0xa48c; 0xa4d0, 0xa4fd; 0xa500, 0xa60c; 0xa610, 0xa62b; - 0xa640, 0xa66f; 0xa674, 0xa67d; 0xa67f, 0xa697; 0xa69f, 0xa6f1; - 0xa717, 0xa71f; 0xa722, 0xa788; 0xa78b, 0xa78e; 0xa790, 0xa793; - 0xa7a0, 0xa7aa; 0xa7f8, 0xa827; 0xa840, 0xa873; 0xa880, 0xa8c4; - 0xa8d0, 0xa8d9; 0xa8e0, 0xa8f7; 0xa8fb, 0xa8fb; 0xa900, 0xa92d; - 0xa930, 0xa953; 0xa960, 0xa97c; 0xa980, 0xa9c0; 0xa9cf, 0xa9d9; - 0xaa00, 0xaa36; 0xaa40, 0xaa4d; 0xaa50, 0xaa59; 0xaa60, 0xaa76; - 0xaa7a, 0xaa7b; 0xaa80, 0xaac2; 0xaadb, 0xaadd; 0xaae0, 0xaaef; - 0xaaf2, 0xaaf6; 0xab01, 0xab06; 0xab09, 0xab0e; 0xab11, 0xab16; - 0xab20, 0xab26; 0xab28, 0xab2e; 0xabc0, 0xabea; 0xabec, 0xabed; - 0xabf0, 0xabf9; 0xac00, 0xd7a3; 0xd7b0, 0xd7c6; 0xd7cb, 0xd7fb; - 0xf900, 0xfa6d; 0xfa70, 0xfad9; 0xfb00, 0xfb06; 0xfb13, 0xfb17; - 0xfb1d, 0xfb28; 0xfb2a, 0xfb36; 0xfb38, 0xfb3c; 0xfb3e, 0xfb3e; - 0xfb40, 0xfb41; 0xfb43, 0xfb44; 0xfb46, 0xfbb1; 0xfbd3, 0xfd3d; - 0xfd50, 0xfd8f; 0xfd92, 0xfdc7; 0xfdf0, 0xfdfb; 0xfe00, 0xfe0f; - 0xfe20, 0xfe26; 0xfe33, 0xfe34; 0xfe4d, 0xfe4f; 0xfe70, 0xfe74; - 0xfe76, 0xfefc; 0xff10, 0xff19; 0xff21, 0xff3a; 0xff3f, 0xff3f; - 0xff41, 0xff5a; 0xff66, 0xffbe; 0xffc2, 0xffc7; 0xffca, 0xffcf; - 0xffd2, 0xffd7; 0xffda, 0xffdc; 0x10000, 0x1000b; 0x1000d, 0x10026; - 0x10028, 0x1003a; 0x1003c, 0x1003d; 0x1003f, 0x1004d; 0x10050, 0x1005d; - 0x10080, 0x100fa; 0x10140, 0x10174; 0x101fd, 0x101fd; 0x10280, 0x1029c; - 0x102a0, 0x102d0; 0x10300, 0x1031e; 0x10330, 0x1034a; 0x10380, 0x1039d; - 0x103a0, 0x103c3; 0x103c8, 0x103cf; 0x103d1, 0x103d5; 0x10400, 0x1049d; - 0x104a0, 0x104a9; 0x10800, 0x10805; 0x10808, 0x10808; 0x1080a, 0x10835; - 0x10837, 0x10838; 0x1083c, 0x1083c; 0x1083f, 0x10855; 0x10900, 0x10915; - 0x10920, 0x10939; 0x10980, 0x109b7; 0x109be, 0x109bf; 0x10a00, 0x10a03; - 0x10a05, 0x10a06; 0x10a0c, 0x10a13; 0x10a15, 0x10a17; 0x10a19, 0x10a33; - 0x10a38, 0x10a3a; 0x10a3f, 0x10a3f; 0x10a60, 0x10a7c; 0x10b00, 0x10b35; - 0x10b40, 0x10b55; 0x10b60, 0x10b72; 0x10c00, 0x10c48; 0x11000, 0x11046; - 0x11066, 0x1106f; 0x11080, 0x110ba; 0x110d0, 0x110e8; 0x110f0, 0x110f9; - 0x11100, 0x11134; 0x11136, 0x1113f; 0x11180, 0x111c4; 0x111d0, 0x111d9; - 0x11680, 0x116b7; 0x116c0, 0x116c9; 0x12000, 0x1236e; 0x12400, 0x12462; - 0x13000, 0x1342e; 0x16800, 0x16a38; 0x16f00, 0x16f44; 0x16f50, 0x16f7e; - 0x16f8f, 0x16f9f; 0x1b000, 0x1b001; 0x1d165, 0x1d169; 0x1d16d, 0x1d172; - 0x1d17b, 0x1d182; 0x1d185, 0x1d18b; 0x1d1aa, 0x1d1ad; 0x1d242, 0x1d244; - 0x1d400, 0x1d454; 0x1d456, 0x1d49c; 0x1d49e, 0x1d49f; 0x1d4a2, 0x1d4a2; - 0x1d4a5, 0x1d4a6; 0x1d4a9, 0x1d4ac; 0x1d4ae, 0x1d4b9; 0x1d4bb, 0x1d4bb; - 0x1d4bd, 0x1d4c3; 0x1d4c5, 0x1d505; 0x1d507, 0x1d50a; 0x1d50d, 0x1d514; - 0x1d516, 0x1d51c; 0x1d51e, 0x1d539; 0x1d53b, 0x1d53e; 0x1d540, 0x1d544; - 0x1d546, 0x1d546; 0x1d54a, 0x1d550; 0x1d552, 0x1d6a5; 0x1d6a8, 0x1d6c0; - 0x1d6c2, 0x1d6da; 0x1d6dc, 0x1d6fa; 0x1d6fc, 0x1d714; 0x1d716, 0x1d734; - 0x1d736, 0x1d74e; 0x1d750, 0x1d76e; 0x1d770, 0x1d788; 0x1d78a, 0x1d7a8; - 0x1d7aa, 0x1d7c2; 0x1d7c4, 0x1d7cb; 0x1d7ce, 0x1d7ff; 0x1ee00, 0x1ee03; - 0x1ee05, 0x1ee1f; 0x1ee21, 0x1ee22; 0x1ee24, 0x1ee24; 0x1ee27, 0x1ee27; - 0x1ee29, 0x1ee32; 0x1ee34, 0x1ee37; 0x1ee39, 0x1ee39; 0x1ee3b, 0x1ee3b; - 0x1ee42, 0x1ee42; 0x1ee47, 0x1ee47; 0x1ee49, 0x1ee49; 0x1ee4b, 0x1ee4b; - 0x1ee4d, 0x1ee4f; 0x1ee51, 0x1ee52; 0x1ee54, 0x1ee54; 0x1ee57, 0x1ee57; - 0x1ee59, 0x1ee59; 0x1ee5b, 0x1ee5b; 0x1ee5d, 0x1ee5d; 0x1ee5f, 0x1ee5f; - 0x1ee61, 0x1ee62; 0x1ee64, 0x1ee64; 0x1ee67, 0x1ee6a; 0x1ee6c, 0x1ee72; - 0x1ee74, 0x1ee77; 0x1ee79, 0x1ee7c; 0x1ee7e, 0x1ee7e; 0x1ee80, 0x1ee89; - 0x1ee8b, 0x1ee9b; 0x1eea1, 0x1eea3; 0x1eea5, 0x1eea9; 0x1eeab, 0x1eebb; - 0x20000, 0x2a6d6; 0x2a700, 0x2b734; 0x2b740, 0x2b81d; 0x2f800, 0x2fa1d; - 0xe0100, 0xe01ef] - - let id_start = - [0x41, 0x5a; 0x61, 0x7a; 0xaa, 0xaa; 0xb5, 0xb5; 0xba, 0xba; 0xc0, 0xd6; - 0xd8, 0xf6; 0xf8, 0x2c1; 0x2c6, 0x2d1; 0x2e0, 0x2e4; 0x2ec, 0x2ec; - 0x2ee, 0x2ee; 0x370, 0x374; 0x376, 0x377; 0x37a, 0x37d; 0x386, 0x386; - 0x388, 0x38a; 0x38c, 0x38c; 0x38e, 0x3a1; 0x3a3, 0x3f5; 0x3f7, 0x481; - 0x48a, 0x527; 0x531, 0x556; 0x559, 0x559; 0x561, 0x587; 0x5d0, 0x5ea; - 0x5f0, 0x5f2; 0x620, 0x64a; 0x66e, 0x66f; 0x671, 0x6d3; 0x6d5, 0x6d5; - 0x6e5, 0x6e6; 0x6ee, 0x6ef; 0x6fa, 0x6fc; 0x6ff, 0x6ff; 0x710, 0x710; - 0x712, 0x72f; 0x74d, 0x7a5; 0x7b1, 0x7b1; 0x7ca, 0x7ea; 0x7f4, 0x7f5; - 0x7fa, 0x7fa; 0x800, 0x815; 0x81a, 0x81a; 0x824, 0x824; 0x828, 0x828; - 0x840, 0x858; 0x8a0, 0x8a0; 0x8a2, 0x8ac; 0x904, 0x939; 0x93d, 0x93d; - 0x950, 0x950; 0x958, 0x961; 0x971, 0x977; 0x979, 0x97f; 0x985, 0x98c; - 0x98f, 0x990; 0x993, 0x9a8; 0x9aa, 0x9b0; 0x9b2, 0x9b2; 0x9b6, 0x9b9; - 0x9bd, 0x9bd; 0x9ce, 0x9ce; 0x9dc, 0x9dd; 0x9df, 0x9e1; 0x9f0, 0x9f1; - 0xa05, 0xa0a; 0xa0f, 0xa10; 0xa13, 0xa28; 0xa2a, 0xa30; 0xa32, 0xa33; - 0xa35, 0xa36; 0xa38, 0xa39; 0xa59, 0xa5c; 0xa5e, 0xa5e; 0xa72, 0xa74; - 0xa85, 0xa8d; 0xa8f, 0xa91; 0xa93, 0xaa8; 0xaaa, 0xab0; 0xab2, 0xab3; - 0xab5, 0xab9; 0xabd, 0xabd; 0xad0, 0xad0; 0xae0, 0xae1; 0xb05, 0xb0c; - 0xb0f, 0xb10; 0xb13, 0xb28; 0xb2a, 0xb30; 0xb32, 0xb33; 0xb35, 0xb39; - 0xb3d, 0xb3d; 0xb5c, 0xb5d; 0xb5f, 0xb61; 0xb71, 0xb71; 0xb83, 0xb83; - 0xb85, 0xb8a; 0xb8e, 0xb90; 0xb92, 0xb95; 0xb99, 0xb9a; 0xb9c, 0xb9c; - 0xb9e, 0xb9f; 0xba3, 0xba4; 0xba8, 0xbaa; 0xbae, 0xbb9; 0xbd0, 0xbd0; - 0xc05, 0xc0c; 0xc0e, 0xc10; 0xc12, 0xc28; 0xc2a, 0xc33; 0xc35, 0xc39; - 0xc3d, 0xc3d; 0xc58, 0xc59; 0xc60, 0xc61; 0xc85, 0xc8c; 0xc8e, 0xc90; - 0xc92, 0xca8; 0xcaa, 0xcb3; 0xcb5, 0xcb9; 0xcbd, 0xcbd; 0xcde, 0xcde; - 0xce0, 0xce1; 0xcf1, 0xcf2; 0xd05, 0xd0c; 0xd0e, 0xd10; 0xd12, 0xd3a; - 0xd3d, 0xd3d; 0xd4e, 0xd4e; 0xd60, 0xd61; 0xd7a, 0xd7f; 0xd85, 0xd96; - 0xd9a, 0xdb1; 0xdb3, 0xdbb; 0xdbd, 0xdbd; 0xdc0, 0xdc6; 0xe01, 0xe30; - 0xe32, 0xe33; 0xe40, 0xe46; 0xe81, 0xe82; 0xe84, 0xe84; 0xe87, 0xe88; - 0xe8a, 0xe8a; 0xe8d, 0xe8d; 0xe94, 0xe97; 0xe99, 0xe9f; 0xea1, 0xea3; - 0xea5, 0xea5; 0xea7, 0xea7; 0xeaa, 0xeab; 0xead, 0xeb0; 0xeb2, 0xeb3; - 0xebd, 0xebd; 0xec0, 0xec4; 0xec6, 0xec6; 0xedc, 0xedf; 0xf00, 0xf00; - 0xf40, 0xf47; 0xf49, 0xf6c; 0xf88, 0xf8c; 0x1000, 0x102a; 0x103f, 0x103f; - 0x1050, 0x1055; 0x105a, 0x105d; 0x1061, 0x1061; 0x1065, 0x1066; - 0x106e, 0x1070; 0x1075, 0x1081; 0x108e, 0x108e; 0x10a0, 0x10c5; - 0x10c7, 0x10c7; 0x10cd, 0x10cd; 0x10d0, 0x10fa; 0x10fc, 0x1248; - 0x124a, 0x124d; 0x1250, 0x1256; 0x1258, 0x1258; 0x125a, 0x125d; - 0x1260, 0x1288; 0x128a, 0x128d; 0x1290, 0x12b0; 0x12b2, 0x12b5; - 0x12b8, 0x12be; 0x12c0, 0x12c0; 0x12c2, 0x12c5; 0x12c8, 0x12d6; - 0x12d8, 0x1310; 0x1312, 0x1315; 0x1318, 0x135a; 0x1380, 0x138f; - 0x13a0, 0x13f4; 0x1401, 0x166c; 0x166f, 0x167f; 0x1681, 0x169a; - 0x16a0, 0x16ea; 0x16ee, 0x16f0; 0x1700, 0x170c; 0x170e, 0x1711; - 0x1720, 0x1731; 0x1740, 0x1751; 0x1760, 0x176c; 0x176e, 0x1770; - 0x1780, 0x17b3; 0x17d7, 0x17d7; 0x17dc, 0x17dc; 0x1820, 0x1877; - 0x1880, 0x18a8; 0x18aa, 0x18aa; 0x18b0, 0x18f5; 0x1900, 0x191c; - 0x1950, 0x196d; 0x1970, 0x1974; 0x1980, 0x19ab; 0x19c1, 0x19c7; - 0x1a00, 0x1a16; 0x1a20, 0x1a54; 0x1aa7, 0x1aa7; 0x1b05, 0x1b33; - 0x1b45, 0x1b4b; 0x1b83, 0x1ba0; 0x1bae, 0x1baf; 0x1bba, 0x1be5; - 0x1c00, 0x1c23; 0x1c4d, 0x1c4f; 0x1c5a, 0x1c7d; 0x1ce9, 0x1cec; - 0x1cee, 0x1cf1; 0x1cf5, 0x1cf6; 0x1d00, 0x1dbf; 0x1e00, 0x1f15; - 0x1f18, 0x1f1d; 0x1f20, 0x1f45; 0x1f48, 0x1f4d; 0x1f50, 0x1f57; - 0x1f59, 0x1f59; 0x1f5b, 0x1f5b; 0x1f5d, 0x1f5d; 0x1f5f, 0x1f7d; - 0x1f80, 0x1fb4; 0x1fb6, 0x1fbc; 0x1fbe, 0x1fbe; 0x1fc2, 0x1fc4; - 0x1fc6, 0x1fcc; 0x1fd0, 0x1fd3; 0x1fd6, 0x1fdb; 0x1fe0, 0x1fec; - 0x1ff2, 0x1ff4; 0x1ff6, 0x1ffc; 0x2071, 0x2071; 0x207f, 0x207f; - 0x2090, 0x209c; 0x2102, 0x2102; 0x2107, 0x2107; 0x210a, 0x2113; - 0x2115, 0x2115; 0x2118, 0x211d; 0x2124, 0x2124; 0x2126, 0x2126; - 0x2128, 0x2128; 0x212a, 0x2139; 0x213c, 0x213f; 0x2145, 0x2149; - 0x214e, 0x214e; 0x2160, 0x2188; 0x2c00, 0x2c2e; 0x2c30, 0x2c5e; - 0x2c60, 0x2ce4; 0x2ceb, 0x2cee; 0x2cf2, 0x2cf3; 0x2d00, 0x2d25; - 0x2d27, 0x2d27; 0x2d2d, 0x2d2d; 0x2d30, 0x2d67; 0x2d6f, 0x2d6f; - 0x2d80, 0x2d96; 0x2da0, 0x2da6; 0x2da8, 0x2dae; 0x2db0, 0x2db6; - 0x2db8, 0x2dbe; 0x2dc0, 0x2dc6; 0x2dc8, 0x2dce; 0x2dd0, 0x2dd6; - 0x2dd8, 0x2dde; 0x3005, 0x3007; 0x3021, 0x3029; 0x3031, 0x3035; - 0x3038, 0x303c; 0x3041, 0x3096; 0x309b, 0x309f; 0x30a1, 0x30fa; - 0x30fc, 0x30ff; 0x3105, 0x312d; 0x3131, 0x318e; 0x31a0, 0x31ba; - 0x31f0, 0x31ff; 0x3400, 0x4db5; 0x4e00, 0x9fcc; 0xa000, 0xa48c; - 0xa4d0, 0xa4fd; 0xa500, 0xa60c; 0xa610, 0xa61f; 0xa62a, 0xa62b; - 0xa640, 0xa66e; 0xa67f, 0xa697; 0xa6a0, 0xa6ef; 0xa717, 0xa71f; - 0xa722, 0xa788; 0xa78b, 0xa78e; 0xa790, 0xa793; 0xa7a0, 0xa7aa; - 0xa7f8, 0xa801; 0xa803, 0xa805; 0xa807, 0xa80a; 0xa80c, 0xa822; - 0xa840, 0xa873; 0xa882, 0xa8b3; 0xa8f2, 0xa8f7; 0xa8fb, 0xa8fb; - 0xa90a, 0xa925; 0xa930, 0xa946; 0xa960, 0xa97c; 0xa984, 0xa9b2; - 0xa9cf, 0xa9cf; 0xaa00, 0xaa28; 0xaa40, 0xaa42; 0xaa44, 0xaa4b; - 0xaa60, 0xaa76; 0xaa7a, 0xaa7a; 0xaa80, 0xaaaf; 0xaab1, 0xaab1; - 0xaab5, 0xaab6; 0xaab9, 0xaabd; 0xaac0, 0xaac0; 0xaac2, 0xaac2; - 0xaadb, 0xaadd; 0xaae0, 0xaaea; 0xaaf2, 0xaaf4; 0xab01, 0xab06; - 0xab09, 0xab0e; 0xab11, 0xab16; 0xab20, 0xab26; 0xab28, 0xab2e; - 0xabc0, 0xabe2; 0xac00, 0xd7a3; 0xd7b0, 0xd7c6; 0xd7cb, 0xd7fb; - 0xf900, 0xfa6d; 0xfa70, 0xfad9; 0xfb00, 0xfb06; 0xfb13, 0xfb17; - 0xfb1d, 0xfb1d; 0xfb1f, 0xfb28; 0xfb2a, 0xfb36; 0xfb38, 0xfb3c; - 0xfb3e, 0xfb3e; 0xfb40, 0xfb41; 0xfb43, 0xfb44; 0xfb46, 0xfbb1; - 0xfbd3, 0xfd3d; 0xfd50, 0xfd8f; 0xfd92, 0xfdc7; 0xfdf0, 0xfdfb; - 0xfe70, 0xfe74; 0xfe76, 0xfefc; 0xff21, 0xff3a; 0xff41, 0xff5a; - 0xff66, 0xffbe; 0xffc2, 0xffc7; 0xffca, 0xffcf; 0xffd2, 0xffd7; - 0xffda, 0xffdc; 0x10000, 0x1000b; 0x1000d, 0x10026; 0x10028, 0x1003a; - 0x1003c, 0x1003d; 0x1003f, 0x1004d; 0x10050, 0x1005d; 0x10080, 0x100fa; - 0x10140, 0x10174; 0x10280, 0x1029c; 0x102a0, 0x102d0; 0x10300, 0x1031e; - 0x10330, 0x1034a; 0x10380, 0x1039d; 0x103a0, 0x103c3; 0x103c8, 0x103cf; - 0x103d1, 0x103d5; 0x10400, 0x1049d; 0x10800, 0x10805; 0x10808, 0x10808; - 0x1080a, 0x10835; 0x10837, 0x10838; 0x1083c, 0x1083c; 0x1083f, 0x10855; - 0x10900, 0x10915; 0x10920, 0x10939; 0x10980, 0x109b7; 0x109be, 0x109bf; - 0x10a00, 0x10a00; 0x10a10, 0x10a13; 0x10a15, 0x10a17; 0x10a19, 0x10a33; - 0x10a60, 0x10a7c; 0x10b00, 0x10b35; 0x10b40, 0x10b55; 0x10b60, 0x10b72; - 0x10c00, 0x10c48; 0x11003, 0x11037; 0x11083, 0x110af; 0x110d0, 0x110e8; - 0x11103, 0x11126; 0x11183, 0x111b2; 0x111c1, 0x111c4; 0x11680, 0x116aa; - 0x12000, 0x1236e; 0x12400, 0x12462; 0x13000, 0x1342e; 0x16800, 0x16a38; - 0x16f00, 0x16f44; 0x16f50, 0x16f50; 0x16f93, 0x16f9f; 0x1b000, 0x1b001; - 0x1d400, 0x1d454; 0x1d456, 0x1d49c; 0x1d49e, 0x1d49f; 0x1d4a2, 0x1d4a2; - 0x1d4a5, 0x1d4a6; 0x1d4a9, 0x1d4ac; 0x1d4ae, 0x1d4b9; 0x1d4bb, 0x1d4bb; - 0x1d4bd, 0x1d4c3; 0x1d4c5, 0x1d505; 0x1d507, 0x1d50a; 0x1d50d, 0x1d514; - 0x1d516, 0x1d51c; 0x1d51e, 0x1d539; 0x1d53b, 0x1d53e; 0x1d540, 0x1d544; - 0x1d546, 0x1d546; 0x1d54a, 0x1d550; 0x1d552, 0x1d6a5; 0x1d6a8, 0x1d6c0; - 0x1d6c2, 0x1d6da; 0x1d6dc, 0x1d6fa; 0x1d6fc, 0x1d714; 0x1d716, 0x1d734; - 0x1d736, 0x1d74e; 0x1d750, 0x1d76e; 0x1d770, 0x1d788; 0x1d78a, 0x1d7a8; - 0x1d7aa, 0x1d7c2; 0x1d7c4, 0x1d7cb; 0x1ee00, 0x1ee03; 0x1ee05, 0x1ee1f; - 0x1ee21, 0x1ee22; 0x1ee24, 0x1ee24; 0x1ee27, 0x1ee27; 0x1ee29, 0x1ee32; - 0x1ee34, 0x1ee37; 0x1ee39, 0x1ee39; 0x1ee3b, 0x1ee3b; 0x1ee42, 0x1ee42; - 0x1ee47, 0x1ee47; 0x1ee49, 0x1ee49; 0x1ee4b, 0x1ee4b; 0x1ee4d, 0x1ee4f; - 0x1ee51, 0x1ee52; 0x1ee54, 0x1ee54; 0x1ee57, 0x1ee57; 0x1ee59, 0x1ee59; - 0x1ee5b, 0x1ee5b; 0x1ee5d, 0x1ee5d; 0x1ee5f, 0x1ee5f; 0x1ee61, 0x1ee62; - 0x1ee64, 0x1ee64; 0x1ee67, 0x1ee6a; 0x1ee6c, 0x1ee72; 0x1ee74, 0x1ee77; - 0x1ee79, 0x1ee7c; 0x1ee7e, 0x1ee7e; 0x1ee80, 0x1ee89; 0x1ee8b, 0x1ee9b; - 0x1eea1, 0x1eea3; 0x1eea5, 0x1eea9; 0x1eeab, 0x1eebb; 0x20000, 0x2a6d6; - 0x2a700, 0x2b734; 0x2b740, 0x2b81d; 0x2f800, 0x2fa1d] - - let lowercase = - [0x61, 0x7a; 0xaa, 0xaa; 0xb5, 0xb5; 0xba, 0xba; 0xdf, 0xf6; 0xf8, 0xff; - 0x101, 0x101; 0x103, 0x103; 0x105, 0x105; 0x107, 0x107; 0x109, 0x109; - 0x10b, 0x10b; 0x10d, 0x10d; 0x10f, 0x10f; 0x111, 0x111; 0x113, 0x113; - 0x115, 0x115; 0x117, 0x117; 0x119, 0x119; 0x11b, 0x11b; 0x11d, 0x11d; - 0x11f, 0x11f; 0x121, 0x121; 0x123, 0x123; 0x125, 0x125; 0x127, 0x127; - 0x129, 0x129; 0x12b, 0x12b; 0x12d, 0x12d; 0x12f, 0x12f; 0x131, 0x131; - 0x133, 0x133; 0x135, 0x135; 0x137, 0x138; 0x13a, 0x13a; 0x13c, 0x13c; - 0x13e, 0x13e; 0x140, 0x140; 0x142, 0x142; 0x144, 0x144; 0x146, 0x146; - 0x148, 0x149; 0x14b, 0x14b; 0x14d, 0x14d; 0x14f, 0x14f; 0x151, 0x151; - 0x153, 0x153; 0x155, 0x155; 0x157, 0x157; 0x159, 0x159; 0x15b, 0x15b; - 0x15d, 0x15d; 0x15f, 0x15f; 0x161, 0x161; 0x163, 0x163; 0x165, 0x165; - 0x167, 0x167; 0x169, 0x169; 0x16b, 0x16b; 0x16d, 0x16d; 0x16f, 0x16f; - 0x171, 0x171; 0x173, 0x173; 0x175, 0x175; 0x177, 0x177; 0x17a, 0x17a; - 0x17c, 0x17c; 0x17e, 0x180; 0x183, 0x183; 0x185, 0x185; 0x188, 0x188; - 0x18c, 0x18d; 0x192, 0x192; 0x195, 0x195; 0x199, 0x19b; 0x19e, 0x19e; - 0x1a1, 0x1a1; 0x1a3, 0x1a3; 0x1a5, 0x1a5; 0x1a8, 0x1a8; 0x1aa, 0x1ab; - 0x1ad, 0x1ad; 0x1b0, 0x1b0; 0x1b4, 0x1b4; 0x1b6, 0x1b6; 0x1b9, 0x1ba; - 0x1bd, 0x1bf; 0x1c6, 0x1c6; 0x1c9, 0x1c9; 0x1cc, 0x1cc; 0x1ce, 0x1ce; - 0x1d0, 0x1d0; 0x1d2, 0x1d2; 0x1d4, 0x1d4; 0x1d6, 0x1d6; 0x1d8, 0x1d8; - 0x1da, 0x1da; 0x1dc, 0x1dd; 0x1df, 0x1df; 0x1e1, 0x1e1; 0x1e3, 0x1e3; - 0x1e5, 0x1e5; 0x1e7, 0x1e7; 0x1e9, 0x1e9; 0x1eb, 0x1eb; 0x1ed, 0x1ed; - 0x1ef, 0x1f0; 0x1f3, 0x1f3; 0x1f5, 0x1f5; 0x1f9, 0x1f9; 0x1fb, 0x1fb; - 0x1fd, 0x1fd; 0x1ff, 0x1ff; 0x201, 0x201; 0x203, 0x203; 0x205, 0x205; - 0x207, 0x207; 0x209, 0x209; 0x20b, 0x20b; 0x20d, 0x20d; 0x20f, 0x20f; - 0x211, 0x211; 0x213, 0x213; 0x215, 0x215; 0x217, 0x217; 0x219, 0x219; - 0x21b, 0x21b; 0x21d, 0x21d; 0x21f, 0x21f; 0x221, 0x221; 0x223, 0x223; - 0x225, 0x225; 0x227, 0x227; 0x229, 0x229; 0x22b, 0x22b; 0x22d, 0x22d; - 0x22f, 0x22f; 0x231, 0x231; 0x233, 0x239; 0x23c, 0x23c; 0x23f, 0x240; - 0x242, 0x242; 0x247, 0x247; 0x249, 0x249; 0x24b, 0x24b; 0x24d, 0x24d; - 0x24f, 0x293; 0x295, 0x2b8; 0x2c0, 0x2c1; 0x2e0, 0x2e4; 0x345, 0x345; - 0x371, 0x371; 0x373, 0x373; 0x377, 0x377; 0x37a, 0x37d; 0x390, 0x390; - 0x3ac, 0x3ce; 0x3d0, 0x3d1; 0x3d5, 0x3d7; 0x3d9, 0x3d9; 0x3db, 0x3db; - 0x3dd, 0x3dd; 0x3df, 0x3df; 0x3e1, 0x3e1; 0x3e3, 0x3e3; 0x3e5, 0x3e5; - 0x3e7, 0x3e7; 0x3e9, 0x3e9; 0x3eb, 0x3eb; 0x3ed, 0x3ed; 0x3ef, 0x3f3; - 0x3f5, 0x3f5; 0x3f8, 0x3f8; 0x3fb, 0x3fc; 0x430, 0x45f; 0x461, 0x461; - 0x463, 0x463; 0x465, 0x465; 0x467, 0x467; 0x469, 0x469; 0x46b, 0x46b; - 0x46d, 0x46d; 0x46f, 0x46f; 0x471, 0x471; 0x473, 0x473; 0x475, 0x475; - 0x477, 0x477; 0x479, 0x479; 0x47b, 0x47b; 0x47d, 0x47d; 0x47f, 0x47f; - 0x481, 0x481; 0x48b, 0x48b; 0x48d, 0x48d; 0x48f, 0x48f; 0x491, 0x491; - 0x493, 0x493; 0x495, 0x495; 0x497, 0x497; 0x499, 0x499; 0x49b, 0x49b; - 0x49d, 0x49d; 0x49f, 0x49f; 0x4a1, 0x4a1; 0x4a3, 0x4a3; 0x4a5, 0x4a5; - 0x4a7, 0x4a7; 0x4a9, 0x4a9; 0x4ab, 0x4ab; 0x4ad, 0x4ad; 0x4af, 0x4af; - 0x4b1, 0x4b1; 0x4b3, 0x4b3; 0x4b5, 0x4b5; 0x4b7, 0x4b7; 0x4b9, 0x4b9; - 0x4bb, 0x4bb; 0x4bd, 0x4bd; 0x4bf, 0x4bf; 0x4c2, 0x4c2; 0x4c4, 0x4c4; - 0x4c6, 0x4c6; 0x4c8, 0x4c8; 0x4ca, 0x4ca; 0x4cc, 0x4cc; 0x4ce, 0x4cf; - 0x4d1, 0x4d1; 0x4d3, 0x4d3; 0x4d5, 0x4d5; 0x4d7, 0x4d7; 0x4d9, 0x4d9; - 0x4db, 0x4db; 0x4dd, 0x4dd; 0x4df, 0x4df; 0x4e1, 0x4e1; 0x4e3, 0x4e3; - 0x4e5, 0x4e5; 0x4e7, 0x4e7; 0x4e9, 0x4e9; 0x4eb, 0x4eb; 0x4ed, 0x4ed; - 0x4ef, 0x4ef; 0x4f1, 0x4f1; 0x4f3, 0x4f3; 0x4f5, 0x4f5; 0x4f7, 0x4f7; - 0x4f9, 0x4f9; 0x4fb, 0x4fb; 0x4fd, 0x4fd; 0x4ff, 0x4ff; 0x501, 0x501; - 0x503, 0x503; 0x505, 0x505; 0x507, 0x507; 0x509, 0x509; 0x50b, 0x50b; - 0x50d, 0x50d; 0x50f, 0x50f; 0x511, 0x511; 0x513, 0x513; 0x515, 0x515; - 0x517, 0x517; 0x519, 0x519; 0x51b, 0x51b; 0x51d, 0x51d; 0x51f, 0x51f; - 0x521, 0x521; 0x523, 0x523; 0x525, 0x525; 0x527, 0x527; 0x561, 0x587; - 0x1d00, 0x1dbf; 0x1e01, 0x1e01; 0x1e03, 0x1e03; 0x1e05, 0x1e05; - 0x1e07, 0x1e07; 0x1e09, 0x1e09; 0x1e0b, 0x1e0b; 0x1e0d, 0x1e0d; - 0x1e0f, 0x1e0f; 0x1e11, 0x1e11; 0x1e13, 0x1e13; 0x1e15, 0x1e15; - 0x1e17, 0x1e17; 0x1e19, 0x1e19; 0x1e1b, 0x1e1b; 0x1e1d, 0x1e1d; - 0x1e1f, 0x1e1f; 0x1e21, 0x1e21; 0x1e23, 0x1e23; 0x1e25, 0x1e25; - 0x1e27, 0x1e27; 0x1e29, 0x1e29; 0x1e2b, 0x1e2b; 0x1e2d, 0x1e2d; - 0x1e2f, 0x1e2f; 0x1e31, 0x1e31; 0x1e33, 0x1e33; 0x1e35, 0x1e35; - 0x1e37, 0x1e37; 0x1e39, 0x1e39; 0x1e3b, 0x1e3b; 0x1e3d, 0x1e3d; - 0x1e3f, 0x1e3f; 0x1e41, 0x1e41; 0x1e43, 0x1e43; 0x1e45, 0x1e45; - 0x1e47, 0x1e47; 0x1e49, 0x1e49; 0x1e4b, 0x1e4b; 0x1e4d, 0x1e4d; - 0x1e4f, 0x1e4f; 0x1e51, 0x1e51; 0x1e53, 0x1e53; 0x1e55, 0x1e55; - 0x1e57, 0x1e57; 0x1e59, 0x1e59; 0x1e5b, 0x1e5b; 0x1e5d, 0x1e5d; - 0x1e5f, 0x1e5f; 0x1e61, 0x1e61; 0x1e63, 0x1e63; 0x1e65, 0x1e65; - 0x1e67, 0x1e67; 0x1e69, 0x1e69; 0x1e6b, 0x1e6b; 0x1e6d, 0x1e6d; - 0x1e6f, 0x1e6f; 0x1e71, 0x1e71; 0x1e73, 0x1e73; 0x1e75, 0x1e75; - 0x1e77, 0x1e77; 0x1e79, 0x1e79; 0x1e7b, 0x1e7b; 0x1e7d, 0x1e7d; - 0x1e7f, 0x1e7f; 0x1e81, 0x1e81; 0x1e83, 0x1e83; 0x1e85, 0x1e85; - 0x1e87, 0x1e87; 0x1e89, 0x1e89; 0x1e8b, 0x1e8b; 0x1e8d, 0x1e8d; - 0x1e8f, 0x1e8f; 0x1e91, 0x1e91; 0x1e93, 0x1e93; 0x1e95, 0x1e9d; - 0x1e9f, 0x1e9f; 0x1ea1, 0x1ea1; 0x1ea3, 0x1ea3; 0x1ea5, 0x1ea5; - 0x1ea7, 0x1ea7; 0x1ea9, 0x1ea9; 0x1eab, 0x1eab; 0x1ead, 0x1ead; - 0x1eaf, 0x1eaf; 0x1eb1, 0x1eb1; 0x1eb3, 0x1eb3; 0x1eb5, 0x1eb5; - 0x1eb7, 0x1eb7; 0x1eb9, 0x1eb9; 0x1ebb, 0x1ebb; 0x1ebd, 0x1ebd; - 0x1ebf, 0x1ebf; 0x1ec1, 0x1ec1; 0x1ec3, 0x1ec3; 0x1ec5, 0x1ec5; - 0x1ec7, 0x1ec7; 0x1ec9, 0x1ec9; 0x1ecb, 0x1ecb; 0x1ecd, 0x1ecd; - 0x1ecf, 0x1ecf; 0x1ed1, 0x1ed1; 0x1ed3, 0x1ed3; 0x1ed5, 0x1ed5; - 0x1ed7, 0x1ed7; 0x1ed9, 0x1ed9; 0x1edb, 0x1edb; 0x1edd, 0x1edd; - 0x1edf, 0x1edf; 0x1ee1, 0x1ee1; 0x1ee3, 0x1ee3; 0x1ee5, 0x1ee5; - 0x1ee7, 0x1ee7; 0x1ee9, 0x1ee9; 0x1eeb, 0x1eeb; 0x1eed, 0x1eed; - 0x1eef, 0x1eef; 0x1ef1, 0x1ef1; 0x1ef3, 0x1ef3; 0x1ef5, 0x1ef5; - 0x1ef7, 0x1ef7; 0x1ef9, 0x1ef9; 0x1efb, 0x1efb; 0x1efd, 0x1efd; - 0x1eff, 0x1f07; 0x1f10, 0x1f15; 0x1f20, 0x1f27; 0x1f30, 0x1f37; - 0x1f40, 0x1f45; 0x1f50, 0x1f57; 0x1f60, 0x1f67; 0x1f70, 0x1f7d; - 0x1f80, 0x1f87; 0x1f90, 0x1f97; 0x1fa0, 0x1fa7; 0x1fb0, 0x1fb4; - 0x1fb6, 0x1fb7; 0x1fbe, 0x1fbe; 0x1fc2, 0x1fc4; 0x1fc6, 0x1fc7; - 0x1fd0, 0x1fd3; 0x1fd6, 0x1fd7; 0x1fe0, 0x1fe7; 0x1ff2, 0x1ff4; - 0x1ff6, 0x1ff7; 0x2071, 0x2071; 0x207f, 0x207f; 0x2090, 0x209c; - 0x210a, 0x210a; 0x210e, 0x210f; 0x2113, 0x2113; 0x212f, 0x212f; - 0x2134, 0x2134; 0x2139, 0x2139; 0x213c, 0x213d; 0x2146, 0x2149; - 0x214e, 0x214e; 0x2170, 0x217f; 0x2184, 0x2184; 0x24d0, 0x24e9; - 0x2c30, 0x2c5e; 0x2c61, 0x2c61; 0x2c65, 0x2c66; 0x2c68, 0x2c68; - 0x2c6a, 0x2c6a; 0x2c6c, 0x2c6c; 0x2c71, 0x2c71; 0x2c73, 0x2c74; - 0x2c76, 0x2c7d; 0x2c81, 0x2c81; 0x2c83, 0x2c83; 0x2c85, 0x2c85; - 0x2c87, 0x2c87; 0x2c89, 0x2c89; 0x2c8b, 0x2c8b; 0x2c8d, 0x2c8d; - 0x2c8f, 0x2c8f; 0x2c91, 0x2c91; 0x2c93, 0x2c93; 0x2c95, 0x2c95; - 0x2c97, 0x2c97; 0x2c99, 0x2c99; 0x2c9b, 0x2c9b; 0x2c9d, 0x2c9d; - 0x2c9f, 0x2c9f; 0x2ca1, 0x2ca1; 0x2ca3, 0x2ca3; 0x2ca5, 0x2ca5; - 0x2ca7, 0x2ca7; 0x2ca9, 0x2ca9; 0x2cab, 0x2cab; 0x2cad, 0x2cad; - 0x2caf, 0x2caf; 0x2cb1, 0x2cb1; 0x2cb3, 0x2cb3; 0x2cb5, 0x2cb5; - 0x2cb7, 0x2cb7; 0x2cb9, 0x2cb9; 0x2cbb, 0x2cbb; 0x2cbd, 0x2cbd; - 0x2cbf, 0x2cbf; 0x2cc1, 0x2cc1; 0x2cc3, 0x2cc3; 0x2cc5, 0x2cc5; - 0x2cc7, 0x2cc7; 0x2cc9, 0x2cc9; 0x2ccb, 0x2ccb; 0x2ccd, 0x2ccd; - 0x2ccf, 0x2ccf; 0x2cd1, 0x2cd1; 0x2cd3, 0x2cd3; 0x2cd5, 0x2cd5; - 0x2cd7, 0x2cd7; 0x2cd9, 0x2cd9; 0x2cdb, 0x2cdb; 0x2cdd, 0x2cdd; - 0x2cdf, 0x2cdf; 0x2ce1, 0x2ce1; 0x2ce3, 0x2ce4; 0x2cec, 0x2cec; - 0x2cee, 0x2cee; 0x2cf3, 0x2cf3; 0x2d00, 0x2d25; 0x2d27, 0x2d27; - 0x2d2d, 0x2d2d; 0xa641, 0xa641; 0xa643, 0xa643; 0xa645, 0xa645; - 0xa647, 0xa647; 0xa649, 0xa649; 0xa64b, 0xa64b; 0xa64d, 0xa64d; - 0xa64f, 0xa64f; 0xa651, 0xa651; 0xa653, 0xa653; 0xa655, 0xa655; - 0xa657, 0xa657; 0xa659, 0xa659; 0xa65b, 0xa65b; 0xa65d, 0xa65d; - 0xa65f, 0xa65f; 0xa661, 0xa661; 0xa663, 0xa663; 0xa665, 0xa665; - 0xa667, 0xa667; 0xa669, 0xa669; 0xa66b, 0xa66b; 0xa66d, 0xa66d; - 0xa681, 0xa681; 0xa683, 0xa683; 0xa685, 0xa685; 0xa687, 0xa687; - 0xa689, 0xa689; 0xa68b, 0xa68b; 0xa68d, 0xa68d; 0xa68f, 0xa68f; - 0xa691, 0xa691; 0xa693, 0xa693; 0xa695, 0xa695; 0xa697, 0xa697; - 0xa723, 0xa723; 0xa725, 0xa725; 0xa727, 0xa727; 0xa729, 0xa729; - 0xa72b, 0xa72b; 0xa72d, 0xa72d; 0xa72f, 0xa731; 0xa733, 0xa733; - 0xa735, 0xa735; 0xa737, 0xa737; 0xa739, 0xa739; 0xa73b, 0xa73b; - 0xa73d, 0xa73d; 0xa73f, 0xa73f; 0xa741, 0xa741; 0xa743, 0xa743; - 0xa745, 0xa745; 0xa747, 0xa747; 0xa749, 0xa749; 0xa74b, 0xa74b; - 0xa74d, 0xa74d; 0xa74f, 0xa74f; 0xa751, 0xa751; 0xa753, 0xa753; - 0xa755, 0xa755; 0xa757, 0xa757; 0xa759, 0xa759; 0xa75b, 0xa75b; - 0xa75d, 0xa75d; 0xa75f, 0xa75f; 0xa761, 0xa761; 0xa763, 0xa763; - 0xa765, 0xa765; 0xa767, 0xa767; 0xa769, 0xa769; 0xa76b, 0xa76b; - 0xa76d, 0xa76d; 0xa76f, 0xa778; 0xa77a, 0xa77a; 0xa77c, 0xa77c; - 0xa77f, 0xa77f; 0xa781, 0xa781; 0xa783, 0xa783; 0xa785, 0xa785; - 0xa787, 0xa787; 0xa78c, 0xa78c; 0xa78e, 0xa78e; 0xa791, 0xa791; - 0xa793, 0xa793; 0xa7a1, 0xa7a1; 0xa7a3, 0xa7a3; 0xa7a5, 0xa7a5; - 0xa7a7, 0xa7a7; 0xa7a9, 0xa7a9; 0xa7f8, 0xa7fa; 0xfb00, 0xfb06; - 0xfb13, 0xfb17; 0xff41, 0xff5a; 0x10428, 0x1044f; 0x1d41a, 0x1d433; - 0x1d44e, 0x1d454; 0x1d456, 0x1d467; 0x1d482, 0x1d49b; 0x1d4b6, 0x1d4b9; - 0x1d4bb, 0x1d4bb; 0x1d4bd, 0x1d4c3; 0x1d4c5, 0x1d4cf; 0x1d4ea, 0x1d503; - 0x1d51e, 0x1d537; 0x1d552, 0x1d56b; 0x1d586, 0x1d59f; 0x1d5ba, 0x1d5d3; - 0x1d5ee, 0x1d607; 0x1d622, 0x1d63b; 0x1d656, 0x1d66f; 0x1d68a, 0x1d6a5; - 0x1d6c2, 0x1d6da; 0x1d6dc, 0x1d6e1; 0x1d6fc, 0x1d714; 0x1d716, 0x1d71b; - 0x1d736, 0x1d74e; 0x1d750, 0x1d755; 0x1d770, 0x1d788; 0x1d78a, 0x1d78f; - 0x1d7aa, 0x1d7c2; 0x1d7c4, 0x1d7c9; 0x1d7cb, 0x1d7cb] - - let math = - [0x2b, 0x2b; 0x3c, 0x3e; 0x5e, 0x5e; 0x7c, 0x7c; 0x7e, 0x7e; 0xac, 0xac; - 0xb1, 0xb1; 0xd7, 0xd7; 0xf7, 0xf7; 0x3d0, 0x3d2; 0x3d5, 0x3d5; - 0x3f0, 0x3f1; 0x3f4, 0x3f6; 0x606, 0x608; 0x2016, 0x2016; 0x2032, 0x2034; - 0x2040, 0x2040; 0x2044, 0x2044; 0x2052, 0x2052; 0x2061, 0x2064; - 0x207a, 0x207e; 0x208a, 0x208e; 0x20d0, 0x20dc; 0x20e1, 0x20e1; - 0x20e5, 0x20e6; 0x20eb, 0x20ef; 0x2102, 0x2102; 0x2107, 0x2107; - 0x210a, 0x2113; 0x2115, 0x2115; 0x2118, 0x211d; 0x2124, 0x2124; - 0x2128, 0x2129; 0x212c, 0x212d; 0x212f, 0x2131; 0x2133, 0x2138; - 0x213c, 0x2149; 0x214b, 0x214b; 0x2190, 0x21a7; 0x21a9, 0x21ae; - 0x21b0, 0x21b1; 0x21b6, 0x21b7; 0x21bc, 0x21db; 0x21dd, 0x21dd; - 0x21e4, 0x21e5; 0x21f4, 0x22ff; 0x2308, 0x230b; 0x2320, 0x2321; - 0x237c, 0x237c; 0x239b, 0x23b5; 0x23b7, 0x23b7; 0x23d0, 0x23d0; - 0x23dc, 0x23e2; 0x25a0, 0x25a1; 0x25ae, 0x25b7; 0x25bc, 0x25c1; - 0x25c6, 0x25c7; 0x25ca, 0x25cb; 0x25cf, 0x25d3; 0x25e2, 0x25e2; - 0x25e4, 0x25e4; 0x25e7, 0x25ec; 0x25f8, 0x25ff; 0x2605, 0x2606; - 0x2640, 0x2640; 0x2642, 0x2642; 0x2660, 0x2663; 0x266d, 0x266f; - 0x27c0, 0x27ff; 0x2900, 0x2aff; 0x2b30, 0x2b44; 0x2b47, 0x2b4c; - 0xfb29, 0xfb29; 0xfe61, 0xfe66; 0xfe68, 0xfe68; 0xff0b, 0xff0b; - 0xff1c, 0xff1e; 0xff3c, 0xff3c; 0xff3e, 0xff3e; 0xff5c, 0xff5c; - 0xff5e, 0xff5e; 0xffe2, 0xffe2; 0xffe9, 0xffec; 0x1d400, 0x1d454; - 0x1d456, 0x1d49c; 0x1d49e, 0x1d49f; 0x1d4a2, 0x1d4a2; 0x1d4a5, 0x1d4a6; - 0x1d4a9, 0x1d4ac; 0x1d4ae, 0x1d4b9; 0x1d4bb, 0x1d4bb; 0x1d4bd, 0x1d4c3; - 0x1d4c5, 0x1d505; 0x1d507, 0x1d50a; 0x1d50d, 0x1d514; 0x1d516, 0x1d51c; - 0x1d51e, 0x1d539; 0x1d53b, 0x1d53e; 0x1d540, 0x1d544; 0x1d546, 0x1d546; - 0x1d54a, 0x1d550; 0x1d552, 0x1d6a5; 0x1d6a8, 0x1d7cb; 0x1d7ce, 0x1d7ff; - 0x1ee00, 0x1ee03; 0x1ee05, 0x1ee1f; 0x1ee21, 0x1ee22; 0x1ee24, 0x1ee24; - 0x1ee27, 0x1ee27; 0x1ee29, 0x1ee32; 0x1ee34, 0x1ee37; 0x1ee39, 0x1ee39; - 0x1ee3b, 0x1ee3b; 0x1ee42, 0x1ee42; 0x1ee47, 0x1ee47; 0x1ee49, 0x1ee49; - 0x1ee4b, 0x1ee4b; 0x1ee4d, 0x1ee4f; 0x1ee51, 0x1ee52; 0x1ee54, 0x1ee54; - 0x1ee57, 0x1ee57; 0x1ee59, 0x1ee59; 0x1ee5b, 0x1ee5b; 0x1ee5d, 0x1ee5d; - 0x1ee5f, 0x1ee5f; 0x1ee61, 0x1ee62; 0x1ee64, 0x1ee64; 0x1ee67, 0x1ee6a; - 0x1ee6c, 0x1ee72; 0x1ee74, 0x1ee77; 0x1ee79, 0x1ee7c; 0x1ee7e, 0x1ee7e; - 0x1ee80, 0x1ee89; 0x1ee8b, 0x1ee9b; 0x1eea1, 0x1eea3; 0x1eea5, 0x1eea9; - 0x1eeab, 0x1eebb; 0x1eef0, 0x1eef1] - - let other_alphabetic = - [0x345, 0x345; 0x5b0, 0x5bd; 0x5bf, 0x5bf; 0x5c1, 0x5c2; 0x5c4, 0x5c5; - 0x5c7, 0x5c7; 0x610, 0x61a; 0x64b, 0x657; 0x659, 0x65f; 0x670, 0x670; - 0x6d6, 0x6dc; 0x6e1, 0x6e4; 0x6e7, 0x6e8; 0x6ed, 0x6ed; 0x711, 0x711; - 0x730, 0x73f; 0x7a6, 0x7b0; 0x816, 0x817; 0x81b, 0x823; 0x825, 0x827; - 0x829, 0x82c; 0x8e4, 0x8e9; 0x8f0, 0x8fe; 0x900, 0x903; 0x93a, 0x93b; - 0x93e, 0x94c; 0x94e, 0x94f; 0x955, 0x957; 0x962, 0x963; 0x981, 0x983; - 0x9be, 0x9c4; 0x9c7, 0x9c8; 0x9cb, 0x9cc; 0x9d7, 0x9d7; 0x9e2, 0x9e3; - 0xa01, 0xa03; 0xa3e, 0xa42; 0xa47, 0xa48; 0xa4b, 0xa4c; 0xa51, 0xa51; - 0xa70, 0xa71; 0xa75, 0xa75; 0xa81, 0xa83; 0xabe, 0xac5; 0xac7, 0xac9; - 0xacb, 0xacc; 0xae2, 0xae3; 0xb01, 0xb03; 0xb3e, 0xb44; 0xb47, 0xb48; - 0xb4b, 0xb4c; 0xb56, 0xb57; 0xb62, 0xb63; 0xb82, 0xb82; 0xbbe, 0xbc2; - 0xbc6, 0xbc8; 0xbca, 0xbcc; 0xbd7, 0xbd7; 0xc01, 0xc03; 0xc3e, 0xc44; - 0xc46, 0xc48; 0xc4a, 0xc4c; 0xc55, 0xc56; 0xc62, 0xc63; 0xc82, 0xc83; - 0xcbe, 0xcc4; 0xcc6, 0xcc8; 0xcca, 0xccc; 0xcd5, 0xcd6; 0xce2, 0xce3; - 0xd02, 0xd03; 0xd3e, 0xd44; 0xd46, 0xd48; 0xd4a, 0xd4c; 0xd57, 0xd57; - 0xd62, 0xd63; 0xd82, 0xd83; 0xdcf, 0xdd4; 0xdd6, 0xdd6; 0xdd8, 0xddf; - 0xdf2, 0xdf3; 0xe31, 0xe31; 0xe34, 0xe3a; 0xe4d, 0xe4d; 0xeb1, 0xeb1; - 0xeb4, 0xeb9; 0xebb, 0xebc; 0xecd, 0xecd; 0xf71, 0xf81; 0xf8d, 0xf97; - 0xf99, 0xfbc; 0x102b, 0x1036; 0x1038, 0x1038; 0x103b, 0x103e; - 0x1056, 0x1059; 0x105e, 0x1060; 0x1062, 0x1062; 0x1067, 0x1068; - 0x1071, 0x1074; 0x1082, 0x1086; 0x109c, 0x109d; 0x135f, 0x135f; - 0x1712, 0x1713; 0x1732, 0x1733; 0x1752, 0x1753; 0x1772, 0x1773; - 0x17b6, 0x17c8; 0x18a9, 0x18a9; 0x1920, 0x192b; 0x1930, 0x1938; - 0x19b0, 0x19c0; 0x19c8, 0x19c9; 0x1a17, 0x1a1b; 0x1a55, 0x1a5e; - 0x1a61, 0x1a74; 0x1b00, 0x1b04; 0x1b35, 0x1b43; 0x1b80, 0x1b82; - 0x1ba1, 0x1ba9; 0x1bac, 0x1bad; 0x1be7, 0x1bf1; 0x1c24, 0x1c35; - 0x1cf2, 0x1cf3; 0x24b6, 0x24e9; 0x2de0, 0x2dff; 0xa674, 0xa67b; - 0xa69f, 0xa69f; 0xa823, 0xa827; 0xa880, 0xa881; 0xa8b4, 0xa8c3; - 0xa926, 0xa92a; 0xa947, 0xa952; 0xa980, 0xa983; 0xa9b4, 0xa9bf; - 0xaa29, 0xaa36; 0xaa43, 0xaa43; 0xaa4c, 0xaa4d; 0xaab0, 0xaab0; - 0xaab2, 0xaab4; 0xaab7, 0xaab8; 0xaabe, 0xaabe; 0xaaeb, 0xaaef; - 0xaaf5, 0xaaf5; 0xabe3, 0xabea; 0xfb1e, 0xfb1e; 0x10a01, 0x10a03; - 0x10a05, 0x10a06; 0x10a0c, 0x10a0f; 0x11000, 0x11002; 0x11038, 0x11045; - 0x11082, 0x11082; 0x110b0, 0x110b8; 0x11100, 0x11102; 0x11127, 0x11132; - 0x11180, 0x11182; 0x111b3, 0x111bf; 0x116ab, 0x116b5; 0x16f51, 0x16f7e] - - let other_lowercase = - [0xaa, 0xaa; 0xba, 0xba; 0x2b0, 0x2b8; 0x2c0, 0x2c1; 0x2e0, 0x2e4; - 0x345, 0x345; 0x37a, 0x37a; 0x1d2c, 0x1d6a; 0x1d78, 0x1d78; - 0x1d9b, 0x1dbf; 0x2071, 0x2071; 0x207f, 0x207f; 0x2090, 0x209c; - 0x2170, 0x217f; 0x24d0, 0x24e9; 0x2c7c, 0x2c7d; 0xa770, 0xa770; - 0xa7f8, 0xa7f9] - - let other_math = - [0x5e, 0x5e; 0x3d0, 0x3d2; 0x3d5, 0x3d5; 0x3f0, 0x3f1; 0x3f4, 0x3f5; - 0x2016, 0x2016; 0x2032, 0x2034; 0x2040, 0x2040; 0x2061, 0x2064; - 0x207d, 0x207e; 0x208d, 0x208e; 0x20d0, 0x20dc; 0x20e1, 0x20e1; - 0x20e5, 0x20e6; 0x20eb, 0x20ef; 0x2102, 0x2102; 0x2107, 0x2107; - 0x210a, 0x2113; 0x2115, 0x2115; 0x2119, 0x211d; 0x2124, 0x2124; - 0x2128, 0x2129; 0x212c, 0x212d; 0x212f, 0x2131; 0x2133, 0x2138; - 0x213c, 0x213f; 0x2145, 0x2149; 0x2195, 0x2199; 0x219c, 0x219f; - 0x21a1, 0x21a2; 0x21a4, 0x21a5; 0x21a7, 0x21a7; 0x21a9, 0x21ad; - 0x21b0, 0x21b1; 0x21b6, 0x21b7; 0x21bc, 0x21cd; 0x21d0, 0x21d1; - 0x21d3, 0x21d3; 0x21d5, 0x21db; 0x21dd, 0x21dd; 0x21e4, 0x21e5; - 0x2308, 0x230b; 0x23b4, 0x23b5; 0x23b7, 0x23b7; 0x23d0, 0x23d0; - 0x23e2, 0x23e2; 0x25a0, 0x25a1; 0x25ae, 0x25b6; 0x25bc, 0x25c0; - 0x25c6, 0x25c7; 0x25ca, 0x25cb; 0x25cf, 0x25d3; 0x25e2, 0x25e2; - 0x25e4, 0x25e4; 0x25e7, 0x25ec; 0x2605, 0x2606; 0x2640, 0x2640; - 0x2642, 0x2642; 0x2660, 0x2663; 0x266d, 0x266e; 0x27c5, 0x27c6; - 0x27e6, 0x27ef; 0x2983, 0x2998; 0x29d8, 0x29db; 0x29fc, 0x29fd; - 0xfe61, 0xfe61; 0xfe63, 0xfe63; 0xfe68, 0xfe68; 0xff3c, 0xff3c; - 0xff3e, 0xff3e; 0x1d400, 0x1d454; 0x1d456, 0x1d49c; 0x1d49e, 0x1d49f; - 0x1d4a2, 0x1d4a2; 0x1d4a5, 0x1d4a6; 0x1d4a9, 0x1d4ac; 0x1d4ae, 0x1d4b9; - 0x1d4bb, 0x1d4bb; 0x1d4bd, 0x1d4c3; 0x1d4c5, 0x1d505; 0x1d507, 0x1d50a; - 0x1d50d, 0x1d514; 0x1d516, 0x1d51c; 0x1d51e, 0x1d539; 0x1d53b, 0x1d53e; - 0x1d540, 0x1d544; 0x1d546, 0x1d546; 0x1d54a, 0x1d550; 0x1d552, 0x1d6a5; - 0x1d6a8, 0x1d6c0; 0x1d6c2, 0x1d6da; 0x1d6dc, 0x1d6fa; 0x1d6fc, 0x1d714; - 0x1d716, 0x1d734; 0x1d736, 0x1d74e; 0x1d750, 0x1d76e; 0x1d770, 0x1d788; - 0x1d78a, 0x1d7a8; 0x1d7aa, 0x1d7c2; 0x1d7c4, 0x1d7cb; 0x1d7ce, 0x1d7ff; - 0x1ee00, 0x1ee03; 0x1ee05, 0x1ee1f; 0x1ee21, 0x1ee22; 0x1ee24, 0x1ee24; - 0x1ee27, 0x1ee27; 0x1ee29, 0x1ee32; 0x1ee34, 0x1ee37; 0x1ee39, 0x1ee39; - 0x1ee3b, 0x1ee3b; 0x1ee42, 0x1ee42; 0x1ee47, 0x1ee47; 0x1ee49, 0x1ee49; - 0x1ee4b, 0x1ee4b; 0x1ee4d, 0x1ee4f; 0x1ee51, 0x1ee52; 0x1ee54, 0x1ee54; - 0x1ee57, 0x1ee57; 0x1ee59, 0x1ee59; 0x1ee5b, 0x1ee5b; 0x1ee5d, 0x1ee5d; - 0x1ee5f, 0x1ee5f; 0x1ee61, 0x1ee62; 0x1ee64, 0x1ee64; 0x1ee67, 0x1ee6a; - 0x1ee6c, 0x1ee72; 0x1ee74, 0x1ee77; 0x1ee79, 0x1ee7c; 0x1ee7e, 0x1ee7e; - 0x1ee80, 0x1ee89; 0x1ee8b, 0x1ee9b; 0x1eea1, 0x1eea3; 0x1eea5, 0x1eea9; - 0x1eeab, 0x1eebb] - - let other_uppercase = [0x2160, 0x216f; 0x24b6, 0x24cf] - - let uppercase = - [0x41, 0x5a; 0xc0, 0xd6; 0xd8, 0xde; 0x100, 0x100; 0x102, 0x102; - 0x104, 0x104; 0x106, 0x106; 0x108, 0x108; 0x10a, 0x10a; 0x10c, 0x10c; - 0x10e, 0x10e; 0x110, 0x110; 0x112, 0x112; 0x114, 0x114; 0x116, 0x116; - 0x118, 0x118; 0x11a, 0x11a; 0x11c, 0x11c; 0x11e, 0x11e; 0x120, 0x120; - 0x122, 0x122; 0x124, 0x124; 0x126, 0x126; 0x128, 0x128; 0x12a, 0x12a; - 0x12c, 0x12c; 0x12e, 0x12e; 0x130, 0x130; 0x132, 0x132; 0x134, 0x134; - 0x136, 0x136; 0x139, 0x139; 0x13b, 0x13b; 0x13d, 0x13d; 0x13f, 0x13f; - 0x141, 0x141; 0x143, 0x143; 0x145, 0x145; 0x147, 0x147; 0x14a, 0x14a; - 0x14c, 0x14c; 0x14e, 0x14e; 0x150, 0x150; 0x152, 0x152; 0x154, 0x154; - 0x156, 0x156; 0x158, 0x158; 0x15a, 0x15a; 0x15c, 0x15c; 0x15e, 0x15e; - 0x160, 0x160; 0x162, 0x162; 0x164, 0x164; 0x166, 0x166; 0x168, 0x168; - 0x16a, 0x16a; 0x16c, 0x16c; 0x16e, 0x16e; 0x170, 0x170; 0x172, 0x172; - 0x174, 0x174; 0x176, 0x176; 0x178, 0x179; 0x17b, 0x17b; 0x17d, 0x17d; - 0x181, 0x182; 0x184, 0x184; 0x186, 0x187; 0x189, 0x18b; 0x18e, 0x191; - 0x193, 0x194; 0x196, 0x198; 0x19c, 0x19d; 0x19f, 0x1a0; 0x1a2, 0x1a2; - 0x1a4, 0x1a4; 0x1a6, 0x1a7; 0x1a9, 0x1a9; 0x1ac, 0x1ac; 0x1ae, 0x1af; - 0x1b1, 0x1b3; 0x1b5, 0x1b5; 0x1b7, 0x1b8; 0x1bc, 0x1bc; 0x1c4, 0x1c4; - 0x1c7, 0x1c7; 0x1ca, 0x1ca; 0x1cd, 0x1cd; 0x1cf, 0x1cf; 0x1d1, 0x1d1; - 0x1d3, 0x1d3; 0x1d5, 0x1d5; 0x1d7, 0x1d7; 0x1d9, 0x1d9; 0x1db, 0x1db; - 0x1de, 0x1de; 0x1e0, 0x1e0; 0x1e2, 0x1e2; 0x1e4, 0x1e4; 0x1e6, 0x1e6; - 0x1e8, 0x1e8; 0x1ea, 0x1ea; 0x1ec, 0x1ec; 0x1ee, 0x1ee; 0x1f1, 0x1f1; - 0x1f4, 0x1f4; 0x1f6, 0x1f8; 0x1fa, 0x1fa; 0x1fc, 0x1fc; 0x1fe, 0x1fe; - 0x200, 0x200; 0x202, 0x202; 0x204, 0x204; 0x206, 0x206; 0x208, 0x208; - 0x20a, 0x20a; 0x20c, 0x20c; 0x20e, 0x20e; 0x210, 0x210; 0x212, 0x212; - 0x214, 0x214; 0x216, 0x216; 0x218, 0x218; 0x21a, 0x21a; 0x21c, 0x21c; - 0x21e, 0x21e; 0x220, 0x220; 0x222, 0x222; 0x224, 0x224; 0x226, 0x226; - 0x228, 0x228; 0x22a, 0x22a; 0x22c, 0x22c; 0x22e, 0x22e; 0x230, 0x230; - 0x232, 0x232; 0x23a, 0x23b; 0x23d, 0x23e; 0x241, 0x241; 0x243, 0x246; - 0x248, 0x248; 0x24a, 0x24a; 0x24c, 0x24c; 0x24e, 0x24e; 0x370, 0x370; - 0x372, 0x372; 0x376, 0x376; 0x386, 0x386; 0x388, 0x38a; 0x38c, 0x38c; - 0x38e, 0x38f; 0x391, 0x3a1; 0x3a3, 0x3ab; 0x3cf, 0x3cf; 0x3d2, 0x3d4; - 0x3d8, 0x3d8; 0x3da, 0x3da; 0x3dc, 0x3dc; 0x3de, 0x3de; 0x3e0, 0x3e0; - 0x3e2, 0x3e2; 0x3e4, 0x3e4; 0x3e6, 0x3e6; 0x3e8, 0x3e8; 0x3ea, 0x3ea; - 0x3ec, 0x3ec; 0x3ee, 0x3ee; 0x3f4, 0x3f4; 0x3f7, 0x3f7; 0x3f9, 0x3fa; - 0x3fd, 0x42f; 0x460, 0x460; 0x462, 0x462; 0x464, 0x464; 0x466, 0x466; - 0x468, 0x468; 0x46a, 0x46a; 0x46c, 0x46c; 0x46e, 0x46e; 0x470, 0x470; - 0x472, 0x472; 0x474, 0x474; 0x476, 0x476; 0x478, 0x478; 0x47a, 0x47a; - 0x47c, 0x47c; 0x47e, 0x47e; 0x480, 0x480; 0x48a, 0x48a; 0x48c, 0x48c; - 0x48e, 0x48e; 0x490, 0x490; 0x492, 0x492; 0x494, 0x494; 0x496, 0x496; - 0x498, 0x498; 0x49a, 0x49a; 0x49c, 0x49c; 0x49e, 0x49e; 0x4a0, 0x4a0; - 0x4a2, 0x4a2; 0x4a4, 0x4a4; 0x4a6, 0x4a6; 0x4a8, 0x4a8; 0x4aa, 0x4aa; - 0x4ac, 0x4ac; 0x4ae, 0x4ae; 0x4b0, 0x4b0; 0x4b2, 0x4b2; 0x4b4, 0x4b4; - 0x4b6, 0x4b6; 0x4b8, 0x4b8; 0x4ba, 0x4ba; 0x4bc, 0x4bc; 0x4be, 0x4be; - 0x4c0, 0x4c1; 0x4c3, 0x4c3; 0x4c5, 0x4c5; 0x4c7, 0x4c7; 0x4c9, 0x4c9; - 0x4cb, 0x4cb; 0x4cd, 0x4cd; 0x4d0, 0x4d0; 0x4d2, 0x4d2; 0x4d4, 0x4d4; - 0x4d6, 0x4d6; 0x4d8, 0x4d8; 0x4da, 0x4da; 0x4dc, 0x4dc; 0x4de, 0x4de; - 0x4e0, 0x4e0; 0x4e2, 0x4e2; 0x4e4, 0x4e4; 0x4e6, 0x4e6; 0x4e8, 0x4e8; - 0x4ea, 0x4ea; 0x4ec, 0x4ec; 0x4ee, 0x4ee; 0x4f0, 0x4f0; 0x4f2, 0x4f2; - 0x4f4, 0x4f4; 0x4f6, 0x4f6; 0x4f8, 0x4f8; 0x4fa, 0x4fa; 0x4fc, 0x4fc; - 0x4fe, 0x4fe; 0x500, 0x500; 0x502, 0x502; 0x504, 0x504; 0x506, 0x506; - 0x508, 0x508; 0x50a, 0x50a; 0x50c, 0x50c; 0x50e, 0x50e; 0x510, 0x510; - 0x512, 0x512; 0x514, 0x514; 0x516, 0x516; 0x518, 0x518; 0x51a, 0x51a; - 0x51c, 0x51c; 0x51e, 0x51e; 0x520, 0x520; 0x522, 0x522; 0x524, 0x524; - 0x526, 0x526; 0x531, 0x556; 0x10a0, 0x10c5; 0x10c7, 0x10c7; - 0x10cd, 0x10cd; 0x1e00, 0x1e00; 0x1e02, 0x1e02; 0x1e04, 0x1e04; - 0x1e06, 0x1e06; 0x1e08, 0x1e08; 0x1e0a, 0x1e0a; 0x1e0c, 0x1e0c; - 0x1e0e, 0x1e0e; 0x1e10, 0x1e10; 0x1e12, 0x1e12; 0x1e14, 0x1e14; - 0x1e16, 0x1e16; 0x1e18, 0x1e18; 0x1e1a, 0x1e1a; 0x1e1c, 0x1e1c; - 0x1e1e, 0x1e1e; 0x1e20, 0x1e20; 0x1e22, 0x1e22; 0x1e24, 0x1e24; - 0x1e26, 0x1e26; 0x1e28, 0x1e28; 0x1e2a, 0x1e2a; 0x1e2c, 0x1e2c; - 0x1e2e, 0x1e2e; 0x1e30, 0x1e30; 0x1e32, 0x1e32; 0x1e34, 0x1e34; - 0x1e36, 0x1e36; 0x1e38, 0x1e38; 0x1e3a, 0x1e3a; 0x1e3c, 0x1e3c; - 0x1e3e, 0x1e3e; 0x1e40, 0x1e40; 0x1e42, 0x1e42; 0x1e44, 0x1e44; - 0x1e46, 0x1e46; 0x1e48, 0x1e48; 0x1e4a, 0x1e4a; 0x1e4c, 0x1e4c; - 0x1e4e, 0x1e4e; 0x1e50, 0x1e50; 0x1e52, 0x1e52; 0x1e54, 0x1e54; - 0x1e56, 0x1e56; 0x1e58, 0x1e58; 0x1e5a, 0x1e5a; 0x1e5c, 0x1e5c; - 0x1e5e, 0x1e5e; 0x1e60, 0x1e60; 0x1e62, 0x1e62; 0x1e64, 0x1e64; - 0x1e66, 0x1e66; 0x1e68, 0x1e68; 0x1e6a, 0x1e6a; 0x1e6c, 0x1e6c; - 0x1e6e, 0x1e6e; 0x1e70, 0x1e70; 0x1e72, 0x1e72; 0x1e74, 0x1e74; - 0x1e76, 0x1e76; 0x1e78, 0x1e78; 0x1e7a, 0x1e7a; 0x1e7c, 0x1e7c; - 0x1e7e, 0x1e7e; 0x1e80, 0x1e80; 0x1e82, 0x1e82; 0x1e84, 0x1e84; - 0x1e86, 0x1e86; 0x1e88, 0x1e88; 0x1e8a, 0x1e8a; 0x1e8c, 0x1e8c; - 0x1e8e, 0x1e8e; 0x1e90, 0x1e90; 0x1e92, 0x1e92; 0x1e94, 0x1e94; - 0x1e9e, 0x1e9e; 0x1ea0, 0x1ea0; 0x1ea2, 0x1ea2; 0x1ea4, 0x1ea4; - 0x1ea6, 0x1ea6; 0x1ea8, 0x1ea8; 0x1eaa, 0x1eaa; 0x1eac, 0x1eac; - 0x1eae, 0x1eae; 0x1eb0, 0x1eb0; 0x1eb2, 0x1eb2; 0x1eb4, 0x1eb4; - 0x1eb6, 0x1eb6; 0x1eb8, 0x1eb8; 0x1eba, 0x1eba; 0x1ebc, 0x1ebc; - 0x1ebe, 0x1ebe; 0x1ec0, 0x1ec0; 0x1ec2, 0x1ec2; 0x1ec4, 0x1ec4; - 0x1ec6, 0x1ec6; 0x1ec8, 0x1ec8; 0x1eca, 0x1eca; 0x1ecc, 0x1ecc; - 0x1ece, 0x1ece; 0x1ed0, 0x1ed0; 0x1ed2, 0x1ed2; 0x1ed4, 0x1ed4; - 0x1ed6, 0x1ed6; 0x1ed8, 0x1ed8; 0x1eda, 0x1eda; 0x1edc, 0x1edc; - 0x1ede, 0x1ede; 0x1ee0, 0x1ee0; 0x1ee2, 0x1ee2; 0x1ee4, 0x1ee4; - 0x1ee6, 0x1ee6; 0x1ee8, 0x1ee8; 0x1eea, 0x1eea; 0x1eec, 0x1eec; - 0x1eee, 0x1eee; 0x1ef0, 0x1ef0; 0x1ef2, 0x1ef2; 0x1ef4, 0x1ef4; - 0x1ef6, 0x1ef6; 0x1ef8, 0x1ef8; 0x1efa, 0x1efa; 0x1efc, 0x1efc; - 0x1efe, 0x1efe; 0x1f08, 0x1f0f; 0x1f18, 0x1f1d; 0x1f28, 0x1f2f; - 0x1f38, 0x1f3f; 0x1f48, 0x1f4d; 0x1f59, 0x1f59; 0x1f5b, 0x1f5b; - 0x1f5d, 0x1f5d; 0x1f5f, 0x1f5f; 0x1f68, 0x1f6f; 0x1fb8, 0x1fbb; - 0x1fc8, 0x1fcb; 0x1fd8, 0x1fdb; 0x1fe8, 0x1fec; 0x1ff8, 0x1ffb; - 0x2102, 0x2102; 0x2107, 0x2107; 0x210b, 0x210d; 0x2110, 0x2112; - 0x2115, 0x2115; 0x2119, 0x211d; 0x2124, 0x2124; 0x2126, 0x2126; - 0x2128, 0x2128; 0x212a, 0x212d; 0x2130, 0x2133; 0x213e, 0x213f; - 0x2145, 0x2145; 0x2160, 0x216f; 0x2183, 0x2183; 0x24b6, 0x24cf; - 0x2c00, 0x2c2e; 0x2c60, 0x2c60; 0x2c62, 0x2c64; 0x2c67, 0x2c67; - 0x2c69, 0x2c69; 0x2c6b, 0x2c6b; 0x2c6d, 0x2c70; 0x2c72, 0x2c72; - 0x2c75, 0x2c75; 0x2c7e, 0x2c80; 0x2c82, 0x2c82; 0x2c84, 0x2c84; - 0x2c86, 0x2c86; 0x2c88, 0x2c88; 0x2c8a, 0x2c8a; 0x2c8c, 0x2c8c; - 0x2c8e, 0x2c8e; 0x2c90, 0x2c90; 0x2c92, 0x2c92; 0x2c94, 0x2c94; - 0x2c96, 0x2c96; 0x2c98, 0x2c98; 0x2c9a, 0x2c9a; 0x2c9c, 0x2c9c; - 0x2c9e, 0x2c9e; 0x2ca0, 0x2ca0; 0x2ca2, 0x2ca2; 0x2ca4, 0x2ca4; - 0x2ca6, 0x2ca6; 0x2ca8, 0x2ca8; 0x2caa, 0x2caa; 0x2cac, 0x2cac; - 0x2cae, 0x2cae; 0x2cb0, 0x2cb0; 0x2cb2, 0x2cb2; 0x2cb4, 0x2cb4; - 0x2cb6, 0x2cb6; 0x2cb8, 0x2cb8; 0x2cba, 0x2cba; 0x2cbc, 0x2cbc; - 0x2cbe, 0x2cbe; 0x2cc0, 0x2cc0; 0x2cc2, 0x2cc2; 0x2cc4, 0x2cc4; - 0x2cc6, 0x2cc6; 0x2cc8, 0x2cc8; 0x2cca, 0x2cca; 0x2ccc, 0x2ccc; - 0x2cce, 0x2cce; 0x2cd0, 0x2cd0; 0x2cd2, 0x2cd2; 0x2cd4, 0x2cd4; - 0x2cd6, 0x2cd6; 0x2cd8, 0x2cd8; 0x2cda, 0x2cda; 0x2cdc, 0x2cdc; - 0x2cde, 0x2cde; 0x2ce0, 0x2ce0; 0x2ce2, 0x2ce2; 0x2ceb, 0x2ceb; - 0x2ced, 0x2ced; 0x2cf2, 0x2cf2; 0xa640, 0xa640; 0xa642, 0xa642; - 0xa644, 0xa644; 0xa646, 0xa646; 0xa648, 0xa648; 0xa64a, 0xa64a; - 0xa64c, 0xa64c; 0xa64e, 0xa64e; 0xa650, 0xa650; 0xa652, 0xa652; - 0xa654, 0xa654; 0xa656, 0xa656; 0xa658, 0xa658; 0xa65a, 0xa65a; - 0xa65c, 0xa65c; 0xa65e, 0xa65e; 0xa660, 0xa660; 0xa662, 0xa662; - 0xa664, 0xa664; 0xa666, 0xa666; 0xa668, 0xa668; 0xa66a, 0xa66a; - 0xa66c, 0xa66c; 0xa680, 0xa680; 0xa682, 0xa682; 0xa684, 0xa684; - 0xa686, 0xa686; 0xa688, 0xa688; 0xa68a, 0xa68a; 0xa68c, 0xa68c; - 0xa68e, 0xa68e; 0xa690, 0xa690; 0xa692, 0xa692; 0xa694, 0xa694; - 0xa696, 0xa696; 0xa722, 0xa722; 0xa724, 0xa724; 0xa726, 0xa726; - 0xa728, 0xa728; 0xa72a, 0xa72a; 0xa72c, 0xa72c; 0xa72e, 0xa72e; - 0xa732, 0xa732; 0xa734, 0xa734; 0xa736, 0xa736; 0xa738, 0xa738; - 0xa73a, 0xa73a; 0xa73c, 0xa73c; 0xa73e, 0xa73e; 0xa740, 0xa740; - 0xa742, 0xa742; 0xa744, 0xa744; 0xa746, 0xa746; 0xa748, 0xa748; - 0xa74a, 0xa74a; 0xa74c, 0xa74c; 0xa74e, 0xa74e; 0xa750, 0xa750; - 0xa752, 0xa752; 0xa754, 0xa754; 0xa756, 0xa756; 0xa758, 0xa758; - 0xa75a, 0xa75a; 0xa75c, 0xa75c; 0xa75e, 0xa75e; 0xa760, 0xa760; - 0xa762, 0xa762; 0xa764, 0xa764; 0xa766, 0xa766; 0xa768, 0xa768; - 0xa76a, 0xa76a; 0xa76c, 0xa76c; 0xa76e, 0xa76e; 0xa779, 0xa779; - 0xa77b, 0xa77b; 0xa77d, 0xa77e; 0xa780, 0xa780; 0xa782, 0xa782; - 0xa784, 0xa784; 0xa786, 0xa786; 0xa78b, 0xa78b; 0xa78d, 0xa78d; - 0xa790, 0xa790; 0xa792, 0xa792; 0xa7a0, 0xa7a0; 0xa7a2, 0xa7a2; - 0xa7a4, 0xa7a4; 0xa7a6, 0xa7a6; 0xa7a8, 0xa7a8; 0xa7aa, 0xa7aa; - 0xff21, 0xff3a; 0x10400, 0x10427; 0x1d400, 0x1d419; 0x1d434, 0x1d44d; - 0x1d468, 0x1d481; 0x1d49c, 0x1d49c; 0x1d49e, 0x1d49f; 0x1d4a2, 0x1d4a2; - 0x1d4a5, 0x1d4a6; 0x1d4a9, 0x1d4ac; 0x1d4ae, 0x1d4b5; 0x1d4d0, 0x1d4e9; - 0x1d504, 0x1d505; 0x1d507, 0x1d50a; 0x1d50d, 0x1d514; 0x1d516, 0x1d51c; - 0x1d538, 0x1d539; 0x1d53b, 0x1d53e; 0x1d540, 0x1d544; 0x1d546, 0x1d546; - 0x1d54a, 0x1d550; 0x1d56c, 0x1d585; 0x1d5a0, 0x1d5b9; 0x1d5d4, 0x1d5ed; - 0x1d608, 0x1d621; 0x1d63c, 0x1d655; 0x1d670, 0x1d689; 0x1d6a8, 0x1d6c0; - 0x1d6e2, 0x1d6fa; 0x1d71c, 0x1d734; 0x1d756, 0x1d76e; 0x1d790, 0x1d7a8; - 0x1d7ca, 0x1d7ca] - - let white_space = - [0x09, 0x0d; 0x20, 0x20; 0x85, 0x85; 0xa0, 0xa0; 0x1680, 0x1680; - 0x2000, 0x200a; 0x2028, 0x2029; 0x202f, 0x202f; 0x205f, 0x205f; - 0x3000, 0x3000] - - let xid_continue = - [0x30, 0x39; 0x41, 0x5a; 0x5f, 0x5f; 0x61, 0x7a; 0xaa, 0xaa; 0xb5, 0xb5; - 0xb7, 0xb7; 0xba, 0xba; 0xc0, 0xd6; 0xd8, 0xf6; 0xf8, 0x2c1; - 0x2c6, 0x2d1; 0x2e0, 0x2e4; 0x2ec, 0x2ec; 0x2ee, 0x2ee; 0x300, 0x374; - 0x376, 0x377; 0x37b, 0x37d; 0x386, 0x38a; 0x38c, 0x38c; 0x38e, 0x3a1; - 0x3a3, 0x3f5; 0x3f7, 0x481; 0x483, 0x487; 0x48a, 0x527; 0x531, 0x556; - 0x559, 0x559; 0x561, 0x587; 0x591, 0x5bd; 0x5bf, 0x5bf; 0x5c1, 0x5c2; - 0x5c4, 0x5c5; 0x5c7, 0x5c7; 0x5d0, 0x5ea; 0x5f0, 0x5f2; 0x610, 0x61a; - 0x620, 0x669; 0x66e, 0x6d3; 0x6d5, 0x6dc; 0x6df, 0x6e8; 0x6ea, 0x6fc; - 0x6ff, 0x6ff; 0x710, 0x74a; 0x74d, 0x7b1; 0x7c0, 0x7f5; 0x7fa, 0x7fa; - 0x800, 0x82d; 0x840, 0x85b; 0x8a0, 0x8a0; 0x8a2, 0x8ac; 0x8e4, 0x8fe; - 0x900, 0x963; 0x966, 0x96f; 0x971, 0x977; 0x979, 0x97f; 0x981, 0x983; - 0x985, 0x98c; 0x98f, 0x990; 0x993, 0x9a8; 0x9aa, 0x9b0; 0x9b2, 0x9b2; - 0x9b6, 0x9b9; 0x9bc, 0x9c4; 0x9c7, 0x9c8; 0x9cb, 0x9ce; 0x9d7, 0x9d7; - 0x9dc, 0x9dd; 0x9df, 0x9e3; 0x9e6, 0x9f1; 0xa01, 0xa03; 0xa05, 0xa0a; - 0xa0f, 0xa10; 0xa13, 0xa28; 0xa2a, 0xa30; 0xa32, 0xa33; 0xa35, 0xa36; - 0xa38, 0xa39; 0xa3c, 0xa3c; 0xa3e, 0xa42; 0xa47, 0xa48; 0xa4b, 0xa4d; - 0xa51, 0xa51; 0xa59, 0xa5c; 0xa5e, 0xa5e; 0xa66, 0xa75; 0xa81, 0xa83; - 0xa85, 0xa8d; 0xa8f, 0xa91; 0xa93, 0xaa8; 0xaaa, 0xab0; 0xab2, 0xab3; - 0xab5, 0xab9; 0xabc, 0xac5; 0xac7, 0xac9; 0xacb, 0xacd; 0xad0, 0xad0; - 0xae0, 0xae3; 0xae6, 0xaef; 0xb01, 0xb03; 0xb05, 0xb0c; 0xb0f, 0xb10; - 0xb13, 0xb28; 0xb2a, 0xb30; 0xb32, 0xb33; 0xb35, 0xb39; 0xb3c, 0xb44; - 0xb47, 0xb48; 0xb4b, 0xb4d; 0xb56, 0xb57; 0xb5c, 0xb5d; 0xb5f, 0xb63; - 0xb66, 0xb6f; 0xb71, 0xb71; 0xb82, 0xb83; 0xb85, 0xb8a; 0xb8e, 0xb90; - 0xb92, 0xb95; 0xb99, 0xb9a; 0xb9c, 0xb9c; 0xb9e, 0xb9f; 0xba3, 0xba4; - 0xba8, 0xbaa; 0xbae, 0xbb9; 0xbbe, 0xbc2; 0xbc6, 0xbc8; 0xbca, 0xbcd; - 0xbd0, 0xbd0; 0xbd7, 0xbd7; 0xbe6, 0xbef; 0xc01, 0xc03; 0xc05, 0xc0c; - 0xc0e, 0xc10; 0xc12, 0xc28; 0xc2a, 0xc33; 0xc35, 0xc39; 0xc3d, 0xc44; - 0xc46, 0xc48; 0xc4a, 0xc4d; 0xc55, 0xc56; 0xc58, 0xc59; 0xc60, 0xc63; - 0xc66, 0xc6f; 0xc82, 0xc83; 0xc85, 0xc8c; 0xc8e, 0xc90; 0xc92, 0xca8; - 0xcaa, 0xcb3; 0xcb5, 0xcb9; 0xcbc, 0xcc4; 0xcc6, 0xcc8; 0xcca, 0xccd; - 0xcd5, 0xcd6; 0xcde, 0xcde; 0xce0, 0xce3; 0xce6, 0xcef; 0xcf1, 0xcf2; - 0xd02, 0xd03; 0xd05, 0xd0c; 0xd0e, 0xd10; 0xd12, 0xd3a; 0xd3d, 0xd44; - 0xd46, 0xd48; 0xd4a, 0xd4e; 0xd57, 0xd57; 0xd60, 0xd63; 0xd66, 0xd6f; - 0xd7a, 0xd7f; 0xd82, 0xd83; 0xd85, 0xd96; 0xd9a, 0xdb1; 0xdb3, 0xdbb; - 0xdbd, 0xdbd; 0xdc0, 0xdc6; 0xdca, 0xdca; 0xdcf, 0xdd4; 0xdd6, 0xdd6; - 0xdd8, 0xddf; 0xdf2, 0xdf3; 0xe01, 0xe3a; 0xe40, 0xe4e; 0xe50, 0xe59; - 0xe81, 0xe82; 0xe84, 0xe84; 0xe87, 0xe88; 0xe8a, 0xe8a; 0xe8d, 0xe8d; - 0xe94, 0xe97; 0xe99, 0xe9f; 0xea1, 0xea3; 0xea5, 0xea5; 0xea7, 0xea7; - 0xeaa, 0xeab; 0xead, 0xeb9; 0xebb, 0xebd; 0xec0, 0xec4; 0xec6, 0xec6; - 0xec8, 0xecd; 0xed0, 0xed9; 0xedc, 0xedf; 0xf00, 0xf00; 0xf18, 0xf19; - 0xf20, 0xf29; 0xf35, 0xf35; 0xf37, 0xf37; 0xf39, 0xf39; 0xf3e, 0xf47; - 0xf49, 0xf6c; 0xf71, 0xf84; 0xf86, 0xf97; 0xf99, 0xfbc; 0xfc6, 0xfc6; - 0x1000, 0x1049; 0x1050, 0x109d; 0x10a0, 0x10c5; 0x10c7, 0x10c7; - 0x10cd, 0x10cd; 0x10d0, 0x10fa; 0x10fc, 0x1248; 0x124a, 0x124d; - 0x1250, 0x1256; 0x1258, 0x1258; 0x125a, 0x125d; 0x1260, 0x1288; - 0x128a, 0x128d; 0x1290, 0x12b0; 0x12b2, 0x12b5; 0x12b8, 0x12be; - 0x12c0, 0x12c0; 0x12c2, 0x12c5; 0x12c8, 0x12d6; 0x12d8, 0x1310; - 0x1312, 0x1315; 0x1318, 0x135a; 0x135d, 0x135f; 0x1369, 0x1371; - 0x1380, 0x138f; 0x13a0, 0x13f4; 0x1401, 0x166c; 0x166f, 0x167f; - 0x1681, 0x169a; 0x16a0, 0x16ea; 0x16ee, 0x16f0; 0x1700, 0x170c; - 0x170e, 0x1714; 0x1720, 0x1734; 0x1740, 0x1753; 0x1760, 0x176c; - 0x176e, 0x1770; 0x1772, 0x1773; 0x1780, 0x17d3; 0x17d7, 0x17d7; - 0x17dc, 0x17dd; 0x17e0, 0x17e9; 0x180b, 0x180d; 0x1810, 0x1819; - 0x1820, 0x1877; 0x1880, 0x18aa; 0x18b0, 0x18f5; 0x1900, 0x191c; - 0x1920, 0x192b; 0x1930, 0x193b; 0x1946, 0x196d; 0x1970, 0x1974; - 0x1980, 0x19ab; 0x19b0, 0x19c9; 0x19d0, 0x19da; 0x1a00, 0x1a1b; - 0x1a20, 0x1a5e; 0x1a60, 0x1a7c; 0x1a7f, 0x1a89; 0x1a90, 0x1a99; - 0x1aa7, 0x1aa7; 0x1b00, 0x1b4b; 0x1b50, 0x1b59; 0x1b6b, 0x1b73; - 0x1b80, 0x1bf3; 0x1c00, 0x1c37; 0x1c40, 0x1c49; 0x1c4d, 0x1c7d; - 0x1cd0, 0x1cd2; 0x1cd4, 0x1cf6; 0x1d00, 0x1de6; 0x1dfc, 0x1f15; - 0x1f18, 0x1f1d; 0x1f20, 0x1f45; 0x1f48, 0x1f4d; 0x1f50, 0x1f57; - 0x1f59, 0x1f59; 0x1f5b, 0x1f5b; 0x1f5d, 0x1f5d; 0x1f5f, 0x1f7d; - 0x1f80, 0x1fb4; 0x1fb6, 0x1fbc; 0x1fbe, 0x1fbe; 0x1fc2, 0x1fc4; - 0x1fc6, 0x1fcc; 0x1fd0, 0x1fd3; 0x1fd6, 0x1fdb; 0x1fe0, 0x1fec; - 0x1ff2, 0x1ff4; 0x1ff6, 0x1ffc; 0x203f, 0x2040; 0x2054, 0x2054; - 0x2071, 0x2071; 0x207f, 0x207f; 0x2090, 0x209c; 0x20d0, 0x20dc; - 0x20e1, 0x20e1; 0x20e5, 0x20f0; 0x2102, 0x2102; 0x2107, 0x2107; - 0x210a, 0x2113; 0x2115, 0x2115; 0x2118, 0x211d; 0x2124, 0x2124; - 0x2126, 0x2126; 0x2128, 0x2128; 0x212a, 0x2139; 0x213c, 0x213f; - 0x2145, 0x2149; 0x214e, 0x214e; 0x2160, 0x2188; 0x2c00, 0x2c2e; - 0x2c30, 0x2c5e; 0x2c60, 0x2ce4; 0x2ceb, 0x2cf3; 0x2d00, 0x2d25; - 0x2d27, 0x2d27; 0x2d2d, 0x2d2d; 0x2d30, 0x2d67; 0x2d6f, 0x2d6f; - 0x2d7f, 0x2d96; 0x2da0, 0x2da6; 0x2da8, 0x2dae; 0x2db0, 0x2db6; - 0x2db8, 0x2dbe; 0x2dc0, 0x2dc6; 0x2dc8, 0x2dce; 0x2dd0, 0x2dd6; - 0x2dd8, 0x2dde; 0x2de0, 0x2dff; 0x3005, 0x3007; 0x3021, 0x302f; - 0x3031, 0x3035; 0x3038, 0x303c; 0x3041, 0x3096; 0x3099, 0x309a; - 0x309d, 0x309f; 0x30a1, 0x30fa; 0x30fc, 0x30ff; 0x3105, 0x312d; - 0x3131, 0x318e; 0x31a0, 0x31ba; 0x31f0, 0x31ff; 0x3400, 0x4db5; - 0x4e00, 0x9fcc; 0xa000, 0xa48c; 0xa4d0, 0xa4fd; 0xa500, 0xa60c; - 0xa610, 0xa62b; 0xa640, 0xa66f; 0xa674, 0xa67d; 0xa67f, 0xa697; - 0xa69f, 0xa6f1; 0xa717, 0xa71f; 0xa722, 0xa788; 0xa78b, 0xa78e; - 0xa790, 0xa793; 0xa7a0, 0xa7aa; 0xa7f8, 0xa827; 0xa840, 0xa873; - 0xa880, 0xa8c4; 0xa8d0, 0xa8d9; 0xa8e0, 0xa8f7; 0xa8fb, 0xa8fb; - 0xa900, 0xa92d; 0xa930, 0xa953; 0xa960, 0xa97c; 0xa980, 0xa9c0; - 0xa9cf, 0xa9d9; 0xaa00, 0xaa36; 0xaa40, 0xaa4d; 0xaa50, 0xaa59; - 0xaa60, 0xaa76; 0xaa7a, 0xaa7b; 0xaa80, 0xaac2; 0xaadb, 0xaadd; - 0xaae0, 0xaaef; 0xaaf2, 0xaaf6; 0xab01, 0xab06; 0xab09, 0xab0e; - 0xab11, 0xab16; 0xab20, 0xab26; 0xab28, 0xab2e; 0xabc0, 0xabea; - 0xabec, 0xabed; 0xabf0, 0xabf9; 0xac00, 0xd7a3; 0xd7b0, 0xd7c6; - 0xd7cb, 0xd7fb; 0xf900, 0xfa6d; 0xfa70, 0xfad9; 0xfb00, 0xfb06; - 0xfb13, 0xfb17; 0xfb1d, 0xfb28; 0xfb2a, 0xfb36; 0xfb38, 0xfb3c; - 0xfb3e, 0xfb3e; 0xfb40, 0xfb41; 0xfb43, 0xfb44; 0xfb46, 0xfbb1; - 0xfbd3, 0xfc5d; 0xfc64, 0xfd3d; 0xfd50, 0xfd8f; 0xfd92, 0xfdc7; - 0xfdf0, 0xfdf9; 0xfe00, 0xfe0f; 0xfe20, 0xfe26; 0xfe33, 0xfe34; - 0xfe4d, 0xfe4f; 0xfe71, 0xfe71; 0xfe73, 0xfe73; 0xfe77, 0xfe77; - 0xfe79, 0xfe79; 0xfe7b, 0xfe7b; 0xfe7d, 0xfe7d; 0xfe7f, 0xfefc; - 0xff10, 0xff19; 0xff21, 0xff3a; 0xff3f, 0xff3f; 0xff41, 0xff5a; - 0xff66, 0xffbe; 0xffc2, 0xffc7; 0xffca, 0xffcf; 0xffd2, 0xffd7; - 0xffda, 0xffdc; 0x10000, 0x1000b; 0x1000d, 0x10026; 0x10028, 0x1003a; - 0x1003c, 0x1003d; 0x1003f, 0x1004d; 0x10050, 0x1005d; 0x10080, 0x100fa; - 0x10140, 0x10174; 0x101fd, 0x101fd; 0x10280, 0x1029c; 0x102a0, 0x102d0; - 0x10300, 0x1031e; 0x10330, 0x1034a; 0x10380, 0x1039d; 0x103a0, 0x103c3; - 0x103c8, 0x103cf; 0x103d1, 0x103d5; 0x10400, 0x1049d; 0x104a0, 0x104a9; - 0x10800, 0x10805; 0x10808, 0x10808; 0x1080a, 0x10835; 0x10837, 0x10838; - 0x1083c, 0x1083c; 0x1083f, 0x10855; 0x10900, 0x10915; 0x10920, 0x10939; - 0x10980, 0x109b7; 0x109be, 0x109bf; 0x10a00, 0x10a03; 0x10a05, 0x10a06; - 0x10a0c, 0x10a13; 0x10a15, 0x10a17; 0x10a19, 0x10a33; 0x10a38, 0x10a3a; - 0x10a3f, 0x10a3f; 0x10a60, 0x10a7c; 0x10b00, 0x10b35; 0x10b40, 0x10b55; - 0x10b60, 0x10b72; 0x10c00, 0x10c48; 0x11000, 0x11046; 0x11066, 0x1106f; - 0x11080, 0x110ba; 0x110d0, 0x110e8; 0x110f0, 0x110f9; 0x11100, 0x11134; - 0x11136, 0x1113f; 0x11180, 0x111c4; 0x111d0, 0x111d9; 0x11680, 0x116b7; - 0x116c0, 0x116c9; 0x12000, 0x1236e; 0x12400, 0x12462; 0x13000, 0x1342e; - 0x16800, 0x16a38; 0x16f00, 0x16f44; 0x16f50, 0x16f7e; 0x16f8f, 0x16f9f; - 0x1b000, 0x1b001; 0x1d165, 0x1d169; 0x1d16d, 0x1d172; 0x1d17b, 0x1d182; - 0x1d185, 0x1d18b; 0x1d1aa, 0x1d1ad; 0x1d242, 0x1d244; 0x1d400, 0x1d454; - 0x1d456, 0x1d49c; 0x1d49e, 0x1d49f; 0x1d4a2, 0x1d4a2; 0x1d4a5, 0x1d4a6; - 0x1d4a9, 0x1d4ac; 0x1d4ae, 0x1d4b9; 0x1d4bb, 0x1d4bb; 0x1d4bd, 0x1d4c3; - 0x1d4c5, 0x1d505; 0x1d507, 0x1d50a; 0x1d50d, 0x1d514; 0x1d516, 0x1d51c; - 0x1d51e, 0x1d539; 0x1d53b, 0x1d53e; 0x1d540, 0x1d544; 0x1d546, 0x1d546; - 0x1d54a, 0x1d550; 0x1d552, 0x1d6a5; 0x1d6a8, 0x1d6c0; 0x1d6c2, 0x1d6da; - 0x1d6dc, 0x1d6fa; 0x1d6fc, 0x1d714; 0x1d716, 0x1d734; 0x1d736, 0x1d74e; - 0x1d750, 0x1d76e; 0x1d770, 0x1d788; 0x1d78a, 0x1d7a8; 0x1d7aa, 0x1d7c2; - 0x1d7c4, 0x1d7cb; 0x1d7ce, 0x1d7ff; 0x1ee00, 0x1ee03; 0x1ee05, 0x1ee1f; - 0x1ee21, 0x1ee22; 0x1ee24, 0x1ee24; 0x1ee27, 0x1ee27; 0x1ee29, 0x1ee32; - 0x1ee34, 0x1ee37; 0x1ee39, 0x1ee39; 0x1ee3b, 0x1ee3b; 0x1ee42, 0x1ee42; - 0x1ee47, 0x1ee47; 0x1ee49, 0x1ee49; 0x1ee4b, 0x1ee4b; 0x1ee4d, 0x1ee4f; - 0x1ee51, 0x1ee52; 0x1ee54, 0x1ee54; 0x1ee57, 0x1ee57; 0x1ee59, 0x1ee59; - 0x1ee5b, 0x1ee5b; 0x1ee5d, 0x1ee5d; 0x1ee5f, 0x1ee5f; 0x1ee61, 0x1ee62; - 0x1ee64, 0x1ee64; 0x1ee67, 0x1ee6a; 0x1ee6c, 0x1ee72; 0x1ee74, 0x1ee77; - 0x1ee79, 0x1ee7c; 0x1ee7e, 0x1ee7e; 0x1ee80, 0x1ee89; 0x1ee8b, 0x1ee9b; - 0x1eea1, 0x1eea3; 0x1eea5, 0x1eea9; 0x1eeab, 0x1eebb; 0x20000, 0x2a6d6; - 0x2a700, 0x2b734; 0x2b740, 0x2b81d; 0x2f800, 0x2fa1d; 0xe0100, 0xe01ef] - - let xid_start = - [0x41, 0x5a; 0x61, 0x7a; 0xaa, 0xaa; 0xb5, 0xb5; 0xba, 0xba; 0xc0, 0xd6; - 0xd8, 0xf6; 0xf8, 0x2c1; 0x2c6, 0x2d1; 0x2e0, 0x2e4; 0x2ec, 0x2ec; - 0x2ee, 0x2ee; 0x370, 0x374; 0x376, 0x377; 0x37b, 0x37d; 0x386, 0x386; - 0x388, 0x38a; 0x38c, 0x38c; 0x38e, 0x3a1; 0x3a3, 0x3f5; 0x3f7, 0x481; - 0x48a, 0x527; 0x531, 0x556; 0x559, 0x559; 0x561, 0x587; 0x5d0, 0x5ea; - 0x5f0, 0x5f2; 0x620, 0x64a; 0x66e, 0x66f; 0x671, 0x6d3; 0x6d5, 0x6d5; - 0x6e5, 0x6e6; 0x6ee, 0x6ef; 0x6fa, 0x6fc; 0x6ff, 0x6ff; 0x710, 0x710; - 0x712, 0x72f; 0x74d, 0x7a5; 0x7b1, 0x7b1; 0x7ca, 0x7ea; 0x7f4, 0x7f5; - 0x7fa, 0x7fa; 0x800, 0x815; 0x81a, 0x81a; 0x824, 0x824; 0x828, 0x828; - 0x840, 0x858; 0x8a0, 0x8a0; 0x8a2, 0x8ac; 0x904, 0x939; 0x93d, 0x93d; - 0x950, 0x950; 0x958, 0x961; 0x971, 0x977; 0x979, 0x97f; 0x985, 0x98c; - 0x98f, 0x990; 0x993, 0x9a8; 0x9aa, 0x9b0; 0x9b2, 0x9b2; 0x9b6, 0x9b9; - 0x9bd, 0x9bd; 0x9ce, 0x9ce; 0x9dc, 0x9dd; 0x9df, 0x9e1; 0x9f0, 0x9f1; - 0xa05, 0xa0a; 0xa0f, 0xa10; 0xa13, 0xa28; 0xa2a, 0xa30; 0xa32, 0xa33; - 0xa35, 0xa36; 0xa38, 0xa39; 0xa59, 0xa5c; 0xa5e, 0xa5e; 0xa72, 0xa74; - 0xa85, 0xa8d; 0xa8f, 0xa91; 0xa93, 0xaa8; 0xaaa, 0xab0; 0xab2, 0xab3; - 0xab5, 0xab9; 0xabd, 0xabd; 0xad0, 0xad0; 0xae0, 0xae1; 0xb05, 0xb0c; - 0xb0f, 0xb10; 0xb13, 0xb28; 0xb2a, 0xb30; 0xb32, 0xb33; 0xb35, 0xb39; - 0xb3d, 0xb3d; 0xb5c, 0xb5d; 0xb5f, 0xb61; 0xb71, 0xb71; 0xb83, 0xb83; - 0xb85, 0xb8a; 0xb8e, 0xb90; 0xb92, 0xb95; 0xb99, 0xb9a; 0xb9c, 0xb9c; - 0xb9e, 0xb9f; 0xba3, 0xba4; 0xba8, 0xbaa; 0xbae, 0xbb9; 0xbd0, 0xbd0; - 0xc05, 0xc0c; 0xc0e, 0xc10; 0xc12, 0xc28; 0xc2a, 0xc33; 0xc35, 0xc39; - 0xc3d, 0xc3d; 0xc58, 0xc59; 0xc60, 0xc61; 0xc85, 0xc8c; 0xc8e, 0xc90; - 0xc92, 0xca8; 0xcaa, 0xcb3; 0xcb5, 0xcb9; 0xcbd, 0xcbd; 0xcde, 0xcde; - 0xce0, 0xce1; 0xcf1, 0xcf2; 0xd05, 0xd0c; 0xd0e, 0xd10; 0xd12, 0xd3a; - 0xd3d, 0xd3d; 0xd4e, 0xd4e; 0xd60, 0xd61; 0xd7a, 0xd7f; 0xd85, 0xd96; - 0xd9a, 0xdb1; 0xdb3, 0xdbb; 0xdbd, 0xdbd; 0xdc0, 0xdc6; 0xe01, 0xe30; - 0xe32, 0xe32; 0xe40, 0xe46; 0xe81, 0xe82; 0xe84, 0xe84; 0xe87, 0xe88; - 0xe8a, 0xe8a; 0xe8d, 0xe8d; 0xe94, 0xe97; 0xe99, 0xe9f; 0xea1, 0xea3; - 0xea5, 0xea5; 0xea7, 0xea7; 0xeaa, 0xeab; 0xead, 0xeb0; 0xeb2, 0xeb2; - 0xebd, 0xebd; 0xec0, 0xec4; 0xec6, 0xec6; 0xedc, 0xedf; 0xf00, 0xf00; - 0xf40, 0xf47; 0xf49, 0xf6c; 0xf88, 0xf8c; 0x1000, 0x102a; 0x103f, 0x103f; - 0x1050, 0x1055; 0x105a, 0x105d; 0x1061, 0x1061; 0x1065, 0x1066; - 0x106e, 0x1070; 0x1075, 0x1081; 0x108e, 0x108e; 0x10a0, 0x10c5; - 0x10c7, 0x10c7; 0x10cd, 0x10cd; 0x10d0, 0x10fa; 0x10fc, 0x1248; - 0x124a, 0x124d; 0x1250, 0x1256; 0x1258, 0x1258; 0x125a, 0x125d; - 0x1260, 0x1288; 0x128a, 0x128d; 0x1290, 0x12b0; 0x12b2, 0x12b5; - 0x12b8, 0x12be; 0x12c0, 0x12c0; 0x12c2, 0x12c5; 0x12c8, 0x12d6; - 0x12d8, 0x1310; 0x1312, 0x1315; 0x1318, 0x135a; 0x1380, 0x138f; - 0x13a0, 0x13f4; 0x1401, 0x166c; 0x166f, 0x167f; 0x1681, 0x169a; - 0x16a0, 0x16ea; 0x16ee, 0x16f0; 0x1700, 0x170c; 0x170e, 0x1711; - 0x1720, 0x1731; 0x1740, 0x1751; 0x1760, 0x176c; 0x176e, 0x1770; - 0x1780, 0x17b3; 0x17d7, 0x17d7; 0x17dc, 0x17dc; 0x1820, 0x1877; - 0x1880, 0x18a8; 0x18aa, 0x18aa; 0x18b0, 0x18f5; 0x1900, 0x191c; - 0x1950, 0x196d; 0x1970, 0x1974; 0x1980, 0x19ab; 0x19c1, 0x19c7; - 0x1a00, 0x1a16; 0x1a20, 0x1a54; 0x1aa7, 0x1aa7; 0x1b05, 0x1b33; - 0x1b45, 0x1b4b; 0x1b83, 0x1ba0; 0x1bae, 0x1baf; 0x1bba, 0x1be5; - 0x1c00, 0x1c23; 0x1c4d, 0x1c4f; 0x1c5a, 0x1c7d; 0x1ce9, 0x1cec; - 0x1cee, 0x1cf1; 0x1cf5, 0x1cf6; 0x1d00, 0x1dbf; 0x1e00, 0x1f15; - 0x1f18, 0x1f1d; 0x1f20, 0x1f45; 0x1f48, 0x1f4d; 0x1f50, 0x1f57; - 0x1f59, 0x1f59; 0x1f5b, 0x1f5b; 0x1f5d, 0x1f5d; 0x1f5f, 0x1f7d; - 0x1f80, 0x1fb4; 0x1fb6, 0x1fbc; 0x1fbe, 0x1fbe; 0x1fc2, 0x1fc4; - 0x1fc6, 0x1fcc; 0x1fd0, 0x1fd3; 0x1fd6, 0x1fdb; 0x1fe0, 0x1fec; - 0x1ff2, 0x1ff4; 0x1ff6, 0x1ffc; 0x2071, 0x2071; 0x207f, 0x207f; - 0x2090, 0x209c; 0x2102, 0x2102; 0x2107, 0x2107; 0x210a, 0x2113; - 0x2115, 0x2115; 0x2118, 0x211d; 0x2124, 0x2124; 0x2126, 0x2126; - 0x2128, 0x2128; 0x212a, 0x2139; 0x213c, 0x213f; 0x2145, 0x2149; - 0x214e, 0x214e; 0x2160, 0x2188; 0x2c00, 0x2c2e; 0x2c30, 0x2c5e; - 0x2c60, 0x2ce4; 0x2ceb, 0x2cee; 0x2cf2, 0x2cf3; 0x2d00, 0x2d25; - 0x2d27, 0x2d27; 0x2d2d, 0x2d2d; 0x2d30, 0x2d67; 0x2d6f, 0x2d6f; - 0x2d80, 0x2d96; 0x2da0, 0x2da6; 0x2da8, 0x2dae; 0x2db0, 0x2db6; - 0x2db8, 0x2dbe; 0x2dc0, 0x2dc6; 0x2dc8, 0x2dce; 0x2dd0, 0x2dd6; - 0x2dd8, 0x2dde; 0x3005, 0x3007; 0x3021, 0x3029; 0x3031, 0x3035; - 0x3038, 0x303c; 0x3041, 0x3096; 0x309d, 0x309f; 0x30a1, 0x30fa; - 0x30fc, 0x30ff; 0x3105, 0x312d; 0x3131, 0x318e; 0x31a0, 0x31ba; - 0x31f0, 0x31ff; 0x3400, 0x4db5; 0x4e00, 0x9fcc; 0xa000, 0xa48c; - 0xa4d0, 0xa4fd; 0xa500, 0xa60c; 0xa610, 0xa61f; 0xa62a, 0xa62b; - 0xa640, 0xa66e; 0xa67f, 0xa697; 0xa6a0, 0xa6ef; 0xa717, 0xa71f; - 0xa722, 0xa788; 0xa78b, 0xa78e; 0xa790, 0xa793; 0xa7a0, 0xa7aa; - 0xa7f8, 0xa801; 0xa803, 0xa805; 0xa807, 0xa80a; 0xa80c, 0xa822; - 0xa840, 0xa873; 0xa882, 0xa8b3; 0xa8f2, 0xa8f7; 0xa8fb, 0xa8fb; - 0xa90a, 0xa925; 0xa930, 0xa946; 0xa960, 0xa97c; 0xa984, 0xa9b2; - 0xa9cf, 0xa9cf; 0xaa00, 0xaa28; 0xaa40, 0xaa42; 0xaa44, 0xaa4b; - 0xaa60, 0xaa76; 0xaa7a, 0xaa7a; 0xaa80, 0xaaaf; 0xaab1, 0xaab1; - 0xaab5, 0xaab6; 0xaab9, 0xaabd; 0xaac0, 0xaac0; 0xaac2, 0xaac2; - 0xaadb, 0xaadd; 0xaae0, 0xaaea; 0xaaf2, 0xaaf4; 0xab01, 0xab06; - 0xab09, 0xab0e; 0xab11, 0xab16; 0xab20, 0xab26; 0xab28, 0xab2e; - 0xabc0, 0xabe2; 0xac00, 0xd7a3; 0xd7b0, 0xd7c6; 0xd7cb, 0xd7fb; - 0xf900, 0xfa6d; 0xfa70, 0xfad9; 0xfb00, 0xfb06; 0xfb13, 0xfb17; - 0xfb1d, 0xfb1d; 0xfb1f, 0xfb28; 0xfb2a, 0xfb36; 0xfb38, 0xfb3c; - 0xfb3e, 0xfb3e; 0xfb40, 0xfb41; 0xfb43, 0xfb44; 0xfb46, 0xfbb1; - 0xfbd3, 0xfc5d; 0xfc64, 0xfd3d; 0xfd50, 0xfd8f; 0xfd92, 0xfdc7; - 0xfdf0, 0xfdf9; 0xfe71, 0xfe71; 0xfe73, 0xfe73; 0xfe77, 0xfe77; - 0xfe79, 0xfe79; 0xfe7b, 0xfe7b; 0xfe7d, 0xfe7d; 0xfe7f, 0xfefc; - 0xff21, 0xff3a; 0xff41, 0xff5a; 0xff66, 0xff9d; 0xffa0, 0xffbe; - 0xffc2, 0xffc7; 0xffca, 0xffcf; 0xffd2, 0xffd7; 0xffda, 0xffdc; - 0x10000, 0x1000b; 0x1000d, 0x10026; 0x10028, 0x1003a; 0x1003c, 0x1003d; - 0x1003f, 0x1004d; 0x10050, 0x1005d; 0x10080, 0x100fa; 0x10140, 0x10174; - 0x10280, 0x1029c; 0x102a0, 0x102d0; 0x10300, 0x1031e; 0x10330, 0x1034a; - 0x10380, 0x1039d; 0x103a0, 0x103c3; 0x103c8, 0x103cf; 0x103d1, 0x103d5; - 0x10400, 0x1049d; 0x10800, 0x10805; 0x10808, 0x10808; 0x1080a, 0x10835; - 0x10837, 0x10838; 0x1083c, 0x1083c; 0x1083f, 0x10855; 0x10900, 0x10915; - 0x10920, 0x10939; 0x10980, 0x109b7; 0x109be, 0x109bf; 0x10a00, 0x10a00; - 0x10a10, 0x10a13; 0x10a15, 0x10a17; 0x10a19, 0x10a33; 0x10a60, 0x10a7c; - 0x10b00, 0x10b35; 0x10b40, 0x10b55; 0x10b60, 0x10b72; 0x10c00, 0x10c48; - 0x11003, 0x11037; 0x11083, 0x110af; 0x110d0, 0x110e8; 0x11103, 0x11126; - 0x11183, 0x111b2; 0x111c1, 0x111c4; 0x11680, 0x116aa; 0x12000, 0x1236e; - 0x12400, 0x12462; 0x13000, 0x1342e; 0x16800, 0x16a38; 0x16f00, 0x16f44; - 0x16f50, 0x16f50; 0x16f93, 0x16f9f; 0x1b000, 0x1b001; 0x1d400, 0x1d454; - 0x1d456, 0x1d49c; 0x1d49e, 0x1d49f; 0x1d4a2, 0x1d4a2; 0x1d4a5, 0x1d4a6; - 0x1d4a9, 0x1d4ac; 0x1d4ae, 0x1d4b9; 0x1d4bb, 0x1d4bb; 0x1d4bd, 0x1d4c3; - 0x1d4c5, 0x1d505; 0x1d507, 0x1d50a; 0x1d50d, 0x1d514; 0x1d516, 0x1d51c; - 0x1d51e, 0x1d539; 0x1d53b, 0x1d53e; 0x1d540, 0x1d544; 0x1d546, 0x1d546; - 0x1d54a, 0x1d550; 0x1d552, 0x1d6a5; 0x1d6a8, 0x1d6c0; 0x1d6c2, 0x1d6da; - 0x1d6dc, 0x1d6fa; 0x1d6fc, 0x1d714; 0x1d716, 0x1d734; 0x1d736, 0x1d74e; - 0x1d750, 0x1d76e; 0x1d770, 0x1d788; 0x1d78a, 0x1d7a8; 0x1d7aa, 0x1d7c2; - 0x1d7c4, 0x1d7cb; 0x1ee00, 0x1ee03; 0x1ee05, 0x1ee1f; 0x1ee21, 0x1ee22; - 0x1ee24, 0x1ee24; 0x1ee27, 0x1ee27; 0x1ee29, 0x1ee32; 0x1ee34, 0x1ee37; - 0x1ee39, 0x1ee39; 0x1ee3b, 0x1ee3b; 0x1ee42, 0x1ee42; 0x1ee47, 0x1ee47; - 0x1ee49, 0x1ee49; 0x1ee4b, 0x1ee4b; 0x1ee4d, 0x1ee4f; 0x1ee51, 0x1ee52; - 0x1ee54, 0x1ee54; 0x1ee57, 0x1ee57; 0x1ee59, 0x1ee59; 0x1ee5b, 0x1ee5b; - 0x1ee5d, 0x1ee5d; 0x1ee5f, 0x1ee5f; 0x1ee61, 0x1ee62; 0x1ee64, 0x1ee64; - 0x1ee67, 0x1ee6a; 0x1ee6c, 0x1ee72; 0x1ee74, 0x1ee77; 0x1ee79, 0x1ee7c; - 0x1ee7e, 0x1ee7e; 0x1ee80, 0x1ee89; 0x1ee8b, 0x1ee9b; 0x1eea1, 0x1eea3; - 0x1eea5, 0x1eea9; 0x1eeab, 0x1eebb; 0x20000, 0x2a6d6; 0x2a700, 0x2b734; - 0x2b740, 0x2b81d; 0x2f800, 0x2fa1d] - -end diff --git a/sedlex-1.99.4/src/syntax/unicode63.mli b/sedlex-1.99.4/src/syntax/unicode63.mli deleted file mode 100644 index b0ab0fb..0000000 --- a/sedlex-1.99.4/src/syntax/unicode63.mli +++ /dev/null @@ -1,54 +0,0 @@ -module Categories : sig - - val cc : Sedlex_cset.t - val cf : Sedlex_cset.t - val cn : Sedlex_cset.t - val co : Sedlex_cset.t - val cs : Sedlex_cset.t - val ll : Sedlex_cset.t - val lm : Sedlex_cset.t - val lo : Sedlex_cset.t - val lt : Sedlex_cset.t - val lu : Sedlex_cset.t - val mc : Sedlex_cset.t - val me : Sedlex_cset.t - val mn : Sedlex_cset.t - val nd : Sedlex_cset.t - val nl : Sedlex_cset.t - val no : Sedlex_cset.t - val pc : Sedlex_cset.t - val pd : Sedlex_cset.t - val pe : Sedlex_cset.t - val pf : Sedlex_cset.t - val pi : Sedlex_cset.t - val po : Sedlex_cset.t - val ps : Sedlex_cset.t - val sc : Sedlex_cset.t - val sk : Sedlex_cset.t - val sm : Sedlex_cset.t - val so : Sedlex_cset.t - val zl : Sedlex_cset.t - val zp : Sedlex_cset.t - val zs : Sedlex_cset.t - -end - -module Properties : sig - - val alphabetic : Sedlex_cset.t - val ascii_hex_digit : Sedlex_cset.t - val hex_digit : Sedlex_cset.t - val id_continue : Sedlex_cset.t - val id_start : Sedlex_cset.t - val lowercase : Sedlex_cset.t - val math : Sedlex_cset.t - val other_alphabetic : Sedlex_cset.t - val other_lowercase : Sedlex_cset.t - val other_math : Sedlex_cset.t - val other_uppercase : Sedlex_cset.t - val uppercase : Sedlex_cset.t - val white_space : Sedlex_cset.t - val xid_continue : Sedlex_cset.t - val xid_start : Sedlex_cset.t - -end